2025-05-03 04:48:12 +08:00

27447 lines
1.0 MiB

(self.webpackChunkxhs_pc_web = self.webpackChunkxhs_pc_web || []).push([["35"], {
88867: function(e, r) {
"use strict";
Object.defineProperty(r, Symbol.toStringTag, {
value: "Module"
});
var i, a, s, u = "webId";
function getCookie(e, r) {
var i = e.match(new RegExp("(^| )".concat(r, "=([^;]*)")));
return i ? unescape(i[2]) : ""
}
function getWebIdFromCookie(e) {
void 0 === e && (e = "");
try {
return getCookie(e, u)
} catch (e) {
return ""
}
}
var c = "xhs_ab_local_storage_key";
r.ABTestStatus = void 0,
(i = r.ABTestStatus || (r.ABTestStatus = {})).Finish = "finish",
i.Pending = "pending",
i.Failed = "failed",
r.RequestStatus = void 0,
(a = r.RequestStatus || (r.RequestStatus = {})).failed = "failed",
a.success = "success",
a.noReq = "noReq",
r.ABDataSource = void 0,
(s = r.ABDataSource || (r.ABDataSource = {})).DefaultValue = "defaultValue",
s.Api = "api",
s.Cache = "cache";
r.ABTEST_CFG_KEY = "red_abTest_config",
r.USER_ID_KEY = "x-user-id",
r.WEB_ID_KEY = u,
r.getCookie = getCookie,
r.getDate = function() {
var e = new Date
, r = e.getFullYear().toString()
, i = (e.getMonth() + 1).toString().padStart(2, "0")
, a = e.getDate().toString().padStart(2, "0");
return "".concat(r, "-").concat(i, "-").concat(a)
}
,
r.getPublicUrl = function(e, r, i) {
void 0 === r && (r = !1),
void 0 === i && (i = "web");
var a = "/api/sns/".concat(i, "/racing_get")
, s = "prod" === e ? "" : "".concat(e || "beta", ".");
s = "";
var u = "//edith.".concat("").concat(s, "xiaohongshu.com");
return "".concat("").concat(u).concat(a)
}
,
r.getWebIdFromCookie = getWebIdFromCookie,
r.getXHSABTestFlag = function() {
try {
var e = localStorage.getItem(c);
return JSON.parse(e)
} catch (e) {
console.error("get localStorage error!!!", e)
}
return null
}
,
r.setXHSABTestFlag = function(e) {
try {
var r = JSON.stringify(e);
return localStorage.setItem(c, r),
!0
} catch (e) {
return console.error("set localStorage error!!!", e),
!1
}
}
},
36757: function(e, r, i) {
"use strict";
i.d(r, {
Lg: function() {
return toJsStyle
},
cJ: function() {
return toPythonStyle
}
});
let a = /^[A-Z_]{2,}$/
, s = /^[A-Z_1-9]{2,}$/
, u = /^(_*)(.*?)(_*)$/;
function isConst(e) {
return a.test(e)
}
function isConstWithNumber(e) {
return s.test(e)
}
function commonConvert(e, r) {
return isConstWithNumber(e) ? e : e.replace(u, (e, i, a, s) => {
let u = r(a);
return `${i}${u}${s}`
}
)
}
function stringTransform_underscoreCase(e, r={}) {
let i = r.separateNumber || !1;
return commonConvert(e, e => {
let r = i ? /[A-Z]|[\d]+|h5/g : /[A-Z]|h5/g
, s = []
, u = e.length
, c = 0
, l = r.exec(e);
for (!l && s.push(e); l; ) {
let i = l.index
, a = e.substring(c, l.index);
if (s.push(a),
c = i,
!(l = r.exec(e))) {
let r = e.substring(i, u);
s.push(r)
}
}
return s.filter(e => e).map( (e, r) => {
var i;
return 0 === r || (i = e,
a.test(i)) ? e : e.replace(/^[A-Z]/, e => e.toLowerCase())
}
).join("_")
}
)
}
function stringTransform_camelCase(e) {
return commonConvert(e, e => e.split("_").filter(e => e).map( (e, r) => {
var i;
return 0 === r || (i = e,
a.test(i)) ? e : e.replace(/^[a-z]/, e => e.toUpperCase())
}
).join(""))
}
function isObjectOrArray(e) {
return "object" == typeof e && ("[object Object]" === Object.prototype.toString.call(e) || Array.isArray(e))
}
function handleProp(e, r, i, a) {
return isObjectOrArray(e) ? a(e, r, i) : e
}
function handleKey(e, r, i) {
return r(e, i)
}
function handleSource(e, r, i) {
let a = Array.isArray(e)
, s = a ? [] : {};
for (let u in e)
if (e.hasOwnProperty(u)) {
let c = a ? u : handleKey(u, r, i)
, l = handleProp(e[u], r, i, handleSource);
s[c] = l
}
return s
}
function toSomeStyle(e, r, i) {
if (!isObjectOrArray(e))
return e;
let a = "function" == typeof r ? r : void 0
, s = handleSource(e, i, "object" == typeof r ? r : void 0);
return a ? a(s) : s
}
function toJsStyle(e, r) {
return toSomeStyle(e, r, stringTransform_camelCase)
}
function toPythonStyle(e, r) {
return toSomeStyle(e, r, stringTransform_underscoreCase)
}
},
40122: function(e, r, i) {
"use strict";
let a;
function postApiSnsWebV1LoginQrcodeCreate(e, r={}) {
return r.summary = "web登录-创建二维码",
a.post("/api/sns/web/v1/login/qrcode/create", e, r)
}
function getApiSnsWebV1LoginQrcodeStatus(e={}) {
return e.summary = "web登录-获取二维码状态",
a.get("/api/sns/web/v1/login/qrcode/status", e)
}
function postApiSnsWebV1LoginActivate(e, r={}) {
return r.summary = "web登录-用户激活",
a.post("/api/sns/web/v1/login/activate", e, r)
}
function getApiSnsWebV1LoginLogout(e={}) {
return e.summary = "web登录-用户退登",
a.get("/api/sns/web/v1/login/logout", e)
}
function getApiSnsWebV1LoginSendCode(e={}) {
return e.summary = "web登录-发送验证码",
a.get("/api/sns/web/v1/login/send_code", e)
}
function getApiSnsWebV1LoginCheckCode(e={}) {
return e.summary = "web登录-验证验证码",
a.get("/api/sns/web/v1/login/check_code", e)
}
function postApiSnsWebV1LoginCode(e, r={}) {
return r.summary = "web登录-验证码登录",
a.post("/api/sns/web/v1/login/code", e, r)
}
function getApiSnsWebV1GetLikedNum(e={}) {
return e.summary = "【web】获取登录后的真实点赞数",
a.get("/api/sns/web/v1/get_liked_num", e)
}
function postApiSnsWebV1Homefeed(e, r={}) {
return r.summary = "【web】- homefeed",
a.post("/api/sns/web/v1/homefeed", e, r)
}
function postApiSnsWebV1Feed(e, r={}) {
return r.summary = "【web】- feed",
a.post("/api/sns/web/v1/feed", e, r)
}
function postApiSnsWebV1NoteUncollect(e, r={}) {
return r.summary = "web笔记取消收藏",
a.post("/api/sns/web/v1/note/uncollect", e, r)
}
function postApiSnsWebV1NoteCollect(e, r={}) {
return r.summary = "web笔记收藏",
a.post("/api/sns/web/v1/note/collect", e, r)
}
function postApiSnsWebV1NoteDislike(e, r={}) {
return r.summary = "WEB-笔记取消点赞",
a.post("/api/sns/web/v1/note/dislike", e, r)
}
function postApiSnsWebV1NoteLike(e, r={}) {
return r.level = "S2",
r.summary = "WEB-笔记点赞",
a.post("/api/sns/web/v1/note/like", e, r)
}
function getApiImRedmojiVersion(e={}) {
return e.summary = "web 表情列表 版本",
a.get("/api/im/redmoji/version", e)
}
function getApiImRedmojiDetail(e={}) {
return e.summary = "web 表情列表",
a.get("/api/im/redmoji/detail", e)
}
function postApiSnsWebV1CommentDelete(e, r={}) {
return r.summary = "web-删除评论",
a.post("/api/sns/web/v1/comment/delete", e, r)
}
function postApiSnsWebV1CommentPost(e, r={}) {
return r.summary = "web-创建评论",
a.post("/api/sns/web/v1/comment/post", e, r)
}
function postApiSnsWebV1CommentDislike(e, r={}) {
return r.summary = "web-评论取消点赞",
a.post("/api/sns/web/v1/comment/dislike", e, r)
}
function postApiSnsWebV1CommentLike(e, r={}) {
return r.summary = "web-评论点赞",
a.post("/api/sns/web/v1/comment/like", e, r)
}
function getApiSnsWebV1IntimacyIntimacyList(e={}) {
return e.summary = "web At用户列表",
a.get("/api/sns/web/v1/intimacy/intimacy_list", e)
}
function getApiSnsWebV1IntimacyIntimacyListSearch(e={}) {
return e.summary = "web查询At搜索用户",
a.get("/api/sns/web/v1/intimacy/intimacy_list/search", e)
}
function postApiSnsWebV1UserFollow(e, r={}) {
return r.summary = "web 用户关注",
a.post("/api/sns/web/v1/user/follow", e, r)
}
function postApiSnsWebV1UserUnfollow(e, r={}) {
return r.summary = "web 用户取消关注",
a.post("/api/sns/web/v1/user/unfollow", e, r)
}
function getApiSnsWebV2CommentSubPage(e={}) {
return e.summary = "web-查询二级评论",
a.get("/api/sns/web/v2/comment/sub/page", e)
}
function getApiSnsWebV2CommentPage(e={}) {
return e.summary = "web-查询一级评论列表",
a.get("/api/sns/web/v2/comment/page", e)
}
function getApiSnsWebV1UserSelfinfo(e={}) {
return e.summary = "web个人页",
a.get("/api/sns/web/v1/user/selfinfo", e)
}
function getApiSnsWebV1UserOtherinfo(e={}) {
return e.summary = "web他人页",
a.get("/api/sns/web/v1/user/otherinfo", e)
}
function postApiSnsWebV1NoteMetricsReport(e, r={}) {
return r.level = "S1",
r.summary = "笔记详情页进入和退出时调取的指标上报接口-web",
a.post("/api/sns/web/v1/note/metrics_report", e, r)
}
function getApiSnsWebV2NoteCollectPage(e={}) {
return e.summary = "web-个人页收藏列表",
a.get("/api/sns/web/v2/note/collect/page", e)
}
function getApiSnsWebV1NoteLikePage(e={}) {
return e.summary = "web-个人页点赞列表",
a.get("/api/sns/web/v1/note/like/page", e)
}
function getApiSnsWebV1HomefeedCategory(e={}) {
return e.summary = "【web】- homefeed_category",
a.get("/api/sns/web/v1/homefeed/category", e)
}
function postApiSnsWebV1Nps(e, r={}) {
return r.summary = "【web】-NPS",
a.post("/api/sns/web/v1/nps", e, r)
}
function postApiSnsWebV1LoginSocial(e, r={}) {
return r.summary = "web端三方登录",
a.post("/api/sns/web/v1/login/social", e, r)
}
function postApiSnsWebV1SearchNotes(e, r={}) {
return r.level = "S1",
r.summary = "web笔记搜索",
a.post("/api/sns/web/v1/search/notes", e, r)
}
function getApiSnsWebV1ResourceLoad(e={}) {
return e.summary = "[web]活动资源位预加载",
a.get("/api/sns/web/v1/resource_load", e)
}
function getApiSnsWebV2UserMe(e={}) {
return e.summary = "web用户-个人信息V2",
a.get("/api/sns/web/v2/user/me", e)
}
function getApiSnsWebV1SearchQuerytrending(e={}) {
return e.summary = "web猜你想搜trending",
a.get("/api/sns/web/v1/search/querytrending", e)
}
function postApiSnsWebV1SearchOnebox(e, r={}) {
return r.summary = "onebox",
a.post("/api/sns/web/v1/search/onebox", e, r)
}
function getApiSnsWebGlobalConfig(e={}) {
return e.summary = "首页全局加载",
a.get("/api/sns/web/global/config", e)
}
function getApiSnsWebV2UserPosted(e={}) {
return e.summary = "【web】- user_posted v2",
a.get("/api/sns/web/v2/user_posted", e)
}
function getApiSnsWebV1UserPosted(e={}) {
return e.summary = "【web】- user_posted",
a.get("/api/sns/web/v1/user_posted", e)
}
function postApiSnsWebV1SearchUsersearch(e, r={}) {
return r.level = "S1",
r.summary = "用户搜索",
a.post("/api/sns/web/v1/search/usersearch", e, r)
}
function getApiSnsWebV1SearchRecommend(e={}) {
return e.level = "S2",
e.summary = "search-recommend",
a.get("/api/sns/web/v1/search/recommend", e)
}
function postApiSnsWebV2LoginCode(e, r={}) {
return r.summary = "web短信验证码登录注册",
a.post("/api/sns/web/v2/login/code", e, r)
}
function postApiSnsWebV1UserInfo(e, r={}) {
return r.summary = "web端编辑资料",
a.post("/api/sns/web/v1/user/info", e, r)
}
function getApiSnsWebV1TagLoginRecommend(e={}) {
return e.summary = "web端获取注册兴趣列表",
a.get("/api/sns/web/v1/tag/login_recommend", e)
}
function postApiSnsWebV1TagFollow(e, r={}) {
return r.summary = "web上报注册兴趣",
a.post("/api/sns/web/v1/tag/follow", e, r)
}
function postApiSnsWebNioFeed(e, r={}) {
return r.summary = "nio笔详feed",
a.post("/api/sns/web/nio/feed", e, r)
}
function postApiSnsWebNioInit(e, r={}) {
return r.summary = "nio视频精选首页",
a.post("/api/sns/web/nio/init", e, r)
}
function postMedusaApiCommunitySourceNew(e, r={}) {
return r.summary = "反馈新增sourceData",
a.post("/medusa/api/community/source/new", e, r)
}
function getApiSnsWebV1SystemConfig(e={}) {
return e.summary = "web系统配置",
a.get("/api/sns/web/v1/system/config", e)
}
function getApiSnsWebV2LoginSendCode(e={}) {
return e.summary = "web登录-发送验证码v2",
a.get("/api/sns/web/v2/login/send_code", e)
}
function postApiSnsWebV1Board(e, r={}) {
return r.summary = "web创建专辑",
a.post("/api/sns/web/v1/board", e, r)
}
function deleteApiSnsWebV1Board(e={}) {
return e.summary = "web删除专辑",
a.del("/api/sns/web/v1/board", e)
}
function putApiSnsWebV1Board(e, r={}) {
return r.summary = "web更新专辑信息",
a.put("/api/sns/web/v1/board", e, r)
}
function getApiSnsWebV1BoardByBoardId(e={}) {
return e.summary = "web获取专辑信息",
a.get("/api/sns/web/v1/board/{boardId}", e)
}
function getApiSnsWebV1BoardUser(e={}) {
return e.summary = "web查询用户的专辑",
a.get("/api/sns/web/v1/board/user", e)
}
function getApiSnsWebV1BoardNote(e={}) {
return e.summary = "web专辑笔记列表",
a.get("/api/sns/web/v1/board/note", e)
}
function postApiSnsWebV1NoteMove(e, r={}) {
return r.summary = "web专辑间移动笔记",
a.post("/api/sns/web/v1/note/move", e, r)
}
function postApiSnsWebV1HomefeedInitialLoad(e, r={}) {
return r.summary = "【web】首刷homefeed ",
a.post("/api/sns/web/v1/homefeed/initial_load", e, r)
}
function postApiSnsWebReportList(e, r={}) {
return r.summary = "web获取举报项",
a.post("/api/sns/web/report/list", e, r)
}
function postApiSnsWebReportSubmit(e, r={}) {
return r.summary = "web提交举报",
a.post("/api/sns/web/report/submit", e, r)
}
function getApiSnsWebV1UserHoverCard(e={}) {
return e.summary = "web hover展示用户卡片",
a.get("/api/sns/web/v1/user/hover_card", e)
}
function getApiSnsWebV1SearchFilter(e={}) {
return e.summary = "web搜索-筛选项",
a.get("/api/sns/web/v1/search/filter", e)
}
i.d(r, {
B1: function() {
return postApiSnsWebV1NoteCollect
},
RZ: function() {
return getApiSnsWebV1NoteLikePage
},
yG: function() {
return postApiSnsWebV2LoginCode
},
JD: function() {
return getApiSnsWebGlobalConfig
},
Iu: function() {
return getApiSnsWebV1ResourceLoad
},
K4: function() {
return getApiSnsWebV1SystemConfig
},
Qy: function() {
return getApiSnsWebV1TagLoginRecommend
},
t8: function() {
return getApiSnsWebV1UserPosted
},
gB: function() {
return getApiSnsWebV1UserSelfinfo
},
y5: function() {
return getApiSnsWebV2LoginSendCode
},
fs: function() {
return getApiSnsWebV2UserMe
},
u3: function() {
return postApiSnsWebReportList
},
F: function() {
return postApiSnsWebV1HomefeedInitialLoad
},
vZ: function() {
return postApiSnsWebV1LoginQrcodeCreate
},
HY: function() {
return postApiSnsWebV1NoteLike
},
d0: function() {
return postApiSnsWebV1NoteMove
},
$5: function() {
return postApiSnsWebV1SearchNotes
},
hb: function() {
return postApiSnsWebNioInit
},
qV: function() {
return postApiSnsWebV1CommentLike
},
Rx: function() {
return postApiSnsWebV1TagFollow
},
R6: function() {
return postApiSnsWebV1UserInfo
},
Ks: function() {
return getApiSnsWebV1BoardNote
},
AM: function() {
return putApiSnsWebV1Board
},
_F: function() {
return postApiSnsWebV1SearchUsersearch
},
tl: function() {
return getApiImRedmojiDetail
},
vW: function() {
return postApiSnsWebV1UserUnfollow
},
IJ: function() {
return getApiSnsWebV1LoginLogout
},
S9: function() {
return getApiSnsWebV2CommentPage
},
al: function() {
return postApiSnsWebV1Nps
},
z1: function() {
return getApiSnsWebV2CommentSubPage
},
p: function() {
return postApiSnsWebV1Homefeed
},
Pm: function() {
return postApiSnsWebV1CommentDelete
},
U_: function() {
return getApiSnsWebV1BoardByBoardId
},
dV: function() {
return deleteApiSnsWebV1Board
},
_d: function() {
return postApiSnsWebV1CommentDislike
},
LN: function() {
return postApiSnsWebV1NoteUncollect
},
js: function() {
return postApiSnsWebV1NoteMetricsReport
},
d9: function() {
return postApiSnsWebV1SearchOnebox
},
UF: function() {
return postApiSnsWebNioFeed
},
b1: function() {
return getApiSnsWebV1SearchFilter
},
jV: function() {
return postApiSnsWebReportSubmit
},
xh: function() {
return postApiSnsWebV1Board
},
ny: function() {
return postApiSnsWebV1NoteDislike
},
EB: function() {
return getApiSnsWebV1LoginSendCode
},
F2: function() {
return getApiSnsWebV1SearchRecommend
},
_Z: function() {
return getApiImRedmojiVersion
},
ho: function() {
return postApiSnsWebV1LoginSocial
},
ng: function() {
return getApiSnsWebV1LoginCheckCode
},
sC: function() {
return postMedusaApiCommunitySourceNew
},
Le: function() {
return getApiSnsWebV1LoginQrcodeStatus
},
B4: function() {
return getApiSnsWebV1GetLikedNum
},
_i: function() {
return getApiSnsWebV1UserHoverCard
},
fg: function() {
return getApiSnsWebV1UserOtherinfo
},
nJ: function() {
return getApiSnsWebV1HomefeedCategory
},
Tt: function() {
return postApiSnsWebV1LoginCode
},
Yf: function() {
return postApiSnsWebV1UserFollow
},
Ff: function() {
return getApiSnsWebV2UserPosted
},
QE: function() {
return getApiSnsWebV1IntimacyIntimacyListSearch
},
an: function() {
return postApiSnsWebV1Feed
},
pe: function() {
return postApiSnsWebV1CommentPost
},
dj: function() {
return postApiSnsWebV1LoginActivate
},
du: function() {
return getApiSnsWebV1SearchQuerytrending
},
Vn: function() {
return getApiSnsWebV2NoteCollectPage
},
yC: function() {
return getApiSnsWebV1BoardUser
},
tF: function() {
return getApiSnsWebV1IntimacyIntimacyList
}
}),
function registerHttp(e) {
a = e
}(i(65266).dJ)
},
34134: function(e, r, i) {
"use strict";
i.d(r, {
Z: function() {
return s
}
});
class a {
static _calculate(e=[]) {
if (0 === e.length)
return null;
if (1 === e.length)
return e[0].t;
let r = e[0];
for (let i = 1; i < e.length; i++) {
let a = e[i];
a.layoutSignificance > r.layoutSignificance && (r = a)
}
return r.t
}
static get() {
return new Promise(e => {
if (window.__FULLY_LOADED__ && window.__FMP_OBSERVED_POINTS__) {
e({
firstPaint: window.__FP__,
firstContentfulPaint: window.__FCP__,
firstScreen: window.__FIRST_SCREEN__,
firstMeaningfulPaint: a._calculate(window.__FMP_OBSERVED_POINTS__),
fullyLoaded: window.__FULLY_LOADED__
});
return
}
window.addEventListener("__fullyloaded__", r => {
e({
firstPaint: r.detail.firstPaint,
firstContentfulPaint: r.detail.firstContentfulPaint,
firstScreen: window.__FIRST_SCREEN__,
firstMeaningfulPaint: a._calculate(r.detail.observedPoints),
fullyLoaded: r.detail.fullyLoaded
})
}
)
}
)
}
}
var s = a
},
80503: function(e, r, i) {
"use strict";
i.d(r, {
Z: function() {
return ti
}
});
var a, s, u, c, l, d, p = i(41622), f = i(46490), v = i(90251), g = i(51606), h = i(70879), m = i(377);
i(29744),
i(36277),
i(34333),
i(86651),
i(7608),
i(87535),
i(75204),
i(97357);
var _ = i(4659)
, y = i(27337);
i(27461),
i(23339),
i(51109),
i(19077),
i(75973);
var w = i(44501);
i(87989);
var E = i(63522)
, S = i(28934)
, T = i(31547);
i(25069),
i(58486),
i(55947),
i(72169),
i(80156),
i(50721),
i(29112),
i(67275),
i(59989),
i(7099),
i(99808),
i(6045),
i(10364),
i(67673),
i(9557),
i(95477),
i(74093),
i(20768),
i(41648),
i(59339),
i(47444),
i(34757),
i(85908),
i(39995),
i(22943),
i(54767),
i(55820),
i(93225),
i(33708),
i(64322),
i(47771);
var b = {
production: "https://fe.xiaohongshu.com/faas/proto/json-to-proto-json-to-proto/proxy",
development: "http://serverless.int.sit.xiaohongshu.com/function/proto/json-to-proto-json-to-proto/proxy"
}
, k = {
production: "https://apm-fe.xiaohongshu.com/api/data",
development: "//apm-fe-test.xiaohongshu.com/api/data"
}
, C = ["t.xiaohongshu.com", "spltest.xiaohongshu.com", "t2.xiaohongshu.com", "t2-test.xiaohongshu.com", "lng.xiaohongshu.com", "apm-track.xiaohongshu.com", "apm-track-test.xiaohongshu.com", "fse.xiaohongshu.com", "fse.devops.xiaohongshu.com", "fesentry.xiaohongshu.com"]
, P = "__APM__ResourceErrorTracker__"
, A = "HTTPServerError"
, R = "HTTPBizError"
, I = "HTTPClientError"
, O = "httpRequestTiming"
, N = "infraJsError"
, L = "x-b3-traceid"
, M = ["link", "script", "img"]
, B = "xhs_context_networkQuality"
, isBrowser = function() {
return "undefined" != typeof window
}
, x = {
isProd: !0
}
, D = {
value: void 0
}
, F = {
isFirstScreen: 1
}
, V = {
isVisable: 1
}
, getDeviceLevel = function() {
var e, r, i = isBrowser() ? null === (r = window) || void 0 === r ? void 0 : null === (e = r.navigator) || void 0 === e ? void 0 : e.hardwareConcurrency : 0;
return i ? i > 12 ? 1 : i > 6 ? 0 : -1 : -2
}
, getPageVisable = function() {
return V.isVisable
}
, setPageVisible = function(e) {
V.isVisable = e
}
, setFirstScreen = function(e) {
F.isFirstScreen = e
}
, setProd = function(e) {
x.isProd = e
}
, base_isProd = function() {
return x.isProd && !/\.sit\./.test(window.location.href)
}
, isXrayLink = function(e) {
return "measurement_name"in e
}
, isArray = function(e) {
return "[object Array]" === Object.prototype.toString.call(e)
}
, parseUrl = function(e) {
try {
return !/^https?:\/\//.test(e) && (e = "https://c.xiaohongshu.com" + e),
new URL(e).pathname.split("/").map(function(e) {
var r, i;
if ("" !== e && !Number.isNaN(Number(e)))
return ":num";
return e.length >= 17 && (r = e,
/\d/.test(r)) && (i = e,
!/-|_/.test(i)) || e.replace(/[^\d]/g, "").length >= 10 ? ":id" : e
}).join("/")
} catch (e) {
return console.error(e),
""
}
}
, getDomain = function(e) {
var r = e.match(/^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/\n]+)/im);
return r ? r[1] : void 0
}
, H = function _getRemoteUrl() {
var e;
return function() {
return e ? Promise.resolve(e) : (D.value ? Promise.resolve(!D.value.trackEnv) : (0,
S.dw)("getTrackEnv").then(function(e) {
return !e.value.isTestEnv
}).catch(function() {
return base_isProd()
})).then(function(r) {
var i, a, s, u, c = tn.options.customEndPoint, l = r ? (null == c ? void 0 : null === (i = c.apmXrayTracker) || void 0 === i ? void 0 : i.production) || k.production : (null == c ? void 0 : null === (a = c.apmXrayTracker) || void 0 === a ? void 0 : a.development) || k.development;
return e = {
xrayLink: l,
oldLink: r ? (null == c ? void 0 : null === (s = c.apmJsonTracker) || void 0 === s ? void 0 : s.production) || b.production : (null == c ? void 0 : null === (u = c.apmJsonTracker) || void 0 === u ? void 0 : u.development) || b.development
}
})
}
}()
, merge = function(e, r) {
var transform = function(e, r) {
var i = {};
return Object.keys(e).forEach(function(a) {
var s = r[a];
void 0 !== s && (void 0 === s ? "undefined" : (0,
T._)(s)) !== "object" ? i[a] = s : (void 0 === s ? "undefined" : (0,
T._)(s)) === "object" && null != s ? i[a] = transform(e[a], r[a]) : i[a] = e[a]
}),
Object.keys(r).forEach(function(a) {
void 0 === e[a] && (i[a] = r[a])
}),
i
};
return transform(e, r)
}
, U = new Map
, errorExist = function(e) {
var r = U.get(e);
if (r)
return !(Date.now() - r > 6e4) && !0;
return !1
}
, setError = function(e) {
U.set(e, Date.now())
}
, transformObj = function(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "add";
if (r) {
var a = {};
return Object.keys(r).forEach(function(s) {
"add" === i && (a["".concat(e, "_").concat(s)] = r[s]),
"delete" === i && (a[s.replace("".concat(e, "_"), "")] = r[s])
}),
a
}
}
, setBaseInfo = function() {
var e;
if (null === (e = window) || void 0 === e ? void 0 : e.__baseInfo__)
try {
var r = JSON.parse(window.__baseInfo__);
D.value = Object.keys(r).length ? r : void 0
} catch (e) {
D.value = void 0
}
else
D.value = void 0
}
, judgePlatform = function() {
if (E.YF.isIOS)
return E.YF.isXHS ? "iOS" : "iOSBrowser";
if (E.YF.isAndroid)
return E.YF.isXHS ? "Android" : "AndroidBrowser";
if (E.YF.isHarmony || E.YF.isHarmonyArk)
return E.YF.isXHS ? "Harmony" : "HarmonyBrowser";
return "PC"
}
, q = {
appVersion: "0.0.0",
systemVersion: "unknown",
uniqueId: "",
bundleId: ""
}
, deviceBuilder = function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : q
, r = arguments.length > 1 ? arguments[1] : void 0;
return {
app: {
type: "App",
value: {
nameTracker: {
type: "NameTracker",
value: "wapT"
},
platform: {
type: "Platform",
value: judgePlatform()
},
appVersion: "discovery-".concat(e.appVersion)
}
},
mob: {
type: "Mobile",
value: {
osVersion: e.systemVersion || "unknown",
dvceModel: e.deviceModel || ""
}
},
dvc: {
type: "Device",
value: {
dvceId: e.uniqueId || (null == r ? void 0 : r.deviceId) || ""
}
}
}
}
, deviceBuilderV2 = function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : q
, r = arguments.length > 1 ? arguments[1] : void 0;
return {
context_nameTracker: "wapT",
context_platform: judgePlatform(),
context_appVersion: "discovery-".concat(e.appVersion),
context_osVersion: e.systemVersion || "unknown",
context_deviceModel: e.deviceModel || "",
context_deviceId: e.uniqueId || (null == r ? void 0 : r.deviceId) || "",
context_package: e.bundleId || ""
}
}
, whenActivated = function(e) {
document.prerendering ? addEventListener("prerenderingchange", function() {
return e()
}, !0) : e()
};
i(25037),
i(74719),
i(13396),
i(91313),
i(82427),
i(36062),
i(57057),
i(64961),
i(12996),
i(59564);
var onActivated = function(e) {
var onHiddenOrPageHide = function(r) {
"visible" === document.visibilityState && e(r)
};
addEventListener("visibilitychange", onHiddenOrPageHide, !0),
addEventListener("pagehide", onHiddenOrPageHide, !0)
}
, j = {
EXCELLENT: [90, 100],
GOOD: [80, 90],
MODERATE: [70, 80],
ACCEPTABLE: [60, 70],
WEAK: [0, 60]
}
, W = [{
rttRange: [0, 110],
jitterRange: [0, 30],
speedRange: [3.3, 100],
score: [90, 100]
}, {
rttRange: [110, 460],
jitterRange: [30, 60],
speedRange: [1.5, 3.3],
score: [80, 90]
}, {
rttRange: [460, 1400],
jitterRange: [60, 100],
speedRange: [1, 1.5],
score: [70, 80]
}, {
rttRange: [1400, 2e3],
jitterRange: [100, 200],
speedRange: [.5, 1],
score: [60, 70]
}, {
rttRange: [2e3, 1e4],
jitterRange: [200, 1e4],
speedRange: [0, .5],
score: [0, 60]
}]
, G = [60, 3]
, J = function() {
function NetworkDetector() {
var e = this;
(0,
f._)(this, NetworkDetector),
(0,
g._)(this, "lastNQELevel", "UNKNOWN"),
(0,
g._)(this, "currentNQELevel", "UNKNOWN"),
(0,
g._)(this, "networkInformation", {
downlink: 0,
effectiveType: "unknown",
rtt: 0,
jitter: 0,
speed: 0,
rttScore: 0,
jitterScore: 0,
speedScore: 0,
networkQuality: "UNKNOWN"
}),
(0,
g._)(this, "imgUrl", "https://picasso-static.xiaohongshu.com/fe-platform/879b789b01030ed45ce198de8229cab980bc176f.png"),
(0,
g._)(this, "_interval", 0),
(0,
g._)(this, "_times", 0),
(0,
g._)(this, "_weights", [.3, .2, .5]),
(0,
g._)(this, "listeners", []),
(0,
g._)(this, "calculateMetricScore", function(e, r, i) {
var a = (0,
w._)(e, 2)
, s = a[0]
, u = a[1]
, c = (0,
w._)(r, 2)
, l = c[0]
, d = c[1];
return Math.round(l + (d - l) / (u - s) * (i - s))
}),
(0,
g._)(this, "getNetworkQuality", function(e) {
var r = !0
, i = !1
, a = void 0;
try {
for (var s, u = Object.entries(j)[Symbol.iterator](); !(r = (s = u.next()).done); r = !0) {
var c = (0,
w._)(s.value, 2)
, l = c[0]
, d = c[1];
if (e >= d[0] && e <= d[1])
return l
}
} catch (e) {
i = !0,
a = e
} finally {
try {
!r && null != u.return && u.return()
} finally {
if (i)
throw a
}
}
return "UNKNOWN"
}),
(0,
g._)(this, "updateNQELevel", function() {
e.lastNQELevel = e.currentNQELevel,
e.currentNQELevel = e.networkInformation.networkQuality,
e.lastNQELevel !== e.currentNQELevel && e.notifyListeners(),
e.reset()
}),
this._interval = 60,
this._times = 3
}
return (0,
v._)(NetworkDetector, [{
key: "sendImgRequest",
value: function sendImgRequest(e) {
try {
return new Promise(function(r, i) {
var a = 0
, s = new Date().getTime()
, u = new XMLHttpRequest;
u.onreadystatechange = function() {
if (4 === u.readyState) {
if (200 === u.status) {
var e = new Date().getTime() - s
, c = 8 * a
, l = e / 1e3;
r({
rtt: e,
speed: c / l / 1e6
})
} else
i("Request failed with status ".concat(u.status))
}
}
,
u.onerror = function() {
i("Request failed with status ".concat(u.status))
}
,
u.onprogress = function(e) {
a = e.loaded
}
,
u.open("GET", e),
u.setRequestHeader("Cache-Control", "no-cache"),
u.send()
}
)
} catch (e) {
console.log(e)
}
}
}, {
key: "calcJitter",
value: function calcJitter(e) {
var r = e.reduce(function(e, r) {
return e + r.rtt
}, 0) / e.length
, i = e.map(function(e) {
return Math.abs(e.rtt - r)
});
return (i.reduce(function(e, r) {
return e + r
}, 0) / i.length).toFixed(2)
}
}, {
key: "calcScore",
value: function calcScore(e) {
var r = e.rtt
, i = e.jitter
, a = e.speed
, s = W.find(function(e) {
return r >= e.rttRange[0] && r <= e.rttRange[1]
}) || W[W.length - 1]
, u = W.find(function(e) {
return i >= e.jitterRange[0] && i <= e.jitterRange[1]
}) || W[W.length - 1]
, c = W.find(function(e) {
return a >= e.speedRange[0] && a <= e.speedRange[1]
}) || W[W.length - 1]
, l = this.calculateMetricScore(s.rttRange, s.score, r)
, d = this.calculateMetricScore(u.jitterRange, u.score, i)
, p = this.calculateMetricScore(c.speedRange, c.score, a)
, f = l * this._weights[0] + d * this._weights[1] + p * this._weights[2]
, v = this.getNetworkQuality(f);
this.networkInformation = (0,
y._)((0,
h._)({}, this.networkInformation), {
rttScore: l,
jitterScore: d,
speedScore: p,
networkQuality: v
})
}
}, {
key: "detectFromImg",
value: function detectFromImg() {
var e = this;
return (0,
p._)(function() {
var r, i, a, s;
return (0,
m.Jh)(this, function(s) {
switch (s.label) {
case 0:
for (i = 0,
r = []; i < e._times; i++)
r.push(e.sendImgRequest(e.imgUrl));
s.label = 1;
case 1:
return s.trys.push([1, 3, , 4]),
[4, Promise.all(r)];
case 2:
return a = s.sent(),
e.networkInformation.speed = Number((a.reduce(function(e, r) {
return e + r.speed
}, 0) / a.length).toFixed(2)),
e.networkInformation.jitter = Number(e.calcJitter(a)),
e.networkInformation.rtt = Number((a.reduce(function(e, r) {
return e + r.rtt
}, 0) / a.length).toFixed(2)),
e.calcScore(e.networkInformation),
[3, 4];
case 3:
return s.sent(),
e.reset(),
[3, 4];
case 4:
return [2]
}
})
})()
}
}, {
key: "detectFromApi",
value: function detectFromApi() {
if ("connection"in navigator) {
var e = navigator.connection;
this.networkInformation.effectiveType = e.effectiveType,
this.networkInformation.downlink = e.downlink
} else
console.log("Network Information API is not supported in this browser.")
}
}, {
key: "detect",
value: function detect() {
var e, r, i = this, a = this;
var s = (e = (0,
p._)(function() {
return (0,
m.Jh)(this, function(e) {
switch (e.label) {
case 0:
if ("visible" !== document.visibilityState)
return [3, 2];
return a.detectFromApi(),
[4, a.detectFromImg()];
case 1:
e.sent(),
a.updateNQELevel(),
clearTimeout(r),
r = setTimeout(s, 1e3 * a._interval),
e.label = 2;
case 2:
return [2]
}
})
}),
function detectRepeatedly() {
return e.apply(this, arguments)
}
);
onActivated(function() {
clearTimeout(r),
r = setTimeout(s, 1e3 * i._interval)
}),
r = setTimeout(s, 3e3)
}
}, {
key: "onchange",
value: function onchange(e) {
this.listeners.push(e)
}
}, {
key: "notifyListeners",
value: function notifyListeners() {
var e = !0
, r = !1
, i = void 0;
try {
for (var a, s = this.listeners[Symbol.iterator](); !(e = (a = s.next()).done); e = !0)
(0,
a.value)(this.lastNQELevel, this.currentNQELevel)
} catch (e) {
r = !0,
i = e
} finally {
try {
!e && null != s.return && s.return()
} finally {
if (r)
throw i
}
}
}
}, {
key: "reset",
value: function reset() {
this.networkInformation = {
downlink: 0,
effectiveType: "unknown",
rtt: 0,
jitter: 0,
speed: 0,
rttScore: 0,
jitterScore: 0,
speedScore: 0,
networkQuality: "UNKNOWN"
}
}
}], [{
key: "getInstance",
value: function getInstance() {
return !NetworkDetector.instance && (NetworkDetector.instance = new NetworkDetector,
NetworkDetector.instance.detect()),
NetworkDetector.instance
}
}]),
NetworkDetector
}();
(0,
g._)(J, "instance", void 0);
var setNetInfoToStorage = function(e) {
localStorage.setItem(B, e)
};
function resolveNetType() {
return new Promise(function(e) {
var r, i;
return D.value ? e((null === (i = D.value) || void 0 === i ? void 0 : null === (r = i.networkType) || void 0 === r ? void 0 : r.toLowerCase()) || "unknow") : (0,
S.dw)("getNetworkType").then(function(r) {
var i = r.result
, a = r.value;
0 === i ? e(a.toLowerCase()) : e("unknow")
}).catch(function() {
try {
var r = window.navigator.userAgent;
e((0,
E.P7)(r).toLowerCase())
} catch (r) {
e("unknow")
}
})
}
)
}
var X = {
wifi: "wifi",
"4g": "mobile",
"3g": "mobile",
"3g+": "mobile",
"2g": "mobile",
none: "unknow",
other: "unknow"
};
var Y = (a = (0,
p._)(function(e) {
return (0,
m.Jh)(this, function(r) {
if (!E.YF.isXHS && (null == e ? void 0 : e.open)) {
var i;
return i = e,
whenActivated(function() {
try {
requestIdleCallback((0,
p._)(function() {
return (0,
m.Jh)(this, function(e) {
return J.getInstance().onchange(function(e, r) {
return i.onchange && i.onchange(e, r),
setNetInfoToStorage(r),
r
}),
[2]
})
}))
} catch (e) {}
}),
[2, Promise.resolve({
context_networkQuality: localStorage.getItem(B) || "UNKNOWN"
})]
}
return [2, new Promise(function(e) {
var r;
if (D.value)
return e({
context_networkQuality: (null === (r = D.value) || void 0 === r ? void 0 : r.networkQuality) || "UNKNOWN"
});
(0,
S.dw)("getDefaultNQELevel").then(function(r) {
e({
context_networkQuality: r.value
})
}).catch(function() {
e({
context_networkQuality: "UNKNOWN"
})
})
}
)]
})
}),
function getNQELevel(e) {
return a.apply(this, arguments)
}
);
i(67930);
var z = {
userId: "",
userToken: "",
sessionId: "",
hashExp: "",
flags: {}
}
, setDefaultABInfo = function(e) {
var r = e.userId
, i = e.userToken
, a = e.sessionId
, s = e.hashExp;
return r && (z.userId = r),
i && (z.userToken = i),
a && (z.sessionId = a),
s && "string" == typeof s && (z.hashExp = s),
z
};
function getABInfoByBridge() {
var e;
return D.value && (null === (e = D.value) || void 0 === e ? void 0 : e.userId) ? Promise.resolve(setDefaultABInfo(D.value)) : (0,
S.dw)("getUserInfo").then(function(e) {
return setDefaultABInfo(e.value)
})
}
function getABInfo() {
return getABInfoByBridge().catch(function() {
return z
})
}
function getOpenId() {
if (E.YF.isMiniprogram) {
var e;
if (null === (e = window) || void 0 === e ? void 0 : e.location)
return new URLSearchParams(window.location.search).get("openid")
}
return null
}
function getUserInfoPromise() {
if (s)
return s;
var e = getABInfo().then(function(e) {
return {
user: {
type: "User",
value: {
userId: e.userId || "",
hashUserId: e.userToken,
wxOpenid: getOpenId() || "",
expV4: e.hashExp
}
}
}
});
return s = e,
e
}
i(43648);
var K = function() {
function Seq() {
(0,
f._)(this, Seq)
}
return (0,
v._)(Seq, null, [{
key: "increment",
value: function increment() {
return Seq.index += 1,
Seq.index
}
}, {
key: "getSeq",
value: function getSeq() {
return Seq.index
}
}]),
Seq
}();
(0,
g._)(K, "index", 0);
var Z = new (function() {
function PageSession() {
(0,
f._)(this, PageSession),
(0,
g._)(this, "preMatchedPath", ""),
(0,
g._)(this, "curMatchedPath", ""),
(0,
g._)(this, "pageSessionId", (0,
_.Z)())
}
return (0,
v._)(PageSession, [{
key: "setSessionId",
value: function setSessionId(e) {
this.preMatchedPath = this.curMatchedPath,
this.curMatchedPath !== e && (this.curMatchedPath = e,
this.pageSessionId = (0,
_.Z)())
}
}, {
key: "getPageSessionId",
value: function getPageSessionId() {
return this.pageSessionId
}
}]),
PageSession
}())
, getPath = function(e) {
var r = (e || {}).matched
, i = void 0 === r ? [] : r
, a = i.length > 0 ? i.slice(-1)[0] : null;
return a && a.path || "/"
};
function getBrowserInfo(e) {
return isBrowser() ? {
browser: {
type: "Browser",
value: {
matchedPath: e ? getPath(e) : parseUrl(window.location.href),
route: window.location.href,
userAgent: window.navigator.userAgent
}
}
} : {}
}
var getXrayBrowserInfo = function(e) {
if (!isBrowser())
return {};
var r = e ? getPath(e) : parseUrl(window.location.href);
return Z.setSessionId(r),
{
context_matchedPath: r,
context_route: window.location.href,
context_userAgent: window.navigator.userAgent
}
}
, Q = {
user: {
type: "User",
value: {
userId: ""
}
}
}
, getUserInfo = function() {
arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}
, r = e.getUserInfo;
return r ? new Promise(function(e) {
setTimeout(function() {
r().then(function(r) {
e(r)
}).catch(function() {
e(Q)
})
})
}
) : getUserInfoPromise()
}
, $ = Promise.resolve(Q)
, getXrayUserInfo = function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return $ = getUserInfo(e, r)
}
, getArtifactInfo = function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, r = {
artifactName: e.package && e.package.name || "xhs-pc-web",
artifactVersion: e.package && e.package.version || "4.62.3"
};
return e.getArtifactInfo ? (0,
h._)({}, r, e.getArtifactInfo()) : r
}
, getOldMeta = function() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return Promise.all([(e = i,
new Promise(function(r) {
if (E.YF.isXHS) {
if (D.value)
return r(deviceBuilder(D.value));
(0,
S.dw)("getDeviceInfo").then(function(e) {
e ? r(deviceBuilder(e.value)) : r(deviceBuilder())
}).catch(function() {
r(deviceBuilder())
})
} else
e.getDeviceInfo ? e.getDeviceInfo().then(function(e) {
r(deviceBuilder({}, e))
}).catch(function() {
r(deviceBuilder())
}) : r(deviceBuilder())
}
)), resolveNetType().then(function(e) {
return {
network: {
type: "Network",
value: {
networkType: {
type: "NetworkType",
value: X[e] || "unknow"
}
}
}
}
}), $, getBrowserInfo(r.route), getArtifactInfo(i)]).then(function(e) {
var r = (0,
w._)(e, 5)
, i = r[0]
, a = r[1]
, s = r[2]
, u = r[3]
, c = r[4]
, l = (0,
h._)({}, i, a, u, s);
return l.app.value = (0,
h._)({}, l.app.value, void 0 === c ? {} : c),
l
})
}
, getXrayMeta = function() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return Promise.all([(e = i,
new Promise(function(r) {
if (E.YF.isXHS) {
if (D.value)
return r(deviceBuilderV2(D.value));
(0,
S.dw)("getDeviceInfo").then(function(e) {
e ? r(deviceBuilderV2(e.value)) : r(deviceBuilderV2())
}).catch(function() {
r(deviceBuilderV2())
})
} else
e.getDeviceInfo ? e.getDeviceInfo().then(function(e) {
r(deviceBuilderV2({}, e))
}).catch(function() {
r(deviceBuilderV2())
}) : r(deviceBuilderV2())
}
)), resolveNetType().then(function(e) {
return {
context_networkType: X[e] || "unknow"
}
}), getXrayUserInfo(r, i), getXrayBrowserInfo(r.route), getArtifactInfo(i), Y(i.network), new Promise(function(e) {
if (E.YF.isXHS) {
if (D.value)
return e({
context_deviceLevel: "".concat(D.value.deviceLevel)
});
(0,
S.dw)("getHardWareLevel").then(function(r) {
e({
context_deviceLevel: "".concat(r.value)
})
}).catch(function() {
return e({})
})
} else
e({
context_deviceLevel: "".concat(getDeviceLevel())
})
}
).then(function(e) {
return e
})]).then(function(e) {
var r = (0,
w._)(e, 7)
, i = r[0]
, a = r[1]
, s = r[2]
, u = r[3]
, c = r[4]
, l = r[5]
, d = r[6]
, p = (0,
h._)((0,
y._)((0,
h._)({}, i, a, u), {
context_artifactName: c.artifactName || "",
context_artifactVersion: c.artifactVersion || ""
}), l, d);
return s && s.user && s.user.value && (p.context_userId = s.user.value.userId),
p
})
}
, ee = new (function() {
function Builder() {
(0,
f._)(this, Builder),
(0,
g._)(this, "meta", {}),
(0,
g._)(this, "extraMeta", {}),
(0,
g._)(this, "flag", !1)
}
return (0,
v._)(Builder, [{
key: "init",
value: function init(e) {
var r = this;
if (this.flag)
return Promise.resolve({});
this.flag = !0;
var i = e.setCustomDimensions
, a = void 0 === i ? function() {
return Promise.resolve({})
}
: i;
return Promise.all([this.updateXrayMeta({}, e), this.updateOldMeta({}, e), a().then(function(e) {
r.extraMeta.dimensions = transformObj("custom", e)
})])
}
}, {
key: "config",
value: function config(e, r, i) {
if (!!r) {
var a = JSON.parse(JSON.stringify(r))
, s = "ApmTracker" === i ? "old" : "";
s && ("old" === s && a.value && delete a.value.gid,
"old" === s && "app" === e && a.value && delete a.value.buildId,
this.meta[s] ? this.meta[s][e] = a : this.meta[s] = (0,
g._)({}, e, a))
}
}
}, {
key: "extend",
value: function extend(e, r) {
var i = this;
Object.keys(e).forEach(function(a) {
i.config(a, e[a], r)
})
}
}, {
key: "updateExtra",
value: function updateExtra(e, r) {
this.extraMeta[e] = (0,
h._)({}, this.extraMeta[e], "dimensions" === e ? transformObj("custom", r) : r)
}
}, {
key: "updateXrayMeta",
value: function updateXrayMeta() {
var e = this
, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return new Promise(function(a) {
getXrayMeta(r, i).then(function(r) {
e.meta.xray = r,
a(r)
}).catch(function(e) {
console.warn(e)
})
}
)
}
}, {
key: "updateOldMeta",
value: function updateOldMeta() {
var e = this
, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return new Promise(function(a) {
getOldMeta(r, i).then(function(r) {
e.meta.old = r,
a(r)
}).catch(function(e) {
console.warn(e)
})
}
)
}
}, {
key: "build",
value: function build(e) {
var r, i, a = isXrayLink(e) ? this.meta.xray : this.meta.old, s = {
event: {
type: "Event",
value: {
dvceMicroTs: 1e3 * new Date().valueOf()
}
}
};
if (isXrayLink(e))
i = (0,
h._)({
clientTime: Date.now(),
context_sdkSessionId: tn.sessionId,
context_pageSessionId: Z.getPageSessionId(),
context_sdkSeqId: K.increment()
}, a, this.extraMeta.dimensions, e);
else {
;if ("type"in (r = e) && "value"in r)
i = (0,
y._)((0,
h._)({}, s, a), {
frontApmTracker: {
type: "FrontApmTracker",
value: e.value
}
});
else
i = (0,
h._)({}, s, a, e)
}
return i
}
}]),
Builder
}());
i(87394),
i(94941),
i(48421),
i(98976);
var et = function getChromeVersion() {
try {
var e = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
return !!e && parseInt(e[2], 10)
} catch (e) {
return !1
}
}();
function isSupportKeepaliveInFetch() {
return !et || et > 69
}
var er = {
GET: "GET",
POST: "POST"
}
, request_xhr = function(e, r, i) {
var a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
return new Promise(function(s, u) {
var c = new XMLHttpRequest;
c.open(e, r);
var l = a.headers
, d = void 0 === l ? {} : l
, p = a.withCredentials;
Object.keys(d).forEach(function(e) {
c.setRequestHeader(e, d[e])
}),
c.withCredentials = void 0 !== p && p,
c.onreadystatechange = function() {
c.readyState == XMLHttpRequest.DONE && (c.status >= 200 && c.status < 400 ? s(JSON.parse(c.response)) : u(c.response))
}
,
e === er.POST ? c.send(JSON.stringify(i)) : c.send()
}
)
}
, post = function(e, r, i) {
return request_xhr(er.POST, e, r, i)
}
, sendByHttp = function(e, r) {
return post(e, r, {
headers: {
"Content-Type": "text/plain"
},
withCredentials: !1
}).catch(function(e) {
!base_isProd() && console.error(e)
})
};
function sendToXrayByFetch(e, r) {
var i = !(arguments.length > 2) || void 0 === arguments[2] || arguments[2];
if ("function" == typeof fetch) {
var a = {
method: "POST",
headers: {
"content-type": "application/json",
"Biz-Type": "apm_fe",
Batch: i ? "true" : "false"
},
body: JSON.stringify(r)
};
return isSupportKeepaliveInFetch() && (a.keepalive = !0),
fetch(e, a).catch(function(e) {
!base_isProd() && console.error(e)
})
}
return post(e, r, {
headers: {
"Biz-Type": "apm_fe",
Batch: "true",
"Content-Type": "application/json;charset=UTF-8"
},
withCredentials: !1
}).catch(function(e) {
!base_isProd() && console.error(e)
})
}
var en = Function("return this")();
en.__APM_COMBO_CACHE_GROUP_V2__ = {};
var ei = !1;
function viewDisappearListener() {
var cb = function() {
var e = Object.keys(en.__APM_COMBO_CACHE_GROUP_V2__);
if (e.length)
for (var r = 0; r < e.length; r++) {
var i = e[r]
, a = en.__APM_COMBO_CACHE_GROUP_V2__[i] || {}
, s = a.data
, u = a.request;
s && s.length && ((u || sendToXrayByFetch).call(null, i, s),
en.__APM_COMBO_CACHE_GROUP_V2__[i] = null)
}
};
E.YF.isXHS ? (E.YF.isAndroid && (0,
S.Ld)("viewDidDisappear", cb),
E.YF.isIOS && (0,
S.Ld)("viewDisappear", cb)) : (window.addEventListener || window.attachEvent)("visibilitychange", function() {
"hidden" === document.visibilityState && cb()
})
}
function requestCombo(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}
, a = i.request
, s = i.isCombo
, u = void 0 === s || s
, c = i.maxComboNum
, l = void 0 === c ? 5 : c
, d = i.collectTime
, p = void 0 === d ? 1e3 * l : d
, f = i.callback;
if (!e || "{}" === JSON.stringify(r))
return null;
var fetchUrl = function(e) {
return new Promise(function(r) {
var i;
if (null === (i = en.__APM_COMBO_CACHE_GROUP_V2__[e]) || void 0 === i ? void 0 : i.data.length) {
var a = en.__APM_COMBO_CACHE_GROUP_V2__[e]
, s = a.data
, u = a.timer
, c = a.request;
clearTimeout(u),
en.__APM_COMBO_CACHE_GROUP_V2__[e] = null,
setTimeout(function() {
return (c || sendByHttp).call(null, e, s).then(function(e) {
r(e)
})
}, 0)
}
}
)
};
return !ei && (viewDisappearListener(),
ei = !0),
new Promise(function(i, s) {
if (u) {
if (e) {
if (!en.__APM_COMBO_CACHE_GROUP_V2__[e] && (en.__APM_COMBO_CACHE_GROUP_V2__[e] = {
request: a,
data: [],
timer: setTimeout(function() {
var r, a = null === (r = en.__APM_COMBO_CACHE_GROUP_V2__[e]) || void 0 === r ? void 0 : r.data;
fetchUrl(e).then(function(e) {
f && f(a),
i(e)
}).catch(function(e) {
s(e)
})
}, p)
}),
en.__APM_COMBO_CACHE_GROUP_V2__[e].data.push(r),
en.__APM_COMBO_CACHE_GROUP_V2__[e].data.length >= l) {
var c, d = null === (c = en.__APM_COMBO_CACHE_GROUP_V2__[e]) || void 0 === c ? void 0 : c.data;
fetchUrl(e).then(function(e) {
f && f(d),
i(e)
}).catch(function(e) {
s(e)
})
}
} else
s("接口 url: ".concat(e, " 不能为空"))
} else
setTimeout(function() {
return sendToXrayByFetch.call(null, e, r, !1).then(function(e) {
i(e)
}).catch(function(e) {
s(e)
})
}, 0)
}
)
}
function requestCombo_destroy() {
return _destroy.apply(this, arguments)
}
function _destroy() {
return (_destroy = (0,
p._)(function() {
var e;
return (0,
m.Jh)(this, function(r) {
switch (r.label) {
case 0:
var i;
if (!(e = Object.keys(en.__APM_COMBO_CACHE_GROUP_V2__)).length)
return [3, 2];
return [4, Promise.all(e.map((i = (0,
p._)(function(e) {
var r, i, a;
return (0,
m.Jh)(this, function(s) {
switch (s.label) {
case 0:
if (i = (r = en.__APM_COMBO_CACHE_GROUP_V2__[e]).data,
a = r.request,
!(i && i.length))
return [3, 2];
return [4, (a || sendByHttp).call(null, e, i)];
case 1:
s.sent(),
en.__APM_COMBO_CACHE_GROUP_V2__[e] = null,
s.label = 2;
case 2:
return [2]
}
})
}),
function(e) {
return i.apply(this, arguments)
}
)))];
case 1:
r.sent(),
r.label = 2;
case 2:
return [2]
}
})
})).apply(this, arguments)
}
var logXrayMetric = function(e) {
var r = e.measurement_name;
console.groupCollapsed("[apm] ".concat(r)),
console.log(e),
console.groupEnd()
}
, logJsonMetric = function(e) {
var r = "";
e.browserApmTracker ? r = Object.keys(e.browserApmTracker.value).filter(function(r) {
var i = e.browserApmTracker.value[r];
return isArray(i) ? i.length > 0 : i
}) : e.frontApmTracker && (r = "frontApmTracker"),
console.groupCollapsed("[apm] ".concat(r.toString())),
console.log(e),
console.groupEnd()
}
, uploadBehavior = function(e, r, i) {
e && H().then(function(a) {
var s = a.xrayLink
, u = a.oldLink
, c = isXrayLink(e) ? s : u
, l = isXrayLink(e) ? logXrayMetric : logJsonMetric
, d = isXrayLink(e) ? sendToXrayByFetch : sendByHttp;
requestCombo(c, e, (0,
h._)({
request: d,
callback: function(e) {
e && e.length && i.debug && e.forEach(function(e) {
l(e)
})
}
}, r))
})
}
, eo = new (function() {
function Sender() {
(0,
f._)(this, Sender)
}
return (0,
v._)(Sender, [{
key: "sender",
value: function sender(e, r, i) {
var a = r.debug
, s = r.http;
(void 0 === s ? {} : s).enableBatchRequest ? uploadBehavior(e, (0,
h._)({}, i), {
debug: a
}) : uploadBehavior(e, (0,
h._)({
isCombo: !1
}, i), {
debug: a
})
}
}, {
key: "destroy",
value: function destroy1() {
requestCombo_destroy()
}
}]),
Sender
}())
, ea = {
i8: "1.2.2"
};
function isSupportGetConfig() {
return _isSupportGetConfig.apply(this, arguments)
}
function _isSupportGetConfig() {
return (_isSupportGetConfig = (0,
p._)(function() {
var e;
return (0,
m.Jh)(this, function(e) {
switch (e.label) {
case 0:
return e.trys.push([0, 2, , 3]),
[4, (0,
S.dw)("getAppInfo").then(function(e) {
return e.value.build && parseInt(e.value.build, 10) || 0
})];
case 1:
if (81e5 > e.sent())
return [2, !1];
return [3, 3];
case 2:
return e.sent(),
[3, 3];
case 3:
return [2, !0]
}
})
})).apply(this, arguments)
}
var es = {
default: 1
}
, eu = function() {
function ApmEmitterSample(e) {
(0,
f._)(this, ApmEmitterSample),
(0,
g._)(this, "sampleOptions", void 0),
(0,
g._)(this, "localSampleValue", void 0),
(0,
g._)(this, "cachePromise", void 0),
(0,
g._)(this, "needCreateCachePromise", !0),
this.sampleOptions = e || es,
this.localSampleValue = this.sampleOptions.default
}
return (0,
v._)(ApmEmitterSample, [{
key: "getSample",
value: function getSample() {
var e = this;
return (0,
p._)(function() {
var r, i, a, s;
return (0,
m.Jh)(this, function(s) {
switch (s.label) {
case 0:
return s.trys.push([0, 4, , 5]),
[4, isSupportGetConfig()];
case 1:
if (!s.sent())
return [3, 3];
return [4, (0,
S.dw)("getConfig", {
configKeys: ["fe_apm_sample"]
})];
case 2:
if (a = null === (i = s.sent().value) || void 0 === i ? void 0 : null === (r = i.fe_apm_sample) || void 0 === r ? void 0 : r.default)
return [2, e.localSampleValue < a ? e.localSampleValue : a];
return [2, e.localSampleValue];
case 3:
return [3, 5];
case 4:
return s.sent(),
[3, 5];
case 5:
return [2, e.localSampleValue]
}
})
})()
}
}, {
key: "createCachePromise",
value: function createCachePromise() {
var e = this;
return new Promise(function(r) {
e.getSample().then(function(e) {
var i = Math.random();
r(i <= e)
})
}
)
}
}, {
key: "getIsReportApm",
value: function getIsReportApm() {
var e = this;
return (0,
p._)(function() {
return (0,
m.Jh)(this, function(r) {
return base_isProd() ? (!0 === e.needCreateCachePromise && (e.needCreateCachePromise = !1,
e.cachePromise = e.createCachePromise()),
[2, e.cachePromise]) : [2, !0]
})
})()
}
}]),
ApmEmitterSample
}()
, unsupportedMethod = function(e) {
return void 0 === e || "function" != typeof e
}
, create_perf_utils_sendMetrics = function(e, r) {
if (!unsupportedMethod(e.toJSON)) {
var i = {
browserApmTracker: {
type: "BrowserApmTracker",
value: {
browserPerformanceMeasure: {
type: "BrowserPerformanceMeasure",
value: e.toJSON()
}
}
}
};
r && "function" == typeof r.push && r.push(i)
}
};
function createPerfUtils(e) {
return {
mark: function(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
if (!unsupportedMethod(window.performance.mark))
window.performance.mark(e),
r && this.sendEntriesByName(e, "mark")
},
markPoint: function(e) {
this.mark(e, !0)
},
measure: function(e, r, i) {
if (!unsupportedMethod(window.performance.measure))
window.performance.measure(e, r, i),
r && window.performance.clearMarks(r),
i && window.performance.clearMarks(i),
this.sendEntriesByName(e, "measure")
},
sendEntriesByName: function(r, i) {
if (!unsupportedMethod(window.performance.getEntriesByName))
create_perf_utils_sendMetrics((0,
w._)(window.performance.getEntriesByName(r, i), 1)[0], e)
}
}
}
i(85203);
var ec = i(75649);
function debounce(e, r) {
var i, a = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
return function() {
for (var s = arguments.length, u = Array(s), c = 0; c < s; c++)
u[c] = arguments[c];
var l = this
, d = a && !i;
i && clearTimeout(i),
i = setTimeout(function later() {
i = null,
!a && e.apply(l, u)
}, r),
d && e.apply(l, u)
}
}
i(42876),
i(33933),
i(41593),
i(23329),
i(34885);
var el = new (function() {
function WhiteScreenDetect() {
var e = this;
(0,
f._)(this, WhiteScreenDetect),
(0,
g._)(this, "isDetected", void 0),
(0,
g._)(this, "debounceSet", debounce(function() {
e.isDetected = !0
}, 1e4)),
this.setDetected()
}
return (0,
v._)(WhiteScreenDetect, [{
key: "setDetected",
value: function setDetected() {
this.isDetected = !1,
this.debounceSet()
}
}, {
key: "pushJsError",
value: function pushJsError(e) {
var r = this;
if (e && !this.isDetected) {
var i, a, s = {
deepLink: (null === (a = window) || void 0 === a ? void 0 : null === (i = a.location) || void 0 === i ? void 0 : i.href) || "",
errorMessage: e
};
(0,
S.dw)("writeJSErrorMessage", s).then(function(e) {
e && (r.isDetected = !!e.value)
}).catch(function() {
r.isDetected = !0
})
}
}
}]),
WhiteScreenDetect
}())
, isHTTPError = function(e) {
return [I, A, R].includes(e || "")
}
, isIgnoreErrors = function(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [];
if (e) {
var i = "".concat(e.errorType, ": ").concat(e.errorMessage);
return r.includes(i)
}
}
, getJsErrorReportMetrics = function(e, r) {
var i, a = (0,
h._)({
enableIgnoreDefaultError: !0,
ignoreErrors: [],
ignoreError: null
}, (void 0 === r ? "undefined" : (0,
T._)(r)) === "object" && r), s = a.ignoreErrors, u = a.ignoreError, c = a.enableIgnoreDefaultError;
if (el.pushJsError(e.errorMessage || ""),
isIgnoreErrors(e, s))
return;
if (!(!0 === c && ((i = e).errorType && isHTTPError(i.errorType) || "AbortError" === i.errorType && "AbortError" === i.errorMessage))) {
if (!(u && u(e)))
return {
measurement_name: N,
measurement_data: e
}
}
}
, getErrorOptions = function(e) {
var r = e || {}
, i = r.level
, a = r.title
, s = r.extra
, u = void 0 === s ? null : s;
return {
errorLevel: i,
errorExtra: JSON.stringify((0,
h._)({
title: a
}, (void 0 === u ? "undefined" : (0,
T._)(u)) === "object" && u))
}
}
, parseError = function(e, r) {
if (e instanceof Error) {
var i, a, s, u, c = e.message, l = e.name;
if (e.stack) {
for (var d = e.stack.split("\n"), p = 0; d && p < d.length; p++) {
var f = /:(\d+:\d+)\)$/.exec(d[p]);
if (f && f[1]) {
var v = f[1].split(":");
i = d[p],
a = parseInt(v[0], 10) || 0,
s = parseInt(v[1], 10) || 0;
break
}
}
}
return e.stack && (u = e.stack),
(0,
h._)({
errorLineNumber: a,
errorColNumber: s,
errorFilePath: i && i.trim(),
errorStack: u,
errorType: l,
errorMessage: c
}, r && getErrorOptions(r))
}
return "string" == typeof e ? (0,
h._)({
errorType: "Error",
errorMessage: e
}, r && getErrorOptions(r)) : null
}
, parseHttpStatus = function(e, r, i, a) {
var s = {};
return (e < 200 || e >= 300) && (s.errorType = A,
s.code = r,
s.errorMsg = i),
e >= 200 && e < 300 && void 0 !== a && !a && (s.errorType = R,
s.code = r,
s.errorMsg = i),
s
}
, ed = (0,
ec._)(Object.values(b)).concat((0,
ec._)(Object.values(k)))
, forbiddenUrl = function(e) {
if (ed.includes(e))
return !0;
var r = getDomain(e);
return !!r && C.includes(r)
}
, ep = null
, reportInnerError = function(e, r) {
try {
if (!base_isProd()) {
console.error(e);
return
}
if (e.name !== (null == ep ? void 0 : ep.name) || e.message !== (null == ep ? void 0 : ep.message) || (null == e ? void 0 : e.stack) !== (null == ep ? void 0 : ep.stack)) {
ep = e;
var i = parseError(e);
if (i) {
var a = {
context_artifactName: "apm-insight",
context_artifactVersion: ea.i8,
measurement_name: N,
measurement_data: (0,
h._)({}, i)
};
r.innerFlush(a)
}
}
} catch (r) {
!base_isProd() && console.error(e)
}
};
function downloadScreenshotTool() {
if (window.html2canvas) {
u = Promise.resolve(!0);
return
}
if (u)
return u;
u = new Promise(function(e) {
var r = document.createElement("script");
r.src = "https://fe-video-qc.xhscdn.com/fe-platform/abf6e0874371419fa6fffa7540610e2013588fe6/html2canvas.min.js",
document.head.appendChild(r),
r.onload = function() {
e(!0)
}
,
r.onerror = function() {
e(!1)
}
}
)
}
function stringifyCyclicObject() {
var e = [];
return function(r, i) {
if ((void 0 === i ? "undefined" : (0,
T._)(i)) === "object" && null !== i) {
if (-1 !== e.indexOf(i))
return;
e.push(i)
}
return i
}
}
var ef = !1
, jsErrorPlugin = function(e) {
try {
if (ef)
return;
ef = !0;
for (var reportJsError = function(r) {
try {
var i = e.options.jsError
, a = getJsErrorReportMetrics(r, i);
a && e.flush(a)
} catch (r) {
reportInnerError(r, e)
}
}, r = window.__ERROR_TRACKER_BUFFER__ || []; r.length; ) {
var i = r.shift()
, a = i.error
, s = i.extra || {}
, u = s.colno
, c = s.lineno
, l = s.source
, d = {
type: "onerror",
errorLineNumber: c,
errorColNumber: u,
errorFilePath: l && l.trim(),
errorStack: a && a.stack,
errorType: a && a.name,
errorMessage: String(a && a.message || a)
};
reportJsError(d)
}
window.onerror = function(e, r, i, a, s) {
var u = {
type: "onerror",
errorLineNumber: i,
errorColNumber: a,
errorFilePath: r && r.trim(),
errorStack: s && s.stack,
errorType: s && s.name,
errorMessage: String(e)
}
, c = u.errorType
, l = u.errorMessage
, d = u.errorFilePath;
window.apm_blankScreen_error = {
errorType: c,
content: l
};
var p = "jserror-".concat(d, "-").concat(c, "-").concat(l, "-").concat(i, "-").concat(a);
if (!errorExist(p))
setError(p),
reportJsError(u)
}
} catch (r) {
reportInnerError(r, e)
}
}
, catchHttpNetworkError = function(e) {
var r = e.config || {
method: "",
url: "",
data: "",
params: ""
}
, i = r.method
, a = r.url
, s = r.data
, u = r.params;
return {
measurement_name: O,
measurement_data: {
method: i,
errorType: "HTTPNetworkError",
url: a,
errorMsg: e.message,
data: "get" === i ? u : s
}
}
}
, ev = !1
, monitor_promiseRejectPlugin = function(e) {
if (!ev) {
ev = !0;
var reportPromiseReject = function(r) {
var i = getJsErrorReportMetrics(r, e.options.jsError);
i && e.flush(i)
};
window.addEventListener("unhandledrejection", function(r) {
try {
var i, a, s, u, c, l = r && r.reason && r.reason.name;
if ("string" == typeof r.reason)
i = r.reason;
else if (null !== r.reason && "object" === (0,
T._)(r.reason)) {
if (r.reason.isAxiosError) {
var d = catchHttpNetworkError(r.reason);
e.flush(d);
return
}
if (r.reason.stack) {
for (var p = r.reason.stack.split("\n"), f = 0; p && f < p.length; f++) {
var v = /:(\d+:\d+)\)$/.exec(p[f]);
if (v && v[1]) {
var g = v[1].split(":");
a = p[f],
s = parseInt(g[0], 10) || 0,
u = parseInt(g[1], 10) || 0;
break
}
}
}
i = r.reason.message,
c = r.reason.stack
}
var h = {
type: "promise",
errorLineNumber: s,
errorColNumber: u,
errorFilePath: a && a.trim(),
errorStack: c,
errorType: l,
errorMessage: i
};
reportPromiseReject(h)
} catch (r) {
reportInnerError(r, e)
}
})
}
}
, eg = i(64593);
i(1154),
i(80013),
i(57745);
var eh = ["t.xiaohongshu.com", "spltest.xiaohongshu.com", "t2.xiaohongshu.com", "t2-test.xiaohongshu.com", "lng.xiaohongshu.com", "apm-track.xiaohongshu.com", "apm-track-test.xiaohongshu.com", "fse.xiaohongshu.com", "fse.devops.xiaohongshu.com", "fesentry.xiaohongshu.com"]
, em = /\/\/(\S+?)[/|:]/;
function helpers_now() {
return Date.now() || +new Date
}
function isForbiddenUrl() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ""
, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : eh
, i = e.match(/:\/\/(.[^/]+)/)
, a = i && i[1] || "";
return r.some(function(e) {
return e === a
})
}
function getTimeFromMarks(e, r) {
var i = (0,
w._)(e.filter(function(e) {
return e.name === r
}), 1)[0];
return i ? i.startTime : null
}
function toDict() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
return e.toJSON && "function" == typeof e.toJSON ? e.toJSON() : Object.keys(Object.getPrototypeOf(e)).reduce(function(r, i) {
return "function" != typeof e[i] && (r[i] = e[i]),
r
}, {})
}
var e_ = Object.prototype.toString
, isUndef = function(e) {
return null == e
}
, isFunc = function(e) {
return "function" == typeof e
}
, ey = ["connectEnd", "connectStart", "domComplete", "domContentLoadedEventEnd", "domContentLoadedEventStart", "domInteractive", "domLoading", "domainLookupEnd", "domainLookupStart", "fetchStart", "loadEventEnd", "loadEventStart", "navigationStart", "redirectEnd", "redirectStart", "requestStart", "responseEnd", "responseStart", "secureConnectionStart", "unloadEventEnd", "unloadEventStart"]
, ew = {}
, eE = []
, eS = helpers_now();
function resetEntries(e) {
var r = {}
, i = [];
eE.forEach(function(a) {
a.entryType !== e && (r[a.name] = a,
i.push(a))
}),
ew = r,
eE = i
}
function removeEntry(e, r) {
if (isUndef(r)) {
resetEntries(e);
return
}
eE = eE.filter(function(i) {
return i.name !== r || i.entryType !== e
});
var i = ew[r];
i && i.entryType === e && (ew[r] = void 0)
}
function ShadowPerformanceEntry(e, r, i, a) {
this.name = e,
this.duration = a,
this.entryType = r,
this.startTime = i
}
function wrap(e) {
function setupPolyfill(r, i) {
isUndef(e.performance[r]) && (e.performance[r] = i)
}
return e.performance = e.performance || {},
setupPolyfill("now", function() {
return "function" == typeof eS ? helpers_now() - eS() : helpers_now() - eS
}),
setupPolyfill("mark", function(e) {
if (ey.indexOf(e) >= 0)
throw Error("Failed to execute 'mark' on 'Performance': '".concat(e, "' is part of the PerformanceTiming interface, and cannot be used as a mark name."));
var r = new ShadowPerformanceEntry(e,"mark",performance.now(),0);
eE.push(r),
ew[e] = r
}),
setupPolyfill("measure", function(e, r, i) {
var a = 0
, s = 0
, u = helpers_now();
if (isUndef(r))
a = 0;
else if (ew[r])
a = ew[r].startTime;
else
throw Error("Failed to execute 'measure' on 'Performance': The mark '".concat(r, "' dose not exist."));
if (isUndef(i))
s = u;
else if (ew[i])
s = ew[i].startTime;
else
throw Error("Failed to execute 'measure' on 'Performance': The mark '".concat(i, "' dose not exist."));
var c = new ShadowPerformanceEntry(e,"measure",a,s - a);
eE.push(c),
ew[e] = c
}),
setupPolyfill("clearMarks", function(e) {
removeEntry("mark", e)
}),
setupPolyfill("clearMeasures", function(e) {
removeEntry("measure", e)
}),
setupPolyfill("getEntries", function(e) {
var r, i = eE;
return isUndef(e) ? i : (e.entryType ? r = e.name ? function(r) {
return r.entryType === e.entryType && r.name === e.name
}
: function(r) {
return r.entryType === e.entryType
}
: e.name && (r = function(r) {
return r.name === e.name
}
),
i.filter(r))
}),
setupPolyfill("getEntriesByName", function(r, i) {
var a = {
name: r
};
return i && (a.entryType = i),
e.performance.getEntries(a)
}),
setupPolyfill("getEntriesByType", function(r) {
return e.performance.getEntries({
entryType: r
})
}),
e.performance.setupPolyfill = setupPolyfill,
e.performance.setNavigationStart = function(e) {
eS = e
}
,
e.performance
}
ShadowPerformanceEntry.prototype.toJSON = function toJSON() {
return {
name: this.name,
duration: this.duration,
entryType: this.entryType,
startTime: this.startTime
}
}
;
function supportNavigationTiming() {
return !!(window.performance && window.performance.timing)
}
function supportUserTiming() {
return !!(window.performance.mark && window.performance.measure && window.performance.clearMarks && window.performance.clearMeasures && window.performance.getEntries && window.performance.getEntriesByType && window.performance.getEntriesByName)
}
wrap(window);
var eT = i(35329)
, eb = i(27292)
, ek = i(34134)
, eC = function() {
function PerfTiming() {
(0,
f._)(this, PerfTiming)
}
return (0,
v._)(PerfTiming, [{
key: "timing",
value: function timing() {
return {}
}
}, {
key: "responseCatchHook",
value: function responseCatchHook(e, r, i) {
return e
}
}, {
key: "observe",
value: function observe() {}
}, {
key: "validate",
value: function validate(e, r) {
for (; r.length; ) {
var i, a = r.shift();
if (!a.prop)
break;
if (a.default && (e[a.prop] = a.default),
a.required && !e[a.prop])
throw Error("[".concat(this.constructor.name, "] Property '").concat(a.prop, "' is missing"));
var s = !0;
if (a.validator && isFunc(a.validator))
s = a.validator(e[a.prop], e);
else {
;if (a.pattern && (i = a.pattern,
e_.call(i, "[object RegExp]")))
s = a.pattern.test(e[a.prop])
}
if (!s)
throw TypeError("[".concat(this.constructor.name, "] Property '").concat(a.prop, "' is invalid"))
}
}
}]),
PerfTiming
}();
function getPaintTimes() {
var e = null
, r = null
, i = window.performance.getEntriesByType("paint");
if (i && i.length)
e = getTimeFromMarks(i, "first-paint"),
r = getTimeFromMarks(i, "first-contentful-paint");
else {
if ("number" != typeof window.performance.timing.msFirstPaint)
return null;
e = window.performance.timing.msFirstPaint - window.performance.timing.navigationStart
}
return {
firstPaint: e,
firstContentfulPaint: r
}
}
var eP = new (function(e) {
function BrowserPaintTiming() {
return (0,
f._)(this, BrowserPaintTiming),
(0,
eT._)(this, BrowserPaintTiming, arguments)
}
return (0,
eb._)(BrowserPaintTiming, e),
(0,
v._)(BrowserPaintTiming, [{
key: "observe",
value: function observe() {
return ek.Z.get().then(function(e) {
var r = e.firstPaint
, i = e.firstContentfulPaint
, a = e.firstMeaningfulPaint
, s = e.fullyLoaded
, u = e.firstScreen
, c = getPaintTimes();
return !c && (c = {
firstPaint: void 0 === r ? null : r,
firstContentfulPaint: void 0 === i ? null : i
}),
{
paintTimes: c,
fullyLoaded: void 0 === s ? null : s,
firstMeaningfulPaint: void 0 === a ? null : a,
firstScreenPaint: void 0 === u ? null : u
}
})
}
}]),
BrowserPaintTiming
}(eC));
new (function(e) {
function BrowserServerTiming() {
return (0,
f._)(this, BrowserServerTiming),
(0,
eT._)(this, BrowserServerTiming, arguments)
}
return (0,
eb._)(BrowserServerTiming, e),
(0,
v._)(BrowserServerTiming, [{
key: "timing",
value: function timing() {
var e = (0,
w._)(window.performance.getEntriesByType("navigation"), 1)[0];
return e && e.serverTiming || []
}
}]),
BrowserServerTiming
}(eC)),
new (function(e) {
function BrowserResourceTiming() {
return (0,
f._)(this, BrowserResourceTiming),
(0,
eT._)(this, BrowserResourceTiming, arguments)
}
return (0,
eb._)(BrowserResourceTiming, e),
(0,
v._)(BrowserResourceTiming, [{
key: "timing",
value: function timing() {
var e = window.performance.getEntriesByType("resource")
, r = this.filterResources(e).map(function(e) {
var r = e.toJSON();
try {
r.hostname = r.name.match(em)[1]
} catch (e) {}
return delete r.serverTiming,
delete r.workerTiming,
r
});
return isFunc(window.performance.clearResourceTimings) && window.performance.clearResourceTimings(),
r
}
}, {
key: "filterResources",
value: function filterResources() {
for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], r = [], i = 0; i < e.length; i++) {
var a = e[i];
if (!(isUndef(a.toJSON) || !isFunc(a.toJSON) || 0 === a.name.indexOf("data:") || 0 === a.name.indexOf("about:") || 0 === a.name.indexOf("javascript:") || isForbiddenUrl(a.name)))
r.push(a)
}
return r
}
}]),
BrowserResourceTiming
}(eC));
var eA = new (function(e) {
function BrowserNavigationTiming() {
return (0,
f._)(this, BrowserNavigationTiming),
(0,
eT._)(this, BrowserNavigationTiming, arguments)
}
return (0,
eb._)(BrowserNavigationTiming, e),
(0,
v._)(BrowserNavigationTiming, [{
key: "timing",
value: function timing() {
var e = toDict(window.performance.timing);
return void 0 !== e.timeToNonBlankPaint && delete e.timeToNonBlankPaint,
void 0 !== e.timeToDOMContentFlushed && delete e.timeToDOMContentFlushed,
e
}
}]),
BrowserNavigationTiming
}(eC));
function serializeParams() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ""
, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return Object.keys(r).reduce(function(e, i) {
var a = r[i];
if (!a)
return e;
var s = "".concat(encodeURIComponent(i), "=").concat(encodeURIComponent(a));
return -1 === e.indexOf("?") ? e += "?".concat(s) : e += "&".concat(s),
e
}, e)
}
var eR = function() {
function HttpTracker() {
(0,
f._)(this, HttpTracker),
this.entryHash = {}
}
return (0,
v._)(HttpTracker, [{
key: "resetEntryHash",
value: function resetEntryHash() {
this.entryHash = {}
}
}, {
key: "track",
value: function track(e, r) {
if (!e)
throw Error("[apm-metrics] mark name is required");
var i = this.entryHash[e];
void 0 !== i ? (performance.mark("".concat(e, "_end")),
this.entryHash[e] = (0,
h._)({}, i, r)) : (performance.mark("".concat(e, "_start")),
this.entryHash[e] = r)
}
}, {
key: "measure",
value: function measure(e) {
var r = this.entryHash[e];
if (!r)
return {};
try {
performance.measure(e, "".concat(e, "_start"), "".concat(e, "_end"))
} catch (e) {
return {}
}
var i = (0,
w._)(performance.getEntriesByName(e, "measure"), 1)[0];
return (0,
y._)((0,
h._)({}, r), {
measure: toDict(i)
})
}
}]),
HttpTracker
}();
function createHttpTracker() {
return new eR
}
var eI = Array(16);
function mathRNG() {
for (var e, r = 0; r < 16; r++)
(3 & r) == 0 && (e = 0x100000000 * Math.random()),
eI[r] = e >>> ((3 & r) << 3) & 255;
return eI
}
var toJsonData = function(e) {
if (!e)
return {};
if ((void 0 === e ? "undefined" : (0,
T._)(e)) === "object") {
if ("[object FormData]" === Object.prototype.toString.call(e)) {
var r = {}
, i = !0
, a = !1
, s = void 0;
try {
for (var u, c = e.entries()[Symbol.iterator](); !(i = (u = c.next()).done); i = !0) {
var l = u.value;
r[l[0]] = l[1]
}
} catch (e) {
a = !0,
s = e
} finally {
try {
!i && null != c.return && c.return()
} finally {
if (a)
throw s
}
}
return r
}
return e
}
if ("string" == typeof e)
try {
return JSON.parse(e)
} catch (e) {}
return {}
}
, eO = "x-b3-traceid"
, eN = "x-xray-traceid"
, eL = ["post", "put", "patch", "delete"]
, eM = new (function(e) {
function BrowserHttpRequestTiming() {
var e;
return (0,
f._)(this, BrowserHttpRequestTiming),
e = (0,
eT._)(this, BrowserHttpRequestTiming, arguments),
(0,
g._)(e, "httpTracker", {}),
e
}
return (0,
eb._)(BrowserHttpRequestTiming, e),
(0,
v._)(BrowserHttpRequestTiming, [{
key: "measure",
value: function measure(e, r) {
this.httpTracker.track(e, r);
var i = this.httpTracker.measure(e)
, a = i.measure
, s = void 0 === a ? {} : a
, u = (0,
eg._)(i, ["measure"]);
return s.name = u.url,
delete u.url,
{
meta: u,
measure: s
}
}
}, {
key: "observe",
value: function observe() {
var e = this
, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, i = this
, a = r.httpClient
, s = r.callback
, u = r.enableResponseData
, c = void 0 !== u && u
, l = r.enableRequestPayload
, d = void 0 !== l && l;
this.validate(r, [{
prop: "httpClient",
required: !0
}, {
prop: "callback",
required: !0,
validator: function(e) {
return "function" == typeof e
}
}]),
this.httpTracker = createHttpTracker(),
a.interceptors.request.use(function(r) {
return !isForbiddenUrl(r.url) && (r.rid = (0,
_.Z)({
rng: mathRNG
}),
e.httpTracker.track(r.rid, {
method: r.method,
matchedPath: r.matchedPath,
traceId: r.headers[eN] || r.headers[eO]
})),
r
}),
a.interceptors.response.use(function(e) {
var r, a, u, l, p, f = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, v = arguments.length > 2 ? arguments[2] : void 0, g = null !== (l = null != v ? v : f.config) && void 0 !== l ? l : {}, h = null == f ? void 0 : null === (r = f.requestHeader) || void 0 === r ? void 0 : r[eN];
if (isForbiddenUrl(g.url))
return e;
var m = f.request || {}
, y = {
status: f.status,
url: m.responseURL
}
, w = i.measure(g.rid, y);
w.reqAndRes = {},
w.meta.url = g.url,
g.level && (w.meta.level = g.level);
var E = (null == f ? void 0 : null === (a = f.headers) || void 0 === a ? void 0 : a.h5ApiPrefetch) || 5;
w.meta.apiPrefetchType = E;
var S = (null == f ? void 0 : null === (u = f.config) || void 0 === u ? void 0 : u.trackData) || {}
, T = S.prefetch
, b = S.requestEndTime
, k = S.requestStartTime;
w.meta.prefetch = T,
w.meta.requestStartTime = k,
w.meta.requestEndTime = b,
h && (w.meta.traceId = h);
var C = void 0 !== e.success && !1 == !!e.success;
C && (w.meta.errorType = "HTTPBizError",
w.meta.errorCode = e.code,
w.meta.errorMsg = e.msg);
var P = (0,
_.Z)({
rng: mathRNG
});
if ((C || !0 === d) && eL.includes(null === (p = g.method) || void 0 === p ? void 0 : p.toLowerCase()))
try {
w.reqAndRes._apm_related_http_id = P,
w.reqAndRes.payload = toJsonData(g.data),
w.meta.data = JSON.stringify({
_apm_related_http_id: P
})
} catch (e) {}
if (C || !0 === c)
try {
w.reqAndRes._apm_related_http_id = P,
w.reqAndRes.response = toJsonData(e),
w.meta.data = JSON.stringify({
_apm_related_http_id: P
})
} catch (e) {}
return s(w),
e
}, function(e) {
var r, u, c, l, d, p, f = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, v = arguments.length > 2 ? arguments[2] : void 0, g = null !== (l = null != v ? v : f ? f.config : {}) && void 0 !== l ? l : {}, h = null == f ? void 0 : null === (r = f.requestHeader) || void 0 === r ? void 0 : r[eN];
if (isForbiddenUrl(g.url))
throw e;
var m = {
meta: {
method: g.method,
matchedPath: g.matchedPath,
status: e.status || e.statusCode || 0,
errorType: e.name,
traceId: h || g.headers[eN] || g.headers[eO],
url: g.url,
errorMsg: e.message
},
measure: {
entryType: "measure",
name: serializeParams(g.url, null !== (d = g.params) && void 0 !== d ? d : {})
},
reqAndRes: {}
}
, y = (null == f ? void 0 : null === (u = f.headers) || void 0 === u ? void 0 : u.h5ApiPrefetch) || 5;
m.meta.apiPrefetchType = y;
var w = (null == f ? void 0 : null === (c = f.config) || void 0 === c ? void 0 : c.trackData) || {}
, E = w.prefetch
, S = w.requestEndTime
, T = w.requestStartTime;
if (m.meta.prefetch = E,
m.meta.requestStartTime = T,
m.meta.requestEndTime = S,
g.level && (m.meta.level = g.level),
["HTTPClientError", "HTTPServerError"].includes(e.name)) {
if (g.params && Object.keys(g.params).length > 0 && isFunc(a.getUri) && (m.meta.url = a.getUri(g)),
eL.includes(null === (p = m.meta.method) || void 0 === p ? void 0 : p.toLowerCase())) {
var b = (0,
_.Z)({
rng: mathRNG
});
m.reqAndRes.payload = toJsonData(g.data),
m.reqAndRes._apm_related_http_id = b,
m.meta.data = JSON.stringify({
_apm_related_http_id: b
})
}
"HTTPClientError" === e.name ? e.code && "N/A" !== e.code && (m.meta.code = e.code) : "HTTPServerError" === e.name && e.code && "N/A" !== e.code && (m.meta.errorCode = e.code),
s(i.responseCatchHook(m, e, g))
}
throw e
})
}
}]),
BrowserHttpRequestTiming
}(eC));
function getMemory() {
var e = toDict(window.performance.memory);
return {
jsHeapSizeLimit: e.jsHeapSizeLimit,
totalJsHeapSize: e.totalJSHeapSize,
usedJsHeapSize: e.usedJSHeapSize
}
}
function getNetwork() {
var e = toDict(window.navigator.connection);
return void 0 !== e.onchange && delete e.onchange,
{
downlink: e.downlink,
effectiveType: e.effectiveType,
rtt: e.rtt,
saveData: e.saveData,
type: e.type
}
}
function getRenderTimes() {
var e = window.performance.getEntriesByType("mark");
return {
firstRenderStart: getTimeFromMarks(e, "firstRenderStart"),
clientRenderStart: getTimeFromMarks(e, "clientRenderStart")
}
}
function getScriptsExecutionTiming() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window.__SCRIPTS_EXECUTION_TIMING__;
return (e || []).map(function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, r = (0,
h._)({}, e);
return r.endTime && r.startTime ? (r.duration = r.endTime - r.startTime,
delete r.endTime) : r.duration = 0,
r
})
}
function getResourceError() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "__APM__ResourceErrorTracker__"
, r = JSON.parse(localStorage.getItem(e));
if (null == r ? void 0 : r.length) {
for (var i = [], a = [], s = 0; s < r.length; s++)
if ("xhs-pc-web" === r[s].projectName) {
var u = r[s]
, c = (u.projectName,
(0,
eg._)(u, ["projectName"]));
i.push(c)
} else
r[s].projectName && a.push(r[s]);
return localStorage.setItem(e, JSON.stringify(a)),
i
}
return []
}
var eB = new (function(e) {
function EnhancedMetrics() {
return (0,
f._)(this, EnhancedMetrics),
(0,
eT._)(this, EnhancedMetrics, arguments)
}
return (0,
eb._)(EnhancedMetrics, e),
(0,
v._)(EnhancedMetrics, [{
key: "timing",
value: function timing() {
return {
memory: getMemory(),
network: getNetwork(),
renderTimes: getRenderTimes(),
scriptsExecutionTiming: getScriptsExecutionTiming(),
resourceError: getResourceError()
}
}
}]),
EnhancedMetrics
}(eC))
, ex = Object.prototype.toString
, typeor_isFunc = function(e) {
return "function" == typeof e
}
, eD = function() {
function PerfTiming() {
(0,
f._)(this, PerfTiming)
}
return (0,
v._)(PerfTiming, [{
key: "timing",
value: function timing() {
return {}
}
}, {
key: "responseCatchHook",
value: function responseCatchHook(e) {
return e
}
}, {
key: "observe",
value: function observe() {}
}, {
key: "validate",
value: function validate(e, r) {
for (; r.length; ) {
var i, a = r.shift();
if (!a.prop)
break;
if (a.default && (e[a.prop] = a.default),
a.required && !e[a.prop])
throw Error("[".concat(this.constructor.name, "] Property '").concat(a.prop, "' is missing"));
var s = !0;
if (a.validator && typeor_isFunc(a.validator))
s = a.validator(e[a.prop], e);
else {
;if (a.pattern && (i = a.pattern,
ex.call(i)))
s = a.pattern.test(e[a.prop])
}
if (!s)
throw TypeError("[".concat(this.constructor.name, "] Property '").concat(a.prop, "' is invalid"))
}
}
}]),
PerfTiming
}()
, eF = /\/\/(\S+?)[/|:]/;
function helpers_isForbiddenUrl() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ""
, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : C;
return r.some(function(r) {
return -1 !== e.indexOf(r)
})
}
var eV = new (function(e) {
function BrowserResourceTiming() {
return (0,
f._)(this, BrowserResourceTiming),
(0,
eT._)(this, BrowserResourceTiming, arguments)
}
return (0,
eb._)(BrowserResourceTiming, e),
(0,
v._)(BrowserResourceTiming, [{
key: "timing",
value: function timing() {
var e = window.performance.getEntriesByType("resource")
, r = this.filterResources(e).map(function(e) {
var r = e.toJSON();
try {
r.hostname = r.name.match(eF)[1]
} catch (e) {}
return delete r.serverTiming,
delete r.workerTiming,
r
});
return typeor_isFunc(window.performance.clearResourceTimings) && window.performance.clearResourceTimings(),
r
}
}, {
key: "filterResources",
value: function filterResources() {
for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], r = [], i = 0; i < e.length; i++) {
var a, s = e[i];
if (!(null == (a = s.toJSON) || !typeor_isFunc(s.toJSON) || 0 === s.name.indexOf("data:") || 0 === s.name.indexOf("about:") || 0 === s.name.indexOf("javascript:") || helpers_isForbiddenUrl(s.name)))
r.push(s)
}
return r
}
}]),
BrowserResourceTiming
}(eD));
function splitEntries() {
for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 30, i = []; e.length; ) {
var a = e.slice(0, r);
i.push(a),
e = e.slice(r)
}
return i
}
var eH = function() {
function PerformanceCollector(e) {
var r = this;
arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
(0,
f._)(this, PerformanceCollector),
(0,
g._)(this, "client", void 0),
this.client = e,
window.addEventListener("load", function() {
return setTimeout(function() {
setFirstScreen(0),
r.track()
}, 0)
}),
supportUserTiming() && (this.observePaintTiming(),
this.handleResourceBuffer())
}
return (0,
v._)(PerformanceCollector, [{
key: "handleResourceBuffer",
value: function handleResourceBuffer() {
var e = this;
window.performance.onresourcetimingbufferfull = function() {
e.sendResourceBuffer()
}
,
(0,
S.Ld)("viewDidDisappear", function() {
return e.sendResourceBuffer()
})
}
}, {
key: "getResourceTiming",
value: function getResourceTiming() {
return {
type: "BrowserResourceTiming",
value: eV.timing()
}
}
}, {
key: "track",
value: function track() {
var e = eB.timing();
if (this.sendMetrics({
browserMemory: {
type: "BrowserMemory",
value: e.memory
}
}),
this.sendMetrics({
browserNetwork: {
type: "BrowserNetwork",
value: e.network
}
}),
supportNavigationTiming() && this.sendMetrics({
browserNavigationTiming: {
type: "BrowserNavigationTiming",
value: eA.timing()
}
}),
e.scriptsExecutionTiming.length > 0 && this.sendMetrics({
browserScriptsExecutionTiming: {
type: "BrowserPerformanceMeasure",
value: e.scriptsExecutionTiming
}
}),
supportUserTiming()) {
var r = this.getResourceTiming();
this.sendMetrics({
browserResourceTiming: r
});
var i = [];
r.value.forEach(function(e) {
if (M.includes(e.initiatorType)) {
var r = Math.round(e.domainLookupEnd - e.domainLookupStart) || 0
, a = Math.round(e.connectEnd - e.connectStart) || 0
, s = Math.round(e.responseEnd - e.requestStart) || 0
, u = Math.round(e.responseEnd - e.responseStart) || 0
, c = Math.round(e.redirectEnd - e.redirectStart) || 0
, l = Math.round(e.responseStart - e.requestStart) || 0
, d = +(0 === e.transferSize || 0 !== e.transferSize && 0 === e.encodedBodySize);
i.push({
dnsTime: r,
tcpTime: a,
responseTime: s,
contentTime: u,
redirectTime: c,
serverTime: l,
collectTime: String(Date.now()),
name: e.name,
encodedBodySize: e.encodedBodySize,
isHitCache: d,
initiatorType: e.initiatorType,
duration: c + r + a + s,
transferSize: e.transferSize || 0
})
}
}),
this.sendXrayMetircs("infraBrowserResourceTiming", i),
e.renderTimes && this.sendMetrics({
browserRenderTimes: {
type: "BrowserRenderTimes",
value: e.renderTimes
}
})
}
}
}, {
key: "observePaintTiming",
value: function observePaintTiming() {
var e = this;
eP.observe().then(function(r) {
var i = r.paintTimes
, a = (0,
eg._)(r, ["paintTimes"]);
e.sendMetrics({
browserPaintTimes: {
type: "BrowserPaintTimes",
value: i
}
}),
e.sendMetrics({
browserFmpTimes: {
type: "BrowserFmpTimes",
value: a
}
})
})
}
}, {
key: "sendMetrics",
value: function sendMetrics(e) {
if (!!this.client && void 0 !== (0,
T._)(this.client.push) && "function" == typeof this.client.push && 0 !== Object.keys(e).length)
this.client.push({
browserApmTracker: {
type: "BrowserApmTracker",
value: e
}
})
}
}, {
key: "sendXrayMetircs",
value: function sendXrayMetircs(e, r) {
var i = this;
this.client && void 0 !== (0,
T._)(this.client.push) && "function" == typeof this.client.push && r.length && r.forEach(function(r) {
i.client.push({
measurement_name: e,
measurement_data: r
})
})
}
}, {
key: "sendResourceBuffer",
value: function sendResourceBuffer() {
var e = this.getResourceTiming()
, r = e.type
, i = e.value;
if (!!i.length)
for (var a = splitEntries(i, 50); a.length; )
this.sendMetrics((0,
g._)({}, r, {
type: r,
value: a.shift()
}))
}
}]),
PerformanceCollector
}()
, eU = !1
, performance_performancePlugin = function(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
!eU && (eU = !0,
new eH(e,r))
};
function initMetric(e) {
var r = {
nqeLevel: "unknow",
deviceLevel: "unknow"
};
return {
measurement_name: e,
measurement_data: ({
visualStability: (0,
y._)((0,
h._)({}, r), {
cumulativeLayoutShift: -1
}),
interactiveTiming: (0,
y._)((0,
h._)({}, r), {
firstInputDelay: -1,
interactionToNextPaint: -1
}),
paintTiming: (0,
y._)((0,
h._)({}, r), {
largestContentfulPaint: -1,
firstContentfulPaint: -1,
firstMeaningfulPaint: -1,
timeToFirstByte: -1,
lcpRenderDelay: -1,
lcpElement: "",
lcpResourceLoadTime: -1,
lcpUrl: "",
staticResourceEntries: "",
staticResourceTime: -1,
webViewCreateCost: -1,
routerToLoadUrl: -1,
isHitCache: 0,
cacheHitCount: -1,
pullSdkMainfest: ""
}),
navigationTiming: (0,
y._)((0,
h._)({}, r), {
webViewCreateCost: -1,
routerToLoadUrl: -1,
dnsTime: -1,
tcpTime: -1,
responseTime: -1,
contentTime: -1,
domParseTime: -1,
resourceLoadTime: -1,
redirectTime: -1,
serverTime: -1,
domLoadTime: -1,
pageLoadTime: -1
})
})[e]
}
}
var getNavigationTiming = function(e) {
var r, i, a, s, u = initMetric("navigationTiming"), c = Number(e.activationStart || e.navigationStart || 0);
return (window.PerformanceObserver || window.performance && window.performance.timing) && (u.measurement_data = (0,
y._)((0,
h._)({}, u.measurement_data), {
webViewCreateCost: (null === (i = window) || void 0 === i ? void 0 : null === (r = i.XHSMonitor) || void 0 === r ? void 0 : r.WebViewCreateCost) || -1,
routerToLoadUrl: (null === (s = window) || void 0 === s ? void 0 : null === (a = s.XHSMonitor) || void 0 === a ? void 0 : a.RouterToLoadUrl) || -1,
dnsTime: Math.round(e.domainLookupEnd - e.domainLookupStart),
tcpTime: Math.round(e.connectEnd - e.connectStart),
responseTime: Math.round(e.responseEnd - e.requestStart),
contentTime: Math.round(e.responseEnd - e.responseStart),
domParseTime: Math.round(e.domInteractive - e.responseEnd),
deferJSRuntime: Math.round(e.domContentLoadedEventStart - e.domInteractive),
resourceLoadTime: Math.abs(Math.round(e.loadEventStart - e.domContentLoadedEventEnd)),
redirectTime: Math.round(e.redirectEnd - e.redirectStart),
serverTime: Math.round(e.responseStart - e.requestStart),
domLoadTime: Math.round(e.domContentLoadedEventEnd - c),
pageLoadTime: Math.round(e.loadEventEnd - c)
})),
u.measurement_data
}
, eq = ["script", "img", "css", "link", "svg"]
, initResourceTimingCache = function() {
var e = window.performance.clearResourceTimings;
return window.performance.clearResourceTimings = function() {
var r = window.performance.getEntriesByType("resource");
if (window.performance.resourcesBufferCache = (window.performance.resourcesBufferCache || []).concat(r),
"function" == typeof e)
return e.call(window.performance)
}
,
function() {
window.performance.resourcesBufferCache && (window.performance.resourcesBufferCache = []),
"function" == typeof e && (window.performance.clearResourceTimings = e)
}
}
, getResourceTiming_getResourceTiming = function() {
var e = {
staticResourceEntries: "",
staticResourceTime: -1
};
if (window.performance) {
var r = window.performance.resourcesBufferCache
, i = window.performance.getEntriesByType("resource").concat(r).filter(function(e) {
return !!e
}).filter(function(e) {
return eq.includes(null == e ? void 0 : e.initiatorType)
});
e.staticResourceEntries = JSON.stringify(i.map(function(e) {
return {
name: e.name,
responseEnd: e.responseEnd,
fetchStart: e.fetchStart,
responseStatus: null == e ? void 0 : e.responseStatus,
duration: e.duration
}
})),
e.staticResourceTime = Math.round(i.reduce(function(e, r) {
return e + r.duration
}, 0))
}
return e
}
, getLcpAttributionMetrics = function(e) {
var r, i = {
lcpElement: (null == e ? void 0 : e.element) || "",
lcpUrl: (null == e ? void 0 : e.url) || "",
lcpResourceLoadDelay: -1,
lcpResourceLoadTime: -1,
lcpRenderDelay: -1,
lcpResourceRT: -1
}, a = "" !== i.lcpUrl && ((null === (r = window.performance) || void 0 === r ? void 0 : r.resourcesBufferCache) || []).concat(performance.getEntriesByType("resource")).find(function(e) {
return e.name === i.lcpUrl
});
if (a) {
var s = e.timeToFirstByte || Math.max(window.performance.timing.responseStart - window.performance.timing.navigationStart, 0)
, u = e.lcpEntry
, c = a.requestStart || a.startTime
, l = a.responseEnd
, d = Math.max(l, u ? u.startTime : 0);
i.lcpResourceLoadDelay = c - s,
i.lcpResourceLoadTime = l - c,
i.lcpRenderDelay = d - l,
i.lcpResourceRT = a.duration
}
return i
}
, getXHSPrefetchMetrics = function() {
var e, r, i, a, s, u, c, l, d, p;
return {
isHitCache: (null === (r = window) || void 0 === r ? void 0 : null === (e = r.XHSPrefetch) || void 0 === e ? void 0 : e.localCacheHit) !== void 0 ? null === (a = window) || void 0 === a ? void 0 : null === (i = a.XHSPrefetch) || void 0 === i ? void 0 : i.localCacheHit : 0,
cacheHitCount: (null === (u = window) || void 0 === u ? void 0 : null === (s = u.XHSPrefetch) || void 0 === s ? void 0 : s.cacheHitCount) !== void 0 ? null === (l = window) || void 0 === l ? void 0 : null === (c = l.XHSPrefetch) || void 0 === c ? void 0 : c.cacheHitCount : -1,
pullSdkMainfest: JSON.stringify((null === (p = window) || void 0 === p ? void 0 : null === (d = p.XHSPrefetch) || void 0 === d ? void 0 : d.manifest) || "")
}
}
, getXHSBaseMetrics = function() {
var e, r;
return {
deviceLevel: (null === (e = ee.meta.xray) || void 0 === e ? void 0 : e.context_deviceLevel) || "unknow",
nqeLevel: (null === (r = ee.meta.xray) || void 0 === r ? void 0 : r.context_networkQuality) || "unknow"
}
}
, ej = i(50037)
, eW = i(57078);
i(97542);
var runOnce = function(e) {
var r = !1;
return function(i) {
!r && (e(i),
r = !0)
}
}
, onHidden = function(e) {
var onHiddenOrPageHide = function(r) {
("pagehide" === r.type || "hidden" === document.visibilityState) && e(r)
};
addEventListener("visibilitychange", onHiddenOrPageHide, !0),
addEventListener("pagehide", onHiddenOrPageHide, !0)
}
, eG = i(1799);
i(64091);
var isElementVisibleInViewport_isElementVisibleInViewport = function(e) {
if ("function" != typeof e.getBoundingClientRect)
return !1;
var r = e.getBoundingClientRect()
, i = getComputedStyle(e);
if ("none" === i.display || "0" === i.opacity && !i.transition.includes("opacity") || "hidden" === i.visibility || "collapse" === i.visibility || e.offsetWidth <= 0 || e.offsetHeight <= 0 || "" === i.display || "" === i.opacity || "" === i.visibility)
return !1;
var a = window.innerHeight || document.documentElement.clientHeight
, s = window.innerWidth || document.documentElement.clientWidth
, u = r.left
, c = r.top
, l = r.right
, d = r.bottom;
return u >= 0 && c >= 0 && l <= (s || 0) && d <= (a || 0)
};
function hasBackgroundImage(e) {
var r = window.getComputedStyle(e);
return r.getPropertyValue("background-image").includes("url") || r.getPropertyValue("background").includes("url")
}
var eJ = i(83782)
, getUrl = function(e) {
if (e) {
if ("img" === e.tagName.toLowerCase()) {
var r, i, a, s;
return (null === (r = e.previousElementSibling) || void 0 === r ? void 0 : r.tagName.toLowerCase()) === "source" || (null === (i = e.nextElementSibling) || void 0 === i ? void 0 : i.tagName.toLowerCase()) === "source" ? (null === (a = e.previousElementSibling) || void 0 === a ? void 0 : a.getAttribute("srcset")) || (null === (s = e.nextElementSibling) || void 0 === s ? void 0 : s.getAttribute("srcset")) : e.getAttribute("src")
}
if (hasBackgroundImage(e)) {
var u = window.getComputedStyle(e)
, c = u.backgroundImage || u.background
, l = c.indexOf("url(");
if (-1 !== l) {
var d = c.indexOf(")", l);
if (-1 !== d)
return c.substring(l + 4, d).split('"').join("")
}
}
}
}
, onLCP = function(e) {
PerformanceObserver.supportedEntryTypes.includes("largest-contentful-paint") ? (0,
eW.NO)(e) : whenActivated(function() {
var r = window.__LDM__OBSERVER
, i = {
name: "LCP",
value: -1,
attribution: {}
}
, a = runOnce(function() {
try {
if (r && r.disconnect(),
r) {
var a, s = r.takeEntry();
i.attribution.element = (0,
eJ.G)(s.element);
var u = getUrl(s.element) || "";
i.attribution.url = u.startsWith("http") ? u : "https:" + u;
var c = "" !== i.attribution.url && ((null === (a = window.performance) || void 0 === a ? void 0 : a.resourcesBufferCache) || []).concat(performance.getEntriesByType("resource")).find(function(e) {
return e.name === i.attribution.url
})
, l = s.startTime - window.performance.timing.navigationStart
, d = (null == c ? void 0 : c.duration) || 0;
i.value = l + d,
i.attribution.lcpEntry = (0,
y._)((0,
h._)({}, s), {
url: i.attribution.url,
startTime: s.startTime - window.performance.timing.navigationStart
}),
i.value > 0 && e(i)
} else
(0,
eG.bw)("checkLcp").then(function(r) {
if (r.value) {
var a = JSON.parse(r.value.lcpMetrics || "{}")
, s = a.renderTime - window.performance.timing.navigationStart;
i.value = "number" == typeof s ? s : -1,
i.attribution.element = (null == a ? void 0 : a.layerName) || "",
i.attribution.resourceLoadDelay = (null == a ? void 0 : a.endType) || 0,
e(i)
}
}).catch(function() {})
} catch (e) {}
});
onHidden(a),
["keydown", "click"].forEach(function(e) {
window.addEventListener(e, a, !0)
})
})
};
i(28636);
var calcFMP = function(e) {
if (0 === e.length)
return null;
if (1 === e.length)
return {
value: e[0].t,
element: e[0].lastElement
};
for (var r = e[0], i = 1; i < e.length; i++) {
var a = e[i];
a.layoutSignificance > r.layoutSignificance && (r = a)
}
return {
value: r.t,
element: r.lastElement
}
}
, stopFMPDispatch = function() {
var e;
(null === (e = window) || void 0 === e ? void 0 : e.__stopFMPObserver__) && ["keydown", "click"].forEach(function(e) {
removeEventListener(e, window.__stopFMPObserver__, !0)
})
}
, onFMP = function(e, r) {
if (r.custom) {
var i = {
name: "CustomFMP",
type: "unknown",
value: -1,
element: ""
}
, a = runOnce(function(r) {
if ("object" === (0,
T._)(window.__CUSTOM_FMP_METRICS__)) {
var a = window.__CUSTOM_FMP_METRICS__;
i.value = a.value,
i.url = null == a ? void 0 : a.src,
i.element = a.id,
i.type = r,
e(i)
}
});
onHidden(function() {
return a("pagehide")
}),
["keydown", "click"].forEach(function(e) {
window.addEventListener(e, function() {
return a("interact")
}, !0)
}),
setTimeout(function() {
a("8s")
}, 8e3)
} else if ((null === (d = window) || void 0 === d ? void 0 : d.__USE_CUSTOM_TIMING__) && (null === (p = window) || void 0 === p ? void 0 : p.__CUSTOM_FMP_ELEMENTS__)) {
var s = {
name: "CustomFMP",
type: "unknown",
value: -1,
element: ""
}
, u = window.__CUSTOM_FMP_ELEMENTS__
, c = []
, l = runOnce(function(r) {
var i = c.sort(function(e, r) {
return e.priority - r.priority
})[0];
i && (s.value = i.startTime,
s.element = i.id,
s.extraData = (null == i ? void 0 : i.extraData) || {},
s.type = r),
e(s)
})
, pushEntry = function(e) {
var r, i = e.id, a = e.startTime, s = e.priority, u = e.extraData;
c.push({
id: i,
startTime: a,
priority: s,
extraData: u
}),
(null === (r = window.__CUSTOM_FMP_ELEMENTS__) || void 0 === r ? void 0 : r.length) === c.length && l("default")
};
window.addEventListener("__APM_FMP_EVENT__", function(e) {
var r, i;
if (null == e ? void 0 : null === (r = e.detail) || void 0 === r ? void 0 : r.id) {
;u.find(function(r) {
return r.id === e.detail.id
}) && pushEntry({
id: e.detail.id,
startTime: e.detail.startTime,
priority: e.detail.priority,
extraData: null === (i = e.detail) || void 0 === i ? void 0 : i.extraData
})
}
}),
onHidden(function() {
return l("pagehide")
}),
["keydown", "click"].forEach(function(e) {
window.addEventListener(e, function() {
return l("interact")
}, !0)
}),
setTimeout(function() {
l("8s")
}, 8e3)
} else {
if (!(null === (f = window) || void 0 === f ? void 0 : f.__FMP_OBSERVED_POINTS__))
return;
var d, p, f, v = {
name: "FMP",
type: "unknown",
value: -1
};
runOnce(function() {
try {
var r = !1
, i = window.sessionStorage.getItem("__REDIRECT_SPA_REFER__");
if (i)
return;
if (window.__FULLY_LOADED__ && window.__FMP_OBSERVED_POINTS__) {
var a = calcFMP(window.__FMP_OBSERVED_POINTS__) || {
value: -1,
element: ""
}
, s = a.value
, u = a.element;
return v.value = s,
v.element = u,
e(v),
r = !0,
stopFMPDispatch()
}
window.addEventListener("__fullyloaded__", function(a) {
if (!r && !i) {
var s, u = calcFMP(window.__FMP_OBSERVED_POINTS__) || {
value: -1,
element: ""
}, c = u.value, l = u.element;
v.value = c,
v.element = l,
v.type = (null == a ? void 0 : null === (s = a.detail) || void 0 === s ? void 0 : s.type) || "unknown",
e(v),
r = !0,
stopFMPDispatch()
}
})
} catch (e) {}
})(null)
}
}
, registerEventHandler = function(e, r) {
return function registerTargetEventHandler(i) {
var a = e[i];
return function eventHandler() {
for (var s = arguments.length, u = Array(s), c = 0; c < s; c++)
u[c] = arguments[c];
r && r();
var l = new Event(i.toLowerCase());
return a.apply(e, u),
window.dispatchEvent(l),
a
}
}
}
, eX = [];
function onSpaLoad_hasBackgroundImage(e) {
var r = window.getComputedStyle(e);
return r.getPropertyValue("background-image").includes("url") || r.getPropertyValue("background").includes("url")
}
var startSpaFMPObserve = function(e, r, i) {
if (null === (a = window) || void 0 === a ? void 0 : a.__FULLY_LOADED__) {
eX.forEach(function(e) {
window.removeEventListener("__spaLoaded__", e)
});
var a, s, u = {
name: "SPA_LOAD",
type: "first",
value: -1
}, reportSpaLoad = function(e) {
var a, s, c, l = null == e ? void 0 : null === (a = e.detail) || void 0 === a ? void 0 : a.observedPoints;
if (l && (null === (s = window) || void 0 === s ? void 0 : s.__SPA_LOAD__START__)) {
var d, p = (window.__SPA_LOAD__START__ || window.performance.timing.navigationStart) - window.performance.timing.navigationStart, f = ((null === (c = calcFMP(l)) || void 0 === c ? void 0 : c.value) || 0) - p;
f > 0 && (u.value = f),
(sessionStorage.getItem("__FMP__" + window.location.pathname) || "popstate" === i) && (u.type = "bfcache");
var v = sessionStorage.getItem("__SPA_REFER__");
null !== v && (u.spaLoadRefer = v),
sessionStorage.setItem("__FMP__" + window.location.pathname, f.toString());
(null === (d = window) || void 0 === d ? void 0 : d.__FMP_Observer__).disconnect(),
r(u)
}
}, c = null === (s = window) || void 0 === s ? void 0 : s.__FMP_Observer__;
if (c && c.disconnect(),
window.__FMP_OBSERVED_POINTS__ = [],
window.__FULLY_SPA_LOADED__ = 0,
window.__FULLY_LOADED__NAME__ = "__spaLoaded__",
window.__SPA_LOAD__START__ = Date.now(),
"function" != typeof window.__FMP_pushObservedPoints)
return 0;
window.__FMP_pushObservedPoints(!0);
c.observe(document, {
childList: !0,
subtree: !0,
attributes: !0,
attributeFilter: ["src"]
}),
window.addEventListener("__spaLoaded__", reportSpaLoad),
eX.push(reportSpaLoad)
}
}
, onSpaLoad_getCurrentTime = function() {
return performance.now()
}
, onSpaLoad_getElementVisibleArea = function(e) {
var r = e.getBoundingClientRect();
return r.width * r.height
}
, onSpaLoad_getUrl = function(e) {
if (e) {
if ("img" === e.tagName.toLowerCase())
return e.getAttribute("src");
if (onSpaLoad_hasBackgroundImage(e)) {
var r = window.getComputedStyle(e)
, i = r.backgroundImage || r.background
, a = i.indexOf("url(");
if (-1 !== a) {
var s = i.indexOf(")", a);
if (-1 !== s)
return i.substring(a + 4, s).split('"').join("")
}
}
}
}
, eY = {
startTime: 0,
size: 0,
url: "",
element: null
}
, startSpaLCPObserve = function(e, r, i) {
if ("replacestate" !== i) {
l = onSpaLoad_getCurrentTime(),
eY = {
startTime: 0,
size: 0,
url: "",
element: null
},
new PerformanceObserver(function(e) {
e.getEntries().forEach(function(e) {})
}
).observe({
type: "element",
buffered: !0
}),
c && (c.disconnect(),
c = null);
var a = runOnce(function() {
var e, a = ((null == eY ? void 0 : eY.startTime) || 0) - (l || 0);
if (!Number.isNaN(a)) {
var s = {
name: "SPA_LOAD",
type: "first",
value: a > 0 ? a : 0,
spaLoadResourceUrl: onSpaLoad_getUrl(null == eY ? void 0 : eY.element),
spaLoadElement: (0,
eJ.G)(null == eY ? void 0 : eY.element),
spaLoadResourceRT: 0,
spaLoadRefer: sessionStorage.getItem("__SPA_REFER__") || ""
}
, u = "" !== s.lcpUrl && ((null === (e = window.performance) || void 0 === e ? void 0 : e.resourcesBufferCache) || []).concat(performance.getEntriesByType("resource")).find(function(e) {
return e.name === s.spaLoadResourceUrl
});
u && (s.spaLoadResourceRT = u.duration),
("popstate" === i || sessionStorage.getItem("__SPA_LCP__" + window.location.pathname)) && (s.type = "bfcache"),
r(s),
sessionStorage.setItem("__SPA_LCP__" + window.location.pathname, "reported")
}
});
["keydown", "click"].forEach(function(e) {
addEventListener(e, a, !0)
}),
onHidden(a),
(c = new MutationObserver(function(e) {
e.forEach(function(e) {
"childList" === e.type && e.addedNodes.length > 0 && e.addedNodes.forEach(function(e) {
recursivelyCheckNodesForImages(e)
}),
"attributes" === e.type && recursivelyCheckNodesForImages(e.target)
})
}
)).observe(document.body, {
childList: !0,
attributes: !0,
subtree: !0
})
}
function recursivelyCheckNodesForImages(e) {
e.nodeType === Node.ELEMENT_NODE && (isElementVisibleInViewport_isElementVisibleInViewport(e) && ("img" === e.tagName.toLowerCase() || onSpaLoad_hasBackgroundImage(e) && 0 === e.childNodes.length) || ["p", "span"].includes(e.tagName.toLowerCase())) ? (eY.size < onSpaLoad_getElementVisibleArea(e) && (eY = {
startTime: onSpaLoad_getCurrentTime(),
size: onSpaLoad_getElementVisibleArea(e),
element: e
}),
eY.size === onSpaLoad_getElementVisibleArea(e) && e.className.includes("active") && (eY = {
startTime: onSpaLoad_getCurrentTime(),
size: onSpaLoad_getElementVisibleArea(e),
element: e
})) : Array.from(e.childNodes).forEach(recursivelyCheckNodesForImages)
}
}
, onSpaLoad = function(e, r) {
var routerChangeListener = function() {};
if ("FMP" === r.type) {
if (!(null === (u = window) || void 0 === u ? void 0 : u.__FMP_OBSERVED_POINTS__))
return;
var i = window.sessionStorage.getItem("__REDIRECT_SPA_REFER__");
if (i && Number(null === (c = window) || void 0 === c ? void 0 : c.__SPA_LOAD__START__) > 0) {
var a = (window.__SPA_LOAD__START__ || window.performance.timing.navigationStart) - window.performance.timing.navigationStart
, s = ((null === (l = window) || void 0 === l ? void 0 : l.__FMP_OBSERVED_POINTS__) || []).filter(function(e) {
return e.t > a
});
if (s) {
var u, c, l, d, p = {
name: "SPA_LOAD",
type: "first",
value: -1,
spaLoadRefer: ""
}, f = (null === (d = calcFMP(s)) || void 0 === d ? void 0 : d.value) || 0 - a;
f > 0 && (p.value = f),
sessionStorage.getItem("__FMP__" + window.location.pathname) && (p.type = "bfcache"),
p.spaLoadRefer = i,
window.sessionStorage.removeItem("__REDIRECT_SPA_REFER__"),
e(p)
}
}
routerChangeListener = startSpaFMPObserve
}
"LCP" === r.type && (routerChangeListener = startSpaLCPObserve);
var v = registerEventHandler(window.history, function() {
window.sessionStorage.setItem("__SPA_REFER__", window.location.href)
});
window.history.pushState = v("pushState"),
window.history.replaceState = v("replaceState"),
window.addEventListener("pushstate", function(r) {
routerChangeListener(r, e, "pushstate")
}, !1),
window.addEventListener("replacestate", function(r) {
routerChangeListener(r, e, "replacestate")
}, !1),
window.addEventListener("popstate", function(r) {
routerChangeListener(r, e, "popstate")
}, !1)
}
, handlingMetrics = function(e) {
return "paintTiming" === e.measurement_name && e.measurement_data.largestContentfulPaint > 0 && e.measurement_data.largestContentfulPaint < 2500 && delete e.measurement_data.staticResourceEntries,
e
}
, onTTI = function(e) {
var r, i;
if ((null === (r = window) || void 0 === r ? void 0 : r.__USE_CUSTOM_TIMING__) && (null === (i = window) || void 0 === i ? void 0 : i.__CUSTOM_TTI_ELEMENTS__)) {
var a = {
name: "TTI",
type: "unknown",
value: -1,
element: ""
}
, s = window.__CUSTOM_TTI_ELEMENTS__
, u = []
, c = runOnce(function(r) {
var report = function() {
var i = u.sort(function(e, r) {
return e.priority - r.priority
})[0];
i && (a.value = i.startTime,
a.element = i.id,
a.extraData = (null == i ? void 0 : i.extraData) || {},
a.type = r),
console.log("stopListening ttiEntry", i),
e(a)
};
"function" == typeof requestIdleCallback ? requestIdleCallback(report) : requestAnimationFrame(report)
})
, pushEntry = function(e) {
var r, i = e.id, a = e.startTime, s = e.priority, l = e.extraData;
u.push({
id: i,
startTime: a,
priority: s,
extraData: l
}),
(null === (r = window.__CUSTOM_TTI_ELEMENTS__) || void 0 === r ? void 0 : r.length) === u.length && c("default")
};
window.addEventListener("__APM_TTI_EVENT__", function(e) {
var r, i;
if (null == e ? void 0 : null === (r = e.detail) || void 0 === r ? void 0 : r.id) {
;s.find(function(r) {
return r.id === e.detail.id
}) && pushEntry({
id: e.detail.id,
startTime: e.detail.startTime,
priority: e.detail.priority,
extraData: null === (i = e.detail) || void 0 === i ? void 0 : i.extraData
})
}
}),
onHidden(function() {
return c("pagehide")
}),
["keydown", "click"].forEach(function(e) {
window.addEventListener(e, function() {
return c("interact")
}, !0)
}),
setTimeout(function() {
c("8s")
}, 8e3)
}
}
, getBaseMetricsData = function() {
return (0,
h._)({}, getXHSPrefetchMetrics(), getNavigationTiming(window.performance.getEntriesByType("navigation")[0] || window.performance.timing), getXHSBaseMetrics())
}
, metrics_onWebPaintTiming = function(e, r, i) {
var a, s, u = initMetric("paintTiming");
(0,
ej.mr)(function(e) {
u.measurement_data.timeToFirstByte = Math.round(e.value)
}),
(0,
eW.a4)(function(e) {
u.measurement_data = (0,
y._)((0,
h._)({}, u.measurement_data, getBaseMetricsData()), {
firstContentfulPaint: Math.round(e.value)
}),
(null == i ? void 0 : i.fcpCallback) && "function" == typeof i.fcpCallback && i.fcpCallback()
});
var c = !1;
onFMP(function(r) {
"CustomFMP" === r.name ? (u.measurement_data = (0,
h._)((0,
y._)((0,
h._)({}, u.measurement_data, getBaseMetricsData()), {
firstMeaningfulPaint: Math.round(r.value),
fmpType: r.type,
fmpElement: r.element,
fmpUrl: r.url
}), r.extraData),
(0,
eG.bw)("syncPerformanceTiming", {
data: (0,
h._)((0,
y._)((0,
h._)({}, getBaseMetricsData()), {
firstMeaningfulPaint: Math.round(r.value),
fmpType: r.type,
fmpElement: r.element,
fmpUrl: r.url
}), r.extraData)
}).then(function(e) {
console.log("[syncPerformanceTiming success]: ", e)
}).catch(function(e) {
console.log("[syncPerformanceTiming fail]: ", e)
})) : u.measurement_data = (0,
y._)((0,
h._)({}, u.measurement_data, getBaseMetricsData()), {
firstMeaningfulPaint: Math.round(r.value),
fmpType: r.type,
fmpElement: r.element
}),
(null == i ? void 0 : i.fmpCallback) && "function" == typeof i.fmpCallback && i.fmpCallback(),
c && e(handlingMetrics(u))
}, {
custom: null == r ? void 0 : null === (a = r.FMP) || void 0 === a ? void 0 : a.custom
}),
onTTI(function(r) {
e({
measurement_name: "paintTiming",
measurement_data: (0,
h._)((0,
y._)((0,
h._)({}, getBaseMetricsData()), {
timeToInteractive: Math.round(r.value),
ttiType: r.type,
ttiElement: r.element
}), r.extraData)
})
}),
onLCP(function(r) {
var a;
u.measurement_data = (0,
h._)((0,
y._)((0,
h._)({}, u.measurement_data, getBaseMetricsData(), getLcpAttributionMetrics(null == r ? void 0 : r.attribution)), {
timeToFirstByte: null == r ? void 0 : null === (a = r.attribution) || void 0 === a ? void 0 : a.timeToFirstByte,
largestContentfulPaint: Math.round(r.value)
}), r.value > 2500 ? getResourceTiming_getResourceTiming() : {}),
-1 === u.measurement_data.firstMeaningfulPaint && (c = !0),
(null == i ? void 0 : i.lcpCallback) && "function" == typeof i.lcpCallback && i.lcpCallback(),
e(handlingMetrics(u))
}),
onSpaLoad(function(i) {
var a;
e({
measurement_name: "paintTiming",
measurement_data: (0,
h._)((0,
y._)((0,
h._)({}, getBaseMetricsData()), {
spaLoad: Math.round(i.value),
spaLoadType: i.type,
spaLoadRefer: i.spaLoadRefer
}), (null == r ? void 0 : null === (a = r.SPA_LOAD) || void 0 === a ? void 0 : a.type) === "LCP" ? {
spaLoadResourceRT: null == i ? void 0 : i.spaLoadResourceRT,
spaLoadElement: null == i ? void 0 : i.spaLoadElement,
spaLoadResourceUrl: null == i ? void 0 : i.spaLoadResourceUrl
} : {})
})
}, {
type: (null == r ? void 0 : null === (s = r.SPA_LOAD) || void 0 === s ? void 0 : s.type) || "FMP"
})
}
, ez = {
NORMAL: 1,
MEDIUM_BRUSH: 2,
HIGH_BRUSH: 3
}
, eK = {
NORMAL: 60,
MEDIUM_BRUSH: 90
}
, onFPS = function(e, r) {
whenActivated(function() {
r && r.observe({
reportFrameThreshold: 60,
lagFrameThreshold: 125
})
}),
onActivated(function() {
r && "observe" !== r.status && r.observe({
reportFrameThreshold: 60,
lagFrameThreshold: 125
})
}),
onHidden(function() {
if (r) {
r.disconnect();
var i, a = r.takeRecords(), s = a[a.length - 1];
if (s) {
;e({
value: s.avgFps,
attribution: {
deviceBrushLevel: (i = s.maxFps) <= eK.NORMAL ? ez.NORMAL : i > eK.NORMAL && i <= eK.MEDIUM_BRUSH ? ez.MEDIUM_BRUSH : i > eK.MEDIUM_BRUSH ? ez.HIGH_BRUSH : ez.NORMAL,
maxJsFps: s.maxFps,
minJsFps: s.minFps,
maxJsInterval: Math.round(s.maxInterval),
jsFpsRecordThreshold: s.frames,
firstFrameTimestamp: Math.round(window.performance.timing.navigationStart + s.firstFrameTimestamp),
lastFrameTimestamp: Math.round(window.performance.timing.navigationStart + s.lastFrameTimestamp)
}
})
}
}
})
}
, onStutter = function(e, r) {
onHidden(function() {
if (r) {
var i = r.takeRecords()
, a = i[i.length - 1];
a && e({
value: a.lagDuration / a.duration,
attribution: {
duration: Math.round(a.duration),
lagDuration: Math.round(a.lagDuration),
lagFrameEntries: a.lagFrameEntries,
maxJsInterval: Math.round(a.maxInterval),
minJsInterval: Math.round(a.minInterval),
jsSeriousLagThreshold: a.lagFrameThreshold
}
})
}
})
}
, onRouteINP = function(e) {
var r = []
, i = null;
(0,
eW.Yn)(function(e) {
r.push(e),
(!i || e.value > i.value) && (i = e)
}, {
reportAllChanges: !0
});
var a = !0
, stopListening = function() {
i && a && (e(i),
a = !1)
};
onHidden(stopListening);
var resetListening = function() {
i = null,
r = [],
a = !0
}
, s = registerEventHandler(window.history, stopListening);
window.history.pushState = s("pushState"),
window.history.replaceState = s("replaceState"),
window.addEventListener("pushstate", resetListening, !1),
window.addEventListener("replacestate", resetListening, !1),
window.addEventListener("popstate", resetListening, !1)
}
, eZ = function() {
function FrameObserver(e) {
var r = this;
(0,
f._)(this, FrameObserver),
(0,
g._)(this, "callback", function() {}),
(0,
g._)(this, "reportFrameThreshold", 120),
(0,
g._)(this, "lagFrameThreshold", 300),
(0,
g._)(this, "records", []),
(0,
g._)(this, "cycleFrames", 0),
(0,
g._)(this, "totalFrames", 0),
(0,
g._)(this, "maxFps", -1 / 0),
(0,
g._)(this, "minFps", Infinity),
(0,
g._)(this, "firstFrameTimeStamp", void 0),
(0,
g._)(this, "lastFrameTimeStamp", void 0),
(0,
g._)(this, "currentFrameTimestamp", void 0),
(0,
g._)(this, "prevFrameTimestamp", void 0),
(0,
g._)(this, "cycleFirstFrameTimestamp", void 0),
(0,
g._)(this, "maxInterval", -1 / 0),
(0,
g._)(this, "minInterval", Infinity),
(0,
g._)(this, "cycleMaxInterval", -1 / 0),
(0,
g._)(this, "cycleMinInterval", Infinity),
(0,
g._)(this, "timer", void 0),
(0,
g._)(this, "_status", void 0),
(0,
g._)(this, "fpsEntires", []),
(0,
g._)(this, "lastThreeFrames", []),
(0,
g._)(this, "lagFrameEntires", []),
(0,
g._)(this, "lagDuration", 0),
(0,
g._)(this, "rafLoop", function(e) {
if (r.currentFrameTimestamp = e,
!r.firstFrameTimeStamp && (r.firstFrameTimeStamp = e),
r.lastFrameTimeStamp = e,
!r.prevFrameTimestamp || !r.cycleFirstFrameTimestamp) {
r.prevFrameTimestamp = e,
r.cycleFirstFrameTimestamp = e,
r.cleanAndSetRequestAnimationFrame(r.rafLoop);
return
}
var i = e - r.prevFrameTimestamp;
r.lastThreeFrames.length >= 3 && r.lastThreeFrames.shift(),
r.lastThreeFrames.push({
startTime: r.prevFrameTimestamp,
endTime: e,
duration: i
});
var a = r.lastThreeFrames.reduce(function(e, r) {
return e + r.duration
}, 0) / r.lastThreeFrames.length;
i > r.maxInterval && (r.maxInterval = Math.round(100 * i) / 100),
i < r.minInterval && (r.minInterval = Math.round(100 * i) / 100),
i > r.cycleMaxInterval && (r.cycleMaxInterval = Math.round(100 * i) / 100),
i < r.cycleMinInterval && (r.cycleMinInterval = Math.round(100 * i) / 100),
i > r.lagFrameThreshold && i >= 2 * a && r.reportEntry("lag"),
r.cycleFrames += 1,
r.totalFrames = r.totalFrames + 1,
r.prevFrameTimestamp = e,
r.cycleFrames >= r.reportFrameThreshold && (r.reportEntry("fps"),
r.resetCycle(e)),
r.cleanAndSetRequestAnimationFrame(r.rafLoop)
}),
(0,
g._)(this, "resetState", function() {
r.firstFrameTimeStamp = void 0,
r.lastFrameTimeStamp = void 0,
r.prevFrameTimestamp = void 0,
r.currentFrameTimestamp = void 0,
r.totalFrames = 0,
r.maxFps = -1 / 0,
r.minFps = Infinity,
r.maxInterval = -1 / 0,
r.minInterval = Infinity,
r.lagFrameEntires = [],
r.lagDuration = 0,
r.fpsEntires = [],
r.resetCycle()
}),
(0,
g._)(this, "resetCycle", function(e) {
r.cycleFirstFrameTimestamp = e,
r.cycleFrames = 0,
r.cycleMaxInterval = -1 / 0,
r.cycleMinInterval = Infinity
}),
(0,
g._)(this, "cleanAndSetRequestAnimationFrame", function(e) {
return r.timer && cancelAnimationFrame(r.timer),
r.timer = requestAnimationFrame(e),
r.timer
}),
this._status = "initialization",
e && (this.callback = e)
}
return (0,
v._)(FrameObserver, [{
key: "status",
get: function get() {
return this._status
}
}, {
key: "reportEntry",
value: function reportEntry(e) {
if ("fps" === e) {
if (!this.cycleFirstFrameTimestamp || !this.currentFrameTimestamp)
return;
var r = FrameObserver.calcFps({
endTime: this.currentFrameTimestamp,
startTime: this.cycleFirstFrameTimestamp,
frames: this.cycleFrames
});
r > this.maxFps && (this.maxFps = r),
r < this.minFps && (this.minFps = r);
var i = {
entryType: "fps",
value: r,
maxInterval: this.cycleMaxInterval,
minInterval: this.cycleMinInterval,
type: e,
firstFrameTimestamp: this.cycleFirstFrameTimestamp,
lastFrameTimestamp: this.currentFrameTimestamp,
frames: this.cycleFrames
};
this.fpsEntires.push(i),
this.callback(i)
}
if ("lag" === e) {
if (!this.prevFrameTimestamp || !this.currentFrameTimestamp)
return;
var a = this.currentFrameTimestamp - this.prevFrameTimestamp
, s = {
entryType: "lag",
startTime: this.prevFrameTimestamp,
endTime: this.currentFrameTimestamp,
duration: a
};
this.lagFrameEntires.push(s),
this.lagDuration = this.lagDuration + a,
this.callback(s)
}
}
}, {
key: "getEntriesByType",
value: function getEntriesByType(e) {
return "fps" === e ? this.fpsEntires : "lag" === e ? this.lagFrameEntires : void 0
}
}, {
key: "takeRecords",
value: function takeRecords() {
return this.records
}
}, {
key: "getCurrentEntries",
value: function getCurrentEntries() {
if (this.cycleFirstFrameTimestamp && this.currentFrameTimestamp)
return {
value: FrameObserver.calcFps({
startTime: this.cycleFirstFrameTimestamp,
endTime: this.currentFrameTimestamp,
frames: this.cycleFrames
}),
maxInterval: this.cycleMaxInterval,
minInterval: this.cycleMinInterval,
firstFrameTimestamp: this.cycleFirstFrameTimestamp,
lastFrameTimestamp: this.currentFrameTimestamp,
frames: this.cycleFrames
}
}
}, {
key: "observe",
value: function observe(e) {
"observe" !== this._status && (this._status = "observe",
this.reportFrameThreshold = e.reportFrameThreshold || 120,
this.lagFrameThreshold = e.lagFrameThreshold || 300,
this.cleanAndSetRequestAnimationFrame(this.rafLoop))
}
}, {
key: "disconnect",
value: function disconnect() {
this._status = "disconnect",
this.reportEntry("fps"),
this.timer && cancelAnimationFrame(this.timer),
this.firstFrameTimeStamp && this.lastFrameTimeStamp && this.records.push({
avgFps: FrameObserver.calcFps({
startTime: this.firstFrameTimeStamp,
endTime: this.lastFrameTimeStamp,
frames: this.totalFrames
}),
maxInterval: this.maxInterval,
minInterval: this.minInterval,
maxFps: this.maxFps,
minFps: this.minFps,
frames: this.totalFrames,
lagFrameEntries: this.lagFrameEntires,
fpsEntries: this.fpsEntires,
duration: this.lastFrameTimeStamp - this.firstFrameTimeStamp,
lagDuration: this.lagDuration,
firstFrameTimestamp: this.firstFrameTimeStamp,
lastFrameTimestamp: this.lastFrameTimeStamp,
lagFrameThreshold: this.lagFrameThreshold
}),
this.resetState()
}
}]),
FrameObserver
}();
(0,
g._)(eZ, "calcFps", function(e) {
var r = e.startTime
, i = e.endTime
, a = e.frames;
return Math.round(1e3 / ((i - r) / a))
});
function getTimeStamp(e) {
return Math.floor(e += window.performance.timing.navigationStart)
}
var eQ = function() {
function LongtaskObserver(e) {
if ((0,
f._)(this, LongtaskObserver),
(0,
g._)(this, "observer", void 0),
!LongtaskObserver.isSupport()) {
this.observer = null;
return
}
this.observer = new PerformanceObserver(null != e ? e : function() {
return 0
}
)
}
return (0,
v._)(LongtaskObserver, [{
key: "cleanObserver",
value: function cleanObserver() {
this.observer = null
}
}, {
key: "startObserve",
value: function startObserve() {
return this.observer && this.observer.observe({
entryTypes: ["longtask"]
}),
this.observer
}
}, {
key: "takeRecords",
value: function takeRecords() {
if (this.observer) {
this.observer.disconnect();
var e = this.observer.takeRecords();
return this.cleanObserver(),
e
}
return null
}
}], [{
key: "isSupport",
value: function isSupport() {
return !!(window && "PerformanceObserver"in window)
}
}]),
LongtaskObserver
}()
, e$ = function() {
function InteractLaggyObserver(e, r) {
(0,
f._)(this, InteractLaggyObserver),
(0,
g._)(this, "_state", void 0),
(0,
g._)(this, "_callback", void 0),
(0,
g._)(this, "_observeOptions", void 0),
(0,
g._)(this, "_entries", []),
(0,
g._)(this, "_interactEventsHandler", void 0),
(0,
g._)(this, "getFps", void 0),
this._state = "initialization",
this._callback = e,
this._interactEventsHandler = debounce(this.handleInteractEvent.bind(this), 200, !0),
this.getFps = r
}
return (0,
v._)(InteractLaggyObserver, [{
key: "getState",
value: function getState() {
return this._state
}
}, {
key: "getObserveOptions",
value: function getObserveOptions() {
return this._observeOptions ? this._observeOptions : null
}
}, {
key: "createFrameObserver",
value: function createFrameObserver() {
return new eZ(function(e) {}
)
}
}, {
key: "getCurrentDurationFps",
value: function getCurrentDurationFps() {
var e = this.createFrameObserver();
return e.observe({
reportFrameThreshold: 50
}),
new Promise(function(r) {
setTimeout(function() {
null == e || e.disconnect(),
r(null == e ? void 0 : e.takeRecords()),
e = null
}, 2e3)
}
)
}
}, {
key: "getCurrentDurationLongtask",
value: function getCurrentDurationLongtask() {
if (!eQ.isSupport())
return new Promise(function(e) {
return e(null)
}
);
var e, r = [];
try {
;new eQ(function(i) {
return (e = r).push.apply(e, (0,
ec._)(i.getEntries()))
}
).startObserve()
} finally {
return new Promise(function(e) {
setTimeout(function() {
return e(r)
}, 2e3)
}
)
}
}
}, {
key: "doEntryCb",
value: function doEntryCb(e) {
this._callback(e)
}
}, {
key: "handleInteractEvent",
value: function handleInteractEvent(e) {
var r = this;
return (0,
p._)(function() {
var i, a, s, u, c, l, d, p, f, v, g, h, _;
return (0,
m.Jh)(this, function(m) {
switch (m.label) {
case 0:
return i = getTimeStamp(performance.now()),
a = r.getFps(),
[4, Promise.all([r.getCurrentDurationFps(), r.getCurrentDurationLongtask()])];
case 1:
if (u = (s = w._.apply(void 0, [m.sent(), 2]))[0],
c = s[1],
u && (l = null == u ? void 0 : null === (v = u[0]) || void 0 === v ? void 0 : v.minFps,
d = null == u ? void 0 : null === (g = u[0]) || void 0 === g ? void 0 : g.firstFrameTimestamp,
p = null == u ? void 0 : null === (h = u[0]) || void 0 === h ? void 0 : h.lastFrameTimestamp),
c && (f = null == c ? void 0 : c.reduce(function(e, r) {
return e.push({
s: getTimeStamp(r.startTime),
d: getTimeStamp(r.duration)
}),
e
}, [])),
void 0 === l || -1 === a || !d)
return [2];
return _ = {
pointGroup: "interactLaggy",
startTime: i,
minJsFps: null != l ? l : -1,
jsFps: a,
fpsLoss: void 0 !== l && -1 !== a ? a - l : -1,
eventTarget: (0,
eJ.G)(e.target),
eventType: e.type || "",
longtask: f ? JSON.stringify(f) : "null",
firstFrameTimestamp: d ? getTimeStamp(d) : -1,
lastFrameTimestamp: p ? getTimeStamp(p) : -1
},
r.doEntryCb(_),
r._entries.push(_),
[2]
}
})
})()
}
}, {
key: "startListenInteractEvent",
value: function startListenInteractEvent() {
var e = this
, r = this.getObserveOptions();
r && r.interactionEventCollectType.forEach(function(r) {
window.addEventListener(r, e._interactEventsHandler, {
capture: !0
})
})
}
}, {
key: "removeInteractEventListener",
value: function removeInteractEventListener() {
var e = this
, r = this.getObserveOptions();
r && r.interactionEventCollectType.forEach(function(r) {
window.removeEventListener(r, e._interactEventsHandler, !0)
})
}
}, {
key: "observe",
value: function observe(e) {
this._state = "observe",
this._observeOptions = e,
this.startListenInteractEvent()
}
}, {
key: "disconnect",
value: function disconnect() {
this._state = "disconnect",
this.removeInteractEventListener()
}
}]),
InteractLaggyObserver
}()
, e0 = ["click", "dblclick"]
, e1 = ["dragend", "dragenter", "dragleave", "dragover", "dragstart", "drop"]
, e2 = ["beforeinput", "input"]
, e3 = ["keydown", "keypress", "keyup"]
, e4 = ["touchstart", "touchend", "touchcancel"]
, e5 = ["resize", "scroll"]
, onInteractLoggy = function(e, r) {
d = new e$(function(r) {
.01 >= Math.random() && e(r)
}
,function() {
if (!r)
return -1;
var e, i, a = r.getEntriesByType("fps");
return !a.length && (a = [r.getCurrentEntries()]),
null !== (i = null == a ? void 0 : null === (e = a[a.length - 1]) || void 0 === e ? void 0 : e.value) && void 0 !== i ? i : -1
}
),
whenActivated(function() {
d && d.observe({
interactionEventCollectType: (0,
ec._)(e0).concat((0,
ec._)(e1), (0,
ec._)(e2), (0,
ec._)(e3), (0,
ec._)(e4), (0,
ec._)(e5))
})
})
}
, metrics_onWebInteractiveTiming = function(e, r) {
var i, a = null != r && !!r.getFrameObserve && r.getFrameObserve(), s = initMetric("interactiveTiming");
if (a) {
var u = new eZ;
onFPS(function(r) {
e({
measurement_name: "interactiveTiming",
measurement_data: (0,
h._)((0,
y._)((0,
h._)({
jsFps: r.value
}, r.attribution), {
deviceBrushLevel: r.attribution.deviceBrushLevel,
maxJsFps: r.attribution.maxJsFps,
minJsFps: r.attribution.minJsFps,
maxJsInterval: r.attribution.maxJsInterval,
jsFpsRecordThreshold: r.attribution.jsFpsRecordThreshold,
firstFrameTimestamp: r.attribution.firstFrameTimestamp,
lastFrameTimestamp: r.attribution.lastFrameTimestamp,
pointGroup: "webJsFps"
}), getXHSBaseMetrics())
})
}, u),
onStutter(function(r) {
e({
measurement_name: "interactiveTiming",
measurement_data: (0,
h._)((0,
y._)((0,
h._)({
jsStutter: r.value,
duration: r.attribution.duration,
lagDuration: r.attribution.lagDuration,
maxJsInterval: r.attribution.maxJsInterval,
minJsInterval: r.attribution.minJsInterval
}, r.value > .01 ? {
extraInfo: JSON.stringify(r.attribution.lagFrameEntries || {})
} : null), {
pointGroup: "webJsSeriousLag"
}), getXHSBaseMetrics())
})
}, u),
onInteractLoggy(function(r) {
e({
measurement_name: "interactiveTiming",
measurement_data: (0,
h._)({}, r, getXHSBaseMetrics())
})
}, u)
}
(0,
ej.Fu)(function(e) {
s.measurement_data.firstInputDelay = Math.round(e.value)
});
var c = (null == r ? void 0 : null === (i = r.INP) || void 0 === i ? void 0 : i.dimension) || "usePeriod"
, l = eW.Yn;
"pageRoute" === c && (l = onRouteINP),
l(function(r) {
var i, a, u, c, l;
e({
measurement_name: s.measurement_name,
measurement_data: (0,
y._)((0,
h._)((0,
y._)((0,
h._)({}, s.measurement_data), {
interactionToNextPaint: Math.round(r.value),
inpEventTarget: null == r ? void 0 : null === (i = r.attribution) || void 0 === i ? void 0 : i.eventTarget
}), r.value > 200 ? {
inpEventEntry: JSON.stringify(null == r ? void 0 : null === (a = r.attribution) || void 0 === a ? void 0 : a.eventEntry)
} : {}), {
inpEventType: null == r ? void 0 : null === (u = r.attribution) || void 0 === u ? void 0 : u.eventType,
inpEventTime: Math.round(((null == r ? void 0 : null === (c = r.attribution) || void 0 === c ? void 0 : c.eventTime) || 0) + window.performance.timing.navigationStart),
inpLoadState: null == r ? void 0 : null === (l = r.attribution) || void 0 === l ? void 0 : l.loadState,
pointGroup: "webINP"
})
})
})
}
, onRouteCLS = function(e) {
var r = []
, i = null;
(0,
eW.mw)(function(e) {
r.push(e),
(!i || e.value > i.value) && (i = e)
}, {
reportAllChanges: !0
});
var a = !0
, stopListening = function() {
i && a && (e(i),
a = !1)
};
onHidden(stopListening);
var resetListening = function() {
i = null,
r = [],
a = !0
}
, s = registerEventHandler(window.history, stopListening);
window.history.pushState = s("pushState"),
window.history.replaceState = s("replaceState"),
window.addEventListener("pushstate", resetListening, !1),
window.addEventListener("replacestate", resetListening, !1),
window.addEventListener("popstate", resetListening, !1)
}
, metrics_onWebVisualStability = function(e, r) {
var i, a = (null == r ? void 0 : null === (i = r.CLS) || void 0 === i ? void 0 : i.dimension) || "usePeriod", s = initMetric("visualStability"), u = eW.mw;
"pageRoute" === a && (u = onRouteCLS),
u(function(r) {
try {
s.measurement_data.cumulativeLayoutShift = r.value,
r.value > .1 && (s.measurement_data.extraInfo = JSON.stringify((null == r ? void 0 : r.attribution) || {}, stringifyCyclicObject()),
s.measurement_data.pointGroup = "webCLS"),
e(s)
} catch (e) {}
})
}
, onCollectMetrics = function(e, r, i) {
try {
metrics_onWebPaintTiming(e, r, i),
metrics_onWebInteractiveTiming(e, r),
metrics_onWebVisualStability(e, r)
} catch (e) {}
}
, getPerformanceMetricsBaseInfo = function() {
var e, r;
return {
cpuCores: null === (e = window.navigator) || void 0 === e ? void 0 : e.hardwareConcurrency,
deviceMemory: null === (r = window.navigator) || void 0 === r ? void 0 : r.deviceMemory
}
}
, e7 = function() {
function PerformanceCollector(e) {
(0,
f._)(this, PerformanceCollector),
(0,
g._)(this, "client", void 0),
(0,
g._)(this, "clearResourceTimingCache", function() {}),
(0,
g._)(this, "lcpDone", !1),
(0,
g._)(this, "fcpDone", !1),
(0,
g._)(this, "fmpDone", !1),
this.client = e,
this.clearResourceTimingCache = initResourceTimingCache()
}
return (0,
v._)(PerformanceCollector, [{
key: "tryClearResourceTimingCache",
value: function tryClearResourceTimingCache() {
this.lcpDone && this.fcpDone && this.fmpDone && "function" == typeof this.clearResourceTimingCache && this.clearResourceTimingCache()
}
}, {
key: "monitor",
value: function monitor() {
var e, r, i = this;
onCollectMetrics(function(e) {
var r = e.measurement_name;
console.groupCollapsed("[apm performance metric] ".concat(r)),
console.log(e),
console.groupEnd(),
i.client.flush({
measurement_name: r,
measurement_data: (0,
h._)({}, e.measurement_data, getPerformanceMetricsBaseInfo())
})
}, (null === (r = this.client) || void 0 === r ? void 0 : null === (e = r.options) || void 0 === e ? void 0 : e.performance) || {}, {
lcpCallback: function() {
i.lcpDone = !0,
i.tryClearResourceTimingCache()
},
fmpCallback: function() {
i.fmpDone = !0,
i.tryClearResourceTimingCache()
},
fcpCallback: function() {
i.fcpDone = !0,
i.tryClearResourceTimingCache()
}
})
}
}]),
PerformanceCollector
}()
, e6 = !1
, performanceV2 = function(e) {
if (!e6) {
e6 = !0;
var r = new e7(e);
window.addEventListener("load", function() {
return r.monitor()
})
}
};
i(58051);
var vueApmPlugin_reportJsError = function(e, r, i, a) {
var s = getJsErrorReportMetrics(e, r.options.jsError);
s && (i && a && Object.assign(s, {
context_artifactName: i,
context_artifactVersion: a
}),
r.flush(s))
};
function sendVueError(e, r, i, a) {
try {
var s = parseError(e);
if (s) {
var u = (0,
h._)({
type: "vueError"
}, s);
vueApmPlugin_reportJsError(u, r, i, a)
}
} catch (e) {
reportInnerError(e, r)
}
}
var vueError = function(e, r, i, a, s) {
var u, c, l, d, p, f, v;
((null === (u = r.version) || void 0 === u ? void 0 : u.startsWith("3")) || (null === (l = e.vm) || void 0 === l ? void 0 : null === (c = l.version) || void 0 === c ? void 0 : c.startsWith("3"))) && (null == e ? void 0 : null === (p = e.vm) || void 0 === p ? void 0 : null === (d = p.config) || void 0 === d ? void 0 : d.errorHandler) ? e.vm.config.errorHandler = function(e) {
console.error(e),
sendVueError(e, i, a, s)
}
: (null == r ? void 0 : null === (v = r.Vue) || void 0 === v ? void 0 : null === (f = v.config) || void 0 === f ? void 0 : f.errorHandler) && (r.Vue.config.errorHandler = function(e) {
console.error(e),
sendVueError(e, i, a, s)
}
)
}
, routeChange = function(e, r) {
e.router.afterEach(function(e) {
r.updateMeta({
route: e
})
})
}
, vueApmPlugin = function(e, r, i, a, s, u) {
var c = i || e.options.Launcher
, l = r || e.options.app;
if (!c || !!c.isBrowser)
(!l || l.router) && (u ? vueError(l, c, e, a, s) : l.use({
name: "vueApmPlugin",
install: function(r, i) {
var a;
vueError(r, i, e),
routeChange(r, e),
(null === (a = r.auth) || void 0 === a ? void 0 : a.services) && r.auth.services.registerAfterLoginCallback && r.auth.services.registerAfterLoginCallback(function() {
e.updateMeta({
purgeUser: !0
})
}, !0)
}
}))
}
, launcher_http_request = function(e, r, i, a) {
var s = (e.options.http || {}).enableResponseData
, report = function(a) {
r && i && Object.assign(a, {
context_artifactName: r,
context_artifactVersion: i
}),
[R, I, A].includes(a.measurement_data.errorType || "") ? e.flush(a) : e.push(a)
}
, u = (null == a ? void 0 : a.http) || e.options.Launcher.http;
eM.observe({
httpClient: u,
callback: function(e) {
(0 === e.meta.status || e.meta.status >= 400) && el.pushJsError("".concat(e.meta.status, " ").concat(e.meta.url, " ").concat(e.meta.errorMsg)),
report({
measurement_name: O,
measurement_data: (0,
y._)((0,
h._)({}, e.meta), {
duration: e.measure && e.measure.duration
})
})
},
enableResponseData: void 0 !== s && s
})
}
, proxyXmlHttp = function(e) {
if ("XMLHttpRequest"in window && "function" == typeof window.XMLHttpRequest) {
var newXMLHttpRequest = function newXMLHttpRequest() {
var i = new r
, a = {
method: "",
url: ""
}
, s = i.open
, u = i.send
, c = i.setRequestHeader;
return i.open = function() {
var e = arguments[0]
, r = arguments[1]
, u = "string" == typeof r ? r : r.toString();
a.method = e,
a.url = u,
a.matchedPath = parseUrl(u),
s.apply(i, arguments)
}
,
i.setRequestHeader = function() {
var e = arguments[0]
, r = arguments[1];
!a.traceId && e === L && (a.traceId = r),
c.apply(i, arguments)
}
,
i.addEventListener("timeout", function() {
a.errorType = I
}),
i.addEventListener("abort", function() {
a.errorType = I
}),
i.addEventListener("loadend", function() {
if (!forbiddenUrl(a.url)) {
var r, s, u, c = (e.options.http || {}).enableResponseData;
a.duration = new Date().getTime() - a.requestTime,
delete a.requestTime;
var l = i.status
, d = i.response;
if (l >= 200 && l < 300)
try {
var p = JSON.parse(d);
r = p.code,
s = p.msg,
u = p.success
} catch (e) {}
(a = (0,
h._)((0,
y._)((0,
h._)({}, a), {
status: l
}), parseHttpStatus(l, r, s, u))).data = isHTTPError(a.errorType) && c ? d : void 0;
var f = {
measurement_name: O,
measurement_data: (0,
h._)({}, a)
};
isHTTPError(a.errorType) ? e.flush(f) : e.push(f)
}
}),
i.send = function(e) {
a.requestTime = new Date().getTime(),
u.call(i, e)
}
,
i
}
, r = window.XMLHttpRequest;
["DONE", "HEADERS_RECEIVED", "LOADING", "OPENED", "UNSENT"].forEach(function(e) {
newXMLHttpRequest[e] = XMLHttpRequest[e]
}),
window.XMLHttpRequest = newXMLHttpRequest
}
}
, proxyFetch = function(e) {
if ("fetch"in window && "function" == typeof window.fetch) {
var r = window.fetch;
window.fetch = function newFetch(i, a) {
var s = a || {}
, u = s.method
, c = s.headers
, l = (i && "string" != typeof i ? i.url : i) || ""
, d = {
method: u || er.GET,
url: l,
requestTime: new Date().getTime(),
matchedPath: parseUrl(l),
traceId: (void 0 === c ? {} : c)[L]
};
return r.call(window, i, a).then(function(r) {
if ((r.headers.get("Content-Type") || "").match(/video/))
return r;
var i = r.clone();
return i.text().then(function(r) {
if (!forbiddenUrl(d.url)) {
var a, s, u, c, l = (e.options.http || {}).enableResponseData, p = i.status;
if (p >= 200 && p < 300)
try {
var f = JSON.parse(r);
s = f.code,
u = f.msg,
c = f.success
} catch (e) {}
a = parseHttpStatus(p, s, u, c),
d.data = isHTTPError(a.errorType) && l ? r : void 0,
d.duration = new Date().getTime() - d.requestTime,
delete d.requestTime;
var v = {
measurement_name: O,
measurement_data: (0,
h._)({
status: p
}, d, a)
};
isHTTPError(a.errorType) ? e.flush(v) : e.push(v)
}
}),
r
}).catch(function(r) {
if (!forbiddenUrl(d.url)) {
d.errorType = I,
d.duration = new Date().getTime() - d.requestTime,
delete d.requestTime;
var i = {
measurement_name: O,
measurement_data: (0,
h._)({}, d)
};
e.flush(i)
}
return Promise.reject(r)
})
}
}
}
, resourceErrorPlugin_report = function(e, r) {
isArray(r) ? r.forEach(function(r) {
e.flush({
measurement_name: "browserResourceError",
measurement_data: r
})
}) : e.flush({
measurement_name: "browserResourceError",
measurement_data: r
})
};
function resourceErrorPlugin_getResourceError(e) {
try {
var r = JSON.parse(localStorage.getItem(P) || "[]");
if (r && r.length) {
for (var i = [], a = [], s = 0; s < r.length; s++)
if (r[s].projectName === (e && e.name || "xhs-pc-web")) {
var u = r[s]
, c = (u.projectName,
(0,
eg._)(u, ["projectName"]));
i.push(c)
} else
r[s].projectName && a.push(r[s]);
return localStorage.setItem(P, JSON.stringify(a)),
i
}
return []
} catch (e) {
return []
}
}
var getName = function(e, r) {
var i = r.target;
switch (e) {
case "img":
return i.currentSrc || i.src;
case "script":
return i.src;
case "link":
return i.href
}
}
, e9 = !1
, monitor_resourceErrorPlugin = function(e) {
if (!e9) {
e9 = !0;
try {
var r = resourceErrorPlugin_getResourceError(e.options.package);
r.length && resourceErrorPlugin_report(e, r);
window.addEventListener("error", function(r) {
if (getPageVisable())
try {
var i = (s = r.target)instanceof HTMLScriptElement ? "script" : s instanceof HTMLLinkElement ? "link" : s instanceof HTMLImageElement ? "img" : void 0;
if ("img" === i && r.target && r.target.src === window.location.href)
return;
if (i) {
var a = getName(i, r);
if (a) {
var s, u, c, l = (u = a,
c = i,
u && "" !== u && c ? {
name: u,
initiatorType: c,
clientEventTime: String(Date.now()),
isFS: F.isFirstScreen
} : {});
el.pushJsError("".concat(l.name, " ").concat(l.initiatorType, " loaded failed")),
resourceErrorPlugin_report(e, l)
}
}
} catch (r) {
reportInnerError(r, e)
}
}, !0)
} catch (r) {
reportInnerError(r, e)
}
}
}
, e8 = []
, resourceTimingNRE = function() {
try {
if (!window.PerformanceObserver)
return;
new PerformanceObserver(function(e) {
e.getEntries().forEach(function(e) {
var r, i = e.initiatorType, a = e.responseStart, s = e.requestStart, u = e.connectEnd, c = e.connectStart, l = e.responseEnd, d = e.transferSize, p = e.responseStatus, f = e.name, v = l - s;
if (!(["fetch", "xmlhttprequest"].includes(i) && 0 === s && (r = f,
new URL(r).origin !== window.location.origin) || e8.some(function(e) {
return e.resUrl === f
})))
e8.length > 1e3 && e8.shift(),
e8.push({
resUrl: f,
applicationRTT: a - s,
transportRTT: u - c,
totalTime: v,
totalBytes: d,
throughput: d / (v || 1),
exception: p > 300 && p < 200 ? "error status code: ".concat(p) : ""
})
})
}
).observe({
type: "resource",
buffered: !0
});
var reset = function(e) {
e8 = e8.slice(e)
}
, cycle = function() {
(0,
S.Ld)("syncNqeData", function() {
var e = e8.length;
(0,
S.dw)("sendNqeData", {
requestList: e8
}).then(function() {
reset(e)
}).catch(function() {})
})
};
window.addEventListener("DOMContentLoaded", function() {
(0,
S.dw)("h5Performance").catch(function() {}),
cycle()
})
} catch (e) {}
}
, te = !1;
function generateRandomCheckPoint(e, r) {
e = e || 5,
r = r || 10;
for (var i = window.innerHeight, a = window.innerWidth, s = [], u = 1; u <= e; u++) {
for (var c = i / (e + 1) * u, l = 1; l <= r; l++) {
var d = a / (r + 1) * l;
s.push({
x: d,
y: c
})
}
}
return s
}
function calculateDomDepth(e) {
for (var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 10, i = arguments.length > 2 ? arguments[2] : void 0, a = 0; e && "HTML" !== e.tagName && "BODY" !== e.tagName && i !== e && a < r; )
e = e.parentElement,
a++;
return a
}
function calculateBlankScreenRatio(e) {
try {
var r = 0
, i = 0
, a = e.domThreshold
, s = e.maxDepth || 0;
if (s < a && !base_isProd())
return console.error("maxDepth 必须大于 domThreshol "),
0;
for (var u = generateRandomCheckPoint(e.lines, e.columns), c = u.length, l = e.rootElementSelector ? document.querySelector(e.rootElementSelector) : null, d = 0; d < c; d++) {
var p = u[d]
, f = (document.elementsFromPoint(p.x, p.y) || [])[0];
if (l && !l.contains(f)) {
i++;
continue
}
f && calculateDomDepth(f, s, l) < a && r++
}
if (i === c)
return 0;
return r / (c - i)
} catch (e) {
!base_isProd() && console.error(e)
}
return 0
}
function blankScreenPlugin_screenshot(e, r) {
var html2image = function html2image() {
window.html2canvas && window.html2canvas(document.body, {
scale: 360 / window.innerWidth
}).then(function(i) {
r.measurement_data.img = i.toDataURL("image/jpeg", .5),
e.flush(r)
})
};
if (window.html2canvas)
return html2image();
null == u || u.then(function(e) {
e && html2image()
})
}
function blankScreenPlugin_checkBlankScreenError(e, r) {
var i = r || e.options.blankScreen;
if (!!document.elementsFromPoint && "function" == typeof document.elementsFromPoint)
!te && (te = !0,
setTimeout(function() {
te = !1
}, 1e4),
i.screenshot && downloadScreenshotTool(),
requestAnimationFrame(function() {
try {
var r = calculateBlankScreenRatio(i);
if (!base_isProd() && console.info("[apm] blankScreenRatio: ".concat(r)),
r > (i.threshold || .7)) {
var a, s = {
ratio: r
};
(null === (a = window.apm_blankScreen_error) || void 0 === a ? void 0 : a.errorType) ? (s.errorType = window.apm_blankScreen_error.errorType,
s.content = window.apm_blankScreen_error.content) : performance.timing.loadEventStart ? s.errorType = "other" : s.errorType = "performance",
window.apm_blankScreen_error = null;
var u = {
measurement_name: "blankScreenError",
measurement_data: s
};
i.screenshot ? blankScreenPlugin_screenshot(e, u) : e.flush(u)
}
} catch (r) {
reportInnerError(r, e)
}
}))
}
var tt = !1
, tr = {
routerAfterEach: 1,
viewDidAppear: 2,
visibiltyChange: 4
}
, pageViewTracker = function(e) {
try {
if (!e.options)
return;
var r, i, a, s, u = e.options.Launcher && e.options.app;
u || null === (p = e.options) || void 0 === p || null === (d = p.pageView) || void 0 === d || d.routeMode;
var c = ""
, l = "";
if (tt)
return;
tt = !0;
var reportPV = function(r) {
try {
r && e.flush({
context_matchedPath: l,
measurement_name: "pageView",
measurement_data: r
})
} catch (r) {
reportInnerError(r, e)
}
};
if (u)
null === (g = e.options) || void 0 === g || null === (v = g.app) || void 0 === v || null === (f = v.router) || void 0 === f || f.afterEach(function(e, r) {
var i = getPath(r)
, a = getPath(e);
a !== i && (c = l,
l = a,
reportPV({
initiatorType: tr.routerAfterEach
}))
});
else {
var d, p, f, v, g, h, m, _ = null === (m = e.options) || void 0 === m ? void 0 : null === (h = m.pageView) || void 0 === h ? void 0 : h.routeMode, reportHistoryStatePv = function() {
(l = parseUrl(window.location.href)) !== c && reportPV({
initiatorType: tr.routerAfterEach
}),
c = l
};
if ("hash" === _)
window.addEventListener("hashChage", reportHistoryStatePv, !1);
else {
var y = registerEventHandler(window.history);
window.history.pushState = y("pushState"),
window.history.replaceState = y("replaceState"),
window.addEventListener("pushstate", reportHistoryStatePv, !1),
window.addEventListener("replacestate", reportHistoryStatePv, !1),
window.addEventListener("popstate", function() {
reportHistoryStatePv()
}, !1)
}
}
r = window.addEventListener || window.attachEvent,
i = function() {
!getPageVisable() && reportPV({
initiatorType: tr.viewDidAppear
}),
setPageVisible(1)
}
,
a = function() {
setPageVisible(0)
}
,
s = function() {
!getPageVisable() && reportPV({
initiatorType: tr.visibiltyChange
}),
setPageVisible(1)
}
,
E.YF.isXHS ? E.YF.isAndroid ? ((0,
S.Ld)("viewDidAppear", i),
(0,
S.Ld)("viewDidDisappear", a)) : E.YF.isIOS && ((0,
S.Ld)("viewDidAppear", i),
(0,
S.Ld)("viewDisappear", a)) : r("visibilitychange", function() {
"visible" === document.visibilityState ? s() : a()
}),
r("beforeunload", a)
} catch (r) {
reportInnerError(r, e)
}
}
, useCustomTimingMetrics = function(e) {
if ("undefined" != typeof window) {
var r = e.fmpElements
, i = e.ttiElements;
window.__USE_CUSTOM_TIMING__ = !0,
window.__CUSTOM_FMP_ELEMENTS__ = r,
window.__CUSTOM_TTI_ELEMENTS__ = i
}
}
, reportTimingMetrics = function(e) {
var r = e.id
, i = e.name
, a = e.priority
, s = e.extraData;
performance.mark(i + r),
window.dispatchEvent(new CustomEvent("__APM_".concat(i, "_EVENT__"),{
detail: {
id: r,
startTime: performance.now(),
priority: a || 1,
extraData: s
}
}))
}
, tn = new (function() {
function Client() {
(0,
f._)(this, Client),
(0,
g._)(this, "sessionId", ""),
(0,
g._)(this, "version", ea.i8),
(0,
g._)(this, "queue", []),
(0,
g._)(this, "apmEmitterSample", {}),
(0,
g._)(this, "options", {
jsError: {
enableIgnoreDefaultError: !0,
ignoreErrors: []
},
http: {
enableBatchRequest: !0,
enableResponseData: !1
},
blankScreen: {
threshold: .95,
domThreshold: 2,
maxDepth: 3,
lines: 5,
columns: 10,
autoCheckBS: !1,
autoCheckBSTime: 3e3,
screenshot: !0,
rootElementSelector: "",
preload: !0
},
debug: !0,
beforeSend: function(e) {
return e
}
}),
(0,
g._)(this, "perf", {}),
(0,
g._)(this, "performance", {
useCustomTimingMetrics: useCustomTimingMetrics,
reportTimingMetrics: reportTimingMetrics
}),
(0,
g._)(this, "isReady", !1),
(0,
g._)(this, "getBaseDeviceInfo", function() {
return ee.meta.xray
})
}
return (0,
v._)(Client, [{
key: "init",
value: function init(e) {
var r, i = this;
if (isBrowser()) {
setBaseInfo(),
this.perf = createPerfUtils(this),
this.apmEmitterSample = new eu(null == e ? void 0 : e.sample),
this.options = merge((0,
h._)({}, this.options), (0,
h._)({}, e));
var a = (null === (r = window) || void 0 === r ? void 0 : r.SDK__SESSION__ID) || (0,
_.Z)();
!window.SDK__SESSION__ID && (window.SDK__SESSION__ID = a),
this.sessionId = a,
e.env && setProd("production" === e.env),
ee.init((0,
h._)({}, this.options)).finally(function() {
for (i.isReady = !0; i.queue.length; ) {
var e = i.queue.shift();
e && i.report(e)
}
}),
window && (window.insight = this),
this.run()
}
}
}, {
key: "config",
value: function config(e, r, i) {
ee.config(e, r, i)
}
}, {
key: "extend",
value: function extend(e, r) {
ee.extend(e, r)
}
}, {
key: "push",
value: function push(e, r) {
if ("ApmJSONTracker" === r) {
var i = e.type
, a = e.value;
this.sendApm(a, i);
return
}
this.report(e)
}
}, {
key: "report",
value: function report(e, r) {
var i = this;
return (0,
p._)(function() {
var a, s;
return (0,
m.Jh)(this, function(u) {
switch (u.label) {
case 0:
if (i.isReady)
return [3, 1];
return i.queue.push(e),
[3, 3];
case 1:
return a = i.options.beforeSend,
[4, i.apmEmitterSample.getIsReportApm()];
case 2:
if (!u.sent())
return [2];
(s = a(ee.build(e))) && eo.sender(s, (0,
h._)({}, i.options), r),
u.label = 3;
case 3:
return [2]
}
})
})()
}
}, {
key: "flush",
value: function flush(e) {
this.report(e, {
isCombo: !1
})
}
}, {
key: "innerFlush",
value: function innerFlush(e) {
try {
var r = ee.meta.xray;
e.measurement_data.errorExtra = JSON.stringify(r),
eo.sender((0,
h._)({}, r, e), (0,
h._)({}, this.options), {
isCombo: !1
})
} catch (e) {}
}
}, {
key: "destroy",
value: function destroy() {
eo.destroy()
}
}, {
key: "setCustomDimensions",
value: function setCustomDimensions(e) {
"function" == typeof e && e(transformObj("custom", ee.extraMeta.dimensions, "delete")).then(function(e) {
ee.updateExtra("dimensions", e)
})
}
}, {
key: "updateMeta",
value: function updateMeta() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
ee.updateXrayMeta(e, (0,
h._)({}, this.options)),
ee.updateOldMeta(e, (0,
h._)({}, this.options))
}
}, {
key: "sendApm",
value: function sendApm(e, r) {
var i = {};
i[r] = {
type: r,
value: e
};
this.push({
type: "FrontApmTracker",
value: i
})
}
}, {
key: "sendCustomPoint",
value: function sendCustomPoint(e) {
this.report(e)
}
}, {
key: "sendCustomError",
value: function sendCustomError(e, r) {
var i = parseError(e, r);
if (i) {
var a = {
measurement_name: "infraJsError",
measurement_data: (0,
h._)({
type: "custom"
}, i)
};
this.flush(a)
}
}
}, {
key: "checkBlankScreenError",
value: function checkBlankScreenError() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, r = this.options.blankScreen;
blankScreenPlugin_checkBlankScreenError(this, (0,
h._)({}, r, e))
}
}, {
key: "run",
value: function run() {
var e = this
, r = [performance_performancePlugin, monitor_resourceErrorPlugin, resourceTimingNRE, performanceV2, pageViewTracker]
, i = this.options
, a = i.jsError
, s = i.app
, u = i.Launcher
, c = i.blankScreen
, l = c.autoCheckBS
, d = c.autoCheckBSTime
, p = c.screenshot
, f = c.preload;
a && r.push(jsErrorPlugin, monitor_promiseRejectPlugin),
s && u ? r.push(vueApmPlugin, launcher_http_request) : r.push(proxyXmlHttp, proxyFetch),
l && (setTimeout(function() {
blankScreenPlugin_checkBlankScreenError(e)
}, d),
p && f && downloadScreenshotTool()),
r.forEach(function(r) {
r(e)
})
}
}, {
key: "initForQiankunSubApp",
value: function initForQiankunSubApp(e, r, i, a) {
vueApmPlugin(this, i, a, e, r, !0),
launcher_http_request(this, e, r, a)
}
}]),
Client
}())
, ti = tn
},
83782: function(e, r, i) {
"use strict";
i.d(r, {
G: function() {
return getSelector
}
}),
i(72169),
i(58486),
i(85203);
var getName = function(e) {
var r = e.nodeName;
return 1 === e.nodeType ? r.toLowerCase() : r.toUpperCase().replace(/^#/, "")
}
, getSelector = function(e, r) {
var i = "";
try {
for (; e && 9 !== e.nodeType; ) {
var a = e
, s = a.id ? "#" + a.id : getName(a) + (a.classList && a.classList.value && a.classList.value.trim() && a.classList.value.trim().length ? "." + a.classList.value.trim().replace(/\s+/g, ".") : "");
if (i.length + s.length > (r || 100) - 1)
return i || s;
if (i = i ? s + ">" + i : s,
a.id)
break;
e = a.parentNode
}
} catch (e) {}
return i
}
},
82825: function(e, r, i) {
"use strict";
i.d(r, {
Fc: function() {
return growthEvent
},
ZP: function() {
return C
}
});
var a, s, u = i(41622), c = i(70879), l = i(27337), d = i(44501), p = i(377);
i(36277),
i(34333),
i(67930),
i(58486),
i(75973),
i(87535),
i(75204),
i(97357),
i(29112),
i(67275),
i(59989),
i(7099),
i(27461),
i(23339),
i(51109),
i(55947),
i(87989),
i(7608),
i(86651),
i(87394),
i(94941),
i(48421),
i(25069),
i(25037),
i(6045),
i(10364),
i(67673),
i(34885);
var f = "growth_query";
i(19077),
i(43648),
i(99808);
var v = "growth";
function setLocalStorage(e, r) {
var i = "".concat(v, "_").concat(e);
localStorage.setItem(i, JSON.stringify({
time: +new Date,
value: r
}))
}
function delLocalStorage(e) {
var r = "".concat(v, "_").concat(e);
localStorage.removeItem(r)
}
function getLocalStorage(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2592e5
, i = "".concat(v, "_").concat(e)
, a = localStorage.getItem(i);
if (a)
try {
var s = JSON.parse(a)
, u = s.time
, c = s.value;
if (+new Date - u < r)
return c;
delLocalStorage(e)
} catch (e) {}
return ""
}
function parse(e) {
var r = {};
return e.slice(e.indexOf("?") + 1).split("&").map(function(e) {
var i = (0,
d._)(e.split("="), 2)
, a = i[0]
, s = i[1];
return a ? (r[a] = s,
e) : {}
}),
r
}
var g = {}
, getCache = function() {
var e = getLocalStorage(f, 1728e5);
return e && (g = e),
g
}
, setQuery = function(e, r) {
r && (g[e] = r,
setLocalStorage(f, g))
}
, cache_getQuery = function(e) {
if (Object.keys(g).length)
return e ? null !== (r = g[e]) && void 0 !== r ? r : "" : g;
var r, i, a = getCache();
return a ? (g = a,
e ? null !== (i = g[e]) && void 0 !== i ? i : "" : g) : e ? "" : {}
}
, h = i(65266)
, m = {
edith2: "https://edith.xiaohongshu.com/api/growth/web_portal_monitor",
default: "https://www.xiaohongshu.com/api/sns/v1/ext/ads/landing_page/monitor"
};
var _ = ((a = {})["图片"] = "image",
a.http = "http",
a)
, sendByImage = function(e, r) {
r.t = new Date().getTime();
var i = new URLSearchParams(r).toString()
, a = new Image
, callback = function() {
a.onload = null,
a.onerror = null,
a.onabort = null,
a = null
};
a.onload = callback,
a.onerror = callback,
a.onabort = callback,
a.src = "".concat(e, "?").concat(i)
}
, getCollect = function() {
var e, r, i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, a = arguments.length > 1 ? arguments[1] : void 0, s = a.sendType, u = a.testUrl;
if (u = "",
s === _["图片"] && sendByImage(u || m.default, i),
s === _.http) {
;e = u || m.edith2,
r = i,
h.dJ.get(e, {
params: r
})
}
}
, y = {
gt_ki: "growth_keywordid",
gt_ui: "growth_userid",
gt_pi: "growth_planid",
gt_uni: "growth_unitid",
gt_ci: "growth_creativeid",
gt_mt: "growth_matchtype",
gt_dt: "growth_dongtai",
gt_of: "growth_ocpc",
gt_cpi: "growth_crowdid",
gt_kw: "growth_kw",
utm_source: "utm_source",
utm_campaign: "utm_campaign",
bd_vid: "growth_bd_vid",
sg_vid: "growth_sg_vid",
qhclickid: "growth_qh_id",
clickid: "growth_sm_id",
qz_gdt: "qz_gdt",
gdt_vid: "gdt_vid",
callback: "growth_ks_id"
}
, w = {
baidu_sem: "growth_bd_vid",
baidu_feeds: "growth_bd_vid",
sogou_sem: "growth_sg_vid",
"360_sem": "growth_qh_id",
shenma_sem: "growth_sm_id",
tencent_gdt: "growth_sm_id",
kuaishou: "growth_ks_id",
uc_huichuan: "uctrackid"
}
, E = !0
, S = {}
, T = {}
, growthEvent = function(e) {
var r, i, a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
if (!E)
return {
status: 1,
msg: "非法来源"
};
var s = window.location
, u = s.origin
, l = s.pathname
, d = parse(s.search)
, p = cache_getQuery();
Object.keys(p).forEach(function(e) {
!(e in d) && (d[e] = p[e])
}),
T = (0,
c._)({}, T, a);
var f = new URLSearchParams(d).toString();
return getCollect({
url: "".concat(u + l, "?").concat(f),
referer: null !== (i = document.referrer) && void 0 !== i ? i : null === (r = window.location) || void 0 === r ? void 0 : r.href,
action: e,
pasteboard: "",
extra: JSON.stringify(T)
}, S),
{
status: 0,
msg: "发送成功"
}
};
var b = (s = (0,
u._)(function() {
var e;
return (0,
p.Jh)(this, function(r) {
switch (r.label) {
case 0:
return r.trys.push([0, 2, , 3]),
[4, h.dJ.get("https://pages.xiaohongshu.com/data/sem_sdk", {
withCredentials: !1
})];
case 1:
return y = (e = r.sent()).allowKey,
e.clickId,
[3, 3];
case 2:
return console.log(r.sent()),
[3, 3];
case 3:
return [2]
}
})
}),
function getConfigFunc() {
return s.apply(this, arguments)
}
)
, k = 0
, handleRouteChange = function(e) {
getCache(),
Object.keys(e).forEach(function(r) {
var i, a = e[r];
if (Array.isArray(a) && (a = null !== (i = (a = a.filter(function(e) {
return !/\{[^\\}]+\}/g.test(e || "")
}))[0]) && void 0 !== i ? i : ""),
/\{[^\\}]+\}/g.test(a || "") && (a = ""),
!!a) {
var s = !1;
Object.entries(y).map(function(e) {
var i = (0,
d._)(e, 2)
, u = i[0]
, c = i[1];
return u === r && (s = !0,
setQuery(u, a),
setQuery(c, a)),
""
}),
!s && setQuery(r, a)
}
}),
k += 1,
growthEvent("pv_".concat(k))
}
, C = {
name: "ocpcPlugin",
installed: !1,
install: function(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
return (0,
u._)(function() {
var a, s, u, d, f, v;
return (0,
p.Jh)(this, function(p) {
return !this.installed && r.isBrowser && e.router ? (this.installed = !0,
s = void 0 === (a = i.sourceName) ? "" : a,
d = void 0 === (u = i.sourceValue) ? [] : u,
v = void 0 === (f = i.sendType) ? _["图片"] : f,
S = (0,
l._)((0,
c._)({}, i), {
sendType: v,
sourceName: s
}),
b(),
e.router.beforeResolve(function(e) {
s ? 0 === d.length && s in e.query ? handleRouteChange(e.query) : 0 !== d.length && d.indexOf(e.query[s]) > -1 ? handleRouteChange(e.query) : E = !1 : handleRouteChange(e.query)
}),
[2]) : [2]
})
}).apply(this)
}
}
},
88028: function(e, r, i) {
"use strict";
i(86651),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.isRiskCanvas = void 0;
r.isRiskCanvas = function() {
var e = []
, r = document.createElement("canvas").getContext("webgl")
, i = null == r ? void 0 : r.getExtension("WEBGL_debug_renderer_info");
return i && r && ("Brian Paul" === r.getParameter(i.UNMASKED_VENDOR_WEBGL) && e.push("WebGLVendor"),
"Mesa OffScreen" === r.getParameter(i.UNMASKED_RENDERER_WEBGL) && e.push("WebGLRendor")),
e
}
},
32394: function(e, r, i) {
"use strict";
var a, s = i(41622), u = i(36102);
i(86651),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.isRiskDevice = void 0;
var c = (a = s._(function() {
var e, r;
return u._(this, function(i) {
switch (i.label) {
case 0:
if (e = [],
0 === navigator.deviceMemory && e.push("MemoryInfo"),
"probably" !== document.createElement("video").canPlayType('video/mp4; codecs="avc1.42E01E"') && e.push("VideoCodecs"),
"probably" !== document.createElement("audio").canPlayType("audio/mpeg;") && e.push("AudioCodecs"),
!(r = navigator.mediaDevices))
return [3, 2];
return [4, navigator.mediaDevices.enumerateDevices()];
case 1:
r = 0 === i.sent().length,
i.label = 2;
case 2:
return r && e.push("MediaDevices"),
[2, e]
}
})
}),
function isRiskDevice() {
return a.apply(this, arguments)
}
);
r.isRiskDevice = c
},
81694: function(e, r, i) {
"use strict";
var a, s = i(41622), u = i(36102);
i(86651),
i(1154),
i(80013),
i(97357),
i(34333),
i(55947),
i(34885),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.isRiskWindow = void 0;
var c = (a = s._(function() {
var e, r, i;
return u._(this, function(a) {
switch (a.label) {
case 0:
return i = [],
window.navigator.webdriver && i.push("ChromeWebdriver"),
["_Selenium_IDE_Recorder", "callSelenium", "_selenium", "__webdriver_script_fn", "__driver_evaluate", "__webdriver_evaluate", "__selenium_evaluate", "__fxdriver_evaluate", "__driver_unwrapped", "__webdriver_unwrapped", "__selenium_unwrapped", "__fxdriver_unwrapped", "__webdriver_script_func"].some(function(e) {
return window.hasOwnProperty(e) || document.hasOwnProperty(e)
}) && i.push("SeleniumDriver"),
(null === (e = window.external) || void 0 === e ? void 0 : e.toString) && window.external.toString().indexOf("Sequentum") > -1 && i.push("SequentumProperties"),
(void 0 !== window.callPhantom || void 0 !== window._phantom || void 0 !== window.phantom) && i.push("PhantomProperties"),
void 0 !== window.__nightmare && i.push("NightmareProperties"),
[4, null === (r = navigator.permissions) || void 0 === r ? void 0 : r.query({
name: "notifications"
})];
case 1:
return "prompt" === a.sent().state && "denied" === Notification.permission && i.push("PermissionConfilct"),
0 === navigator.plugins.length && i.push("PluginLength"),
!(navigator.plugins instanceof PluginArray) && i.push("PluginPrototype"),
(0 === navigator.languages.length || !navigator.languages) && i.push("Languages"),
[2, i]
}
})
}),
function isRiskWindow() {
return a.apply(this, arguments)
}
);
r.isRiskWindow = c
},
16658: function(e, r, i) {
"use strict";
i(25069),
i(58486),
i(86651),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.isHeadlessUA = void 0;
r.isHeadlessUA = function() {
var e = []
, r = navigator.userAgent;
return /Headless/.test(r) && e.push("HeadlessUA"),
/PhantomJS/.test(r) && e.push("PhantomUA"),
e
}
},
90405: function(e, r, i) {
"use strict";
var a, s, u, c = i(41622), l = i(75649), d = i(36102);
i(86651),
i(36277),
i(34333),
i(27461),
i(23339),
i(51109),
i(6045),
i(10364),
i(67673),
i(87535),
i(75204),
i(97357),
i(7608);
var p = i(88028)
, f = i(32394)
, v = i(81694)
, g = [i(16658).isHeadlessUA, v.isRiskWindow, p.isRiskCanvas, f.isRiskDevice];
(a = u || (u = {})).pass = "pass",
a.risk = "risk",
a.unknown = "unknown";
var h = null;
var m = (s = c._(function() {
var e, r, i;
return d._(this, function(a) {
switch (a.label) {
case 0:
if (h)
return [2, h];
a.label = 1;
case 1:
return a.trys.push([1, 3, , 4]),
[4, Promise.all(g.map(function(e) {
return e()
}))];
case 2:
return e = a.sent(),
r = [],
e.forEach(function(e) {
r.push.apply(r, l._(e))
}),
[2, h = {
pass: 0 === r.length ? u.pass : u.risk,
reason: JSON.stringify(r)
}];
case 3:
return i = a.sent(),
[2, h = {
pass: u.unknown,
reason: i.message
}];
case 4:
return [2]
}
})
}),
function detectHeadless() {
return s.apply(this, arguments)
}
);
r.default = m
},
85456: function(e, r, i) {
"use strict";
i.r(r),
i.d(r, {
post: function() {
return B
},
del: function() {
return L
},
axios: function() {
return s()
},
interceptors: function() {
return H
},
patch: function() {
return D
},
fork: function() {
return j
},
default: function() {
return G
},
buildURL: function() {
return q
},
put: function() {
return x
},
head: function() {
return M
},
configure: function() {
return U
},
makeUri: function() {
return V
},
get: function() {
return N
},
getUri: function() {
return F
},
instance: function() {
return W
}
});
var a = i(86246)
, s = i.n(a)
, u = i(70879)
, c = i(27337)
, l = i(75649)
, d = i(31547);
i(87989),
i(41593),
i(34333),
i(55947),
i(36277),
i(58051),
i(34885),
i(1154),
i(80013),
i(97357),
i(42876),
i(33933),
i(87535),
i(75204);
var p = i(39160)
, f = i.n(p)
, v = i(50142)
, g = i(63877);
i(25069),
i(58486),
i(72169);
var h = {
baseURL: void 0,
apiList: void 0
}
, m = /(^https?|^mesh):/;
function isFullUri(e) {
return /^\/\//.test(e) || m.test(e)
}
function isRelativeUri(e) {
return "/" === e.charAt(0)
}
function checkBaseURL(e) {
if ("string" != typeof e)
throw Error("[Http Exception] baseURL must be string, but now: ".concat(e));
if ("/" === e.charAt(e.length - 1))
throw Error('[Http Exception] baseURL should not end with "/"')
}
function checkApiItem(e, r) {
var i = "[Http Exception] ".concat(r);
if ("string" != typeof e)
throw Error("".concat(i, " should be a string"));
if (!isFullUri(e) && "/" !== e.charAt(0))
throw Error("".concat(i, ' should be start with "/"'))
}
function checkApiList(e) {
if ((void 0 === e ? "undefined" : (0,
d._)(e)) !== "object")
throw Error("[Http Exception] apiList must be a map, but now: ".concat(void 0 === e ? "undefined" : (0,
d._)(e)));
for (var r in e)
e.hasOwnProperty(r) && checkApiItem(e[r], r)
}
function configure(e) {
var r = e.baseURL
, i = e.apiList;
r && (checkBaseURL(r),
void 0 !== h.baseURL && (0,
g.ZK)("[Http Warning] baseURL defined more than once"),
h.baseURL = r),
i && (checkApiList(i),
void 0 !== h.apiList && (0,
g.ZK)("[Http Warning] apiList defined more than once"),
h.apiList = i)
}
function concatBaseURL(e, r) {
return r.baseURL ? "".concat(r.baseURL).concat(e) : void 0 === h.baseURL ? e : h.baseURL + e
}
function concatPath(e, r) {
return "".concat(e, "/").concat(r)
}
var _ = /\$?\{([^}]+)\}/g;
function replacePlaceholder(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}
, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}
, a = r && "function" == typeof r.get && "function" == typeof r.has;
return e.replace(_, function(s, u) {
return i && i[u] ? i[u] : r && r[u] ? r[u] : a && r.has(u) ? r.get(u) : ((0,
g.vU)("[Http Exception] could not found placeholder ".concat(u, " in ").concat(e, " from payload")),
"undefined")
})
}
function handleUriCreation(e, r) {
var i = isFullUri(e) ? e : concatBaseURL(e, r);
return i = r.resourceParams ? replacePlaceholder(i, r.resourceParams) : replacePlaceholder(i, r.data, r.params),
r.resourceId && (i = concatPath(i, r.resourceId)),
r.resourceAction && (i = concatPath(i, r.resourceAction)),
i
}
function makeUri(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
if (isFullUri(e) || isRelativeUri(e) || void 0 === h.apiList)
return handleUriCreation(e, r);
if (h.apiList[e])
return handleUriCreation(h.apiList[e], r);
throw Error("[Http Exception] ".concat(e, " is not specified on api-list.config"))
}
function getMatchedPath(e) {
return void 0 !== h.apiList && h.apiList[e] ? h.apiList[e] : e
}
var y = i(17177)
, w = i(46490)
, E = i(90251);
i(86651);
var S = function() {
function Interceptor() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
(0,
w._)(this, Interceptor),
this.queue = e
}
return (0,
E._)(Interceptor, [{
key: "use",
value: function use(e, r) {
this.queue.push({
fulfilled: e,
rejected: r
})
}
}]),
Interceptor
}();
function createInterceptor() {
return new S
}
function forkInterceptor(e) {
return new S((0,
l._)(e.queue))
}
var T = i(36757);
function merge() {
for (var e = arguments.length, r = Array(e), i = 0; i < e; i++)
r[i] = arguments[i];
var a = {};
function assignValue(e, r) {
"object" === (0,
d._)(a[r]) && (void 0 === e ? "undefined" : (0,
d._)(e)) === "object" ? a[r] = merge(a[r], e) : a[r] = e
}
return r.forEach(function(e) {
if (void 0 !== e) {
if ((void 0 === e ? "undefined" : (0,
d._)(e)) !== "object" || Array.isArray(e))
throw Error("[Http Exception] config must be a plain object");
for (var r in e)
e.hasOwnProperty(r) && assignValue(e[r], r)
}
}),
a
}
function isFormData(e) {
return "undefined" != typeof FormData && e instanceof FormData
}
function isNumber(e) {
return "number" == typeof e
}
function needParse(e) {
return (void 0 === e ? "undefined" : (0,
d._)(e)) === "object" && !isFormData(e)
}
function transformRequestConfig(e) {
var r = e.transform;
return r && (needParse(e.data) && (e.data = (0,
T.cJ)(e.data, r)),
needParse(e.params) && (e.params = (0,
T.cJ)(e.params, r))),
e
}
function transformResponseData(e, r) {
var i = r.transform;
return r.transform ? (0,
T.Lg)(e, i) : e
}
function mapStatusCodeFromLegacyResponse(e) {
return e && (-101 === e.result || -101 === e.code) ? 401 : 200
}
function apiListAdapter(e) {
return Object.keys(e).reduce(function(r, i) {
var a = e[i];
return (void 0 === a ? "undefined" : (0,
d._)(a)) === "object" ? ((0,
g.ZK)("[Http Warning] The value of 'API_LIST.".concat(i, "' should not be object, please change to string")),
r[i] = a.url) : r[i] = a,
r
}, {})
}
i(75973),
i(82427),
i(36062),
i(57057);
function generateTraceId() {
for (var e = "", r = 0; r < 16; r++)
e += "abcdef0123456789".charAt(Math.floor(16 * Math.random()));
return e
}
var b = "x-b3-traceid"
, k = "x-xray-traceid"
, C = ["www.xiaohongshu.com", "logan.devops.xiaohongshu.com", "dragon.devops.xiaohongshu.com"]
, P = ["www.beta.xiaohongshu.com/api/sec/v1/scripting", "www.beta.xiaohongshu.com/api/sec/v1/shield/webprofile", "www.xiaohongshu.com/api/sec/v1/sbtsource"]
, A = {
traceHosts: C,
traceIgnores: P
};
function factory_configure(e) {
if ((e.baseURL || e.apiList) && configure({
baseURL: e.baseURL,
apiList: apiListAdapter(e.apiList)
}),
e.defaults) {
var r = e.defaults
, i = r.traceHosts
, a = r.traceIgnores;
A = (0,
c._)((0,
u._)({}, e.defaults), {
traceHosts: "function" == typeof i ? i(C) : (0,
l._)(C).concat((0,
l._)(i || [])),
traceIgnores: "function" == typeof a ? a(P) : (0,
l._)(P).concat((0,
l._)(a || []))
})
}
return e.logger && (0,
g._c)(e.logger),
A
}
function isConfigWithFormData(e) {
return (void 0 === e ? "undefined" : (0,
d._)(e)) === "object" && isFormData(e.data)
}
function makeSendingConfig(e) {
var r = merge(A, e);
return isConfigWithFormData(r) && !isNumber(e.timeout) && isNumber(A.uploadTimeout) && (r.timeout = A.uploadTimeout),
r.uploadTimeout && delete r.uploadTimeout,
r
}
function handleResData(e, r) {
return !1 === r ? e : "function" == typeof r ? r(e) : e.data
}
function processSend(e, r, i) {
for (var a = r, s = null, u = (0,
l._)(i.request.queue).concat([{
fulfilled: function(e) {
return e !== a && (0,
g.ZK)("[Http Warning] config reference has been changed during request interceptor"),
a = transformRequestConfig(makeSendingConfig(e))
}
}], (0,
l._)(i.dispatch.queue), [{
fulfilled: function(r) {
r !== a && (0,
g.ZK)("[Http Warning] config reference has been changed during dispatch interceptor");
var i = e(r);
if (!i || !i.then)
throw Error("[Http Exception] send must return a promise object");
return i
}
}], (0,
l._)(i.spam.queue), [{
name: "responseStatusCodeHandler",
fulfilled: function(e) {
if (200 === e.status && (e.status = mapStatusCodeFromLegacyResponse(e.data)),
"[object Null]" === Object.prototype.toString.call(e.data) && (e.data = {}),
"[object Object]" === Object.prototype.toString.call(e.data) && (e.data[y.Eg] = (0,
y.qH)(e.data),
e.data[y.Wz] = (0,
y.qG)(e.data)),
s = e,
e.status < 200 || e.status >= 300)
throw new y.v$(e.status,e.data);
return e.data
},
rejected: function(e) {
var r;
throw new y.th(null !== (r = e.code) && void 0 !== r ? r : "ENetworkError",e.message)
}
}], (0,
l._)(i.response.queue), [{
fulfilled: function(e, r) {
if (void 0 !== e.success && !1 == !!e.success)
throw new y.al(r.status,e);
return handleResData(transformResponseData(e, a), a.extractData)
}
}], (0,
l._)(i.result.queue)), c = Promise.resolve(a), wrapFulfilled = function(e) {
return function(r) {
return e ? e(r, s, a) : r
}
}, wrapRejected = function(e) {
return function(r) {
if (e)
return e(r, s, a);
throw r
}
}; u.length; ) {
var d = u.shift();
c = c.then(wrapFulfilled(d.fulfilled), wrapRejected(d.rejected))
}
return c
}
var R = ["POST", "PUT", "PATCH"]
, I = ["GET", "DELETE", "HEAD"]
, sendFactory = function(e, r, i, a, s) {
return function(u, c, l) {
if (!u)
return Promise.reject(Error("[Http Exception] apiKey is empty"));
if (a ? (p = l || {}).data = c : (p = c || {},
(void 0 === l ? "undefined" : (0,
d._)(l)) === "object" && Object.assign(p, l)),
p.method = e,
p.url = makeUri(u, p),
p.matchedPath = getMatchedPath(u),
!p.headers && (p.headers = {}),
!p.headers[b]) {
if (0 === p.url.indexOf("/") && 0 !== p.url.indexOf("//"))
p.headers[b] = generateTraceId();
else {
var p, f = A.traceHosts, g = A.traceIgnores;
f.some(function(e) {
return p.url.includes(e)
}) && !g.some(function(e) {
return p.url.includes(e)
}) && (p.headers[b] = generateTraceId())
}
}
if ("undefined" != typeof window && !1 !== p.useXRayHeader && (p.useXRayHeader || A.useXRayHeader)) {
var h = !1;
try {
h = p.headers[k] || s.defaults.headers.common[k] || s.defaults.headers[e][k]
} catch (e) {}
if (!h) {
if (0 === p.url.indexOf("/") && 0 !== p.url.indexOf("//"))
p.headers[k] = (0,
v.traceId)();
else {
var m = A.traceHosts
, _ = A.traceIgnores;
m.some(function(e) {
return p.url.includes(e)
}) && !_.some(function(e) {
return p.url.includes(e)
}) && (p.headers[k] = (0,
v.traceId)())
}
}
}
return processSend(r, p, i)
}
};
function factory(e, r, i) {
var a = {}
, u = {
request: i ? forkInterceptor(i.interceptors.request) : createInterceptor(),
dispatch: i ? forkInterceptor(i.interceptors.dispatch) : createInterceptor(),
spam: i ? forkInterceptor(i.interceptors.spam) : createInterceptor(),
response: i ? forkInterceptor(i.interceptors.response) : createInterceptor(),
result: i ? forkInterceptor(i.interceptors.result) : createInterceptor()
};
return R.forEach(function(i) {
a[i.toLowerCase()] = sendFactory(i, e, u, !0, r)
}),
I.forEach(function(i) {
a[i.toLowerCase()] = sendFactory(i, e, u, !1, r)
}),
a.del = a.delete,
a.configure = factory_configure,
a.interceptors = u,
a.makeUri = makeUri,
a.getUri = s().getUri,
a.buildURL = f(),
a.instance = r,
a.fork = function() {
var e = s().create();
return factory(e.request.bind(e), e, a)
}
,
a
}
s().defaults.validateStatus = void 0;
var O = factory(s().request.bind(s()), s())
, N = O.get
, L = O.del
, M = O.head
, B = O.post
, x = O.put
, D = O.patch
, F = O.getUri
, V = O.makeUri
, H = O.interceptors
, U = O.configure
, q = O.buildURL
, j = O.fork
, W = O.instance
, G = O
},
17177: function(e, r, i) {
"use strict";
i.d(r, {
Eg: function() {
return v
},
Wz: function() {
return h
},
al: function() {
return y
},
qG: function() {
return getErrorMsgFromData
},
qH: function() {
return getErrorCodeFromData
},
th: function() {
return m
},
v$: function() {
return _
}
});
var a = i(35329)
, s = i(46490)
, u = i(90251)
, c = i(27292)
, l = i(75649)
, d = i(30961);
i(87989),
i(87535),
i(75204),
i(97357),
i(34333),
i(41593);
var p = i(63877)
, f = ["result", "error", "error_code"]
, v = "code"
, g = ["error_message", "message", "error_msg"]
, h = "msg";
function warnWhenLegacyFound(e, r) {
(0,
p.ZK)("[Http Warning] 'response.body.".concat(e, "' was deprecated, please ask the backend to change it to '").concat(r, "'"))
}
function getErrorCodeFromData() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, r = e[v];
return void 0 === r && f.forEach(function(i) {
e[i] && (r = e[i],
warnWhenLegacyFound(i, v))
}),
void 0 === r && (r = "N/A"),
r
}
function getErrorMsgFromData() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, r = e[h];
return void 0 === r && g.forEach(function(i) {
e[i] && (r = e[i],
warnWhenLegacyFound(i, h))
}),
void 0 === r && (r = "Error"),
r
}
var m = function(e) {
function HTTPClientError(e, r) {
var i;
return (0,
s._)(this, HTTPClientError),
(i = (0,
a._)(this, HTTPClientError, [r])).name = "HTTPClientError",
i.code = e,
i
}
return (0,
c._)(HTTPClientError, e),
HTTPClientError
}((0,
d._)(Error))
, _ = function(e) {
function HTTPServerError(e, r) {
var i;
return (0,
s._)(this, HTTPServerError),
(i = (0,
a._)(this, HTTPServerError, [null == r ? void 0 : r.msg])).name = "HTTPServerError",
i.code = null == r ? void 0 : r.code,
i.status = e,
i.data = r,
i
}
return (0,
c._)(HTTPServerError, e),
(0,
u._)(HTTPServerError, [{
key: "statusCode",
get: function get() {
return (0,
p.ZK)("[Http Warning] 'statusCode' was deprecated, please use 'status'"),
this.status
}
}, {
key: "detail",
get: function get() {
return (0,
p.ZK)("[Http Warning] 'detail' was deprecated, please use 'data'"),
this.data
}
}]),
HTTPServerError
}((0,
d._)(Error))
, y = function(e) {
function HTTPBizError() {
for (var e, r = arguments.length, i = Array(r), u = 0; u < r; u++)
i[u] = arguments[u];
return (0,
s._)(this, HTTPBizError),
(e = (0,
a._)(this, HTTPBizError, (0,
l._)(i))).name = "HTTPBizError",
e
}
return (0,
c._)(HTTPBizError, e),
HTTPBizError
}(_)
},
63877: function(e, r, i) {
"use strict";
i.d(r, {
ZK: function() {
return a.warn
},
_c: function() {
return configDefaultTransport
},
vU: function() {
return error
}
});
var a = i(14166)
, s = {};
function configDefaultTransport(e) {
s = e
}
function error(e, r, i, u) {
(0,
a.error)(e, r, i, u || s)
}
},
44840: function(e, r, i) {
"use strict";
i.d(r, {
W: function() {
return d
}
});
var a = i(70879);
i(34333),
i(55947),
i(34885),
i(87989),
i(25069),
i(58486),
i(80156),
i(50721),
i(29112),
i(67275),
i(59989),
i(7099),
i(27461),
i(23339),
i(51109),
i(72169);
var s = i(5681)
, u = i.n(s);
let c = "/fe_api/";
function encryptToken(e, r, i="X") {
let {url: a=""} = e
, {params: s, paramsSerializer: l} = e;
return (a = a.slice(a.indexOf(c), a.length),
"X" === i) ? `${i}${u()(r(a, s, l) + "WSUDD")}` : ""
}
var l = i(14166);
function getStorageItem(e) {
var r = parseInt(window.sessionStorage.getItem(e) || 0, 10) + 1;
return window.sessionStorage.setItem(e, r.toString()),
(0,
l.info)(e, {
arg1: r
}, e),
r < 5
}
function spamNeedReload(e) {
var r = !1;
return !window.spamTimer && (window.spamTimer = window.setTimeout(function() {
window.sessionStorage.removeItem("spam_font_counter"),
window.sessionStorage.removeItem("spam_sign_counter")
}, 36e5)),
("3" === e || "1" === e) && (r = getStorageItem("spam_sign_counter")),
"4" === e && (r = getStorageItem("spam_font_counter")),
r
}
var d = {
name: "crawler-spam",
installed: !1,
install: function(e, r) {
if (!this.installed && !!r.isBrowser)
r.http.interceptors.dispatch.use(function(e) {
e.url.indexOf(c) > -1 && (e.headers["X-Sign"] = encryptToken(e, r.http.buildURL));
var i, s = e.url, u = void 0 === s ? "" : s;
if ((null === (i = window) || void 0 === i ? void 0 : i.shouldSign) && window.shouldSign(u)) {
var l = u;
if (0 === u.indexOf("//") && (u = "".concat(window.location.protocol).concat(u)),
/^https?:/.test(u))
try {
var d = new URL(u);
l = d.href.replace(d.origin, "")
} catch (e) {
l = u
}
var p = e.params
, f = e.paramsSerializer
, v = r.http.buildURL(l, p, f)
, g = window.sign(v, e.data) || {}
, h = window.f && "function" == typeof window.f ? window.f() : {};
e.headers = (0,
a._)({}, e.headers, g, h)
}
return e
}),
r.http.interceptors.spam.use(function(e) {
var r = (null == e ? void 0 : e.headers) && e.headers["x-kong-sign"];
return 406 === e.status ? r && "2" === r ? (alert("系统时间错误"),
(0,
l.info)("systemTimeError", void 0, "system_time_error")) : spamNeedReload(r) && window.location.reload() : r && spamNeedReload(r) && window.location.reload(),
e
}),
this.installed = !0
}
};
i(36277)
},
57517: function(e, r, i) {
"use strict";
i.d(r, {
Ni: function() {
return C
},
jP: function() {
return H
},
mD: function() {
return A
},
$T: function() {
return useABTest
}
});
var a, s, u, c, l, d, p, f = i(46490), v = i(90251), g = i(51606), h = i(78607), m = i(41622), _ = i(377);
i(36277),
i(34333),
i(27461),
i(23339),
i(51109),
i(6045),
i(10364),
i(67673),
i(86651),
i(42876),
i(33933),
i(87394),
i(94941),
i(48421),
i(97357),
i(87535),
i(75204),
i(64961),
i(12996),
i(59564),
i(75973);
var y = i(88867)
, w = i(51401)
, E = i(85456)
, getExpFlags = function(e, r, i) {
var a = (0,
y.getPublicUrl)(r, i)
, s = 5e3;
return "prod" === r && (s = "undefined" != typeof window ? 3e3 : 500),
E.default.post(a, {
racing_info: e,
source: "web",
app: ""
}, {
transform: !1,
timeout: s
})
};
var S = (a = (0,
m._)(function(e, r) {
return (0,
_.Jh)(this, function(i) {
switch (i.label) {
case 0:
var a;
return [4, Promise.all(e.map((a = (0,
m._)(function(e) {
var i, a, s;
return (0,
_.Jh)(this, function(s) {
switch (s.label) {
case 0:
if (i = e.id,
"WEB_ID" === e.type && r && (i = r),
"web_g" === e.domain && "WEB_ID" === e.type) {
var u;
i = null !== (a = w.Z.get("abRequestId")) && void 0 !== a ? a : (u = r,
w.Z.set("abRequestId ", u, {
domain: "xiaohongshu.com",
expires: 365
}),
u)
}
if ("function" != typeof e.id)
return [3, 4];
s.label = 1;
case 1:
return s.trys.push([1, 3, , 4]),
[4, e.id()];
case 2:
return i = s.sent(),
[3, 4];
case 3:
return s.sent(),
i = "",
[3, 4];
case 4:
return ["0", ""].includes(null != i ? i : "") && (e.id = i),
[2, {
domain: e.domain,
type: e.type,
id: i
}]
}
})
}),
function(e) {
return a.apply(this, arguments)
}
)))];
case 1:
return [2, i.sent().filter(function(e) {
var r;
return !["", "0"].includes(null !== (r = e.id) && void 0 !== r ? r : "")
}).map(function(e) {
return {
open_id: "OPEN_ID" === e.type ? e.id : void 0,
user_id: "USER_ID" === e.type ? e.id : void 0,
web_id: "WEB_ID" === e.type ? e.id : void 0,
request_id: "REQUEST_ID" === e.type ? e.id : void 0,
domain: e.domain
}
})]
}
})
}),
function getRacingInfo(e, r) {
return a.apply(this, arguments)
}
);
var T = (s = (0,
m._)(function(e, r, i, a) {
var s, u;
return (0,
_.Jh)(this, function(u) {
switch (u.label) {
case 0:
s = e,
(null == r || "" === r) && (s = e.filter(function(e) {
return "WEB_ID" !== e.type
})),
u.label = 1;
case 1:
return u.trys.push([1, 4, , 5]),
[4, S(s, r)];
case 2:
return [4, getExpFlags(u.sent(), i, a)];
case 3:
return [2, u.sent()];
case 4:
return u.sent(),
console.warn("get racing error"),
[2, void 0];
case 5:
return [2]
}
})
}),
function combineLauncherRequest(e, r, i, a) {
return s.apply(this, arguments)
}
)
, getDefaultValue = function() {
return {
value: {},
rejected: {},
id: {
webId: "",
userId: ""
},
status: y.ABTestStatus.Pending,
diversions: {},
source: {},
csrReqStatus: y.RequestStatus.noReq,
ssrReqStatus: y.RequestStatus.noReq,
clientCost: 0,
serverCost: 0
}
};
function initDefaultABTestData() {
var e = P.getAbFlagReference();
return e.value = (0,
h.qj)(getDefaultValue()),
e
}
var b = (u = (0,
m._)(function(e, r, i, a) {
var s, u, c;
return (0,
_.Jh)(this, function(l) {
switch (l.label) {
case 0:
return l.trys.push([0, 2, , 3]),
[4, T(r, e.id.webId, i, a)];
case 1:
return (c = null !== (u = null == (s = l.sent()) ? void 0 : s.diversion_results) && void 0 !== u ? u : []).length > 0 && r.forEach(function(r) {
var i = r.name
, a = r.domain
, s = r.type
, u = r.id
, l = c.find(function(e) {
return e.diversion_key === a
});
if (e.id[s] = u,
l) {
var d = l.flag_map
, p = l.diversions;
e.value[i] = d,
e.diversions[i] = p,
e.source[i] = y.ABDataSource.Api
} else
e.rejected[i] = "no data"
}),
e.status = y.ABTestStatus.Finish,
[3, 3];
case 2:
return console.error(l.sent()),
[3, 3];
case 3:
return [2]
}
})
}),
function handleRequestABFlags(e, r, i, a) {
return u.apply(this, arguments)
}
);
var k = (c = (0,
m._)(function(e, r) {
var i, a, s, u, c, l, d, p, f, v;
return (0,
_.Jh)(this, function(g) {
switch (g.label) {
case 0:
if (a = e.requests.map(function(e) {
return e.name
}),
s = Object.keys((null === (i = r.value) || void 0 === i ? void 0 : i.value) || {}),
0 === (u = a.filter(function(e) {
return !s.includes(e)
})).length)
return [2, r];
if (!e.retry)
return [3, 2];
return l = Date.now(),
d = e.requests.filter(function(e) {
return u.includes(e.name)
}),
[4, b(r.value, d, e.env)];
case 1:
if (g.sent(),
p = Date.now(),
r.value.clientCost = p - l,
s = Object.keys(null !== (f = null === (c = r.value) || void 0 === c ? void 0 : c.value) && void 0 !== f ? f : {}),
0 === (u = u.filter(function(e) {
return !s.includes(e)
})).length)
return r.value.csrReqStatus = y.RequestStatus.success,
[2, r];
r.value.csrReqStatus = y.RequestStatus.failed,
g.label = 2;
case 2:
if (v = (0,
y.getXHSABTestFlag)(),
!e.disableCache && v)
return u.forEach(function(i) {
var a, s, u;
r.value.value[i] = null !== (u = null === (a = v.value) || void 0 === a ? void 0 : a[i]) && void 0 !== u ? u : null === (s = e.requests.find(function(e) {
return e.name === i
})) || void 0 === s ? void 0 : s.defaultFlags,
r.value.source[i] = y.ABDataSource.DefaultValue
}),
[2, r];
return u.forEach(function(i) {
var a;
r.value.value[i] = null === (a = e.requests.find(function(e) {
return e.name === i
})) || void 0 === a ? void 0 : a.defaultFlags,
r.value.source[i] = y.ABDataSource.Cache
}),
[2, r]
}
})
}),
function clientDowngrade(e, r) {
return c.apply(this, arguments)
}
)
, saveFlags = function(e, r) {
!e.disableCache && (0,
y.setXHSABTestFlag)(r.value)
};
var C = (l = (0,
m._)(function(e) {
var r, i = arguments;
return (0,
_.Jh)(this, function(a) {
return r = i.length > 1 && void 0 !== i[1] ? i[1] : 3e3,
[2, new Promise(function(i) {
var a = P.getAbFlagReference()
, getResolveValue = function() {
return {
status: a.value.status,
flags: e ? a.value.value[e] : a.value.value,
id: a.value.id
}
}
, s = getResolveValue();
if (a.value.status !== y.ABTestStatus.Pending) {
i(s);
return
}
var u = null
, c = (0,
h.YP)(function() {
return a.value.status
}, function(e) {
e === y.ABTestStatus.Finish && (c(),
null != u && clearTimeout(u),
i(getResolveValue()))
}, {
immediate: !0
});
u = setTimeout(function() {
c(),
a.value.status = y.ABTestStatus.Failed,
i(getResolveValue())
}, r)
}
)]
})
}),
function abTestResolve(e) {
return l.apply(this, arguments)
}
)
, handleABFlagsFromServer = function(e, r) {
var i = getDefaultValue()
, a = P.getAbFlagReference();
return e.forEach(function(e) {
var a = e.name
, s = r[e.domain];
s ? (i.value[a] = s,
i.diversions[a] = [],
i.source[a] = y.ABDataSource.Api) : i.rejected[a] = "no data"
}),
i.id.webId = r.$webId,
i.id.userId = r.$userId,
i.status = y.ABTestStatus.Finish,
i.serverCost = +r.$flagResponseTime,
i.ssrReqStatus = y.RequestStatus.success,
a.value = i,
i
}
, P = new (function() {
function VueInstance() {
(0,
f._)(this, VueInstance),
(0,
g._)(this, "app", void 0)
}
return (0,
v._)(VueInstance, [{
key: "initAbFlagReference",
value: function initAbFlagReference() {
this.app.config.abTestFlags = (0,
h.iH)(getDefaultValue())
}
}, {
key: "setInstance",
value: function setInstance(e) {
this.app = e,
this.initAbFlagReference()
}
}, {
key: "getInstance",
value: function getInstance() {
return this.app
}
}, {
key: "getAbFlagReference",
value: function getAbFlagReference() {
return this.app.config.abTestFlags
}
}]),
VueInstance
}());
function provideABConfigToApp_provideABConfigToApp(e, r) {
initDefaultABTestData(),
e.config.abTestResolve = function(r) {
return new Promise(function(i, a) {
if (e.config.abTestFlags.value.status === y.ABTestStatus.Finish) {
i(e.config.abTestFlags.value);
return
}
var s = null
, u = (0,
h.YP)(function() {
return e.config.abTestFlags.value.status
}, function(r) {
r === y.ABTestStatus.Finish && (u(),
null != s && clearTimeout(s),
i(e.config.abTestFlags.value))
}, {
immediate: !0
});
s = setTimeout(function() {
u(),
a(Error("timeout"))
}, r)
}
)
}
,
null == r.reportUserMapping && (r.reportUserMapping = !0),
e.provide(y.ABTEST_CFG_KEY, {
rootInstance: e,
config: r
})
}
i(41593);
var A = {
name: "ABPlugin",
install: function(e, r, i) {
P.setInstance(e.app),
provideABConfigToApp_provideABConfigToApp(e.app, i)
}
}
, useABTest = function(e, r) {
var i, a = (0,
h.f3)("abTest"), s = (0,
h.Fl)(function() {
var r, i, s, u;
return (null == a ? void 0 : null === (r = a.value) || void 0 === r ? void 0 : r.value) == null ? {} : null == e ? null !== (s = null == a ? void 0 : a.value.value) && void 0 !== s ? s : {} : null !== (u = null == a ? void 0 : null === (i = a.value.value) || void 0 === i ? void 0 : i[e]) && void 0 !== u ? u : {}
}), u = (0,
h.Fl)(function() {
var e;
return null == a ? void 0 : null === (e = a.value) || void 0 === e ? void 0 : e.status
}), c = (0,
h.qj)({
flags: s,
id: null == a ? void 0 : null === (i = a.value) || void 0 === i ? void 0 : i.id,
status: u
});
return (0,
h.YP)(u, function(e) {
if (e === y.ABTestStatus.Finish) {
var i;
null == r || null === (i = r.onFlagFetched) || void 0 === i || i.call(r, c)
}
}, {
immediate: !0
}),
c
};
i(7608),
i(19077);
var R = i(75649)
, I = i(80503)
, O = "1.1.2"
, trackABFlags = function(e) {
var r, i = [];
Object.keys(e.value).forEach(function(r) {
var a;
i.push.apply(i, (0,
R._)(Object.keys(null !== (a = e.value[r]) && void 0 !== a ? a : {})))
});
var a = {};
Object.keys(null !== (r = e.value) && void 0 !== r ? r : {}).forEach(function(r) {
var i;
Object.keys(null !== (i = e.value[r]) && void 0 !== i ? i : {}).forEach(function(i) {
a[i] = e.value[r][i]
})
}),
I.Z.sendCustomPoint({
measurement_name: "AbTestPluginMetrics",
measurement_data: {
abTestData: JSON.stringify(a),
diversions: JSON.stringify(e.diversions),
source: JSON.stringify(e.source),
version: O,
rejected: JSON.stringify(e.rejected),
ids: JSON.stringify(e.id),
csrReqStatus: e.csrReqStatus,
ssrReqStatus: e.ssrReqStatus,
flags: i.join(","),
serverCost: e.serverCost,
clientCost: e.clientCost
}
})
};
i(69032),
i(93354);
var getABTestDirective = function(e) {
var stop = function() {};
return {
created: function(r, i) {
var a, s = Object.keys(null !== (a = i.modifiers) && void 0 !== a ? a : {})[0], u = i.value, c = i.arg, l = Array.isArray(u), d = r.style.display;
if (null == s) {
console.error("必须填写修饰符");
return
}
var handle = function() {
var i, a, p, f, v, g, h = Object.keys(null !== (a = null === (i = e.value) || void 0 === i ? void 0 : i.value) && void 0 !== a ? a : {}), m = !1;
(m = null == c ? h.every(function(r) {
var i, a, c, d;
return l ? !u.includes(null === (a = e.value.value) || void 0 === a ? void 0 : null === (i = a[r]) || void 0 === i ? void 0 : i[s]) : (null === (d = e.value.value) || void 0 === d ? void 0 : null === (c = d[r]) || void 0 === c ? void 0 : c[s]) !== u
}) : l ? !u.includes(null === (f = e.value.value) || void 0 === f ? void 0 : null === (p = f[c]) || void 0 === p ? void 0 : p[s]) : (null === (g = e.value.value) || void 0 === g ? void 0 : null === (v = g[c]) || void 0 === v ? void 0 : v[s]) !== u) ? r.style.display = "none" : r.style.display = null != d ? d : ""
};
handle(),
stop = (0,
h.YP)(e.value.value, function() {
handle()
}, {
flush: "sync"
})
},
beforeUnmount: function() {
stop()
}
}
};
i(87989),
i(82427),
i(36062),
i(57057);
var N = i(73656)
, L = (null == N ? void 0 : null === (p = N.env) || void 0 === p ? void 0 : p.REGION) === "sg" ? "rednote.life" : "xiaohongshu.com"
, M = {
beta: "https://edith.beta.".concat(L, "/api/sns/web/racing_report"),
prod: "https://edith.".concat(L, "/api/sns/web/racing_report"),
sit: "https://edith.sit.".concat(L, "/api/sns/web/racing_report")
}
, B = "NEW_XHS_ABTEST_REPORT_KEY";
var x = (d = (0,
m._)(function(e, r) {
var i, a, s, u;
return (0,
_.Jh)(this, function(u) {
switch (u.label) {
case 0:
var c;
localStorage.removeItem("XHS_ABTEST_REPORT_KEY"),
i = localStorage.getItem(B),
a = e.racing_info.reduce(function(e, r) {
return e + (r.web_id || r.user_id || r.request_id)
}, "");
try {
if (i && JSON.parse(i)[a] === (0,
y.getDate)())
return [2]
} catch (e) {
console.error("report record parse error")
}
c = (0,
m._)(function() {
return (0,
_.Jh)(this, function(i) {
switch (i.label) {
case 0:
return [4, E.default.post(M[r], e)];
case 1:
return i.sent(),
localStorage.setItem(B, JSON.stringify((0,
g._)({}, a, (0,
y.getDate)()))),
[2]
}
})
}),
s = function report() {
return c.apply(this, arguments)
}
,
u.label = 1;
case 1:
return u.trys.push([1, 3, , 5]),
[4, s()];
case 2:
case 4:
return u.sent(),
[3, 5];
case 3:
return u.sent(),
[4, s()];
case 5:
return [2]
}
})
}),
function userReport(e, r) {
return d.apply(this, arguments)
}
)
, D = ["data-ab-flags"]
, F = "__XHS_AB_FLAGS__"
, V = (0,
h.aZ)({
__name: "ABWrapper",
setup: function(e) {
var r, i, a = (0,
h.f3)(y.ABTEST_CFG_KEY), s = initDefaultABTestData(), u = (0,
h.iH)("");
var c = (r = (0,
m._)(function(e) {
var r, i, u, c;
return (0,
_.Jh)(this, function(c) {
switch (c.label) {
case 0:
if ((r = s.value).id.webId = e,
["", "0"].includes(e))
return [2, r];
c.label = 1;
case 1:
return c.trys.push([1, 3, , 4]),
i = Date.now(),
[4, b(r, a.config.requests, a.config.env, a.config.useMesh)];
case 2:
return c.sent(),
u = Date.now(),
r.serverCost = u - i,
r.ssrReqStatus = y.RequestStatus.success,
[3, 4];
case 3:
return c.sent(),
r.ssrReqStatus = y.RequestStatus.failed,
[3, 4];
case 4:
return [2, r]
}
})
}),
function getRacingData(e) {
return r.apply(this, arguments)
}
);
(0,
h.vl)((0,
m._)(function() {
var e, r, i, l;
return (0,
_.Jh)(this, function(d) {
switch (d.label) {
case 0:
if (r = (e = (0,
h.Zq)()).abFlags)
return [3, 2];
return [4, c((0,
y.getWebIdFromCookie)((null === (l = e.headers) || void 0 === l ? void 0 : l.cookie) || ""))];
case 1:
return i = d.sent(),
[3, 3];
case 2:
i = handleABFlagsFromServer(a.config.requests, r),
d.label = 3;
case 3:
return (null == a ? void 0 : a.rootInstance) != null && (a.rootInstance.config.abTestFlags.value = i),
s.value = i,
u.value = JSON.stringify(i),
[2, i]
}
})
}));
var l = (i = (0,
m._)(function() {
var e, r, i, u;
return (0,
_.Jh)(this, function(i) {
switch (i.label) {
case 0:
try {
r = document.getElementById(F),
e = JSON.parse(r.getAttribute("data-ab-flags")),
(0,
h.bv)(function() {
r.remove()
})
} catch (e) {}
e && (s.value = e),
"" === s.value.id.webId && (s.value.id.webId = (0,
y.getWebIdFromCookie)(document.cookie)),
i.label = 1;
case 1:
return i.trys.push([1, 3, , 4]),
[4, k(a.config, s)];
case 2:
return i.sent(),
[3, 4];
case 3:
return i.sent(),
console.warn("clientDowngrade failed"),
[3, 4];
case 4:
if (s.value.status = y.ABTestStatus.Finish,
saveFlags(a.config, s),
trackABFlags(s.value),
!a.config.reportUserMapping)
return [3, 6];
return u = {},
[4, S(a.config.requests, s.value.id.webId)];
case 5:
x.apply(void 0, [(u.racing_info = i.sent(),
u.source = "web",
u.app = a.config.artifactName,
u), a.config.env]),
i.label = 6;
case 6:
return [2]
}
})
}),
function browserHandle() {
return i.apply(this, arguments)
}
);
return l(),
(0,
h.JJ)("abTest", a.rootInstance.config.abTestFlags),
a.rootInstance && (a.rootInstance.directive("ab", getABTestDirective(s)),
a.rootInstance.config.abTestFlags.value = s.value),
function(e, r) {
return (0,
h.wg)(),
(0,
h.iD)(h.HY, null, [(0,
h.WI)(e.$slots, "default"), (0,
h._)("div", {
id: F,
style: {
display: "none",
width: "0",
height: "0",
position: "absolute"
},
"data-ab-flags": u.value
}, null, 8, D)], 64)
}
}
})
, H = V
},
32399: function(e, r, i) {
"use strict";
i.d(r, {
ZP: function() {
return el
}
}),
i(58051);
var a, s, u, c = i(63522), l = i(51401);
i(36277),
i(34333),
i(74719),
i(13396),
i(91313),
i(27461),
i(23339),
i(51109),
i(41593),
i(86651),
i(80156),
i(50721),
i(29112),
i(67275),
i(59989),
i(7099),
i(1154),
i(80013),
i(97357),
i(87535),
i(75204),
i(19077),
i(75973),
i(7608),
i(87989),
i(9557),
i(55947),
i(34885),
i(21608),
i(6045),
i(10364),
i(67673);
var d = "webId"
, p = "websectiga"
, f = "sec_poison_id"
, v = "xsecappid"
, g = "loadts"
, h = ["/t.xiaohongshu.com", "/c.xiaohongshu.com", "spltest.xiaohongshu.com", "t2.xiaohongshu.com", "t2-test.xiaohongshu.com", "lng.xiaohongshu.com", "apm-track.xiaohongshu.com", "apm-track-test.xiaohongshu.com", "fse.xiaohongshu.com", "fse.devops.xiaohongshu.com", "fesentry.xiaohongshu.com", "spider-tracker.xiaohongshu.com"]
, m = ["/privacy", "/privacy/teenager"]
, _ = "/api/sec/v1/scripting"
, y = "/api/sec/v1/sbtsource"
, w = "sdt_source_storage_key"
, E = "last_tiga_update_time"
, S = "sign_lack_info"
, T = ["fe_api/burdock/v2/user/keyInfo", "fe_api/burdock/v2/shield/profile", "fe_api/burdock/v2/shield/captcha", "fe_api/burdock/v2/shield/registerCanvas", "api/sec/v1/shield/webprofile", "api/sec/v1/shield/captcha", /fe_api\/burdock\/v2\/note\/[0-9a-zA-Z]+\/tags/, /fe_api\/burdock\/v2\/note\/[0-9a-zA-Z]+\/image_stickers/, /fe_api\/burdock\/v2\/note\/[0-9a-zA-Z]+\/other\/notes/, /fe_api\/burdock\/v2\/note\/[0-9a-zA-Z]+\/related/, "/fe_api/burdock/v2/note/post", "/api/sns/web", "/api/redcaptcha", "/api/store/jpd/main"]
, b = {
300011: "检测到帐号异常,请稍后重试",
300012: "网络连接异常,请检查网络设置后重试",
300013: "访问频次异常,请勿频繁操作",
300015: "浏览器异常,请尝试更换浏览器后重试"
}
, k = []
, C = "4.1.0";
i(43648),
i(72169),
i(58486);
for (var P = [], A = "ZmserbBoHQtNP+wOcza/LpngG8yJq42KWYj0DSfdikx3VT16IlUAFM97hECvuRX5", R = 0, I = A.length; R < I; ++R)
P[R] = A[R];
var encrypt_crc32 = function crc32(e) {
for (var r, i = [], a = 0; a < 256; a++) {
r = a;
for (var s = 0; s < 8; s++)
r = 1 & r ? 0xedb88320 ^ r >>> 1 : r >>> 1;
i[a] = r
}
for (var u = -1, c = 0; c < e.length; c++)
u = u >>> 8 ^ i[255 & (u ^ e.charCodeAt(c))];
return (-1 ^ u) >>> 0
};
function tripletToBase64(e) {
return P[e >> 18 & 63] + P[e >> 12 & 63] + P[e >> 6 & 63] + P[63 & e]
}
function encodeChunk(e, r, i) {
for (var a, s = [], u = r; u < i; u += 3)
a = (e[u] << 16 & 0xff0000) + (e[u + 1] << 8 & 65280) + (255 & e[u + 2]),
s.push(tripletToBase64(a));
return s.join("")
}
function encodeUtf8(e) {
for (var r = encodeURIComponent(e), i = [], a = 0; a < r.length; a++) {
var s = r.charAt(a);
if ("%" === s) {
var u = parseInt(r.charAt(a + 1) + r.charAt(a + 2), 16);
i.push(u),
a += 2
} else
i.push(s.charCodeAt(0))
}
return i
}
function b64Encode(e) {
for (var r, i = e.length, a = i % 3, s = [], u = 0, c = i - a; u < c; u += 16383)
s.push(encodeChunk(e, u, u + 16383 > c ? c : u + 16383));
return 1 === a ? (r = e[i - 1],
s.push(P[r >> 2] + P[r << 4 & 63] + "==")) : 2 === a && (r = (e[i - 2] << 8) + e[i - 1],
s.push(P[r >> 10] + P[r >> 4 & 63] + P[r << 2 & 63] + "=")),
s.join("")
}
var O = function(e) {
for (var r, i, a = 256, s = []; a--; s[a] = r >>> 0)
for (i = 8,
r = a; i--; )
r = 1 & r ? r >>> 1 ^ 0xedb88320 : r >>> 1;
return function(e) {
if ("string" == typeof e) {
for (var r = 0, i = -1; r < e.length; ++r)
i = s[255 & i ^ e.charCodeAt(r)] ^ i >>> 8;
return -1 ^ i ^ 0xedb88320
}
for (var r = 0, i = -1; r < e.length; ++r)
i = s[255 & i ^ e[r]] ^ i >>> 8;
return -1 ^ i ^ 0xedb88320
}
}()
, N = function(e) {
function n(i) {
if (r[i])
return r[i].exports;
var a = r[i] = {
i: i,
l: !1,
exports: {}
};
return e[i].call(a.exports, a, a.exports, n),
a.l = !0,
a.exports
}
var r = {};
return n.m = e,
n.c = r,
n.i = function(e) {
return e
}
,
n.d = function(e, r, i) {
n.o(e, r) || Object.defineProperty(e, r, {
configurable: !1,
enumerable: !0,
get: i
})
}
,
n.n = function(e) {
var r = e && e.__esModule ? function t() {
return e.default
}
: function() {
return e
}
;
return n.d(r, "a", r),
r
}
,
n.o = function(e, r) {
return Object.prototype.hasOwnProperty.call(e, r)
}
,
n.p = "",
n(n.s = 4)
}([function(e, r) {
var i = {
utf8: {
stringToBytes: function stringToBytes(e) {
return i.bin.stringToBytes(unescape(encodeURIComponent(e)))
},
bytesToString: function bytesToString(e) {
return decodeURIComponent(escape(i.bin.bytesToString(e)))
}
},
bin: {
stringToBytes: function stringToBytes(e) {
for (var r = [], i = 0; i < e.length; i++)
r.push(255 & e.charCodeAt(i));
return r
},
bytesToString: function bytesToString(e) {
for (var r = [], i = 0; i < e.length; i++)
r.push(String.fromCharCode(e[i]));
return r.join("")
}
}
};
e.exports = i
}
, function(e, r, i) {
var a, s, u, c, l;
a = i(2),
s = i(0).utf8,
u = i(3),
c = i(0).bin,
(l = function i1(e, r) {
e.constructor == String ? e = r && "binary" === r.encoding ? c.stringToBytes(e) : s.stringToBytes(e) : u(e) ? e = Array.prototype.slice.call(e, 0) : Array.isArray(e) || (e = e.toString());
for (var i = a.bytesToWords(e), d = 8 * e.length, p = 0x67452301, f = -0x10325477, v = -0x67452302, g = 0x10325476, h = 0; h < i.length; h++)
i[h] = 0xff00ff & (i[h] << 8 | i[h] >>> 24) | 0xff00ff00 & (i[h] << 24 | i[h] >>> 8);
i[d >>> 5] |= 128 << d % 32,
i[14 + (d + 64 >>> 9 << 4)] = d;
for (var m = l._ff, _ = l._gg, y = l._hh, w = l._ii, h = 0; h < i.length; h += 16) {
var E = p
, S = f
, T = v
, b = g;
p = m(p, f, v, g, i[h + 0], 7, -0x28955b88),
g = m(g, p, f, v, i[h + 1], 12, -0x173848aa),
v = m(v, g, p, f, i[h + 2], 17, 0x242070db),
f = m(f, v, g, p, i[h + 3], 22, -0x3e423112),
p = m(p, f, v, g, i[h + 4], 7, -0xa83f051),
g = m(g, p, f, v, i[h + 5], 12, 0x4787c62a),
v = m(v, g, p, f, i[h + 6], 17, -0x57cfb9ed),
f = m(f, v, g, p, i[h + 7], 22, -0x2b96aff),
p = m(p, f, v, g, i[h + 8], 7, 0x698098d8),
g = m(g, p, f, v, i[h + 9], 12, -0x74bb0851),
v = m(v, g, p, f, i[h + 10], 17, -42063),
f = m(f, v, g, p, i[h + 11], 22, -0x76a32842),
p = m(p, f, v, g, i[h + 12], 7, 0x6b901122),
g = m(g, p, f, v, i[h + 13], 12, -0x2678e6d),
v = m(v, g, p, f, i[h + 14], 17, -0x5986bc72),
f = m(f, v, g, p, i[h + 15], 22, 0x49b40821),
p = _(p, f, v, g, i[h + 1], 5, -0x9e1da9e),
g = _(g, p, f, v, i[h + 6], 9, -0x3fbf4cc0),
v = _(v, g, p, f, i[h + 11], 14, 0x265e5a51),
f = _(f, v, g, p, i[h + 0], 20, -0x16493856),
p = _(p, f, v, g, i[h + 5], 5, -0x29d0efa3),
g = _(g, p, f, v, i[h + 10], 9, 0x2441453),
v = _(v, g, p, f, i[h + 15], 14, -0x275e197f),
f = _(f, v, g, p, i[h + 4], 20, -0x182c0438),
p = _(p, f, v, g, i[h + 9], 5, 0x21e1cde6),
g = _(g, p, f, v, i[h + 14], 9, -0x3cc8f82a),
v = _(v, g, p, f, i[h + 3], 14, -0xb2af279),
f = _(f, v, g, p, i[h + 8], 20, 0x455a14ed),
p = _(p, f, v, g, i[h + 13], 5, -0x561c16fb),
g = _(g, p, f, v, i[h + 2], 9, -0x3105c08),
v = _(v, g, p, f, i[h + 7], 14, 0x676f02d9),
f = _(f, v, g, p, i[h + 12], 20, -0x72d5b376),
p = y(p, f, v, g, i[h + 5], 4, -378558),
g = y(g, p, f, v, i[h + 8], 11, -0x788e097f),
v = y(v, g, p, f, i[h + 11], 16, 0x6d9d6122),
f = y(f, v, g, p, i[h + 14], 23, -0x21ac7f4),
p = y(p, f, v, g, i[h + 1], 4, -0x5b4115bc),
g = y(g, p, f, v, i[h + 4], 11, 0x4bdecfa9),
v = y(v, g, p, f, i[h + 7], 16, -0x944b4a0),
f = y(f, v, g, p, i[h + 10], 23, -0x41404390),
p = y(p, f, v, g, i[h + 13], 4, 0x289b7ec6),
g = y(g, p, f, v, i[h + 0], 11, -0x155ed806),
v = y(v, g, p, f, i[h + 3], 16, -0x2b10cf7b),
f = y(f, v, g, p, i[h + 6], 23, 0x4881d05),
p = y(p, f, v, g, i[h + 9], 4, -0x262b2fc7),
g = y(g, p, f, v, i[h + 12], 11, -0x1924661b),
v = y(v, g, p, f, i[h + 15], 16, 0x1fa27cf8),
f = y(f, v, g, p, i[h + 2], 23, -0x3b53a99b),
p = w(p, f, v, g, i[h + 0], 6, -0xbd6ddbc),
g = w(g, p, f, v, i[h + 7], 10, 0x432aff97),
v = w(v, g, p, f, i[h + 14], 15, -0x546bdc59),
f = w(f, v, g, p, i[h + 5], 21, -0x36c5fc7),
p = w(p, f, v, g, i[h + 12], 6, 0x655b59c3),
g = w(g, p, f, v, i[h + 3], 10, -0x70f3336e),
v = w(v, g, p, f, i[h + 10], 15, -1051523),
f = w(f, v, g, p, i[h + 1], 21, -0x7a7ba22f),
p = w(p, f, v, g, i[h + 8], 6, 0x6fa87e4f),
g = w(g, p, f, v, i[h + 15], 10, -0x1d31920),
v = w(v, g, p, f, i[h + 6], 15, -0x5cfebcec),
f = w(f, v, g, p, i[h + 13], 21, 0x4e0811a1),
p = w(p, f, v, g, i[h + 4], 6, -0x8ac817e),
g = w(g, p, f, v, i[h + 11], 10, -0x42c50dcb),
v = w(v, g, p, f, i[h + 2], 15, 0x2ad7d2bb),
f = w(f, v, g, p, i[h + 9], 21, -0x14792c6f),
p = p + E >>> 0,
f = f + S >>> 0,
v = v + T >>> 0,
g = g + b >>> 0
}
return a.endian([p, f, v, g])
}
)._ff = function(e, r, i, a, s, u, c) {
var l = e + (r & i | ~r & a) + (s >>> 0) + c;
return (l << u | l >>> 32 - u) + r
}
,
l._gg = function(e, r, i, a, s, u, c) {
var l = e + (r & a | i & ~a) + (s >>> 0) + c;
return (l << u | l >>> 32 - u) + r
}
,
l._hh = function(e, r, i, a, s, u, c) {
var l = e + (r ^ i ^ a) + (s >>> 0) + c;
return (l << u | l >>> 32 - u) + r
}
,
l._ii = function(e, r, i, a, s, u, c) {
var l = e + (i ^ (r | ~a)) + (s >>> 0) + c;
return (l << u | l >>> 32 - u) + r
}
,
l._blocksize = 16,
l._digestsize = 16,
e.exports = function(e, r) {
if (null == e)
throw Error("Illegal argument " + e);
var i = a.wordsToBytes(l(e, r));
return r && r.asBytes ? i : r && r.asString ? c.bytesToString(i) : a.bytesToHex(i)
}
}
, function(e, r) {
var i, a;
i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
a = {
rotl: function rotl(e, r) {
return e << r | e >>> 32 - r
},
rotr: function rotr(e, r) {
return e << 32 - r | e >>> r
},
endian: function endian(e) {
if (e.constructor == Number)
return 0xff00ff & a.rotl(e, 8) | 0xff00ff00 & a.rotl(e, 24);
for (var r = 0; r < e.length; r++)
e[r] = a.endian(e[r]);
return e
},
randomBytes: function randomBytes(e) {
for (var r = []; e > 0; e--)
r.push(Math.floor(256 * Math.random()));
return r
},
bytesToWords: function bytesToWords(e) {
for (var r = [], i = 0, a = 0; i < e.length; i++,
a += 8)
r[a >>> 5] |= e[i] << 24 - a % 32;
return r
},
wordsToBytes: function wordsToBytes(e) {
for (var r = [], i = 0; i < 32 * e.length; i += 8)
r.push(e[i >>> 5] >>> 24 - i % 32 & 255);
return r
},
bytesToHex: function bytesToHex(e) {
for (var r = [], i = 0; i < e.length; i++)
r.push((e[i] >>> 4).toString(16)),
r.push((15 & e[i]).toString(16));
return r.join("")
},
hexToBytes: function hexToBytes(e) {
for (var r = [], i = 0; i < e.length; i += 2)
r.push(parseInt(e.substr(i, 2), 16));
return r
},
bytesToBase64: function bytesToBase64(e) {
for (var r = [], a = 0; a < e.length; a += 3)
for (var s = e[a] << 16 | e[a + 1] << 8 | e[a + 2], u = 0; u < 4; u++)
8 * a + 6 * u <= 8 * e.length ? r.push(i.charAt(s >>> 6 * (3 - u) & 63)) : r.push("=");
return r.join("")
},
base64ToBytes: function base64ToBytes(e) {
e = e.replace(/[^A-Z0-9+\/]/gi, "");
for (var r = [], a = 0, s = 0; a < e.length; s = ++a % 4)
0 != s && r.push((i.indexOf(e.charAt(a - 1)) & Math.pow(2, -2 * s + 8) - 1) << 2 * s | i.indexOf(e.charAt(a)) >>> 6 - 2 * s);
return r
}
},
e.exports = a
}
, function(e, r) {
function t(e) {
return !!e.constructor && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e)
}
function o(e) {
return "function" == typeof e.readFloatLE && "function" == typeof e.slice && t(e.slice(0, 0))
}
e.exports = function(e) {
return null != e && (t(e) || o(e) || !!e._isBuffer)
}
}
, function(e, r, i) {
e.exports = i(1)
}
]);
function encrypt_sign(e, r) {
var _utf8_encode = function _utf8_encode(e) {
e = e.replace(/\r\n/g, "\n");
for (var r = "", i = 0; i < e.length; i++) {
var a = e.charCodeAt(i);
a < 128 ? r += String.fromCharCode(a) : (a > 127 && a < 2048 ? r += String.fromCharCode(a >> 6 | 192) : (r += String.fromCharCode(a >> 12 | 224),
r += String.fromCharCode(a >> 6 & 63 | 128)),
r += String.fromCharCode(63 & a | 128))
}
return r
}
, a = "A4NjFqYu5wPHsO0XTdDgMa2r1ZQocVte9UJBvk6/7=yRnhISGKblCWi+LpfE8xzm3"
, s = "iamspam"
, u = new Date().getTime()
, c = "undefined" == typeof window ? i.g : window;
return void 0 !== c && c && c.navigator && c.navigator.userAgent && c.alert && (s = "test"),
{
"X-s": function encode(e) {
var r, i, s, u, c, l, d, p = "", f = 0;
for (e = _utf8_encode(e); f < e.length; )
r = e.charCodeAt(f++),
i = e.charCodeAt(f++),
s = e.charCodeAt(f++),
u = r >> 2,
c = (3 & r) << 4 | i >> 4,
l = (15 & i) << 2 | s >> 6,
d = 63 & s,
isNaN(i) ? l = d = 64 : isNaN(s) && (d = 64),
p = p + a.charAt(u) + a.charAt(c) + a.charAt(l) + a.charAt(d);
return p
}(N([u, s, e, "[object Object]" === Object.prototype.toString.call(r) || "[object Array]" === Object.prototype.toString.call(r) ? JSON.stringify(r) : ""].join(""))),
"X-t": u
}
}
var __awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, __generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
};
function isTestHost(e) {
return !!(e.indexOf("0.0.0.0") >= 0) || ["sit.xiaohongshu.com", "local.xiaohongshu.com", "test.xiaohongshu.com"].some(function(r) {
return e.indexOf(r) >= 0
})
}
function isStaging(e) {
return e.indexOf("beta.") >= 0
}
function utils_getHost() {
var e = "//as.xiaohongshu.com"
, r = window.location.host;
return isTestHost(r) && (e = "//as.sit.xiaohongshu.com"),
isStaging(r) && (e = "//as.beta.xiaohongshu.com"),
e
}
function getRedHost() {
var e = "//edith.xiaohongshu.com"
, r = window.location.host;
return isTestHost(r) && (e = "//edith.sit.xiaohongshu.com"),
isStaging(r) && (e = "//edith.beta.xiaohongshu.com"),
e
}
function getErrorPageHost() {
var e = "https://www.xiaohongshu.com"
, r = window.location.host;
return isTestHost(r) && (e = "http://www.sit.xiaohongshu.com"),
isStaging(r) && (e = "https://www.beta.xiaohongshu.com"),
e
}
function genRandomString(e) {
return Array(e).fill(void 0).map(function() {
return "abcdefghijklmnopqrstuvwxyz1234567890"[Math.floor(36 * Math.random())]
}).join("")
}
function getPlatformCode(e) {
switch (e) {
case "Android":
return s.Android;
case "iOS":
return s.iOS;
case "Mac OS":
return s.MacOs;
case "Linux":
return s.Linux;
default:
return s.other
}
}
function getFullURIFromContext(e) {
var r = (null == e ? void 0 : e.request) || {}
, i = r.header
, a = r.url
, s = i || {}
, u = s.referer
, c = s.host;
return u || "http://".concat(c).concat(a)
}
function clientRedirect(e) {
window.location.href = e,
setTimeout(function() {
window.location.href = e
}, 100),
setTimeout(function() {
window.location.href = e
}, 400)
}
function retry(e, r, i, a) {
return __awaiter(this, void 0, void 0, function() {
var s, u;
return __generator(this, function(c) {
switch (c.label) {
case 0:
s = i,
u = null,
c.label = 1;
case 1:
if (!(s >= 0))
return [3, 7];
c.label = 2;
case 2:
return c.trys.push([2, 4, , 5]),
[4, e(r)];
case 3:
return [2, c.sent()];
case 4:
return u = c.sent(),
[3, 5];
case 5:
return [4, sleep(1e3 * a)];
case 6:
return c.sent(),
s--,
[3, 1];
case 7:
throw null == u ? u : Error("retry ".concat(e.name, " fail and count is ").concat(i))
}
})
})
}
function sleep(e) {
return new Promise(function(r, i) {
setTimeout(r, e)
}
)
}
function utils_shouldSign(e) {
var r = !0;
return e.indexOf(window.location.host) > -1 || e.indexOf("sit.xiaohongshu.com") > -1 ? r : (h.some(function(i) {
if (e.indexOf(i) > -1)
return r = !1,
!0
}),
r)
}
(a = s || (s = {}))[a.Windows = 0] = "Windows",
a[a.iOS = 1] = "iOS",
a[a.Android = 2] = "Android",
a[a.MacOs = 3] = "MacOs",
a[a.Linux = 4] = "Linux",
a[a.other = 5] = "other";
var utils_SignReload = function SignReload() {
this.count = 1,
this.time = +new Date
};
function shouldSignReload() {
try {
var e = +new Date
, r = JSON.stringify(localStorage.getItem(S) || {})
, i = !!(r && r.count)
, a = r && r.time && e - r.time < 36e5;
if (!(i && a)) {
var s = new utils_SignReload;
return localStorage.setItem(S, JSON.stringify(s)),
!0
}
if (r.count > 3)
return !1;
return r.count = r.count + 1,
localStorage.setItem(S, JSON.stringify(r)),
!0
} catch (e) {
return !1
}
}
function loadScript(e, r) {
return __awaiter(this, void 0, void 0, function() {
return __generator(this, function(i) {
return void 0 === e ? [2] : [2, new Promise(function(i, a) {
var s = document.createElement("script");
s.src = e,
s.type = "text/javascript",
s.crossOrigin = "anonymous",
s.dataset.formulaAsset = "1",
s.dataset.formulaCdnRetry = "1",
document.body.appendChild(s),
s.onload = function() {
null == r || r(),
i()
}
}
)]
})
})
}
var utils_TriggerLogRequest = function TriggerLogRequest(e, r, i, a, s) {
this.url = e || "un",
this.verifyBiz = r || "un",
this.verifyUuid = i || "un",
this.verifyType = a || "un",
this.repeatVerify = s || !1
};
function triggerLog(e, r) {
var i = Cookies.get("gid")
, a = Cookies.get(d);
try {
var s = {
url: e.url,
verify_biz: e.verifyBiz,
verify_uuid: e.verifyUuid,
verify_type: e.verifyType,
repeat_verify: e.repeatVerify,
webId: a || "",
gid: i || "",
timestamp: +new Date,
extra_source: r || ""
}
, u = {
measurement_name: "infra_sec_spam_walify",
measurement_data: s
};
window.insight ? window.insight.sendCustomPoint(u) : window.eaglet && window.eaglet.push(u, "ApmXrayTracker")
} catch (e) {}
}
function generateLocalId(e) {
var r = getPlatformCode(e)
, i = "".concat((+new Date).toString(16)).concat(genRandomString(30)).concat(r).concat("0").concat("000")
, a = encrypt_crc32(i);
return "".concat(i).concat(a).substring(0, 52)
}
var L = i(65266)
, log_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, log_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
};
function wrapperLog(e, r) {
return function(i) {
return log_awaiter(this, void 0, void 0, function() {
var a, s, u, c;
return log_generator(this, function(l) {
switch (l.label) {
case 0:
a = +new Date,
l.label = 1;
case 1:
return l.trys.push([1, 3, , 4]),
[4, r(i)];
case 2:
return s = l.sent(),
logSecInfo("", e, u = +new Date - a, "true"),
[2, s];
case 3:
throw c = l.sent(),
u = +new Date - a,
logSecInfo(JSON.stringify(c), e, u, "false"),
c;
case 4:
return [2]
}
})
})
}
}
function logSecInfo(e, r, i, a) {
try {
var s = {
measurement_name: "infra_sec_web_api_walify",
measurement_data: {
error_info: "",
api_name: r,
timecost: i,
is_success: a || ""
}
};
window.insight ? window.insight.sendCustomPoint(s) : window.eaglet && window.eaglet.push(s, "ApmXrayTracker")
} catch (e) {}
}
function logSec(e) {
if (!(Math.random() > .01))
try {
var r = {
measurement_name: e.name,
measurement_data: e.data
};
window.insight ? window.insight.sendCustomPoint(r) : window.eaglet && window.eaglet.push(r, "ApmXrayTracker")
} catch (e) {}
}
var token_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, token_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
}
, M = wrapperLog(_, getScripting)
, B = wrapperLog("scriptingEval", eval);
function tokenCheck(e) {
return token_awaiter(this, void 0, void 0, function() {
return token_generator(this, function(r) {
switch (r.label) {
case 0:
return [4, updateSign(e)];
case 1:
return r.sent(),
[2]
}
})
})
}
function updateSign(e) {
return token_awaiter(this, void 0, void 0, function() {
var r, i, a, s, u, c, d, v;
return token_generator(this, function(v) {
switch (v.label) {
case 0:
if (r = 6e4,
i = e.isHidden,
a = e.callFrom,
s = token_shouldUpdate(),
!("visible" === i && s))
return [3, 5];
v.label = 1;
case 1:
return v.trys.push([1, 3, , 4]),
u = "seccallback",
c = "",
window[u] = function(e) {
l.Z.set(p, e, {
domain: "xiaohongshu.com",
expires: 3
}),
l.Z.set(f, c, {
domain: "xiaohongshu.com",
expires: .007
}),
l.Z.set(p, e, {
domain: "xiaohongshu.hk",
expires: 3
}),
l.Z.set(f, c, {
domain: "xiaohongshu.hk",
expires: .007
})
}
,
[4, retry(M, {
callFrom: a,
callback: u
}, 2, 60)];
case 2:
return c = (d = v.sent()).secPoisonId,
B(d.data),
delete window[u],
updateTokenTs(),
[3, 4];
case 3:
return v.sent(),
[3, 4];
case 4:
return setTimeout(function() {
return updateSign(e)
}, 5 * r),
[3, 6];
case 5:
setTimeout(function() {
return updateSign(e)
}, r / 12),
v.label = 6;
case 6:
return [2]
}
})
})
}
function getScripting(e) {
return token_awaiter(this, void 0, void 0, function() {
var r;
return token_generator(this, function(i) {
switch (i.label) {
case 0:
return [4, L.ZP.http.post("".concat(utils_getHost()).concat(_), e, {
withCredentials: !0,
transform: !1
})];
case 1:
if ((r = i.sent()).data && r.data.length > 0)
return [2, r];
throw Error("get scripting length is 0")
}
})
})
}
function updateHidden(e) {
e.isHidden = "visible",
document.addEventListener("visibilitychange", function() {
e.isHidden = document.visibilityState
}),
document.addEventListener("pagehide", function() {
e.isHidden = "hidden"
})
}
function updateTokenTs() {
localStorage.setItem(E, new Date().getTime())
}
function token_shouldUpdate() {
var e = Number(localStorage.getItem(E) || 0)
, r = new Date().getTime();
return r - e >= 3e5
}
var reportBroswerInfo_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, reportBroswerInfo_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
}
, x = wrapperLog(y, ConfigHttp);
function reportBroswerInfo(e, r) {
var i;
return reportBroswerInfo_awaiter(this, void 0, void 0, function() {
var a, s, u;
return reportBroswerInfo_generator(this, function(c) {
switch (c.label) {
case 0:
if (l.Z.set(v, e.appId, {
domain: "xiaohongshu.com",
expires: 365
}),
l.Z.set(v, e.appId, {
domain: "xiaohongshu.hk",
expires: 365
}),
a = (i = new URL(window.location.href),
i.pathname),
m.some(function(e) {
return e === a
}))
return [2];
return [4, loadFpConfig(e)];
case 1:
if (void 0 == (s = c.sent()))
return [2];
return pushXsCommon(s.commonPatch),
pushRealTimeXsCommon(s.realTimeCommonPatch),
tokenCheck(e),
u = !1,
[4, loadSrc(e, s)];
case 2:
return c.sent(),
e.onReadyToLoadJS ? (e.onReadyToLoadJS(function() {
startLoading(e, s, r),
u = !0
}),
setTimeout(function() {
!u && startLoading(e, s, r)
}, e.loadTimeout || 4e3)) : startLoading(e, s, r),
[2]
}
})
})
}
function startLoading(e, r, i) {
return reportBroswerInfo_awaiter(this, void 0, void 0, function() {
return reportBroswerInfo_generator(this, function(a) {
switch (a.label) {
case 0:
return [4, loadSrc(e, r)];
case 1:
return a.sent(),
report(e, r, i),
[2]
}
})
})
}
function pushXsCommon(e) {
try {
(e && Array.isArray(e) && e.length > 0 ? e : ["api/sec/v1/shield/webprofile"]).forEach(function(e) {
T.push(e)
})
} catch (e) {}
}
function pushRealTimeXsCommon(e) {
try {
(e && Array.isArray(e) && e.length > 0 ? e : []).forEach(function(e) {
k.push(e)
})
} catch (e) {}
}
function loadFpConfig(e) {
return reportBroswerInfo_awaiter(this, void 0, void 0, function() {
var r, i, a, s;
return reportBroswerInfo_generator(this, function(a) {
switch (a.label) {
case 0:
r = {
callFrom: e.callFrom
},
a.label = 1;
case 1:
return a.trys.push([1, 3, , 8]),
[4, x(r)];
case 2:
i = a.sent();
try {
i && i.extraInfo && (i.extraInfo = JSON.parse(i.extraInfo))
} catch (e) {}
return localStorage.setItem(w, JSON.stringify(i)),
[2, i];
case 3:
if (a.sent(),
i = getLocalConfig())
return [2, i];
a.label = 4;
case 4:
return a.trys.push([4, 6, , 7]),
[4, retry(x, r, 2, 1)];
case 5:
return [2, a.sent()];
case 6:
return a.sent(),
[3, 7];
case 7:
return [3, 8];
case 8:
return [2]
}
})
})
}
function getLocalConfig() {
var e;
try {
var r = null !== (e = localStorage.getItem(w)) && void 0 !== e ? e : "{}"
, i = JSON.parse(r);
if (i.url && i.reportUrl && i.desVersion)
return i
} catch (e) {}
return null
}
function ConfigHttp(e) {
return L.ZP.http.post("".concat(utils_getHost()).concat(y), e, {
withCredentials: !0,
transform: !1
})
}
function loadSrc(e, r) {
var i, a;
return reportBroswerInfo_awaiter(this, void 0, void 0, function() {
var s, u;
return reportBroswerInfo_generator(this, function(c) {
(null === (i = r.extraInfo) || void 0 === i ? void 0 : i.mnsTokenUrl) && loadScript(null === (a = r.extraInfo) || void 0 === a ? void 0 : a.mnsTokenUrl, function() {}),
loadScript(r.xhsTokenUrl, function() {});
try {
s = 0;
(u = function() {
var i = document.createElement("script");
i.src = r.signUrl,
i.type = "text/javascript",
i.crossOrigin = "anonymous",
i.dataset.formulaAsset = "1",
i.dataset.formulaCdnRetry = "1",
i.onerror = function() {
++s < 3 && (document.body.removeChild(i),
u()),
logSec({
name: "anti_spam_js_fail",
data: {
url: null == r ? void 0 : r.signUrl,
type: "sign"
}
})
}
,
i.onload = function() {
e.configInit = !0
}
,
document.body.appendChild(i)
}
)()
} catch (e) {}
return [2, new Promise(function(e) {
var i = document.createElement("script");
i.src = r.url,
i.type = "text/javascript",
i.crossOrigin = "anonymous",
i.dataset.formulaAsset = "1",
i.dataset.formulaCdnRetry = "1",
i.onload = function() {
e()
}
,
document.body.appendChild(i)
}
)]
})
})
}
function report(e, r, i) {
return reportBroswerInfo_awaiter(this, void 0, void 0, function() {
return reportBroswerInfo_generator(this, function(a) {
return setTimeout(function() {
var a, s, u = (null === (a = window.xhsFingerprintV3) || void 0 === a ? void 0 : a.VERSION) || C, c = getGid.bind(null, i);
null === (s = window.xhsFingerprintV3) || void 0 === s || s.getV18(function() {
for (var i = [], a = 0; a < arguments.length; a++)
i[a] = arguments[a];
return reportBroswerInfo_awaiter(this, void 0, void 0, function() {
var a, s;
return reportBroswerInfo_generator(this, function(l) {
switch (l.label) {
case 0:
a = 2 == i.length ? i[1] : i[0],
s = {
platform: e.platform || "PC",
sdkVersion: u,
svn: r.desVersion,
profileData: a,
reportUrl: r.reportUrl
},
l.label = 1;
case 1:
return l.trys.push([1, 3, , 4]),
[4, retry(c, s, 2, 2)];
case 2:
return l.sent(),
updateProfileCount(),
[3, 4];
case 3:
return console.log("profile error", l.sent()),
[3, 4];
case 4:
return [2]
}
})
})
})
}, 600),
[2]
})
})
}
function getGid(e, r) {
return reportBroswerInfo_awaiter(this, void 0, void 0, function() {
var i, a, s, u;
return reportBroswerInfo_generator(this, function(c) {
switch (c.label) {
case 0:
return i = utils_getHost(),
a = r.reportUrl,
s = Object.assign({}, r),
delete s.reportUrl,
[4, e.http.post("".concat(i).concat(a), s, {
baseURL: i,
withCredentials: !0,
transform: !1,
extractData: !1
})];
case 1:
if (0 !== (u = c.sent()).code || !u.success)
throw Error(JSON.stringify(u));
return [2]
}
})
})
}
function updateProfileCount() {
var e = ((Number(localStorage.getItem("p1")) || 0) + 1).toString();
localStorage.setItem("p1", e)
}
i(25069);
var riskHandler_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, riskHandler_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
}
, riskHandler_RiskErrorRes = function RiskErrorRes() {
this.errorCode = "",
this.shouldRedirect = !1
};
function riskHandler(e, r) {
return riskHandler_awaiter(this, void 0, void 0, function() {
var i, a, s, u, l, d;
return riskHandler_generator(this, function(p) {
if (i = !L.ZP.isBrowser,
c.YF.isXHS || !r)
return [2, r];
try {
if (!(a = handlerRiskError(r)).shouldRedirect)
return [2, r];
s = i ? e.context.ssrContext : {},
u = i ? s.redirect : clientRedirect,
l = i ? getFullURIFromContext(s) : window.location.href,
d = getErrorUrl(l, a.errorCode),
u(d)
} catch (e) {}
return [2, r]
})
})
}
function handlerRiskError(e) {
var r = new riskHandler_RiskErrorRes
, i = e.status
, a = e.data
, s = void 0 === a ? {} : a
, u = s.code
, c = s.result
, l = (u || c || "undefined").toString();
return 200 === i && b.hasOwnProperty(l) ? (r.shouldRedirect = !0,
r.errorCode = l,
r) : r
}
function getErrorUrl(e, r) {
var i = b[r];
return "https://www.xiaohongshu.com/website-login/error?redirectPath=".concat(e, "&error_code=").concat(r, "&error_msg=").concat(i)
}
i(109),
i(54060),
i(20266);
var signAdaptor_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, signAdaptor_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
};
function signAdaptor(e, r) {
var i;
return signAdaptor_awaiter(this, void 0, void 0, function() {
var a, s;
return signAdaptor_generator(this, function(u) {
return a = Date.now(),
"function" == typeof e.shouldSign ? (s = e.shouldSign(r)) && xhsSign(e, r) : xhsSign(e, r),
"function" == typeof e.shouldFp ? (s = e.shouldFp(r)) && xsCommon(e, r) : xsCommon(e, r),
"function" == typeof e.shouldToken ? (s = e.shouldToken(r)) && xhsToken(e, r) : xhsToken(e, r),
logSec({
name: "anti_spam_sign_cost",
data: {
cost: Date.now() - a,
type: (null == window ? void 0 : window._webmsxyw) ? "sign_new" : "sign_old",
source: null !== (i = null == r ? void 0 : r.url) && void 0 !== i ? i : window.location.href
}
}),
[2, r]
})
})
}
function xhsSign(e, r) {
var i = r.url
, a = r.params
, s = r.paramsSerializer
, u = r.data
, c = e.configInit
, l = e.xsIgnore
, d = e.autoReload;
if (!(!l.some(function(e) {
return i.indexOf(e) >= 0
}) && utils_shouldSign(i)))
return r;
d && signLackReload();
try {
var p = getRealUrl(i, a, s)
, f = encrypt_sign;
c && void 0 !== window._webmsxyw && (f = window._webmsxyw);
var v = f(p, u) || {};
r.headers["X-t"] = v["X-t"],
r.headers["X-s"] = v["X-s"]
} catch (e) {}
if (!0 !== e.disableMns)
try {
if (window.mns) {
var p = getRealUrl(i, a, s)
, g = "[object Object]" === Object.prototype.toString.call(u) || "[object Array]" === Object.prototype.toString.call(u)
, h = N([p, g ? JSON.stringify(u) : ""].join(""));
r.headers["X-Mns"] = window.mns.getMnsToken(p, u, h) || ""
} else
r.headers["X-Mns"] = "unload"
} catch (e) {
r.headers["X-Mns"] = "error"
}
return r
}
function xhsToken(e, r) {
var i = r.url;
r.params,
r.paramsSerializer,
r.data,
e.configInit;
var a = e.xsIgnore;
if (e.autoReload,
!(!a.some(function(e) {
return i.indexOf(e) >= 0
}) && utils_shouldSign(i)))
return r;
try {
r.headers["Sc-T"] = window.__xhs_sc__.getXHSToken() || ""
} catch (e) {}
return r
}
function signLackReload(e) {
if (e && void 0 !== window._webmsxyw)
throw shouldSignReload() && window.location.reload(),
Error("网络连接不可用,请刷新重试。")
}
function getRealUrl(e, r, i) {
var a = ["%27"]
, s = e;
if (0 === e.indexOf("//") && (e = "".concat(window.location.protocol).concat(e)),
/^https?:/.test(e))
try {
var u = new URL(e);
s = u.href.replace(u.origin, "")
} catch (r) {
s = e
}
var c = L.ZP.http.buildURL(s, r, i);
return [/\'/g].forEach(function(e, r) {
c = c.replace(e, a[r])
}),
c
}
function xsCommon(e, r) {
var i, a;
try {
var s = e.platform
, u = r.url;
if (!T.map(function(e) {
return new RegExp(e)
}).some(function(e) {
return e.test(u)
}))
return r;
var c = r.headers["X-t"] || ""
, d = r.headers["X-s"] || ""
, p = r.headers["X-Sign"] || ""
, f = c && d || p
, v = getSigCount(f)
, g = localStorage.getItem("b1")
, h = localStorage.getItem("b1b1") || "1"
, m = {
s0: getPlatformCode(s),
s1: "",
x0: h,
x1: C,
x2: s || "PC",
x3: "xhs-pc-web",
x4: "4.62.3",
x5: l.Z.get("a1"),
x6: c,
x7: d,
x8: g,
x9: O("".concat(c).concat(d).concat(g)),
x10: v
}
, _ = k.map(function(e) {
return new RegExp(e)
}).some(function(e) {
return e.test(u)
});
(null === (i = window.xhsFingerprintV3) || void 0 === i ? void 0 : i.getCurMiniUa) && _ ? null === (a = window.xhsFingerprintV3) || void 0 === a || a.getCurMiniUa(function(e) {
m.x8 = e,
m.x9 = O("".concat(c).concat(d).concat(e)),
r.headers["X-S-Common"] = b64Encode(encodeUtf8(JSON.stringify(m)))
}) : r.headers["X-S-Common"] = b64Encode(encodeUtf8(JSON.stringify(m)))
} catch (e) {}
return r
}
function getSigCount(e) {
var r = Number(sessionStorage.getItem("sc")) || 0;
return e && (r++,
sessionStorage.setItem("sc", r.toString())),
r
}
i(42876),
i(33933);
var genDeviceFingerprint_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, genDeviceFingerprint_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
}
, D = null;
function setCanvas(e, r, i, a) {
var s = this;
return window.xhsFingerprint.getV18(function(u, c, l) {
return genDeviceFingerprint_awaiter(s, void 0, void 0, function() {
var s;
return genDeviceFingerprint_generator(this, function(c) {
switch (c.label) {
case 0:
s = {
sign: l,
id: u
},
c.label = 1;
case 1:
return c.trys.push([1, 3, , 4]),
[4, i.post("/fe_api/burdock/v2/shield/registerCanvas", s, {
params: {
p: "cc",
callFrom: a
},
baseURL: utils_getHost(),
withCredentials: !0
}).then(function(r) {
e(r)
})];
case 2:
return c.sent(),
[3, 4];
case 3:
return r(c.sent()),
[3, 4];
case 4:
return [2]
}
})
})
})
}
function beforeRecallHandle(e, r) {
return !D && (D = new Promise(function(i, a) {
if (window.xhsFingerprint)
setCanvas(i, a, e, r);
else {
var s = document.createElement("script");
s.src = "//fe-video-qc.xhscdn.com/fe-platform/565a6c0720d87794072b272492de312ec8143fb7.js",
s.type = "text/javascript",
s.crossOrigin = "anonymous",
s.onload = function() {
setCanvas(i, a, e, r)
}
,
document.body.appendChild(s)
}
}
)),
D
}
function tryGenDeviceFingerprint(e, r, i) {
return genDeviceFingerprint_awaiter(this, void 0, void 0, function() {
var a, s;
return genDeviceFingerprint_generator(this, function(u) {
switch (u.label) {
case 0:
return a = (r || {}).callFrom,
s = i.config,
[4, beforeRecallHandle(e, a)];
case 1:
return u.sent(),
[4, e.axios(s)];
case 2:
return [2, u.sent()]
}
})
})
}
i(94934),
i(97542);
var F = i(7862)
, V = i.n(F)
, H = i(28934);
function isSupport_isSupport(e) {
var r, i = c.YF.isIOS ? null === (r = window.webkit) || void 0 === r ? void 0 : r.messageHandlers : window.xhsbridge;
return i && !!i[e]
}
i(99808);
var U = "0";
if (c.YF.isXHS) {
var q = (0,
c.Vk)()
, j = q.major
, W = q.minor
, G = q.patch;
U = "".concat(j, ".").concat(W, ".").concat(G)
}
function coerce(e) {
var r = e.split(".").map(function(e) {
return Number.parseInt(e, 10)
});
return [r[0] || 0, r[1] || 0, r[2] || 0]
}
function compare(e, r) {
for (var i = coerce(e), a = coerce(r), s = 0, u = 0; u < 3; u++) {
if (i[u] > a[u])
return 1;
i[u] === a[u] && (s += 1)
}
return 3 === s ? 0 : -1
}
function version_appVersionLt(e) {
return 0 > compare(U, e)
}
function version_appVersionGte(e) {
return !version_appVersionLt(e)
}
function appVersionEq(e) {
return 0 === compare(U, e)
}
var J = i(35329)
, X = i(46490)
, Y = i(27292)
, z = i(75649)
, K = function(e) {
function BridgeError(e) {
for (var r, i = arguments.length, a = Array(i > 1 ? i - 1 : 0), s = 1; s < i; s++)
a[s - 1] = arguments[s];
return (0,
X._)(this, BridgeError),
(r = (0,
J._)(this, BridgeError, (0,
z._)(a))).name = "BridgeError",
r.code = e,
r
}
return (0,
Y._)(BridgeError, e),
BridgeError
}((0,
i(30961)._)(Error));
function bridge(e, r, i) {
var a = {};
if (void 0 !== r && (a.data = r),
i && (a.callback = i),
c.YF.isIOS) {
if ("registerNotice" === e && !version_appVersionLt("5.29") && version_appVersionLt("5.31")) {
try {
window.webkit.messageHandlers[e].postMessage({
data: i
})
} catch (e) {
throw new K("ERR_NATIVE",e.message)
}
return
}
try {
window.webkit.messageHandlers[e].postMessage(a)
} catch (r) {
throw new K("ERR_NATIVE","".concat(r.message, ", bridge is ").concat(e))
}
} else {
var s = JSON.stringify(a);
try {
window.xhsbridge[e](s)
} catch (r) {
throw new K("ERR_NATIVE","".concat(r.message, ", bridge is ").concat(e))
}
}
}
var Z = i(4659);
function generateKey() {
return (0,
Z.Z)().replace(/-/g, "_")
}
var Q = i(72252);
function check(e, r, i, a) {
setTimeout(function() {
try {
V().checkPropTypes({
prop: e
}, {
prop: r
}, i, "ozone-bridge/".concat(a), !1, !0)
} catch (e) {
var s = e.stack.indexOf(e.message) > -1 ? e.stack : "Error: ".concat(e.message, "\n").concat(e.stack);
(0,
Q.vU)(s, null, null, {
console: !0,
owl: !0
})
}
})
}
function checks_checkArgs(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
if (!r) {
(0,
Q.ZK)("argsT is necessary");
return
}
check(r, e, "args", i)
}
function checks_checkRes(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
if (!r) {
(0,
Q.ZK)("resT is necessary");
return
}
check(r, e, "res", i)
}
function escapeNewLineChars(e) {
return "string" == typeof e ? e.replace(/\n/g, "\\n").replace(/\r/g, "\\r") : e
}
u = window.XHS_CALLBACKS || (window.XHS_CALLBACKS = {});
var $ = {
add: function add(e, r, i) {
var a = "".concat(e, "_").concat(generateKey());
return u[a] = function callbackWrap(a) {
var s;
if (c.YF.isIOS || !version_appVersionLt("5.26.1"))
s = a;
else
try {
s = JSON.parse(escapeNewLineChars(a))
} catch (e) {
s = a
}
(null == i ? void 0 : i.resT) && checks_checkRes(s, i.resT, e),
r(s)
}
,
"XHS_CALLBACKS.".concat(a)
}
};
function bridgeAdapter_callbackAdapter(e, r, i, a) {
var s;
if (!isSupport_isSupport(e))
throw new K("ERR_NOT_SUPPORT","not support ".concat(e));
(null == a ? void 0 : a.argsT) && checks_checkArgs(r, a.argsT, e),
"function" == typeof i && (s = $.add(e, i, a)),
bridge(e, r, s)
}
function bridgeAdapter_adapter(e, r, i) {
return new Promise(function(a, s) {
try {
var u = r
, c = i;
u && (u.argsT || u.resT) && (c = u,
u = void 0),
bridgeAdapter_callbackAdapter(e, u, a, c)
} catch (e) {
s(e)
}
}
)
}
var ee = i(31547);
c.YF.isAndroid && version_appVersionLt("5.20");
function postNotice(e) {
var r = e.methodName
, i = e.data
, a = ("undefined" == typeof window ? "undefined" : (0,
ee._)(window)) === "object" && "object" === (0,
ee._)(window.wx) ? window.wx : null;
return a && a.miniProgram && a.miniProgram.postMessage ? (a.miniProgram.postMessage({
data: {
methodName: r,
data: i
}
}),
Promise.resolve()) : Promise.resolve()
}
function changeTitle() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";
return postNotice({
methodName: "changeTitle",
data: {
title: e
}
})
}
var et = V().oneOf([0, -1]).isRequired;
function deprecatedStr(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
return "[OzoneBridge] ".concat(e, " was deprecated, please use ").concat(r, ".").concat(i ? " Changelog for ".concat(i) : "")
}
function logDeprecated_warnDeprecated(e, r, i) {
(0,
Q.ZK)(deprecatedStr(e, r, i))
}
function ui_changeTitle(e) {
if (c.YF.isHarmony)
return (0,
H.dw)("changeTitle", e);
logDeprecated_warnDeprecated("changeTitle", "document.title = 'my title'");
var r = {
argsT: V().string.isRequired
};
return c.YF.isMiniprogram ? changeTitle(e) : bridgeAdapter_adapter("changeTitle", e, r)
}
function closeWindow() {
return (0,
H.dw)("closeWindow")
}
function confirmAntiSpam() {
return c.YF.isHarmony ? (0,
H.dw)("confirmAntiSpam") : bridgeAdapter_adapter("confirmAntiSpam")
}
function completeUrl_completeUrl(e) {
if (!e.startsWith("http"))
return e.startsWith("//") ? window.location.protocol + e : window.location.origin + e;
return e
}
i(63712),
function installPolyfill() {
if (c.YF.isMiniprogram) {
Object.defineProperty(document, "title", {
set: function(e) {
this._title = e,
changeTitle(e)
},
get: function() {
return this._title
},
configurable: !0
});
return
}
if (!!c.YF.isXHS)
version_appVersionLt("6.36") && (window.open = function windowOpen(e) {
if (["redtop://", "uniik://"].some(function(r) {
return null == e ? void 0 : e.startsWith(r)
}))
window.location.href = e;
else {
var r = new URL(completeUrl_completeUrl(e));
r.searchParams.set("openPage", "yes"),
window.location.href = r.toString()
}
}
),
window.close = function windowClose() {
closeWindow()
}
,
c.YF.isAndroid && (appVersionEq("6.61") && !window.XHSEvents && (window.XHSEvents = {}),
version_appVersionLt("6.54") && Object.defineProperty(document, "title", {
set: function(e) {
this._title = e,
ui_changeTitle(e)
},
get: function() {
return this._title
},
configurable: !0
}))
}();
var er = i(41622)
, en = i(70879)
, ei = i(377);
i(15066);
var eo = i(36757);
function adaptGetDeviceInfo(e) {
return c.YF.isIOS && (e.deviceId = e.uniqueId),
e
}
function getDeviceInfoOld() {
if (c.YF.isHarmony)
return (0,
H.dw)("getDeviceInfo");
function imeiType() {
return version_appVersionLt("5.24") ? {} : c.YF.isIOS ? {
idfa: V().string.isRequired,
idfv: V().string.isRequired
} : {
imei: V().string.isRequired
}
}
var e = {
resT: V().shape((0,
en._)({
result: et,
appMarket: V().string.isRequired,
appVersion: V().string.isRequired,
buildNumber: V().string.isRequired,
systemVersion: V().string.isRequired,
deviceModel: V().string.isRequired,
manufacturer: V().string.isRequired,
timezone: V().string.isRequired,
deviceScreenWidth: V().number.isRequired,
deviceScreenHeight: V().number.isRequired,
carrier: V().string.isRequired,
uniqueId: V().string.isRequired
}, c.YF.isIOS ? {
applepayInfo: V().bool.isRequired
} : {}, imeiType))
};
return bridgeAdapter_adapter("getDeviceInfo").then(function(r) {
var i = (0,
eo.Lg)(r);
return r.applepay_info && (i.applepay_info = r.applepay_info,
logDeprecated_warnDeprecated("res.applepay_info", "res.applepayInfo")),
checks_checkRes(i, e.resT),
i
})
}
function getDeviceInfo() {
return _getDeviceInfo.apply(this, arguments)
}
function _getDeviceInfo() {
return (_getDeviceInfo = (0,
er._)(function() {
var e, r, i, a;
return (0,
ei.Jh)(this, function(a) {
switch (a.label) {
case 0:
return a.trys.push([0, 2, , 3]),
[4, (0,
H.dw)("getDeviceInfo")];
case 1:
if (r = (e = a.sent() || {}).result,
i = e.value,
0 === r)
return [2, adaptGetDeviceInfo(i)];
return [2, getDeviceInfoOld()];
case 2:
return a.sent(),
[2, getDeviceInfoOld()];
case 3:
return [2]
}
})
})).apply(this, arguments)
}
var ea = i(14978)
, es = i.n(ea)
, verifyInit_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, verifyInit_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
};
function verifySdkInit() {
return verifyInit_awaiter(this, void 0, void 0, function() {
var e;
return verifyInit_generator(this, function(e) {
switch (e.label) {
case 0:
return e.trys.push([0, 3, , 4]),
[4, retry(verifyInit_ConfigHttp, {}, 2, 2)];
case 1:
return [4, loadScript(e.sent().sdkUrl)];
case 2:
case 3:
return e.sent(),
[3, 4];
case 4:
return [2]
}
})
})
}
function verifyInit_ConfigHttp() {
return L.ZP.http.post("".concat(getRedHost()).concat("/api/redcaptcha/v2/getconfig"), {}, {
withCredentials: !0,
transform: !1
})
}
var __assign = function() {
return (__assign = Object.assign || function(e) {
for (var r, i = 1, a = arguments.length; i < a; i++)
for (var s in r = arguments[i],
r)
Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
return e
}
).apply(this, arguments)
}
, Captcha_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, Captcha_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
};
function getCaptchaUrl(e, r, i, a, s, u) {
var c = encodeURIComponent(e)
, l = "".concat(getErrorPageHost(), "/web-login/captcha?redirectPath=").concat(c, "&callFrom=").concat(r);
return i && (l = "".concat(l, "&biz=").concat(i)),
a && (l = "".concat(l, "&verifyUuid=").concat(a)),
s && (l = "".concat(l, "&verifyType=").concat(s)),
u && (l = "".concat(l, "&verifyBiz=").concat(u)),
l
}
function triggerCaptcha(e, r, i) {
var a, s, u;
return Captcha_awaiter(this, void 0, void 0, function() {
var c, l, d, p, f, v, g, h, m, _, y, w, E, S, T, b, k, C, P, A, R, I, O;
return Captcha_generator(this, function(d) {
switch (d.label) {
case 0:
c = r.process461Response,
l = r.callFrom,
r.captchaOption,
p = r.captchaInCurrent,
f = (null == i ? void 0 : i.status) || "",
v = (null == i ? void 0 : i.headers) || {},
g = 461 === f && c,
h = 462 === f,
m = !L.ZP.isBrowser;
if (y = m ? e.context.ssrContext : {},
w = m ? getFullURIFromContext(y) : window.location.href,
E = m ? y.redirect : clientRedirect,
S = v["x-biz"],
T = v.verifyuuid,
b = v.verifytype,
k = f,
"301" === b)
return P = (C = window.location).host,
A = C.href,
clientRedirect("//".concat(P, "/login?redirectPath=").concat(encodeURIComponent(A))),
[2, i];
if ("302" === b)
return clientRedirect(location.origin),
[2, i];
if (R = getCaptchaUrl(w, l, S, T, b, k),
!h)
return [3, 2];
return [4, tryGenDeviceFingerprint(L.ZP.http, {
callFrom: l
}, i)];
case 1:
return [2, d.sent()];
case 2:
if (I = v.Resultpolicy || v.ResultPolicy || v.resultpolicy,
!g || "400" === I && (null === (a = null == i ? void 0 : i.data) || void 0 === a ? void 0 : a.code) >= 300030 && (null === (s = null == i ? void 0 : i.data) || void 0 === s ? void 0 : s.code) <= 300039)
return [2, i];
if (m)
return E(R),
[2, i];
try {
O = new utils_TriggerLogRequest(null === (u = null == i ? void 0 : i.config) || void 0 === u ? void 0 : u.url,k,T,b,!1),
triggerLog(O)
} catch (e) {}
return confirmAntiSpam().catch(es()(function() {
E(R)
}, 5e3)),
[2, i]
}
})
})
}
function riskVerify(e, r, i) {
var a, s, u, c;
return Captcha_awaiter(this, void 0, void 0, function() {
var e, l, d, p, f, v, g, h, m, _, y, w;
return Captcha_generator(this, function(E) {
if (e = (null == i ? void 0 : i.status) || "",
l = (null == i ? void 0 : i.headers) || {},
461 !== e && 471 !== e)
return [2, i];
if (l.verifytype && (null === (a = null == i ? void 0 : i.data) || void 0 === a ? void 0 : a.code) !== 0 && (null === (s = null == i ? void 0 : i.data) || void 0 === s ? void 0 : s.code) !== 200)
try {
triggerLog({
verifyBiz: null == i ? void 0 : i.status,
verifyUuid: l.riskuuid,
verifyType: l.verifytype,
verifyStatus: !1,
repeatVerify: !1
}, "not_match_verify_type_code_".concat(null === (u = null == i ? void 0 : i.data) || void 0 === u ? void 0 : u.code))
} catch (e) {}
if ("400" === (d = l.Resultpolicy || l.ResultPolicy || l.resultpolicy))
return (p = e,
f = d || "",
v = l.Riskuuid || l.RiskUuid || l.riskuuid || "",
g = __assign({}, i),
delete g.headers,
delete g.config,
h = encodeURIComponent(JSON.stringify(g)),
m = localStorage.getItem("xhs-pc-theme") || "",
null === (c = r.spamInterception) || void 0 === c ? void 0 : c.call(r, __assign(__assign({}, i), {
uuid: v,
verifySdkInit: verifySdkInit
}))) ? [2, i.data.code >= 300035 && i.data.code <= 300039 ? {
headers: null == i ? void 0 : i.headers,
data: i.data
} : {
headers: null == i ? void 0 : i.headers,
status: 200,
data: {
success: !1,
code: 300031,
data: null
}
}] : (_ = window.location.href,
y = "https://www.xiaohongshu.com",
(w = window.location.href).includes("sit") ? y = "http://www.sit.xiaohongshu.com" : w.includes("beta") && (y = "http://www.beta.xiaohongshu.com"),
clientRedirect("".concat(y, "/website-login/error?redirectPath=").concat(_, '"&httpStatus=').concat(p, "&verifyType=").concat(f, "&uuid=").concat(v, "&response=").concat(h, "&theme=").concat(m)),
[2]);
return [2, i]
})
})
}
var xCommonParams_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, xCommonParams_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
};
function xCommonParams(e, r) {
return xCommonParams_awaiter(this, void 0, void 0, function() {
var i, a, s, u, l, d, p, f, v, g, h, m, _, y, w, E, S, T;
return xCommonParams_generator(this, function(T) {
switch (T.label) {
case 0:
if (i = e.platform,
a = e.includes,
s = e.carryDeviceInfo,
u = a.some(function(e) {
return r.url.includes(e)
}),
!(c.YF.isXHS && s && u))
return [2, r];
l = Date.now(),
p = (d = (0,
c.Vk)()).major,
f = d.minor,
v = d.patch,
g = getDeviceInfo(),
(h = new URLSearchParams).append("platform", i),
h.append("versionName", "".concat(p, ".").concat(f, ".").concat(v)),
T.label = 1;
case 1:
if (T.trys.push([1, 4, , 5]),
h.has("deviceId"))
return [3, 3];
return [4, g];
case 2:
_ = (m = T.sent()).deviceId,
y = m.uniqueId,
w = m.deviceFingerprint,
E = m.deviceFingerprint1,
S = m.fid,
h.append("deviceId", _ || y),
h.append("device_fingerprint", w),
h.append("device_fingerprint1", E),
h.append("fid", S),
T.label = 3;
case 3:
return [3, 5];
case 4:
return T.sent(),
[3, 5];
case 5:
return r.headers["xy-common-params"] = h.toString(),
logSec({
name: "anti_spam_sign_cost",
data: {
cost: Date.now() - l,
type: "xCommonParams",
source: null == r ? void 0 : r.url
}
}),
[2, r]
}
})
})
}
var riskLogin_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, riskLogin_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
};
function riskLogin(e, r, i) {
return riskLogin_awaiter(this, void 0, void 0, function() {
var e, a;
return riskLogin_generator(this, function(a) {
switch (a.label) {
case 0:
e = r.forceLoginHook,
a.label = 1;
case 1:
if (a.trys.push([1, 4, , 5]),
!handlerRiskLogin(i))
return [2, i];
if ("function" != typeof e)
return [3, 3];
return [4, e()];
case 2:
a.sent(),
a.label = 3;
case 3:
return [3, 5];
case 4:
return a.sent(),
[3, 5];
case 5:
return [2, i]
}
})
})
}
function handlerRiskLogin(e) {
return 465 === Number((e || {}).status)
}
var riskVerify_awaiter = function(e, r, i, a) {
function adopt(e) {
return e instanceof i ? e : new i(function(r) {
r(e)
}
)
}
return new (i || (i = Promise))(function(i, s) {
function fulfilled(e) {
try {
step(a.next(e))
} catch (e) {
s(e)
}
}
function rejected(e) {
try {
step(a.throw(e))
} catch (e) {
s(e)
}
}
function step(e) {
e.done ? i(e.value) : adopt(e.value).then(fulfilled, rejected)
}
step((a = a.apply(e, r || [])).next())
}
)
}
, riskVerify_generator = function(e, r) {
var i, a, s, u, c = {
label: 0,
sent: function sent() {
if (1 & s[0])
throw s[1];
return s[1]
},
trys: [],
ops: []
};
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
},
"function" == typeof Symbol && (u[Symbol.iterator] = function() {
return this
}
),
u;
function verb(e) {
return function(r) {
return step([e, r])
}
}
function step(l) {
if (i)
throw TypeError("Generator is already executing.");
for (; u && (u = 0,
l[0] && (c = 0)),
c; )
try {
if (i = 1,
a && (s = 2 & l[0] ? a.return : l[0] ? a.throw || ((s = a.return) && s.call(a),
0) : a.next) && !(s = s.call(a, l[1])).done)
return s;
switch (a = 0,
s && (l = [2 & l[0], s.value]),
l[0]) {
case 0:
case 1:
s = l;
break;
case 4:
return c.label++,
{
value: l[1],
done: !1
};
case 5:
c.label++,
a = l[1],
l = [0];
continue;
case 7:
l = c.ops.pop(),
c.trys.pop();
continue;
default:
if (!(s = (s = c.trys).length > 0 && s[s.length - 1]) && (6 === l[0] || 2 === l[0])) {
c = 0;
continue
}
if (3 === l[0] && (!s || l[1] > s[0] && l[1] < s[3])) {
c.label = l[1];
break
}
if (6 === l[0] && c.label < s[1]) {
c.label = s[1],
s = l;
break
}
if (s && c.label < s[2]) {
c.label = s[2],
c.ops.push(l);
break
}
s[2] && c.ops.pop(),
c.trys.pop();
continue
}
l = r.call(e, c)
} catch (e) {
l = [6, e],
a = 0
} finally {
i = s = 0
}
if (5 & l[0])
throw l[1];
return {
value: l[0] ? l[1] : void 0,
done: !0
}
}
}
, eu = !1;
function triggerSpam(e, r, i) {
return riskVerify_awaiter(this, void 0, void 0, function() {
return riskVerify_generator(this, function(e) {
switch (e.label) {
case 0:
if ((null == i ? void 0 : i.status) !== 471)
return [3, 2];
return [4, initVerifySdk(i, r)];
case 1:
e.sent(),
e.label = 2;
case 2:
return [2, i]
}
})
})
}
function initVerifySdk(e, r) {
var i;
return riskVerify_awaiter(this, void 0, void 0, function() {
var a, s, u, c, l, d, p, f, v, g, h, m, _, y;
return riskVerify_generator(this, function(w) {
switch (w.label) {
case 0:
if (a = null == e ? void 0 : e.status,
u = (s = (null == e ? void 0 : e.headers) || {})["x-biz"],
c = s.verifyuuid,
l = s.verifytype,
d = a,
"301" === l)
return f = (p = window.location).host,
v = p.href,
clientRedirect("//".concat(f, "/login?redirectPath=").concat(encodeURIComponent(v))),
[2, e];
if ("302" === l)
return clientRedirect(location.origin),
[2, e];
try {
g = new utils_TriggerLogRequest(null === (i = null == e ? void 0 : e.config) || void 0 === i ? void 0 : i.url,d,c,l,eu),
triggerLog(g)
} catch (e) {}
if (!0 === eu)
return [2];
if (h = r.spamCallback,
m = r.onCaptchaClose,
y = {
type: "rotate",
mode: "popup",
verifyBiz: d || "471",
verifyUuid: c || "",
verifyType: l || "102",
biz: u,
platform: "web",
http: L.ZP.http,
onInit: function onInit() {
ubtTrack(c, "onInit")
},
onReady: function onReady() {
ubtTrack(c, "onReady")
},
onError: function onError(e, r, i) {
ubtTrack(e, "onError", "", JSON.stringify({
msg: r,
code: i
}))
},
onSuccess: function onSuccess(r) {
var i;
ubtTrack(c, "onSuccess", r),
null == _ || _.destroy(),
eu = !1,
"function" == typeof h && h(!0, null === (i = null == e ? void 0 : e.config) || void 0 === i ? void 0 : i.url)
},
onFailed: function onFailed(r) {
var i;
ubtTrack("onFail", r),
"function" == typeof h && h(!1, null === (i = null == e ? void 0 : e.config) || void 0 === i ? void 0 : i.url)
},
onClose: function onClose() {
ubtTrack("onClose"),
"function" == typeof m && m(),
eu = !1
}
},
window.initCaptcha)
return [3, 2];
return [4, verifySdkInit()];
case 1:
w.sent(),
w.label = 2;
case 2:
return _ = window.initCaptcha(y),
eu = !0,
[2]
}
})
})
}
function ubtTrack(e, r, i, a) {
var s = l.Z.get("gid")
, u = l.Z.get(d);
try {
var c = {
method: r,
rid: i || "",
verify_uuid: e || "",
web_id: u || "",
gid: s || "",
timestamp: +new Date,
extra_data: a || ""
}
, p = {
measurement_name: "infra_sec_verify_walify",
measurement_data: c
};
window.insight ? window.insight.sendCustomPoint(p) : window.eaglet && window.eaglet.push(p, "ApmXrayTracker")
} catch (e) {}
}
var ec = {
callFrom: "web",
carryDeviceInfo: !1,
includes: ["xiaohongshu.com"],
process461Response: !0,
captchaInCurrent: !1,
isHidden: "visible",
platform: "Windows",
forceLoginHook: void 0,
xsIgnore: [],
configInit: !1,
autoReload: !1,
disableMns: !1,
spamCallback: void 0,
onCaptchaClose: void 0,
onReadyToLoadJS: void 0,
loadTimeout: 4e3
}
, el = {
name: "AntiSpam",
install: function install(e, r, i) {
var a = r.http.interceptors.spam
, s = r.http.interceptors.dispatch;
ec.appId = "xhs-pc-web";
var u = Object.assign({}, ec, i);
if (r.isBrowser) {
!0 === window.sdt_source_init && (u.configInit = !0),
a.use(riskLogin.bind(null, e, u)),
a.use(riskVerify.bind(null, e, u)),
a.use(triggerCaptcha.bind(null, e, u)),
a.use(triggerSpam.bind(null, e, u)),
a.use(riskHandler.bind(null, e));
var p = (0,
c.Ij)();
u.platform = p,
s.use(signAdaptor.bind(this, u)),
r.http.interceptors.request.use(xCommonParams.bind(this, u)),
reportBroswerInfo(u, r),
updateHidden(u);
var f = l.Z.get("a1")
, v = l.Z.get(d)
, h = f && v && 52 === f.length
, m = +new Date + "";
if (l.Z.set(g, m, {
domain: "xiaohongshu.com",
expires: 365
}),
l.Z.set(g, m, {
domain: "xiaohongshu.hk",
expires: 365
}),
!h) {
for (var _ = "", y = 0; y < 1e3 && 52 !== _.length; )
_ = generateLocalId(p),
y++;
l.Z.set("a1", _, {
domain: "xiaohongshu.com",
expires: 365
}),
l.Z.set(d, N(_), {
domain: "xiaohongshu.com",
expires: 365
}),
l.Z.set("a1", _, {
domain: "xiaohongshu.hk",
expires: 365
}),
l.Z.set(d, N(_), {
domain: "xiaohongshu.hk",
expires: 365
})
}
u.captchaInCurrent && verifySdkInit()
}
}
}
},
92691: function(e, r, i) {
"use strict";
i.d(r, {
Q: function() {
return e5
},
Z: function() {
return e8
}
});
var a, s, u, c, l, d, p = i(41622), f = i(51606), v = i(70879), g = i(27337), h = i(75649), m = i(31547), _ = i(377);
i(86651),
i(42876),
i(33933),
i(41593),
i(36277),
i(34333),
i(27461),
i(23339),
i(51109),
i(75973),
i(6045),
i(10364),
i(67673),
i(87989),
i(87535),
i(75204),
i(97357),
i(19077),
i(7608),
i(97542),
i(80156),
i(50721),
i(29112),
i(67275),
i(59989),
i(7099),
i(55947);
var y = i(63522);
i(72169),
i(58486);
var w = i(7862)
, E = i.n(w);
function isSupport_isSupport(e) {
var r = y.YF.isIOS ? window.webkit && window.webkit.messageHandlers : window.xhsbridge;
return r && !!r[e]
}
i(99808),
i(9557);
var S = "0";
if (y.YF.isXHS) {
var T = (0,
y.Vk)()
, b = T.major
, k = T.minor
, C = T.patch;
S = "".concat(b, ".").concat(k, ".").concat(C)
}
function coerce(e) {
var r = e.split(".").map(function(e) {
return Number.parseInt(e, 10)
});
return [r[0] || 0, r[1] || 0, r[2] || 0]
}
function compare(e, r) {
for (var i = coerce(e), a = coerce(r), s = 0, u = 0; u < 3; u++) {
if (i[u] > a[u])
return 1;
i[u] === a[u] && (s += 1)
}
return 3 === s ? 0 : -1
}
function version_appVersionLt(e) {
return 0 > compare(S, e)
}
function version_appVersionGte(e) {
return !version_appVersionLt(e)
}
function appVersionEq(e) {
return 0 === compare(S, e)
}
var P = i(35329)
, A = i(46490)
, R = i(27292)
, I = function(e) {
function BridgeError(e) {
for (var r, i = arguments.length, a = Array(i > 1 ? i - 1 : 0), s = 1; s < i; s++)
a[s - 1] = arguments[s];
return (0,
A._)(this, BridgeError),
(r = (0,
P._)(this, BridgeError, (0,
h._)(a))).name = "BridgeError",
r.code = e,
r
}
return (0,
R._)(BridgeError, e),
BridgeError
}((0,
i(30961)._)(Error));
function bridge(e, r, i) {
var a = {};
if (void 0 !== r && (a.data = r),
i && (a.callback = i),
y.YF.isIOS) {
if ("registerNotice" === e && !version_appVersionLt("5.29") && version_appVersionLt("5.31")) {
try {
window.webkit.messageHandlers[e].postMessage({
data: i
})
} catch (e) {
throw new I("ERR_NATIVE",e.message)
}
return
}
try {
window.webkit.messageHandlers[e].postMessage(a)
} catch (r) {
throw new I("ERR_NATIVE","".concat(r.message, ", bridge is ").concat(e))
}
} else {
var s = JSON.stringify(a);
try {
window.xhsbridge[e](s)
} catch (r) {
throw new I("ERR_NATIVE","".concat(r.message, ", bridge is ").concat(e))
}
}
}
var O = i(4659);
function generateKey() {
return (0,
O.Z)().replace(/-/g, "_")
}
i(34885);
var N = i(72252);
function check(e, r, i, a) {
setTimeout(function() {
try {
E().checkPropTypes({
prop: e
}, {
prop: r
}, i, "ozone-bridge/".concat(a), !1, !0)
} catch (e) {
var s = e.stack.indexOf(e.message) > -1 ? e.stack : "Error: ".concat(e.message, "\n").concat(e.stack);
(0,
N.vU)(s, null, null, {
console: !0,
owl: !0
})
}
})
}
function checks_checkArgs(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
if (!r) {
(0,
N.ZK)("argsT is necessary");
return
}
check(r, e, "args", i)
}
function checks_checkRes(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
if (!r) {
(0,
N.ZK)("resT is necessary");
return
}
check(r, e, "res", i)
}
function escapeNewLineChars(e) {
return "string" == typeof e ? e.replace(/\n/g, "\\n").replace(/\r/g, "\\r") : e
}
s = window.XHS_CALLBACKS || (window.XHS_CALLBACKS = {});
var L = {
add: function add(e, r, i) {
var a = "".concat(e, "_").concat(generateKey());
return s[a] = function callbackWrap(a) {
var s;
if (y.YF.isIOS || !version_appVersionLt("5.26.1"))
s = a;
else
try {
s = JSON.parse(escapeNewLineChars(a))
} catch (e) {
s = a
}
i && i.resT && checks_checkRes(s, i.resT, e),
r(s)
}
,
"XHS_CALLBACKS.".concat(a)
}
};
function bridgeAdapter_callbackAdapter(e, r, i, a) {
var s;
if (!isSupport_isSupport(e))
throw new I("ERR_NOT_SUPPORT","not support ".concat(e));
a && a.argsT && checks_checkArgs(r, a.argsT, e),
"function" == typeof i && (s = L.add(e, i, a)),
bridge(e, r, s)
}
function bridgeAdapter_adapter(e, r, i) {
return new Promise(function(a, s) {
try {
var u = r
, c = i;
u && (u.argsT || u.resT) && (c = u,
u = void 0),
bridgeAdapter_callbackAdapter(e, u, a, c)
} catch (e) {
s(e)
}
}
)
}
y.YF.isAndroid && version_appVersionLt("5.20");
function postNotice(e) {
var r = e.methodName
, i = e.data
, a = ("undefined" == typeof window ? "undefined" : (0,
m._)(window)) === "object" && "object" === (0,
m._)(window.wx) ? window.wx : null;
return a && a.miniProgram && a.miniProgram.postMessage ? (a.miniProgram.postMessage({
data: {
methodName: r,
data: i
}
}),
Promise.resolve()) : Promise.resolve()
}
function changeTitle() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";
return postNotice({
methodName: "changeTitle",
data: {
title: e
}
})
}
i(25069);
var M = E().oneOf([0, -1]).isRequired;
function validators_urlType(e, r, i, a) {
if (e[r] && !/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.?%&=]*)?/.test(e[r]))
return Error("Invalid ".concat(a, " `").concat(r, "` => `").concat(JSON.stringify(e[r]), "` supplied to `").concat(i, "`, expected `url` pattern."))
}
function deprecatedStr(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
return "[OzoneBridge] ".concat(e, " was deprecated, please use ").concat(r, ".").concat(i ? " Changelog for ".concat(i) : "")
}
function logDeprecated_warnDeprecated(e, r, i) {
(0,
N.ZK)(deprecatedStr(e, r, i))
}
function ui_changeTitle(e) {
logDeprecated_warnDeprecated("changeTitle", "document.title = 'my title'");
var r = {
argsT: E().string.isRequired
};
return y.YF.isMiniprogram ? changeTitle(e) : bridgeAdapter_adapter("changeTitle", e, r)
}
function closeWindow() {
return bridgeAdapter_adapter("closeWindow")
}
function completeUrl_completeUrl(e) {
if (!e.startsWith("http"))
return e.startsWith("//") ? window.location.protocol + e : window.location.origin + e;
return e
}
(function installPolyfill() {
if (y.YF.isMiniprogram) {
Object.defineProperty(document, "title", {
set: function(e) {
this._title = e,
changeTitle(e)
},
get: function() {
return this._title
},
configurable: !0
});
return
}
if (!!y.YF.isXHS)
version_appVersionLt("6.36") && (window.open = function windowOpen(e) {
var r = new URL(completeUrl_completeUrl(e));
r.searchParams.set("openPage", "yes"),
window.location.href = r.toString()
}
,
window.close = function windowClose() {
closeWindow()
}
),
y.YF.isAndroid && (appVersionEq("6.61") && !window.XHSEvents && (window.XHSEvents = {}),
version_appVersionLt("6.54") && Object.defineProperty(document, "title", {
set: function(e) {
this._title = e,
ui_changeTitle(e)
},
get: function() {
return this._title
},
configurable: !0
}))
}
)(),
i(15066);
var B = i(36757);
function data_getUserInfo() {
var e, r, i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
extractValue: !1
};
var a = y.YF.isAndroid && (e = "6.5",
!version_appVersionLt("6.5")) || y.YF.isIOS && (r = "6.9",
!version_appVersionLt("6.9"))
, s = {
resT: E().shape({
result: M,
response: E().shape((0,
v._)({
userId: E().string.isRequired,
nickname: E().string.isRequired,
gender: E().number.isRequired,
userToken: E().string.isRequired,
image: validators_urlType.isRequired,
location: E().string.isRequired,
flags: E().shape({
fulishe: E().oneOfType([E().object]).isRequired,
shequ: E().oneOfType([E().object]).isRequired
})
}, version_appVersionLt("5.24") ? {} : {
lat: E().number.isRequired,
lon: E().number.isRequired,
sessionId: E().string.isRequired
}, a ? {
hashExp: E().string.isRequired
} : {}))
})
};
return bridgeAdapter_adapter("getUserInfo").then(function(e) {
var r = (0,
B.Lg)(e);
if (e.response && (e.response.flags && (e.response.flags.fulishe && (r.response.flags.fulishe = e.response.flags.fulishe),
e.response.flags.shequ && (r.response.flags.shequ = e.response.flags.shequ)),
e.response.user_id && (r.response.user_id = e.response.user_id,
logDeprecated_warnDeprecated("res.response.user_id", "res.response.userId")),
e.response.user_token && (r.response.user_token = e.response.user_token,
logDeprecated_warnDeprecated("res.response.user_token", "res.response.userToken")),
e.response.session_id && (r.response.session_id = e.response.session_id,
logDeprecated_warnDeprecated("res.response.session_id", "res.response.sessionId")),
e.response.images && !e.response.image && (r.response.image = e.response.images,
logDeprecated_warnDeprecated("res.response.images", "res.response.image"))),
checks_checkRes(r, s.resT),
i.extractValue) {
if (0 === r.result)
return r.response;
throw new I("ERR_RESULT_".concat(r.result),"res.result is not 0")
}
return r
})
}
let x = {
userId: "",
userToken: "",
sessionId: "",
hashExp: "",
flags: {}
};
function getABInfoByBridge() {
return data_getUserInfo({
extractValue: !0
}).then(e => {
let {userId: r, userToken: i, sessionId: a, hashExp: s, flags: u} = e;
return r && (x.userId = r),
i && (x.userToken = i),
a && (x.sessionId = a),
s && "string" == typeof s && (x.hashExp = s),
u && (x.flags = u),
x
}
)
}
function getABInfo() {
return getABInfoByBridge().catch( () => x)
}
function getFlagValue(...e) {
return getABInfo().then(r => {
let {flags: i} = r
, a = [];
return e.forEach(e => {
if (!i.shequ && !i.fulishe) {
a.push(void 0);
return
}
let r = i.shequ[e]
, s = i.fulishe[e];
void 0 !== r ? a.push(r) : void 0 !== s ? a.push(s) : a.push(void 0)
}
),
1 === a.length ? a[0] : a
}
)
}
var D = i(90251)
, getDomTrackerData = function getDomTrackerData1(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
if (!e || e === document.body || i > 20)
return null;
if (e.hasAttribute("data-eaglet") || e.hasAttribute("eaglet"))
return e;
var a = e.hasAttribute("eaglet-no-propagation");
return r || a ? null : getDomTrackerData(null == e ? void 0 : e.parentNode, !1, ++i)
};
function getPostData(e) {
var r, i, a, s, u = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], c = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "click";
if (!e)
throw Error("targetDom should not be ".concat(e));
var l = null
, d = null;
if ("click" === c ? l = getDomTrackerData(e, u) : "impression" === c && (l = e),
!l)
return;
if ("click" === c ? d = l.dataset.eaglet || l.getAttribute("eaglet") : "impression" === c && (d = l.dataset.impression || l.dataset.eaglet || l.getAttribute("eaglet")),
!!d) {
var p = JSON.parse(d);
Number(null == p ? void 0 : null === (i = p.event) || void 0 === i ? void 0 : null === (r = i.value) || void 0 === r ? void 0 : r.pointId) >= 2e4 && l.dataset.eaglet && l.dataset.impression;
return p
}
}
var F = function() {
function ClickCollector(e) {
var r = this;
(0,
A._)(this, ClickCollector),
(0,
f._)(this, "tracker", void 0),
this.tracker = e,
document.body.addEventListener("click", function(e) {
var i = e.target
, a = r.getData(i);
a && r.tracker.push(a)
}, !0)
}
return (0,
D._)(ClickCollector, [{
key: "getData",
value: function getData(e) {
var r = getPostData(e);
if (!!r) {
if (r.event) {
if (r.event.value.action) {
if ("impression" === r.event.value.action.value)
return
} else
r.event.value.action = {
type: "NormalizedAction",
value: "click"
},
r.event.value.seAction = "click"
} else
r.event = {
type: "Event",
value: {
action: {
type: "NormalizedAction",
value: "click"
},
seAction: "click"
}
};
return r
}
}
}]),
ClickCollector
}();
function createClickCollector(e) {
return new F(e)
}
var V = function() {
function ImpressionCollector(e) {
var r = this;
(0,
A._)(this, ImpressionCollector),
(0,
f._)(this, "tracker", void 0),
(0,
f._)(this, "countDown", void 0),
(0,
f._)(this, "intervalTimer", void 0),
(0,
f._)(this, "intervalTickCount", void 0),
(0,
f._)(this, "warningShown", void 0),
(0,
f._)(this, "countDownTimer", void 0),
this.tracker = e,
this.countDown = null,
this.intervalTimer = 0,
this.intervalTickCount = 0,
this.countDownTimer = 0,
this.warningShown = !1,
this.postData(),
this.checkByEvent(),
this.checkByInterval(),
document.addEventListener("trigger-impression", function() {
r.postData()
})
}
return (0,
D._)(ImpressionCollector, [{
key: "checkByEvent",
value: function checkByEvent() {
var e = this
, r = this.isSupportTouch() ? "touchmove" : "scroll";
window.addEventListener(r, function() {
e.postData()
}, !1)
}
}, {
key: "checkByInterval",
value: function checkByInterval() {
var e = this;
this.intervalTickCount <= 120 && (this.intervalTimer = window.setTimeout(function() {
e.intervalTickCount += 1,
e.postData(),
e.checkByInterval()
}, 5e3))
}
}, {
key: "postData",
value: function postData() {
var e = this;
this.countDownTimer && clearTimeout(this.countDownTimer),
this.countDownTimer = window.setTimeout(function() {
var r = (0,
h._)(document.querySelectorAll("[eaglet]"));
r.length > 0 && !e.warningShown && (console.warn("[WebTracker] custom data attribute `eaglet` was deprecated, please use `data-eaglet` instead"),
e.warningShown = !0);
var i = (0,
h._)(document.querySelectorAll("[data-eaglet],[data-impression]"));
(0,
h._)(r).concat((0,
h._)(i)).forEach(function(r) {
var i;
if (!((null === (i = r.dataset) || void 0 === i ? void 0 : i.eagletImp) || r.getAttribute("data-eaglet-imp"))) {
var a = e.isInnerWindow(r)
, s = e.isHidden(r);
if (a && s) {
var u = e.getData(r);
r.setAttribute("data-eaglet-imp", "true"),
u && e.tracker.push(u)
}
}
})
}, 500)
}
}, {
key: "getData",
value: function getData(e) {
var r, i, a, s, u = getPostData(e, !0, "impression");
if (!!u)
return u.event ? (u.event.value.action = {
type: "NormalizedAction",
value: "impression"
},
u.event.value.seAction = "impression",
(null === (i = u.event) || void 0 === i ? void 0 : null === (r = i.value) || void 0 === r ? void 0 : r.pointId) !== void 0 && (null === (s = u.event) || void 0 === s ? void 0 : null === (a = s.value) || void 0 === a ? void 0 : a.pointId) < 2e4 && delete u.event.value.pointId) : u.event = {
type: "Event",
value: {
action: {
type: "NormalizedAction",
value: "impression"
},
seAction: "impression"
}
},
u
}
}, {
key: "isSupportTouch",
value: function isSupportTouch() {
return "ontouchmove"in document
}
}, {
key: "isInnerWindow",
value: function isInnerWindow(e) {
var r = window.innerHeight
, i = window.innerWidth;
if (e && "function" == typeof e.getBoundingClientRect) {
var a = e.getBoundingClientRect()
, s = a.bottom >= 0 && a.top + .3 * a.height < r
, u = a.right >= 0 && a.left + .3 * a.width < i
, c = a.bottom >= 0 && .3 <= (r - a.top) / window.screen.height
, l = a.right >= 0 && .3 <= (i - a.left) / window.screen.width;
return s && u || c && l
}
return !1
}
}, {
key: "isHidden",
value: function isHidden(e) {
var r = window.getComputedStyle(e)
, i = r.getPropertyValue("position")
, a = r.getPropertyValue("display");
return "fixed" === i && "none" !== a || !!e.offsetParent
}
}]),
ImpressionCollector
}();
function createImpressionCollector(e) {
return new V(e)
}
var H = i(64593);
i(43648);
var U = i(65266)
, q = i(71022);
i(87394),
i(94941),
i(48421);
var j = i(44501);
i(1154),
i(80013),
i(57745),
i(82427),
i(36062),
i(57057);
var W = ["t.xiaohongshu.com", "spltest.xiaohongshu.com", "t2.xiaohongshu.com", "t2-test.xiaohongshu.com", "lng.xiaohongshu.com", "apm-track.xiaohongshu.com", "apm-track-test.xiaohongshu.com", "fse.xiaohongshu.com", "fse.devops.xiaohongshu.com", "fesentry.xiaohongshu.com"]
, G = /\/\/(\S+?)[/|:]/;
function helpers_now() {
return Date.now() || +new Date
}
function isForbiddenUrl() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ""
, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : W;
return r.some(function(r) {
return -1 !== e.indexOf(r)
})
}
function getTimeFromMarks(e, r) {
var i = (0,
j._)(e.filter(function(e) {
return e.name === r
}), 1)[0];
return i ? i.startTime : null
}
function toDict() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
return e.toJSON && "function" == typeof e.toJSON ? e.toJSON() : Object.keys(Object.getPrototypeOf(e)).reduce(function(r, i) {
return "function" != typeof e[i] && (r[i] = e[i]),
r
}, {})
}
var J = Object.prototype.toString
, isUndef = function(e) {
return null == e
}
, isFunc = function(e) {
return "function" == typeof e
}
, X = ["connectEnd", "connectStart", "domComplete", "domContentLoadedEventEnd", "domContentLoadedEventStart", "domInteractive", "domLoading", "domainLookupEnd", "domainLookupStart", "fetchStart", "loadEventEnd", "loadEventStart", "navigationStart", "redirectEnd", "redirectStart", "requestStart", "responseEnd", "responseStart", "secureConnectionStart", "unloadEventEnd", "unloadEventStart"]
, Y = {}
, z = []
, K = helpers_now();
function resetEntries(e) {
var r = {}
, i = [];
z.forEach(function(a) {
a.entryType !== e && (r[a.name] = a,
i.push(a))
}),
Y = r,
z = i
}
function removeEntry(e, r) {
if (isUndef(r)) {
resetEntries(e);
return
}
z = z.filter(function(i) {
return i.name !== r || i.entryType !== e
});
var i = Y[r];
i && i.entryType === e && (Y[r] = void 0)
}
function ShadowPerformanceEntry(e, r, i, a) {
this.name = e,
this.duration = a,
this.entryType = r,
this.startTime = i
}
function wrap(e) {
function setupPolyfill(r, i) {
isUndef(e.performance[r]) && (e.performance[r] = i)
}
return e.performance = e.performance || {},
setupPolyfill("now", function() {
return "function" == typeof K ? helpers_now() - K() : helpers_now() - K
}),
setupPolyfill("mark", function(e) {
if (X.indexOf(e) >= 0)
throw Error("Failed to execute 'mark' on 'Performance': '".concat(e, "' is part of the PerformanceTiming interface, and cannot be used as a mark name."));
var r = new ShadowPerformanceEntry(e,"mark",performance.now(),0);
z.push(r),
Y[e] = r
}),
setupPolyfill("measure", function(e, r, i) {
var a = 0
, s = 0
, u = helpers_now();
if (isUndef(r))
a = 0;
else if (Y[r])
a = Y[r].startTime;
else
throw Error("Failed to execute 'measure' on 'Performance': The mark '".concat(r, "' dose not exist."));
if (isUndef(i))
s = u;
else if (Y[i])
s = Y[i].startTime;
else
throw Error("Failed to execute 'measure' on 'Performance': The mark '".concat(i, "' dose not exist."));
var c = new ShadowPerformanceEntry(e,"measure",a,s - a);
z.push(c),
Y[e] = c
}),
setupPolyfill("clearMarks", function(e) {
removeEntry("mark", e)
}),
setupPolyfill("clearMeasures", function(e) {
removeEntry("measure", e)
}),
setupPolyfill("getEntries", function(e) {
var r, i = z;
return isUndef(e) ? i : (e.entryType ? r = e.name ? function(r) {
return r.entryType === e.entryType && r.name === e.name
}
: function(r) {
return r.entryType === e.entryType
}
: e.name && (r = function(r) {
return r.name === e.name
}
),
i.filter(r))
}),
setupPolyfill("getEntriesByName", function(r, i) {
var a = {
name: r
};
return i && (a.entryType = i),
e.performance.getEntries(a)
}),
setupPolyfill("getEntriesByType", function(r) {
return e.performance.getEntries({
entryType: r
})
}),
e.performance.setupPolyfill = setupPolyfill,
e.performance.setNavigationStart = function(e) {
K = e
}
,
e.performance
}
ShadowPerformanceEntry.prototype.toJSON = function toJSON() {
return {
name: this.name,
duration: this.duration,
entryType: this.entryType,
startTime: this.startTime
}
}
;
function supportNavigationTiming() {
return !!(window.performance && window.performance.timing)
}
function supportUserTiming() {
return !!(window.performance.mark && window.performance.measure && window.performance.clearMarks && window.performance.clearMeasures && window.performance.getEntries && window.performance.getEntriesByType && window.performance.getEntriesByName)
}
wrap(window);
var Z = i(34134)
, Q = function() {
function PerfTiming() {
(0,
A._)(this, PerfTiming)
}
return (0,
D._)(PerfTiming, [{
key: "timing",
value: function timing() {
return {}
}
}, {
key: "responseCatchHook",
value: function responseCatchHook(e, r, i) {
return e
}
}, {
key: "observe",
value: function observe() {}
}, {
key: "validate",
value: function validate(e, r) {
for (; r.length; ) {
var i, a = r.shift();
if (!a.prop)
break;
if (a.default && (e[a.prop] = a.default),
a.required && !e[a.prop])
throw Error("[".concat(this.constructor.name, "] Property '").concat(a.prop, "' is missing"));
var s = !0;
if (a.validator && isFunc(a.validator))
s = a.validator(e[a.prop], e);
else {
;if (a.pattern && (i = a.pattern,
J.call(i, "[object RegExp]")))
s = a.pattern.test(e[a.prop])
}
if (!s)
throw TypeError("[".concat(this.constructor.name, "] Property '").concat(a.prop, "' is invalid"))
}
}
}]),
PerfTiming
}();
function getPaintTimes() {
var e = null
, r = null
, i = window.performance.getEntriesByType("paint");
if (i && i.length)
e = getTimeFromMarks(i, "first-paint"),
r = getTimeFromMarks(i, "first-contentful-paint");
else {
if ("number" != typeof window.performance.timing.msFirstPaint)
return null;
e = window.performance.timing.msFirstPaint - window.performance.timing.navigationStart
}
return {
firstPaint: e,
firstContentfulPaint: r
}
}
var $ = new (function(e) {
function BrowserPaintTiming() {
return (0,
A._)(this, BrowserPaintTiming),
(0,
P._)(this, BrowserPaintTiming, arguments)
}
return (0,
R._)(BrowserPaintTiming, e),
(0,
D._)(BrowserPaintTiming, [{
key: "observe",
value: function observe() {
return Z.Z.get().then(function(e) {
var r = e.firstPaint
, i = e.firstContentfulPaint
, a = e.firstMeaningfulPaint
, s = e.fullyLoaded
, u = e.firstScreen
, c = getPaintTimes();
return !c && (c = {
firstPaint: void 0 === r ? null : r,
firstContentfulPaint: void 0 === i ? null : i
}),
{
paintTimes: c,
fullyLoaded: void 0 === s ? null : s,
firstMeaningfulPaint: void 0 === a ? null : a,
firstScreenPaint: void 0 === u ? null : u
}
})
}
}]),
BrowserPaintTiming
}(Q));
new (function(e) {
function BrowserServerTiming() {
return (0,
A._)(this, BrowserServerTiming),
(0,
P._)(this, BrowserServerTiming, arguments)
}
return (0,
R._)(BrowserServerTiming, e),
(0,
D._)(BrowserServerTiming, [{
key: "timing",
value: function timing() {
var e = (0,
j._)(window.performance.getEntriesByType("navigation"), 1)[0];
return e && e.serverTiming || []
}
}]),
BrowserServerTiming
}(Q)),
i(95477);
var ee = new (function(e) {
function BrowserResourceTiming() {
return (0,
A._)(this, BrowserResourceTiming),
(0,
P._)(this, BrowserResourceTiming, arguments)
}
return (0,
R._)(BrowserResourceTiming, e),
(0,
D._)(BrowserResourceTiming, [{
key: "timing",
value: function timing() {
var e = window.performance.getEntriesByType("resource")
, r = this.filterResources(e).map(function(e) {
var r = e.toJSON();
try {
r.hostname = r.name.match(G)[1]
} catch (e) {}
return delete r.serverTiming,
delete r.workerTiming,
r
});
return isFunc(window.performance.clearResourceTimings) && window.performance.clearResourceTimings(),
r
}
}, {
key: "filterResources",
value: function filterResources() {
for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], r = [], i = 0; i < e.length; i++) {
var a = e[i];
if (!(isUndef(a.toJSON) || !isFunc(a.toJSON) || 0 === a.name.indexOf("data:") || 0 === a.name.indexOf("about:") || 0 === a.name.indexOf("javascript:") || isForbiddenUrl(a.name)))
r.push(a)
}
return r
}
}]),
BrowserResourceTiming
}(Q))
, et = new (function(e) {
function BrowserNavigationTiming() {
return (0,
A._)(this, BrowserNavigationTiming),
(0,
P._)(this, BrowserNavigationTiming, arguments)
}
return (0,
R._)(BrowserNavigationTiming, e),
(0,
D._)(BrowserNavigationTiming, [{
key: "timing",
value: function timing() {
var e = toDict(window.performance.timing);
return void 0 !== e.timeToNonBlankPaint && delete e.timeToNonBlankPaint,
void 0 !== e.timeToDOMContentFlushed && delete e.timeToDOMContentFlushed,
e
}
}]),
BrowserNavigationTiming
}(Q));
function serializeParams() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ""
, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return Object.keys(r).reduce(function(e, i) {
var a = r[i];
if (!a)
return e;
var s = "".concat(encodeURIComponent(i), "=").concat(encodeURIComponent(a));
return -1 === e.indexOf("?") ? e += "?".concat(s) : e += "&".concat(s),
e
}, e)
}
i(74719),
i(13396),
i(91313);
var er = function() {
function HttpTracker() {
(0,
A._)(this, HttpTracker),
this.entryHash = {}
}
return (0,
D._)(HttpTracker, [{
key: "resetEntryHash",
value: function resetEntryHash() {
this.entryHash = {}
}
}, {
key: "track",
value: function track(e, r) {
if (!e)
throw Error("[apm-metrics] mark name is required");
var i = this.entryHash[e];
void 0 !== i ? (performance.mark("".concat(e, "_end")),
this.entryHash[e] = (0,
v._)({}, i, r)) : (performance.mark("".concat(e, "_start")),
this.entryHash[e] = r)
}
}, {
key: "measure",
value: function measure(e) {
var r = this.entryHash[e];
if (!r)
return {};
try {
performance.measure(e, "".concat(e, "_start"), "".concat(e, "_end"))
} catch (e) {
return {}
}
var i = (0,
j._)(performance.getEntriesByName(e, "measure"), 1)[0];
return (0,
g._)((0,
v._)({}, r), {
measure: toDict(i)
})
}
}]),
HttpTracker
}();
function createHttpTracker() {
return new er
}
var en = Array(16);
function mathRNG() {
for (var e, r = 0; r < 16; r++)
(3 & r) == 0 && (e = 0x100000000 * Math.random()),
en[r] = e >>> ((3 & r) << 3) & 255;
return en
}
var ei = "x-b3-traceid"
, eo = new (function(e) {
function BrowserHttpRequestTiming() {
var e;
return (0,
A._)(this, BrowserHttpRequestTiming),
e = (0,
P._)(this, BrowserHttpRequestTiming, arguments),
(0,
f._)(e, "httpTracker", {}),
e
}
return (0,
R._)(BrowserHttpRequestTiming, e),
(0,
D._)(BrowserHttpRequestTiming, [{
key: "measure",
value: function measure(e, r) {
this.httpTracker.track(e, r);
var i = this.httpTracker.measure(e)
, a = i.measure
, s = void 0 === a ? {} : a
, u = (0,
H._)(i, ["measure"]);
return s.name = u.url,
delete u.url,
{
meta: u,
measure: s
}
}
}, {
key: "observe",
value: function observe() {
var e = this
, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, i = this
, a = r.httpClient
, s = r.callback
, u = r.enableResponseData
, c = void 0 !== u && u;
this.validate(r, [{
prop: "httpClient",
required: !0
}, {
prop: "callback",
required: !0,
validator: function(e) {
return "function" == typeof e
}
}]),
this.httpTracker = createHttpTracker(),
a.interceptors.request.use(function(r) {
return !isForbiddenUrl(r.url) && (r.rid = (0,
O.Z)({
rng: mathRNG
}),
e.httpTracker.track(r.rid, {
method: r.method,
matchedPath: r.matchedPath,
traceId: r.headers[ei]
})),
r
}),
a.interceptors.response.use(function(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}
, a = arguments.length > 2 ? arguments[2] : void 0
, u = null !== (m = null != a ? a : r.config) && void 0 !== m ? m : {};
if (isForbiddenUrl(u.url))
return e;
var l = r.request || {}
, d = {
status: r.status,
url: l.responseURL
}
, p = i.measure(u.rid, d);
if (p.meta.url = u.url,
u.level && (p.meta.level = u.level),
!0 === c) {
if (e && "[object FormData]" === Object.prototype.toString.call(e)) {
var f = {}
, v = !0
, g = !1
, h = void 0;
try {
for (var m, _, y = e.entries()[Symbol.iterator](); !(v = (_ = y.next()).done); v = !0) {
var w = _.value;
f[w[0]] = w[1]
}
} catch (e) {
g = !0,
h = e
} finally {
try {
!v && null != y.return && y.return()
} finally {
if (g)
throw h
}
}
p.meta.data = JSON.stringify(f)
} else
e && (p.meta.data = JSON.stringify(e))
}
return void 0 !== e.success && !1 == !!e.success && (p.meta.errorType = "HTTPBizError",
p.meta.errorCode = e.code,
p.meta.errorMsg = e.msg),
s(p),
e
}, function(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}
, u = arguments.length > 2 ? arguments[2] : void 0
, c = null !== (g = null != u ? u : r ? r.config : {}) && void 0 !== g ? g : {}
, l = {
meta: {
method: c.method,
matchedPath: c.matchedPath,
status: e.status || e.statusCode || 0,
errorType: e.name,
traceId: c.headers[ei],
url: c.url,
errorMsg: e.message
},
measure: {
entryType: "measure",
name: serializeParams(c.url, null !== (h = c.params) && void 0 !== h ? h : {})
}
};
if (c.level && (l.meta.level = c.level),
["HTTPClientError", "HTTPServerError"].includes(e.name)) {
if (c.params && Object.keys(c.params).length > 0 && isFunc(a.getUri) && (l.meta.url = a.getUri(c)),
c.data && "[object FormData]" === Object.prototype.toString.call(c.data)) {
var d = {}
, p = !0
, f = !1
, v = void 0;
try {
for (var g, h, m, _ = c.data.entries()[Symbol.iterator](); !(p = (m = _.next()).done); p = !0) {
var y = m.value;
d[y[0]] = y[1]
}
} catch (e) {
f = !0,
v = e
} finally {
try {
!p && null != _.return && _.return()
} finally {
if (f)
throw v
}
}
l.meta.data = JSON.stringify(d)
} else
c.data && (l.meta.data = JSON.stringify(c.data));
"HTTPClientError" === e.name ? e.code && "N/A" !== e.code && (l.meta.code = e.code) : "HTTPServerError" === e.name && e.code && "N/A" !== e.code && (l.meta.errorCode = e.code),
s(i.responseCatchHook(l, e, c))
}
throw e
})
}
}]),
BrowserHttpRequestTiming
}(Q));
function getMemory() {
var e = toDict(window.performance.memory);
return {
jsHeapSizeLimit: e.jsHeapSizeLimit,
totalJsHeapSize: e.totalJSHeapSize,
usedJsHeapSize: e.usedJSHeapSize
}
}
function getNetwork() {
var e = toDict(window.navigator.connection);
return void 0 !== e.onchange && delete e.onchange,
{
downlink: e.downlink,
effectiveType: e.effectiveType,
rtt: e.rtt,
saveData: e.saveData,
type: e.type
}
}
function getRenderTimes() {
var e = window.performance.getEntriesByType("mark");
return {
firstRenderStart: getTimeFromMarks(e, "firstRenderStart"),
clientRenderStart: getTimeFromMarks(e, "clientRenderStart")
}
}
function getScriptsExecutionTiming() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window.__SCRIPTS_EXECUTION_TIMING__;
return (e || []).map(function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, r = (0,
v._)({}, e);
return r.endTime && r.startTime ? (r.duration = r.endTime - r.startTime,
delete r.endTime) : r.duration = 0,
r
})
}
function getResourceError() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "__APM__ResourceErrorTracker__"
, r = JSON.parse(localStorage.getItem(e));
if (null == r ? void 0 : r.length) {
for (var i = [], a = [], s = 0; s < r.length; s++)
if ("xhs-pc-web" === r[s].projectName) {
var u = r[s]
, c = (u.projectName,
(0,
H._)(u, ["projectName"]));
i.push(c)
} else
r[s].projectName && a.push(r[s]);
return localStorage.setItem(e, JSON.stringify(a)),
i
}
return []
}
var ea = new (function(e) {
function EnhancedMetrics() {
return (0,
A._)(this, EnhancedMetrics),
(0,
P._)(this, EnhancedMetrics, arguments)
}
return (0,
R._)(EnhancedMetrics, e),
(0,
D._)(EnhancedMetrics, [{
key: "timing",
value: function timing() {
return {
memory: getMemory(),
network: getNetwork(),
renderTimes: getRenderTimes(),
scriptsExecutionTiming: getScriptsExecutionTiming(),
resourceError: getResourceError()
}
}
}]),
EnhancedMetrics
}(Q));
function splitEntries() {
for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 30, i = []; e.length; ) {
var a = e.slice(0, r);
i.push(a),
e = e.slice(r)
}
return i
}
var es = function() {
function PerformanceCollector(e) {
var r = this
, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
(0,
A._)(this, PerformanceCollector),
(0,
f._)(this, "tracker", void 0),
this.tracker = e,
this.observeRequestTiming(i),
window.addEventListener("load", function() {
return setTimeout(function() {
return r.track()
}, 0)
}),
supportUserTiming() && (this.observePaintTiming(),
this.handleResourceBuffer())
}
return (0,
D._)(PerformanceCollector, [{
key: "handleResourceBuffer",
value: function handleResourceBuffer() {
var e = this;
window.performance.onresourcetimingbufferfull = window.performance.onwebkitresourcetimingbufferfull = function() {
e.sendResourceBuffer()
}
,
(0,
q.Ld)("viewDidDisappear", function() {
return e.sendResourceBuffer()
})
}
}, {
key: "getResourceTiming",
value: function getResourceTiming() {
return {
type: "BrowserResourceTiming",
value: ee.timing()
}
}
}, {
key: "track",
value: function track() {
var e, r = ea.timing();
this.sendMetrics({
browserMemory: {
type: "BrowserMemory",
value: r.memory
}
}),
this.sendMetrics({
browserNetwork: {
type: "BrowserNetwork",
value: r.network
}
}),
supportNavigationTiming() && this.sendMetrics({
browserNavigationTiming: {
type: "BrowserNavigationTiming",
value: et.timing()
}
}),
r.scriptsExecutionTiming.length > 0 && this.sendMetrics({
browserScriptsExecutionTiming: {
type: "BrowserPerformanceMeasure",
value: r.scriptsExecutionTiming
}
}),
supportUserTiming() && (this.sendMetrics({
browserResourceTiming: this.getResourceTiming()
}),
r.renderTimes && this.sendMetrics({
browserRenderTimes: {
type: "BrowserRenderTimes",
value: r.renderTimes
}
})),
(null === (e = r.resourceError) || void 0 === e ? void 0 : e.length) > 0 && this.sendMetrics({
browserResourceError: {
type: "BrowserResourceError",
value: r.resourceError
}
})
}
}, {
key: "detectBrowserFeatures",
value: function detectBrowserFeatures() {
var e = this
, r = {
type: "BrowserModernizrFeature",
value: []
};
Promise.all([i.e("39"), i.e("37")]).then(i.t.bind(i, 51951, 23)).then(function() {
Object.keys(window.Modernizr).forEach(function(e) {
var i = window.Modernizr[e];
"boolean" == typeof i ? r.value.push({
name: e,
isSupport: i
}) : r.value.push({
name: e,
detail: JSON.stringify(i)
})
}),
e.sendMetrics({
browserModernizrFeature: r
})
})
}
}, {
key: "observePaintTiming",
value: function observePaintTiming() {
var e = this;
$.observe().then(function(r) {
var i = r.paintTimes
, a = (0,
H._)(r, ["paintTimes"]);
e.sendMetrics({
browserPaintTimes: {
type: "BrowserPaintTimes",
value: i
}
}),
e.sendMetrics({
browserFmpTimes: {
type: "BrowserFmpTimes",
value: a
}
})
})
}
}, {
key: "observeRequestTiming",
value: function observeRequestTiming() {
var e = this
, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
eo.observe((0,
v._)({
httpClient: U.dJ,
callback: function(r) {
var i;
e.sendMetrics({
measurement_name: "httpRequestTiming",
measurement_data: (0,
g._)((0,
v._)({}, r.meta || void 0), {
duration: null === (i = r.measure) || void 0 === i ? void 0 : i.duration
})
})
}
}, r))
}
}, {
key: "sendMetrics",
value: function sendMetrics() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
if (!!this.tracker && void 0 !== this.tracker.push && "function" == typeof this.tracker.push && 0 !== Object.keys(e).length) {
if (e.measurement_name) {
this.tracker.push(e, "ApmXrayTracker");
return
}
this.tracker.push({
browserApmTracker: {
type: "BrowserApmTracker",
value: e
}
}, "ApmTracker")
}
}
}, {
key: "sendResourceBuffer",
value: function sendResourceBuffer() {
var e = this.getResourceTiming()
, r = e.type
, i = e.value;
if (!!i.length)
for (var a = splitEntries(i, 50); a.length; )
this.sendMetrics((0,
f._)({}, r, {
type: r,
value: a.shift()
}))
}
}]),
PerformanceCollector
}();
function createPerformanceCollector(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return new es(e,r)
}
var eu = i(28934);
i(85203);
var ec = {
android: "7617000",
ios: "7700000"
}
, el = ["pageview", "page_end", "page_info", "impression", "modal_show", "modal_hide", "popup_show", "popup_hide"]
, ed = ["undefined", "default", "back", "foreground"]
, ep = ""
, ef = {
value: "default"
}
, judgePlatform = function() {
if (y.YF.isIOS)
return y.YF.isXHS ? "iOS" : "iOSBrowser";
if (y.YF.isAndroid)
return y.YF.isXHS ? "Android" : "AndroidBrowser";
return "PC"
}
, getPointInfo = function(e, r) {
var i, a, s, u, c, l, d, p, f, v, g, h, m, _, y, w, E, S = "", T = "", b = 0, k = 0, C = 0, P = 0, A = 0, R = 0;
if ((null === (a = e.event) || void 0 === a ? void 0 : null === (i = a.value) || void 0 === i ? void 0 : i.pointId) && (b = e.event.value.pointId),
null === (c = e.page) || void 0 === c ? void 0 : null === (u = c.value) || void 0 === u ? void 0 : null === (s = u.pageInstance) || void 0 === s ? void 0 : s.value) {
S = e.page.value.pageInstance.value;
var I = e.page.value.pageInstance.value.toUpperCase();
k = (null == r ? void 0 : r.PageInstance["".concat(I)]) || 0
}
if (null === (p = e.event) || void 0 === p ? void 0 : null === (d = p.value) || void 0 === d ? void 0 : null === (l = d.action) || void 0 === l ? void 0 : l.value) {
var O = e.event.value.action.value.toUpperCase();
C = (null == r ? void 0 : r.NormalizedAction["".concat(O)]) || 0
}
if (null === (g = e.event) || void 0 === g ? void 0 : null === (v = g.value) || void 0 === v ? void 0 : null === (f = v.actionInteractionType) || void 0 === f ? void 0 : f.value) {
var N = e.event.value.actionInteractionType.value.toUpperCase();
P = (null == r ? void 0 : r.ActionInteractionType["".concat(N)]) || 0
}
if (null === (_ = e.event) || void 0 === _ ? void 0 : null === (m = _.value) || void 0 === m ? void 0 : null === (h = m.targetType) || void 0 === h ? void 0 : h.value) {
var L = e.event.value.targetType.value.toUpperCase();
A = (null == r ? void 0 : r.RichTargetType["".concat(L)]) || 0
}
if (null === (E = e.event) || void 0 === E ? void 0 : null === (w = E.value) || void 0 === w ? void 0 : null === (y = w.targetDisplayType) || void 0 === y ? void 0 : y.value) {
var M = e.event.value.targetDisplayType.value.toUpperCase();
R = (null == r ? void 0 : r.TargetDisplayType["".concat(M)]) || 0
}
return T = "".concat(k, "^").concat(C, "^").concat(P, "^").concat(A, "^").concat(R),
{
pointId: b,
pageInstanceStr: S,
pageInstance: k,
action: C,
actionInteractionType: P,
targetType: A,
targetDisplayType: R,
referKey: T
}
};
function flowSourcePointProcess(e, r) {
return _flowSourcePointProcess.apply(this, arguments)
}
function _flowSourcePointProcess() {
return (_flowSourcePointProcess = (0,
p._)(function(e, r) {
var i, a, s, u, c, l, d, p, f, v, g, h, m, y, w, E, S, T, b, k, C, P, A, R, I, O, N, L, M, B, x, D, F;
return (0,
_.Jh)(this, function(_) {
switch (_.label) {
case 0:
if (v = null == e ? void 0 : null === (a = e.app) || void 0 === a ? void 0 : null === (i = a.value) || void 0 === i ? void 0 : i.buildId,
"PC" === (g = judgePlatform()) || "iOSBrowser" === g || "AndroidBrowser" === g || "Android" === g && v < ec.android || "iOS" === g && v < ec.ios)
return [2, e];
if ((null === (c = e.event) || void 0 === c ? void 0 : null === (u = c.value) || void 0 === u ? void 0 : null === (s = u.action) || void 0 === s ? void 0 : s.value) !== "pageview")
return [3, 8];
y = (m = getPointInfo(e, r)).pointId,
w = m.pageInstanceStr,
E = m.referKey,
S = {
type: 2,
spv_type: ef.value,
page_instance: w
},
y ? S.point_id = y : (S.point_id = 0,
S.refer_key = E),
_.label = 1;
case 1:
return _.trys.push([1, 3, , 4]),
[4, (0,
eu.dw)("addApmReferV2", S)];
case 2:
return _.sent(),
[3, 4];
case 3:
return T = _.sent(),
k = /^(addApmReferV2).*-12002_.*/i,
T.message && k.test(T.message) ? (C = T.message.split(":")[1].trim(),
ep = '[{"t":"E","m":"'.concat(C, '"}]')) : ep = '[{"t":"E","m":"-1010"}]',
e.event.value.rp = ep,
(null === (b = e.page) || void 0 === b ? void 0 : b.value) && (e.page.value.spvType = S.spv_type),
ef.value = "default",
[2, e];
case 4:
return _.trys.push([4, 6, , 7]),
[4, (0,
eu.dw)("getApmReferPathV2", {})];
case 5:
return ep = null == (P = _.sent()) ? void 0 : P.value,
[3, 7];
case 6:
return _.sent(),
ep = '[{"t":"E","m":"-1010"}]',
e.event.value.rp = ep,
(null === (R = e.page) || void 0 === R ? void 0 : R.value) && (e.page.value.spvType = S.spv_type),
ef.value = "default",
[2, e];
case 7:
e.event.value.rp = ep,
(null === (h = e.page) || void 0 === h ? void 0 : h.value) && (e.page.value.spvType = S.spv_type),
ef.value = "default",
_.label = 8;
case 8:
if (-1 !== el.indexOf(null === (p = e.event) || void 0 === p ? void 0 : null === (d = p.value) || void 0 === d ? void 0 : null === (l = d.action) || void 0 === l ? void 0 : l.value))
return [3, 12];
O = (I = getPointInfo(e, r)).pointId,
N = I.pageInstanceStr,
L = I.referKey,
M = {
type: 1,
page_instance: N
},
O ? M.point_id = O : (M.point_id = 0,
M.refer_key = L),
_.label = 9;
case 9:
return _.trys.push([9, 11, , 12]),
[4, (0,
eu.dw)("addApmReferV2", M)];
case 10:
return _.sent(),
[3, 12];
case 11:
return B = _.sent(),
D = /^(addApmReferV2).*-12002_.*/i,
B.message && D.test(B.message) ? (F = B.message.split(":")[1].trim(),
ep = '[{"t":"E","m":"'.concat(F, '"}]')) : ep = '[{"t":"E","m":"-1010"}]',
(null === (x = e.event) || void 0 === x ? void 0 : x.value) && (e.event.value.rp = ep),
[2, e];
case 12:
return (null === (f = e.event) || void 0 === f ? void 0 : f.value) && (e.event.value.rp = ep),
[2, e]
}
})
})).apply(this, arguments)
}
function flowSourceConfig() {
window.addEventListener("customPopState", function(e) {
ef.value = e.detail.spvType
})
}
var ev = {
PAGEVIEW: {
AFTEREACH: 1,
VIEWDIDAPPEAR: 2,
FOCUS: 3,
VISIBLE: 4
},
PAGE_END: {
BEFOREEACH: 1,
VIEWDIDDISAPPEAR: 2,
BLUR: 3,
HIDDEN: 4,
BEFOREUNLOAD: 5
}
}
, eg = {
value: !1
}
, eh = !0
, duration_judgePlatform = function() {
if (y.YF.isIOS)
return y.YF.isXHS ? "iOS" : "iOSBrowser";
if (y.YF.isAndroid)
return y.YF.isXHS ? "Android" : "AndroidBrowser";
return "PC"
}
, em = 0
, reportPv = function(e, r, i, a, s) {
eh = !1,
a.then(function() {
var a;
if ("function" == typeof (null == i ? void 0 : null === (a = i.meta) || void 0 === a ? void 0 : a.getTrackerData)) {
var u, c = i.meta.getTrackerData(i);
c instanceof Promise ? c.then(function(r) {
var i;
e.push((0,
g._)((0,
v._)({}, r), {
page: {
type: "Page",
value: (0,
v._)({
initiatorType: s
}, null == r ? void 0 : null === (i = r.page) || void 0 === i ? void 0 : i.value)
}
}))
}) : c && e.push((0,
g._)((0,
v._)({}, c), {
page: {
type: "Page",
value: (0,
v._)({
initiatorType: s
}, null == c ? void 0 : null === (u = c.page) || void 0 === u ? void 0 : u.value)
}
}))
} else if (r)
throw Error("[eagletPlugin] `getTrackerData` in route.meta is necessary when use liteTracker!");
else
e.flush({
event: {
type: "Event",
value: {
action: {
type: "NormalizedAction",
value: "pageview"
},
seAction: "pageview"
}
},
page: {
type: "Page",
value: {
initiatorType: s
}
}
})
})
}
, e_ = function() {
function PageDurationCollector(e, r, i, a) {
var s = this;
(0,
A._)(this, PageDurationCollector),
(0,
f._)(this, "tracker", void 0),
(0,
f._)(this, "firstEnter", void 0),
(0,
f._)(this, "pageStartTime", void 0),
(0,
f._)(this, "trackPageView", void 0),
(0,
f._)(this, "blurAndVisibilityFlag", void 0),
(0,
f._)(this, "route", void 0),
(0,
f._)(this, "durationMsData", void 0),
(0,
f._)(this, "appearListener", void 0),
(0,
f._)(this, "disappearListener", void 0),
(0,
f._)(this, "appearListenerIOS", void 0),
(0,
f._)(this, "disappearListenerIOS", void 0),
this.tracker = r,
this.firstEnter = !0,
this.pageStartTime = Date.now(),
this.trackPageView = a.trackPageView,
this.blurAndVisibilityFlag = {
pvReady: !1,
peReady: !0
},
this.route = {},
this.durationMsData = 0,
this.appearListener = {
remove: function() {
return null
}
},
this.disappearListener = {
remove: function() {
return null
}
},
this.appearListenerIOS = {
remove: function() {
return null
}
},
this.disappearListenerIOS = {
remove: function() {
return null
}
};
var trackPageEnd = function(e, r) {
i.then(function() {
if (!eh) {
em = -1,
s.durationMsData = s.durationMs();
var a, u = e || s.route;
if ("function" == typeof (null == u ? void 0 : null === (a = u.meta) || void 0 === a ? void 0 : a.getPageEnd)) {
var c = u.meta.getPageEnd(s.route);
i.then(function() {
if (c instanceof Promise)
c.then(function(e) {
var i, a = (0,
g._)((0,
v._)({}, e), {
page: {
type: "Page",
value: (0,
v._)({
initiatorType: r,
durationMs: s.durationMsData
}, null == e ? void 0 : null === (i = e.page) || void 0 === i ? void 0 : i.value)
}
});
eg.value && (a._uba_sendBeacon = !0,
eg.value = !1),
s.tracker.push(a),
eh = !0
});
else {
var e, i = (0,
g._)((0,
v._)({}, c), {
page: {
type: "Page",
value: (0,
v._)({
initiatorType: r,
durationMs: s.durationMsData
}, null == c ? void 0 : null === (e = c.page) || void 0 === e ? void 0 : e.value)
}
});
eg.value && (i._uba_sendBeacon = !0,
eg.value = !1),
s.tracker.push(i),
eh = !0
}
s.pageStartTime = 0
})
}
}
})
}
, getTrackerData = function(e) {
reportPv(s.tracker, void 0, s.route, i, e)
}
, handleViewDisappear = function(e) {
var r, i, a = null === (i = s.route) || void 0 === i ? void 0 : null === (r = i.meta) || void 0 === r ? void 0 : r.pageInstance;
!s.firstEnter && s.trackPageView && a && trackPageEnd(s.route, e)
}
, handleDidViewAppear = function(e, r) {
var i, a, u = (null == e ? void 0 : e.result) || 1;
ef.value = ed[u],
s.firstEnter = !1,
s.pageStartTime = Date.now();
var c = null === (a = s.route) || void 0 === a ? void 0 : null === (i = a.meta) || void 0 === i ? void 0 : i.pageInstance;
s.trackPageView && c && getTrackerData(r)
}
, handleVisibleVisible = function(e) {
s.pageStartTime = Date.now();
var r, i, a = null === (i = s.route) || void 0 === i ? void 0 : null === (r = i.meta) || void 0 === r ? void 0 : r.pageInstance;
s.trackPageView && a && getTrackerData(e)
}
, handleVisibleHidden = function(e) {
var r, i, a = null === (i = s.route) || void 0 === i ? void 0 : null === (r = i.meta) || void 0 === r ? void 0 : r.pageInstance;
s.trackPageView && a && trackPageEnd(s.route, e)
}
, viewDidAppear = function(e) {
if (0 === em) {
em = -1;
return
}
handleDidViewAppear(e, ev.PAGEVIEW.VIEWDIDAPPEAR)
}
, viewDidDisAppear = function(e) {
!e && (e = ev.PAGE_END.VIEWDIDDISAPPEAR),
handleViewDisappear(e)
}
, viewDidDisAppearWrapper = function() {
viewDidDisAppear(ev.PAGE_END.VIEWDIDDISAPPEAR)
}
, visibilitychangeVisible = function(e) {
handleVisibleVisible(e)
}
, visibilitychangeHidden = function(e) {
handleVisibleHidden(e)
};
y.YF.isXHS ? ("Android" === duration_judgePlatform() && (this.appearListener = (0,
eu.Ld)("viewDidAppear", viewDidAppear),
this.disappearListener = (0,
eu.Ld)("viewDidDisappear", viewDidDisAppearWrapper)),
"iOS" === duration_judgePlatform() && (this.appearListenerIOS = (0,
eu.Ld)("viewDidAppear", viewDidAppear),
this.disappearListenerIOS = (0,
eu.Ld)("viewDisappear", viewDidDisAppearWrapper))) : (window.addEventListener("visibilitychange", function() {
"visible" === document.visibilityState && s.blurAndVisibilityFlag.pvReady ? (s.updateBlurAndVisibilityFlag(!1, !0),
visibilitychangeVisible(ev.PAGEVIEW.VISIBLE)) : "hidden" === document.visibilityState && s.blurAndVisibilityFlag.peReady && (s.updateBlurAndVisibilityFlag(!0, !1),
visibilitychangeHidden(ev.PAGE_END.HIDDEN))
}),
window.addEventListener("beforeunload", function() {
if ("hidden" !== document.visibilityState)
eg.value = !0,
s.updateBlurAndVisibilityFlag(!0, !1),
viewDidDisAppear(ev.PAGE_END.BEFOREUNLOAD)
}),
window.addEventListener("focus", function() {
s.blurAndVisibilityFlag.pvReady && (s.updateBlurAndVisibilityFlag(!1, !0),
visibilitychangeVisible(ev.PAGEVIEW.FOCUS))
}),
window.addEventListener("blur", function() {
s.blurAndVisibilityFlag.peReady && (s.updateBlurAndVisibilityFlag(!0, !1),
visibilitychangeHidden(ev.PAGE_END.BLUR))
}));
var handleBeforeRouteViewDisappear = function(e, r) {
var i, a = null === (i = s.route.meta) || void 0 === i ? void 0 : i.pageInstance;
s.firstEnter ? s.firstEnter = !1 : s.trackPageView && a && trackPageEnd(e, r)
}
, handlerAfterRouteDidViewAppear = function(e) {
s.route = e,
s.pageStartTime = Date.now()
};
e.router.beforeEach(function(e, r, i) {
handleBeforeRouteViewDisappear(r, ev.PAGE_END.BEFOREEACH),
"function" == typeof i && i()
}),
e.router.afterEach(function(e, r) {
handlerAfterRouteDidViewAppear(e)
})
}
return (0,
D._)(PageDurationCollector, [{
key: "durationMs",
value: function durationMs() {
return 0 === this.pageStartTime ? 0 : Date.now() - this.pageStartTime
}
}, {
key: "updateBlurAndVisibilityFlag",
value: function updateBlurAndVisibilityFlag(e, r) {
this.blurAndVisibilityFlag.pvReady = e,
this.blurAndVisibilityFlag.peReady = r
}
}]),
PageDurationCollector
}();
function createPageDurationCollector(e, r, i, a) {
return new e_(e,r,i,a)
}
function isHTTPError(e) {
return ["HTTPClientError", "HTTPServerError", "HTTPBizError"].includes(e)
}
function ignoreDefaultError(e) {
return !!(e.errorType && isHTTPError(e.errorType)) || "AbortError" === e.errorType && "AbortError" === e.errorMessage || !1
}
function isIgnoreErrors(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : []
, i = "".concat(null == e ? void 0 : e.errorType, ": ").concat(null == e ? void 0 : e.errorMessage);
return r.includes(i)
}
function getErrorOptions(e) {
var r = e || {}
, i = r.level
, a = r.title
, s = r.extra
, u = void 0 === s ? null : s;
return {
errorLevel: i,
errorExtra: JSON.stringify((0,
v._)({
title: a
}, (void 0 === u ? "undefined" : (0,
m._)(u)) === "object" && u))
}
}
function catchHttpNetworkError(e) {
var r = e.config || {
method: "",
url: "",
data: "",
params: ""
}
, i = r.method
, a = r.url
, s = r.data
, u = r.params;
return {
measurement_name: "httpRequestTiming",
measurement_data: {
method: i,
errorType: "HTTPNetworkError",
url: a,
errorMsg: e.message,
data: "get" === i ? u : s
}
}
}
function parseError(e, r) {
if (e instanceof Error) {
var i = e.message
, a = ""
, s = 0
, u = 0
, c = e.name
, l = "";
if (e.stack) {
for (var d, p = null === (d = e.stack) || void 0 === d ? void 0 : d.split("\n"), f = 0; f < (null == p ? void 0 : p.length); f++) {
var g = /:(\d+:\d+)\)$/.exec(p[f]);
if (null == g ? void 0 : g[1]) {
var h = g[1].split(":");
a = p[f],
s = parseInt(h[0], 10) || 0,
u = parseInt(h[1], 10) || 0;
break
}
}
}
return e.stack && (l = e.stack),
(0,
v._)({
errorLineNumber: s,
errorColNumber: u,
errorFilePath: null == a ? void 0 : a.trim(),
errorStack: l,
errorType: c,
errorMessage: i
}, r && getErrorOptions(r))
}
return "string" == typeof e ? (0,
v._)({
errorType: "Error",
errorMessage: e
}, r && getErrorOptions(r)) : null
}
function collector_jsError(e, r, i, a) {
for (var s, u, c, l, d, sendInfraJsError = function sendInfraJsError(e) {
if (!(isIgnoreErrors(e, f) || !0 === h && ignoreDefaultError(e)))
(null == g || !g(e)) && (window.apm_blankScreen_error = {
errorType: "JSError",
content: e.errorMessage
},
i.push({
measurement_name: "infraJsError",
measurement_data: e
}, "ApmXrayTracker").catch(function(e) {}))
}, sendVueError = function sendVueError(e) {
var r = parseError(e);
r && sendInfraJsError((0,
v._)({
type: "vueError"
}, r))
}, p = (0,
v._)({
enableIgnoreDefaultError: !0,
ignoreErrors: [],
ignoreError: null
}, (void 0 === a ? "undefined" : (0,
m._)(a)) === "object" && a), f = p.ignoreErrors, g = p.ignoreError, h = p.enableIgnoreDefaultError, _ = p.microApp, y = window.__ERROR_TRACKER_BUFFER__ || []; y.length; ) {
var w = y.shift()
, E = w.error
, S = w.extra
, T = S.colno
, b = S.lineno
, k = S.source;
sendInfraJsError({
type: "onerror",
errorLineNumber: b,
errorColNumber: T,
errorFilePath: null == k ? void 0 : k.trim(),
errorStack: null == E ? void 0 : E.stack,
errorType: null == E ? void 0 : E.name,
errorMessage: String((null == E ? void 0 : E.message) || E)
})
}
if ((null === (s = r.version) || void 0 === s ? void 0 : s.startsWith("3")) && (null == e ? void 0 : null === (c = e.vm) || void 0 === c ? void 0 : null === (u = c.config) || void 0 === u ? void 0 : u.errorHandler) ? e.vm.config.errorHandler = function(e) {
sendVueError(e)
}
: (null == r ? void 0 : null === (d = r.Vue) || void 0 === d ? void 0 : null === (l = d.config) || void 0 === l ? void 0 : l.errorHandler) && (r.Vue.config.errorHandler = function(e) {
sendVueError(e)
}
),
!_)
window.onerror = function(e, r, i, a, s) {
sendInfraJsError({
type: "onerror",
errorLineNumber: i,
errorColNumber: a,
errorFilePath: null == r ? void 0 : r.trim(),
errorStack: null == s ? void 0 : s.stack,
errorType: null == s ? void 0 : s.name,
errorMessage: String(e)
})
}
,
window.addEventListener("unhandledrejection", function(e) {
var r = ""
, a = ""
, s = 0
, u = 0
, c = null == e ? void 0 : null === (p = e.reason) || void 0 === p ? void 0 : p.name
, l = "";
if ("string" == typeof e.reason)
r = e.reason;
else if ("object" === (0,
m._)(e.reason)) {
if (e.reason.isAxiosError) {
var d = catchHttpNetworkError(e.reason);
i.push(d, "ApmXrayTracker");
return
}
if (e.reason.stack) {
for (var p, f, v = null === (f = e.reason.stack) || void 0 === f ? void 0 : f.split("\n"), g = 0; g < (null == v ? void 0 : v.length); g++) {
var h = /:(\d+:\d+)\)$/.exec(v[g]);
if (null == h ? void 0 : h[1]) {
var _ = h[1].split(":");
a = v[g],
s = parseInt(_[0], 10) || 0,
u = parseInt(_[1], 10) || 0;
break
}
}
}
r = e.reason.message,
l = e.reason.stack
}
sendInfraJsError({
type: "promise",
errorLineNumber: s,
errorColNumber: u,
errorFilePath: null == a ? void 0 : a.trim(),
errorStack: l,
errorType: c,
errorMessage: r
})
})
}
var ey = !1;
function generateRandomCheckPoint(e, r) {
e = e || 5,
r = r || 10;
for (var i = window.innerHeight, a = window.innerWidth, s = [], u = 1; u <= e; u++) {
for (var c = i / (e + 1) * u, l = 1; l <= r; l++) {
var d = a / (r + 1) * l;
s.push({
x: d,
y: c
})
}
}
return s
}
function calculateDomDepth(e) {
for (var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 10, i = arguments.length > 2 ? arguments[2] : void 0, a = 0, s = i ? document.querySelector(i) : null; e && "BODY" !== e.tagName && s !== e && a < r; )
e = e.parentElement,
a++;
return a
}
function calculateBlankScreenRatio(e) {
try {
var r = 0
, i = e.domThreshold
, a = generateRandomCheckPoint(e.lines, e.columns);
return a.forEach(function(a) {
var s = (document.elementsFromPoint(a.x, a.y) || [])[0];
s && calculateDomDepth(s, e.maxDepth, e.rootElementSelector) < i && r++
}),
r / a.length
} catch (e) {}
return 0
}
function blank_screen_screenshot(e, r) {
var html2image = function html2image() {
window.html2canvas && window.html2canvas(document.body, {
scale: 360 / window.innerWidth
}).then(function(i) {
r.measurement_data.img = i.toDataURL("image/jpeg", .2),
e.push(r, "ApmXrayTracker")
})
};
if (window.html2canvas)
return html2image();
var i = document.createElement("script");
i.src = "https://fe-video-qc.xhscdn.com/fe-platform/abf6e0874371419fa6fffa7540610e2013588fe6/html2canvas.min.js",
document.head.appendChild(i),
i.onload = function() {
html2image()
}
}
function checkBlankScreenError(e, r) {
try {
if (!document.elementsFromPoint || "function" != typeof document.elementsFromPoint || ey)
return;
ey = !0,
setTimeout(function() {
ey = !1
}, 1e4);
var i = calculateBlankScreenRatio(r);
if (i > (r.threshold || .7)) {
var a, s = {
ratio: i
};
(null === (a = window.apm_blankScreen_error) || void 0 === a ? void 0 : a.errorType) ? (s.errorType = window.apm_blankScreen_error.errorType,
s.content = window.apm_blankScreen_error.content) : performance.timing.loadEventStart ? s.errorType = "other" : s.errorType = "performance",
window.apm_blankScreen_error = null;
var u = {
measurement_name: "blankScreenError",
measurement_data: s
};
r.screenshot ? blank_screen_screenshot(e, u) : e.push(u, "ApmXrayTracker")
}
} catch (e) {}
}
var throwError = function(e) {
throw Error("[Eaglet Exception] ".concat(e))
}
, capitalize = function(e) {
return "string" == typeof e ? e.replace(/\b\w/g, function(e) {
return e.toUpperCase()
}) : e
}
, isObject = function(e) {
return e && "[object Object]" === Object.prototype.toString.call(e)
}
, ew = function() {
function ProtoBuilder(e) {
(0,
A._)(this, ProtoBuilder),
this.builder = e
}
return (0,
D._)(ProtoBuilder, [{
key: "getMessageBuilder",
value: function getMessageBuilder(e) {
return !this.builder[e] && throwError("no message type found: `".concat(e, "`")),
new this.builder[e]
}
}, {
key: "getProtoSetter",
value: function getProtoSetter(e, r, i, a) {
var s = "set".concat(capitalize(i))
, u = a;
return u && u.value && (u = u.value),
Array.isArray(u) && (s += "List"),
!r[s] && throwError("no match setter `".concat(s, "` for `").concat(capitalize(i), "` in proto.").concat(e)),
s
}
}, {
key: "format",
value: function format(e, r) {
var i = this;
if (Array.isArray(r))
return r.map(function(r) {
return i.format(e, r)
});
var a = this.getMessageBuilder(e);
return Object.keys(r).forEach(function(s) {
var u = i.getProtoSetter(e, a, s, r[s]);
if (isObject(r[s])) {
var c = r[s]
, l = c.type
, d = c.value;
if ((!l || !i.builder[l]) && throwError("no match type `".concat(l, "` in `").concat(s, "` field")),
isObject(d) || Array.isArray(d)) {
var p = i.format(l, d);
a[u](p)
} else {
var f, v = i.builder[l]["string" == typeof (f = d) ? f.toUpperCase() : f];
void 0 === v && throwError("no match enum `".concat(d, "` in `").concat(l, "` field")),
a[u](v)
}
} else
a[u](r[s])
}),
a
}
}, {
key: "build",
value: function build() {
var e = this
, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "Tracker"
, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
!r && throwError("missing tracker name");
var a = this.getMessageBuilder(r);
return Object.keys(i).forEach(function(s) {
var u = i[s];
(!u.type || !u.value) && throwError("missing `type` or `value` field");
var c = e.getProtoSetter(r, a, s, u.value)
, l = e.format(u.type, u.value);
a[c](l)
}),
a
}
}]),
ProtoBuilder
}();
function createBuilder(e) {
return "function" == typeof e.build ? e : new ew(e)
}
var eE = function() {
function Eaglet(e) {
var r = e.name
, i = e.builder
, a = e.emitter;
(0,
A._)(this, Eaglet),
!r && throwError("missing tracker name"),
!i && throwError("missing builder"),
!a && throwError("missing emitter"),
this.name = r,
this.builder = createBuilder(i),
this.emitter = a
}
return (0,
D._)(Eaglet, [{
key: "push",
value: function push(e) {
var r = this.builder.build(this.name, e);
this.emitter.push(r)
}
}, {
key: "flush",
value: function flush() {
this.emitter.flush()
}
}, {
key: "destroy",
value: function destroy() {
var e;
null === (e = this.emitter) || void 0 === e || e.destroy()
}
}]),
Eaglet
}();
i(18638),
i(96336),
i(87168),
i(14190),
i(4137),
i(70805),
i(5317),
i(81167),
i(22583),
i(89655),
i(88598),
i(11530),
i(16765),
i(3398),
i(90621),
i(35904),
i(73982),
i(87683),
i(59735),
i(69167),
i(27151),
i(95341),
i(53395),
i(10074),
i(31899),
i(98398),
i(94837),
i(53077),
i(14340),
i(31578),
i(46521),
i(49932),
i(78246),
i(62444),
i(34076),
i(12334),
i(68802),
i(76267),
i(83257),
i(90834),
i(907),
i(18552);
for (var eS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", eT = {}, eb = 0; eb < eS.length; eb++)
eT[eb] = eS.charAt(eb);
function splitInt64(e) {
var r = Math.abs(e)
, i = r >>> 0
, a = Math.floor((r - i) / 0x100000000);
return a >>>= 0,
e < 0 && (a = ~a >>> 0,
(i = (~i >>> 0) + 1) > 0xffffffff && (i = 0,
(a += 1) > 0xffffffff && (a = 0))),
{
lowBits: i,
highBits: a
}
}
var ek = {
writeString: function(e) {
for (var r = [], i = 0; i < e.length; i++) {
var a = e.charCodeAt(i);
if (a < 128)
r.push(a);
else if (a < 2048)
r.push(a >> 6 | 192),
r.push(63 & a | 128);
else if (a < 65536) {
if (a >= 55296 && a <= 56319 && i + 1 < e.length) {
var s = e.charCodeAt(i + 1);
s >= 56320 && s <= 57343 && (a = (a - 55296) * 1024 + s - 56320 + 65536,
r.push(a >> 18 | 240),
r.push(a >> 12 & 63 | 128),
r.push(a >> 6 & 63 | 128),
r.push(63 & a | 128),
i += 1)
} else
r.push(a >> 12 | 224),
r.push(a >> 6 & 63 | 128),
r.push(63 & a | 128)
}
}
return r
},
writeInt64: function(e) {
for (var r = splitInt64(e), i = r.lowBits, a = r.highBits, s = []; a > 0 || i > 127; )
s.push(127 & i | 128),
i = (i >>> 7 | a << 25) >>> 0,
a >>>= 7;
return s.push(i),
s
},
writeInt32: function(e) {
var r = [];
return r.push(e >>> 0 & 255),
r.push(e >>> 8 & 255),
r.push(e >>> 16 & 255),
r.push(e >>> 24 & 255),
r
},
writeSignedVarint32: function(e) {
if (e >= 0)
return this.writeUnsignedVarint32(e);
for (var r = [], i = e, a = 0; a < 9; a++)
r.push(127 & i | 128),
i >>= 7;
return r.push(1),
r
},
writeUnsignedVarint32: function(e) {
for (var r = [], i = e; i > 127; )
r.push(127 & i | 128),
i >>>= 7;
return r.push(i),
r
},
writeBoolean: function(e) {
return [+!!e]
},
encodeByteArray: function(e) {
for (var r = [], i = 0; i < e.length; i += 3) {
var a = e[i]
, s = i + 1 < e.length
, u = s ? e[i + 1] : 0
, c = i + 2 < e.length
, l = c ? e[i + 2] : 0
, d = a >> 2
, p = (3 & a) << 4 | u >> 4
, f = (15 & u) << 2 | l >> 6
, v = 63 & l;
!c && (v = 64,
!s && (f = 64)),
r.push(eT[d], eT[p], eT[f] || "", eT[v] || "")
}
return r.join("")
}
};
function getBufferLength(e) {
return ek.writeUnsignedVarint32(e)
}
function builder_getData(e, r, i) {
var a, s = e.match(/\{(\w+):(\w+)\.(\w+)\}/), u = s[1], c = s[2], l = s[3];
if (null === (a = r[c]) || void 0 === a ? void 0 : a.value) {
var d = r[c].value[l];
if ("Enum" === u)
try {
"function" == typeof d.value.toUpperCase && (d = i[d.type][d.value.toUpperCase()])
} catch (r) {
throw Error("not support ".concat(e))
}
return {
value: d,
dataType: u
}
}
return {
value: void 0,
dataType: u
}
}
function encodeData(e, r) {
if (void 0 === r)
return [];
var i = [];
if ("String" === e && "string" == typeof r)
i = ek.writeString(r);
else if ("Int64" === e && "number" == typeof r)
i = ek.writeInt64(r);
else if ("Int32" === e && "number" == typeof r)
i = ek.writeSignedVarint32(r);
else if ("Enum" === e && "number" == typeof r)
i = ek.writeUnsignedVarint32(r);
else if ("Boolean" === e && "boolean" == typeof r)
i = ek.writeBoolean(r);
else
throw Error("not support ".concat(e, ":").concat(r));
return i
}
function buildBlock(e, r, i) {
var a, s = [], u = builder_getData(e.pop(), r, i), c = u.value, l = u.dataType;
if (void 0 === c)
return [];
if ("RepeatedString" === l)
e.pop(),
a = e,
c.forEach(function(e) {
var r = encodeData("String", e);
r.length > 0 && (a.forEach(function(e) {
return s.push(e)
}),
getBufferLength(r.length).forEach(function(e) {
return s.push(e)
}),
r.forEach(function(e) {
return s.push(e)
}))
});
else if ("String" === l) {
e.pop(),
a = e;
var d = encodeData("String", c);
d.length > 0 && (a.forEach(function(e) {
return s.push(e)
}),
getBufferLength(d.length).forEach(function(e) {
return s.push(e)
}),
d.forEach(function(e) {
return s.push(e)
}))
} else
(a = e).forEach(function(e) {
return s.push(e)
}),
encodeData(l, c).forEach(function(e) {
return s.push(e)
});
return s
}
function buildBuffer(e, r, i, a) {
var s = [];
r.forEach(function(i, u) {
if (u % 2 == 1) {
var c = []
, l = r[u - 1];
i.forEach(function(r) {
buildBlock(r, e, a).forEach(function(e) {
c.push(e)
})
}),
c.length > 0 ? (l.pop(),
getBufferLength(c.length).forEach(function(e) {
return l.push(e)
}),
s.push(c)) : s.pop()
} else
s.push(i)
});
var u = 0;
s.forEach(function(e) {
return u += e.length
});
var c = (0,
h._)(ek.writeInt64(u + 4)).concat((0,
h._)(ek.writeInt32(i)));
s = [c].concat((0,
h._)(s));
for (var l = new Uint8Array(u += c.length), d = 0, p = 0; p < s.length; p++) {
var f = s[p];
l.set(f, d),
d += f.length
}
return ek.encodeByteArray(l)
}
function titleCase(e) {
return e.slice(0, 1).toUpperCase() + e.slice(1)
}
var eC = function() {
function LiteEaglet(e) {
var r = e.name
, i = e.emitter
, a = e.trackerEnums
, s = e.versionHash;
if ((0,
A._)(this, LiteEaglet),
(0,
f._)(this, "name", void 0),
(0,
f._)(this, "emitter", void 0),
(0,
f._)(this, "versionHash", void 0),
(0,
f._)(this, "trackerEnums", void 0),
!r)
throw Error("missing name");
if (!i)
throw Error("missing emitter");
if (!a)
throw Error("missing trackerEnums");
if (!s)
throw Error("missing versionHash");
this.name = r,
this.emitter = i,
this.versionHash = s,
this.trackerEnums = a
}
return (0,
D._)(LiteEaglet, [{
key: "push",
value: function push(e) {
var r = e.data
, i = e.templateBuffers
, a = {};
Object.keys(r).forEach(function(e) {
a[titleCase(e)] = r[e]
}),
this.emitter.push(buildBuffer(a, i, this.versionHash, this.trackerEnums))
}
}, {
key: "flush",
value: function flush() {
this.emitter.flush()
}
}]),
LiteEaglet
}();
function needImplement(e) {
throw Error("[Eaglet Emitter Exception] __proto__.".concat(e, " should be implemented"))
}
function argsCheck(e) {
if (!e.versionHash)
throw Error("[Eaglet Emitter Exception] args.versionHash is required");
if (!e.endpoint)
throw Error("[Eaglet Emitter Exception] args.endpoint is required")
}
var eP = function() {
function EmitterBase(e) {
(0,
A._)(this, EmitterBase),
(0,
f._)(this, "buffer", []),
argsCheck(e),
this.versionHash = e.versionHash,
this.endpoint = e.endpoint
}
return (0,
D._)(EmitterBase, [{
key: "shouldFlushBuffer",
value: function shouldFlushBuffer() {
return !0
}
}, {
key: "flush",
value: function flush() {
needImplement("flush")()
}
}, {
key: "push",
value: function push(e) {
this.buffer.push(e),
this.shouldFlushBuffer(e) && this.flush()
}
}]),
EmitterBase
}()
, eA = (0,
q.dh)().then(function(e) {
return e.isTestEnv
}).catch(function() {
return !1
});
function sendToXray(e, r) {
return U.dJ.axios.post(e, r, {
headers: {
"Biz-Type": "apm_fe",
Batch: "true"
},
withCredentials: !1
}).catch(function(e) {})
}
function sendByHttp(e, r) {
return U.dJ.axios.post(e, r, {
headers: {
"Content-Type": "text/plain"
},
withCredentials: !1
}).catch(function(e) {})
}
function sendByNative(e, r, i) {
return _sendByNative.apply(this, arguments)
}
function _sendByNative() {
return (_sendByNative = (0,
p._)(function(e, r, i) {
var a;
return (0,
_.Jh)(this, function(a) {
switch (a.label) {
case 0:
if (a.trys.push([0, 5, , 6]),
!i)
return [3, 2];
return [4, (0,
q.EU)(r)];
case 1:
return a.sent(),
[3, 4];
case 2:
return [4, (0,
q.qc)(r)];
case 3:
a.sent(),
a.label = 4;
case 4:
return [3, 6];
case 5:
return a.sent(),
[2, sendByHttp(e, r)];
case 6:
return [2]
}
})
})).apply(this, arguments)
}
function sendByDefault(e, r, i) {
return _sendByDefault.apply(this, arguments)
}
function _sendByDefault() {
return (_sendByDefault = (0,
p._)(function(e, r, i) {
var a, s, u, c;
return (0,
_.Jh)(this, function(l) {
switch (l.label) {
case 0:
if (a = i.preferNative,
u = void 0 !== (s = i.apm) && s,
c = a,
"function" != typeof a)
return [3, 2];
return [4, a(getFlagValue)];
case 1:
c = l.sent(),
l.label = 2;
case 2:
if (!0 === c)
return [2, sendByNative(e, r, u)];
return [2, sendByHttp(e, r)]
}
})
})).apply(this, arguments)
}
var showTrackerMessage = function(e, r) {
var i = JSON.stringify(r);
(0,
q.Ww)({
title: e,
content: i,
isNewTrack: !0
}).catch(function() {})
}
, eR = function(e) {
function DefaultEmitter(e) {
var r;
return (0,
A._)(this, DefaultEmitter),
r = (0,
P._)(this, DefaultEmitter, [e]),
(0,
f._)(r, "isLite", void 0),
(0,
f._)(r, "localDebug", void 0),
(0,
f._)(r, "preferNative", void 0),
r.isLite = e.isLite,
r.localDebug = e.debug,
r.preferNative = e.preferNative,
r
}
return (0,
R._)(DefaultEmitter, e),
(0,
D._)(DefaultEmitter, [{
key: "shouldFlushBuffer",
value: function shouldFlushBuffer() {
return !0
}
}, {
key: "serializeBinary",
value: function serializeBinary(e, r) {
var i = new r
, a = e.serializeBinary();
i.encoder_.writeSignedVarint64(a.byteLength + 4),
i.encoder_.writeInt32(this.versionHash),
i.encoder_.writeBytes(a);
var s = i.getResultBase64String();
return i.reset(),
s
}
}, {
key: "sendData",
value: function sendData(e) {
sendByDefault(u || this.localDebug ? this.endpoint.development : this.endpoint.production, e, {
preferNative: this.preferNative
}).then(function(e) {
if (!!e)
u && showTrackerMessage("success", e)
}).catch(function(e) {
u && showTrackerMessage("error", e)
})
}
}, {
key: "flush",
value: function flush() {
var e = this;
if (!!this.buffer.length) {
var r = [eA];
!this.isLite && r.push(Promise.resolve().then(i.t.bind(i, 94287, 23))),
Promise.all(r).then(function(r) {
var i = (0,
j._)(r, 2)
, a = i[0]
, s = i[1];
if (u = a,
e.isLite)
for (; e.buffer.length; ) {
var c = e.buffer.shift();
e.sendData(c)
}
else
for (; e.buffer.length; ) {
var l = e.buffer.shift();
e.sendData(e.serializeBinary(l, s.BinaryWriter))
}
})
}
}
}]),
DefaultEmitter
}(eP);
i(96205),
i(98976);
var eI = Function("return this")();
eI.__APM_COMBO_CACHE_GROUP_V2__ = {};
var eO = !1;
function sendToXrayByAjax(e, r, i) {
var a = new XMLHttpRequest;
a.open("POST", e, !0),
a.setRequestHeader("Content-Type", "application/json"),
a.setRequestHeader("Biz-Type", "apm_fe"),
a.setRequestHeader("Batch", i ? "true" : "false"),
a.send(JSON.stringify(r))
}
function sendToXrayByFetch(e, r, i) {
"function" == typeof fetch ? fetch(e, {
keepalive: !0,
method: "POST",
headers: {
"content-type": "application/json",
"Biz-Type": "apm_fe",
Batch: i ? "true" : "false"
},
body: JSON.stringify(r)
}).catch(function(e) {}) : sendToXrayByAjax(e, r)
}
function viewDisappearListener() {
var cb = function() {
var e = Object.keys(eI.__APM_COMBO_CACHE_GROUP_V2__);
if (e.length)
for (var r = 0; r < e.length; r++) {
var i = e[r]
, a = eI.__APM_COMBO_CACHE_GROUP_V2__[i] || {}
, s = a.data
, u = a.request;
if (null == s ? void 0 : s.length) {
if ((null == u ? void 0 : u.name) === "sendToXray")
sendToXrayByFetch.call(null, i, s, !0);
else {
var c, l = {
type: "text/plain"
}, d = new Blob([JSON.stringify(s)],l);
null === (c = navigator) || void 0 === c || c.sendBeacon(i, d)
}
eI.__APM_COMBO_CACHE_GROUP_V2__[i] = null
}
}
};
y.YF.isXHS ? (y.YF.isAndroid && (0,
eu.Ld)("viewDidDisappear", cb),
y.YF.isIOS && (0,
eu.Ld)("viewDisappear", cb)) : (window.addEventListener || window.attachEvent)("visibilitychange", function() {
"hidden" === document.visibilityState && cb()
})
}
var helpers_requestCombo = function requestCombo(e, r) {
var i, a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, s = a.request, u = a.isCombo, c = void 0 === u || u, l = a.maxComboNum, d = void 0 === l ? 5 : l, f = a.collectTime, v = void 0 === f ? 1e3 * d : f, g = a.callback;
if (!e || "{}" === JSON.stringify(r))
return null;
var h = (i = (0,
p._)(function(e) {
var r, i, a, s, u;
return (0,
_.Jh)(this, function(c) {
switch (c.label) {
case 0:
if (!(null === (r = eI.__APM_COMBO_CACHE_GROUP_V2__[e]) || void 0 === r ? void 0 : r.data.length))
return [3, 2];
return a = (i = eI.__APM_COMBO_CACHE_GROUP_V2__[e]).data,
s = i.timer,
u = i.request,
clearTimeout(s),
eI.__APM_COMBO_CACHE_GROUP_V2__[e] = null,
[4, (u || sendByHttp).call(null, e, a)];
case 1:
return [2, c.sent()];
case 2:
return [2]
}
})
}),
function fetch1(e) {
return i.apply(this, arguments)
}
);
return !eO && (viewDisappearListener(),
eO = !0),
new Promise(function(i, a) {
if (c) {
if (e) {
var u;
if (!(null === (u = eI.__APM_COMBO_CACHE_GROUP_V2__) || void 0 === u ? void 0 : u[e]) && (eI.__APM_COMBO_CACHE_GROUP_V2__[e] = {
request: s,
data: [],
timer: window.setTimeout(function() {
var r, s = null === (r = eI.__APM_COMBO_CACHE_GROUP_V2__[e]) || void 0 === r ? void 0 : r.data;
h(e).then(function(e) {
null == g || g(s),
i(e)
}).catch(function(e) {
a(e)
})
}, v)
}),
eI.__APM_COMBO_CACHE_GROUP_V2__[e].data.push(r),
eI.__APM_COMBO_CACHE_GROUP_V2__[e].data.length >= d) {
var l, p = null === (l = eI.__APM_COMBO_CACHE_GROUP_V2__[e]) || void 0 === l ? void 0 : l.data;
h(e).then(function(e) {
null == g || g(p),
i(e)
}).catch(function(e) {
a(e)
})
}
} else
a("接口 url: ".concat(e, " 不能为空"))
} else
null == s || s.call(null, e, r).then(function(e) {
i(e)
}).catch(function(e) {
a(e)
})
}
)
};
function requestCombo_destroy() {
return _destroy.apply(this, arguments)
}
function _destroy() {
return (_destroy = (0,
p._)(function() {
var e;
return (0,
_.Jh)(this, function(r) {
switch (r.label) {
case 0:
var i;
if (!(e = Object.keys(eI.__APM_COMBO_CACHE_GROUP_V2__)).length)
return [3, 2];
return [4, Promise.all(e.map((i = (0,
p._)(function(e) {
var r, i, a;
return (0,
_.Jh)(this, function(s) {
switch (s.label) {
case 0:
if (i = (r = eI.__APM_COMBO_CACHE_GROUP_V2__[e]).data,
a = r.request,
!(null == i ? void 0 : i.length))
return [3, 2];
return [4, (a || sendByHttp).call(null, e, i)];
case 1:
s.sent(),
eI.__APM_COMBO_CACHE_GROUP_V2__[e] = null,
s.label = 2;
case 2:
return [2]
}
})
}),
function(e) {
return i.apply(this, arguments)
}
)))];
case 1:
r.sent(),
r.label = 2;
case 2:
return [2]
}
})
})).apply(this, arguments)
}
var eN = {
NAME: "Tracker",
ENDPOINT: {
production: "https://t2.xiaohongshu.com/api/v2/collect",
development: "https://t2-test.xiaohongshu.com/api/v2/collect"
}
}
, eL = {
NAME: "ApmTracker",
ENDPOINT: {
production: "https://lng.xiaohongshu.com/api/collect",
development: "https://lng.xiaohongshu.com/api/collect"
}
}
, eM = {
NAME: "ApmTracker",
ENDPOINT: {
production: "https://fe.xiaohongshu.com/faas/proto/json-to-proto-json-to-proto/proxy",
development: "http://serverless.int.sit.xiaohongshu.com/function/proto/json-to-proto-json-to-proto/proxy"
}
}
, eB = {
NAME: "ApmXrayTracker",
ENDPOINT: {
production: "https://apm-fe.xiaohongshu.com/api/data",
development: "http://81.69.167.96/api/data"
}
}
, ex = {
ENDPOINT: {
production: "https://apm-fe.xiaohongshu.com/api/collect",
development: "http://81.69.167.96/api/collect"
}
}
, apm_emitter_showTrackerMessage = function(e) {
var r = JSON.stringify(e);
(0,
q.Xw)({
content: r
}).catch(function() {})
}
, eD = function(e) {
function ApmEmitter(e) {
var r;
return (0,
A._)(this, ApmEmitter),
r = (0,
P._)(this, ApmEmitter, [e]),
(0,
f._)(r, "localDebug", void 0),
(0,
f._)(r, "preferNative", void 0),
(0,
f._)(r, "enableBatchRequest", void 0),
(0,
f._)(r, "apmXrayProtoTrackerEndPoint", void 0),
(0,
f._)(r, "apmXrayTrackerEndPoint", void 0),
r.localDebug = e.debug,
r.preferNative = e.preferNative,
r.enableBatchRequest = e.enableBatchRequest,
r.apmXrayTrackerEndPoint = e.apmXrayTrackerEndPoint,
r.apmXrayProtoTrackerEndPoint = e.apmXrayProtoTrackerEndPoint,
r
}
return (0,
R._)(ApmEmitter, e),
(0,
D._)(ApmEmitter, [{
key: "shouldFlushBuffer",
value: function shouldFlushBuffer() {
return !0
}
}, {
key: "serializeBinary",
value: function serializeBinary(e, r) {
var i = new r
, a = e.serializeBinary();
i.encoder_.writeSignedVarint64(a.byteLength + 4),
i.encoder_.writeInt32(this.versionHash),
i.encoder_.writeBytes(a);
var s = i.getResultBase64String();
return i.reset(),
s
}
}, {
key: "sendLocalMetric",
value: function sendLocalMetric(e) {
if (this.localDebug) {
var r;
e.apmLog && (r = "apmLog"),
e.browserApmTracker ? r = Object.keys(e.browserApmTracker).filter(function(r) {
var i = e.browserApmTracker[r];
return Array.isArray(i) ? i.length > 0 : i
}) : e.frontApmTracker && (r = "frontApmTracker"),
console.groupCollapsed("[apm] ".concat(r.toString())),
console.log(e),
console.groupEnd()
}
}
}, {
key: "logJsonMetric",
value: function logJsonMetric(e) {
if (this.localDebug) {
var r;
if (e.apmLog && (r = "apmLog"),
e.browserApmTracker) {
var i = e.browserApmTracker.value;
r = Object.keys(i).filter(function(e) {
var r = i[e];
return Array.isArray(r) ? r.length > 0 : r
})
} else
e.frontApmTracker && (r = "frontApmTracker");
console.groupCollapsed("[apm] ".concat(r.toString())),
console.log(e),
console.groupEnd()
}
}
}, {
key: "logXrayMetric",
value: function logXrayMetric(e) {
if (this.localDebug) {
var r = e.measurement_name;
console.groupCollapsed("[apm] ".concat(r)),
console.log(e),
console.groupEnd()
}
}
}, {
key: "sendData",
value: function sendData(e, r) {
var i, a = this, s = "string" == typeof e ? "proto" : "json", u = c || this.localDebug ? this.endpoint.development : this.endpoint.production;
"proto" === s && r.frontApmTracker && (u = (null === (i = this.apmXrayProtoTrackerEndPoint) || void 0 === i ? void 0 : i.production) || ex.ENDPOINT.production);
var l = this.preferNative;
"json" === s && (l = !1),
sendByDefault(u, e, {
preferNative: l,
apm: !0
}).then(function(e) {
if (!!e)
c && apm_emitter_showTrackerMessage(e),
"proto" === s ? a.sendLocalMetric(r) : a.logJsonMetric(r)
}).catch(function(e) {
c && apm_emitter_showTrackerMessage(e),
a.localDebug && (console.group("[apm error]"),
console.error(e.detail || e),
console.groupEnd())
})
}
}, {
key: "flush",
value: function flush() {
var e = this;
if (!!this.buffer.length) {
if (this.enableBatchRequest) {
eA.then(function(r) {
for (var i, a, s = r || e.localDebug ? e.endpoint.development : e.endpoint.production, u = r || e.localDebug ? (null === (i = e.apmXrayTrackerEndPoint) || void 0 === i ? void 0 : i.development) || eB.ENDPOINT.development : (null === (a = e.apmXrayTrackerEndPoint) || void 0 === a ? void 0 : a.production) || eB.ENDPOINT.production; e.buffer.length; ) {
var c = e.buffer.shift();
c.measurement_name ? helpers_requestCombo(u, c, {
request: sendToXray,
callback: function(r) {
(null == r ? void 0 : r.length) && r.forEach(function(r) {
e.logXrayMetric(r)
})
}
}) : helpers_requestCombo(s, c, {
callback: function(r) {
(null == r ? void 0 : r.length) && r.forEach(function(r) {
e.logJsonMetric(r)
})
}
})
}
});
return
}
Promise.all([Promise.resolve().then(i.t.bind(i, 94287, 23)), eA]).then(function(r) {
var i = (0,
j._)(r, 2)
, a = i[0];
for (c = i[1]; e.buffer.length; ) {
var s = e.buffer.shift();
"function" == typeof s.toObject ? e.sendData(e.serializeBinary(s, a.BinaryWriter), s.toObject()) : e.sendData(s, s)
}
})
}
}
}, {
key: "flushApm",
value: function flushApm(e) {
var r = this;
eA.then(function(i) {
var a, s, u = i || r.localDebug ? (null === (a = r.apmXrayTrackerEndPoint) || void 0 === a ? void 0 : a.development) || eB.ENDPOINT.development : (null === (s = r.apmXrayTrackerEndPoint) || void 0 === s ? void 0 : s.production) || eB.ENDPOINT.production;
e.measurement_name && sendToXrayByFetch(u, e)
})
}
}, {
key: "destroy",
value: function destroy() {
requestCombo_destroy()
}
}]),
ApmEmitter
}(eP)
, isUpgrade = function(e) {
if (window.insight && !e)
throw Error("请将 launcher-plugin-eaglet 插件中 apm 手动置为 false");
return !!window.insight
}
, eF = [eM.NAME, eB.NAME]
, isApmTracker = function(e) {
return eF.includes(e)
}
, getPBEndPoint = function() {
return eN.ENDPOINT
};
function createTracker(e, r) {
var i, a, s, u, c, l, d, p, f = r.enableNativeEmitter, h = r.enableBatchRequest, m = r.customEndPoint, _ = e.NAME === eN.NAME, y = {
versionHash: e.PROTOBUF_HASH,
debug: e.debug,
preferNative: f
};
return _ ? y.endpoint = {
development: (null == m ? void 0 : null === (i = m.defaultTracker) || void 0 === i ? void 0 : i.development) || getPBEndPoint().development,
production: (null == m ? void 0 : null === (a = m.defaultTracker) || void 0 === a ? void 0 : a.production) || getPBEndPoint().production
} : "json" === e.dataType ? (y.enableBatchRequest = h,
y.dataType = e.dataType,
y.endpoint = {
development: (null == m ? void 0 : null === (s = m.apmJsonTracker) || void 0 === s ? void 0 : s.development) || eM.ENDPOINT.development,
production: (null == m ? void 0 : null === (u = m.apmJsonTracker) || void 0 === u ? void 0 : u.production) || eM.ENDPOINT.production
}) : (y.enableBatchRequest = !1,
y.endpoint = {
development: (null == m ? void 0 : null === (c = m.apmTracker) || void 0 === c ? void 0 : c.development) || eL.ENDPOINT.development,
production: (null == m ? void 0 : null === (l = m.apmTracker) || void 0 === l ? void 0 : l.production) || eL.ENDPOINT.production
}),
d = e.IS_LITE ? new eC({
name: e.NAME,
emitter: new eR((0,
g._)((0,
v._)({}, y), {
isLite: !0
})),
trackerEnums: null === (p = e.tracker) || void 0 === p ? void 0 : p.trackerEnums,
versionHash: e.PROTOBUF_HASH
}) : new eE({
name: e.NAME,
builder: e.builder,
emitter: _ ? new eR(y) : new eD((0,
g._)((0,
v._)({}, y), {
apmXrayTrackerEndPoint: null == m ? void 0 : m.apmXrayTracker,
apmXrayProtoTrackerEndPoint: null == m ? void 0 : m.apmXrayProtoTracker
}))
}),
{
push: function(r) {
var i, a;
e.IS_LITE ? (r.data.app.value.trackerVersion = e.VERSION,
d.push(r)) : (null === (i = r.app) || void 0 === i ? void 0 : i.value) ? (r.app.value.trackerVersion = e.VERSION,
d.push(r)) : r.measurement_name && (null === (a = d.emitter) || void 0 === a || a.push(r))
},
flush: function() {
d.flush()
},
flushApm: function(e) {
var r;
null === (r = d.emitter) || void 0 === r || r.flushApm(e)
},
destroy: function() {
null == d || d.destroy()
}
}
}
var eV = i(94287)
, eH = i.n(eV)
, eU = function(e) {
function DefaultEmitter(e) {
var r;
return (0,
A._)(this, DefaultEmitter),
r = (0,
P._)(this, DefaultEmitter, [e]),
(0,
f._)(r, "isLite", void 0),
(0,
f._)(r, "localDebug", void 0),
r.isLite = e.isLite,
r.localDebug = e.debug,
r
}
return (0,
R._)(DefaultEmitter, e),
(0,
D._)(DefaultEmitter, [{
key: "serializeBinary",
value: function serializeBinary(e, r) {
var i = new r
, a = e.serializeBinary();
i.encoder_.writeSignedVarint64(a.byteLength + 4),
i.encoder_.writeInt32(this.versionHash),
i.encoder_.writeBytes(a);
var s = i.getResultBase64String();
return i.reset(),
s
}
}, {
key: "sendData",
value: function sendData(e) {
var r, i = l || this.localDebug ? this.endpoint.development : this.endpoint.production, a = new Blob([e],{
type: "text/plain"
});
"function" == typeof (null === (r = navigator) || void 0 === r ? void 0 : r.sendBeacon) && navigator.sendBeacon(i, a)
}
}, {
key: "flush",
value: function flush() {
var e = this;
if (!!this.buffer.length) {
var r = [eA];
!this.isLite && r.push(Promise.resolve(eH())),
Promise.all(r).then(function(r) {
var i = (0,
j._)(r, 2)
, a = i[0]
, s = i[1];
for (l = a; e.buffer.length; ) {
var u = e.buffer.shift();
e.sendData(e.serializeBinary(u, s.BinaryWriter))
}
})
}
}
}]),
DefaultEmitter
}(eP);
function createSendBeaconTracker_createTracker(e, r) {
var i, a, s = e.NAME === eN.NAME, u = {
versionHash: e.PROTOBUF_HASH,
debug: e.debug
};
s && (u.endpoint = {
development: (null == r ? void 0 : null === (i = r.defaultTracker) || void 0 === i ? void 0 : i.development) || eN.ENDPOINT.development,
production: (null == r ? void 0 : null === (a = r.defaultTracker) || void 0 === a ? void 0 : a.production) || eN.ENDPOINT.production
});
var c = new eE({
name: e.NAME,
builder: e.builder,
emitter: new eU(u)
});
return {
push: function(r) {
var i;
(null === (i = r.app) || void 0 === i ? void 0 : i.value) && (r.app.value.trackerVersion = e.VERSION,
c.push(r))
}
}
}
var unsupportedMethod = function(e) {
return void 0 === e || "function" != typeof e
}
, create_perf_utils_sendMetrics = function(e, r) {
if (!unsupportedMethod(e.toJSON)) {
var i, a = {
browserApmTracker: {
type: "BrowserApmTracker",
value: {
browserPerformanceMeasure: {
type: "BrowserPerformanceMeasure",
value: e.toJSON()
}
}
}
};
if (r && "function" == typeof r.push) {
if (isUpgrade(!0)) {
null === (i = window.insight) || void 0 === i || i.push(a);
return
}
r.push(a, eL.NAME)
}
}
};
function createPerfUtils(e) {
return {
mark: function(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
if (!unsupportedMethod(window.performance.mark))
window.performance.mark(e),
r && this.sendEntriesByName(e, "mark")
},
markPoint: function(e) {
this.mark(e, !0)
},
measure: function(e, r, i) {
if (!unsupportedMethod(window.performance.measure))
window.performance.measure(e, r, i),
r && window.performance.clearMarks(r),
i && window.performance.clearMarks(i),
this.sendEntriesByName(e, "measure")
},
sendEntriesByName: function(r, i) {
if (!unsupportedMethod(window.performance.getEntriesByName))
create_perf_utils_sendMetrics((0,
j._)(window.performance.getEntriesByName(r, i), 1)[0], e)
}
}
}
var eq = i(84560)
, ej = i.n(eq)
, eW = {};
function setPageLoadType(e, r) {
if (!r || !r.PageLoadType)
return e;
var i = r.PageLoadType
, a = i.PAGE_LOAD_TYPE_NORMAL_JUMP
, s = i.PAGE_LOAD_TYPE_REGRESSION;
if (a && s && (null == e ? void 0 : null === (l = e.event) || void 0 === l ? void 0 : null === (c = l.value) || void 0 === c ? void 0 : null === (u = c.action) || void 0 === u ? void 0 : u.value) === "pageview") {
var u, c, l, d, p, f, v = null == e ? void 0 : null === (f = e.page) || void 0 === f ? void 0 : null === (p = f.value) || void 0 === p ? void 0 : null === (d = p.pageInstance) || void 0 === d ? void 0 : d.value;
eW[v] ? e.event.value.pageLoadType = s : (eW[v] = !0,
e.event.value.pageLoadType = a)
}
return e
}
function trackerDataMerge(e, r, i, a) {
return r = setPageLoadType(r = ej()({}, i, a), e)
}
function initiatorTypeProcess(e, r) {
var i, a, s, u, c, l;
!((null == r ? void 0 : null === (a = r.Page) || void 0 === a ? void 0 : null === (i = a.prototype) || void 0 === i ? void 0 : i.setInitiatorType) && (null == r ? void 0 : null === (u = r.Page) || void 0 === u ? void 0 : null === (s = u.prototype) || void 0 === s ? void 0 : s.getInitiatorType)) && (null == e || null === (l = e.page) || void 0 === l || null === (c = l.value) || void 0 === c || delete c.initiatorType)
}
var eG = 0
, eJ = 0
, addEventSeqIdInSession = function(e, r) {
if (!!e && !!r) {
(null == e ? void 0 : null === (i = e.event) || void 0 === i ? void 0 : i.value) && (e.event.value.seqId = Date.now()),
(null == e ? void 0 : null === (a = e.app) || void 0 === a ? void 0 : a.value) && (eG += 1,
e.app.value.eventSeqIdInSession = eG);
var i, a, s, u, c, l, d, p, f, v, g, h, m, _, y, w, E, S, T, b, k, C, P, A, R = (null == r ? void 0 : null === (u = r.App) || void 0 === u ? void 0 : null === (s = u.prototype) || void 0 === s ? void 0 : s.getColdStartId) && (null == r ? void 0 : null === (l = r.App) || void 0 === l ? void 0 : null === (c = l.prototype) || void 0 === c ? void 0 : c.setColdStartId), I = (null == r ? void 0 : null === (p = r.App) || void 0 === p ? void 0 : null === (d = p.prototype) || void 0 === d ? void 0 : d.getEventSeqIdInSession) && (null == r ? void 0 : null === (v = r.App) || void 0 === v ? void 0 : null === (f = v.prototype) || void 0 === f ? void 0 : f.setEventSeqIdInSession), O = (null == r ? void 0 : null === (h = r.Event) || void 0 === h ? void 0 : null === (g = h.prototype) || void 0 === g ? void 0 : g.getSeqId) && (null == r ? void 0 : null === (_ = r.Event) || void 0 === _ ? void 0 : null === (m = _.prototype) || void 0 === m ? void 0 : m.setSeqId);
!R && (null === (b = e.app) || void 0 === b || null === (T = b.value) || void 0 === T || delete T.coldStartId),
!I && (null === (C = e.app) || void 0 === C || null === (k = C.value) || void 0 === k || delete k.eventSeqIdInSession),
!O && (null === (A = e.event) || void 0 === A || null === (P = A.value) || void 0 === P || delete P.seqId),
(null == r ? void 0 : null === (w = r.Event) || void 0 === w ? void 0 : null === (y = w.prototype) || void 0 === y ? void 0 : y.getSdkSeqId) && (null == r ? void 0 : null === (S = r.Event) || void 0 === S ? void 0 : null === (E = S.prototype) || void 0 === E ? void 0 : E.setSdkSeqId) && (eJ += 1,
e.event.value.sdkSeqId = eJ)
}
};
function objectHasKey(e, r) {
if (!r || !e)
return !1;
var i = r.split(".");
if (1 === i.length)
return void 0 !== e[i[0]] && "" !== e[i[0]] && null !== e[i[0]] || !1;
if ("object" === (0,
m._)(e[i[0]]) && null !== e[i[0]] || "function" == typeof e[i[0]]) {
var a = i.shift()
, s = i.join(".");
return objectHasKey(e[a], s)
}
return !1
}
function flatten(e) {
Object.keys(e).forEach(function(r) {
e[r] && "object" === (0,
m._)(e[r]) && flatten(e[r]),
e[r] && e[r].value && (e[r] = e[r].value),
e[r] && e[r].type && delete e[r].type
})
}
function showTypeValue(e) {
var r = JSON.parse(JSON.stringify(e));
try {
flatten(r);
var i = [r.event.action, r.event.target_type, r.page.page_instance].filter(function(e) {
return !!e
}).join(".");
console.group("[eaglet] ".concat(i)),
console.log("%c".concat(r.event.pointId || ""), "padding:0 2px;background:green;color:white", r),
console.groupEnd()
} catch (e) {
console.group("[eaglet] ".concat(r.event.value.action.value)),
console.log("%c".concat(r.event.value.pointId || ""), "padding:0 2px;background:green;color:white", r),
console.groupEnd()
}
}
var eX = "";
function addBrowserSource(e, r) {
e && r && objectHasKey(r, "Browser.prototype.setSource") && objectHasKey(r, "Browser.prototype.getSource") && "object" === (0,
m._)(e.browser) && (e.browser.value.source = eX)
}
function updateBrowserSource(e) {
if (!e)
return null;
var r = e.meta.urlSource;
eX = !0 === r ? String(Array.isArray(e.query.source) ? e.query.source[0] : e.query.source || "") : "function" == typeof r ? String(r() || "") : ""
}
var setUserId = function setUserId_setUserId(e, r) {
var i, a, s = objectHasKey(e, "Tracker.user.value"), u = objectHasKey(e, "ApmTracker.user.value"), c = objectHasKey(e, "ApmXrayTracker.context_userId");
s && (null == e ? void 0 : null === (i = e.Tracker) || void 0 === i ? void 0 : i.user) && (e.Tracker.user.value.userId = r),
u && (null == e ? void 0 : null === (a = e.ApmTracker) || void 0 === a ? void 0 : a.user) && (e.ApmTracker.user.value.userId = r),
c && e.ApmXrayTracker && (e.ApmXrayTracker.context_userId = r)
}
, eY = new Promise(function(e) {
(0,
q.dh)().then(function(r) {
e({
sessionId: r.sessionId
})
}).catch(function() {
e({
sessionId: ""
})
})
}
)
, device_judgePlatform = function() {
if (y.YF.isIOS)
return y.YF.isXHS ? "iOS" : "iOSBrowser";
if (y.YF.isAndroid)
return y.YF.isXHS ? "Android" : "AndroidBrowser";
if (y.YF.isHarmony || y.YF.isHarmonyArk)
return y.YF.isXHS ? "Harmony" : "HarmonyBrowser";
return "PC"
}
, ez = {
appVersion: "0.0.0",
systemVersion: "unknow",
uniqueId: "",
appMarket: "",
buildId: "",
bundleId: ""
}
, deviceBuilder = function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ez
, r = arguments.length > 1 ? arguments[1] : void 0;
return {
app: {
type: "App",
value: {
nameTracker: {
type: "NameTracker",
value: "wapT"
},
platform: {
type: "Platform",
value: device_judgePlatform()
},
appVersion: "discovery-".concat(e.appVersion),
appMarket: e.appMarket,
buildId: e.buildNumber,
coldStartId: e.cold_start_id,
package: e.bundleId
}
},
mob: {
type: "Mobile",
value: {
osVersion: e.systemVersion,
dvceModel: e.deviceModel,
dvceManufacture: e.manufacturer,
timezone: e.timezone,
dvceScreenWidth: e.deviceScreenWidth,
dvceScreenHeight: e.deviceScreenHeight
}
},
dvc: {
type: "Device",
value: {
idfa: e.idfa,
idfv: e.idfv,
dvceId: e.uniqueId || (null == r ? void 0 : r.deviceId) || "",
gid: (null == r ? void 0 : r.gid) || ""
}
}
}
}
, deviceBuilderV2 = function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ez
, r = arguments.length > 1 ? arguments[1] : void 0;
return {
context_nameTracker: "wapT",
context_platform: device_judgePlatform(),
context_appVersion: "discovery-".concat(e.appVersion),
context_osVersion: e.systemVersion,
context_deviceModel: e.deviceModel || "",
context_deviceId: e.uniqueId || (null == r ? void 0 : r.deviceId) || "",
context_package: e.bundleId
}
};
function resolveNetType() {
return new Promise(function(e) {
(0,
q._V)().then(function(r) {
var i = r.result
, a = r.value;
0 === i ? e(a.toLowerCase()) : e("unknown")
}).catch(function() {
try {
var r = window.navigator.userAgent;
e((0,
y.P7)(r).toLowerCase())
} catch (r) {
e("unknown")
}
})
}
)
}
var eK = {
wifi: "wifi",
"4g": "mobile",
"3g": "mobile",
"3g+": "mobile",
"2g": "mobile",
none: "unknow",
other: "unknow"
}
, eZ = resolveNetType().then(function(e) {
return {
network: {
type: "Network",
value: {
networkType: {
type: "NetworkType",
value: eK[e] || "unknow"
}
}
}
}
})
, eQ = resolveNetType().then(function(e) {
return {
context_networkType: eK[e] || "unknow"
}
});
function getOpenId() {
if (y.YF.isMiniprogram) {
var e;
if (null === (e = window) || void 0 === e ? void 0 : e.location)
return new URLSearchParams(window.location.search).get("openid")
}
return null
}
i(67930);
var meta_user = function() {
return d ? d : d = getABInfo().then(function(e) {
return {
user: {
type: "User",
value: {
userId: e.userId || "",
hashUserId: e.userToken,
wxOpenid: getOpenId() || "",
expV4: e.hashExp
}
}
}
})
}
, purgeUserInfo = function() {
return getABInfo().then(function(e) {
return {
user: {
type: "User",
value: {
userId: e.userId || "",
hashUserId: e.userToken,
wxOpenid: getOpenId() || "",
expV4: e.hashExp
}
}
}
})
};
function getPageInfo() {
var e, r, i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, a = i.params, s = void 0 === a ? {} : a, u = i.meta, c = void 0 === u ? {} : u;
c.pageInstance && (e = c.pageInstance),
c.instanceId ? r = "function" == typeof c.instanceId ? c.instanceId(i) : c.instanceId : s.id && (r = s.id);
var l = {
page: {
type: "Page",
value: {
instanceId: r
}
}
};
return e && (l.page.value.pageInstance = {
type: "PageInstance",
value: e
}),
l
}
function getBrowserInfo() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
fullPath: ""
};
if (!U.ZP.isBrowser)
return {};
var i = r.matched
, a = void 0 === i ? [] : i
, s = a.length > 0 ? a.slice(-1)[0] : null;
return {
browser: {
type: "Browser",
value: {
matchedPath: null !== (e = null == s ? void 0 : s.path) && void 0 !== e ? e : "",
route: window.location.origin + (null == r ? void 0 : r.fullPath),
userAgent: window.navigator.userAgent,
sessionId: (0,
O.Z)(),
fixedReferer: document.referrer
}
}
}
}
var getBrowserInfoV2 = function() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
if (!U.ZP.isBrowser)
return {};
var i = r.matched
, a = void 0 === i ? [] : i
, s = a.length > 0 ? a.slice(-1)[0] : null;
return {
context_matchedPath: null !== (e = null == s ? void 0 : s.path) && void 0 !== e ? e : "",
context_route: window.location.href,
context_userAgent: window.navigator.userAgent
}
}
, getBaseInfo = function() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, a = i.getUserInfo ? i.getUserInfo() : r.purgeUser ? purgeUserInfo() : meta_user(), s = {
artifactName: "xhs-pc-web",
artifactVersion: "4.62.3"
}, u = i.getArtifactInfo ? (0,
v._)({}, s, i.getArtifactInfo()) : s;
return Promise.all([(e = i,
new Promise(function(r) {
y.YF.isXHS ? (0,
eu.dw)("getDeviceInfo").then(function(e) {
e.value ? r(deviceBuilderV2(e.value)) : r(deviceBuilderV2())
}).catch(function() {
r(deviceBuilderV2())
}) : e.getDeviceInfo ? e.getDeviceInfo().then(function(e) {
r(deviceBuilderV2({}, e))
}).catch(function() {
r(deviceBuilderV2())
}) : r(deviceBuilderV2())
}
)), eQ, a, getBrowserInfoV2(r.route), u]).then(function(e) {
var r = (0,
j._)(e, 5)
, i = r[0]
, a = r[1]
, s = r[2]
, u = r[3]
, c = r[4]
, l = (0,
v._)({}, i, a, u);
return l.context_artifactName = c.artifactName,
l.context_artifactVersion = c.artifactVersion,
(null == s ? void 0 : s.user) && (l.context_userId = s.user.value.userId),
l
})
}
, data_meta = function() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, a = i.getUserInfo ? i.getUserInfo() : r.purgeUser ? purgeUserInfo() : meta_user(), s = {
artifactName: "xhs-pc-web",
artifactVersion: "4.62.3"
}, u = i.getArtifactInfo ? (0,
v._)({}, s, i.getArtifactInfo()) : s;
return Promise.all([(e = i,
new Promise(function(r) {
y.YF.isXHS || y.YF.isXhsMerchant ? (0,
eu.dw)("getDeviceInfo").then(function(e) {
e.value ? r(deviceBuilder(e.value)) : r(deviceBuilder())
}).catch(function() {
r(deviceBuilder())
}) : e.getDeviceInfo ? e.getDeviceInfo().then(function(e) {
r(deviceBuilder({}, e))
}).catch(function() {
r(deviceBuilder())
}) : r(deviceBuilder())
}
)), eZ, eY, a, getPageInfo(r.route), getBrowserInfo(r.route), u]).then(function(e) {
var r = (0,
j._)(e, 7)
, i = r[0]
, a = r[1]
, s = r[2]
, u = r[3]
, c = r[4]
, l = r[5]
, d = r[6]
, p = (0,
v._)({}, i, a, c, l);
return (null == u ? void 0 : u.user) && (p.user = u.user),
p.app && (p.app.value = (0,
v._)({}, p.app.value, d),
p.app.value.sessionId = s.sessionId),
p
})
}
, e$ = i(27100)
, e0 = i.n(e$);
var e1 = (a = (0,
O.Z)(),
"undefined" != typeof window && (window.SDK__SESSION__ID ? a = window.SDK__SESSION__ID : window.SDK__SESSION__ID = a),
a)
, data_event = function() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, i = arguments.length > 1 ? arguments[1] : void 0, a = arguments.length > 2 ? arguments[2] : void 0;
return (null === (e = r.event) || void 0 === e ? void 0 : e.value) ? (r.event.value.eventId = (0,
O.Z)(),
r.event.value.dvceMicroTs = 1e3 * Date.now()) : r.event = {
type: "Event",
value: {
eventId: (0,
O.Z)(),
dvceMicroTs: 1e3 * Date.now()
}
},
i === eN.NAME && (r.event.value.requestId = e0()(),
objectHasKey(a, "Event.prototype.getSdkSessionId") && objectHasKey(a, "Event.prototype.setSdkSessionId") && (r.event.value.sdkSessionId = e1)),
r
};
i(64961),
i(12996),
i(59564);
var e2 = ["infraJsError", "httpRequestTiming"];
function interceptFactory(e) {
var r = e || {}
, i = r.scopes
, a = r.handler
, s = (null == i ? void 0 : i.filter(function(e) {
return e2.find(function(r) {
return r === e
})
})) || [];
return function interceptorImplement(e) {
if (s.find(function(r) {
return r === e.measurement_name
}))
try {
return (null == a ? void 0 : a(e)) || e
} catch (e) {}
return e
}
}
function checkTrackerInstalled(e, r) {
return !!e[r] || !1
}
var e3 = ["BrowserResourceError"];
function needPbToPave(e) {
if (null == e ? void 0 : e.browserApmTracker) {
for (var r, i = null == e ? void 0 : null === (r = e.browserApmTracker) || void 0 === r ? void 0 : r.value, a = Object.keys(i), s = 0; s < (null == a ? void 0 : a.length); s++) {
var u = i[a[s]].type;
if (e3.includes(u))
return !0
}
}
return !1
}
function initialToLower(e) {
return e.charAt(0).toLowerCase() + e.slice(1)
}
function transformPb(e, r) {
var i = [];
return Object.keys(e).forEach(function(a) {
var s = e[a];
if (s) {
var u = s.type
, c = s.value;
Array.isArray(c) ? null == c || c.forEach(function(e) {
i.push((0,
g._)((0,
v._)({}, r), {
measurement_name: initialToLower(u),
measurement_data: e
}))
}) : i.push((0,
g._)((0,
v._)({}, r), {
measurement_name: initialToLower(u),
measurement_data: c
}))
}
}),
i
}
function pbToPave(e) {
var r, i = [], a = e.app, s = e.mob, u = e.dvc, c = e.network, l = e.browser, d = e.user, p = (null == a ? void 0 : a.value) || {}, f = p.artifactName, v = p.artifactVersion, g = p.appVersion, h = p.platform, m = p.buildId, _ = (d || {}).value, y = (s || {}).value, w = (u || {}).value, E = (c || {}).value, S = (l || {}).value, T = {
clientTime: Date.now(),
context_package: m || "",
context_appVersion: g,
context_artifactName: f,
context_artifactVersion: v,
context_userId: (null == _ ? void 0 : _.userId) || "",
context_deviceId: (null == w ? void 0 : w.dvceId) || "",
context_route: (null == S ? void 0 : S.route) || "",
context_matchedPath: (null == S ? void 0 : S.matchedPath) || "",
context_deviceModel: (null == y ? void 0 : y.dvceModel) || "",
context_osVersion: (null == y ? void 0 : y.osVersion) || "",
context_userAgent: (null == S ? void 0 : S.userAgent) || "",
context_networkType: (null == E ? void 0 : null === (r = E.networkType) || void 0 === r ? void 0 : r.value) || "",
context_nameTracker: "wapT",
context_platform: null == h ? void 0 : h.value
};
return e.browserApmTracker ? i = transformPb(e.browserApmTracker.value, T) : e.frontApmTracker && (i = transformPb(e.frontApmTracker.value, T)),
i
}
var e4 = []
, e5 = {
push: (0,
p._)(function() {
var e, r, i, a = arguments;
return (0,
_.Jh)(this, function(s) {
for (r = Array(e = a.length),
i = 0; i < e; i++)
r[i] = a[i];
return e4.push({
type: "push",
params: r
}),
[2]
})
}),
flush: (0,
p._)(function() {
var e, r, i, a = arguments;
return (0,
_.Jh)(this, function(s) {
for (r = Array(e = a.length),
i = 0; i < e; i++)
r[i] = a[i];
return e4.push({
type: "flush",
params: r
}),
[2]
})
}),
config: function() {
for (var e = arguments.length, r = Array(e), i = 0; i < e; i++)
r[i] = arguments[i];
e4.push({
type: "config",
params: r
})
},
extend: function() {
for (var e = arguments.length, r = Array(e), i = 0; i < e; i++)
r[i] = arguments[i];
e4.push({
type: "extend",
params: r
})
},
getABFlagValue: function() {
for (var e = arguments.length, r = Array(e), i = 0; i < e; i++)
r[i] = arguments[i];
e4.push({
type: "getABFlagValue",
params: r
})
}
}
, e7 = !0
, e6 = {}
, e9 = {}
, e8 = {
name: "eaglet",
installed: !1,
trackPageView: !0,
trackPageEnd: !0,
debug: !1,
sendBeaconTracker: {
push: function() {}
},
trackerBuilder: {},
trackers: {},
install: function(e, r) {
var i, a, s, u, c, l, d = this, w = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
if (!this.installed && !!r.isBrowser && !!e.router) {
var E = w.tracker
, S = w.liteTracker
, T = w.apmTracker
, b = w.trackPageView
, k = w.trackPageEnd
, C = w.enableNativeEmitter
, P = void 0 === C || C
, A = w.performance
, R = w.apm
, I = void 0 === R ? {} : R
, O = w.referPath
, N = void 0 !== O && O
, L = w.customEndPoint
, M = w.noSameRouter
, B = I.jsError
, x = void 0 !== B && B
, D = I.http
, F = void 0 === D ? {} : D
, V = F.enableBatchRequest
, H = void 0 === V || V
, U = F.enableResponseData
, q = I.interceptor
, j = I.blankScreenError
, W = void 0 === j ? {} : j
, G = W.threshold
, J = W.domThreshold
, X = W.maxDepth
, Y = W.lines
, z = W.columns
, K = W.autoCheckBS
, Z = void 0 !== K && K
, Q = W.autoCheckBSTime
, $ = void 0 === Q ? 3e3 : Q
, ee = W.screenshot
, et = W.rootElementSelector
, er = !1 === w.apm
, en = {
threshold: void 0 === G ? .7 : G,
domThreshold: void 0 === J ? 5 : J,
maxDepth: void 0 === X ? 10 : X,
lines: void 0 === Y ? 5 : Y,
columns: void 0 === z ? 10 : z,
autoCheckBS: Z,
autoCheckBSTime: $,
screenshot: void 0 === ee || ee,
rootElementSelector: void 0 === et ? "" : et
};
if (this.installed = !0,
this.debug = window.location.href.includes("eaglet_debug"),
E && (this.trackers.tracker = E,
E().then(function(e) {
d.trackerBuilder = e.builder
})),
S) {
if (E)
throw Error("[eagletPlugin] Cannot both use tracker and liteTracker");
this.trackers.liteTracker = S
}
T ? this.trackers.apmTracker = T : this.trackers.apmTracker = {
NAME: "ApmTracker",
PROTOBUF_HASH: 0x5c17126e,
dataType: "json",
VERSION: "0.1.33",
builder: {
build: function(e, r) {
return r
}
},
jspb: {}
},
void 0 !== b && (this.trackPageView = b),
void 0 !== k && (this.trackPageEnd = k);
var ei = Promise.all(Object.keys(this.trackers).map(function(e) {
return "function" == typeof d.trackers[e] ? d.trackers[e]() : d.trackers[e]
})).then(function(e) {
return e.map(function(e, r) {
var i = Object.keys(d.trackers)[r];
if (e.NAME === eN.NAME) {
if ("liteTracker" === i && !e.IS_LITE)
throw Error("[eagletPlugin] Illegal liteTracker");
if ("tracker" === i && e.IS_LITE)
throw Error("[eagletPlugin] Illegal tracker")
} else if ("apmTracker" !== i)
throw Error("[eagletPlugin] Illegal ".concat(i));
return e
})
}).then(function(e) {
return e.forEach(function(e) {
if (e.NAME === eN.NAME && !e.IS_LITE) {
var r, i = e.builder.NormalizedAction;
d.trackPageView && (d.trackPageView = void 0 !== (null == i ? void 0 : i.PAGEVIEW)),
d.trackPageEnd && (d.trackPageEnd = void 0 !== (null == i ? void 0 : i.PAGE_END))
}
e.debug = window.location.href.includes("eaglet_debug"),
e6[e.NAME] = createTracker(e, {
enableNativeEmitter: P,
enableBatchRequest: null !== (r = null == A ? void 0 : A.enableBatchRequest) && void 0 !== r ? r : H,
customEndPoint: L
}),
e.NAME === eN.NAME && !e.IS_LITE && !y.YF.isXHS && (d.sendBeaconTracker = createSendBeaconTracker_createTracker(e, L))
}),
e
})
, getTrackerName = function(e) {
return ei.then(function(r) {
return e || r[0].NAME
})
}
, eo = new Promise(function(r) {
var i, purgeMetaInfo = function(e) {
return data_meta(e, w).then(function(e) {
e5.extend(e, eN.NAME),
e5.extend(e, eM.NAME),
e5.extend(e, eL.NAME),
r()
})
};
e.router.afterEach(function(e, r) {
if (!0 !== M || e.fullPath != r.fullPath) {
e5.extend(getPageInfo(e), eN.NAME);
ei.then(function() {
purgeMetaInfo({
route: e
});
var r = e.meta.pageInstance;
updateBrowserSource(e),
d.trackPageView && r && reportPv(e5, S, e, ei, ev.PAGEVIEW.AFTEREACH),
e7 && (createClickCollector(e5),
createImpressionCollector(e5)),
e7 = !1
})
}
}),
(null === (i = e.auth) || void 0 === i ? void 0 : i.services) && e.auth.services.registerAfterLoginCallback && e.auth.services.registerAfterLoginCallback(function() {
purgeMetaInfo({
purgeUser: !0
})
}, !0)
}
)
, ea = new Promise(function(r) {
var i, a, purgeBaseInfo = function(e) {
return getBaseInfo(e, w).then(function(e) {
e9[eB.NAME] = e,
r()
})
};
e.router.afterEach(function(e) {
getTrackerName().then(function() {
return purgeBaseInfo({
route: e
})
})
}),
(null === (i = e.auth) || void 0 === i ? void 0 : i.services) && e.auth.services.registerAfterLoginCallback && (null === (a = e.auth.services) || void 0 === a || a.registerAfterLoginCallback(function() {
purgeBaseInfo({
purgeUser: !0
})
}, !0))
}
)
, es = interceptFactory(q);
e5 = {
supportResourceError: !0,
push: (i = (0,
p._)(function(e, r) {
var i, a, s, u, c;
return (0,
_.Jh)(this, function(l) {
var f, h, m, y;
switch (l.label) {
case 0:
if (i = e,
a = r,
!i)
return [2];
if (a === eB.NAME) {
;return f = i,
ea.then(function() {
var e, r, i = es((0,
v._)({
clientTime: Date.now()
}, e9[eB.NAME], f));
if (isUpgrade(er)) {
null === (r = window.insight) || void 0 === r || r.push(i);
return
}
null == e6 || null === (e = e6.ApmTracker) || void 0 === e || e.push(i)
}),
[2]
}
return "ApmJSONTracker" === a && (s = e.type,
(u = {})[s] = e,
i = {
frontApmTracker: {
type: "FrontApmTracker",
value: u
}
},
a = "ApmTracker"),
[4, getTrackerName(a)];
case 1:
;if (c = l.sent(),
i && !checkTrackerInstalled(e6, c))
return [2];
return h = i,
m = c,
y = 0,
eo.then((0,
p._)(function() {
var e, r, i, a, s, u, c, l, p, f, y, w;
return (0,
_.Jh)(this, function(_) {
switch (_.label) {
case 0:
if (i = {
value: !1
},
h._uba_sendBeacon && (i.value = !0,
delete h._uba_sendBeacon),
S && m === eN.NAME) {
if (h.templateData)
r = (0,
v._)({}, h.templateData, e9[m]);
else
throw Error("[eagletPlugin] Illegal push payload, you use `liteTracker` in eaglet, make sure push data with lite template")
} else {
if (h.templateData || h.templateBuffers)
throw Error("[eagletPlugin] Illegal push payload, you use `Tracker` in eaglet, make sure push data with normal template");
r = (0,
g._)((0,
v._)({}, e9[m], h), {
page: {
type: (null === (a = h.page) || void 0 === a ? void 0 : a.type) || (null === (s = e9[m].page) || void 0 === s ? void 0 : s.type),
value: (0,
v._)({}, null === (c = e9[m]) || void 0 === c ? void 0 : null === (u = c.page) || void 0 === u ? void 0 : u.value, null === (l = h.page) || void 0 === l ? void 0 : l.value)
}
}),
m === eN.NAME && (r = trackerDataMerge(d.trackerBuilder, r, e9[m], h))
}
if (r = data_event(r, m, d.trackerBuilder),
m === eN.NAME && addEventSeqIdInSession(r, d.trackerBuilder),
!(N && m === eN.NAME))
return [3, 2];
return [4, flowSourcePointProcess(r, d.trackerBuilder)];
case 1:
r = _.sent(),
_.label = 2;
case 2:
if (m === eN.NAME && (initiatorTypeProcess(r, d.trackerBuilder),
addBrowserSource(r, d.trackerBuilder)),
m !== eN.NAME && (null == r || null === (f = r.app) || void 0 === f || null === (p = f.value) || void 0 === p || delete p.coldStartId),
"ApmTracker" === m)
return needPbToPave(r) ? null == (y = pbToPave(r)) || y.forEach(function(e) {
var r;
if (isUpgrade(er)) {
var i, a = e.measurement_name, s = e.measurement_data;
null === (i = window.insight) || void 0 === i || i.push({
measurement_name: a,
measurement_data: s
});
return
}
null == e6 || null === (r = e6.ApmTracker) || void 0 === r || r.push(e)
}) : (r.browserApmTracker || r.frontApmTracker || r.apmLog) && (null == e6 || null === (w = e6.ApmTracker) || void 0 === w || w.push(r)),
[2];
if (i.value)
return i.value = !1,
d.sendBeaconTracker.push(r),
[2];
return d.debug && showTypeValue(r),
null === (e = e6[m]) || void 0 === e || e.push(S && m === eN.NAME ? {
data: r,
templateBuffers: JSON.parse(JSON.stringify(h.templateBuffers))
} : r),
[2]
}
})
})),
[2]
}
})
}),
function(e, r) {
return i.apply(this, arguments)
}
),
flushApm: (a = (0,
p._)(function(e, r) {
var i;
return (0,
_.Jh)(this, function(a) {
if ("ApmXrayTracker" === r) {
if (isUpgrade(er))
return null === (i = window.insight) || void 0 === i || i.flush(e),
[2];
ea.then(function() {
var r, i, a = (0,
v._)({
clientTime: Date.now()
}, e9[eB.NAME], e);
"function" == typeof (null === (r = e6.ApmTracker) || void 0 === r ? void 0 : r.flushApm) && (null === (i = e6.ApmTracker) || void 0 === i || i.flushApm(a))
})
}
return [2]
})
}),
function(e, r) {
return a.apply(this, arguments)
}
),
flush: (s = (0,
p._)(function(e, r) {
var i, a, s;
return (0,
_.Jh)(this, function(u) {
switch (u.label) {
case 0:
return [4, getTrackerName(r)];
case 1:
if (!checkTrackerInstalled(e6, a = u.sent()))
return [2];
if (isUpgrade(er) && isApmTracker(a))
return null === (s = window.insight) || void 0 === s || s.flush(e),
[2];
if (!e)
return [3, 3];
return [4, e5.push(e, a)];
case 2:
u.sent(),
u.label = 3;
case 3:
return null === (i = e6[a]) || void 0 === i || i.flush(),
[2]
}
})
}),
function(e, r) {
return s.apply(this, arguments)
}
),
config: function(e, r, i) {
var a = i || eN.NAME
, s = JSON.parse(JSON.stringify(r));
if (a !== eN.NAME && ("page" === e && delete s.value.pageInstance,
"browser" === e && delete s.value.fixedReferer),
"ApmTracker" === a && (null === (c = s.value) || void 0 === c || delete c.gid),
"ApmTracker" === a && "app" === e && (null === (l = s.value) || void 0 === l || delete l.buildId),
e9[a] ? e9[a][e] = s : e9[a] = (0,
f._)({}, e, s),
isUpgrade(er) && isApmTracker(a)) {
var u = JSON.parse(JSON.stringify(r));
if ("app" === e) {
var c, l, d, p = u.type, v = u.value, g = v.platform, h = v.appVersion, m = v.artifactName, _ = v.artifactVersion;
null === (d = window.insight) || void 0 === d || d.config(e, {
type: p,
value: {
platform: g,
appVersion: h,
artifactName: m,
artifactVersion: _
}
}, i)
}
if ("mob" === e) {
var y, w = u.type, E = u.value, S = E.osVersion, T = E.dvceModel;
null === (y = window.insight) || void 0 === y || y.config(e, {
type: w,
value: {
osVersion: S,
dvceModel: T
}
}, i)
}
if ("dvc" === e) {
var b, k = u.type, C = u.value.dvceId;
null === (b = window.insight) || void 0 === b || b.config(e, {
type: k,
value: {
dvceId: C
}
}, i)
}
if ("network" === e && (null === (P = window.insight) || void 0 === P || P.config(e, u, i)),
"browser" === e) {
var P, A, R = u || {}, I = R.type, O = R.value, N = void 0 === O ? {} : O, L = N.matchedPath, M = N.route, B = N.userAgent;
null === (A = window.insight) || void 0 === A || A.config(e, {
type: I,
value: {
matchedPath: void 0 === L ? [] : L,
route: void 0 === M ? "" : M,
userAgent: void 0 === B ? "" : B
}
}, i)
}
if ("user" === e) {
var x, D = u.type, F = u.value.userId;
null === (x = window.insight) || void 0 === x || x.config(e, {
type: D,
value: {
userId: F
}
}, i)
}
}
},
extend: function(e, r) {
Object.keys(e).forEach(function(i) {
e5.config(i, e[i], r)
})
},
getABFlagValue: function(e) {
return getFlagValue(e)
},
sendApm: function(e, r) {
var i, a = {};
a[r] = {
type: r,
value: e
};
var s = {
frontApmTracker: {
type: "FrontApmTracker",
value: a
}
};
if (isUpgrade(er)) {
null === (i = window.insight) || void 0 === i || i.push(s);
return
}
e5.push(s, "ApmTracker")
},
sendCustomError: function(e, r) {
var i = parseError(e, r);
if (i) {
var a, s = {
measurement_name: "infraJsError",
measurement_data: (0,
v._)({
type: "custom"
}, i)
};
if (isUpgrade(er)) {
null === (a = window.insight) || void 0 === a || a.push(s);
return
}
e5.push(s, "ApmXrayTracker")
}
},
checkBlankScreenError: function() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
if (isUpgrade(er)) {
null === (e = window.insight) || void 0 === e || e.checkBlankScreenError(r);
return
}
var i = (0,
v._)({}, en, r);
checkBlankScreenError(e5, i)
},
updateUserInfo: function(e) {
setUserId(e9, e)
}
},
(!0 === x || (void 0 === x ? "undefined" : (0,
m._)(x)) === "object") && !window.insight && !er && collector_jsError(e, r, e5, x),
Z && !window.insight && !er && setTimeout(function() {
checkBlankScreenError(e5, en)
}, $),
e7 && (createPageDurationCollector(e, e5, ei, (0,
g._)((0,
v._)({}, w), {
trackPageView: this.trackPageView
})),
!window.insight && !er && createPerformanceCollector(e5, {
enableResponseData: null !== (c = null == A ? void 0 : A.enableResponseData) && void 0 !== c ? c : void 0 !== U && U
})),
e4.length && e4.forEach(function(e) {
var r = e.type
, i = e.params;
return (l = e5)[r].apply(l, (0,
h._)(i))
}),
!1 !== T && Object.defineProperty(e5, "perf", {
value: createPerfUtils(e5)
}),
w.extend && "object" === (0,
m._)(w.extend) && e5.extend(w.extend),
window.eaglet = e5,
(null === (u = r.version) || void 0 === u ? void 0 : u.startsWith("3")) ? e.vm.config.globalProperties.$eaglet = e5 : r.Vue.use({
install: function(e) {
e.prototype.$eaglet = e5
}
}),
N && flowSourceConfig()
}
},
destroy: function() {
var e;
null == e6 || null === (e = e6.ApmTracker) || void 0 === e || e.destroy()
}
}
},
19676: function(e, r, i) {
"use strict";
i.d(r, {
ZP: function() {
return s
}
}),
i(87535),
i(75204),
i(97357),
i(34333);
var a = i(54425)
, usePinia = function(e, r) {
var i = (0,
a.WB)();
i.state.value = window.__INITIAL_STATE__ || {},
e.vm.use(i),
(null == r ? void 0 : r.plugins) && r.plugins.forEach(function(e) {
return i.use(e)
}),
e.store = i
}
, s = {
name: "store",
install: function(e, r, i) {
usePinia(e, i)
}
}
},
65266: function(e, r, i) {
"use strict";
i.d(r, {
Kf: function() {
return b.u
},
ZP: function() {
return U
},
dJ: function() {
return C
},
kg: function() {
return P
}
});
var a, s, u, c, l = i(41622), d = i(35329), p = i(46490), f = i(90251), v = i(51606), g = i(27292), h = i(70879), m = i(27337), _ = i(64593), y = i(44501), w = i(75649), E = i(377);
i(28636),
i(87535),
i(75204),
i(97357),
i(34333),
i(1154),
i(80013),
i(86651),
i(9557),
i(41593),
i(87989),
i(74719),
i(13396),
i(25069),
i(58486),
i(29112),
i(67275),
i(59989),
i(7099),
i(27461),
i(23339),
i(51109),
i(25037),
i(55947),
i(95477),
i(19077),
i(75973),
i(7608),
i(36277);
var S = i(78607)
, T = i(2754)
, b = i(53512)
, k = i(44840)
, C = i(85456)
, P = i(14166)
, A = i(50934)
, R = i(71022)
, I = i(7825)
, O = i.n(I)
, N = i(86378)
, L = i.n(N)
, M = i(17177)
, B = (a = function() {
function _Launcher(e, r) {
(0,
p._)(this, _Launcher),
(0,
v._)(this, "ops", void 0),
(0,
v._)(this, "vm", void 0),
(0,
v._)(this, "options", void 0),
(0,
v._)(this, "plugins", []),
(0,
v._)(this, "template", void 0),
(0,
v._)(this, "app", void 0),
(0,
v._)(this, "router", void 0),
(0,
v._)(this, "head", void 0),
(0,
v._)(this, "http", C),
(0,
v._)(this, "logger", P),
(0,
v._)(this, "store", void 0),
(0,
v._)(this, "context", void 0),
(0,
v._)(this, "serverContext", void 0);
var i = r.platform
, a = r.routes
, s = r.router
, u = (void 0 === s ? {} : s).routes
, c = (0,
_._)(r.router, ["routes"]);
this.ops = {
template: e,
config: r
},
this.options = (0,
m._)((0,
h._)({}, r), {
platform: void 0 === i ? "pc" : i,
router: (0,
h._)({
routes: void 0 === u ? a : u
}, c)
}),
this.template = e
}
return (0,
f._)(_Launcher, [{
key: "registerGlobalProperties",
value: function registerGlobalProperties() {
this.app.config.globalProperties.isBrowser = _Launcher.isBrowser
}
}, {
key: "registerPlugins",
value: function registerPlugins() {
var e = this
, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.plugins;
r.sort(function(e, r) {
return e.priority - r.priority
}).forEach(function(r) {
return (0,
r.install)(e, _Launcher, r.options)
})
}
}, {
key: "use",
value: function use(e, r) {
var i, a;
if (void 0 !== e.name && this.plugins.some(function(r) {
var i = r.name;
return e.name === i
}))
return this;
return this.plugins.push({
name: e.name,
install: (a = (0,
l._)(function(r, i, a) {
var s;
return (0,
E.Jh)(this, function(u) {
return e.install(r, i, a),
null === (s = e.create) || void 0 === s || s.call(e, r, i, a),
[2]
})
}),
function(e, r, i) {
return a.apply(this, arguments)
}
),
options: r,
priority: null !== (i = e.priority) && void 0 !== i ? i : "store" === e.name ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY
}),
this
}
}, {
key: "start",
value: function start() {
throw _Launcher.NotImplementedError("start")
}
}, {
key: "render",
value: function render(e, r) {
throw _Launcher.NotImplementedError("render")
}
}, {
key: "streamingRender",
value: function streamingRender(e, r) {
throw _Launcher.NotImplementedError("streamingRender")
}
}], [{
key: "NotImplementedError",
value: function NotImplementedError(e) {
return Error("[Launcher Exception] ".concat(e, " is not implemented yet."))
}
}]),
_Launcher
}(),
(0,
v._)(a, "version", "3.32.1"),
(0,
v._)(a, "isBrowser", !0),
(0,
v._)(a, "http", C),
(0,
v._)(a, "logger", P),
a)
, x = (s = function() {
function _RootState() {
(0,
p._)(this, _RootState),
(0,
v._)(this, "skipServerPrefetch", void 0),
(0,
v._)(this, "setupServerState", void 0),
(0,
v._)(this, "onmountedServerState", void 0)
}
return (0,
f._)(_RootState, [{
key: "provideServerState",
value: function provideServerState(e, r, i) {
var a, s, u;
this.setupServerState = (0,
S.qj)(window.__SETUP_SERVER_STATE__ || {}),
this.onmountedServerState = (0,
S.qj)(window.__ONMOUNTED_SERVER_STATE__ || {}),
(0,
S.JJ)(_RootState.SETUP_SERVER_STATE, this.setupServerState),
(0,
S.JJ)(_RootState.ONMOUNTED_SERVER_STATE, this.onmountedServerState),
a = C.instance,
(u = null == i ? void 0 : null === (s = i.headers) || void 0 === s ? void 0 : s[A.XRAY_TRACE_HEADER_NAME]) && (a.defaults.headers.common[A.XRAY_TRACE_HEADER_NAME] = u),
(0,
S.JJ)(_RootState.HTTP, C)
}
}], [{
key: "provideUseServerPrefetch",
value: function provideUseServerPrefetch() {
return function useServerPrefetch2(e, r) {
var i = r.key
, a = void 0 === i ? e.name : i
, s = r.serverOnly
, u = r.clientFetch;
r.ignoreSkipServerPrefetch,
r.PARALLEL;
var c = (0,
S.iH)()
, d = (0,
S.f3)(_RootState.SETUP_SERVER_STATE) || {}
, p = void 0 !== d[a]
, f = (0,
S.f3)(_RootState.ONMOUNTED_SERVER_STATE) || {}
, v = void 0 !== f[a];
return p && (c.value = d[a]),
(0,
S.bv)((0,
l._)(function() {
return (0,
E.Jh)(this, function(r) {
switch (r.label) {
case 0:
if (v && (c.value = f[a]),
s || !(u || !(p || v)))
return [3, 2];
return [4, u ? u({
prefeched: f[a] || d[a]
}) : e({
isBrowser: !0,
prefeched: f[a] || d[a]
})];
case 1:
c.value = r.sent(),
r.label = 2;
case 2:
return [2]
}
})
})),
c
}
}
}, {
key: "provideUseHttp",
value: function provideUseHttp() {
return function useHttp2() {
return (0,
S.f3)(_RootState.HTTP)
}
}
}]),
_RootState
}(),
(0,
v._)(s, "SKIP_SERVER_PREFETCH", Symbol("SKIP_SERVER_PREFETCH")),
(0,
v._)(s, "SETUP_SERVER_STATE", Symbol("SETUP_SERVER_STATE")),
(0,
v._)(s, "ONMOUNTED_SERVER_STATE", Symbol("ONMOUNTED_SERVER_STATE")),
(0,
v._)(s, "HTTP", Symbol("HTTP")),
s);
function createRoot() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
, r = e.name
, i = e.skipServerPrefetch
, a = e.serverState
, s = e.customRoot
, u = e.serverContext
, c = new x
, l = (0,
S.aZ)({
name: void 0 === r ? "Root" : r,
setup: function() {
return c.provideServerState(i, a, u)
},
render: function() {
return s ? "string" == typeof s ? (0,
S.h)((0,
S.up)(s)) : (0,
S.h)(s) : (0,
S.h)((0,
S.up)("router-view"))
}
});
return {
rootState: c,
rootComponent: l
}
}
function formatComponentName(e) {
if (e) {
if (e.$root === e)
return "root";
var r, i, a, s = (null === (r = e.$options) || void 0 === r ? void 0 : r.name) || (null === (i = e.$options) || void 0 === i ? void 0 : i._componentTag);
return "".concat(s ? "component <".concat(s, ">") : "anonymous component", " at ").concat((null === (a = e.$options) || void 0 === a ? void 0 : a.__file) || "untracked")
}
return "untracked"
}
x.provideUseServerPrefetch(),
x.provideUseHttp(),
(0,
S.aZ)({
props: {
name: {
type: String,
required: !1
},
ignoreImgLoad: {
type: Boolean,
required: !1,
default: !1
},
finalized: {
type: Boolean,
required: !1,
default: !0
}
},
setup: function(e, r) {
var i = r.slots
, a = !1;
return e.finalized ? function() {
var r = null === (s = i.default) || void 0 === s ? void 0 : s.call(i);
if (!a && (a = !0,
r)) {
var s, u, c, l = r[r.length - 1], d = e.name || "__UNSET__", p = (null === (u = l.props) || void 0 === u ? void 0 : u.id) || "__UNSET__", srcListener = function(e) {
return 'function (event){var value=event.timeStamp;var legacy=value-window.performance.timing.navigationStart;if(legacy>0){value=legacy};window.__CUSTOM_FMP_REPORT__("'.concat(d, '","').concat(p, '",').concat(e, ",value)}")
};
return [r, (0,
S.h)("script", {
innerHTML: 'window.__CUSTOM_FMP_REPORT__=function (name,id,src,value){window.__CUSTOM_FMP_METRICS__={"name":name,"id":id,"src":src,"value":value||performance.now()}};window.__CUSTOM_FMP_REPORT__("'.concat(d, '","').concat(p, '","__UNSET__");').concat(!e.ignoreImgLoad && (null === (c = l.props) || void 0 === c ? void 0 : c.id) ? 'window.__CUSTOM_FMP_ELEMENT__=document.getElementById("'.concat(l.props.id, '");if(window.__CUSTOM_FMP_ELEMENT__.tagName=="IMG"){(function(){var src=window.__CUSTOM_FMP_ELEMENT__.src;window.__CUSTOM_FMP_ELEMENT__.addEventListener("load",').concat(srcListener("src"), ')})()}else{(function(){for(var el of window.__CUSTOM_FMP_ELEMENT__.getElementsByTagName("img")){var src=el.src;el.addEventListener("load",').concat(srcListener("src"), ")}})()};") : "")
})]
}
return [r]
}
: function() {
var e;
return null === (e = i.default) || void 0 === e ? void 0 : e.call(i)
}
}
});
var D = Symbol("logger")
, F = {
install: function(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {
transport: {
console: !1
}
};
!r[D] && (r[D] = i,
e.logger.configure(i)),
e.app.config.errorHandler = function(r, i, a) {
var s;
return e.logger.error(r, {
componentName: formatComponentName(i),
propsData: null == i ? void 0 : null === (s = i.$options) || void 0 === s ? void 0 : s.propsData,
lifecycleHook: a
})
}
},
priority: 0
};
function getEnv(e) {
return "production"
}
var V = Symbol("http")
, install = function(e, r, i) {
var a = i;
!r[V] && (r[V] = i,
a = e.http.configure({
baseURL: ((null == i ? void 0 : i.BASE_URL) ? null == i ? void 0 : i.BASE_URL[getEnv(i.BASE_URL)] : "") || "",
apiList: null == i ? void 0 : i.API_LIST,
defaults: (0,
h._)({
timeout: 1e4,
uploadTimeout: 6e4,
adapter: null == i ? void 0 : i.adapter
}, (null == i ? void 0 : i.BASE_CONFIG) && (0,
h._)({}, i.BASE_CONFIG.defaults, i.BASE_CONFIG[getEnv(i.BASE_CONFIG)]))
})),
(null == i ? void 0 : i.dynamicAdapter) && (e.http.axios.defaults.adapter = i.dynamicAdapter(e, r, a))
};
function isSupportV3Invoke() {
return _isSupportV3Invoke.apply(this, arguments)
}
function _isSupportV3Invoke() {
return (_isSupportV3Invoke = (0,
l._)(function() {
var e;
return (0,
E.Jh)(this, function(e) {
switch (e.label) {
case 0:
if (void 0 !== u)
return [2, u];
e.label = 1;
case 1:
return e.trys.push([1, 3, , 4]),
[4, (0,
R.dz)()];
case 2:
return u = e.sent().buildNumber >= "6630000",
[3, 4];
case 3:
return e.sent(),
u = !1,
[3, 4];
case 4:
return [2, u]
}
})
})).apply(this, arguments)
}
function transformToSearchParams(e) {
if (!e)
return "";
var r = new URLSearchParams;
return Object.entries(e).forEach(function(e) {
var i = (0,
y._)(e, 2)
, a = i[0]
, s = i[1];
r.append(a, s)
}),
r.toString()
}
function sendClientRequestV3Adapter(e) {
return _sendClientRequestV3Adapter.apply(this, arguments)
}
function _sendClientRequestV3Adapter() {
return (_sendClientRequestV3Adapter = (0,
l._)(function(e) {
var r, i, a, s, u, l, d, p, f, v, g, _, y, w, S, T, b, k, C, P, A, I, N;
return (0,
E.Jh)(this, function(E) {
switch (E.label) {
case 0:
if (r = e.method,
i = e.url,
a = e.params,
s = e.paramsSerializer,
u = e.data,
l = e.headers,
p = void 0 !== (d = e.disableFallback) && d,
f = r.toUpperCase(),
v = (l || {})["Content-Type"],
"GET" !== f && (!(v || "").match(/application\/x-www-form-urlencoded|application\/json/) || u instanceof FormData))
return [2, O()(e)];
E.label = 1;
case 1:
if (E.trys.push([1, 6, , 7]),
_ = void 0 === u ? u : JSON.parse(u),
y = Object.prototype.toString.call(_),
_ && "[object Object]" !== y)
return [2, O()(e)];
if (w = L()(i, a, s),
S = {
method: f,
url: w,
headers: l
},
T = null,
"GET" !== f && (T = "application/x-www-form-urlencoded" === v ? transformToSearchParams(_) : JSON.stringify(_),
S.body = T),
!e.timeout)
return [3, 3];
return [4, Promise.race([new Promise(function(r, i) {
setTimeout(function() {
i("RequestTimeout")
}, e.timeout)
}
), (0,
R.qp)(S)])];
case 2:
return b = E.sent(),
[3, 5];
case 3:
return [4, (0,
R.qp)(S)];
case 4:
b = E.sent(),
E.label = 5;
case 5:
if (k = Date.now(),
C = 1,
1 === Number((null == b ? void 0 : null === (g = b.headers) || void 0 === g ? void 0 : g.h5ApiPrefetch) || 5) && (C = 2),
P = b.result,
A = b.value,
I = b.message,
0 === P)
return [2, {
data: A.body,
status: A.status,
headers: A.headers,
config: (0,
m._)((0,
h._)({}, e), {
trackData: {
requestStartTime: c,
requestEndTime: k,
prefetch: C
}
})
}];
throw Error("The result returned from sendClientRequestV3 bridge is not 0, the result code is ".concat(P, ", the message is ").concat(I));
case 6:
if ((null == (N = E.sent()) ? void 0 : N.name) === "SchemaError")
return (N.code === R.nJ.NotSupport || -1e4 === N.code) && console.warn('[Launcher Http] Run "'.concat(r, " ").concat(i, '" request with sendClientRequestV3 fail, make sure your app verion >= 6.63 and run in XHSWebView')),
[2, O()(e)];
if ("RequestTimeout" === N) {
if (p)
throw new M.th("ECONNABORTED",N);
return [2, O()(e)]
}
throw new M.th("EUseBridgeV3Error",(null == N ? void 0 : N.message) || JSON.stringify(N));
case 7:
return [2]
}
})
})).apply(this, arguments)
}
function sendClientRequestV2Adapter(e) {
return _sendClientRequestV2Adapter.apply(this, arguments)
}
function _sendClientRequestV2Adapter() {
return (_sendClientRequestV2Adapter = (0,
l._)(function(e) {
var r, i, a, s, u, c, l, d, p, f, v, g;
return (0,
E.Jh)(this, function(_) {
switch (_.label) {
case 0:
r = e.method,
i = e.url,
a = e.params,
s = e.paramsSerializer,
c = void 0 === (u = e.data) ? u : JSON.parse(u),
_.label = 1;
case 1:
return _.trys.push([1, 3, , 4]),
l = (0,
m._)((0,
h._)({}, a), {
sid: void 0
}),
d = L()(i, l, s),
[4, (0,
R.wS)({
type: r.toUpperCase(),
url: d,
data: c
})];
case 2:
if (f = (p = _.sent()).result,
v = p.response,
0 === f)
return [2, {
data: v.body,
status: v.status,
headers: v.headers,
config: e
}];
throw Error("The result returned from sendClientRequestV2 bridge is not 0");
case 3:
g = _.sent();
throw new M.th("EUseBridgeError",g.message);
case 4:
return [2]
}
})
})).apply(this, arguments)
}
function xhrByBridgeAdapter(e) {
return _xhrByBridgeAdapter.apply(this, arguments)
}
function _xhrByBridgeAdapter() {
return (_xhrByBridgeAdapter = (0,
l._)(function(e) {
var r, i, a, s, u, l;
return (0,
E.Jh)(this, function(d) {
switch (d.label) {
case 0:
if (c = Date.now(),
r = e.method,
a = void 0 !== (i = e.preferBridge) && i,
u = void 0 !== (s = e.useBridge) && s,
!a && !u)
return [2, O()(e)];
d.label = 1;
case 1:
if (d.trys.push([1, 4, , 5]),
a)
return [2, sendClientRequestV3Adapter(e)];
if (!u)
return [3, 3];
return console.warn("[Launcher Http] useBridge was deprecated, please use preferBridge"),
[4, isSupportV3Invoke()];
case 2:
if (d.sent()) {
if (("post" === r || "put" === r || "delete" === r) && e.headers)
return e.headers["Content-Type"] = "application/x-www-form-urlencoded",
[2, sendClientRequestV3Adapter(e)];
if ("get" === r)
return [2, sendClientRequestV3Adapter(e)]
}
return [2, sendClientRequestV2Adapter(e)];
case 3:
return [3, 5];
case 4:
throw l = d.sent(),
new M.th("EUnknowHttpError",l.message);
case 5:
return [2, ""]
}
})
})).apply(this, arguments)
}
var H = {
install: function(e, r, i) {
return install(e, r, (0,
h._)({
adapter: xhrByBridgeAdapter
}, i))
},
priority: 0
};
window.addEventListener("popstate", function() {
var e = new CustomEvent("customPopState",{
detail: {
spvType: "back"
}
});
window.dispatchEvent(e)
});
var U = function(e) {
function Launcher2(e, r) {
(0,
p._)(this, Launcher2),
(i = (0,
d._)(this, Launcher2, [e, r])).use(F, i.options.logger).use(H, i.options.http).use(k.W),
i.router = i.createRouter(),
i.head = (0,
b.c)(i.options.head);
var i, a = createRoot({
name: r.name,
customRoot: r.customRoot
}).rootComponent;
return i.app = i.vm = (window.__SSR__ || window.__STREAMING__ || window.__SSG__ ? S.vr : S.ri)(a),
i.app.use(i.router),
i.app.use(i.head),
i
}
return (0,
g._)(Launcher2, e),
(0,
f._)(Launcher2, [{
key: "createRouter",
value: function createRouter1() {
var e = this.options.router || {}
, r = e.useDefault404Route
, a = e.routes
, s = void 0 === a ? [] : a
, u = e.history
, c = void 0 === u ? (0,
T.PO)() : u
, l = e.linkActiveClass
, d = (0,
_._)(e, ["useDefault404Route", "routes", "history", "linkActiveClass"])
, p = void 0 === r || r ? (0,
w._)(s).concat([{
path: "/:catchAll(.*)",
component: function() {
return i.e("37").then(i.bind(i, 47332)).then(function(e) {
return e.ErrorPage
})
},
meta: {
title: "你访问的页面不见了"
}
}]) : s
, f = (0,
T.p7)((0,
h._)({
routes: this.options.appContainer ? [{
path: "/",
component: this.options.appContainer,
children: p
}] : p,
history: c,
linkActiveClass: void 0 === l ? "active" : l
}, d));
return f.afterEach(function(e) {
var r = e.meta;
"string" == typeof (null == r ? void 0 : r.title) && (document.title = r.title)
}),
f
}
}, {
key: "start",
value: function start() {
var e = this;
return (0,
l._)(function() {
var r, i;
return (0,
E.Jh)(this, function(a) {
switch (a.label) {
case 0:
return e.registerGlobalProperties(),
e.registerPlugins(),
[4, null === (r = (i = e.options).beforeStart) || void 0 === r ? void 0 : r.call(i, e.app)];
case 1:
return a.sent(),
[4, e.router.isReady()];
case 2:
return a.sent(),
e.app.mount(e.template),
[2]
}
})
})()
}
}]),
Launcher2
}(B)
},
42723: function(e, r, i) {
"use strict";
i.d(r, {
Kf: function() {
return w.u
}
});
var a, s, u = i(41622), c = i(46490), l = i(90251), d = i(51606), p = i(70879), f = i(27337), v = i(64593), g = i(377);
i(28636),
i(87535),
i(75204),
i(97357),
i(34333),
i(1154),
i(80013),
i(86651),
i(9557),
i(41593),
i(87989),
i(74719),
i(13396),
i(25069),
i(58486),
i(29112),
i(67275),
i(59989),
i(7099),
i(27461),
i(23339),
i(51109),
i(25037),
i(55947),
i(95477),
i(19077),
i(75973),
i(7608),
i(36277);
var h = i(78607);
i(44840);
var m = i(85456)
, _ = i(14166)
, y = i(50934);
i(71022),
i(7825),
i(86378),
i(17177);
var w = i(53512);
a = function() {
function _Launcher(e, r) {
(0,
c._)(this, _Launcher),
(0,
d._)(this, "ops", void 0),
(0,
d._)(this, "vm", void 0),
(0,
d._)(this, "options", void 0),
(0,
d._)(this, "plugins", []),
(0,
d._)(this, "template", void 0),
(0,
d._)(this, "app", void 0),
(0,
d._)(this, "router", void 0),
(0,
d._)(this, "head", void 0),
(0,
d._)(this, "http", m),
(0,
d._)(this, "logger", _),
(0,
d._)(this, "store", void 0),
(0,
d._)(this, "context", void 0),
(0,
d._)(this, "serverContext", void 0);
var i = r.platform
, a = r.routes
, s = r.router
, u = (void 0 === s ? {} : s).routes
, l = (0,
v._)(r.router, ["routes"]);
this.ops = {
template: e,
config: r
},
this.options = (0,
f._)((0,
p._)({}, r), {
platform: void 0 === i ? "pc" : i,
router: (0,
p._)({
routes: void 0 === u ? a : u
}, l)
}),
this.template = e
}
return (0,
l._)(_Launcher, [{
key: "registerGlobalProperties",
value: function registerGlobalProperties() {
this.app.config.globalProperties.isBrowser = _Launcher.isBrowser
}
}, {
key: "registerPlugins",
value: function registerPlugins() {
var e = this
, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.plugins;
r.sort(function(e, r) {
return e.priority - r.priority
}).forEach(function(r) {
return (0,
r.install)(e, _Launcher, r.options)
})
}
}, {
key: "use",
value: function use(e, r) {
var i, a;
if (void 0 !== e.name && this.plugins.some(function(r) {
var i = r.name;
return e.name === i
}))
return this;
return this.plugins.push({
name: e.name,
install: (a = (0,
u._)(function(r, i, a) {
var s;
return (0,
g.Jh)(this, function(u) {
return e.install(r, i, a),
null === (s = e.create) || void 0 === s || s.call(e, r, i, a),
[2]
})
}),
function(e, r, i) {
return a.apply(this, arguments)
}
),
options: r,
priority: null !== (i = e.priority) && void 0 !== i ? i : "store" === e.name ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY
}),
this
}
}, {
key: "start",
value: function start() {
throw _Launcher.NotImplementedError("start")
}
}, {
key: "render",
value: function render(e, r) {
throw _Launcher.NotImplementedError("render")
}
}, {
key: "streamingRender",
value: function streamingRender(e, r) {
throw _Launcher.NotImplementedError("streamingRender")
}
}], [{
key: "NotImplementedError",
value: function NotImplementedError(e) {
return Error("[Launcher Exception] ".concat(e, " is not implemented yet."))
}
}]),
_Launcher
}(),
(0,
d._)(a, "version", "3.32.1"),
(0,
d._)(a, "isBrowser", !0),
(0,
d._)(a, "http", m),
(0,
d._)(a, "logger", _);
var E = (s = function() {
function _RootState() {
(0,
c._)(this, _RootState),
(0,
d._)(this, "skipServerPrefetch", void 0),
(0,
d._)(this, "setupServerState", void 0),
(0,
d._)(this, "onmountedServerState", void 0)
}
return (0,
l._)(_RootState, [{
key: "provideServerState",
value: function provideServerState(e, r, i) {
var a, s, u;
this.setupServerState = (0,
h.qj)(window.__SETUP_SERVER_STATE__ || {}),
this.onmountedServerState = (0,
h.qj)(window.__ONMOUNTED_SERVER_STATE__ || {}),
(0,
h.JJ)(_RootState.SETUP_SERVER_STATE, this.setupServerState),
(0,
h.JJ)(_RootState.ONMOUNTED_SERVER_STATE, this.onmountedServerState),
a = m.instance,
(u = null == i ? void 0 : null === (s = i.headers) || void 0 === s ? void 0 : s[y.XRAY_TRACE_HEADER_NAME]) && (a.defaults.headers.common[y.XRAY_TRACE_HEADER_NAME] = u),
(0,
h.JJ)(_RootState.HTTP, m)
}
}], [{
key: "provideUseServerPrefetch",
value: function provideUseServerPrefetch() {
return function useServerPrefetch2(e, r) {
var i = r.key
, a = void 0 === i ? e.name : i
, s = r.serverOnly
, c = r.clientFetch;
r.ignoreSkipServerPrefetch,
r.PARALLEL;
var l = (0,
h.iH)()
, d = (0,
h.f3)(_RootState.SETUP_SERVER_STATE) || {}
, p = void 0 !== d[a]
, f = (0,
h.f3)(_RootState.ONMOUNTED_SERVER_STATE) || {}
, v = void 0 !== f[a];
return p && (l.value = d[a]),
(0,
h.bv)((0,
u._)(function() {
return (0,
g.Jh)(this, function(r) {
switch (r.label) {
case 0:
if (v && (l.value = f[a]),
s || !(c || !(p || v)))
return [3, 2];
return [4, c ? c({
prefeched: f[a] || d[a]
}) : e({
isBrowser: !0,
prefeched: f[a] || d[a]
})];
case 1:
l.value = r.sent(),
r.label = 2;
case 2:
return [2]
}
})
})),
l
}
}
}, {
key: "provideUseHttp",
value: function provideUseHttp() {
return function useHttp2() {
return (0,
h.f3)(_RootState.HTTP)
}
}
}]),
_RootState
}(),
(0,
d._)(s, "SKIP_SERVER_PREFETCH", Symbol("SKIP_SERVER_PREFETCH")),
(0,
d._)(s, "SETUP_SERVER_STATE", Symbol("SETUP_SERVER_STATE")),
(0,
d._)(s, "ONMOUNTED_SERVER_STATE", Symbol("ONMOUNTED_SERVER_STATE")),
(0,
d._)(s, "HTTP", Symbol("HTTP")),
s);
E.provideUseServerPrefetch(),
E.provideUseHttp(),
(0,
h.aZ)({
props: {
name: {
type: String,
required: !1
},
ignoreImgLoad: {
type: Boolean,
required: !1,
default: !1
},
finalized: {
type: Boolean,
required: !1,
default: !0
}
},
setup: function(e, r) {
var i = r.slots
, a = !1;
return e.finalized ? function() {
var r = null === (s = i.default) || void 0 === s ? void 0 : s.call(i);
if (!a && (a = !0,
r)) {
var s, u, c, l = r[r.length - 1], d = e.name || "__UNSET__", p = (null === (u = l.props) || void 0 === u ? void 0 : u.id) || "__UNSET__", srcListener = function(e) {
return 'function (event){var value=event.timeStamp;var legacy=value-window.performance.timing.navigationStart;if(legacy>0){value=legacy};window.__CUSTOM_FMP_REPORT__("'.concat(d, '","').concat(p, '",').concat(e, ",value)}")
};
return [r, (0,
h.h)("script", {
innerHTML: 'window.__CUSTOM_FMP_REPORT__=function (name,id,src,value){window.__CUSTOM_FMP_METRICS__={"name":name,"id":id,"src":src,"value":value||performance.now()}};window.__CUSTOM_FMP_REPORT__("'.concat(d, '","').concat(p, '","__UNSET__");').concat(!e.ignoreImgLoad && (null === (c = l.props) || void 0 === c ? void 0 : c.id) ? 'window.__CUSTOM_FMP_ELEMENT__=document.getElementById("'.concat(l.props.id, '");if(window.__CUSTOM_FMP_ELEMENT__.tagName=="IMG"){(function(){var src=window.__CUSTOM_FMP_ELEMENT__.src;window.__CUSTOM_FMP_ELEMENT__.addEventListener("load",').concat(srcListener("src"), ')})()}else{(function(){for(var el of window.__CUSTOM_FMP_ELEMENT__.getElementsByTagName("img")){var src=el.src;el.addEventListener("load",').concat(srcListener("src"), ")}})()};") : "")
})]
}
return [r]
}
: function() {
var e;
return null === (e = i.default) || void 0 === e ? void 0 : e.call(i)
}
}
}),
Symbol("logger"),
Symbol("http"),
window.addEventListener("popstate", function() {
var e = new CustomEvent("customPopState",{
detail: {
spvType: "back"
}
});
window.dispatchEvent(e)
})
},
72252: function(e, r, i) {
"use strict";
i.d(r, {
ZK: function() {
return f
},
vU: function() {
return p
}
});
var a = i(70879);
i(58051),
i(87535),
i(75204),
i(97357),
i(34333);
var s = {
ERROR: 50,
WARN: 40,
INFO: 30,
DEBUG: 20
};
function isPlainObject_isPlainObject(e) {
return e && "[object Object]" === Object.prototype.toString.call(e)
}
function isUndefined(e) {
return void 0 === e
}
i(55947),
i(7608),
i(75973);
var u = i(31547);
function isError(e) {
return e instanceof Error || (void 0 === e ? "undefined" : (0,
u._)(e)) === "object" && !!e.message && !!e.stack || !1
}
function normalizePayload(e, r) {
var i = {};
if (isPlainObject_isPlainObject(r))
for (var a in r)
r.hasOwnProperty(a) && (i[a] = r[a]);
if (isError(e))
i.error = !0,
i.stack = e.stack || "",
i.message = e.message || "",
void 0 !== e.code && (i.code = e.code || ""),
void 0 !== e.internal && (i.internal = e.internal);
else if (isPlainObject_isPlainObject(e))
for (var s in i.message = "no_message",
e)
e.hasOwnProperty(s) && (i[s] = e[s]);
else
i.message = String(e);
var u = 1 === Object.keys(i).length;
return Object.defineProperty(i, "plain", {
value: u
}),
i
}
i(41593);
var c = console.error && console.debug
, getMethod = function(e) {
if (c) {
if (e >= s.ERROR)
return "error";
if (e >= s.WARN)
return "warn";
if (e >= s.INFO)
return "info"
}
return "log"
}
, outputConsole = function(e, r) {
var i = getMethod(e);
console[i](r)
}
, outputForBrowser = function(e, r) {
r.error ? outputConsole(e, r.stack) : r.plain ? outputConsole(e, r.message) : outputConsole(e, r)
}
, outputForServer = function(e, r) {
r.plain ? outputConsole(e, r.message) : outputConsole(e, JSON.stringify(r))
}
, dispatchContent = function(e, r) {
outputForBrowser(e, r)
};
function consoleTransport(e, r, i) {
dispatchContent(e, normalizePayload(r, i))
}
var l = i(75649);
i(86651);
var getLogLevel = function(e) {
var r = "INFO";
return e >= s.ERROR ? r = "ERROR" : e >= s.WARN && (r = "WARN"),
{
type: "LogLevel",
value: r
}
};
function outputEaglet(e, r, i, a) {
var s, u, c = window.eaglet;
if (!!c)
u = r.error ? r.stack : r.plain ? r.message : JSON.stringify(r),
c.push({
apmLog: {
type: "ApmLog",
value: {
group: a,
message: u,
context: JSON.stringify(i),
level: getLogLevel(e),
error: {
type: "LogError",
value: {
message: (s = r).message,
stack: s.stack,
code: s.code,
internal: s.internal
}
}
}
}
}, "ApmTracker")
}
var eaglet_dispatchContent = function() {
for (var e = arguments.length, r = Array(e), i = 0; i < e; i++)
r[i] = arguments[i];
outputEaglet.apply(void 0, (0,
l._)(r))
};
function eagletTransport(e, r, i, a) {
eaglet_dispatchContent(e, normalizePayload(r), i, a)
}
var d = {
transport: {
eaglet: !1,
sentry: !1,
console: !0
},
fields: {}
};
function shouldTransport(e, r) {
return !0 === e || "number" == typeof e && !!(r >= e) || !1
}
function log(e, r, i, s) {
var u = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {};
if (i = isPlainObject_isPlainObject(i) ? (0,
a._)({}, d.fields, i) : d.fields,
shouldTransport(void 0 === u.console ? d.transport.console : u.console, e))
consoleTransport(e, r, i, s);
if (shouldTransport(void 0 === u.eaglet ? d.transport.eaglet : u.eaglet, e))
eagletTransport(e, r, i, s)
}
var wrap = function(e) {
return function(r, i, a, s) {
return log(e, r, i, a, s)
}
}
, p = wrap(s.ERROR)
, f = wrap(s.WARN);
wrap(s.INFO),
wrap(s.DEBUG)
},
14166: function(e, r, i) {
"use strict";
i.r(r),
i.d(r, {
info: function() {
return g
},
assert: function() {
return assert
},
error: function() {
return f
},
debug: function() {
return h
},
LOG_LEVEL: function() {
return s
},
configure: function() {
return configure
},
warn: function() {
return v
},
fatal: function() {
return fatal
}
}),
i(58051),
i(87535),
i(75204),
i(97357),
i(34333),
i(43648),
i(42876),
i(33933),
i(87989);
var a, s = {
FATAL: 60,
ERROR: 50,
WARN: 40,
INFO: 30,
DEBUG: 20,
TRACE: 10
};
function isPlainObject(e) {
return e && "[object Object]" === Object.prototype.toString.call(e)
}
function isUndefined(e) {
return void 0 === e
}
i(55947);
var u = i(64593);
i(7608),
i(75973);
var c = i(31547);
function isError(e) {
return e instanceof Error || (void 0 === e ? "undefined" : (0,
c._)(e)) === "object" && !!e.message && !!e.stack || !1
}
function normalizePayload(e, r) {
var i = {};
if (isPlainObject(r))
for (var a in r)
r.hasOwnProperty(a) && (i[a] = r[a]);
if (isError(e))
i.error = !0,
i.stack = e.stack || "",
i.message = e.message || "",
void 0 !== e.code && (i.code = e.code || ""),
void 0 !== e.internal && (i.internal = e.internal);
else if (isPlainObject(e))
for (var s in i.message = "no_message",
e)
e.hasOwnProperty(s) && (i[s] = e[s]);
else
i.message = String(e);
var u = 1 === Object.keys(i).length;
return Object.defineProperty(i, "plain", {
value: u
}),
i
}
i(41593);
var l = console.error && console.debug
, getMethod = function(e) {
if (l) {
if (e >= s.ERROR)
return "error";
if (e >= s.WARN)
return "warn";
if (e >= s.INFO)
return "info"
}
return "log"
}
, outputConsole = function(e, r) {
var i = getMethod(e);
console[i](r)
}
, generateOuputString = function(e) {
var r = e.message
, i = (0,
u._)(e, ["message"]);
return "".concat(r, ", extra: ").concat(JSON.stringify(i))
}
, outputForBrowser = function(e, r) {
r.error ? outputConsole(e, r.stack) : r.plain ? outputConsole(e, r.message) : outputConsole(e, generateOuputString(r))
}
, outputForServer = function(e, r) {
r.plain ? outputConsole(e, r.message) : outputConsole(e, generateOuputString(r))
}
, dispatchContent = function(e, r) {
outputForBrowser(e, r)
};
function consoleTransport(e, r, i) {
dispatchContent(e, normalizePayload(r, i))
}
var d = {
transport: {
console: !0
},
fields: {}
};
a = s.INFO,
dispatchContent(a, normalizePayload("框架和 SDK 输出的日志默认不展示,可在框架配置文件中设置开启,详见 https://doc.weixin.qq.com/doc/w3_AWkASAb9APAr8IdJI5VS0OyqetUE6?scode=ANAAyQcbAAgB8qKjm9AWkASAb9APA", {}));
var p = ["app", "prdline", "logType"];
function configure(e) {
var r = e.transport
, i = e.fields;
isPlainObject(r) && (d.transport = Object.assign(d.transport, r)),
isPlainObject(i) && p.forEach(function(e) {
e in i && (d.fields[e] = i[e])
})
}
function shouldTransport(e, r) {
return !0 === e || "number" == typeof e && !!(r >= e) || !1
}
function capitalizeFirstLetter(e) {
return e && "string" == typeof e ? e.charAt(0).toUpperCase() + e.slice(1) : ""
}
function log(e, r, i, a) {
var u, c, l, p = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {}, f = "";
if (f = isPlainObject(i) ? a || "" : i || "",
shouldTransport(isUndefined(p.console) ? d.transport.console : p.console, e) && ((null === (l = d.fields.logType) || void 0 === l ? void 0 : l.includes(f)) || e >= s.ERROR)) {
;u = e,
c = "[".concat(capitalizeFirstLetter(f), "] ").concat(r),
dispatchContent(u, normalizePayload(c, i))
}
}
var wrap = function(e) {
return function(r, i, a, s) {
return log(e, r, i, a, s)
}
}
, f = wrap(s.ERROR)
, v = wrap(s.WARN)
, g = wrap(s.INFO)
, h = wrap(s.DEBUG)
, fatal = function(e, r, i, a) {
throw f(e, r, i, a),
e
}
, assert = function(e, r) {
!e && fatal(r)
}
},
94934: function() {
"undefined" != typeof window && (window.process = window.process || {},
window.process.env = window.process.env || {},
window.process.env.BROWSER = !0,
window.process.env.BUILD_ENV = "production")
},
71022: function(e, r, i) {
"use strict";
i.d(r, {
Ww: function() {
return showTrack
},
qc: function() {
return emitTrack
},
dh: function() {
return getTrackEnv
},
_V: function() {
return getNetworkType
},
EU: function() {
return emitApmTrack
},
dz: function() {
return getDeviceInfo
},
qp: function() {
return sendClientRequestV3
},
Ld: function() {
return subscribe
},
wS: function() {
return sendClientRequestV2
},
nJ: function() {
return l.nJ
},
Xw: function() {
return showApmTrack
}
}),
i(19738),
i(1154),
i(80013),
i(97357),
i(34333),
i(97542),
i(80156),
i(50721),
i(29112),
i(67275),
i(59989),
i(7099),
i(27461),
i(23339),
i(51109),
i(55947);
var a, s = i(63522);
i(87535),
i(75204),
i(86651),
i(87989),
i(72169),
i(58486),
i(36277);
var u = i(7862)
, c = i.n(u)
, l = i(28934);
function isSupport_isSupport(e) {
var r, i = s.YF.isIOS ? null === (r = window.webkit) || void 0 === r ? void 0 : r.messageHandlers : window.xhsbridge;
return i && !!i[e]
}
i(7608),
i(99808),
i(6045),
i(10364),
i(67673),
i(9557);
var d = "0";
if (s.YF.isXHS) {
var p = (0,
s.Vk)()
, f = p.major
, v = p.minor
, g = p.patch;
d = "".concat(f, ".").concat(v, ".").concat(g)
}
function coerce(e) {
var r = e.split(".").map(function(e) {
return Number.parseInt(e, 10)
});
return [r[0] || 0, r[1] || 0, r[2] || 0]
}
function compare(e, r) {
for (var i = coerce(e), a = coerce(r), s = 0, u = 0; u < 3; u++) {
if (i[u] > a[u])
return 1;
i[u] === a[u] && (s += 1)
}
return 3 === s ? 0 : -1
}
function appVersionLt(e) {
return 0 > compare(d, e)
}
function version_appVersionGte(e) {
return !appVersionLt(e)
}
function appVersionEq(e) {
return 0 === compare(d, e)
}
var h = i(35329)
, m = i(46490)
, _ = i(27292)
, y = i(75649)
, w = i(30961);
i(41593);
var E = function(e) {
function BridgeError(e) {
for (var r, i = arguments.length, a = Array(i > 1 ? i - 1 : 0), s = 1; s < i; s++)
a[s - 1] = arguments[s];
return (0,
m._)(this, BridgeError),
(r = (0,
h._)(this, BridgeError, (0,
y._)(a))).name = "BridgeError",
r.code = e,
r
}
return (0,
_._)(BridgeError, e),
BridgeError
}((0,
w._)(Error));
function bridge(e, r, i) {
var a = {};
if (void 0 !== r && (a.data = r),
i && (a.callback = i),
s.YF.isIOS) {
if ("registerNotice" === e && !appVersionLt("5.29") && appVersionLt("5.31")) {
try {
window.webkit.messageHandlers[e].postMessage({
data: i
})
} catch (e) {
throw new E("ERR_NATIVE",e.message)
}
return
}
try {
window.webkit.messageHandlers[e].postMessage(a)
} catch (r) {
throw new E("ERR_NATIVE","".concat(r.message, ", bridge is ").concat(e))
}
} else {
var u = JSON.stringify(a);
try {
window.xhsbridge[e](u)
} catch (r) {
throw new E("ERR_NATIVE","".concat(r.message, ", bridge is ").concat(e))
}
}
}
i(19077),
i(75973);
var S = i(4659);
function generateKey() {
return (0,
S.Z)().replace(/-/g, "_")
}
i(34885);
var T = i(72252);
function check(e, r, i, a) {
setTimeout(function() {
try {
c().checkPropTypes({
prop: e
}, {
prop: r
}, i, "ozone-bridge/".concat(a), !1, !0)
} catch (e) {
var s = e.stack.indexOf(e.message) > -1 ? e.stack : "Error: ".concat(e.message, "\n").concat(e.stack);
(0,
T.vU)(s, null, null, {
console: !0,
owl: !0
})
}
})
}
function checks_checkArgs(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
if (!r) {
(0,
T.ZK)("argsT is necessary");
return
}
check(r, e, "args", i)
}
function checks_checkRes(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
if (!r) {
(0,
T.ZK)("resT is necessary");
return
}
check(r, e, "res", i)
}
function escapeNewLineChars(e) {
return "string" == typeof e ? e.replace(/\n/g, "\\n").replace(/\r/g, "\\r") : e
}
a = window.XHS_CALLBACKS || (window.XHS_CALLBACKS = {});
var b = {
add: function add(e, r, i) {
var u = "".concat(e, "_").concat(generateKey());
return a[u] = function callbackWrap(a) {
var u;
if (s.YF.isIOS || !appVersionLt("5.26.1"))
u = a;
else
try {
u = JSON.parse(escapeNewLineChars(a))
} catch (e) {
u = a
}
(null == i ? void 0 : i.resT) && checks_checkRes(u, i.resT, e),
r(u)
}
,
"XHS_CALLBACKS.".concat(u)
}
};
function callbackAdapter(e, r, i, a) {
var s;
if (!isSupport_isSupport(e))
throw new E("ERR_NOT_SUPPORT","not support ".concat(e));
(null == a ? void 0 : a.argsT) && checks_checkArgs(r, a.argsT, e),
"function" == typeof i && (s = b.add(e, i, a)),
bridge(e, r, s)
}
function bridgeAdapter_adapter(e, r, i) {
return new Promise(function(a, s) {
try {
var u = r
, c = i;
u && (u.argsT || u.resT) && (c = u,
u = void 0),
callbackAdapter(e, u, a, c)
} catch (e) {
s(e)
}
}
)
}
var k = i(31547);
s.YF.isAndroid && appVersionLt("5.20");
function postNotice(e) {
var r = e.methodName
, i = e.data
, a = ("undefined" == typeof window ? "undefined" : (0,
k._)(window)) === "object" && "object" === (0,
k._)(window.wx) ? window.wx : null;
return a && a.miniProgram && a.miniProgram.postMessage ? (a.miniProgram.postMessage({
data: {
methodName: r,
data: i
}
}),
Promise.resolve()) : Promise.resolve()
}
function changeTitle() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";
return postNotice({
methodName: "changeTitle",
data: {
title: e
}
})
}
i(25069);
var C = c().oneOf([0, -1]).isRequired;
function deprecatedStr(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
return "[OzoneBridge] ".concat(e, " was deprecated, please use ").concat(r, ".").concat(i ? " Changelog for ".concat(i) : "")
}
function logDeprecated_warnDeprecated(e, r, i) {
(0,
T.ZK)(deprecatedStr(e, r, i))
}
function ui_changeTitle(e) {
logDeprecated_warnDeprecated("changeTitle", "document.title = 'my title'");
var r = {
argsT: c().string.isRequired
};
return s.YF.isMiniprogram ? changeTitle(e) : bridgeAdapter_adapter("changeTitle", e, r)
}
function setNaviBackCallbackLegacy(e) {
return callbackAdapter("setNaviBackCallback", void 0, e)
}
function closeWindow() {
return bridgeAdapter_adapter("closeWindow")
}
function showTrack(e) {
return bridgeAdapter_adapter("showTrack", e, {
argsT: c().shape({
title: c().string,
content: c().string,
isNewTrack: c().bool
})
})
}
function showApmTrack(e) {
return bridgeAdapter_adapter("showApmTrack", e, {
argsT: c().shape({
content: c().string
})
})
}
function emitTrack(e) {
return bridgeAdapter_adapter("emitTrack", e, {
argsT: c().string.isRequired
})
}
function emitApmTrack(e) {
return bridgeAdapter_adapter("emitApmTrack", e, {
argsT: c().string.isRequired
})
}
function completeUrl(e) {
if (!e.startsWith("http"))
return e.startsWith("//") ? window.location.protocol + e : window.location.origin + e;
return e
}
i(63712),
function installPolyfill() {
if (s.YF.isMiniprogram) {
Object.defineProperty(document, "title", {
set: function(e) {
this._title = e,
changeTitle(e)
},
get: function() {
return this._title
},
configurable: !0
});
return
}
if (!!s.YF.isXHS) {
appVersionLt("6.36") && (window.open = function windowOpen(e) {
if (["redtop://", "uniik://"].some(function(r) {
return null == e ? void 0 : e.startsWith(r)
}))
window.location.href = e;
else {
var r = new URL(completeUrl(e));
r.searchParams.set("openPage", "yes"),
window.location.href = r.toString()
}
}
);
var e = window.close;
window.close = function windowClose() {
closeWindow().catch(function() {
return null == e ? void 0 : e()
})
}
,
s.YF.isAndroid && (appVersionEq("6.61") && !window.XHSEvents && (window.XHSEvents = {}),
appVersionLt("6.54") && Object.defineProperty(document, "title", {
set: function(e) {
this._title = e,
ui_changeTitle(e)
},
get: function() {
return this._title
},
configurable: !0
}))
}
}();
var P = i(41622)
, A = i(70879)
, R = i(27337)
, I = i(64593)
, O = i(377);
i(15066),
i(42876),
i(33933);
var N = i(36757);
function adaptGetDeviceInfo(e) {
return s.YF.isIOS && (e.deviceId = e.uniqueId),
e
}
function getDeviceInfoOld() {
function imeiType() {
return appVersionLt("5.24") ? {} : s.YF.isIOS ? {
idfa: c().string.isRequired,
idfv: c().string.isRequired
} : {
imei: c().string.isRequired
}
}
var e = {
resT: c().shape((0,
A._)({
result: C,
appMarket: c().string.isRequired,
appVersion: c().string.isRequired,
buildNumber: c().string.isRequired,
systemVersion: c().string.isRequired,
deviceModel: c().string.isRequired,
manufacturer: c().string.isRequired,
timezone: c().string.isRequired,
deviceScreenWidth: c().number.isRequired,
deviceScreenHeight: c().number.isRequired,
carrier: c().string.isRequired,
uniqueId: c().string.isRequired
}, s.YF.isIOS ? {
applepayInfo: c().bool.isRequired
} : {}, imeiType))
};
return bridgeAdapter_adapter("getDeviceInfo").then(function(r) {
var i = (0,
N.Lg)(r);
return r.applepay_info && (i.applepay_info = r.applepay_info,
logDeprecated_warnDeprecated("res.applepay_info", "res.applepayInfo")),
checks_checkRes(i, e.resT),
i
})
}
function getDeviceInfo() {
return _getDeviceInfo.apply(this, arguments)
}
function _getDeviceInfo() {
return (_getDeviceInfo = (0,
P._)(function() {
var e, r, i, a;
return (0,
O.Jh)(this, function(a) {
switch (a.label) {
case 0:
return a.trys.push([0, 2, , 3]),
[4, (0,
l.dw)("getDeviceInfo")];
case 1:
if (r = (e = a.sent() || {}).result,
i = e.value,
0 === r)
return [2, adaptGetDeviceInfo(i)];
return [2, getDeviceInfoOld()];
case 2:
return a.sent(),
[2, getDeviceInfoOld()];
case 3:
return [2]
}
})
})).apply(this, arguments)
}
function getNetworkTypeLegacy() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
extractValue: !1
}
, r = {
resT: c().shape({
result: C,
value: c().oneOf(["WiFi", "4G", "3G+", "3G", "2G", "NONE"])
})
};
return bridgeAdapter_adapter("getNetworkType").then(function(i) {
var a = (0,
A._)({}, i);
if (("wifi" === i.value || "WIFI" === i.value) && (a.value = "WiFi"),
checks_checkRes(a, r.resT),
e.extractValue) {
if (0 === a.result)
return a.value;
throw new E("ERR_RESULT_".concat(a.result),"res.result is not 0")
}
return a
})
}
function getNetworkType() {
return _getNetworkType.apply(this, arguments)
}
function _getNetworkType() {
return (_getNetworkType = (0,
P._)(function() {
var e, r, i, a, s, u, c = arguments;
return (0,
O.Jh)(this, function(u) {
switch (u.label) {
case 0:
e = c.length > 0 && void 0 !== c[0] ? c[0] : {
extractValue: !1
},
u.label = 1;
case 1:
return u.trys.push([1, 3, , 4]),
[4, (0,
l.dw)("getNetworkType")];
case 2:
if (a = (i = (r = u.sent()) || {}).result,
s = i.value,
0 === a)
return [2, e.extractValue ? s : r];
return [3, 4];
case 3:
return u.sent(),
[2, getNetworkTypeLegacy(e)];
case 4:
return [2, getNetworkTypeLegacy(e)]
}
})
})).apply(this, arguments)
}
function getTrackEnvOld() {
var e = {
resT: c().shape({
isTestEnv: c().bool,
uploadOneByOne: c().bool,
sessionId: c().string
})
};
return bridgeAdapter_adapter("getTrackEnv").then(function(r) {
var i = (0,
N.Lg)(r);
return r.session_id && (i.sessionId = r.session_id),
checks_checkRes(i, e.resT),
i
})
}
function getTrackEnv() {
return _getTrackEnv.apply(this, arguments)
}
function _getTrackEnv() {
return (_getTrackEnv = (0,
P._)(function() {
var e, r, i, a;
return (0,
O.Jh)(this, function(a) {
switch (a.label) {
case 0:
return a.trys.push([0, 2, , 3]),
[4, (0,
l.dw)("getTrackEnv")];
case 1:
if (r = (e = a.sent() || {}).result,
i = e.value,
0 === r)
return i.session_id = i.sessionId,
[2, i];
return [3, 3];
case 2:
return a.sent(),
[2, getTrackEnvOld()];
case 3:
return [2, getTrackEnvOld()]
}
})
})).apply(this, arguments)
}
function basicSendClientRequest(e) {
return bridgeAdapter_adapter("sendClientRequest", e)
}
function sendClientRequestV2(e) {
var r = (0,
R._)((0,
A._)({}, e), {
url: completeUrl(e.url)
});
return isSupport_isSupport("sendClientRequestV2") && s.YF.isAndroid ? bridgeAdapter_adapter("sendClientRequestV2", r) : basicSendClientRequest(r).then(function(e) {
var r = e.result
, i = e.status
, a = e.response;
if (s.YF.isAndroid) {
if (-1 === r)
return -1 !== i ? {
result: 0,
response: {
status: i
}
} : {
result: r
};
return {
result: r,
response: {
status: 200,
body: a
}
}
}
if (-1 === r)
return a ? {
result: 0,
response: {
status: 200,
body: a
}
} : {
result: r
};
return {
result: r,
response: {
status: 200,
body: a
}
}
})
}
function sendClientRequestV3(e) {
var r = (0,
A._)({}, e.headers)
, i = e.method.toUpperCase()
, a = r["Content-Type"]
, s = (0,
I._)(r, ["Content-Type"]);
"GET" === i || ["application/x-www-form-urlencoded", "application/json"].includes(a) ? "GET" === i && a && (r = s) : r["Content-Type"] = "application/json",
Object.keys(r).forEach(function(e) {
"string" != typeof r[e] && (r[e] = String(r[e]))
});
var u = (0,
R._)((0,
A._)({}, e), {
url: completeUrl(e.url),
headers: r
});
return (0,
l.dw)("sendClientRequestV3", u)
}
function registerNoticeLegacy(e) {
return callbackAdapter("registerNotice", void 0, e)
}
var L = {
viewWillAppearIOS: {
ios: "5.6.0"
},
viewDidAppear: {
ios: "5.39.0",
android: "5.7.0"
},
viewWillDisappearIOS: {
ios: "5.6.0"
},
viewDidDisappear: {
ios: "5.39.0",
android: "5.7.0"
},
viewAppear: {
ios: "5.6.0",
android: "5.7.0"
},
viewDisappear: {
ios: "5.6.0",
android: "5.7.0"
},
keyboardChange: {
ios: "5.7.0",
namespace: "XHSHandler"
},
afterLogin: {
ios: "5.22.0",
android: "5.22.0",
namespace: "XHSHandler"
},
dataTrafficChange: {
ios: "5.42",
android: "5.42",
namespace: "XHSHandler"
},
themeTypeChange: {
ios: "6.13",
android: "6.12",
namespace: "XHSHandler"
},
faceRecognitionResult: {
ios: "6.58",
android: "6.58",
namespace: "XHSHandler"
},
onBomLotteryStart: {
ios: "6.63",
android: "6.63",
namespace: "XHSHandler"
},
onBomLotteryEnd: {
ios: "6.63",
android: "6.63",
namespace: "XHSHandler"
},
onHitCouponFinish: {
ios: "6.65",
android: "6.65",
namespace: "XHSHandler"
},
receiveTrickleMessage: {
android: "6.81.0",
namespace: "XHSHandler"
}
};
function supportEvent(e) {
var r = L[e];
if (!r)
return !1;
return s.YF.isIOS && r.ios && !appVersionLt(r.ios) || s.YF.isAndroid && r.android && !appVersionLt(r.android)
}
function addCalledJsListener(e, r) {
window.XHSHandler = window.XHSHandler || {},
window.XHSHandler["".concat(e, "CallbackList")] = window.XHSHandler["".concat(e, "CallbackList")] || [];
for (var i = window.XHSHandler["".concat(e, "CallbackList")], a = 0; a < i.length; a++)
if (i[a] === r)
return;
i.push(r)
}
function generateCalledJsCallback(e) {
return function(r) {
var i;
((null === (i = window.XHSHandler) || void 0 === i ? void 0 : i["".concat(e, "CallbackList")]) || []).forEach(function(e) {
e(r)
})
}
}
function subscribe(e, r) {
var i = e;
if ("viewAppear" === i && logDeprecated_warnDeprecated("viewAppear", "viewDidAppear", "v2.6.0"),
"viewDisappear" === i && logDeprecated_warnDeprecated("viewDisappear", "viewDidDisappear", "v2.6.0"),
"viewWillAppearIOS" === i) {
if (s.YF.isAndroid)
return !1;
i = "viewAppear"
}
if ("viewDidAppear" === i && (s.YF.isAndroid || s.YF.isIOS && appVersionLt("5.39.0")) && (i = "viewAppear"),
"viewWillDisappearIOS" === i) {
if (s.YF.isAndroid)
return !1;
i = "viewDisappear"
}
if ("viewDidDisappear" === i && (s.YF.isAndroid || s.YF.isIOS && appVersionLt("5.39.0")) && (i = "viewDisappear"),
"navBack" === i || "setNaviBackCallback" === i)
try {
return setNaviBackCallbackLegacy(r),
!0
} catch (e) {
return !1
}
if ("notice" === i || "registerNotice" === i)
try {
return registerNoticeLegacy(r),
!0
} catch (e) {
return !1
}
if (!supportEvent(i))
return s.YF.isXHS && (0,
T.ZK)("[OzoneBridge] ".concat(i, " is not supported")),
!1;
addCalledJsListener(i, r);
var a = L[i].namespace;
if (a) {
window[a] = window[a] || {};
var u = window[a];
!u[i] && (u[i] = generateCalledJsCallback(i))
} else
!window[i] && (window[i] = generateCalledJsCallback(i));
return !0
}
},
19738: function() {
"undefined" != typeof window && (window.process = window.process || {},
window.process.env = window.process.env || {},
window.process.env.BROWSER = !0,
window.process.env.BUILD_ENV = "production")
},
63522: function(e, r, i) {
"use strict";
i.d(r, {
Vk: function() {
return browser_getBrowserVersion
},
P7: function() {
return getNetType
},
mV: function() {
return appVersionLt
},
Np: function() {
return getOSVersion
},
Ij: function() {
return os_getOS
},
S8: function() {
return appVersionGte
},
YF: function() {
return m
}
}),
i(87535),
i(75204),
i(97357),
i(34333),
i(41593);
var a = i(70879)
, s = i(27337);
function os_getOS(e) {
var r = "unspecified"
, i = e || ""
, a = {};
return i = (e || window.navigator.userAgent).toLowerCase(),
a = window.navigator,
-1 !== i.indexOf("harmony") ? r = -1 !== i.indexOf("arkweb") ? "HarmonyArk" : "Harmony" : -1 !== i.indexOf("android") && -1 === i.indexOf("harmony") ? r = "Android" : -1 !== i.indexOf("iphone") || -1 !== i.indexOf("ipad") || -1 !== i.indexOf("ipod") || "MacIntel" === a.platform && a.maxTouchPoints > 1 ? r = "iOS" : -1 !== i.indexOf("macintosh") ? r = "Mac OS" : -1 !== i.indexOf("windows") ? r = "Windows" : -1 !== i.indexOf("linux") && (r = "Linux"),
"unspecified" === r && i.indexOf("discover") >= 0 && (r = "iOS"),
r
}
function getOSVersion(e) {
var r, i = os_getOS(e = e || window.navigator.userAgent), a = {};
return ("iOS" === i ? r = /(?:iPhone OS |OS |Version\/)(\d+)[._](\d+)[._]?(\d+)?/.exec(e) : "Android" === i && (r = /Android\s(\d+)\.(\d+)\.?(\d+)?/.exec(e)),
r) ? (a.major = parseInt(r[1], 10),
a.minor = parseInt(r[2], 10),
void 0 !== r[3] && (a.patch = parseInt(r[3], 10)),
a) : {
major: 0,
minor: 0,
patch: 0
}
}
i(67930),
i(58486),
i(34885),
i(42876),
i(33933),
i(95477),
i(87989);
var u = [780, 844, 926];
function iphoneXCheck(e) {
var r = {
isIphoneX: !1,
iphoneXType: ""
};
return "iOS" !== e ? r : (812 === window.screen.height ? r.iphoneXType = "X" : 896 === window.screen.height ? r.iphoneXType = window.devicePixelRatio > 2 ? "XS Max" : "XR" : u.includes(window.screen.height) && (r.iphoneXType = 3 === window.devicePixelRatio ? "12" : ""),
r.iphoneXType && (r.isIphoneX = !0),
r)
}
function iphone14ProCheck(e) {
return "iOS" === e && [932, 852].includes(window.screen.height)
}
i(82427),
i(36062),
i(57057),
i(25069),
i(72169);
var c = ["qq", "mqqbrowser", "ucbrowser", "baiduboxapp", "baiduspider", "baidubrowser", "micromessenger", "weibo", "alipay", "discover", "redtop", "uniik", "spark", "merchant", "snowpeak", "internation", "catalog", "odyssey"];
function browser_getBrowser() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", i = "unspecified";
return e = (r || window.navigator.userAgent).toLowerCase(),
"unspecified" === (i = c.reduce(function(r, i) {
return e.indexOf(i) >= 0 && (r = i),
r
}, i)) && (e.indexOf("iphone") >= 0 || e.indexOf("macintosh") >= 0 ? i = "safari" : (e.indexOf("android") >= 0 || e.indexOf("windows nt") >= 0) && (i = "chrome")),
"mqqbrowser" === i && e.indexOf("android") >= 0 && /mqqbrowser/i.test(e) && /qq/i.test(e.replace("mqqbrowser", "")) && (i = "qq"),
i
}
function browser_getBrowserVersion() {
var e, r, i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", a = {
major: 0,
minor: 0,
patch: 0
}, s = (r = (e = (i || window.navigator.userAgent).toLowerCase()).includes("discover") ? /(?:discover)\/(\d+)\.(\d+)\.?(\d+)?/ : /(?:XHS|Version|Chrome)\/(\d+)\.(\d+)\.?(\d+)?/).exec(e);
return s && (a.major = parseInt(s[1], 10),
a.minor = parseInt(s[2], 10),
void 0 !== s[3] && (a.patch = parseInt(s[3], 10))),
a
}
function browser_getBuildNumber() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", i = 0;
e = (r || window.navigator.userAgent).toLowerCase();
var a = e.match(/build\/(\d{7})/);
return a && Array.isArray(a) && (i = a[1]),
parseInt(i, 10) || 0
}
var l = {
qq: "mp_qq",
weixin: "mp_weixin",
alipay: "mp_alipay",
baidu: "mp_baidu",
toutiao: "mp_toutiao"
};
function getMpType() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ""
, r = arguments.length > 1 ? arguments[1] : void 0
, i = (e || window.navigator.userAgent).toLowerCase();
if (r = r || window,
i.indexOf("swan-baiduboxapp") > -1)
return l.baidu;
if (i.indexOf("toutiaomicroapp") > -1)
return l.toutiao;
if ("miniprogram" === r.__wxjs_environment || i.indexOf("miniprogram") > -1)
return i.indexOf("qq") > -1 ? l.qq : l.weixin;
return !1
}
function getMiniprogramType(e, r) {
return getMpType(e, r)
}
function query_extractFromQuery(e) {
var r = new URLSearchParams(e);
return {
isXHS: "app" === r.get("clientsource"),
isMiniprogram: "true" === r.get("isMiniprogram"),
isFullscreen: "true" === r.get("fullscreen"),
isNaviHidden: "yes" === r.get("naviHidden"),
isThemeDark: "dark" === r.get("themeType")
}
}
i(29112),
i(67275),
i(59989),
i(7099),
i(27461),
i(23339),
i(51109);
var d = {
isXHS: !1,
isIOS: !1,
isAndroid: !1,
isWeixin: !1,
isAlipay: !1,
isWeibo: !1,
isQQ: !1,
isQQBrowser: !1,
isMiniprogram: !1,
isBaiduMiniprogram: !1,
isQQMiniprogram: !1,
isAlipayMiniprogram: !1,
isToutiaoMiniprogram: !1,
isIphoneX: !1,
isFullscreen: !1,
isTop: !1,
isUniik: !1,
isSpark: !1,
isXhsMerchant: !1,
isSnowPeak: !1,
isInternation: !1,
isCatalog: !1,
isOdyssey: !1,
isPC: !1,
buildNumber: 0
};
function commonChecks(e) {
var r, i, u = e.navigator, c = e.location, p = u.userAgent, f = os_getOS(p), v = browser_getBrowser(p), g = getMiniprogramType(p, e), h = iphoneXCheck(f), m = query_extractFromQuery(c.search), _ = "iOS" === f, y = "Android" === f, w = "Harmony" === f, E = "HarmonyArk" === f, S = !!window.xhsbridge || !!window.XHSBridge, T = !!(null === (i = window.webkit) || void 0 === i ? void 0 : null === (r = i.messageHandlers) || void 0 === r ? void 0 : r.getDeviceInfo), b = !!window.XHSBridge, k = S || T || "discover" === v || m.isXHS || b, C = "redtop" === v, P = (p || "").toLowerCase().indexOf("mobile") > -1, A = browser_getBuildNumber(p), R = !k && !y && !_ && !P && !w && !E, I = !1;
if (k || C) {
var O = browser_getBrowserVersion(p);
I = (O.major > 6 || 6 === O.major && O.minor >= 7) && m.isFullscreen || _ && m.isNaviHidden || C && m.isFullscreen
}
return (0,
s._)((0,
a._)({}, d), {
isIOS: _,
isAndroid: y,
isHarmony: w,
isHarmonyArk: E,
isXHS: k,
isFullscreen: I,
isWeixin: "micromessenger" === v,
isAlipay: "alipay" === v,
isWeibo: "weibo" === v,
isQQ: "qq" === v,
isQQBrowser: "mqqbrowser" === v,
isMiniprogram: g === l.weixin || m.isMiniprogram,
isBaiduMiniprogram: g === l.baidu,
isQQMiniprogram: g === l.qq,
isAlipayMiniprogram: g === l.alipay,
isToutiaoMiniprogram: g === l.toutiao,
isIphone14Pro: iphone14ProCheck(f),
isIphoneX: h.isIphoneX,
iphoneXType: h.iphoneXType,
isTop: C,
isUniik: "uniik" === v,
isSpark: "spark" === v,
isXhsMerchant: "merchant" === v,
isSnowPeak: "snowpeak" === v,
isInternation: "internation" === v,
isCatalog: "catalog" === v,
isOdyssey: "odyssey" === v,
isPC: R,
isMobile: P,
buildNumber: A
})
}
function getNetTypeFromUA(e) {
var r = "Unrecognized"
, i = ["2g", "3g", "4g", "wifi", "cellnetwork"];
return (e || window.navigator.userAgent).replace(/\s?(?:NetType|nt:)\/?(\w+)\s?/g, function(e, a) {
i.indexOf(a.toLowerCase()) >= 0 && (r = a)
}),
r.toLowerCase()
}
function getNetType(e) {
return getNetTypeFromUA(e)
}
i(99808),
i(6045),
i(10364),
i(67673),
i(9557);
var p = "0"
, f = browser_getBrowserVersion()
, v = f.major
, g = f.minor
, h = f.patch;
function coerce(e) {
var r = e.split(".").map(function(e) {
return Number.parseInt(e, 10)
});
return [r[0] || 0, r[1] || 0, r[2] || 0]
}
function compare(e, r) {
for (var i = coerce(e), a = coerce(r), s = 0; s < 3; s++) {
if (i[s] > a[s])
return 1;
if (i[s] < a[s])
return -1
}
return 0
}
function appVersionLt(e) {
return 0 > compare(p, e)
}
function appVersionGte(e) {
return !appVersionLt(e)
}
p = "".concat(v, ".").concat(g, ".").concat(h);
var m = commonChecks(window)
},
28934: function(e, r, i) {
"use strict";
function check_validateReq(e, r, i) {
arguments.length > 3 && void 0 !== arguments[3] && arguments[3]
}
function validateRes(e, r, i) {
arguments.length > 3 && void 0 !== arguments[3] && arguments[3]
}
i.d(r, {
Ld: function() {
return invoke_subscribe
},
nJ: function() {
return D
},
dw: function() {
return xhs_invoke_invoke
}
}),
(M = D || (D = {}))[M.NotSupport = 16e3] = "NotSupport",
M[M.Native = 16001] = "Native",
M[M.Validate = 17e3] = "Validate",
M[M.UnKnow = 18e3] = "UnKnow",
(B = F || (F = {})).Method = "method",
B.Event = "event",
(x = V || (V = {})).Error = "error",
x.Timing = "timing",
x.Fallback = "fallback";
var a, s, u, c, l, d, p, f, v, g, h, m, _, y, w, E, S, T, b, k, C, P, A, R, I, O, N, L, M, B, x, D, F, V, H, U, q, j, W, G, J, X, Y, z, K, Z, Q, $, ee, et, er, en, ei, eo, ea, es, eu, ec, el, ed, ep, ef, ev, eg, eh, em = i(46490), e_ = i(77698), ey = i(44270), ew = i(90251);
i(89300),
i(49930),
i(19990),
i(27461),
i(23339),
i(51109),
i(34333),
i(87989),
i(86651),
i(87535),
i(75204),
i(97357),
i(87394),
i(94941),
i(48421);
var eE = ["log", "error", "info", "warn", "dir", "time", "timeLog", "timeEnd", "clear", "table", "assert", "count", "countReset", "debug", "group", "groupCollapsed", "groupEnd"]
, bridgeConsole_noop = function noop() {};
function hasBridgeConsole() {
return !!window.bridgeConsole
}
function bridgeStart(e) {
e.name,
e.callbackId;
var r = e.type
}
function bridgeSuccess(e) {
e.name,
e.callbackId,
e.time,
e.res
}
function eventSuccess(e) {
e.name,
e.res
}
function bridgeValidateError(e) {
e.name,
e.callbackId,
e.time,
e.err
}
function bridgeError(e) {
e.name,
e.callbackId,
e.time,
e.err
}
function bridgeNotSupport(e) {}
(function genBridgeConsole() {
if (hasBridgeConsole())
return window.bridgeConsole.log("Bridge 面板用于输出 ozone-schema 与 ozone-bridge 调用日志, 有建议或功能不足请联系 月初(yuechu@xiaohongshu.com)"),
window.bridgeConsole;
var e = {};
return eE.forEach(function(r) {
e[r] = bridgeConsole_noop
})
}
)();
var eS = "CallbackList"
, eT = new WeakMap
, eb = function() {
function XHSEventsCB() {
(0,
em._)(this, XHSEventsCB),
(0,
ey._)(this, eT, {
writable: !0,
value: {}
})
}
return (0,
ew._)(XHSEventsCB, [{
key: "get",
value: function get(e) {
return (0,
e_._)(this, eT)[e] || []
}
}, {
key: "set",
value: function set(e, r) {
(0,
e_._)(this, eT)[e] = r
}
}]),
XHSEventsCB
}();
function addCalledJsListener(e, r) {
for (var i = "".concat(e).concat(eS), a = window.XHSEventsCB.get(i), s = 0; s < a.length; s++)
if (a[s] === r)
return;
a.push(r),
window.XHSEventsCB.set(i, a)
}
function generateCalledJsCallback(e, r) {
return function(i) {
validateRes(e, F.Event, i, r),
eventSuccess({
name: e,
res: i
}),
window.XHSEventsCB.get("".concat(e).concat(eS)).forEach(function(e) {
return e(i)
})
}
}
function removeCalledJsListener(e, r) {
return {
remove: function() {
var i = "".concat(e).concat(eS)
, a = window.XHSEventsCB.get(i);
window.XHSEventsCB.set(i, a.filter(function(e) {
return e !== r
}))
}
}
}
function subscribe(e, r, i) {
return bridgeStart({
name: e,
type: "event"
}),
addCalledJsListener(e, r),
!window.XHSEvents[e] && (window.XHSEvents[e] = generateCalledJsCallback(e, i)),
removeCalledJsListener(e, r)
}
window.XHSEvents = window.XHSEvents || {},
window.XHSEventsCB = window.XHSEventsCB || new eb,
i(36277),
i(7608);
var ek = i(63522);
i(72169),
i(58486);
var eC = i(4659)
, eP = Array(16);
function makeRng() {
for (var e, r = 0; r < 16; r++)
(3 & r) == 0 && (e = 0x100000000 * Math.random()),
eP[r] = e >>> ((3 & r) << 3) & 255;
return eP
}
function generateKey() {
return (0,
eC.Z)({
rng: makeRng
}).replace(/-/g, "_")
}
function addCallback(e, r) {
var i = "".concat(e, "_").concat(generateKey());
return window.XHSCallbacks[i] = r,
"window.XHSCallbacks.".concat(i)
}
window.XHSCallbacks = window.XHSCallbacks || {},
window.XHSInvokeCallback = function(e, r) {
window.XHSCallbacks[r] && window.XHSCallbacks[r](e)
}
;
var eA = i(35329)
, eR = i(51606)
, eI = i(27292)
, eO = i(75649)
, eN = i(30961);
i(41593);
var eL = i(72252)
, eM = function(e) {
function SchemaError(e) {
for (var r, i = arguments.length, a = Array(i > 1 ? i - 1 : 0), s = 1; s < i; s++)
a[s - 1] = arguments[s];
return (0,
em._)(this, SchemaError),
r = (0,
eA._)(this, SchemaError, (0,
eO._)(a)),
(0,
eR._)(r, "code", void 0),
r.name = "SchemaError",
r.code = e,
ek.YF.isXHS && r.code === D.UnKnow && (0,
eL.vU)(r),
r
}
return (0,
eI._)(SchemaError, e),
SchemaError
}((0,
eN._)(Error))
, eB = i(70879)
, ex = i(27337)
, eD = i(64593);
function completeUrl(e) {
if (!e.startsWith("http"))
return e.startsWith("//") ? window.location.protocol + e : window.location.origin + e;
return e
}
function webp2png(e) {
if (ek.YF.isIOS) {
var r, i, a = (null == e ? void 0 : null === (r = e.response) || void 0 === r ? void 0 : r.image) || (null == e ? void 0 : null === (i = e.response) || void 0 === i ? void 0 : i.images), s = (0,
ek.Np)();
(null == s ? void 0 : s.major) < 14 && (null == a ? void 0 : a.endsWith("format/webp")) && (a = "".concat(a.substring(0, a.length - 4), "png"),
e.response.image = a,
e.response.images = a)
}
}
i(42876),
i(33933),
i(75973),
i(55947),
i(97542),
i(63712);
var eF = ["getDeviceInfo", "getSupportedEvents"]
, eV = ["getPreResponse"];
function transformArgs(e, r) {
if ("sendClientRequestV3" === e) {
var i = (0,
eB._)({}, r.headers)
, a = r.method.toUpperCase()
, s = i["Content-Type"]
, u = (0,
eD._)(i, ["Content-Type"]);
return "GET" === a || ["application/x-www-form-urlencoded", "application/json"].includes(s) ? "GET" === a && s && (i = u) : i["Content-Type"] = "application/json",
Object.keys(i).forEach(function(e) {
"string" != typeof i[e] && (i[e] = String(i[e]))
}),
(0,
ex._)((0,
eB._)({}, r), {
url: completeUrl(r.url),
headers: i
})
}
return r
}
var eH = {
getDeviceInfo: function adaptGetDeviceInfo(e) {
if (ek.YF.isIOS) {
var r;
e.value.deviceId = null == e ? void 0 : null === (r = e.value) || void 0 === r ? void 0 : r.uniqueId
}
try {
delete e.value.freeDiskStorage,
delete e.value.totalDiskCapacity
} catch (e) {
console.log("get device info interceptor error:", e.message)
}
return e
},
getUserInfo: function(e) {
return webp2png(e),
e
}
};
function transformRes(e, r) {
var i = r || {}
, a = i.result
, s = i.value
, u = i.message
, c = s;
if (eF.includes(e) && 0 === a && !("[object Object]" === Object.prototype.toString.call(c) && Object.prototype.hasOwnProperty.call(c, "result")) && (c = r),
0 === a)
return eH[e] ? eH[e](c) : c;
if (eV.includes(e))
throw new eM((null == s ? void 0 : s.message) || a,"".concat(e, ": ").concat(u));
throw new eM(a,"".concat(e, ": ").concat(u))
}
function shouldLog() {
return .01 > Math.random()
}
var eU = ["getABFlag", "addApmReferV2"];
function addMeasure(e) {
if (eU.includes(e.bridgeName))
return;
var r = window.eaglet;
if (!!r) {
if (e.logType !== V.Timing || shouldLog())
try {
r.push({
measurement_name: "bridgeMonitor",
measurement_data: (0,
eB._)({
bridgeName: e.bridgeName,
bridgeLogType: e.logType,
bridgePlatform: e.platformType
}, e.logType === V.Error ? {
bridgeError: e.errorInfo
} : {
bridgeTiming: e.timing
})
}, "ApmXrayTracker").catch(function() {})
} catch (e) {}
}
}
i(19077);
var eq = i(41622)
, ej = i(377)
, eW = i(7862)
, eG = i.n(eW)
, eJ = i(36757);
i(25069);
var eX = eG().oneOf([0, -1]).isRequired;
function urlType(e, r, i, a) {
if (e[r] && !/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.?%&=]*)?/.test(e[r]))
return Error("Invalid ".concat(a, " `").concat(r, "` => `").concat(JSON.stringify(e[r]), "` supplied to `").concat(i, "`, expected `url` pattern."))
}
var eY = function(e) {
function BridgeError(e) {
for (var r, i = arguments.length, a = Array(i > 1 ? i - 1 : 0), s = 1; s < i; s++)
a[s - 1] = arguments[s];
return (0,
em._)(this, BridgeError),
r = (0,
eA._)(this, BridgeError, (0,
eO._)(a)),
(0,
eR._)(r, "code", void 0),
r.name = "BridgeError",
r.code = e,
r
}
return (0,
eI._)(BridgeError, e),
BridgeError
}((0,
eN._)(Error));
function check(e, r, i, a) {
setTimeout(function() {
try {
eG().checkPropTypes({
prop: e
}, {
prop: r
}, i, "ozone-bridge/".concat(a), function() {
return !1
})
} catch (e) {
var s = e.stack.indexOf(e.message) > -1 ? e.stack : "Error: ".concat(e.message, "\n").concat(e.stack);
(0,
eL.vU)(s, null, null, {
console: !0,
owl: !0
})
}
})
}
function checkArgs(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
if (!r) {
(0,
eL.ZK)("argsT is necessary");
return
}
check(r, e, "args", i)
}
function checkRes(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
if (!r) {
(0,
eL.ZK)("resT is necessary");
return
}
check(r, e, "res", i)
}
i(34885);
function escapeNewLineChars(e) {
return "string" == typeof e ? e.replace(/\n/g, "\\n").replace(/\r/g, "\\r") : e
}
H = window.XHS_CALLBACKS || (window.XHS_CALLBACKS = {});
var ez = {
add: function add(e, r, i) {
var a = "".concat(e, "_").concat(generateKey());
return H[a] = function callbackWrap(a) {
var s;
if (ek.YF.isIOS || (0,
ek.S8)("5.26.1"))
s = a;
else
try {
s = JSON.parse(escapeNewLineChars(a))
} catch (e) {
s = a
}
(null == i ? void 0 : i.resT) && checkRes(s, i.resT, e),
r(s)
}
,
"XHS_CALLBACKS.".concat(a)
}
};
function isSupportAdapter(e) {
var r, i = ek.YF.isIOS ? null === (r = window.webkit) || void 0 === r ? void 0 : r.messageHandlers : window.xhsbridge;
return i && !!i[e]
}
function bridge(e, r, i) {
var a = {};
if (void 0 !== r && (a.data = r),
i && (a.callback = i),
ek.YF.isIOS) {
if ("registerNotice" === e && (0,
ek.S8)("5.29") && (0,
ek.mV)("5.31")) {
try {
window.webkit.messageHandlers[e].postMessage({
data: i
})
} catch (e) {
throw new eY("ERR_NATIVE",e.message)
}
return
}
try {
window.webkit.messageHandlers[e].postMessage(a)
} catch (r) {
throw new eY("ERR_NATIVE","".concat(r.message, ", bridge is ").concat(e))
}
} else {
var s = JSON.stringify(a);
try {
window.xhsbridge[e](s)
} catch (r) {
throw new eY("ERR_NATIVE","".concat(r.message, ", bridge is ").concat(e))
}
}
}
function callbackAdapter(e, r, i, a) {
var s;
if (!isSupportAdapter(e))
throw new eY("ERR_NOT_SUPPORT","not support ".concat(e));
(null == a ? void 0 : a.argsT) && checkArgs(r, a.argsT, e),
"function" == typeof i && (s = ez.add(e, i, a)),
bridge(e, r, s)
}
function adapter(e, r, i) {
return new Promise(function(a, s) {
try {
var u = r
, c = i;
u && (u.argsT || u.resT) && (c = u,
u = void 0),
callbackAdapter(e, u, a, c)
} catch (e) {
s(e)
}
}
)
}
var eK = i(31547);
function deprecatedStr(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
return "[OzoneBridge] ".concat(e, " was deprecated, please use ").concat(r, ".").concat(i ? " Changelog for ".concat(i) : "")
}
function logDeprecated_warnDeprecated(e, r, i) {
(0,
eL.ZK)(deprecatedStr(e, r, i))
}
function arrangeExtensionFriend(e) {
var r;
return "string" == typeof e ? logDeprecated_warnDeprecated("args.extension.friend String", "args.extension.friend Object") : (void 0 === e ? "undefined" : (0,
eK._)(e)) === "object" && (e.cover && !e.image && (logDeprecated_warnDeprecated("args.extension.friend.cover", "args.extension.friend.image"),
e.image = e.cover,
r = (0,
eB._)({}, e)),
ek.YF.isAndroid && (r = JSON.stringify(e))),
r
}
var eZ = ek.YF.isAndroid && (0,
ek.S8)("5.20") || !0;
function postNotice(e) {
var r = e.methodName
, i = e.data
, a = ("undefined" == typeof window ? "undefined" : (0,
eK._)(window)) === "object" && "object" === (0,
eK._)(window.wx) ? window.wx : null;
return a && a.miniProgram && a.miniProgram.postMessage ? (a.miniProgram.postMessage({
data: {
methodName: r,
data: i
}
}),
Promise.resolve()) : Promise.resolve()
}
function setShareInfo(e) {
return postNotice({
methodName: "setShareInfo",
data: e
})
}
function showToast(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
if (checkArgs(e, {
argsT: eG().string.isRequired
}.argsT, "showToast"),
null == e)
throw new eY("ERR_ARGS_NULL","message should not be undefined or null");
return adapter("toast", (0,
eB._)({
message: e
}, r))
}
function showAlert(e) {
var r = "showalertV2";
checkArgs(e, {
argsT: eG().shape({
title: eG().string,
desc: eG().string,
actions: eG().arrayOf(eG().shape({
name: eG().string,
callback: eG().func
}))
})
}.argsT, "showAlert");
var i = (0,
ex._)((0,
eB._)({}, e), {
des: e.desc || ""
})
, a = []
, s = {
default: 0,
cancel: 1,
destructive: 2
};
return i.actions.forEach(function(e) {
var i = ez.add(r, e.callback);
a.push({
name: e.name,
type: s[e.style],
script: "window.".concat(i, " && window.").concat(i)
})
}),
i.actions = a,
adapter(r, i)
}
function showActionSheet(e) {
return adapter("showActionSheet", e, {
argsT: eG().shape({
title: eG().string,
desc: eG().string,
actions: eG().arrayOf(eG().shape({
name: eG().string,
value: eG().string.isRequired
}))
}),
resT: eG().shape({
result: eX,
value: eG().string
})
})
}
function setNavigationHidden() {
return adapter("setNavigationHidden", {
resT: eG().shape({
result: eX
})
})
}
function showNavigationRightBarButtonItem(e) {
var r = {
argsT: eG().shape({
visible: eG().bool,
buttonTitle: eG().string,
buttonIcon: eG().string,
handler: eG().func
}),
resT: eG().shape({
result: eX
})
};
e.button_title && logDeprecated_warnDeprecated("args.button_title", "args.buttonTitle"),
e.button_icon && logDeprecated_warnDeprecated("args.button_icon", "args.buttonIcon"),
checkArgs(e, r.argsT, "showNavigationRightBarButtonItem");
var i = e.handler
, a = (0,
eD._)(e, ["handler"])
, s = (0,
eJ.cJ)(a);
return i && "function" == typeof i && (window.XHSHandler = (0,
ex._)((0,
eB._)({}, window.XHSHandler), {
navigationRightBarButtonItem: i
})),
adapter("showNavigationRightBarButtonItemV2", s, {
resT: r.resT
})
}
function setStatusBarHiddenIOS() {
var e = !(arguments.length > 0) || void 0 === arguments[0] || arguments[0];
return adapter("setStatusBarHiddenIOS", e, {
argsT: eG().bool.isRequired
})
}
function setStatusBarTextColor() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
color: "0"
};
if (ek.YF.isIOS)
throw new eY("NOT SUPPORTED ON iOS, Please use setStatusBarStyleIOS");
return adapter("setStatusBarTextColor", e.color)
}
function alwaysBounceIOS(e) {
var r = !(arguments.length > 1) || void 0 === arguments[1] || arguments[1];
return adapter("alwaysBounceIOS", {
direction: e,
bounces: r
}, {
argsT: eG().shape({
direction: eG().oneOf(["vertical", "horizontal"]).isRequired,
bounces: eG().bool.isRequired
})
})
}
function ui_setShareInfo(e) {
var r = {
argsT: eG().shape({
contentType: eG().string,
title: eG().string,
content: eG().string,
linkurl: urlType,
imageurl: urlType,
type: eG().string,
extension: eG().shape({
miniprogram: eG().shape({
title: eG().string,
desc: eG().string,
webpageurl: urlType,
path: eG().string,
thumb: eG().string,
username: eG().string
}),
friend: eG().oneOfType([eG().string, eG().shape({
source: eG().string,
type: eG().oneOf(["general", "goodsDetail", "center", "topic", "event"]),
title: eG().string,
content: eG().string,
cover: eG().string,
image: eG().string,
link: eG().string,
btn: eG().string,
avatar: eG().string,
brandName: eG().string,
id: eG().string,
desc: eG().string,
price: eG().number
})])
})
}),
resT: eG().shape({
result: eX
})
}
, i = e;
if (i) {
(i = (0,
eB._)({}, i)).type && !eZ && (i.type = i.type.replace(/WXMiniProgram/, "WeixinSession")),
i.image && !i.imageurl && (logDeprecated_warnDeprecated("args.image", "args.imageurl"),
i.imageurl = i.image);
var a, s = arrangeExtensionFriend(null === (a = i.extension) || void 0 === a ? void 0 : a.friend);
s && (i.extension.friend = s)
}
return ek.YF.isMiniprogram ? setShareInfo(i) : adapter("setShareInfo", i, r)
}
function showShareMenu() {
return adapter("showShareMenu")
}
function shareContent(e) {
var r, i = {
argsT: eG().shape({
type: eG().string.isRequired,
contentType: eG().oneOf(["link", "image", "text"]),
title: eG().string,
content: eG().string,
linkurl: urlType,
imageurl: urlType,
base64string: eG().string,
extension: eG().shape({
miniprogram: eG().shape({
title: eG().string,
desc: eG().string,
webpageurl: urlType,
path: eG().string,
thumb: eG().string,
username: eG().string
}),
friend: eG().oneOf([eG().string, {
source: eG().string,
type: eG().oneOf(["general", "goodsDetail", "center", "topic", "event"]),
title: eG().string,
content: eG().string,
cover: eG().string,
image: eG().string,
link: eG().string,
btn: eG().string,
avatar: eG().string,
brandName: eG().string,
id: eG().string,
desc: eG().string,
price: eG().number
}])
})
}),
resT: eG().shape({
result: eX
})
}, a = (0,
eB._)({}, e);
a.type && !eZ && (a.type = e.type.replace(/WXMiniProgram/, "WeixinSession")),
a.image && !a.imageurl && (logDeprecated_warnDeprecated("args.image", "args.imageurl"),
a.imageurl = a.image);
var s = arrangeExtensionFriend(null === (r = a.extension) || void 0 === r ? void 0 : r.friend);
return s && (a.extension.friend = s),
adapter("shareContentV2", a, i)
}
function pay(e) {
return adapter("pay", e)
}
function alipayClient(e) {
return adapter("alipayClient", e, {
argsT: eG().string.isRequired,
resT: eG().shape({
result: eX,
orderid: eG().string.isRequired
})
})
}
function openURLByWechat(e) {
return adapter("openURLByWechat", e, {
argsT: eG().shape({
url: eG().string.isRequired
})
})
}
function wechatPayClient(e) {
return adapter("wechatPayClient", e, {
argsT: eG().string.isRequired,
resT: eG().shape({
result: eX,
orderid: eG().string.isRequired
})
})
}
function supportApplePayIOS() {
return adapter("supportApplePay")
}
function applePayClientIOS(e) {
return adapter("applePayClient", e)
}
function openLinkAndroid(e) {
return adapter("openLink", e, {
argsT: eG().string.isRequired
})
}
function closeWindow() {
return adapter("closeWindow")
}
function removeVCFromStackIOS() {
return adapter("removeVCFromStack")
}
function replaceSelfWithLink(e) {
var r = e.link
, i = e.type
, a = ek.YF.isIOS && (0,
ek.S8)("5.39")
, s = {
argsT: a ? {
link: eG().string.isRequired,
type: eG().oneOf(["push", "present"]).isRequired
} : eG().string.isRequired
};
return a ? adapter("replaceSelfWithLink", {
link: r,
type: i
}, s) : adapter("replaceSelfWithLink", r, s)
}
function replaceSelfWithLinkV2Android(e) {
return adapter("replaceSelfWithLinkV2", {
link: e
})
}
function replaceRouteWith(e) {
return ek.YF.isIOS && (0,
ek.S8)("6.54") ? replaceSelfWithLink({
link: e
}) : ek.YF.isAndroid && (0,
ek.S8)("6.56") ? replaceSelfWithLinkV2Android(e) : ek.YF.isIOS && !isSupportAdapter("removeVCFromStack") ? replaceSelfWithLink({
link: e
}) : new Promise(function(r, i) {
window.open(e),
setTimeout(function() {
ek.YF.isIOS ? removeVCFromStackIOS().then(r).catch(i) : (window.close(),
r(void 0))
}, 300)
}
)
}
function openGiftPanel() {
return _openGiftPanel.apply(this, arguments)
}
function _openGiftPanel() {
return (_openGiftPanel = (0,
eq._)(function() {
return (0,
ej.Jh)(this, function(e) {
return [2, adapter("openGiftPanel")]
})
})).apply(this, arguments)
}
function setPasteBoard(e) {
var r = {
argsT: eG().string.isRequired,
resT: eG().shape({
result: eX
})
};
return checkArgs(e, r.argsT, "setPasteBoard"),
adapter("setPasteBoard", {
string: e
}, {
resT: r.resT
})
}
function showTrack(e) {
return adapter("showTrack", e, {
argsT: eG().shape({
title: eG().string,
content: eG().string,
isNewTrack: eG().bool
})
})
}
function showApmTrack(e) {
return adapter("showApmTrack", e, {
argsT: eG().shape({
content: eG().string
})
})
}
function webtrack(e) {
return adapter("webtrack", e, {
argsT: eG().object
})
}
function emitTrack(e) {
return adapter("emitTrack", e, {
argsT: eG().string.isRequired
})
}
function emitApmTrack(e) {
return adapter("emitApmTrack", e, {
argsT: eG().string.isRequired
})
}
function openMapWithLocation(e) {
return adapter("openMapWithLocation", e, {
argsT: eG().shape({
lat: eG().number,
long: eG().number,
direction: eG().bool,
name: eG().string,
coordinate: eG().shape({
wgs84: eG().shape({
long: eG().number,
lat: eG().number
}),
gcj02: eG().shape({
long: eG().number,
lat: eG().number
}),
bd09: eG().shape({
long: eG().number,
lat: eG().number
})
})
}),
resT: eG().shape({
result: eX,
type: eG().oneOf(["apple", "baidu", "amap", "google"]).isRequired
})
})
}
function confirmAntiSpam() {
return adapter("confirmAntiSpam")
}
function addComment(e) {
return adapter("addComment", e, {
argsT: eG().shape({
placeholder: eG().string,
uid: eG().string
}),
resT: eG().shape({
uid: eG().string,
is_send: eG().bool,
data: eG().shape({
content: eG().string,
at_users: eG().arrayOf(eG().shape({
userid: eG().string,
nickname: eG().string
}))
})
})
})
}
function openXhsSystemSettings() {
return _openXhsSystemSettings.apply(this, arguments)
}
function _openXhsSystemSettings() {
return (_openXhsSystemSettings = (0,
eq._)(function() {
return (0,
ej.Jh)(this, function(e) {
return [2, adapter("openXhsSystemSettings")]
})
})).apply(this, arguments)
}
function openRechargeCoinPanel() {
return adapter("openRechargeCoinPanel")
}
function openFansPanel() {
return adapter("openFansPanel")
}
function checkLoginWithAction(e) {
return adapter("checkLoginWithAction", e, {
argsT: eG().shape({
type: eG().number.isRequired
}),
resT: eG().shape({
result: eX
})
})
}
function logout() {
return adapter("logout")
}
function isAppInstalled(e) {
return adapter("isAppInstalled", e, {
argsT: eG().shape({
iOS: eG().string,
Android: eG().string
}),
resT: eG().shape({
result: eX,
value: eG().bool.isRequired
})
})
}
function getAppInfo() {
return adapter("getAppInfo", {
resT: eG().shape({
result: eX,
version: eG().string.isRequired,
build: eG().string.isRequired,
jsversion: eG().string.isRequired,
package: eG().oneOf(["com.xingin.discover", "com.xingin.xhs"]).isRequired
})
})
}
function getDeviceInfoOld() {
function imeiType() {
return (0,
ek.mV)("5.24") ? {} : ek.YF.isIOS ? {
idfa: eG().string.isRequired,
idfv: eG().string.isRequired
} : {
imei: eG().string.isRequired
}
}
var e = {
resT: eG().shape((0,
eB._)({
result: eX,
appMarket: eG().string.isRequired,
appVersion: eG().string.isRequired,
buildNumber: eG().string.isRequired,
systemVersion: eG().string.isRequired,
deviceModel: eG().string.isRequired,
manufacturer: eG().string.isRequired,
timezone: eG().string.isRequired,
deviceScreenWidth: eG().number.isRequired,
deviceScreenHeight: eG().number.isRequired,
carrier: eG().string.isRequired,
uniqueId: eG().string.isRequired
}, ek.YF.isIOS ? {
applepayInfo: eG().bool.isRequired
} : {}, imeiType))
};
return adapter("getDeviceInfo").then(function(r) {
var i = (0,
eJ.Lg)(r);
return r.applepay_info && (i.applepay_info = r.applepay_info,
logDeprecated_warnDeprecated("res.applepay_info", "res.applepayInfo")),
checkRes(i, e.resT),
i
})
}
function getNetworkTypeLegacy() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
extractValue: !1
}
, r = {
resT: eG().shape({
result: eX,
value: eG().oneOf(["WiFi", "4G", "3G+", "3G", "2G", "NONE"])
})
};
return adapter("getNetworkType").then(function(i) {
var a = (0,
eB._)({}, i);
if (("wifi" === i.value || "WIFI" === i.value) && (a.value = "WiFi"),
checkRes(a, r.resT),
e.extractValue) {
if (0 === a.result)
return a.value;
throw new eY("ERR_RESULT_".concat(a.result),"res.result is not 0")
}
return a
})
}
function getUserInfo() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
extractValue: !0
}
, r = Date.now();
console.warn("[OzoneBridge] getUserInfo was deprecated, use `getUserInfoV2` and `getABFlag` to replace, more info see readme");
var i = ek.YF.isAndroid && (0,
ek.S8)("6.5") || ek.YF.isIOS && (0,
ek.S8)("6.9")
, a = {
resT: eG().shape({
result: eX,
response: eG().shape((0,
eB._)({
userId: eG().string.isRequired,
nickname: eG().string.isRequired,
gender: eG().number.isRequired,
userToken: eG().string.isRequired,
image: urlType.isRequired,
location: eG().string.isRequired,
flags: eG().shape({
fulishe: eG().oneOfType([eG().object]).isRequired,
shequ: eG().oneOfType([eG().object]).isRequired
})
}, (0,
ek.S8)("5.24") ? {
lat: eG().number.isRequired,
lon: eG().number.isRequired,
sessionId: eG().string.isRequired
} : {}, i ? {
hashExp: eG().string.isRequired
} : {}))
})
};
return adapter("getUserInfo").then(function(i) {
var s = (0,
eJ.Lg)(i);
if (i.response && (i.response.flags && (i.response.flags.fulishe && (s.response.flags.fulishe = i.response.flags.fulishe),
i.response.flags.shequ && (s.response.flags.shequ = i.response.flags.shequ)),
i.response.user_id && (s.response.user_id = i.response.user_id,
logDeprecated_warnDeprecated("res.response.user_id", "res.response.userId")),
i.response.user_token && (s.response.user_token = i.response.user_token,
logDeprecated_warnDeprecated("res.response.user_token", "res.response.userToken")),
i.response.session_id && (s.response.session_id = i.response.session_id,
logDeprecated_warnDeprecated("res.response.session_id", "res.response.sessionId")),
i.response.images && !i.response.image && (s.response.image = i.response.images,
logDeprecated_warnDeprecated("res.response.images", "res.response.image"))),
webp2png(s),
checkRes(s, a.resT),
e.extractValue) {
if (0 === s.result)
return addMeasure({
platformType: "H5",
bridgeName: "getUserInfoOld",
timing: Date.now() - r,
logType: V.Timing
}),
s.response;
throw new eY("ERR_RESULT_".concat(s.result),"res.result is not 0")
}
return addMeasure({
platformType: "H5",
bridgeName: "getUserInfoOld",
timing: Date.now() - r,
logType: V.Timing
}),
s
})
}
function getTrackEnv() {
var e = {
resT: eG().shape({
isTestEnv: eG().bool,
uploadOneByOne: eG().bool,
sessionId: eG().string
})
};
return adapter("getTrackEnv").then(function(r) {
var i = (0,
eJ.Lg)(r);
return r.session_id && (i.sessionId = r.session_id),
checkRes(i, e.resT),
i
})
}
function lowPowerModeEnabled() {
return adapter("lowPowerModeEnabled", {
resT: eG().shape({
result: eX,
value: eG().bool.isRequired
})
})
}
function requestNotificationPermission(e) {
return adapter("requestNotificationPermission", e, {
argsT: eG().shape({
engaingType: eG().number.isRequired,
engaingMessage: eG().string
})
})
}
function saveImage(e) {
return adapter("saveImage", e, {
argsT: eG().shape({
url: urlType,
base64string: eG().string,
type: eG().string.isRequired
}),
resT: eG().shape({
result: eX
})
})
}
function basicSendClientRequest(e) {
return adapter("sendClientRequest", e)
}
function sendClientRequest(e) {
console.warn("[OzoneBridge] sendClientRequest was deprecated, please use [Launcher http](https://code.devops.xiaohongshu.com/formula/launcher/tree/master/src/http)");
var r = {
argsT: eG().shape({
url: eG().string,
type: eG().oneOf(["GET", "POST", "PUT", "DELETE"]).isRequired,
data: eG().oneOfType([eG().object]),
transform: eG().oneOfType([eG().bool, eG().shape({
separateNumber: eG().bool
}), eG().func])
}),
resT: eG().shape({
result: eX,
response: eG().oneOfType([eG().object]),
status: eG().number
})
};
checkArgs(e, r.argsT, "sendClientRequest");
var i = (0,
eB._)({}, e)
, a = i.transform;
return a && "object" === (0,
eK._)(i.data) && (i.data = (0,
eJ.cJ)(i.data, a),
delete i.transform),
basicSendClientRequest(i).then(function(e) {
return (checkRes(e, r.resT),
a) ? (0,
eJ.Lg)(e, a) : e
}).then(function(e) {
if (-1 === e.result) {
var r = Error();
throw r.status = e.status,
r
}
var i = e.response;
if (void 0 === i.success && 0 !== i.result || !1 === i.success) {
var a = Error();
throw a.status = i.result,
a
}
return i.data || i
})
}
function sendClientRequestV2(e) {
var r = (0,
ex._)((0,
eB._)({}, e), {
url: completeUrl(e.url)
});
return isSupportAdapter("sendClientRequestV2") && ek.YF.isAndroid ? adapter("sendClientRequestV2", r) : basicSendClientRequest(r).then(function(e) {
var r = e.result
, i = e.status
, a = e.response;
if (ek.YF.isAndroid) {
if (-1 === r)
return -1 !== i ? {
result: 0,
response: {
status: i
}
} : {
result: r
};
return {
result: r,
response: {
status: 200,
body: a
}
}
}
if (-1 === r)
return a ? {
result: 0,
response: {
status: 200,
body: a
}
} : {
result: r
};
return {
result: r,
response: {
status: 200,
body: a
}
}
})
}
function getPrevData() {
return adapter("getPrevData", {
resT: eG().oneOfType([eG().array, eG().bool, eG().number, eG().object, eG().string])
})
}
function getItemOld(e) {
var r = {
argsT: eG().string.isRequired,
resT: eG().shape({
result: eX,
value: eG().string
})
};
return checkArgs(e, r.argsT, "getItem"),
adapter("getItem", {
key: e
}, {
resT: r.resT
})
}
function getItem(e) {
return _getItem.apply(this, arguments)
}
function _getItem() {
return (_getItem = (0,
eq._)(function(e) {
return (0,
ej.Jh)(this, function(r) {
return [2, getItemOld(e)]
})
})).apply(this, arguments)
}
function setItemOld(e, r) {
return adapter("setItem", {
key: e,
value: r
}, {
argsT: eG().shape({
key: eG().string.isRequired,
value: eG().string.isRequired
}),
resT: eG().shape({
result: eX
})
})
}
function setItem(e, r) {
return _setItem.apply(this, arguments)
}
function _setItem() {
return (_setItem = (0,
eq._)(function(e, r) {
return (0,
ej.Jh)(this, function(i) {
return [2, setItemOld(e, r)]
})
})).apply(this, arguments)
}
function removeItemOld(e) {
var r = {
argsT: eG().string.isRequired,
resT: eG().shape({
result: eX
})
};
return checkArgs(e, r.argsT, "removeItem"),
adapter("removeItem", {
key: e
}, {
resT: r.resT
})
}
function removeItem(e) {
return _removeItem.apply(this, arguments)
}
function _removeItem() {
return (_removeItem = (0,
eq._)(function(e) {
return (0,
ej.Jh)(this, function(r) {
return [2, removeItemOld(e)]
})
})).apply(this, arguments)
}
function broadcast(e) {
return adapter("broadcast", e)
}
function broadcastNative(e) {
return adapter("broadcastNative", e, {
argsT: eG().shape({
key: eG().string.isRequired,
data: eG().string.isRequired
})
})
}
function getMessageStatusIOS() {
return adapter("getMessageStatus", {
resT: eG().shape({
result: eX,
status: eG().oneOf([0, 1]).isRequired
})
})
}
function getThirdAuth(e) {
return adapter("getThirdAuth", e, {
argsT: eG().oneOf(["weixin"]).isRequired,
resT: eG().shape({
result: eX,
value: eG().oneOfType([eG().object])
})
})
}
function getCurrentGeolocation() {
return adapter("getCurrentGeolocation")
}
function checkAppPermission(e) {
var r = {
argsT: eG().string.isRequired,
resT: eG().shape({
result: eG().oneOf([0, -1]).isRequired,
state: eG().oneOf(["denied", "granted", "undeterminated"])
})
}
, i = e.type;
return adapter("checkAppPermission", void 0 === i ? "" : i, r)
}
function areNotificationsEnabledAndroid() {
return adapter("areNotificationsEnabled", {
resT: eG().shape({
result: eG().oneOf([0, -1]).isRequired,
state: eG().oneOf(["denied", "granted"])
})
})
}
function getFileUrlFromLocalServerIOS(e) {
return _getFileUrlFromLocalServerIOS.apply(this, arguments)
}
function _getFileUrlFromLocalServerIOS() {
return (_getFileUrlFromLocalServerIOS = (0,
eq._)(function(e) {
var r;
return (0,
ej.Jh)(this, function(i) {
switch (i.label) {
case 0:
return [4, adapter("getFileUrlFromLocalServer", e, {
argsT: eG().shape({
url: urlType.isRequired
}),
resT: eG().shape({
result: eG().oneOf([0, -1]).isRequired,
value: urlType,
message: eG().string
})
})];
case 1:
if (0 === (r = i.sent()).result)
return [2, r.value];
throw new eY("ERR_RESULT_".concat(r.result),r.message)
}
})
})).apply(this, arguments)
}
function toggleLocalDns(e) {
return _toggleLocalDns.apply(this, arguments)
}
function _toggleLocalDns() {
return (_toggleLocalDns = (0,
eq._)(function(e) {
var r;
return (0,
ej.Jh)(this, function(i) {
switch (i.label) {
case 0:
return [4, adapter("toggleLocalDns", {
enable: e
})];
case 1:
if (0 === (r = i.sent()).result)
return [2];
throw new eY("ERR_RESULT_".concat(r.result),r.message)
}
})
})).apply(this, arguments)
}
function registerTrickleConnectTopic(e) {
return _registerTrickleConnectTopic.apply(this, arguments)
}
function _registerTrickleConnectTopic() {
return (_registerTrickleConnectTopic = (0,
eq._)(function(e) {
return (0,
ej.Jh)(this, function(r) {
return [2, adapter("registerTrickleConnectTopic", e)]
})
})).apply(this, arguments)
}
function getABFlag(e) {
return getUserInfo({
extractValue: !0
}).then(function(r) {
var i = e.key
, a = (r || {}).flags || {}
, s = a.fulishe
, u = a.shequ
, c = a.ios
, l = a.android
, d = ek.YF.isIOS ? c : l
, p = null;
return (null == u ? void 0 : u[i]) ? p = u[i] : (null == s ? void 0 : s[i]) ? p = s[i] : (null == d ? void 0 : d[i]) && (p = d[i]),
{
result: 0,
message: "success",
value: p
}
})
}
i(15066);
var eQ = {
toast: showToast,
showToast: showToast,
showalertV2: showAlert,
showAlert: showAlert,
removeVCFromStack: removeVCFromStackIOS,
removeVCFromStackIOS: removeVCFromStackIOS,
showNavigationRightBarButtonItemV2: showNavigationRightBarButtonItem,
showNavigationRightBarButtonItem: showNavigationRightBarButtonItem,
shareContentV2: shareContent,
shareContent: shareContent,
supportApplePay: supportApplePayIOS,
supportApplePayIOS: supportApplePayIOS,
applePayClient: applePayClientIOS,
applePayClientIOS: applePayClientIOS,
replaceSelfWithLink: replaceSelfWithLink,
replaceSelfWithLinkV2: replaceSelfWithLinkV2Android,
replaceSelfWithLinkV2Android: replaceSelfWithLinkV2Android,
replaceRouteWith: replaceRouteWith,
showActionSheet: showActionSheet,
setNavigationHidden: setNavigationHidden,
setStatusBarHiddenIOS: setStatusBarHiddenIOS,
setStatusBarStyleIOS: setStatusBarTextColor,
setStatusBarTextColor: setStatusBarTextColor,
alwaysBounceIOS: alwaysBounceIOS,
setShareInfo: ui_setShareInfo,
showShareMenu: showShareMenu,
pay: pay,
alipayClient: alipayClient,
openURLByWechat: openURLByWechat,
wechatPayClient: wechatPayClient,
openLink: openLinkAndroid,
closeWindow: closeWindow,
openGiftPanel: openGiftPanel,
setPasteBoard: setPasteBoard,
showTrack: showTrack,
showApmTrack: showApmTrack,
webtrack: webtrack,
emitTrack: emitTrack,
emitApmTrack: emitApmTrack,
openMapWithLocation: openMapWithLocation,
confirmAntiSpam: confirmAntiSpam,
addComment: addComment,
openXhsSystemSettings: openXhsSystemSettings,
openRechargeCoinPanel: openRechargeCoinPanel,
openFansPanel: openFansPanel,
getMessageStatusIOS: getMessageStatusIOS,
getMessageStatus: getMessageStatusIOS,
areNotificationsEnabledAndroid: areNotificationsEnabledAndroid,
areNotificationsEnabled: areNotificationsEnabledAndroid,
getFileUrlFromLocalServerIOS: getFileUrlFromLocalServerIOS,
getFileUrlFromLocalServer: getFileUrlFromLocalServerIOS,
checkLoginWithAction: checkLoginWithAction,
logout: logout,
isAppInstalled: isAppInstalled,
getAppInfo: getAppInfo,
getDeviceInfo: getDeviceInfoOld,
getNetworkType: getNetworkTypeLegacy,
getUserInfo: getUserInfo,
getTrackEnv: getTrackEnv,
lowPowerModeEnabled: lowPowerModeEnabled,
requestNotificationPermission: requestNotificationPermission,
saveImage: saveImage,
basicSendClientRequest: basicSendClientRequest,
sendClientRequest: sendClientRequest,
sendClientRequestV2: sendClientRequestV2,
getPrevData: getPrevData,
getItem: getItem,
setItem: setItem,
removeItem: removeItem,
broadcast: broadcast,
broadcastNative: broadcastNative,
getThirdAuth: getThirdAuth,
getCurrentGeolocation: getCurrentGeolocation,
checkAppPermission: checkAppPermission,
toggleLocalDns: toggleLocalDns,
registerTrickleConnectTopic: registerTrickleConnectTopic,
getABFlag: getABFlag
}
, e$ = {
xhs: {},
top: {}
}
, e0 = {
xhs: {},
top: {}
};
function transformBridgeResultForTest(e) {
try {
(null == e ? void 0 : e.value) !== void 0 && (null == e ? void 0 : e.value) === null && delete e.value
} catch (e) {}
return e
}
function genBridgeQueue(e, r, i, a) {
var s, u, c, l, d, p, f = a.type, v = a.app, g = a.enableValidate, h = "h5" === f ? e0 : e$, m = (null == h ? void 0 : null === (c = h.xhs) || void 0 === c ? void 0 : null === (u = c[e]) || void 0 === u ? void 0 : null === (s = u.request) || void 0 === s ? void 0 : s.queue) || [], _ = (null == h ? void 0 : null === (p = h.xhs) || void 0 === p ? void 0 : null === (d = p[e]) || void 0 === d ? void 0 : null === (l = d.result) || void 0 === l ? void 0 : l.queue) || [], y = generateKey(), w = Date.now(), E = !0, S = (0,
eO._)(m).concat([i, {
fulfilled: function(e) {
return e
},
rejected: function(i) {
return new Promise(function(a, s) {
if ("xhs" === v && -1e4 === i.code) {
E = !1;
var u = eQ[e];
if (u)
return u(r).then(function(r) {
a({
result: (null == r ? void 0 : r.result) || 0,
message: "".concat(e, " 新通道不支持,降级为老通道发送"),
value: (null == r ? void 0 : r.value) !== void 0 ? r.value : r
})
}).catch(function(e) {
s(e)
})
}
return s(i)
}
)
}
}], (0,
eO._)(_));
(void 0 === g || g) && S.push({
fulfilled: function(r) {
return E && validateRes(e, F.Method, transformBridgeResultForTest(r), v),
r
},
rejected: function(e) {
throw e
}
}),
hasBridgeConsole() && S.push({
fulfilled: function(r) {
return bridgeSuccess({
name: e,
callbackId: y,
time: Date.now() - w,
res: r
}),
r
},
rejected: function(r) {
var i = Date.now() - w;
try {
var a = JSON.parse(r.message).errorMessage;
bridgeValidateError({
name: e,
callbackId: y,
time: i,
err: JSON.stringify(a, null, 2)
})
} catch (a) {
bridgeError({
name: e,
callbackId: y,
time: i,
err: r
})
}
throw r
}
});
var T = {
method: e,
args: r
}
, b = Promise.resolve(r)
, wrapFulfilled = function(e) {
return function(r) {
return e ? e(r, T) : r
}
}
, wrapRejected = function(e) {
return function(r) {
if (e)
return e(r, null, T);
throw r
}
};
for (bridgeStart({
name: e,
callbackId: y
}); S.length; ) {
var k = S.shift();
b = b.then(wrapFulfilled(null == k ? void 0 : k.fulfilled), wrapRejected(null == k ? void 0 : k.rejected))
}
return b
}
function isSupportInvoke() {
var e, r, i, a = ek.YF.isIOS ? null === (r = window) || void 0 === r ? void 0 : null === (e = r.webkit) || void 0 === e ? void 0 : e.messageHandlers : null === (i = window) || void 0 === i ? void 0 : i.XHSBridge;
return a && !!a.invoke
}
function invoke_invoke(e, r) {
var i = Date.now();
return new Promise(function(a, s) {
try {
if (!isSupportInvoke())
throw bridgeNotSupport(e),
new eM(D.NotSupport,"not support invoke");
var u = addCallback(e, function(r) {
var u = Date.now() - i;
try {
var c = transformRes(e, r);
addMeasure({
platformType: "H5",
bridgeName: e,
timing: u,
logType: V.Timing
}),
a(c)
} catch (r) {
addMeasure({
platformType: "H5",
bridgeName: e,
logType: V.Error,
errorInfo: (null == r ? void 0 : r.message) || "".concat(e, " call error")
}),
s(r)
}
})
, c = {
method: e,
callback: u,
args: r
};
try {
if (ek.YF.isIOS) {
var l = ek.YF.isSpark || ek.YF.isUniik || ek.YF.isSnowPeak || ek.YF.isInternation || ek.YF.isOdyssey || ek.YF.isCatalog ? c : JSON.stringify(c);
window.webkit.messageHandlers.invoke.postMessage(l)
} else
window.XHSBridge.invoke(JSON.stringify(c))
} catch (e) {
throw new eM(D.Native,null == e ? void 0 : e.message)
}
} catch (r) {
r instanceof eM ? s(r) : s(new eM(D.UnKnow,(null == r ? void 0 : r.message) || "[ozone-bridge] [".concat(e, "] call error")))
}
}
)
}
function invoke_invokeInterceptor(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "xhs"
, a = !(arguments.length > 3) || void 0 === arguments[3] || arguments[3];
return arguments.length > 4 && arguments[4],
genBridgeQueue(e, r, {
fulfilled: function(r) {
return invoke_invoke(e, transformArgs(e, r))
},
rejected: void 0
}, {
type: "h5",
app: i,
enableValidate: a
})
}
function xhs_invoke_invoke(e, r, i) {
return check_validateReq(e, F.Method, r, "xhs"),
invoke_invokeInterceptor(e, r, "xhs", !0, i)
}
function invoke_subscribe(e, r) {
return subscribe(e, r, "xhs")
}
(a = U || (U = {})).Back = "back",
a.Default = "default",
a.Foreground = "foreground",
(s = q || (q = {})).Authorized = "authorized",
s.Denied = "denied",
s.Restricted = "restricted",
s.Undetermined = "undetermined",
(u = j || (j = {})).Denied = "denied",
u.Granted = "granted",
u.Undetermined = "undetermined",
(c = W || (W = {})).Authorized = "authorized",
c.Denied = "denied",
(l = G || (G = {})).EditProfileChangedData = "edit_profile_changed_data",
l.EditProfilePreviewData = "edit_profile_preview_data",
(d = J || (J = {})).Android = "Android",
d.Harmony = "harmony",
d.IOS = "iOS",
(X || (X = {})).EditProfileChangedData = "edit_profile_changed_data",
(p = Y || (Y = {})).DOMInsert = "domInsert",
p.Destroy = "destroy",
p.Play = "play",
p.SetPlayer = "setPlayer",
p.Stop = "stop",
(f = z || (z = {})).The1 = "1",
f.The2 = "2",
f.The3 = "3",
(v = K || (K = {})).Multi = "multi",
v.Normal = "normal",
v.Video = "video",
(g = Z || (Z = {})).CnyTopicFeed = "cny_topic_feed",
g.Topic = "topic",
g.TopicDiscussion = "topic_discussion",
g.TopicRating = "topic_rating",
(h = Q || (Q = {})).Normal = "normal",
h.Video = "video",
($ || ($ = {})).Mp4 = "mp4",
(m = ee || (ee = {})).EditProfileChangedData = "edit_profile_changed_data",
m.EditProfilePreviewData = "edit_profile_preview_data",
(_ = et || (et = {})).EditProfileChangedData = "edit_profile_changed_data",
_.EditProfilePreviewData = "edit_profile_preview_data",
(y = er || (er = {})).ApplicationJSON = "application/json",
y.ApplicationXWWWFormUrlencoded = "application/x-www-form-urlencoded",
y.ImagePNG = "image/png",
(w = en || (en = {})).Delete = "DELETE",
w.Get = "GET",
w.Post = "POST",
w.Put = "PUT",
(E = ei || (ei = {})).AccountDidSwitch = "accountDidSwitch",
E.BrandAreaCard = "brand-area-card",
E.BusinessBindsUpdate = "business_binds_update",
E.CapaActivityTopicResult = "capaActivityTopicResult",
E.CapaAdvanceOptionLiveTrailerConfigUpdate = "capa_advance_option_live_trailer_config_update",
E.CheckoutPostOrder = "checkout_post_order",
E.CloseLocationPage = "closeLocationPage",
E.ClosePoiCard = "closePoiCard",
E.CnyFMPFinished = "cnyFMPFinished",
E.CoinRechargeFinishEvent = "coin_recharge_finish_event",
E.CommonAddressRn = "common-address-rn",
E.CurationKListRefreshCategory = "curation_k_list_refresh_category",
E.CurationKMoveCategory = "curation_k_move_category",
E.CustomerServiceQuickOrderCreate = "customer_service_quick_order_create",
E.CyberidentityAuthResult = "cyberidentityAuthResult",
E.DeclarePrivacyChange = "declare_privacy_change",
E.DspyxisDetailUpdateCompass = "dspyxis-detailUpdate-compass",
E.EoiMediaOffLine = "eoi_media_off_line",
E.ExitPoipage = "exitPoipage",
E.FinanceRechargeH5 = "finance-recharge-h5",
E.FloatingClose = "floating_close",
E.FloatingFull = "floating_full",
E.ForceUpdateCnyTab = "forceUpdateCnyTab",
E.GameplayWishSuccess = "gameplayWishSuccess",
E.GetLiveFloatingStatus = "getLiveFloatingStatus",
E.GoCapaByCloseWindow = "goCapaByCloseWindow",
E.GroupTopicSelectGoods = "group_topic_select_goods",
E.GrowthFeeds = "GrowthFeeds",
E.InspirationCollectBroadcast = "inspiration_collect_broadcast",
E.IosLiveMerchantNotSupportTopUpAlert = "ios_live_merchant_not_support_top_up_alert",
E.KeyboardResponded = "keyboard_responded",
E.Kuri = "kuri",
E.LancerAddressGrowth = "lancer-address-growth",
E.LancerAddressMp = "lancer-address-mp",
E.LancerAddressSlim = "lancer-address-slim",
E.LancerInvoiceSlim = "lancer-invoice-slim",
E.LancerSparkSlim = "lancer-spark-slim",
E.LegoBoxCrossPlatformEvent = "legoBoxCrossPlatformEvent",
E.LiveDynamicBridge = "live_dynamic_bridge",
E.LiveFloatWindowMute = "live_float_window_mute",
E.LiveRefreshCouponList = "live_refresh_coupon_list",
E.LiveRoomBridge = "live-room-bridge",
E.MarketingBoxClose = "marketingBoxClose",
E.MeituanNotification = "MeituanNotification",
E.MemoryWarningNotification = "memoryWarningNotification",
E.MoreClassify = "more_classify",
E.NativePostOrder = "native_post_order",
E.NativeRnNoteLike = "native-rn-note-like",
E.ObtainedGoldenNickname = "obtained_golden_nickname",
E.OpenScreenshot = "openScreenshot",
E.OpenSnackbar = "openSnackbar",
E.OrderCreated = "order-created",
E.PoiCommentPopoverImpression = "poiCommentPopoverImpression",
E.PoiCommentTagClick = "poiCommentTagClick",
E.PoiCommentTagImpression = "poiCommentTagImpression",
E.PoiDeclareOnUpdate = "poi_declare_on_update",
E.PoiDetailOnShow = "poiDetailOnShow",
E.PoiPopcornDayRankExit = "poi-popcorn-day-rank-exit",
E.PoiPopcornDetailPkExit = "poi-popcorn-detail-pk-exit",
E.PoiPopcornTotalRankExit = "poi-popcorn-total-rank-exit",
E.PostNoteGoodsResult = "postNoteGoodsResult",
E.ProfileRefreshKey = "ProfileRefreshKey",
E.PurchaseRefresh = "purchase_refresh",
E.RealNameVerifyCompleted = "realNameVerifyCompleted",
E.RedCAPTCHAVerifySuccess = "red_captcha_verify_success",
E.RelieveFreezeAccountSuccess = "relieve_freeze_account_success",
E.ReportFinishEvent = "report_finish_event",
E.ReportNoteRemoveEvent = "report_note_remove_event",
E.RnDevtools = "rn-devtools",
E.RnDevtoolsEmitter = "rn-devtools-emitter",
E.RnNativeNoteLike = "rn-native-note-like",
E.RnPostOrder = "rn_post_order",
E.SNSRNDiscoverCommentAction = "SNSRNDiscoverCommentAction",
E.SearchRNCardImpressionEvent = "searchRNCardImpressionEvent",
E.SearchRnCard = "search_rn_card",
E.SellerFeedbackAction = "seller-feedback-action",
E.SetProfileEntries = "setProfileEntries",
E.ShareLiveTrailerCard = "share_live_trailer_card",
E.ShowTopicReadTask = "show_topic_read_task",
E.SizeBeenEntered = "size-been-entered",
E.SqaLike = "sqa-like",
E.SyncScrollviewRef = "syncScrollviewRef",
E.Test = "test",
E.TranslateY = "translateY",
E.UpdateRnLiveNoticeListInfo = "update_rn_live_notice_list_info",
E.UpdateTravelInfo = "updateTravelInfo",
E.VisitedChanged = "visitedChanged",
(S = eo || (eo = {})).BusinessExecutionEnd = "businessExecutionEnd",
S.BusinessExecutionStart = "businessExecutionStart",
S.CoreHTTPRequestEnd = "coreHttpRequestEnd",
S.CoreHTTPRequestStart = "coreHttpRequestStart",
S.FirstMeaningfulPaint = "firstMeaningfulPaint",
S.FrameExecutionEnd = "frameExecutionEnd",
S.FrameExecutionStart = "frameExecutionStart",
S.RouterStart = "routerStart",
S.ViewRenderEnd = "viewRenderEnd",
(T = ea || (ea = {})).More = "more",
T.Share = "share",
(b = es || (es = {})).Center = "center",
b.Event = "event",
b.General = "general",
b.GoodsDetail = "goodsDetail",
b.Topic = "topic",
b.XiuxiuInvite = "xiuxiuInvite",
(k = eu || (eu = {})).Image = "image",
k.Link = "link",
k.MiniProgram = "miniProgram",
k.Text = "text",
(C = ec || (ec = {})).Image = "image",
C.Link = "link",
(P = el || (el = {})).Image = "image",
P.Link = "link",
P.Text = "text",
(A = ed || (ed = {})).Emoji = "emoji",
A.Image = "image",
A.Link = "link",
A.MiniProgram = "miniProgram",
A.Text = "text",
(R = ep || (ep = {})).Image = "image",
R.Link = "link",
R.Text = "text",
(I = ef || (ef = {})).Image = "image",
I.Link = "link",
I.Text = "text",
(O = ev || (ev = {})).Goods = "goods",
O.Universal = "universal",
(N = eg || (eg = {})).PageComplete = "page_complete",
N.PageLoad = "page_load",
(L = eh || (eh = {})).Pause = "pause",
L.Resume = "resume"
},
92014: function(e, r, i) {
"use strict";
i.r(r),
i.d(r, {
OzonePanelType: function() {
return ea
},
SheetType: function() {
return em
},
SaveProfileEditDataEventKey: function() {
return ep
},
OzoneSystemName: function() {
return en
},
findCalendarEvent: function() {
return findCalendarEvent
},
invokeAurora: function() {
return xhsaurora_invoke_invoke
},
ShareToFriendType: function() {
return e_
},
subscribeAurora: function() {
return xhsaurora_invoke_subscribe
},
OzoneCalendarStatus: function() {
return Z
},
invoke: function() {
return invoke_invoke
},
Type: function() {
return es
},
BackgroundFetchFileStatus: function() {
return eP
},
SpvType: function() {
return $
},
invokePrado: function() {
return prado_invoke_invoke
},
invokeTop: function() {
return top_invoke_invoke
},
invokeUniik: function() {
return uniik_invoke_invoke
},
subscribeDocs: function() {
return xhsdocs_invoke_subscribe
},
invokeSync: function() {
return invokeSync
},
subscribePrado: function() {
return prado_invoke_subscribe
},
subscribeTop: function() {
return top_invoke_subscribe
},
setUpBridge: function() {
return setup
},
invokeDocs: function() {
return xhsdocs_invoke_invoke
},
SendCrossPlatformEventEventKey: function() {
return eg
},
QQSpaceContentType: function() {
return ew
},
ShowPhoneBindDialogType: function() {
return ek
},
WechatWorkContentType: function() {
return eb
},
subscribe: function() {
return invoke_subscribe
},
Scene: function() {
return eu
},
Method: function() {
return ev
},
EventKey: function() {
return ei
},
QQContentType: function() {
return ey
},
SaveCrossPlatformDataDataKey: function() {
return ed
},
Step: function() {
return eC
},
getUserInfoV2: function() {
return getUserInfoV2
},
SchemaErrorCode: function() {
return D.nJ
},
saveCalendarEvent: function() {
return saveCalendarEvent
},
CheckAppPermissionValue: function() {
return ee
},
ContentType: function() {
return ef
},
addMeasure: function() {
return X.b
},
removeCalendarEvent: function() {
return removeCalendarEvent
},
PerformanceName: function() {
return eh
},
WechatTimelineContentType: function() {
return eT
},
subscribeBiz: function() {
return biz_invoke_subscribe
},
WechatSessionContentType: function() {
return eS
},
subscribeUniik: function() {
return uniik_invoke_subscribe
},
OpenPfCommentListType: function() {
return ec
},
shortVibrate: function() {
return shortVibrate
},
Format: function() {
return el
},
getSession: function() {
return getSession
},
Action: function() {
return eo
},
OzonePopupStatus: function() {
return et
},
DataKey: function() {
return er
},
SinaWeiboContentType: function() {
return eE
},
invokeBiz: function() {
return biz_invoke_invoke
}
});
var a, s, u, c, l, d, p, f, v, g, h, m, _, y, w, E, S, T, b, k, C, P, A, R, I, O, N, L, M, B, x = i(70076), D = i(50837), F = i(46490), V = i(77698), H = i(44270), U = i(90251);
i(89300),
i(49930),
i(19990),
i(27461),
i(23339),
i(51109),
i(34333),
i(87989),
i(86651),
i(87535),
i(75204),
i(97357),
i(87394),
i(94941),
i(48421);
var q = i(70306)
, j = "CallbackList"
, W = new WeakMap
, G = function() {
function XHSEventsCB() {
(0,
F._)(this, XHSEventsCB),
(0,
H._)(this, W, {
writable: !0,
value: {}
})
}
return (0,
U._)(XHSEventsCB, [{
key: "get",
value: function get(e) {
return (0,
V._)(this, W)[e] || []
}
}, {
key: "set",
value: function set(e, r) {
(0,
V._)(this, W)[e] = r
}
}]),
XHSEventsCB
}();
function addCalledJsListener(e, r) {
for (var i = "".concat(e).concat(j), a = window.XHSEventsCB.get(i), s = 0; s < a.length; s++)
if (a[s] === r)
return;
a.push(r),
window.XHSEventsCB.set(i, a)
}
function generateCalledJsCallback(e, r) {
return function(i) {
(0,
x.o)(e, D.XQ.Event, i, r),
(0,
q.Wb)({
name: e,
res: i
}),
window.XHSEventsCB.get("".concat(e).concat(j)).forEach(function(e) {
return e(i)
})
}
}
function removeCalledJsListener(e, r) {
return {
remove: function() {
var i = "".concat(e).concat(j)
, a = window.XHSEventsCB.get(i);
window.XHSEventsCB.set(i, a.filter(function(e) {
return e !== r
}))
}
}
}
function subscribe(e, r, i) {
return (0,
q.mJ)({
name: e,
type: "event"
}),
addCalledJsListener(e, r),
!window.XHSEvents[e] && (window.XHSEvents[e] = generateCalledJsCallback(e, i)),
removeCalledJsListener(e, r)
}
window.XHSEvents = window.XHSEvents || {},
window.XHSEventsCB = window.XHSEventsCB || new G;
var J = i(1799);
function invoke_invoke(e, r, i) {
return (0,
x.T)(e, D.XQ.Method, r, "xhs"),
(0,
J.fA)(e, r, "xhs", !0, i)
}
function invoke_subscribe(e, r) {
return subscribe(e, r, "xhs")
}
function invokeSync(e, r, i) {
return (0,
J.xm)(e, r)
}
function top_invoke_invoke(e, r, i) {
return (0,
x.T)(e, D.XQ.Method, r, "top"),
(0,
J.fA)(e, r, "top", !0, i)
}
function top_invoke_subscribe(e, r) {
return subscribe(e, r, "top")
}
function biz_invoke_invoke(e, r, i) {
return (0,
x.T)(e, D.XQ.Method, r, "biz"),
(0,
J.fA)(e, r, "biz", !0, i)
}
function biz_invoke_subscribe(e, r) {
return subscribe(e, r, "biz")
}
function uniik_invoke_invoke(e, r, i) {
return (0,
x.T)(e, D.XQ.Method, r, "uniik"),
(0,
J.fA)(e, r, "uniik", !0, i)
}
function uniik_invoke_subscribe(e, r) {
return subscribe(e, r, "uniik")
}
function xhsdocs_invoke_invoke(e, r, i) {
return (0,
x.T)(e, D.XQ.Method, r, "xhsdocs"),
(0,
J.fA)(e, r, "xhsdocs", !0, i)
}
function xhsdocs_invoke_subscribe(e, r) {
return subscribe(e, r, "xhsdocs")
}
function xhsaurora_invoke_invoke(e, r, i) {
return (0,
x.T)(e, D.XQ.Method, r, "xhsaurora"),
(0,
J.fA)(e, r, "xhsaurora", !0, i)
}
function xhsaurora_invoke_subscribe(e, r) {
return subscribe(e, r, "xhsaurora")
}
function prado_invoke_invoke(e, r, i) {
return (0,
x.T)(e, D.XQ.Method, r, "prado"),
(0,
J.fA)(e, r, "prado", !0, i)
}
function prado_invoke_subscribe(e, r) {
return subscribe(e, r, "prado")
}
var X = i(27256)
, Y = i(41622)
, z = i(377);
i(36277),
i(41593);
var K = i(63522);
var Z = ((a = {}).Authorized = "authorized",
a.Denied = "denied",
a.Restricted = "restricted",
a.Undetermined = "undetermined",
a)
, Q = i(3511);
function shortVibrate() {
return _shortVibrate.apply(this, arguments)
}
function _shortVibrate() {
return (_shortVibrate = (0,
Y._)(function() {
var e, r;
return (0,
z.Jh)(this, function(i) {
if (K.YF.isIOS)
return [2, (0,
J.fA)("shortVibrate", {
id: 1519
})];
if (null === (r = window) || void 0 === r ? void 0 : null === (e = r.navigator) || void 0 === e ? void 0 : e.vibrate)
return window.navigator.vibrate(50),
[2, Promise.resolve({
message: "success",
result: 0
})];
throw new Q.Z("ERR_NOT_SUPPORT","not support shortVibrate")
})
})).apply(this, arguments)
}
function findCalendarEvent(e) {
return _findCalendarEvent.apply(this, arguments)
}
function _findCalendarEvent() {
return (_findCalendarEvent = (0,
Y._)(function(e) {
var r;
return (0,
z.Jh)(this, function(i) {
switch (i.label) {
case 0:
return i.trys.push([0, 2, , 3]),
[4, (0,
J.fA)("authorizeCalendarStatus")];
case 1:
if ((r = (i.sent() || {}).value) === Z.Authorized)
return [2, (0,
J.fA)("findCalendarEvent", e)];
throw new Q.Z("calendar permission: ".concat(r));
case 2:
return [2, Promise.reject(i.sent())];
case 3:
return [2]
}
})
})).apply(this, arguments)
}
function removeCalendarEvent(e) {
return _removeCalendarEvent.apply(this, arguments)
}
function _removeCalendarEvent() {
return (_removeCalendarEvent = (0,
Y._)(function(e) {
var r;
return (0,
z.Jh)(this, function(i) {
switch (i.label) {
case 0:
return i.trys.push([0, 2, , 3]),
[4, (0,
J.fA)("authorizeCalendarStatus")];
case 1:
if ((r = (i.sent() || {}).value) === Z.Authorized)
return [2, (0,
J.fA)("removeCalendarEvent", e)];
throw new Q.Z("calendar permission: ".concat(r));
case 2:
return [2, Promise.reject(i.sent())];
case 3:
return [2]
}
})
})).apply(this, arguments)
}
function saveCalendarEvent(e) {
return _saveCalendarEvent.apply(this, arguments)
}
function _saveCalendarEvent() {
return (_saveCalendarEvent = (0,
Y._)(function(e) {
var r;
return (0,
z.Jh)(this, function(i) {
switch (i.label) {
case 0:
return i.trys.push([0, 2, , 3]),
[4, (0,
J.fA)("authorizeCalendarStatus")];
case 1:
if ((r = (i.sent() || {}).value) === Z.Authorized)
return [2, (0,
J.fA)("saveCalendarEvent", e)];
throw new Q.Z("calendar permission: ".concat(r));
case 2:
return [2, Promise.reject(i.sent())];
case 3:
return [2]
}
})
})).apply(this, arguments)
}
function getUserInfoV2() {
return (0,
J.fA)("getUserInfo")
}
function getSession() {
return _getSession.apply(this, arguments)
}
function _getSession() {
return (_getSession = (0,
Y._)(function() {
var e, r;
return (0,
z.Jh)(this, function(i) {
switch (i.label) {
case 0:
return [4, getUserInfoV2()];
case 1:
if ((null == (e = i.sent()) ? void 0 : e.result) === 0)
return [2, null === (r = e.value) || void 0 === r ? void 0 : r.sessionId];
throw Error("Session 获取失败")
}
})
})).apply(this, arguments)
}
var $ = ((s = {}).Back = "back",
s.Default = "default",
s.Foreground = "foreground",
s);
var ee = ((u = {}).Denied = "denied",
u.Granted = "granted",
u.Undetermined = "undetermined",
u);
var et = ((c = {}).Authorized = "authorized",
c.Denied = "denied",
c);
var er = ((l = {}).EditProfileChangedData = "edit_profile_changed_data",
l.EditProfilePreviewData = "edit_profile_preview_data",
l);
var en = ((d = {}).Android = "Android",
d.Harmony = "harmony",
d.IOS = "iOS",
d);
var ei = ((p = {}).EditProfileChangedData = "edit_profile_changed_data",
p);
var eo = ((f = {}).DOMInsert = "domInsert",
f.Destroy = "destroy",
f.Play = "play",
f.SetPlayer = "setPlayer",
f.Stop = "stop",
f);
var ea = ((v = {}).The1 = "1",
v.The2 = "2",
v.The3 = "3",
v);
var es = ((g = {}).Multi = "multi",
g.Normal = "normal",
g.Video = "video",
g);
var eu = ((h = {}).CnyTopicFeed = "cny_topic_feed",
h.Topic = "topic",
h.TopicDiscussion = "topic_discussion",
h.TopicRating = "topic_rating",
h);
var ec = ((m = {}).Normal = "normal",
m.Video = "video",
m);
var el = ((_ = {}).Mp4 = "mp4",
_);
var ed = ((y = {}).EditProfileChangedData = "edit_profile_changed_data",
y.EditProfilePreviewData = "edit_profile_preview_data",
y);
var ep = ((w = {}).EditProfileChangedData = "edit_profile_changed_data",
w.EditProfilePreviewData = "edit_profile_preview_data",
w);
var ef = ((E = {}).ApplicationJSON = "application/json",
E.ApplicationXWWWFormUrlencoded = "application/x-www-form-urlencoded",
E.ImagePNG = "image/png",
E);
var ev = ((S = {}).Delete = "DELETE",
S.Get = "GET",
S.Post = "POST",
S.Put = "PUT",
S);
var eg = ((T = {}).AccountDidSwitch = "accountDidSwitch",
T.BrandAreaCard = "brand-area-card",
T.BusinessBindsUpdate = "business_binds_update",
T.CapaActivityTopicResult = "capaActivityTopicResult",
T.CapaAdvanceOptionLiveTrailerConfigUpdate = "capa_advance_option_live_trailer_config_update",
T.CheckoutPostOrder = "checkout_post_order",
T.CloseLocationPage = "closeLocationPage",
T.ClosePoiCard = "closePoiCard",
T.CnyFMPFinished = "cnyFMPFinished",
T.CoinRechargeFinishEvent = "coin_recharge_finish_event",
T.CommonAddressRn = "common-address-rn",
T.CurationKListRefreshCategory = "curation_k_list_refresh_category",
T.CurationKMoveCategory = "curation_k_move_category",
T.CustomerServiceQuickOrderCreate = "customer_service_quick_order_create",
T.CyberidentityAuthResult = "cyberidentityAuthResult",
T.DeclarePrivacyChange = "declare_privacy_change",
T.DspyxisDetailUpdateCompass = "dspyxis-detailUpdate-compass",
T.EoiMediaOffLine = "eoi_media_off_line",
T.ExitPoipage = "exitPoipage",
T.FinanceRechargeH5 = "finance-recharge-h5",
T.FloatingClose = "floating_close",
T.FloatingFull = "floating_full",
T.ForceUpdateCnyTab = "forceUpdateCnyTab",
T.GameplayWishSuccess = "gameplayWishSuccess",
T.GetLiveFloatingStatus = "getLiveFloatingStatus",
T.GoCapaByCloseWindow = "goCapaByCloseWindow",
T.GroupTopicSelectGoods = "group_topic_select_goods",
T.GrowthFeeds = "GrowthFeeds",
T.InspirationCollectBroadcast = "inspiration_collect_broadcast",
T.IosLiveMerchantNotSupportTopUpAlert = "ios_live_merchant_not_support_top_up_alert",
T.KeyboardResponded = "keyboard_responded",
T.Kuri = "kuri",
T.LancerAddressGrowth = "lancer-address-growth",
T.LancerAddressMp = "lancer-address-mp",
T.LancerAddressSlim = "lancer-address-slim",
T.LancerInvoiceSlim = "lancer-invoice-slim",
T.LancerSparkSlim = "lancer-spark-slim",
T.LegoBoxCrossPlatformEvent = "legoBoxCrossPlatformEvent",
T.LiveDynamicBridge = "live_dynamic_bridge",
T.LiveFloatWindowMute = "live_float_window_mute",
T.LiveRefreshCouponList = "live_refresh_coupon_list",
T.LiveRoomBridge = "live-room-bridge",
T.MarketingBoxClose = "marketingBoxClose",
T.MeituanNotification = "MeituanNotification",
T.MemoryWarningNotification = "memoryWarningNotification",
T.MoreClassify = "more_classify",
T.NativePostOrder = "native_post_order",
T.NativeRnNoteLike = "native-rn-note-like",
T.ObtainedGoldenNickname = "obtained_golden_nickname",
T.OpenScreenshot = "openScreenshot",
T.OpenSnackbar = "openSnackbar",
T.OrderCreated = "order-created",
T.PoiCommentPopoverImpression = "poiCommentPopoverImpression",
T.PoiCommentTagClick = "poiCommentTagClick",
T.PoiCommentTagImpression = "poiCommentTagImpression",
T.PoiDeclareOnUpdate = "poi_declare_on_update",
T.PoiDetailOnShow = "poiDetailOnShow",
T.PoiPopcornDayRankExit = "poi-popcorn-day-rank-exit",
T.PoiPopcornDetailPkExit = "poi-popcorn-detail-pk-exit",
T.PoiPopcornTotalRankExit = "poi-popcorn-total-rank-exit",
T.PostNoteGoodsResult = "postNoteGoodsResult",
T.ProfileRefreshKey = "ProfileRefreshKey",
T.PurchaseRefresh = "purchase_refresh",
T.RealNameVerifyCompleted = "realNameVerifyCompleted",
T.RedCAPTCHAVerifySuccess = "red_captcha_verify_success",
T.RelieveFreezeAccountSuccess = "relieve_freeze_account_success",
T.ReportFinishEvent = "report_finish_event",
T.ReportNoteRemoveEvent = "report_note_remove_event",
T.RnDevtools = "rn-devtools",
T.RnDevtoolsEmitter = "rn-devtools-emitter",
T.RnNativeNoteLike = "rn-native-note-like",
T.RnPostOrder = "rn_post_order",
T.SNSRNDiscoverCommentAction = "SNSRNDiscoverCommentAction",
T.SearchRNCardImpressionEvent = "searchRNCardImpressionEvent",
T.SearchRnCard = "search_rn_card",
T.SellerFeedbackAction = "seller-feedback-action",
T.SetProfileEntries = "setProfileEntries",
T.ShareLiveTrailerCard = "share_live_trailer_card",
T.ShowTopicReadTask = "show_topic_read_task",
T.SizeBeenEntered = "size-been-entered",
T.SqaLike = "sqa-like",
T.SyncScrollviewRef = "syncScrollviewRef",
T.Test = "test",
T.TranslateY = "translateY",
T.UpdateRnLiveNoticeListInfo = "update_rn_live_notice_list_info",
T.UpdateTravelInfo = "updateTravelInfo",
T.VisitedChanged = "visitedChanged",
T);
var eh = ((b = {}).BusinessExecutionEnd = "businessExecutionEnd",
b.BusinessExecutionStart = "businessExecutionStart",
b.CoreHTTPRequestEnd = "coreHttpRequestEnd",
b.CoreHTTPRequestStart = "coreHttpRequestStart",
b.FirstMeaningfulPaint = "firstMeaningfulPaint",
b.FrameExecutionEnd = "frameExecutionEnd",
b.FrameExecutionStart = "frameExecutionStart",
b.RouterStart = "routerStart",
b.ViewRenderEnd = "viewRenderEnd",
b);
var em = ((k = {}).More = "more",
k.Share = "share",
k);
var e_ = ((C = {}).Center = "center",
C.Event = "event",
C.General = "general",
C.GoodsDetail = "goodsDetail",
C.Topic = "topic",
C.XiuxiuInvite = "xiuxiuInvite",
C);
var ey = ((P = {}).Image = "image",
P.Link = "link",
P.MiniProgram = "miniProgram",
P.Text = "text",
P);
var ew = ((A = {}).Image = "image",
A.Link = "link",
A);
var eE = ((R = {}).Image = "image",
R.Link = "link",
R.Text = "text",
R);
var eS = ((I = {}).Emoji = "emoji",
I.Image = "image",
I.Link = "link",
I.MiniProgram = "miniProgram",
I.Text = "text",
I);
var eT = ((O = {}).Image = "image",
O.Link = "link",
O.Text = "text",
O);
var eb = ((N = {}).Image = "image",
N.Link = "link",
N.Text = "text",
N);
var ek = ((L = {}).Goods = "goods",
L.Universal = "universal",
L);
var eC = ((M = {}).PageComplete = "page_complete",
M.PageLoad = "page_load",
M);
var eP = ((B = {}).Pause = "pause",
B.Resume = "resume",
B)
, setup = function() {}
},
1799: function(e, r, i) {
"use strict";
i.d(r, {
bw: function() {
return invokeInterceptorWithoutValidate
},
xm: function() {
return invokeSync
},
fA: function() {
return invokeInterceptor
}
}),
i(36277),
i(34333),
i(87989),
i(7608);
var a, s = i(63522);
i(72169),
i(58486);
var u = i(4659)
, c = Array(16);
function makeRng() {
for (var e, r = 0; r < 16; r++)
(3 & r) == 0 && (e = 0x100000000 * Math.random()),
c[r] = e >>> ((3 & r) << 3) & 255;
return c
}
function generateKey() {
return (0,
u.Z)({
rng: makeRng
}).replace(/-/g, "_")
}
function addCallback(e, r) {
var i = "".concat(e, "_").concat(generateKey());
return window.XHSCallbacks[i] = r,
"window.XHSCallbacks.".concat(i)
}
window.XHSCallbacks = window.XHSCallbacks || {},
window.XHSInvokeCallback = function(e, r) {
window.XHSCallbacks[r] && window.XHSCallbacks[r](e)
}
;
var l = i(50837)
, d = i(35329)
, p = i(46490)
, f = i(51606)
, v = i(27292)
, g = i(75649)
, h = i(30961);
i(41593);
var m = i(72252)
, _ = function(e) {
function SchemaError(e) {
for (var r, i = arguments.length, a = Array(i > 1 ? i - 1 : 0), u = 1; u < i; u++)
a[u - 1] = arguments[u];
return (0,
p._)(this, SchemaError),
r = (0,
d._)(this, SchemaError, (0,
g._)(a)),
(0,
f._)(r, "code", void 0),
r.name = "SchemaError",
r.code = e,
s.YF.isXHS && r.code === l.nJ.UnKnow && (0,
m.vU)(r),
r
}
return (0,
v._)(SchemaError, e),
SchemaError
}((0,
h._)(Error))
, y = i(70879)
, w = i(27337)
, E = i(64593);
function completeUrl(e) {
if (!e.startsWith("http"))
return e.startsWith("//") ? window.location.protocol + e : window.location.origin + e;
return e
}
function webp2png(e) {
if (s.YF.isIOS) {
var r, i, a = (null == e ? void 0 : null === (r = e.response) || void 0 === r ? void 0 : r.image) || (null == e ? void 0 : null === (i = e.response) || void 0 === i ? void 0 : i.images), u = (0,
s.Np)();
(null == u ? void 0 : u.major) < 14 && (null == a ? void 0 : a.endsWith("format/webp")) && (a = "".concat(a.substring(0, a.length - 4), "png"),
e.response.image = a,
e.response.images = a)
}
}
i(42876),
i(33933),
i(75973),
i(87535),
i(75204),
i(97357),
i(55947),
i(97542),
i(63712);
var S = ["getDeviceInfo", "getSupportedEvents"]
, T = ["getPreResponse"];
function transformArgs(e, r) {
if ("sendClientRequestV3" === e) {
var i = (0,
y._)({}, r.headers)
, a = r.method.toUpperCase()
, s = i["Content-Type"]
, u = (0,
E._)(i, ["Content-Type"]);
return "GET" === a || ["application/x-www-form-urlencoded", "application/json"].includes(s) ? "GET" === a && s && (i = u) : i["Content-Type"] = "application/json",
Object.keys(i).forEach(function(e) {
"string" != typeof i[e] && (i[e] = String(i[e]))
}),
(0,
w._)((0,
y._)({}, r), {
url: completeUrl(r.url),
headers: i
})
}
return r
}
var b = {
getDeviceInfo: function adaptGetDeviceInfo(e) {
if (s.YF.isIOS) {
var r;
e.value.deviceId = null == e ? void 0 : null === (r = e.value) || void 0 === r ? void 0 : r.uniqueId
}
try {
delete e.value.freeDiskStorage,
delete e.value.totalDiskCapacity
} catch (e) {
console.log("get device info interceptor error:", e.message)
}
return e
},
getUserInfo: function(e) {
return webp2png(e),
e
}
};
function transformRes(e, r) {
var i = r || {}
, a = i.result
, s = i.value
, u = i.message
, c = s;
if (S.includes(e) && 0 === a && !("[object Object]" === Object.prototype.toString.call(c) && Object.prototype.hasOwnProperty.call(c, "result")) && (c = r),
0 === a)
return b[e] ? b[e](c) : c;
if (T.includes(e))
throw new _((null == s ? void 0 : s.message) || a,"".concat(e, ": ").concat(u));
throw new _(a,"".concat(e, ": ").concat(u))
}
var k = i(27256)
, C = i(70306);
i(86651),
i(19077);
var P = i(70076)
, A = i(41622)
, R = i(377)
, I = i(7862)
, O = i.n(I)
, N = i(36757);
i(25069);
var L = O().oneOf([0, -1]).isRequired;
function urlType(e, r, i, a) {
if (e[r] && !/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.?%&=]*)?/.test(e[r]))
return Error("Invalid ".concat(a, " `").concat(r, "` => `").concat(JSON.stringify(e[r]), "` supplied to `").concat(i, "`, expected `url` pattern."))
}
var M = i(3511);
function checkOldBridge_check(e, r, i, a) {
setTimeout(function() {
try {
O().checkPropTypes({
prop: e
}, {
prop: r
}, i, "ozone-bridge/".concat(a), function() {
return !1
})
} catch (e) {
var s = e.stack.indexOf(e.message) > -1 ? e.stack : "Error: ".concat(e.message, "\n").concat(e.stack);
(0,
m.vU)(s, null, null, {
console: !0,
owl: !0
})
}
})
}
function checkArgs(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
if (!r) {
(0,
m.ZK)("argsT is necessary");
return
}
checkOldBridge_check(r, e, "args", i)
}
function checkRes(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
if (!r) {
(0,
m.ZK)("resT is necessary");
return
}
checkOldBridge_check(r, e, "res", i)
}
i(34885);
function escapeNewLineChars(e) {
return "string" == typeof e ? e.replace(/\n/g, "\\n").replace(/\r/g, "\\r") : e
}
a = window.XHS_CALLBACKS || (window.XHS_CALLBACKS = {});
var B = {
add: function add(e, r, i) {
var u = "".concat(e, "_").concat(generateKey());
return a[u] = function callbackWrap(a) {
var u;
if (s.YF.isIOS || (0,
s.S8)("5.26.1"))
u = a;
else
try {
u = JSON.parse(escapeNewLineChars(a))
} catch (e) {
u = a
}
(null == i ? void 0 : i.resT) && checkRes(u, i.resT, e),
r(u)
}
,
"XHS_CALLBACKS.".concat(u)
}
};
function isSupportAdapter(e) {
var r, i = s.YF.isIOS ? null === (r = window.webkit) || void 0 === r ? void 0 : r.messageHandlers : window.xhsbridge;
return i && !!i[e]
}
function bridge(e, r, i) {
var a = {};
if (void 0 !== r && (a.data = r),
i && (a.callback = i),
s.YF.isIOS) {
if ("registerNotice" === e && (0,
s.S8)("5.29") && (0,
s.mV)("5.31")) {
try {
window.webkit.messageHandlers[e].postMessage({
data: i
})
} catch (e) {
throw new M.Z("ERR_NATIVE",e.message)
}
return
}
try {
window.webkit.messageHandlers[e].postMessage(a)
} catch (r) {
throw new M.Z("ERR_NATIVE","".concat(r.message, ", bridge is ").concat(e))
}
} else {
var u = JSON.stringify(a);
try {
window.xhsbridge[e](u)
} catch (r) {
throw new M.Z("ERR_NATIVE","".concat(r.message, ", bridge is ").concat(e))
}
}
}
function callbackAdapter(e, r, i, a) {
var s;
if (!isSupportAdapter(e))
throw new M.Z("ERR_NOT_SUPPORT","not support ".concat(e));
(null == a ? void 0 : a.argsT) && checkArgs(r, a.argsT, e),
"function" == typeof i && (s = B.add(e, i, a)),
bridge(e, r, s)
}
function adapter(e, r, i) {
return new Promise(function(a, s) {
try {
var u = r
, c = i;
u && (u.argsT || u.resT) && (c = u,
u = void 0),
callbackAdapter(e, u, a, c)
} catch (e) {
s(e)
}
}
)
}
var x = i(31547);
function deprecatedStr(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "";
return "[OzoneBridge] ".concat(e, " was deprecated, please use ").concat(r, ".").concat(i ? " Changelog for ".concat(i) : "")
}
function logDeprecated_warnDeprecated(e, r, i) {
(0,
m.ZK)(deprecatedStr(e, r, i))
}
function arrangeExtensionFriend(e) {
var r;
return "string" == typeof e ? logDeprecated_warnDeprecated("args.extension.friend String", "args.extension.friend Object") : (void 0 === e ? "undefined" : (0,
x._)(e)) === "object" && (e.cover && !e.image && (logDeprecated_warnDeprecated("args.extension.friend.cover", "args.extension.friend.image"),
e.image = e.cover,
r = (0,
y._)({}, e)),
s.YF.isAndroid && (r = JSON.stringify(e))),
r
}
var D = s.YF.isAndroid && (0,
s.S8)("5.20") || !0;
function postNotice(e) {
var r = e.methodName
, i = e.data
, a = ("undefined" == typeof window ? "undefined" : (0,
x._)(window)) === "object" && "object" === (0,
x._)(window.wx) ? window.wx : null;
return a && a.miniProgram && a.miniProgram.postMessage ? (a.miniProgram.postMessage({
data: {
methodName: r,
data: i
}
}),
Promise.resolve()) : Promise.resolve()
}
function setShareInfo(e) {
return postNotice({
methodName: "setShareInfo",
data: e
})
}
function showToast(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
if (checkArgs(e, {
argsT: O().string.isRequired
}.argsT, "showToast"),
null == e)
throw new M.Z("ERR_ARGS_NULL","message should not be undefined or null");
return adapter("toast", (0,
y._)({
message: e
}, r))
}
function showAlert(e) {
var r = "showalertV2";
checkArgs(e, {
argsT: O().shape({
title: O().string,
desc: O().string,
actions: O().arrayOf(O().shape({
name: O().string,
callback: O().func
}))
})
}.argsT, "showAlert");
var i = (0,
w._)((0,
y._)({}, e), {
des: e.desc || ""
})
, a = []
, s = {
default: 0,
cancel: 1,
destructive: 2
};
return i.actions.forEach(function(e) {
var i = B.add(r, e.callback);
a.push({
name: e.name,
type: s[e.style],
script: "window.".concat(i, " && window.").concat(i)
})
}),
i.actions = a,
adapter(r, i)
}
function showActionSheet(e) {
return adapter("showActionSheet", e, {
argsT: O().shape({
title: O().string,
desc: O().string,
actions: O().arrayOf(O().shape({
name: O().string,
value: O().string.isRequired
}))
}),
resT: O().shape({
result: L,
value: O().string
})
})
}
function setNavigationHidden() {
return adapter("setNavigationHidden", {
resT: O().shape({
result: L
})
})
}
function showNavigationRightBarButtonItem(e) {
var r = {
argsT: O().shape({
visible: O().bool,
buttonTitle: O().string,
buttonIcon: O().string,
handler: O().func
}),
resT: O().shape({
result: L
})
};
e.button_title && logDeprecated_warnDeprecated("args.button_title", "args.buttonTitle"),
e.button_icon && logDeprecated_warnDeprecated("args.button_icon", "args.buttonIcon"),
checkArgs(e, r.argsT, "showNavigationRightBarButtonItem");
var i = e.handler
, a = (0,
E._)(e, ["handler"])
, s = (0,
N.cJ)(a);
return i && "function" == typeof i && (window.XHSHandler = (0,
w._)((0,
y._)({}, window.XHSHandler), {
navigationRightBarButtonItem: i
})),
adapter("showNavigationRightBarButtonItemV2", s, {
resT: r.resT
})
}
function setStatusBarHiddenIOS() {
var e = !(arguments.length > 0) || void 0 === arguments[0] || arguments[0];
return adapter("setStatusBarHiddenIOS", e, {
argsT: O().bool.isRequired
})
}
function setStatusBarTextColor() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
color: "0"
};
if (s.YF.isIOS)
throw new M.Z("NOT SUPPORTED ON iOS, Please use setStatusBarStyleIOS");
return adapter("setStatusBarTextColor", e.color)
}
function alwaysBounceIOS(e) {
var r = !(arguments.length > 1) || void 0 === arguments[1] || arguments[1];
return adapter("alwaysBounceIOS", {
direction: e,
bounces: r
}, {
argsT: O().shape({
direction: O().oneOf(["vertical", "horizontal"]).isRequired,
bounces: O().bool.isRequired
})
})
}
function ui_setShareInfo(e) {
var r = {
argsT: O().shape({
contentType: O().string,
title: O().string,
content: O().string,
linkurl: urlType,
imageurl: urlType,
type: O().string,
extension: O().shape({
miniprogram: O().shape({
title: O().string,
desc: O().string,
webpageurl: urlType,
path: O().string,
thumb: O().string,
username: O().string
}),
friend: O().oneOfType([O().string, O().shape({
source: O().string,
type: O().oneOf(["general", "goodsDetail", "center", "topic", "event"]),
title: O().string,
content: O().string,
cover: O().string,
image: O().string,
link: O().string,
btn: O().string,
avatar: O().string,
brandName: O().string,
id: O().string,
desc: O().string,
price: O().number
})])
})
}),
resT: O().shape({
result: L
})
}
, i = e;
if (i) {
(i = (0,
y._)({}, i)).type && !D && (i.type = i.type.replace(/WXMiniProgram/, "WeixinSession")),
i.image && !i.imageurl && (logDeprecated_warnDeprecated("args.image", "args.imageurl"),
i.imageurl = i.image);
var a, u = arrangeExtensionFriend(null === (a = i.extension) || void 0 === a ? void 0 : a.friend);
u && (i.extension.friend = u)
}
return s.YF.isMiniprogram ? setShareInfo(i) : adapter("setShareInfo", i, r)
}
function showShareMenu() {
return adapter("showShareMenu")
}
function shareContent(e) {
var r, i = {
argsT: O().shape({
type: O().string.isRequired,
contentType: O().oneOf(["link", "image", "text"]),
title: O().string,
content: O().string,
linkurl: urlType,
imageurl: urlType,
base64string: O().string,
extension: O().shape({
miniprogram: O().shape({
title: O().string,
desc: O().string,
webpageurl: urlType,
path: O().string,
thumb: O().string,
username: O().string
}),
friend: O().oneOf([O().string, {
source: O().string,
type: O().oneOf(["general", "goodsDetail", "center", "topic", "event"]),
title: O().string,
content: O().string,
cover: O().string,
image: O().string,
link: O().string,
btn: O().string,
avatar: O().string,
brandName: O().string,
id: O().string,
desc: O().string,
price: O().number
}])
})
}),
resT: O().shape({
result: L
})
}, a = (0,
y._)({}, e);
a.type && !D && (a.type = e.type.replace(/WXMiniProgram/, "WeixinSession")),
a.image && !a.imageurl && (logDeprecated_warnDeprecated("args.image", "args.imageurl"),
a.imageurl = a.image);
var s = arrangeExtensionFriend(null === (r = a.extension) || void 0 === r ? void 0 : r.friend);
return s && (a.extension.friend = s),
adapter("shareContentV2", a, i)
}
function pay(e) {
return adapter("pay", e)
}
function alipayClient(e) {
return adapter("alipayClient", e, {
argsT: O().string.isRequired,
resT: O().shape({
result: L,
orderid: O().string.isRequired
})
})
}
function openURLByWechat(e) {
return adapter("openURLByWechat", e, {
argsT: O().shape({
url: O().string.isRequired
})
})
}
function wechatPayClient(e) {
return adapter("wechatPayClient", e, {
argsT: O().string.isRequired,
resT: O().shape({
result: L,
orderid: O().string.isRequired
})
})
}
function supportApplePayIOS() {
return adapter("supportApplePay")
}
function applePayClientIOS(e) {
return adapter("applePayClient", e)
}
function openLinkAndroid(e) {
return adapter("openLink", e, {
argsT: O().string.isRequired
})
}
function closeWindow() {
return adapter("closeWindow")
}
function removeVCFromStackIOS() {
return adapter("removeVCFromStack")
}
function replaceSelfWithLink(e) {
var r = e.link
, i = e.type
, a = s.YF.isIOS && (0,
s.S8)("5.39")
, u = {
argsT: a ? {
link: O().string.isRequired,
type: O().oneOf(["push", "present"]).isRequired
} : O().string.isRequired
};
return a ? adapter("replaceSelfWithLink", {
link: r,
type: i
}, u) : adapter("replaceSelfWithLink", r, u)
}
function replaceSelfWithLinkV2Android(e) {
return adapter("replaceSelfWithLinkV2", {
link: e
})
}
function replaceRouteWith(e) {
return s.YF.isIOS && (0,
s.S8)("6.54") ? replaceSelfWithLink({
link: e
}) : s.YF.isAndroid && (0,
s.S8)("6.56") ? replaceSelfWithLinkV2Android(e) : s.YF.isIOS && !isSupportAdapter("removeVCFromStack") ? replaceSelfWithLink({
link: e
}) : new Promise(function(r, i) {
window.open(e),
setTimeout(function() {
s.YF.isIOS ? removeVCFromStackIOS().then(r).catch(i) : (window.close(),
r(void 0))
}, 300)
}
)
}
function openGiftPanel() {
return _openGiftPanel.apply(this, arguments)
}
function _openGiftPanel() {
return (_openGiftPanel = (0,
A._)(function() {
return (0,
R.Jh)(this, function(e) {
return [2, adapter("openGiftPanel")]
})
})).apply(this, arguments)
}
function setPasteBoard(e) {
var r = {
argsT: O().string.isRequired,
resT: O().shape({
result: L
})
};
return checkArgs(e, r.argsT, "setPasteBoard"),
adapter("setPasteBoard", {
string: e
}, {
resT: r.resT
})
}
function showTrack(e) {
return adapter("showTrack", e, {
argsT: O().shape({
title: O().string,
content: O().string,
isNewTrack: O().bool
})
})
}
function showApmTrack(e) {
return adapter("showApmTrack", e, {
argsT: O().shape({
content: O().string
})
})
}
function webtrack(e) {
return adapter("webtrack", e, {
argsT: O().object
})
}
function emitTrack(e) {
return adapter("emitTrack", e, {
argsT: O().string.isRequired
})
}
function emitApmTrack(e) {
return adapter("emitApmTrack", e, {
argsT: O().string.isRequired
})
}
function openMapWithLocation(e) {
return adapter("openMapWithLocation", e, {
argsT: O().shape({
lat: O().number,
long: O().number,
direction: O().bool,
name: O().string,
coordinate: O().shape({
wgs84: O().shape({
long: O().number,
lat: O().number
}),
gcj02: O().shape({
long: O().number,
lat: O().number
}),
bd09: O().shape({
long: O().number,
lat: O().number
})
})
}),
resT: O().shape({
result: L,
type: O().oneOf(["apple", "baidu", "amap", "google"]).isRequired
})
})
}
function confirmAntiSpam() {
return adapter("confirmAntiSpam")
}
function addComment(e) {
return adapter("addComment", e, {
argsT: O().shape({
placeholder: O().string,
uid: O().string
}),
resT: O().shape({
uid: O().string,
is_send: O().bool,
data: O().shape({
content: O().string,
at_users: O().arrayOf(O().shape({
userid: O().string,
nickname: O().string
}))
})
})
})
}
function openXhsSystemSettings() {
return _openXhsSystemSettings.apply(this, arguments)
}
function _openXhsSystemSettings() {
return (_openXhsSystemSettings = (0,
A._)(function() {
return (0,
R.Jh)(this, function(e) {
return [2, adapter("openXhsSystemSettings")]
})
})).apply(this, arguments)
}
function openRechargeCoinPanel() {
return adapter("openRechargeCoinPanel")
}
function openFansPanel() {
return adapter("openFansPanel")
}
function checkLoginWithAction(e) {
return adapter("checkLoginWithAction", e, {
argsT: O().shape({
type: O().number.isRequired
}),
resT: O().shape({
result: L
})
})
}
function logout() {
return adapter("logout")
}
function isAppInstalled(e) {
return adapter("isAppInstalled", e, {
argsT: O().shape({
iOS: O().string,
Android: O().string
}),
resT: O().shape({
result: L,
value: O().bool.isRequired
})
})
}
function getAppInfo() {
return adapter("getAppInfo", {
resT: O().shape({
result: L,
version: O().string.isRequired,
build: O().string.isRequired,
jsversion: O().string.isRequired,
package: O().oneOf(["com.xingin.discover", "com.xingin.xhs"]).isRequired
})
})
}
function getDeviceInfoOld() {
function imeiType() {
return (0,
s.mV)("5.24") ? {} : s.YF.isIOS ? {
idfa: O().string.isRequired,
idfv: O().string.isRequired
} : {
imei: O().string.isRequired
}
}
var e = {
resT: O().shape((0,
y._)({
result: L,
appMarket: O().string.isRequired,
appVersion: O().string.isRequired,
buildNumber: O().string.isRequired,
systemVersion: O().string.isRequired,
deviceModel: O().string.isRequired,
manufacturer: O().string.isRequired,
timezone: O().string.isRequired,
deviceScreenWidth: O().number.isRequired,
deviceScreenHeight: O().number.isRequired,
carrier: O().string.isRequired,
uniqueId: O().string.isRequired
}, s.YF.isIOS ? {
applepayInfo: O().bool.isRequired
} : {}, imeiType))
};
return adapter("getDeviceInfo").then(function(r) {
var i = (0,
N.Lg)(r);
return r.applepay_info && (i.applepay_info = r.applepay_info,
logDeprecated_warnDeprecated("res.applepay_info", "res.applepayInfo")),
checkRes(i, e.resT),
i
})
}
function getNetworkTypeLegacy() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
extractValue: !1
}
, r = {
resT: O().shape({
result: L,
value: O().oneOf(["WiFi", "4G", "3G+", "3G", "2G", "NONE"])
})
};
return adapter("getNetworkType").then(function(i) {
var a = (0,
y._)({}, i);
if (("wifi" === i.value || "WIFI" === i.value) && (a.value = "WiFi"),
checkRes(a, r.resT),
e.extractValue) {
if (0 === a.result)
return a.value;
throw new M.Z("ERR_RESULT_".concat(a.result),"res.result is not 0")
}
return a
})
}
function getUserInfo() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
extractValue: !0
}
, r = Date.now();
console.warn("[OzoneBridge] getUserInfo was deprecated, use `getUserInfoV2` and `getABFlag` to replace, more info see readme");
var i = s.YF.isAndroid && (0,
s.S8)("6.5") || s.YF.isIOS && (0,
s.S8)("6.9")
, a = {
resT: O().shape({
result: L,
response: O().shape((0,
y._)({
userId: O().string.isRequired,
nickname: O().string.isRequired,
gender: O().number.isRequired,
userToken: O().string.isRequired,
image: urlType.isRequired,
location: O().string.isRequired,
flags: O().shape({
fulishe: O().oneOfType([O().object]).isRequired,
shequ: O().oneOfType([O().object]).isRequired
})
}, (0,
s.S8)("5.24") ? {
lat: O().number.isRequired,
lon: O().number.isRequired,
sessionId: O().string.isRequired
} : {}, i ? {
hashExp: O().string.isRequired
} : {}))
})
};
return adapter("getUserInfo").then(function(i) {
var s = (0,
N.Lg)(i);
if (i.response && (i.response.flags && (i.response.flags.fulishe && (s.response.flags.fulishe = i.response.flags.fulishe),
i.response.flags.shequ && (s.response.flags.shequ = i.response.flags.shequ)),
i.response.user_id && (s.response.user_id = i.response.user_id,
logDeprecated_warnDeprecated("res.response.user_id", "res.response.userId")),
i.response.user_token && (s.response.user_token = i.response.user_token,
logDeprecated_warnDeprecated("res.response.user_token", "res.response.userToken")),
i.response.session_id && (s.response.session_id = i.response.session_id,
logDeprecated_warnDeprecated("res.response.session_id", "res.response.sessionId")),
i.response.images && !i.response.image && (s.response.image = i.response.images,
logDeprecated_warnDeprecated("res.response.images", "res.response.image"))),
webp2png(s),
checkRes(s, a.resT),
e.extractValue) {
if (0 === s.result)
return (0,
k.b)({
platformType: "H5",
bridgeName: "getUserInfoOld",
timing: Date.now() - r,
logType: l.tM.Timing
}),
s.response;
throw new M.Z("ERR_RESULT_".concat(s.result),"res.result is not 0")
}
return (0,
k.b)({
platformType: "H5",
bridgeName: "getUserInfoOld",
timing: Date.now() - r,
logType: l.tM.Timing
}),
s
})
}
function getTrackEnv() {
var e = {
resT: O().shape({
isTestEnv: O().bool,
uploadOneByOne: O().bool,
sessionId: O().string
})
};
return adapter("getTrackEnv").then(function(r) {
var i = (0,
N.Lg)(r);
return r.session_id && (i.sessionId = r.session_id),
checkRes(i, e.resT),
i
})
}
function lowPowerModeEnabled() {
return adapter("lowPowerModeEnabled", {
resT: O().shape({
result: L,
value: O().bool.isRequired
})
})
}
function requestNotificationPermission(e) {
return adapter("requestNotificationPermission", e, {
argsT: O().shape({
engaingType: O().number.isRequired,
engaingMessage: O().string
})
})
}
function saveImage(e) {
return adapter("saveImage", e, {
argsT: O().shape({
url: urlType,
base64string: O().string,
type: O().string.isRequired
}),
resT: O().shape({
result: L
})
})
}
function basicSendClientRequest(e) {
return adapter("sendClientRequest", e)
}
function sendClientRequest(e) {
console.warn("[OzoneBridge] sendClientRequest was deprecated, please use [Launcher http](https://code.devops.xiaohongshu.com/formula/launcher/tree/master/src/http)");
var r = {
argsT: O().shape({
url: O().string,
type: O().oneOf(["GET", "POST", "PUT", "DELETE"]).isRequired,
data: O().oneOfType([O().object]),
transform: O().oneOfType([O().bool, O().shape({
separateNumber: O().bool
}), O().func])
}),
resT: O().shape({
result: L,
response: O().oneOfType([O().object]),
status: O().number
})
};
checkArgs(e, r.argsT, "sendClientRequest");
var i = (0,
y._)({}, e)
, a = i.transform;
return a && "object" === (0,
x._)(i.data) && (i.data = (0,
N.cJ)(i.data, a),
delete i.transform),
basicSendClientRequest(i).then(function(e) {
return (checkRes(e, r.resT),
a) ? (0,
N.Lg)(e, a) : e
}).then(function(e) {
if (-1 === e.result) {
var r = Error();
throw r.status = e.status,
r
}
var i = e.response;
if (void 0 === i.success && 0 !== i.result || !1 === i.success) {
var a = Error();
throw a.status = i.result,
a
}
return i.data || i
})
}
function sendClientRequestV2(e) {
var r = (0,
w._)((0,
y._)({}, e), {
url: completeUrl(e.url)
});
return isSupportAdapter("sendClientRequestV2") && s.YF.isAndroid ? adapter("sendClientRequestV2", r) : basicSendClientRequest(r).then(function(e) {
var r = e.result
, i = e.status
, a = e.response;
if (s.YF.isAndroid) {
if (-1 === r)
return -1 !== i ? {
result: 0,
response: {
status: i
}
} : {
result: r
};
return {
result: r,
response: {
status: 200,
body: a
}
}
}
if (-1 === r)
return a ? {
result: 0,
response: {
status: 200,
body: a
}
} : {
result: r
};
return {
result: r,
response: {
status: 200,
body: a
}
}
})
}
function getPrevData() {
return adapter("getPrevData", {
resT: O().oneOfType([O().array, O().bool, O().number, O().object, O().string])
})
}
function getItemOld(e) {
var r = {
argsT: O().string.isRequired,
resT: O().shape({
result: L,
value: O().string
})
};
return checkArgs(e, r.argsT, "getItem"),
adapter("getItem", {
key: e
}, {
resT: r.resT
})
}
function getItem(e) {
return _getItem.apply(this, arguments)
}
function _getItem() {
return (_getItem = (0,
A._)(function(e) {
return (0,
R.Jh)(this, function(r) {
return [2, getItemOld(e)]
})
})).apply(this, arguments)
}
function setItemOld(e, r) {
return adapter("setItem", {
key: e,
value: r
}, {
argsT: O().shape({
key: O().string.isRequired,
value: O().string.isRequired
}),
resT: O().shape({
result: L
})
})
}
function setItem(e, r) {
return _setItem.apply(this, arguments)
}
function _setItem() {
return (_setItem = (0,
A._)(function(e, r) {
return (0,
R.Jh)(this, function(i) {
return [2, setItemOld(e, r)]
})
})).apply(this, arguments)
}
function removeItemOld(e) {
var r = {
argsT: O().string.isRequired,
resT: O().shape({
result: L
})
};
return checkArgs(e, r.argsT, "removeItem"),
adapter("removeItem", {
key: e
}, {
resT: r.resT
})
}
function removeItem(e) {
return _removeItem.apply(this, arguments)
}
function _removeItem() {
return (_removeItem = (0,
A._)(function(e) {
return (0,
R.Jh)(this, function(r) {
return [2, removeItemOld(e)]
})
})).apply(this, arguments)
}
function broadcast(e) {
return adapter("broadcast", e)
}
function broadcastNative(e) {
return adapter("broadcastNative", e, {
argsT: O().shape({
key: O().string.isRequired,
data: O().string.isRequired
})
})
}
function getMessageStatusIOS() {
return adapter("getMessageStatus", {
resT: O().shape({
result: L,
status: O().oneOf([0, 1]).isRequired
})
})
}
function getThirdAuth(e) {
return adapter("getThirdAuth", e, {
argsT: O().oneOf(["weixin"]).isRequired,
resT: O().shape({
result: L,
value: O().oneOfType([O().object])
})
})
}
function getCurrentGeolocation() {
return adapter("getCurrentGeolocation")
}
function checkAppPermission(e) {
var r = {
argsT: O().string.isRequired,
resT: O().shape({
result: O().oneOf([0, -1]).isRequired,
state: O().oneOf(["denied", "granted", "undeterminated"])
})
}
, i = e.type;
return adapter("checkAppPermission", void 0 === i ? "" : i, r)
}
function areNotificationsEnabledAndroid() {
return adapter("areNotificationsEnabled", {
resT: O().shape({
result: O().oneOf([0, -1]).isRequired,
state: O().oneOf(["denied", "granted"])
})
})
}
function getFileUrlFromLocalServerIOS(e) {
return _getFileUrlFromLocalServerIOS.apply(this, arguments)
}
function _getFileUrlFromLocalServerIOS() {
return (_getFileUrlFromLocalServerIOS = (0,
A._)(function(e) {
var r;
return (0,
R.Jh)(this, function(i) {
switch (i.label) {
case 0:
return [4, adapter("getFileUrlFromLocalServer", e, {
argsT: O().shape({
url: urlType.isRequired
}),
resT: O().shape({
result: O().oneOf([0, -1]).isRequired,
value: urlType,
message: O().string
})
})];
case 1:
if (0 === (r = i.sent()).result)
return [2, r.value];
throw new M.Z("ERR_RESULT_".concat(r.result),r.message)
}
})
})).apply(this, arguments)
}
function toggleLocalDns(e) {
return _toggleLocalDns.apply(this, arguments)
}
function _toggleLocalDns() {
return (_toggleLocalDns = (0,
A._)(function(e) {
var r;
return (0,
R.Jh)(this, function(i) {
switch (i.label) {
case 0:
return [4, adapter("toggleLocalDns", {
enable: e
})];
case 1:
if (0 === (r = i.sent()).result)
return [2];
throw new M.Z("ERR_RESULT_".concat(r.result),r.message)
}
})
})).apply(this, arguments)
}
function registerTrickleConnectTopic(e) {
return _registerTrickleConnectTopic.apply(this, arguments)
}
function _registerTrickleConnectTopic() {
return (_registerTrickleConnectTopic = (0,
A._)(function(e) {
return (0,
R.Jh)(this, function(r) {
return [2, adapter("registerTrickleConnectTopic", e)]
})
})).apply(this, arguments)
}
function getABFlag(e) {
return getUserInfo({
extractValue: !0
}).then(function(r) {
var i = e.key
, a = (r || {}).flags || {}
, u = a.fulishe
, c = a.shequ
, l = a.ios
, d = a.android
, p = s.YF.isIOS ? l : d
, f = null;
return (null == c ? void 0 : c[i]) ? f = c[i] : (null == u ? void 0 : u[i]) ? f = u[i] : (null == p ? void 0 : p[i]) && (f = p[i]),
{
result: 0,
message: "success",
value: f
}
})
}
i(15066);
var F = {
toast: showToast,
showToast: showToast,
showalertV2: showAlert,
showAlert: showAlert,
removeVCFromStack: removeVCFromStackIOS,
removeVCFromStackIOS: removeVCFromStackIOS,
showNavigationRightBarButtonItemV2: showNavigationRightBarButtonItem,
showNavigationRightBarButtonItem: showNavigationRightBarButtonItem,
shareContentV2: shareContent,
shareContent: shareContent,
supportApplePay: supportApplePayIOS,
supportApplePayIOS: supportApplePayIOS,
applePayClient: applePayClientIOS,
applePayClientIOS: applePayClientIOS,
replaceSelfWithLink: replaceSelfWithLink,
replaceSelfWithLinkV2: replaceSelfWithLinkV2Android,
replaceSelfWithLinkV2Android: replaceSelfWithLinkV2Android,
replaceRouteWith: replaceRouteWith,
showActionSheet: showActionSheet,
setNavigationHidden: setNavigationHidden,
setStatusBarHiddenIOS: setStatusBarHiddenIOS,
setStatusBarStyleIOS: setStatusBarTextColor,
setStatusBarTextColor: setStatusBarTextColor,
alwaysBounceIOS: alwaysBounceIOS,
setShareInfo: ui_setShareInfo,
showShareMenu: showShareMenu,
pay: pay,
alipayClient: alipayClient,
openURLByWechat: openURLByWechat,
wechatPayClient: wechatPayClient,
openLink: openLinkAndroid,
closeWindow: closeWindow,
openGiftPanel: openGiftPanel,
setPasteBoard: setPasteBoard,
showTrack: showTrack,
showApmTrack: showApmTrack,
webtrack: webtrack,
emitTrack: emitTrack,
emitApmTrack: emitApmTrack,
openMapWithLocation: openMapWithLocation,
confirmAntiSpam: confirmAntiSpam,
addComment: addComment,
openXhsSystemSettings: openXhsSystemSettings,
openRechargeCoinPanel: openRechargeCoinPanel,
openFansPanel: openFansPanel,
getMessageStatusIOS: getMessageStatusIOS,
getMessageStatus: getMessageStatusIOS,
areNotificationsEnabledAndroid: areNotificationsEnabledAndroid,
areNotificationsEnabled: areNotificationsEnabledAndroid,
getFileUrlFromLocalServerIOS: getFileUrlFromLocalServerIOS,
getFileUrlFromLocalServer: getFileUrlFromLocalServerIOS,
checkLoginWithAction: checkLoginWithAction,
logout: logout,
isAppInstalled: isAppInstalled,
getAppInfo: getAppInfo,
getDeviceInfo: getDeviceInfoOld,
getNetworkType: getNetworkTypeLegacy,
getUserInfo: getUserInfo,
getTrackEnv: getTrackEnv,
lowPowerModeEnabled: lowPowerModeEnabled,
requestNotificationPermission: requestNotificationPermission,
saveImage: saveImage,
basicSendClientRequest: basicSendClientRequest,
sendClientRequest: sendClientRequest,
sendClientRequestV2: sendClientRequestV2,
getPrevData: getPrevData,
getItem: getItem,
setItem: setItem,
removeItem: removeItem,
broadcast: broadcast,
broadcastNative: broadcastNative,
getThirdAuth: getThirdAuth,
getCurrentGeolocation: getCurrentGeolocation,
checkAppPermission: checkAppPermission,
toggleLocalDns: toggleLocalDns,
registerTrickleConnectTopic: registerTrickleConnectTopic,
getABFlag: getABFlag
}
, V = {
xhs: {},
top: {}
}
, H = {
xhs: {},
top: {}
};
function transformBridgeResultForTest(e) {
try {
(null == e ? void 0 : e.value) !== void 0 && (null == e ? void 0 : e.value) === null && delete e.value
} catch (e) {}
return e
}
function genBridgeQueue(e, r, i, a) {
var s, u, c, d, p, f, v = a.type, h = a.app, m = a.enableValidate, _ = "h5" === v ? H : V, y = (null == _ ? void 0 : null === (c = _.xhs) || void 0 === c ? void 0 : null === (u = c[e]) || void 0 === u ? void 0 : null === (s = u.request) || void 0 === s ? void 0 : s.queue) || [], w = (null == _ ? void 0 : null === (f = _.xhs) || void 0 === f ? void 0 : null === (p = f[e]) || void 0 === p ? void 0 : null === (d = p.result) || void 0 === d ? void 0 : d.queue) || [], E = generateKey(), S = Date.now(), T = !0, b = (0,
g._)(y).concat([i, {
fulfilled: function(e) {
return e
},
rejected: function(i) {
return new Promise(function(a, s) {
if ("xhs" === h && -1e4 === i.code) {
T = !1;
var u = F[e];
if (u)
return u(r).then(function(r) {
a({
result: (null == r ? void 0 : r.result) || 0,
message: "".concat(e, " 新通道不支持,降级为老通道发送"),
value: (null == r ? void 0 : r.value) !== void 0 ? r.value : r
})
}).catch(function(e) {
s(e)
})
}
return s(i)
}
)
}
}], (0,
g._)(w));
(void 0 === m || m) && b.push({
fulfilled: function(r) {
return T && (0,
P.o)(e, l.XQ.Method, transformBridgeResultForTest(r), h),
r
},
rejected: function(e) {
throw e
}
}),
(0,
C.eD)() && b.push({
fulfilled: function(r) {
var i = Date.now() - S;
return (0,
C.pd)({
name: e,
callbackId: E,
time: i,
res: r
}),
r
},
rejected: function(r) {
var i = Date.now() - S;
try {
var a = JSON.parse(r.message).errorMessage;
(0,
C.Us)({
name: e,
callbackId: E,
time: i,
err: JSON.stringify(a, null, 2)
})
} catch (a) {
(0,
C.UZ)({
name: e,
callbackId: E,
time: i,
err: r
})
}
throw r
}
});
var k = {
method: e,
args: r
}
, A = Promise.resolve(r)
, wrapFulfilled = function(e) {
return function(r) {
return e ? e(r, k) : r
}
}
, wrapRejected = function(e) {
return function(r) {
if (e)
return e(r, null, k);
throw r
}
};
for ((0,
C.mJ)({
name: e,
callbackId: E
}); b.length; ) {
var R = b.shift();
A = A.then(wrapFulfilled(null == R ? void 0 : R.fulfilled), wrapRejected(null == R ? void 0 : R.rejected))
}
return A
}
function isSupportInvoke() {
var e, r, i, a = s.YF.isIOS ? null === (r = window) || void 0 === r ? void 0 : null === (e = r.webkit) || void 0 === e ? void 0 : e.messageHandlers : null === (i = window) || void 0 === i ? void 0 : i.XHSBridge;
return a && !!a.invoke
}
function invoke(e, r) {
var i = Date.now();
return new Promise(function(a, u) {
try {
if (!isSupportInvoke())
throw (0,
C.f1)(e),
new _(l.nJ.NotSupport,"not support invoke");
var c = addCallback(e, function(r) {
var s = Date.now() - i;
try {
var c = transformRes(e, r);
(0,
k.b)({
platformType: "H5",
bridgeName: e,
timing: s,
logType: l.tM.Timing
}),
a(c)
} catch (r) {
(0,
k.b)({
platformType: "H5",
bridgeName: e,
logType: l.tM.Error,
errorInfo: (null == r ? void 0 : r.message) || "".concat(e, " call error")
}),
u(r)
}
})
, d = {
method: e,
callback: c,
args: r
};
try {
if (s.YF.isIOS) {
var p = s.YF.isSpark || s.YF.isUniik || s.YF.isSnowPeak || s.YF.isInternation || s.YF.isOdyssey || s.YF.isCatalog ? d : JSON.stringify(d);
window.webkit.messageHandlers.invoke.postMessage(p)
} else
window.XHSBridge.invoke(JSON.stringify(d))
} catch (e) {
throw new _(l.nJ.Native,null == e ? void 0 : e.message)
}
} catch (r) {
r instanceof _ ? u(r) : u(new _(l.nJ.UnKnow,(null == r ? void 0 : r.message) || "[ozone-bridge] [".concat(e, "] call error")))
}
}
)
}
function invokeInterceptor(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "xhs"
, a = !(arguments.length > 3) || void 0 === arguments[3] || arguments[3];
return arguments.length > 4 && arguments[4],
genBridgeQueue(e, r, {
fulfilled: function(r) {
return invoke(e, transformArgs(e, r))
},
rejected: void 0
}, {
type: "h5",
app: i,
enableValidate: a
})
}
function invokeInterceptorWithoutValidate(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "xhs";
return invokeInterceptor(e, r, i, !1)
}
function invokeSync(e, r) {
throw new _(l.nJ.NotSupport,"not support invokeSync")
}
},
3511: function(e, r, i) {
"use strict";
i.d(r, {
Z: function() {
return p
}
});
var a = i(35329)
, s = i(46490)
, u = i(51606)
, c = i(27292)
, l = i(75649)
, d = i(30961);
i(41593);
var p = function(e) {
function BridgeError(e) {
for (var r, i = arguments.length, c = Array(i > 1 ? i - 1 : 0), d = 1; d < i; d++)
c[d - 1] = arguments[d];
return (0,
s._)(this, BridgeError),
r = (0,
a._)(this, BridgeError, (0,
l._)(c)),
(0,
u._)(r, "code", void 0),
r.name = "BridgeError",
r.code = e,
r
}
return (0,
c._)(BridgeError, e),
BridgeError
}((0,
d._)(Error))
},
27256: function(e, r, i) {
"use strict";
i.d(r, {
b: function() {
return addMeasure
}
});
var a = i(70879);
i(42876),
i(33933),
i(86651);
var s = i(50837);
function shouldLog() {
return .01 > Math.random()
}
var u = ["getABFlag", "addApmReferV2"];
function addMeasure(e) {
if (u.includes(e.bridgeName))
return;
var r = window.eaglet;
if (!!r) {
if (e.logType !== s.tM.Timing || shouldLog())
try {
r.push({
measurement_name: "bridgeMonitor",
measurement_data: (0,
a._)({
bridgeName: e.bridgeName,
bridgeLogType: e.logType,
bridgePlatform: e.platformType
}, e.logType === s.tM.Error ? {
bridgeError: e.errorInfo
} : {
bridgeTiming: e.timing
})
}, "ApmXrayTracker").catch(function() {})
} catch (e) {}
}
}
},
70306: function(e, r, i) {
"use strict";
i.d(r, {
UZ: function() {
return bridgeError
},
Us: function() {
return bridgeValidateError
},
Wb: function() {
return eventSuccess
},
eD: function() {
return hasBridgeConsole
},
f1: function() {
return bridgeNotSupport
},
mJ: function() {
return bridgeStart
},
pd: function() {
return bridgeSuccess
}
}),
i(87535),
i(75204),
i(97357),
i(34333),
i(87989);
var a = ["log", "error", "info", "warn", "dir", "time", "timeLog", "timeEnd", "clear", "table", "assert", "count", "countReset", "debug", "group", "groupCollapsed", "groupEnd"]
, noop = function noop() {};
function hasBridgeConsole() {
return !!window.bridgeConsole
}
function bridgeStart(e) {
e.name,
e.callbackId;
var r = e.type
}
function bridgeSuccess(e) {
e.name,
e.callbackId,
e.time,
e.res
}
function eventSuccess(e) {
e.name,
e.res
}
function bridgeValidateError(e) {
e.name,
e.callbackId,
e.time,
e.err
}
function bridgeError(e) {
e.name,
e.callbackId,
e.time,
e.err
}
function bridgeNotSupport(e) {}
(function genBridgeConsole() {
if (hasBridgeConsole())
return window.bridgeConsole.log("Bridge 面板用于输出 ozone-schema 与 ozone-bridge 调用日志, 有建议或功能不足请联系 月初(yuechu@xiaohongshu.com)"),
window.bridgeConsole;
var e = {};
return a.forEach(function(r) {
e[r] = noop
})
}
)()
},
70076: function(e, r, i) {
"use strict";
function validateReq(e, r, i) {
arguments.length > 3 && void 0 !== arguments[3] && arguments[3]
}
function validateRes(e, r, i) {
arguments.length > 3 && void 0 !== arguments[3] && arguments[3]
}
i.d(r, {
T: function() {
return validateReq
},
o: function() {
return validateRes
}
})
},
50837: function(e, r, i) {
"use strict";
i.d(r, {
XQ: function() {
return l
},
nJ: function() {
return c
},
tM: function() {
return d
}
});
var a, s, u, c = ((a = {})[a.NotSupport = 16e3] = "NotSupport",
a[a.Native = 16001] = "Native",
a[a.Validate = 17e3] = "Validate",
a[a.UnKnow = 18e3] = "UnKnow",
a);
var l = ((s = {}).Method = "method",
s.Event = "event",
s);
var d = ((u = {}).Error = "error",
u.Timing = "timing",
u.Fallback = "fallback",
u)
},
97493: function(e, r, i) {
"use strict";
var a = i(41622)
, s = i(35329)
, u = i(46490)
, c = i(90251)
, l = i(27292)
, d = i(36102);
i(59976),
i(74093),
i(20768),
i(41648),
i(59339),
i(47444),
i(34757),
i(85908),
i(39995),
i(22943),
i(54767),
i(55820),
i(93225),
i(33708),
i(64322),
i(47771),
i(27461),
i(23339),
i(51109),
i(34333),
i(97553),
i(75973),
i(86651),
i(87989),
i(36277),
i(34885),
i(29273),
i(42876),
i(33933),
i(23390),
i(64817),
i(29650),
i(69038),
i(6045),
i(10364),
i(67673),
i(87535),
i(75204),
i(97357),
i(87394),
i(94941),
i(48421),
i(1154),
i(80013);
var p = this && this.__createBinding || (Object.create ? function(e, r, i, a) {
void 0 === a && (a = i);
var s = Object.getOwnPropertyDescriptor(r, i);
(!s || ("get"in s ? !r.__esModule : s.writable || s.configurable)) && (s = {
enumerable: !0,
get: function get() {
return r[i]
}
}),
Object.defineProperty(e, a, s)
}
: function(e, r, i, a) {
void 0 === a && (a = i),
e[a] = r[i]
}
)
, f = this && this.__setModuleDefault || (Object.create ? function(e, r) {
Object.defineProperty(e, "default", {
enumerable: !0,
value: r
})
}
: function(e, r) {
e.default = r
}
)
, v = this && this.__importStar || function(e) {
if (e && e.__esModule)
return e;
var r = {};
if (null != e)
for (var i in e)
"default" !== i && Object.prototype.hasOwnProperty.call(e, i) && p(r, e, i);
return f(r, e),
r
}
, g = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
});
var h = g(i(88960))
, m = i(47324)
, _ = i(10727)
, y = i(7361)
, w = i(15900)
, E = g(i(36229))
, S = i(90316)
, T = i(74794)
, b = i(1266)
, k = i(23533)
, C = i(79066)
, P = i(87853)
, A = i(61700)
, R = i(7449)
, I = i(87014)
, O = i(21329)
, N = i(41172)
, L = (0,
h.default)("longlink:sdk")
, M = function(e) {
function LonglinkSdk(e) {
u._(this, LonglinkSdk),
(r = s._(this, LonglinkSdk))._authCtx = void 0,
r._bindCtx = void 0,
r._pushTopic = new Map,
r.initPromise = null,
r.cachedDevice = null,
r._urls = [],
r.__events__ = [],
r.isFetchingConfig = !1,
r.getEventIndex = function(e) {
return r.__events__.findIndex(function(r) {
return r.bizName === e.bizName && r.id === e.id
})
}
,
r.config = (0,
T.merge)(y.defaultConfig, e),
r.msgManager = k.MsgManager.create(r),
r._urls = [];
var r, a = i(51409);
return r.sdkVersion = a.version,
r.initPromise = r.init(),
r
}
return l._(LonglinkSdk, e),
c._(LonglinkSdk, [{
key: "env",
get: function get() {
return this.config.env
}
}, {
key: "maxComboNum",
get: function get() {
return this.config.maxComboNum || 6
}
}, {
key: "trackerLog",
get: function get() {
return this.config.trackerLog || !1
}
}, {
key: "authCtx",
get: function get() {
return this._authCtx
},
set: function set(e) {
this._authCtx = e
}
}, {
key: "bindCtx",
get: function get() {
return this._bindCtx
},
set: function set(e) {
this._bindCtx = e
}
}, {
key: "topics",
get: function get() {
return Object.keys(this._pushTopic)
}
}, {
key: "readyState",
get: function get() {
return this.transport && this.transport.readyState || _.ELongLinkState.INITIAL
}
}, {
key: "deviceInfo",
get: function get() {
return this.cachedDevice
},
set: function set(e) {
this.cachedDevice = e
}
}, {
key: "longlinkConfig",
get: function get() {
return this.config
}
}, {
key: "cacheUrls",
value: function cacheUrls() {
var e = this;
return a._(function() {
var r;
return d._(this, function(r) {
switch (r.label) {
case 0:
return r.trys.push([0, 2, , 3]),
[4, (0,
R.fetchLonglinkConfig)(e.config)];
case 1:
return [2, r.sent()];
case 2:
return r.sent(),
[2, {
longlinkHost: [],
logLevel: 1
}];
case 3:
return [2]
}
})
})()
}
}, {
key: "init",
value: function init() {
var e = this;
return a._(function() {
var r, i, s, u, c, l, p, f, v, g;
return d._(this, function(v) {
switch (v.label) {
case 0:
if (v.trys.push([0, 8, , 9]),
e.config.device)
return [3, 2];
return s = e.config,
[4, (0,
P.getDefaultDeviceInfo)(e)];
case 1:
s.device = v.sent(),
v.label = 2;
case 2:
if (e.tracker = new A.NewApm(e),
e.isCustomSetRoute = !!e.config.url,
!(!e.isCustomSetRoute && e.config.protocol === b.EProtocols.Websocket))
return [3, 4];
return [4, e.cacheUrls()];
case 3:
(null == (c = v.sent()) ? void 0 : null === (u = c.longlinkHost) || void 0 === u ? void 0 : u.length) && (e._urls = (null == c ? void 0 : c.longlinkHost) || [],
e.config.url = e._urls[0]),
v.label = 4;
case 4:
return [4, S.Store.create(e, {
fallbackRoute: e.config.url,
env: e.config.env,
customStorage: null !== (l = null === (r = e.config) || void 0 === r ? void 0 : r.customStorage) && void 0 !== l ? l : null
})];
case 5:
if (e.store = v.sent(),
e.isCustomSetRoute)
return [3, 7];
return p = e.config,
[4, e.store.get()];
case 6:
p.url = v.sent().route,
e.on(_.EVENTS.CONNECTING, a._(function() {
var r;
return d._(this, function(i) {
switch (i.label) {
case 0:
return r = e.config,
[4, e.store.get(!0)];
case 1:
return r.url = i.sent().route,
[2]
}
})
})),
f = e,
e.store.on(S.EStoreEvent.ROUTE_EXPIRE, a._(function() {
var r, i, a, s, u, c;
return d._(this, function(c) {
switch (c.label) {
case 0:
if (e.isFetchingConfig)
return [2];
c.label = 1;
case 1:
return c.trys.push([1, 3, 4, 5]),
e.isFetchingConfig = !0,
[4, (0,
I.pullLonglinkRoute)(f.config, null !== (i = null == f ? void 0 : null === (r = f.authCtx) || void 0 === r ? void 0 : r.uid) && void 0 !== i ? i : "".concat(Math.floor(10 * Math.random())))];
case 2:
return s = (a = c.sent()).longlinkHost,
u = a.expires,
e.store.set({
routeExipire: u,
route: s[0]
}),
[3, 5];
case 3:
return c.sent(),
[3, 5];
case 4:
return e.isFetchingConfig = !1,
[7];
case 5:
return [2]
}
})
})),
v.label = 7;
case 7:
return [2, {
longlinkHost: (null === (i = e.config) || void 0 === i ? void 0 : i.url) || "bridge"
}];
case 8:
return v.sent(),
[2, {
longlinkHost: (null === (g = e.config) || void 0 === g ? void 0 : g.url) || "bridge"
}];
case 9:
return [2]
}
})
})()
}
}, {
key: "presetAuthCtx",
value: function presetAuthCtx(e) {
this.authCtx = e
}
}, {
key: "checkState",
value: function checkState() {
return this.config.protocol === b.EProtocols.Bridge ? this.transport.checkState() : this.readyState
}
}, {
key: "checkHealthy",
value: function checkHealthy() {
var e = this
, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
reason: "checkHealthy",
respondTime: 3e3
};
return new Promise(function(i, a) {
e.transport.sendPingPacket({
resolve: i,
reject: a,
opts: r,
clearCb: function(r, i) {
if (i) {
var a;
null == e || null === (a = e.transport) || void 0 === a || a.cleanPingTimer()
}
}
})
}
)
}
}, {
key: "emptyAuthCtx",
value: function emptyAuthCtx() {
this.authCtx = void 0
}
}, {
key: "emptyBindCtx",
value: function emptyBindCtx() {
this.bindCtx = void 0
}
}, {
key: "nextIp",
value: function nextIp(e) {
var r = this;
return a._(function() {
var i;
return d._(this, function(a) {
switch (a.label) {
case 0:
if (!((i = r._urls.indexOf(e)) > -1))
return [3, 2];
return [4, r.cacheUrls()];
case 1:
if (a.sent().longlinkHost.length && (r._urls.splice(i, 1),
r._urls.length > 0))
return [2, r._urls[0]];
a.label = 2;
case 2:
return [2, r._urls[0]]
}
})
})()
}
}, {
key: "trackerCtx",
value: function trackerCtx() {
var e, r = this.config, i = this.config.device, a = {
trackerEnable: r.trackerEnable
};
return (0,
T.merge)(a, {
context_artifactName: "redlonglink",
context_artifactVersion: this.sdkVersion,
context_package: r.app,
context_appVersion: r.version,
context_nameTracker: "wapT",
context_platform: i.platform,
context_osVersion: i.osVersion,
context_deviceModel: i.deviceName,
context_deviceId: i.deviceId,
context_networkType: r.protocol,
context_matchedPath: r.domain,
context_route: r.url,
context_userAgent: i.userAgent,
measurement_name: "imlonglink",
context_networkQuality: -1,
context_userId: (null === this || void 0 === this ? void 0 : null === (e = this.authCtx) || void 0 === e ? void 0 : e.uid) || this.config.uid || "-"
})
}
}, {
key: "connect",
value: function connect() {
var e = this;
return a._(function() {
var r, a;
return d._(this, function(s) {
switch (s.label) {
case 0:
return [4, e.initPromise || e.init()];
case 1:
if (s.sent(),
(a = e.config.protocol) !== b.EProtocols.Websocket)
return [3, 2];
return r = new E.default(e),
[3, 4];
case 2:
if (a !== b.EProtocols.Bridge)
return [3, 4];
return [4, Promise.resolve().then(function() {
return v(i(88049))
})];
case 3:
r = s.sent().default.create(e),
s.label = 4;
case 4:
return e.mountTransportEvents(r),
e.on(_.EVENTS.AUTH, e.reRegisterEventsForServer.bind(e)),
[2, r.retryConnect(_.EConnectType.CONNECT)]
}
})
})()
}
}, {
key: "close",
value: function close() {
var e = this
, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : N.CLOSE_TYPE.User.reason;
this.transport && this.transport.close((0,
N.createClose)({
code: N.CLOSE_TYPE.User.code,
reason: r
})).then(function() {
e.store.removeAllListeners(),
e.transport.removeAllListeners(),
e.removeAllListeners()
})
}
}, {
key: "mockAbnormalClose",
value: function mockAbnormalClose() {
this.transport && this.transport.mockAbnormalClose()
}
}, {
key: "reconnect",
value: function reconnect() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "biz reconnect"
, r = this;
return a._(function() {
return d._(this, function(i) {
return [2, r.transport.reconnectByBiz(e)]
})
})()
}
}, {
key: "_canAuth",
value: function _canAuth() {
var e = [_.ELongLinkState.CONNECT];
if (!e.includes(this.readyState))
throw C.LonglinkError.create(C.ERR_TYPE.TransportErrorStatus, "current state: ".concat(this.readyState, ", only can auth in state: ").concat(e.join("|"), " "))
}
}, {
key: "_canSendPacket",
value: function _canSendPacket() {
var e = [_.ELongLinkState.CONNECT, _.ELongLinkState.AUTHING, _.ELongLinkState.AUTH];
if (!e.includes(this.readyState))
throw C.LonglinkError.create(C.ERR_TYPE.TransportErrorStatus, "current state: ".concat(this.readyState, ", SendPacket only can send message in state: ").concat(e.join("|"), " "))
}
}, {
key: "_canSendMessage",
value: function _canSendMessage() {
var e = [_.ELongLinkState.AUTH, _.ELongLinkState.BIND];
if (!e.includes(this.readyState))
throw C.LonglinkError.create(C.ERR_TYPE.TransportErrorStatus, "only can send in states: ".concat(e.join("|"), ", current state: ").concat(this.readyState))
}
}, {
key: "login",
value: function login(e) {
var r = this;
return a._(function() {
var i, a, s;
return d._(this, function(u) {
switch (u.label) {
case 0:
return r.presetAuthCtx(e),
L("[LOG]preset login authCx", e),
[4, r.connect()];
case 1:
if (a = (i = u.sent()).code,
s = i.msg,
a === _.EStatusCodes.SUCCESS)
return [2, r.auth(e)];
return [2, (0,
O.createFailed)(a, s)]
}
})
})()
}
}, {
key: "auth",
value: function auth(e) {
var r = this;
return a._(function() {
var i, a, s, u, c;
return d._(this, function(l) {
return (r._canAuth(),
r.config.protocol === b.EProtocols.Bridge) ? [2, r.transport.retryBind(e)] : (a = (i = r.config || {}).device,
s = i.domain,
u = i.uid,
c = (0,
T.merge)({
uid: u,
device: a,
domain: s,
extra: {
appName: r.config.app,
appVersion: r.config.version,
"User-Agent": (0,
P.getUA)()
}
}, e || {}),
[2, r.transport.retryAuth(c, !1)])
})
})()
}
}, {
key: "subPushTopic",
value: function subPushTopic(e, r) {
Reflect.set(this._pushTopic, e, r)
}
}, {
key: "removePushTopic",
value: function removePushTopic(e) {
Reflect.deleteProperty(this._pushTopic, e)
}
}, {
key: "getTopicCallback",
value: function getTopicCallback(e) {
return Reflect.get(this._pushTopic, e)
}
}, {
key: "sendPacket",
value: function sendPacket(e, r) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
this._canSendPacket();
var a = this.transport.createPayload(e, r, i)
, s = a.packet
, u = a.payload;
this.transport.send(u, s)
}
}, {
key: "sendRaw",
value: function sendRaw(e) {
this._canSendPacket(),
this.transport.write(e)
}
}, {
key: "sendMessage",
value: function sendMessage(e, r, i) {
var s = this;
return a._(function() {
return d._(this, function(a) {
return s._canSendMessage(),
[2, s.msgManager.sendMessage(e, r, i)]
})
})()
}
}, {
key: "mountTransportEvents",
value: function mountTransportEvents(e) {
var r = this
, i = Object.keys(_.EVENTS).map(function(e) {
return _.EVENTS[e]
});
this.transport && this.transport.removeAllListeners(),
this.transport = e,
i.forEach(function(i) {
(i === _.EVENTS.MESSAGE_ACK || i === _.EVENTS.REGISTER_EVENT_ACK) && e.on(i, r.msgManager.onMessageAck.bind(r.msgManager)),
e.on(i, r.emit.bind(r, i))
})
}
}, {
key: "registerEventsForServer",
value: function registerEventsForServer(e, r) {
var i = this;
return a._(function() {
var a, s, u, c, l, p;
return d._(this, function(d) {
switch (d.label) {
case 0:
if (!e || Array.isArray(e) && 0 === e.length)
return [2];
if (s = null !== (a = null == r ? void 0 : r.reconnectTag) && void 0 !== a && a,
u = Array.isArray(e) ? e : [e],
!s && (u = u.filter(function(e) {
return !(i.getEventIndex(e) > -1)
})),
!u.length)
return [2];
d.label = 1;
case 1:
return d.trys.push([1, 3, , 4]),
c = u.map(function(e) {
return {
eventId: e.id,
bizName: e.bizName
}
}),
[4, i.sendMessage({
registerInfos: c,
type: b.RegisterType.Register
}, {
messageType: w.EPacketType.REGISTE_EVENT,
headerFilter: ["action", "bizId", "serviceId", "oneWay"]
}, null !== (l = null == r ? void 0 : r.retryOptions) && void 0 !== l ? l : {})];
case 2:
if (d.sent(),
s)
return [2];
return u.forEach(function(e) {
0 > i.getEventIndex(e) && i.__events__.push(e)
}),
u.forEach(function(e) {
if (null == e ? void 0 : e.cb) {
var r = "".concat(e.bizName, "_").concat(e.id);
i.subPushTopic(r, e.cb)
}
}),
[3, 4];
case 3:
throw d.sent(),
C.LonglinkError.create(C.ERR_TYPE.TransportErrorStatus, "register event(s) failed ");
case 4:
return [2]
}
})
})()
}
}, {
key: "unregisterEventsForServer",
value: function unregisterEventsForServer(e, r) {
var i = this;
return a._(function() {
var a, s, u, c;
return d._(this, function(c) {
switch (c.label) {
case 0:
if (!e || Array.isArray(e) && 0 === e.length || !(a = (a = Array.isArray(e) ? e : [e]).filter(function(e) {
return i.getEventIndex(e) > -1
})).length)
return [2];
c.label = 1;
case 1:
return c.trys.push([1, 3, , 4]),
s = a.map(function(e) {
return {
eventId: e.id,
bizName: e.bizName
}
}),
[4, i.sendMessage({
registerInfos: s,
type: b.RegisterType.UnRegister
}, {
messageType: w.EPacketType.REGISTE_EVENT,
headerFilter: ["action", "bizId", "serviceId", "oneWay"]
}, null !== (u = null == r ? void 0 : r.retryOptions) && void 0 !== u ? u : {})];
case 2:
return c.sent(),
i.__events__ = i.__events__.filter(function(e) {
return !a.some(function(r) {
return r.bizName === e.bizName && r.id === e.id
})
}),
a.forEach(function(e) {
var r = "".concat(e.bizName, "_").concat(e.id);
i.removePushTopic(r)
}),
[3, 4];
case 3:
throw c.sent(),
C.LonglinkError.create(C.ERR_TYPE.TransportErrorStatus, "unregister event(s) failed ");
case 4:
return [2]
}
})
})()
}
}, {
key: "reRegisterEventsForServer",
value: function reRegisterEventsForServer() {
this.registerEventsForServer(this.__events__, {
reconnectTag: !0
})
}
}], [{
key: "LonglinkState",
get: function get() {
return _.ELongLinkState
}
}, {
key: "EVENTS",
get: function get() {
return _.EVENTS
}
}, {
key: "create",
value: function create(e) {
return new this(e)
}
}]),
LonglinkSdk
}(m.EventEmitter);
r.default = M
},
7800: function(e, r, i) {
"use strict";
var a, s = i(51606);
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.createPacket = r.packetHeaderMap = void 0;
var u = i(15900)
, c = i(74794)
, l = i(10727);
r.packetHeaderMap = (a = {},
s._(a, u.EPacketType.PING, function(e) {
return {
header: {
seq: e.seq,
type: u.EPacketType.PING,
bizId: e.bizId || -1,
action: l.ELonglinkAction.PING
}
}
}),
s._(a, u.EPacketType.PONG, function(e) {
return {
header: {
seq: e.seq,
type: u.EPacketType.PONG,
bizId: e.bizId || -1,
action: l.ELonglinkAction.PONG
}
}
}),
s._(a, u.EPacketType.AUTH, function(e) {
return {
header: {
sTime: (0,
c.now)(),
seq: e.seq,
type: u.EPacketType.AUTH,
contentType: e.sdkConfig.contentType,
bizId: e.bizId || -1,
action: l.ELonglinkAction.AUTH,
traceId: (0,
c.genTraceId)()
}
}
}),
s._(a, u.EPacketType.BIND, function(e) {
return {
header: {
sTime: (0,
c.now)(),
seq: e.seq,
type: u.EPacketType.BIND,
bizId: e.bizId || -1,
action: l.ELonglinkAction.BIND,
traceId: (0,
c.genTraceId)()
}
}
}),
s._(a, u.EPacketType.VIRTUAL_LINK, function(e) {
return {
header: {
sTime: (0,
c.now)(),
seq: e.seq,
type: u.EPacketType.VIRTUAL_LINK,
bizId: e.bizId || -1,
action: l.ELonglinkAction.VIRTUAL_LINK,
traceId: (0,
c.genTraceId)()
}
}
}),
s._(a, u.EPacketType.MESSAGE, function(e) {
return {
header: {
sTime: (0,
c.now)(),
seq: e.seq,
type: u.EPacketType.MESSAGE,
bizId: e.bizId || -1,
contentType: e.sdkConfig.contentType,
traceId: (0,
c.genTraceId)(),
action: l.ELonglinkAction.MESSAGE
}
}
}),
s._(a, u.EPacketType.MESSAGE_DOWN_ACK, function(e) {
return {
header: {
seq: e.seq,
type: u.EPacketType.MESSAGE_DOWN_ACK,
bizId: e.bizId || -1,
traceId: (0,
c.genTraceId)(),
action: l.ELonglinkAction.MESSAGE_DOWN_ACK
}
}
}),
s._(a, u.EPacketType.REGISTE_EVENT, function(e) {
return {
header: {
sTime: (0,
c.now)(),
seq: e.seq,
type: u.EPacketType.REGISTE_EVENT,
contentType: e.sdkConfig.contentType,
traceId: (0,
c.genTraceId)()
}
}
}),
a);
r.createPacket = function(e, i, a, s) {
var u = r.packetHeaderMap[e](i);
return u.header = (0,
c.merge)(u.header, a),
u.body = s || {},
u
}
},
13398: function(e, r, i) {
"use strict";
var a = i(15313).Buffer
, s = i(31547);
i(7608),
i(41593),
i(87989),
i(19077),
i(75973);
var u = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.decodePacket = r.encodePacket = void 0;
var c = u(i(88960))
, l = i(36189)
, d = (0,
c.default)("longlink parser");
function endcodeAsString(e, r) {
try {
return JSON.stringify(e)
} catch (e) {
throw Error("输入的 packet 格式非法, ".concat(e.message))
}
}
function decodeString(e, r) {
try {
return JSON.parse(e)
} catch (e) {
throw d("decode error", e),
Error("接收 packet 字符串非法, ".concat(e.message))
}
}
function endcodeAsBinary(e) {
return d("encode %O to buffer", e),
a.from([])
}
function decodeBinary(e) {
return d("decodeBinary %O to packet", e),
null
}
function encodePacket(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : l.EPacketFormat.STRING
, i = arguments.length > 2 ? arguments[2] : void 0;
return r === l.EPacketFormat.BINARY ? endcodeAsBinary(e) : endcodeAsString(e, i)
}
function decodePacket(e, r) {
if ((void 0 === e ? "undefined" : s._(e)) === "object")
return e instanceof a ? decodeBinary(e) : e;
return decodeString(e, r)
}
r.encodePacket = encodePacket,
r.decodePacket = decodePacket,
r.default = {
encodePacket: encodePacket,
decodePacket: decodePacket
}
},
95260: function(e, r, i) {
"use strict";
var a = i(41622)
, s = i(35329)
, u = i(46490)
, c = i(90251)
, l = i(27292)
, d = i(70879)
, p = i(27337)
, f = i(75649)
, v = i(36102);
i(74093),
i(20768),
i(41648),
i(59339),
i(47444),
i(34757),
i(85908),
i(39995),
i(22943),
i(54767),
i(55820),
i(93225),
i(33708),
i(64322),
i(47771),
i(27461),
i(23339),
i(51109),
i(34333),
i(42876),
i(33933),
i(86651),
i(87989),
i(36277),
i(43648),
i(6045),
i(10364),
i(67673),
i(21608),
i(7608),
i(41593),
i(19077),
i(75973);
var g = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
});
var h = i(47324)
, m = g(i(88960))
, _ = g(i(13398))
, y = i(15900)
, w = i(36189)
, E = i(1266)
, S = i(74794)
, T = i(10727)
, b = i(79066)
, k = i(70594)
, C = i(41172)
, P = i(7800)
, A = i(61357)
, R = i(21329)
, I = i(39998)
, O = (0,
m.default)("longlink:Transport")
, N = function(e) {
function Transport(e) {
var r;
return u._(this, Transport),
(r = s._(this, Transport)).sdk = e,
r.transportMap = new Map,
r._seq = 0,
r.closeCounter = 0,
r.pingTimeoutCounter = 0,
r.pingIntervalIndex = 0,
r.channelId = "channel-id",
r.useBridge = !1,
r.sdk = e,
r.useBridge = r.sdkConfig.protocol === E.EProtocols.Bridge,
r.initInterval(),
r
}
return l._(Transport, e),
c._(Transport, [{
key: "sdkConfig",
get: function get() {
return this.sdk.config
}
}, {
key: "authCtx",
get: function get() {
return this.sdk.authCtx
}
}, {
key: "bindCtx",
get: function get() {
return this.sdk.bindCtx
}
}, {
key: "connCtx",
get: function get() {
return {
url: this.sdkConfig.url,
env: this.sdkConfig.env
}
}
}, {
key: "bizId",
get: function get() {
return this.sdkConfig.bizId
}
}, {
key: "readyState",
get: function get() {
return this._readyState
},
set: function set(e) {
this._readyState = e,
this.emit(T.EVENTS.STATE, e)
}
}, {
key: "seq",
get: function get() {
return this._seq
}
}, {
key: "initInterval",
value: function initInterval() {
this.pingIntervalIndex = 0
}
}, {
key: "addSeq",
value: function addSeq() {
this._seq += 1
}
}, {
key: "nextPingInterval",
value: function nextPingInterval() {
this.pingIntervalIndex += 1
}
}, {
key: "getPingInterval",
value: function getPingInterval() {
var e, r = (null === (e = this.sdkConfig) || void 0 === e ? void 0 : e.pingInterval) || [6e3];
if (this.pingIntervalIndex < r.length) {
var i = r[this.pingIntervalIndex];
return this.nextPingInterval(),
i
}
return r[r.length - 1]
}
}, {
key: "setMap",
value: function setMap(e, r) {
this.transportMap.set(e, r)
}
}, {
key: "getMap",
value: function getMap(e) {
return this.transportMap.get(e)
}
}, {
key: "deleteMap",
value: function deleteMap(e) {
return this.transportMap.delete(e)
}
}, {
key: "clearAll",
value: function clearAll() {
O("clear all")
}
}, {
key: "inConnecting",
value: function inConnecting() {
return [T.ELongLinkState.CONNECTING].includes(this.readyState)
}
}, {
key: "inReConnecting",
value: function inReConnecting() {
return [T.ELongLinkState.RECONNECTING].includes(this.readyState)
}
}, {
key: "emitClose",
value: function emitClose(e) {
e.code !== C.CLOSE_TYPE.User.code && this.sdk.tracker.push({
evt: I.EEvtName.CLOS,
cnt: this.closeCounter,
extra: d._({
closeEvt: e
}, this.connCtx)
}),
this.emit(T.EVENTS.CLOSE, e)
}
}, {
key: "processError",
value: function processError(e) {
var r = !(arguments.length > 1) || void 0 === arguments[1] || arguments[1]
, i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
if (this.sdk.tracker.push({
evt: I.EEvtName.ERR,
extra: d._({
err: {
code: e.code,
message: e.message,
detail: null == e ? void 0 : e.detail
}
}, this.connCtx)
}),
r && this.emit(T.EVENTS.ERROR, e),
i)
throw e
}
}, {
key: "connect",
value: function connect(e, r) {
this.setMap(T.EVENTS.CONNECT, {
resolve: e,
reject: r
}),
this.readyState !== T.ELongLinkState.RECONNECTING && (this.readyState = T.ELongLinkState.CONNECTING),
this.emit(T.EVENTS.CONNECTING, this.sdk.config),
this.doConnect()
}
}, {
key: "onConnect",
value: function onConnect() {
O("onConnect readyState", this.readyState),
this.readyState = T.ELongLinkState.CONNECT,
this.emit(T.EVENTS.CONNECT, {
ctx: this.sdk.config
});
var e = (this.getMap(T.EVENTS.CONNECT) || {}).resolve;
e && (e((0,
R.createSuccess)()),
this.deleteMap(T.EVENTS.CONNECT))
}
}, {
key: "onReConnect",
value: function onReConnect() {
this.readyState = T.ELongLinkState.CONNECT,
this.useBridge ? this.retryBind() : (O("[onReConnect] retryAuth"),
this.retryAuth(this.authCtx, !0))
}
}, {
key: "reconnectBySdk",
value: function reconnectBySdk(e, r) {
var i = this;
return a._(function() {
var a;
return v._(this, function(s) {
switch (s.label) {
case 0:
return e && i.close(r),
a = r.reason,
i.readyState = T.ELongLinkState.RECONNECTING,
i.emit(T.EVENTS.RECONNECTING, "".concat(a, " by sdk")),
[4, i.changeURL()];
case 1:
return s.sent(),
i.retryConnect(T.EConnectType.RECONNECT, a, !0).then(function() {
i.onReConnect()
}),
[2]
}
})
})()
}
}, {
key: "reconnectByBiz",
value: function reconnectByBiz(e) {
var r = this;
return a._(function() {
return v._(this, function(i) {
return ![T.ELongLinkState.CLOSE, T.ELongLinkState.CLOSING].includes(r.readyState) && r.close((0,
C.createClose)({
reason: e,
code: C.CLOSE_TYPE.ReconnectClose.code
})),
r.readyState = T.ELongLinkState.RECONNECTING,
r.emit(T.EVENTS.RECONNECTING, "".concat(e, " by biz")),
[2, r.retryConnect(T.EConnectType.RECONNECT, e, !1).then(function(e) {
return r.onReConnect(),
e
})]
})
})()
}
}, {
key: "retryBind",
value: function retryBind(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, i = this;
return a._(function() {
var s, u, c;
return v._(this, function(l) {
var f;
if (!e && !i.bindCtx)
return i.processError(b.LonglinkError.create(k.ERR_TYPE_BASE.DefaultError, "bind 上下文为空,通道无法正常运行")),
[2, (0,
R.createFailed)(T.EStatusCodes.FAILED, "empty bindCtx")];
return s = (0,
S.ptime)(),
u = i.sdkConfig.authTimeout,
c = i.sdkConfig.authRetryAttempts,
e && i.setBindCtx(e),
[2, (0,
S.promiseTimeoutAndRetry)(function() {
return {
promise: new Promise(function(e, r) {
i.bind(e, r)
}
),
info: "bind"
}
}, {
timeout: u,
retryAttempts: c,
retryInterval: i.sdkConfig.retryInterval
}, (f = a._(function(e, r) {
var i;
return v._(this, function(e) {
return (i = (null == r ? void 0 : r.code) || -1,
(0,
S.octopusErrorCodeScope)(i) === T.EErrorAvailable.Available) ? [2, !1] : [2, !0]
})
}),
function(e, r) {
return f.apply(this, arguments)
}
)).then(function(e) {
var r = e.result
, a = e.retryTimes;
return i.sdk.tracker.push({
evt: I.EEvtName.BIND_OK,
ts: (0,
S.ptime)() - s,
cnt: a
}),
p._(d._({}, r), {
data: r.data
})
}).catch(function(e) {
i.authFailedCb(T.ELongLinkState.BINDING),
i.sdk.tracker.push({
evt: I.EEvtName.BIND_NOT,
cnt: (null == e ? void 0 : null === (a = e.errors) || void 0 === a ? void 0 : a.length) || -1,
extra: {
url: i.sdkConfig.url,
env: i.sdkConfig.env,
error: (0,
S.uniq)((null == e ? void 0 : null === (s = e.errors) || void 0 === s ? void 0 : s.slice(0, 5).map(function(e) {
return e.message
})) || []).join(", "),
errorCnt: null == e ? void 0 : e.errors.length,
ctx: i.authCtx
}
});
var a, s, u, c, l = b.LonglinkError.create({
code: (null == e ? void 0 : null === (u = e.errors[0]) || void 0 === u ? void 0 : u.code) || b.ERR_TYPE.TransportBindFailed.code,
message: (null == e ? void 0 : null === (c = e.errors[0]) || void 0 === c ? void 0 : c.message) || b.ERR_TYPE.TransportBindFailed.message
});
i.processError(l, !0, !r)
})]
})
})()
}
}, {
key: "_canAuthRetry",
value: function _canAuthRetry() {
return !![T.ELongLinkState.CONNECT, T.ELongLinkState.AUTH].includes(this.readyState) || (this.processError(b.LonglinkError.create(b.ERR_TYPE.TransportErrorStatus, "鉴权重试时为 ".concat(this.readyState, " 态")), !0, !1),
!1)
}
}, {
key: "retryAuth",
value: function retryAuth(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, i = this;
return a._(function() {
var s, u, c;
return v._(this, function(l) {
var f;
if (!e)
return i.processError(b.LonglinkError.create(k.ERR_TYPE_BASE.DefaultError, "鉴权上下文为空,通道无法正常运行"), !0, !r),
[2, (0,
R.createFailed)(T.EStatusCodes.FAILED, "empty authCtx")];
return i.setAuthCtx(e),
s = (0,
S.ptime)(),
u = i.sdkConfig.authTimeout,
c = i.sdkConfig.authRetryAttempts,
[2, (0,
S.promiseTimeoutAndRetry)(function() {
return {
promise: new Promise(function(e, r) {
i.auth(e, r)
}
),
info: "auth"
}
}, {
timeout: u,
retryAttempts: c,
retryInterval: i.sdkConfig.retryInterval
}, (f = a._(function(e, r) {
var a;
return v._(this, function(e) {
return i._canAuthRetry() ? (a = (null == r ? void 0 : r.code) || -1,
(0,
S.octopusErrorCodeScope)(a) === T.EErrorAvailable.Available) ? [2, !1] : [2, !0] : [2, !0]
})
}),
function(e, r) {
return f.apply(this, arguments)
}
)).then(function(e) {
var r = e.result
, a = e.retryTimes;
return i.sdk.tracker.push({
evt: I.EEvtName.AUTH_OK,
ts: (0,
S.ptime)() - s,
cnt: a
}),
p._(d._({}, r), {
data: r.data
})
}).catch(function(e) {
i.authFailedCb(T.ELongLinkState.AUTHING),
i.sdk.tracker.push({
evt: I.EEvtName.AUTH_NOT,
cnt: (null == e ? void 0 : null === (a = e.errors) || void 0 === a ? void 0 : a.length) || -1,
extra: {
url: i.sdkConfig.url,
env: i.sdkConfig.env,
error: (0,
S.uniq)((null == e ? void 0 : null === (s = e.errors) || void 0 === s ? void 0 : s.slice(0, 5).map(function(e) {
return e.message
})) || []).join(", "),
errorCnt: null == e ? void 0 : e.errors.length,
ctx: i.authCtx
}
});
var a, s, u, c, l = b.LonglinkError.create({
code: (null == e ? void 0 : null === (u = e.errors[0]) || void 0 === u ? void 0 : u.code) || b.ERR_TYPE.TransportAuthFailed.code,
message: (null == e ? void 0 : null === (c = e.errors[0]) || void 0 === c ? void 0 : c.message) || b.ERR_TYPE.TransportAuthFailed.message
});
i.processError(l, !0, !r)
})]
})
})()
}
}, {
key: "changeURL",
value: function changeURL() {
var e = this;
return a._(function() {
var r;
return v._(this, function(i) {
switch (i.label) {
case 0:
if (!e.sdkConfig.openChangeUrl)
return [2, !0];
if (T.EEnv.SIT !== e.sdkConfig.env)
return [3, 2];
return [4, e.sdk.nextIp(e.sdkConfig.url)];
case 1:
if (r = i.sent())
return e.sdkConfig.url = r,
[2, !0];
return [2, !1];
case 2:
return [2, !0]
}
})
})()
}
}, {
key: "retryConnect",
value: function retryConnect() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : T.EConnectType.CONNECT
, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ""
, i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]
, s = this;
return a._(function() {
var u, c, l;
return v._(this, function(g) {
var h;
return u = (0,
S.ptime)(),
c = s.sdkConfig.connectTimeout,
l = e === T.EConnectType.CONNECT,
O("[log] retryConnect", e, c),
[2, (0,
S.promiseTimeoutAndRetry)(function() {
return {
promise: new Promise(function(e, r) {
s.connect(e, r)
}
),
info: e
}
}, {
useRetry: !0,
timeout: c,
retryAttempts: s.sdkConfig.maxReconnectAttempts,
retryInterval: f._(Array(10).fill(500)).concat(f._(Array(10).fill(3e3)), [5e3])
}, (h = a._(function(e) {
var r;
return v._(this, function(i) {
switch (i.label) {
case 0:
if (s.protocol !== E.EProtocols.Websocket || !(e > 0))
return [3, 2];
return [4, s.changeURL()];
case 1:
return O("[LOG] change URL result", e, r = !i.sent()),
[2, r];
case 2:
return [2, !1]
}
})
}),
function(e) {
return h.apply(this, arguments)
}
)).then(function(e) {
var i = e.result
, a = e.retryTimes;
return s.sdk.tracker.push({
evt: l ? I.EEvtName.CONN_OK : I.EEvtName.RECONN_OK,
ts: (0,
S.ptime)() - u,
cnt: a,
extra: {
reason: r
}
}),
p._(d._({}, i), {
data: p._(d._({}, i.data), {
longlinkHost: s.sdkConfig.url
})
})
}).catch(function(e) {
O("[ERROR] retryConnect failed", s.sdkConfig.maxReconnectAttempts),
s.sdk.tracker.push({
evt: l ? I.EEvtName.CONN_NOT : I.EEvtName.RECONN_NOT,
cnt: (null == e ? void 0 : null === (r = e.errors) || void 0 === r ? void 0 : r.length) || -1,
extra: {
error: (0,
S.uniq)((null == e ? void 0 : null === (a = e.errors) || void 0 === a ? void 0 : a.slice(0, 5).map(function(e) {
return e.message
})) || []).join(", "),
errorCnt: null == e ? void 0 : null === (u = e.errors) || void 0 === u ? void 0 : u.length,
ctx: s.connCtx,
extra: {
config: s.sdkConfig
}
}
});
var r, a, u, c = b.LonglinkError.create(l ? b.ERR_TYPE.TransportConnFailed : b.ERR_TYPE.TransportReconnectFailed, e.message);
s.processError(c, !0, !i)
})]
})
})()
}
}, {
key: "mockAbnormalClose",
value: function mockAbnormalClose() {
this.close((0,
C.createClose)({
code: 1006,
reason: "模拟异常关闭",
wasClean: !0
}))
}
}, {
key: "close",
value: function close(e) {
var r = this;
return this.closeHealthCheck(),
new Promise(function() {
r.onCloseing(e)
}
)
}
}, {
key: "onCloseing",
value: function onCloseing(e) {
return this.readyState = T.ELongLinkState.CLOSING,
this.doClose(e),
this
}
}, {
key: "onPreConnectClose",
value: function onPreConnectClose(e) {
O("[LOG]onPreConnectClose", e),
this.processError(b.LonglinkError.create(b.ERR_TYPE.TransportPreConnectClose, "", e), !1),
this.emit(T.EVENTS.PRE_CONNECT_CLOSE, e)
}
}, {
key: "onClose",
value: function onClose(e) {
var r = this;
return a._(function() {
return v._(this, function(i) {
return O("[close]onClose", e, r.readyState),
!r.inReConnecting() && !r.inConnecting() && Promise.resolve().then(function() {
r.readyState = T.ELongLinkState.CLOSE,
r.clearAll(),
r.emitClose(e),
!(0,
S.isUserClose)(e) && (O("[close] should reconnect", e),
r.reconnectBySdk(!1, e))
}),
[2]
})
})()
}
}, {
key: "cleanPingTimer",
value: function cleanPingTimer() {
O("[log] cleanPingTimer"),
clearTimeout(this.pingTimer),
this.pingTimer = null,
this.pingTimeoutCounter = 0;
var e = this.getMap(T.EVENTS.PING);
e && (null == e || e.resolve((0,
R.createSuccess)()),
this.deleteMap(T.EVENTS.PING))
}
}, {
key: "setPingTimeout",
value: function setPingTimeout() {
var e = this;
this.pingTimer = setTimeout(function() {
O("[error] ping timeout", e.pingTimeoutCounter),
e.initInterval(),
e.healthCheck(),
e.pingTimeoutCounter += 1,
e.pingTimeoutCounter >= e.sdkConfig.pingLimit && (e.reconnectBySdk(!0, (0,
C.createClose)(C.CLOSE_TYPE.PingTimeout)),
e.processError(b.LonglinkError.create(b.ERR_TYPE.TransportPingTimeout)))
}, this.sdkConfig.pingTimeout)
}
}, {
key: "sendPingPacket",
value: function sendPingPacket(e) {
var r = this
, i = this.createPayload(y.EPacketType.PING)
, a = i.payload
, s = i.packet;
if (e) {
this.setMap(T.EVENTS.PING, e);
var u, c = e.opts;
this.pingTimer = setTimeout(function() {
r.deleteMap(T.EVENTS.PING),
r.reconnectBySdk(!0, (0,
C.createClose)({
code: C.CLOSE_TYPE.HealthCheck.code,
reason: (null == c ? void 0 : c.reason) || "health check failed"
})),
e.reject((0,
R.createFailed)(T.EStatusCodes.FAILED, "ping packet timeout"))
}, (null == c ? void 0 : c.respondTime) || (null == c ? void 0 : c.timeout) || (null === (u = this.sdkConfig) || void 0 === u ? void 0 : u.pingTimeout))
}
return this.send(a, s, null == e ? void 0 : e.clearCb.bind(this))
}
}, {
key: "openPing",
value: function openPing() {
var e = this
, r = this.getPingInterval();
this.pingSenderTimer = setTimeout(function() {
[T.ELongLinkState.AUTH, T.ELongLinkState.BIND, T.ELongLinkState.CONNECT].includes(e.readyState) && (e.sendPingPacket(),
e.setPingTimeout(),
e.openPing())
}, r || 5e3)
}
}, {
key: "closeHealthCheck",
value: function closeHealthCheck() {
clearTimeout(this.pingSenderTimer),
this.pingSenderTimer = null
}
}, {
key: "healthCheck",
value: function healthCheck() {
this.closeHealthCheck(),
this.openPing()
}
}, {
key: "authFailedCb",
value: function authFailedCb(e) {
this.deleteMap(e),
this.readyState = T.ELongLinkState.CONNECT
}
}, {
key: "setAuthCtx",
value: function setAuthCtx(e) {
this.sdk.authCtx = e
}
}, {
key: "setBindCtx",
value: function setBindCtx(e) {
this.sdk.bindCtx = e
}
}, {
key: "bind",
value: function bind(e, r) {
var i, a = this.createPayload(y.EPacketType.VIRTUAL_LINK, {}, {
sceneId: this.sdkConfig.app,
sceneUserId: null === (i = this.bindCtx) || void 0 === i ? void 0 : i.sid,
handleType: T.EVirtualLinkHandleType.CREATE
}), s = a.packet, u = a.payload;
this.readyState = T.ELongLinkState.BINDING,
this.emit(T.EVENTS.BINDING, s),
this.setMap(T.ELongLinkState.BINDING, {
resolve: e,
reject: r
}),
this.send(u, s, this.onPacketBindAck.bind(this))
}
}, {
key: "auth",
value: function auth(e, r) {
var i, a = this.createPayload(y.EPacketType.AUTH, {}, p._(d._({}, this.sdk.authCtx), {
extra: JSON.stringify(null === this || void 0 === this ? void 0 : null === (i = this.authCtx) || void 0 === i ? void 0 : i.extra)
})), s = a.payload, u = a.packet;
this.readyState = T.ELongLinkState.AUTHING,
this.emit(T.EVENTS.AUTHING, u),
this.setMap(T.ELongLinkState.AUTHING, {
resolve: e,
reject: r
}),
this.send(s, u)
}
}, {
key: "unbind",
value: function unbind() {
var e, r, i = {
businessType: w.BusinessType.impaas,
payloadType: w.BridgePayloadType.bind,
options: {
bizId: this.sdkConfig.bizId,
echo: !1,
retryCount: this.sdkConfig.sendRetryAttempts,
timeout: this.sdkConfig.authTimeout
},
payload: JSON.stringify({
identity: null === (r = this.sdk) || void 0 === r ? void 0 : null === (e = r.authCtx) || void 0 === e ? void 0 : e.sid,
cancel: !0
})
};
this.send(i, i)
}
}, {
key: "appBind",
value: function appBind(e) {
var r = this;
if (!e)
throw Error("bindContext 为空,请检查");
this.readyState !== T.ELongLinkState.CONNECT && this.emit(T.EVENTS.SDK_ERROR, Error("bind() 仅在 ".concat(T.ELongLinkState.CONNECT, " 态时可调用"))),
this.setAuthCtx(e);
var i = {
businessType: w.BusinessType.impaas,
payloadType: w.BridgePayloadType.bind,
options: {
bizId: this.sdkConfig.bizId,
echo: !1,
retryCount: this.sdkConfig.sendRetryAttempts,
timeout: this.sdkConfig.authTimeout
},
payload: JSON.stringify({
identity: e.sid,
cancel: !1
})
};
this.readyState = T.ELongLinkState.BINDING,
this.emit(T.EVENTS.BINDING, i);
var a = new Promise(function(e, a) {
r.setMap(T.ELongLinkState.BINDING, {
resolve: e,
reject: a
}),
r.send(i, i, r.onPacketBindAck.bind(r))
}
);
return (0,
S.timeoutPromise)(this.sdkConfig.authTimeout, a, b.LonglinkError.create(b.ERR_TYPE.TransportBindFailed), function() {
r.authFailedCb(T.ELongLinkState.BINDING)
})
}
}, {
key: "createPayload",
value: function createPayload(e, r, i) {
var a, s = (0,
P.createPacket)(e, this, r, i);
if (this.sdkConfig.protocol === E.EProtocols.Websocket) {
var u = _.default.encodePacket(s, this.sdkConfig.packetFormat, this);
return {
packet: s,
payload: u
}
}
var c = this.sdkConfig
, l = c.sendTimeout
, f = c.sendRetryAttempts
, v = c.debugEcho;
[y.EPacketType.MESSAGE, y.EPacketType.PING].includes(e) && (s.header = p._(d._({}, s.header), {
authorization: null === (a = this.bindCtx) || void 0 === a ? void 0 : a.sid
}));
var g = (0,
A.createBridgePacket)(this, e, s, {
timeout: l,
retryCount: f,
echo: v
});
return {
packet: g,
payload: g
}
}
}, {
key: "send",
value: function send(e, r, i) {
try {
this.useBridge ? (this.onSend(e, r),
this.write(e).then(function() {
for (var e = arguments.length, r = Array(e), a = 0; a < e; a++)
r[a] = arguments[a];
i && i.apply(void 0, [void 0].concat(f._(r)))
}).catch(function(e) {
i(e)
})) : (this.write(e),
this.onSend(e, r))
} catch (r) {
var a = b.LonglinkError.create(b.ERR_TYPE.TransportErrorWriteData, r.message, e);
this.onError(a),
O("[error] send()", a)
}
return r
}
}, {
key: "onSend",
value: function onSend(e, r) {
this.emit(T.EVENTS.SEND, e, r),
this.addSeq()
}
}, {
key: "protocol",
get: function get() {
return this.sdkConfig.protocol
}
}, {
key: "onError",
value: function onError(e) {
if (O("[onError]", this.readyState, e.message, e.detail),
this.inConnecting()) {
var r = this.getMap(T.EVENTS.CONNECT);
r && (0,
r.reject)(b.LonglinkError.create(this.protocol === E.EProtocols.Websocket ? b.ERR_TYPE.WebSocketErrorCreate : b.ERR_TYPE.BridgeErrorCreate, (null == e ? void 0 : e.message) || "".concat(this.protocol, " connect error")))
} else
this.processError(e, !0, !1)
}
}, {
key: "onData",
value: function onData(e) {
this.emit(T.EVENTS.DATA, e);
var r = _.default.decodePacket(e, this);
return this.onPacket(r),
this
}
}, {
key: "onPacket",
value: function onPacket(e) {
var r, i = null === (r = e.header) || void 0 === r ? void 0 : r.type;
switch (this.emit(T.EVENTS.PACKET, e),
this.cleanPingTimer(),
i) {
case y.EPacketType.PING:
this.onPacketPing();
break;
case y.EPacketType.PONG:
this.onPacketPong(e);
break;
case y.EPacketType.AUTH_ACK:
this.onPacketAuthAck(e);
break;
case y.EPacketType.CLOSE:
this.onPacketClose(e);
break;
case y.EPacketType.CLOSE_ACK:
this.onPacketCloseAck(e);
break;
case y.EPacketType.MESSAGE_DOWN:
this.onPacketMessageDown(e);
break;
case y.EPacketType.MESSAGE_ACK:
this.onPacketMessageAck(e);
break;
case y.EPacketType.REGISTE_EVENT_ACK:
this.onRegisterEventAck(e);
break;
default:
O("[unknown packet]", e),
this.onPacketUnknown(e)
}
}
}, {
key: "onPacketAuthAck",
value: function onPacketAuthAck(e) {
var r = this.getMap(T.ELongLinkState.AUTHING) || {}
, i = r.resolve
, a = r.reject;
if (i) {
if ((null == e ? void 0 : e.body) && (null == e ? void 0 : null === (c = e.body) || void 0 === c ? void 0 : c.code) === T.EStatusCodes.SUCCESS) {
this.readyState = T.ELongLinkState.AUTH,
this.healthCheck();
var s, u, c, l, d, p = (0,
R.createSuccess)(T.EStatusCodes.SUCCESS, T.EStatusMessage.SUCCESS, e.body.data);
this.emit(T.EVENTS.AUTH, e.body),
this.channelId = (null === (d = e.body) || void 0 === d ? void 0 : null === (l = d.data) || void 0 === l ? void 0 : l.channelId) || "channel-id",
i(p)
} else
this.readyState = T.ELongLinkState.CONNECT,
a(b.LonglinkError.create({
code: (null == e ? void 0 : null === (s = e.body) || void 0 === s ? void 0 : s.code) || k.ERR_TYPE_BASE.DefaultError,
message: null == e ? void 0 : null === (u = e.body) || void 0 === u ? void 0 : u.msg
}, "", (null == e ? void 0 : e.body) || {}))
}
return this.deleteMap(T.ELongLinkState.AUTHING),
this
}
}, {
key: "onPacketBindAck",
value: function onPacketBindAck(e, r) {
var i = this.getMap(T.ELongLinkState.BINDING) || {}
, a = i.resolve
, s = i.reject;
if (e)
O("bind ack 报错", e),
s(e);
else {
var u, c, l = (null == r ? void 0 : null === (p = r.value) || void 0 === p ? void 0 : p.payload) || "{}", d = "string" == typeof l ? JSON.parse(l) : l;
if ((null == d ? void 0 : d.body) && (null == d ? void 0 : null === (f = d.body) || void 0 === f ? void 0 : f.code) === T.EStatusCodes.SUCCESS) {
this.readyState = T.ELongLinkState.BIND;
var p, f, v, g = (0,
R.createSuccess)(T.EStatusCodes.SUCCESS, T.EStatusMessage.SUCCESS, d.body.data);
this.emit(T.EVENTS.BIND, null == d ? void 0 : d.body),
this.channelId = (null === (v = d.body) || void 0 === v ? void 0 : v.data.channelId) || "channel-id",
a(g)
} else
this.readyState = T.ELongLinkState.CONNECT,
s(b.LonglinkError.create({
code: (null == d ? void 0 : null === (u = d.body) || void 0 === u ? void 0 : u.code) || k.ERR_TYPE_BASE.DefaultError,
message: null == d ? void 0 : null === (c = d.body) || void 0 === c ? void 0 : c.msg
}, "", (null == d ? void 0 : d.body) || {}))
}
return this.deleteMap(T.ELongLinkState.BINDING),
this
}
}, {
key: "onPacketMessageAck",
value: function onPacketMessageAck(e) {
return this.emit(T.EVENTS.MESSAGE_ACK, e),
this
}
}, {
key: "onRegisterEventAck",
value: function onRegisterEventAck(e) {
return this.emit(T.EVENTS.REGISTER_EVENT_ACK, e),
this
}
}, {
key: "onPacketClose",
value: function onPacketClose(e) {
var r;
return this.doClose((0,
C.createClose)({
code: C.CLOSE_TYPE.Kickout.code,
reason: (null == e ? void 0 : null === (r = e.body) || void 0 === r ? void 0 : r.reason) || "kickout by service"
})),
this
}
}, {
key: "onPacketCloseAck",
value: function onPacketCloseAck(e) {
var r;
return this.close((0,
C.createClose)({
reason: (null == e ? void 0 : null === (r = e.body) || void 0 === r ? void 0 : r.reason) || "send close packet by close_ack",
code: C.CLOSE_TYPE.Kickout.code
})),
this
}
}, {
key: "onPacketPing",
value: function onPacketPing() {
var e = this.createPayload(y.EPacketType.PONG)
, r = e.payload
, i = e.packet;
return this.send(r, i),
this
}
}, {
key: "onPacketPong",
value: function onPacketPong(e) {
var r;
return this.emit(T.EVENTS.PONG, (null === (r = e.header) || void 0 === r ? void 0 : r.ts) || -1),
this
}
}, {
key: "onPacketMessageDown",
value: function onPacketMessageDown(e) {
var r = this
, i = e.header
, a = i.bizId
, s = i.domain
, u = i.oneWay
, c = i.traceId
, l = a === T.PUSH_BIZ_ID;
if (Promise.resolve().then(function() {
try {
var i = null == e ? void 0 : e.body;
if (l) {
var a = i;
(0,
S.isString)(a) && (a = JSON.parse(a || "{}")),
r.emit(l ? T.EVENTS.PUSH_MESSAGE : T.EVENTS.MESSAGE_DOWN, a, e);
var s = a.topic
, u = a.payload
, f = r.sdk.getTopicCallback(s);
f && f(u, a)
}
r.emit(T.EVENTS.MESSAGE_DOWN, p._(d._({}, i), {
traceId: c
}), e)
} catch (i) {
r.processError(b.LonglinkError.create(b.ERR_TYPE.TransportDownMsgFailed, "解析下行 msg 失败".concat(i.message), e), !0, !1)
}
}),
!u && this.sdkConfig.protocol !== E.EProtocols.Bridge) {
var f, v = {
code: T.EStatusCodes.SUCCESS,
msg: T.EStatusMessage.SUCCESS
};
(!a || !s) && (v.code = T.EStatusCodes.FAILED,
v.msg = "message_down in empty biz or domain"),
null === (f = e.header) || void 0 === f || delete f.type;
var g = this.createPayload(y.EPacketType.MESSAGE_DOWN_ACK, e.header, v)
, h = g.payload
, m = g.packet;
this.send(h, m)
}
return this
}
}, {
key: "onPacketUnknown",
value: function onPacketUnknown(e) {
return O("unknown packet", e),
this.processError(b.LonglinkError.create(b.ERR_TYPE.TransportUnknowPacket, "", e), !0, !1),
this
}
}]),
Transport
}(h.EventEmitter);
r.default = N
},
88049: function(e, r, i) {
"use strict";
var a = i(41622)
, s = i(35329)
, u = i(46490)
, c = i(90251)
, l = i(27292)
, d = i(36102);
i(36277),
i(34333),
i(42876),
i(33933),
i(19077),
i(75973),
i(27461),
i(23339),
i(51109);
var p = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
});
var f = i(92014)
, v = p(i(88960))
, g = p(i(95260))
, h = i(79066)
, m = i(10727)
, _ = i(74794)
, y = (0,
v.default)("longlink:bridge")
, w = function(e) {
function Bridge(e) {
var r;
return u._(this, Bridge),
(r = s._(this, Bridge, [e])).$io = null,
r.subs = [],
r
}
return l._(Bridge, e),
c._(Bridge, [{
key: "checkState",
value: function checkState() {
var e = this;
return a._(function() {
return d._(this, function(r) {
try {
return [2, new Promise(function(r, i) {
e.invoke("rimStateGet", function(e) {
r(e.value.state)
}).catch(function() {
i(m.ELongLinkState.CLOSE)
})
}
)]
} catch (e) {
return y("rimStateGet failed", e),
[2, Promise.reject(m.ELongLinkState.CLOSE)]
}
return [2]
})
})()
}
}, {
key: "doConnect",
value: function doConnect() {
var e = this;
try {
this.$io && this.unMountEvents(),
this.invoke("rimStateGet").then(function(r) {
var i = r.value;
y("获取状态 rimStateGet", i);
var a = i.state
, s = void 0 === a ? m.ELongLinkState.INITIAL : a;
e.emit(m.EVENTS.BRIDGE_STATE, s),
[m.ELongLinkState.AUTH].includes(s) ? e.onConnect() : e._doReconnect()
}).catch(function(e) {
y("bridge 连接获取状态失败", e)
}),
this.mountEvents()
} catch (e) {
y("bridge connect error", e),
this.onError(h.LonglinkError.create(h.ERR_TYPE.BridgeErrorCreate, "", e))
}
return this
}
}, {
key: "_doReconnect",
value: function _doReconnect() {
this.invoke("rimReconnect").then(function() {}).catch(function(e) {
console.log("调用端侧重连错误", e)
})
}
}, {
key: "doReConnect",
value: function doReConnect() {}
}, {
key: "doClose",
value: function doClose(e) {
console.log("bridge doClose 断连", e),
this.onClose(e),
this.unMountEvents(),
this.unbind()
}
}, {
key: "unMountEvents",
value: function unMountEvents() {
for ((0,
_.log)("订阅个数", this.subs.length); this.subs.length; )
(0,
_.log)("订阅个数", this.subs.length),
this.subs.shift()()
}
}, {
key: "preRimData",
value: function preRimData(e) {
console.log("收到 pre data", e),
this.emit(m.EVENTS.PRE_DATA, e)
}
}, {
key: "preRimSend",
value: function preRimSend(e) {
this.emit(m.EVENTS.PRE_SEND, e)
}
}, {
key: "mountEvents",
value: function mountEvents() {
var e, r = this;
(0,
f.subscribeBiz)("rimState", function(e) {
(0,
_.log)("bridge 状态变化", e);
var i = e.value
, a = i.state;
console.log("收到 rim-bridge 状态变化", a),
r.emit(m.EVENTS.BRIDGE_STATE, a),
a === m.ELongLinkState.CONNECTING || (a === m.ELongLinkState.AUTH ? r.onReConnect() : [m.ELongLinkState.CLOSING, m.ELongLinkState.CLOSE].includes(a) && console.log("native 断连状态", i))
}),
(0,
f.subscribeBiz)("rimPreData", function(e) {
var i = e.value;
r.preRimData(i)
}),
(0,
f.subscribeBiz)("rimPreSend", function(e) {
var i = e.value;
r.preRimSend(i)
}),
(0,
f.subscribeBiz)("rimDataIMPAAS", function(e) {
var i = e.value;
if (console.log("端侧下推", e),
i) {
var a = (null == i ? void 0 : i.payload) || "{}"
, s = "string" == typeof a ? JSON.parse(a) : a;
r.onPacketMessageDown(s)
}
}),
(0,
f.subscribeBiz)("rimError", (e = a._(function(e) {
var r, i, a;
return d._(this, function(i) {
return (r = null == e ? void 0 : e.value).message,
601 === (a = r.result),
[2]
})
}),
function(r) {
return e.apply(this, arguments)
}
))
}
}, {
key: "write",
value: function write(e) {
return y("[log] bridge Transport", e),
(0,
_.log)("bridge Send", e),
this.invoke("rimSend", e)
}
}, {
key: "invoke",
value: function invoke(e) {
var r = this
, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return Promise.race([(0,
f.invokeBiz)(e, i), new Promise(function(e, i) {
setTimeout(function() {
i(h.LonglinkError.create(h.ERR_TYPE.BridgeErrorEvent, "bridge 通道发送超时"))
}, r.sdkConfig.sendTimeout)
}
)])
}
}], [{
key: "create",
value: function create(e) {
return new this(e)
}
}]),
Bridge
}(g.default);
r.default = w
},
61357: function(e, r, i) {
"use strict";
i(7608),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.createBridgePacket = void 0;
var a = i(15900)
, s = i(36189);
function createOpts(e, r) {
var i, a;
return {
timeout: null !== (i = null == r ? void 0 : r.timeout) && void 0 !== i ? i : e.sdkConfig.sendTimeout,
retryCount: null !== (a = null == r ? void 0 : r.retryCount) && void 0 !== a ? a : e.sdkConfig,
echo: r.echo,
bizId: 10
}
}
function createBridgePacket(e, r, i, u) {
var c = {
payloadType: s.BridgePayloadType.message,
businessType: s.BusinessType.impaas,
payload: JSON.stringify({})
};
switch (r) {
case a.EPacketType.PING:
case a.EPacketType.MESSAGE:
case a.EPacketType.VIRTUAL_LINK:
c = {
businessType: s.BusinessType.impaas,
payloadType: s.BridgePayloadType.message,
options: createOpts(e, u),
payload: JSON.stringify(i)
}
}
return c
}
r.createBridgePacket = createBridgePacket
},
90316: function(e, r, i) {
"use strict";
var a, s = i(41622), u = i(35329), c = i(46490), l = i(90251), d = i(27292), p = i(36102);
i(86651),
i(19077),
i(75973),
i(7608),
i(87989);
var f = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.EStoreEvent = r.Store = void 0;
var v = f(i(47324))
, g = i(92381)
, h = i(39998);
(a || (a = {})).ROUTE_EXPIRE = "routeExpire",
r.EStoreEvent = a;
var m = function(e) {
function Store(e) {
var r;
return c._(this, Store),
(r = u._(this, Store)).fallbackRoute = e,
r
}
return d._(Store, e),
l._(Store, [{
key: "get",
value: function get() {
var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]
, r = this;
return s._(function() {
var i, s, u, c;
return p._(this, function(c) {
switch (c.label) {
case 0:
if (c.trys.push([0, 6, , 7]),
!(!e || !r.memoryCache))
return [3, 4];
return [4, Store.storage.getItem(Store.key)];
case 1:
if (i = JSON.parse(c.sent()))
return [3, 3];
return [4, Store.initStore()];
case 2:
c.sent(),
c.label = 3;
case 3:
return [3, 5];
case 4:
i = r.memoryCache,
c.label = 5;
case 5:
return s = i.route,
u = i.routeExipire,
(new Date().getTime() >= u || !s) && r.emit(a.ROUTE_EXPIRE),
[2, {
route: (null == s ? void 0 : s.length) > 0 ? s : r.fallbackRoute,
routeExipire: u
}];
case 6:
return c.sent(),
Store.sdk.tracker.push({
evt: h.EEvtName.STORAGE_GET
}),
[2, {
route: r.fallbackRoute,
routeExipire: new Date().getTime()
}];
case 7:
return [2]
}
})
})()
}
}, {
key: "set",
value: function set(e) {
var r = this;
return s._(function() {
var i;
return p._(this, function(i) {
switch (i.label) {
case 0:
r.memoryCache = e,
i.label = 1;
case 1:
return i.trys.push([1, 3, , 4]),
[4, Store.storage.setItem(Store.key, JSON.stringify(e))];
case 2:
return i.sent(),
[3, 4];
case 3:
return i.sent(),
Store.sdk.tracker.push({
evt: h.EEvtName.STORAGE_SET
}),
[3, 4];
case 4:
return [2]
}
})
})()
}
}], [{
key: "initStore",
value: function initStore() {
return s._(function() {
var e;
return p._(this, function(e) {
switch (e.label) {
case 0:
return e.trys.push([0, 2, , 3]),
[4, Store.storage.setItem(Store.key, JSON.stringify({
route: null,
routeExipire: new Date().getTime()
}))];
case 1:
return e.sent(),
[3, 3];
case 2:
return e.sent(),
Store.sdk.tracker.push({
evt: h.EEvtName.STORAGE_INIT
}),
[3, 3];
case 3:
return [2]
}
})
})()
}
}, {
key: "create",
value: function create(e, r) {
var i = this;
return s._(function() {
var a, s, u;
return p._(this, function(c) {
switch (c.label) {
case 0:
return a = r.fallbackRoute,
s = r.env,
u = r.customStorage,
Store.key = "".concat("RED_IM_STORE", "_").concat(s),
Store.sdk = e,
u && (Store.storage = u),
[4, Store.storage.getItem(Store.key)];
case 1:
if (c.sent())
return [3, 3];
return [4, Store.initStore()];
case 2:
c.sent(),
c.label = 3;
case 3:
return [2, new i(a)]
}
})
})()
}
}]),
Store
}(v.default);
r.Store = m,
m.storage = g.defaultStorage
},
36229: function(e, r, i) {
"use strict";
var a = i(41622)
, s = i(35329)
, u = i(46490)
, c = i(90251)
, l = i(27292)
, d = i(70879)
, p = i(36102);
i(87989),
i(43648);
var f = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
});
var v = f(i(88960))
, g = f(i(95260))
, h = i(79066)
, m = i(41172)
, _ = i(74794)
, y = i(78943)
, w = (0,
v.default)("longlink: ws")
, E = function(e) {
function Websocket(e) {
var r;
return u._(this, Websocket),
(r = s._(this, Websocket, [e])).$io = null,
r._listeners = {},
r
}
return l._(Websocket, e),
c._(Websocket, [{
key: "checkState",
value: function checkState() {
var e = this;
return a._(function() {
return p._(this, function(r) {
return [2, e.readyState]
})
})()
}
}, {
key: "doConnect",
value: function doConnect() {
try {
this.$io && this.unMountEvents(),
w("[websocket] doconnect"),
this.$io = new y(this.sdkConfig.url),
this.mountEvents()
} catch (e) {
this.onError(h.LonglinkError.create(h.ERR_TYPE.WebSocketErrorCreate, (null == e ? void 0 : e.message) || ""))
}
return this
}
}, {
key: "doReConnect",
value: function doReConnect() {
this.doConnect()
}
}, {
key: "doClose",
value: function doClose(e) {
var r = this
, i = e.code
, a = e.reason;
w("doClose = (".concat(i, ", ").concat(a, ")")),
this.$io && ((0,
_.notNeedEmitClose)(e) && (this.$io.onclose = function(e) {
r.onPreConnectClose(e)
}
),
this.$io.close(i, (a || "normal close").slice(0, 123)))
}
}, {
key: "unMountEvents",
value: function unMountEvents() {
delete this._listeners,
this.$io.onopen = null,
this.$io.onclose = null,
this.$io.onmessage = null,
this.$io.onerror = null,
this.$io = null
}
}, {
key: "mountEvents",
value: function mountEvents() {
var e = this;
this.$io.onopen = this.onConnect.bind(this),
this.$io.onclose = function(r) {
w("[ws onclose]", r.reason),
e.unMountEvents(),
e.onClose((0,
m.createClose)({
code: r.code,
reason: r.reason,
wasClean: r.wasClean
}))
}
,
this.$io.onerror = function(r) {
var i = h.LonglinkError.create(h.ERR_TYPE.WebSocketErrorEvent, "", d._({}, (null == r ? void 0 : r.error) || {}));
e.onError(i)
}
,
this.$io.onmessage = function(r) {
e.onData(r.data)
}
}
}, {
key: "write",
value: function write(e) {
this.$io && this.$io.send(e)
}
}]),
Websocket
}(g.default);
r.default = E
},
10727: function(e, r) {
"use strict";
var i, a, s, u, c, l, d, p, f, v, g, h, m, _, y, w, E, S, T, b, k, C, P, A, R, I;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.ELongLinkState = r.EMsgEvents = r.EVENTS = r.EAuthType = r.EContentType = r.ELonglinkAction = r.EVirtualLinkHandleType = r.ErrorCode = r.EStatusMessage = r.EStatusCodes = r.EConnectType = r.EEnv = r.EErrorAvailable = r.PUSH_BIZ_ID = void 0,
r.PUSH_BIZ_ID = 2,
(_ = r.EErrorAvailable || (r.EErrorAvailable = {})).Available = "Available",
_.UnAvailable = "UnAvailable",
_.Other = "Other",
_.Biz = "Biz",
(y = r.EEnv || (r.EEnv = {})).SIT = "SIT",
y.BETA = "BETA",
y.PROD = "PROD",
(w = r.EConnectType || (r.EConnectType = {})).CONNECT = "CONNECT",
w.RECONNECT = "RECONNECT",
(E = r.EStatusCodes || (r.EStatusCodes = {}))[E.SUCCESS = 0] = "SUCCESS",
E[E.FAILED = -1] = "FAILED",
(S = r.EStatusMessage || (r.EStatusMessage = {})).SUCCESS = "success",
S.FAILED = "failed",
(T = r.ErrorCode || (r.ErrorCode = {}))[T.SYSTEM_ERROR = 500] = "SYSTEM_ERROR",
(b = r.EVirtualLinkHandleType || (r.EVirtualLinkHandleType = {}))[b.CREATE = 0] = "CREATE",
b[b.CANCEL = 1] = "CANCEL",
(k = r.ELonglinkAction || (r.ELonglinkAction = {})).PING = "ping",
k.PONG = "pong",
k.AUTH = "auth",
k.BIND = "bind",
k.VIRTUAL_LINK = "virtual_link",
k.MESSAGE = "msg",
k.MESSAGE_DOWN_ACK = "msg_down_ack",
(C = r.EContentType || (r.EContentType = {})).JSON = "json",
C.PROTOBUF = "protobuf",
(P = r.EAuthType || (r.EAuthType = {})).GENERIC = "generic",
P.PORCH = "porch",
P.RED_PASSPORT = "red_passport",
P.ANONYMOUS = "anonymous",
(A = r.EVENTS || (r.EVENTS = {})).INITIAL = "initial",
A.CONNECTING = "connecting",
A.RECONNECTING = "reconnecting",
A.RECONNECT_FAILED = "reconnect_failed",
A.CONNECT = "connect",
A.CONNECT_FAILED = "connect_failed",
A.AUTHING = "authing",
A.AUTH = "auth",
A.AUTH_FAILED = "auth_failed",
A.BINDING = "binding",
A.BIND = "bind",
A.BIND_FAILED = "bind_failed",
A.SEND = "send",
A.PING = "ping",
A.PONG = "pong",
A.CLOSING = "closing",
A.CLOSE = "close",
A.ERROR = "error",
A.SDK_ERROR = "sdk_error",
A.DATA = "data",
A.PACKET = "packet",
A.MESSAGE_SEND = "message_send",
A.MESSAGE_ACK = "message_ack",
A.MESSAGE_DOWN = "message_down",
A.REGISTER_EVENT_ACK = "register_event_ack",
A.PUSH_MESSAGE = "push_message",
A.STATE = "state",
A.PRE_CONNECT_CLOSE = "pre_connect_close",
A.BRIDGE_STATE = "bridge_state",
A.PRE_DATA = "pre_data",
A.PRE_SEND = "pre_send",
(R = r.EMsgEvents || (r.EMsgEvents = {})).SEND_MESSAGE = "message_send_message",
R.SEND_FAIL = "message_send_fail",
R.SEND_SUCCESS = "message_send_success",
(I = r.ELongLinkState || (r.ELongLinkState = {})).INITIAL = "initial",
I.CONNECTING = "connecting",
I.RECONNECTING = "reconnecting",
I.CONNECT = "connect",
I.AUTHING = "authing",
I.AUTH = "auth",
I.BINDING = "binding",
I.BIND = "bind",
I.CLOSING = "closing",
I.CLOSE = "close"
},
7361: function(e, r, i) {
"use strict";
var a = i(75649);
i(21608),
i(87989),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.defaultConfig = void 0;
var s = i(10727)
, u = i(1266)
, c = i(36189)
, l = [, , , , , ].fill(5e3)
, d = Array(10).fill(15e3);
r.defaultConfig = {
contentType: s.EContentType.JSON,
packetFormat: c.EPacketFormat.STRING,
protocol: u.EProtocols.Websocket,
env: s.EEnv.PROD,
connectTimeout: a._(l).concat(a._(d), [3e4]),
authTimeout: 8e3,
authRetryAttempts: 10,
authType: s.EAuthType.GENERIC,
openChangeUrl: !1,
sendTimeout: 5e3,
sendRetryAttempts: 5,
retryInterval: 3e3,
pingTimeout: 4e3,
pingInterval: [3e3, 8e3, 14e3, 28e3, 3e4],
pingLimit: 1,
trackerLevel: 1,
trackerLog: !1,
autoReconnect: !0,
maxReconnectAttempts: 1 / 0,
closeLimit: 10,
debugEcho: !1,
maxComboNum: 8,
trackerEnable: !0
}
},
15900: function(e, r) {
"use strict";
var i, a;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.NameOfPacketType = r.EPacketType = void 0,
(a = r.EPacketType || (r.EPacketType = {}))[a.PING = 0] = "PING",
a[a.PONG = 128] = "PONG",
a[a.AUTH = 1] = "AUTH",
a[a.AUTH_ACK = 129] = "AUTH_ACK",
a[a.CLOSE = 2] = "CLOSE",
a[a.CLOSE_ACK = 130] = "CLOSE_ACK",
a[a.MESSAGE = 3] = "MESSAGE",
a[a.MESSAGE_ACK = 131] = "MESSAGE_ACK",
a[a.MESSAGE_DOWN = 4] = "MESSAGE_DOWN",
a[a.MESSAGE_DOWN_ACK = 132] = "MESSAGE_DOWN_ACK",
a[a.BIND = 5] = "BIND",
a[a.BIND_ACK = 133] = "BIND_ACK",
a[a.SWITCH = 6] = "SWITCH",
a[a.SWITCH_ACK = 134] = "SWITCH_ACK",
a[a.VIRTUAL_LINK = 8] = "VIRTUAL_LINK",
a[a.VIRTUAL_LINK_ACK = 136] = "VIRTUAL_LINK_ACK",
a[a.REGISTE_EVENT = 9] = "REGISTE_EVENT",
a[a.REGISTE_EVENT_ACK = 153] = "REGISTE_EVENT_ACK",
r.NameOfPacketType = {
0: "PING",
128: "PONG",
1: "AUTH",
129: "AUTH_ACK",
2: "CLOSE",
130: "CLOSE_ACK",
3: "MESSAGE",
131: "MESSAGE_ACK",
4: "MESSAGE_DOWN",
132: "MESSAGE_DOWN_ACK",
5: "BIND",
133: "BIND_ACK",
8: "VIRTUAL_LINK",
136: "VIRTUAL_LINK_ACK",
6: "SWITCH",
134: "SWITCH_ACK"
}
},
8027: function(e, r, i) {
"use strict";
i(59976);
var a = this && this.__createBinding || (Object.create ? function(e, r, i, a) {
void 0 === a && (a = i);
var s = Object.getOwnPropertyDescriptor(r, i);
(!s || ("get"in s ? !r.__esModule : s.writable || s.configurable)) && (s = {
enumerable: !0,
get: function get() {
return r[i]
}
}),
Object.defineProperty(e, a, s)
}
: function(e, r, i, a) {
void 0 === a && (a = i),
e[a] = r[i]
}
)
, s = this && this.__exportStar || function(e, r) {
for (var i in e)
"default" !== i && !Object.prototype.hasOwnProperty.call(r, i) && a(r, e, i)
}
, u = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.EMPTY_ERROR_CODE = r.ERR_TYPE_BASE = r.BaseError = r.LonglinkSdk = void 0;
var c = i(97493);
Object.defineProperty(r, "LonglinkSdk", {
enumerable: !0,
get: function get() {
return u(c).default
}
}),
s(i(15900), r),
s(i(7361), r),
s(i(10727), r),
s(i(1266), r),
s(i(36189), r),
s(i(21155), r),
s(i(61700), r),
s(i(65061), r),
s(i(39998), r),
s(i(13398), r),
s(i(74794), r),
s(i(41172), r),
s(i(87853), r),
s(i(34493), r),
s(i(44509), r);
var l = i(70594);
Object.defineProperty(r, "BaseError", {
enumerable: !0,
get: function get() {
return l.BaseError
}
}),
Object.defineProperty(r, "ERR_TYPE_BASE", {
enumerable: !0,
get: function get() {
return l.ERR_TYPE_BASE
}
}),
Object.defineProperty(r, "EMPTY_ERROR_CODE", {
enumerable: !0,
get: function get() {
return l.EMPTY_ERROR_CODE
}
})
},
1266: function(e, r) {
"use strict";
var i, a, s, u, c, l, d, p, f, v, g, h;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.RegisterType = r.EPlatformType = r.EOSType = r.EConnectStatus = r.EStartTime = r.EProtocols = void 0,
(d = r.EProtocols || (r.EProtocols = {})).Websocket = "WS",
d.Bridge = "bridge",
(p = r.EStartTime || (r.EStartTime = {})).CONNECT_START = "connect_start",
p.AUTH_START = "auth_start",
p.SEND_START = "send_start",
p.PING_START = "ping_start",
(f = r.EConnectStatus || (r.EConnectStatus = {})).CONNECT = "connect",
f.CONNECTED = "connected",
f.RECONNECT = "reconnect",
f.RECONNECTED = "reconnected",
(v = r.EOSType || (r.EOSType = {})).WEB = "web",
v.IOS = "iOS",
v.ANDROID = "Android",
(g = r.EPlatformType || (r.EPlatformType = {})).BROWSER = "browser",
g.PHONE = "phone",
g.PAD = "pad",
g.IPHONE = "iPhone",
g.IPAD = "iPad",
g.WINDOWS = "windows",
g.MAC = "mac",
(h = r.RegisterType || (r.RegisterType = {}))[h.Register = 1] = "Register",
h[h.UnRegister = 0] = "UnRegister"
},
36189: function(e, r) {
"use strict";
var i, a, s, u, c, l, d, p;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.BusinessType = r.BridgePayloadType = r.BridgeDataType = r.EPacketFormat = void 0,
(c = r.EPacketFormat || (r.EPacketFormat = {})).STRING = "string",
c.BINARY = "binary",
(l = r.BridgeDataType || (r.BridgeDataType = {}))[l.jsonObject = 0] = "jsonObject",
l[l.buffer = 1] = "buffer",
l[l.string = 2] = "string",
(d = r.BridgePayloadType || (r.BridgePayloadType = {})).bind = "bind",
d.message = "message",
d.context = "context",
(p = r.BusinessType || (r.BusinessType = {})).cs = "CS",
p.impaas = "IMPAAS"
},
7449: function(e, r, i) {
"use strict";
var a, s, u = i(51606);
i(36277),
i(34333),
i(6045),
i(10364),
i(67673),
i(87989),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.fetchLonglinkConfig = void 0;
var c = i(10727)
, l = i(1266)
, d = i(70594)
, p = i(34493)
, f = (a = {},
u._(a, c.EEnv.BETA, "wss://apppush.beta.xiaohongshu.com:443/longlink"),
u._(a, c.EEnv.PROD, "wss://apppush-sh5.xiaohongshu.com:443/longlink"),
a)
, v = (s = {},
u._(s, c.EEnv.SIT, "https://edith.sit.xiaohongshu.com/api/sns/octopus/router/longlinkconfig"),
u._(s, c.EEnv.BETA, ""),
u._(s, c.EEnv.PROD, "https://edith.xiaohongshu.com/api/sns/octopus/router/longlinkconfig"),
s);
r.fetchLonglinkConfig = function(e) {
return new Promise(function(r, i) {
var a = e.env
, s = e.domain
, u = e.device
, g = e.protocol
, h = e.serviceTag
, m = u || {}
, _ = m.platform
, y = m.os
, w = m.appVersion
, E = m.deviceId;
a === c.EEnv.SIT ? (0,
p.httpFetch)(v[c.EEnv.SIT], {
"Service-Tag": e.serviceTag || ""
}, {
domain: s,
field: 0,
platform: _,
os: y,
ws: g === l.EProtocols.Websocket,
appVersion: w,
deviceId: E,
"Service-Tag": h
}, "GET").then(function(e) {
var s, u = e.data;
(null == u ? void 0 : u.dns) && (null == u ? void 0 : null === (s = u.dns) || void 0 === s ? void 0 : s.china) ? r({
longlinkHost: u.dns.china.map(function(e) {
return "ws://".concat(e, ":5444/longlink")
})
}) : i(d.BaseError.create(d.ERR_TYPE_BASE.HttpFetchError, "".concat(a, " 获取长连配置失败")))
}).catch(function(e) {
i(d.BaseError.create(d.ERR_TYPE_BASE.HttpFetchError, e.message))
}) : r({
longlinkHost: [f[a]]
})
}
)
}
},
25834: function(e, r, i) {
"use strict";
var a = i(70879)
, s = i(27337);
i(42876),
i(33933),
i(43648),
i(34885);
var u = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.processHttpRes = r.processBody = void 0;
var c = (0,
u(i(88960)).default)("longlink:debug");
r.processBody = function(e, r) {
if (window && "_Debug_Mode_"in window) {
var i = window._Debug_Mode_;
if (c("[longlink-DEBUG]", null == i ? void 0 : i[r]),
null == i ? void 0 : i.open) {
var a = null == i ? void 0 : i[r];
if (null == a ? void 0 : a.open)
return {
code: a.code,
msg: a.msg,
data: e.data
}
}
}
return e
}
;
r.processHttpRes = function(e) {
if (window && "_Debug_Mode_"in window) {
var r = window._Debug_Mode_;
if (null == r ? void 0 : r.open) {
var i = "/api/impaas"
, u = e.config.url;
if (u.includes(i)) {
var l = u.slice(u.indexOf(i) + i.length)
, d = null == r ? void 0 : r[l];
if (c("[http-res-DEBUG]", d),
null == d ? void 0 : d.openHttp)
return s._(a._({}, e), {
status: d.code,
statusText: d.msg
})
}
}
}
return e
}
},
23533: function(e, r, i) {
"use strict";
var a = i(41622)
, s = i(46490)
, u = i(90251)
, c = i(36102);
i(74093),
i(20768),
i(41648),
i(59339),
i(47444),
i(34757),
i(85908),
i(39995),
i(22943),
i(54767),
i(55820),
i(93225),
i(33708),
i(64322),
i(47771),
i(27461),
i(23339),
i(51109),
i(34333),
i(87989),
i(42876),
i(33933),
i(87535),
i(75204),
i(97357),
i(36277),
i(86651),
i(29744);
var l = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.MsgManager = void 0;
var d = l(i(88960))
, p = i(10727)
, f = i(15900)
, v = i(74794)
, g = i(79066)
, h = i(39998)
, m = i(25834)
, _ = i(70594)
, y = (0,
d.default)("longlink:msg")
, w = function() {
function MsgManager(e) {
s._(this, MsgManager),
this.ctx = e,
this.sMidMap = new Map
}
return u._(MsgManager, [{
key: "onMessageAck",
value: function onMessageAck(e) {
var r = e.header
, i = e.body
, a = r.sMid
, s = r.traceId;
if (a) {
var u = this.getMap(a);
if (u) {
var c = u.resolve
, l = u.reject
, d = u.action
, f = (0,
m.processBody)(i, d)
, v = f.code
, h = f.msg
, y = f.data;
v !== p.EStatusCodes.SUCCESS ? l(_.BaseError.create({
code: v,
message: h
}, h, {
traceId: s,
data: i
})) : c({
code: v,
msg: h,
data: y,
headers: {
sMid: a,
traceId: s
}
}),
this.deleteMap(a)
} else
this.ctx.transport.onError(g.LonglinkError.create(g.ERR_TYPE.TransportMsgMapFailed, "未找到 ".concat(a, " 的消息映射,可能是未发该消息")))
}
}
}, {
key: "onBridgeMessageAck",
value: function onBridgeMessageAck(e, r, i) {
var a;
if ((null == i ? void 0 : null === (a = i.value) || void 0 === a ? void 0 : a.payload) !== "null")
try {
var s = this.getMap(e)
, u = s.reject;
if (r)
s && u(g.LonglinkError.create(g.ERR_TYPE.TransportSendMsgFailed, "bridge send error", r));
else {
var c = i.result
, l = i.value;
if (c === p.EStatusCodes.SUCCESS) {
var d = l.payload;
if (d) {
var f = (0,
v.string2Object)(d);
this.onMessageAck(f)
}
} else {
var h = g.LonglinkError.create(g.ERR_TYPE.TransportSendMsgFailed, "bridge send ack error, result not success", i);
u(h),
this.ctx.transport.onError(h)
}
}
} catch (e) {
this.ctx.transport.onError(g.LonglinkError.create(g.ERR_TYPE.TransportSendMsgFailed, "bridge send ack error, catch", r))
}
}
}, {
key: "transportSend",
value: function transportSend(e, r, i) {
return this.ctx.transport.useBridge ? this.ctx.transport.send(r, i, this.onBridgeMessageAck.bind(this, e)) : (this.ctx.transport.healthCheck(),
this.ctx.transport.send(r, i))
}
}, {
key: "_canMsgRetry",
value: function _canMsgRetry() {
var e = this.ctx.readyState;
return !![p.ELongLinkState.AUTH].includes(e) || (this.ctx.transport.processError(g.LonglinkError.create(g.ERR_TYPE.TransportErrorStatus, "发消息重试时为 ".concat(e, " 态")), !1),
!1)
}
}, {
key: "sendMessage",
value: function sendMessage(e, r) {
var i, s, u = this, l = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {
useRetry: !0
}, d = (0,
v.ptime)(), g = this.ctx.config, m = (null == r ? void 0 : r.sMid) || (0,
v.genUuid)(), _ = (null == r ? void 0 : r.oneWay) || !1, w = (null == r ? void 0 : r.action) || "/send/message", E = {
bizId: (null == r ? void 0 : r.bizId) || g.bizId,
serviceId: (null == r ? void 0 : r.serviceId) || "general",
action: w,
oneWay: _,
sMid: m
};
_ && delete E.sMid,
Array.isArray(null == r ? void 0 : r.headerFilter) && r.headerFilter.forEach(function(e) {
null == E || delete E[e]
});
var S = null !== (s = null == r ? void 0 : r.messageType) && void 0 !== s ? s : f.EPacketType.MESSAGE
, T = this.ctx.transport.createPayload(S, E, e)
, b = T.packet
, k = T.payload;
this.ctx.emit(S === f.EPacketType.MESSAGE ? p.EVENTS.MESSAGE_SEND : p.EVENTS.REGISTER_EVENT_ACK, k);
var sender = function() {
return {
promise: new Promise(function(e, r) {
!_ && u.setMap(m, {
resolve: e,
reject: r,
action: w
}),
u.transportSend(_ ? "one-way" : m, k, b)
}
),
info: w
}
};
if (_)
return Promise.resolve(sender().promise),
Promise.resolve({
code: p.EStatusCodes.SUCCESS,
msg: "".concat(w, " ").concat(p.EStatusMessage.SUCCESS)
});
if (!l.useRetry)
return Promise.resolve(sender().promise);
var C = this;
return (0,
v.promiseTimeoutAndRetry)(sender, {
useRetry: l.useRetry,
retryAttempts: (null == l ? void 0 : l.retryAttempts) || g.sendRetryAttempts,
timeout: (null == l ? void 0 : l.timeout) || g.sendTimeout,
retryInterval: (null == l ? void 0 : l.retryInterval) || g.retryInterval
}, (i = a._(function(e, r) {
var i, a;
return c._(this, function(s) {
if (y("[sendMessage] failed", e, r.code, r.message),
C.ctx.tracker.push({
evt: h.EEvtName.MSG_NOT,
api: w,
extra: {
url: C.ctx.config.url,
err: r,
failCnt: e
}
}),
!C._canMsgRetry())
return [2, !0];
if ((i = null == r ? void 0 : r.code) !== p.EStatusCodes.SUCCESS) {
if ((a = (0,
v.octopusErrorCodeScope)(i)) === p.EErrorAvailable.Available)
return [2, !1];
if (a === p.EErrorAvailable.UnAvailable)
return [2, !0]
}
return [2, !1]
})
}),
function(e, r) {
return i.apply(this, arguments)
}
)).then(function(e) {
var r = e.result
, i = e.retryTimes
, a = e.retryErrors;
return u.ctx.tracker.push({
evt: h.EEvtName.MSG_OK,
ts: (0,
v.ptime)() - d,
cnt: i,
api: w,
extra: {
retryErrors: a
}
}),
r
}).catch(function(e) {
throw e
}).finally(function() {
u.deleteMap(m)
})
}
}, {
key: "setMap",
value: function setMap(e, r) {
this.sMidMap.set(e, r)
}
}, {
key: "getMap",
value: function getMap(e) {
return this.sMidMap.get(e)
}
}, {
key: "deleteMap",
value: function deleteMap(e) {
return this.sMidMap.delete(e)
}
}], [{
key: "create",
value: function create(e) {
return new this(e)
}
}]),
MsgManager
}();
r.MsgManager = w
},
21329: function(e, r, i) {
"use strict";
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.createFailed = r.createSuccess = void 0;
var a = i(10727);
r.createSuccess = function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : a.EStatusCodes.SUCCESS
, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : a.EStatusMessage.SUCCESS
, i = arguments.length > 2 ? arguments[2] : void 0;
return {
code: e,
msg: r,
data: i
}
}
;
r.createFailed = function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : a.EStatusCodes.FAILED
, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : a.EStatusMessage.FAILED
, i = arguments.length > 2 ? arguments[2] : void 0;
return {
code: e,
msg: r,
data: i
}
}
},
87014: function(e, r, i) {
"use strict";
var a, s, u = i(41622), c = i(51606), l = i(36102);
i(36277),
i(34333),
i(42876),
i(33933),
i(87989),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.pullLonglinkRoute = r.longlinkHostMap = void 0;
var d = i(10727)
, p = i(1266)
, f = i(70594)
, v = i(34493);
r.longlinkHostMap = (a = {},
c._(a, d.EEnv.BETA, "wss://apppush.beta.xiaohongshu.com:443/longlink"),
c._(a, d.EEnv.PROD, "wss://apppush-sh5.xiaohongshu.com:443/longlink"),
a);
var g = (s = {},
c._(s, d.EEnv.SIT, "https://edith.sit.xiaohongshu.com/api/sns/octopus/router/longlinkconfig"),
c._(s, d.EEnv.BETA, "https://edith.beta.xiaohongshu.com/api/sns/octopus/router/longlinkconfig"),
c._(s, d.EEnv.PROD, "https://edith.xiaohongshu.com/api/sns/octopus/router/longlinkconfig"),
s);
r.pullLonglinkRoute = function(e, i) {
return new Promise(function(a, s) {
var c, h = e.env, m = e.domain, _ = e.device, y = e.protocol, w = e.serviceTag, E = _ || {}, S = E.platform, T = E.os, b = E.appVersion, k = E.deviceId;
if ([d.EEnv.SIT, d.EEnv.BETA, d.EEnv.PROD].includes(h)) {
;(0,
v.httpFetch)(g[h], {
"Service-Tag": e.serviceTag || ""
}, {
domain: m,
protocol: "WS",
field: 0,
platform: S,
os: T,
ws: y === p.EProtocols.Websocket,
appVersion: b,
deviceId: k,
userId: i,
"Service-Tag": w
}, "GET").then((c = u._(function(e) {
var r, i, u, c, p, v;
return l._(this, function(l) {
return (null == (u = e.data) ? void 0 : null === (r = u.dns) || void 0 === r ? void 0 : r.chost) && ((null == u ? void 0 : u.port) || (null == u ? void 0 : null === (i = u.dns) || void 0 === i ? void 0 : i.port)) ? h === d.EEnv.SIT ? a({
longlinkHost: ["ws://".concat(u.dns.china[0], ":").concat(null == u ? void 0 : null === (c = u.dns) || void 0 === c ? void 0 : c.port, "/longlink")],
expires: null !== (p = null == u ? void 0 : u.validTime) && void 0 !== p ? p : new Date().getTime()
}) : a({
longlinkHost: ["wss://".concat(u.dns.chost, ":").concat(null == u ? void 0 : u.port, "/longlink")],
expires: null !== (v = null == u ? void 0 : u.validTime) && void 0 !== v ? v : new Date().getTime()
}) : s(f.BaseError.create(f.ERR_TYPE_BASE.HttpFetchError, "".concat(h, " 获取长连配置失败"))),
[2]
})
}),
function(e) {
return c.apply(this, arguments)
}
)).catch(function(e) {
s(f.BaseError.create(f.ERR_TYPE_BASE.HttpFetchError, e.message))
})
} else
a({
longlinkHost: [r.longlinkHostMap[h]],
expires: new Date().getTime()
})
}
)
}
},
275: function(e, r, i) {
"use strict";
var a = i(46490);
Object.defineProperty(r, "__esModule", {
value: !0
});
r.default = function ApmAdapter() {
a._(this, ApmAdapter)
}
},
39998: function(e, r) {
"use strict";
var i, a;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.EEvtName = void 0,
(a = r.EEvtName || (r.EEvtName = {})).CONN_OK = "conn_ok",
a.CONN_NOT = "conn_not",
a.RECONN_OK = "reconn_ok",
a.RECONN_NOT = "reconn_not",
a.AUTH_OK = "auth_ok",
a.AUTH_NOT = "auth_not",
a.BIND_OK = "bind_ok",
a.BIND_NOT = "bind_not",
a.MSG_STA = "msg_sta",
a.MSG_OK = "msg_ok",
a.MSG_NOT = "msg_not",
a.MSG_FAIL = "msg_fail",
a.ERR = "err",
a.CLOS = "clos",
a.API_OK = "api_ok",
a.API_NOT = "api_not",
a.LOGIN_OK = "login_ok",
a.LOGIN_NOT = "login_not",
a.NOT_READY = "not_ready",
a.SDK_READY = "sdk_ready",
a.SDK_ERROR = "sdk_error",
a.STORAGE_INIT = "storage_init",
a.STORAGE_SET = "storage_set",
a.STORAGE_GET = "storage_get"
},
65061: function(e, r) {
"use strict";
Object.defineProperty(r, "__esModule", {
value: !0
})
},
21155: function(e, r, i) {
"use strict";
var a, s, u, c, l = i(46490), d = i(90251), p = i(70879), f = i(27337);
i(34885),
i(75973),
i(87535),
i(75204),
i(97357),
i(34333),
i(7608),
i(42876),
i(33933);
var v = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.Metrics = r.EMetricsEventName = r.EMetricsSdkEventName = void 0;
var g = v(i(15876))
, h = i(74794);
(a = r.EMetricsSdkEventName || (r.EMetricsSdkEventName = {})).MISS_PROPERTY = "sdk_miss_property",
a.ENCODE_FAILED = "sdk_encode_failed",
a.DECODE_FAILED = "sdk_decode_failed",
a.WRONG_TYPE = "sdk_wrong_type",
a.WRITE_FAILED = "sdk_write_failed",
(s = c = r.EMetricsEventName || (r.EMetricsEventName = {})).CONNECT_TIME = "connect_time",
s.CONNECT_FAILED = "connect_failed",
s.AUTH_TIME = "auth_time",
s.AUTH_FAILED = "auth_failed",
s.SEND_TIME = "send_time",
s.SEND_FAILED = "send_failed",
s.PING_TIME = "ping_time",
s.PING_FAILED = "ping_failed",
s.ERR_MSG = "err_msg",
s.CLOSE_EVENT = "close_event",
s.RECONNECT_EVT = "reconnect_evt",
s.RECONNECT_FAILED = "reconnect_failed",
s.MSG_DOWN = "msg_down",
s.PUSH_MSG = "push_msg";
var m = function() {
function Metrics(e, r) {
l._(this, Metrics),
e.app,
e.version;
var i = e.url;
e.domain,
e.authType,
e.uid,
this.artifactName = r.artifactName,
this.artifactVersion = r.artifactVersion,
this.base = {
url: i
},
this._repeatEvt = {}
}
return d._(Metrics, [{
key: "sendApm",
value: function sendApm(e) {
this.base.url.indexOf("wss");
var r = {
app: {
type: "App",
value: {
platform: {
type: "Platform",
value: "PC"
},
appVersion: "discovery-0.0.0",
artifactName: this.artifactName || "@xhs/red-longlink",
artifactVersion: this.artifactVersion || "0.0.0"
}
},
mob: {
type: "Mobile",
value: {
osVersion: "unknow"
}
},
dvc: {
type: "Device",
value: {
dvceId: ""
}
},
network: {
type: "Network",
value: {
networkType: {
type: "NetworkType",
value: "unknow"
}
}
},
browser: {
type: "Browser",
value: {
matchedPath: "",
route: "",
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36",
sessionId: "-"
}
},
user: {
type: "User",
value: {
userId: "-"
}
},
frontApmTracker: {
type: "FrontApmTracker",
value: {
InfraRedImWeb: {
type: "InfraRedImWeb",
value: e
}
}
}
};
(0,
g.default)("https://fe.xiaohongshu.com/faas/proto/json-to-proto-json-to-proto/proxy", r, {
maxComboNum: 6,
collectTime: 6e3
})
}
}, {
key: "sendRepeat",
value: function sendRepeat() {
var e = this;
Object.keys(this._repeatEvt).forEach(function(r) {
e.sendApm(e._repeatEvt[r])
}),
this._repeatEvt = {},
clearTimeout(this._repeatTimmer),
this._repeatTimmer = void 0
}
}, {
key: "push",
value: function push(e, r, i, a) {
var s, u = this, l = f._(p._({}, this.base), {
sdkTime: (0,
h.now)(),
evt: e,
ts: r,
extra: JSON.stringify(i),
content: JSON.stringify(a || {})
}), d = [c.ERR_MSG, c.CLOSE_EVENT, c.RECONNECT_EVT];
(null == d ? void 0 : d.includes(e)) ? (this._repeatEvt[e] = l,
(null === (s = this._repeatEvt) || void 0 === s ? void 0 : s.hasOwnProperty(e)) && (this._repeatTimmer = setTimeout(function() {
u.sendRepeat()
}, 8e3))) : (e === c.PING_TIME && (this.sendRepeat(),
clearTimeout(this._repeatTimmer),
this._repeatTimmer = void 0),
this.sendApm(l))
}
}]),
Metrics
}();
r.Metrics = m
},
61700: function(e, r, i) {
"use strict";
var a = i(35329)
, s = i(46490)
, u = i(90251)
, c = i(51606)
, l = i(27292)
, d = i(70879)
, p = i(27337);
i(86651),
i(7608),
i(58051);
var f = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.NewApm = void 0;
var v = f(i(15876))
, g = i(74794)
, h = f(i(275))
, m = i(39998)
, _ = i(34493)
, y = function(e) {
function NewApm(e) {
var r, i;
return s._(this, NewApm),
(r = a._(this, NewApm)).ctx = e,
r.prodUrl = "https://apm-fe.xiaohongshu.com/api/data",
r.testUrl = "https://apm-fe-test.xiaohongshu.com/api/data",
r.cnt_map = (i = {},
c._(i, m.EEvtName.MSG_STA, 0),
c._(i, m.EEvtName.MSG_OK, 0),
i),
r
}
return l._(NewApm, e),
u._(NewApm, [{
key: "collect",
value: function collect(e) {
e === m.EEvtName.MSG_STA && (this.cnt_map[m.EEvtName.MSG_STA] += 1),
e === m.EEvtName.MSG_OK && (this.cnt_map[m.EEvtName.MSG_OK] += 1);
var r = this.cnt_map[m.EEvtName.MSG_STA]
, i = this.cnt_map[m.EEvtName.MSG_OK];
r > 5 && (this.push({
evt: m.EEvtName.MSG_STA,
cnt: r,
ts: i
}),
this.cnt_map[m.EEvtName.MSG_STA] = 0,
this.cnt_map[m.EEvtName.MSG_OK] = 0)
}
}, {
key: "push",
value: function push(e, r) {
var i, a, s, u, c = null === (i = this.ctx) || void 0 === i ? void 0 : i.trackerCtx();
if (!!(null === (s = null == c ? void 0 : c.trackerEnable) || void 0 === s || s)) {
var l = (null == r ? void 0 : r.networkType) || c.context_networkType
, f = {
clientEventTime: (0,
g.now)(),
clientTime: (0,
g.now)(),
context_nameTracker: c.context_nameTracker,
context_platform: c.context_platform,
context_appVersion: c.context_appVersion,
context_osVersion: c.context_osVersion,
context_deviceModel: c.context_deviceModel,
context_deviceId: c.context_deviceId,
context_package: c.context_package,
context_networkType: l,
context_matchedPath: c.context_matchedPath,
context_route: c.context_route,
context_userAgent: c.context_userAgent,
context_artifactName: c.context_artifactName,
context_artifactVersion: c.context_artifactVersion,
context_networkQuality: c.context_networkQuality,
context_userId: c.context_userId,
measurement_name: c.measurement_name,
measurement_data: p._(d._({}, e), {
env: this.ctx.env,
extra: JSON.stringify(Object.assign(null !== (u = e.extra) && void 0 !== u ? u : {}, {
traceid: (0,
_.getFetchCtx)()
}))
})
}
, h = this.prodUrl;
(null === this || void 0 === this ? void 0 : null === (a = this.ctx) || void 0 === a ? void 0 : a.trackerLog) && (0,
g.log)("%c [埋点数据]", "color:#0f0;", null == e ? void 0 : e.evt, h, f);
try {
(0,
v.default)(h, f, {
maxComboNum: this.ctx.maxComboNum,
collectTime: 3e3
})
} catch (e) {}
}
}
}]),
NewApm
}(h.default);
r.NewApm = y
},
41172: function(e, r) {
"use strict";
function createClose(e) {
return {
code: e.code,
reason: e.reason,
wasClean: (null == e ? void 0 : e.wasClean) || !1
}
}
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.createClose = r.CLOSE_TYPE = void 0,
r.CLOSE_TYPE = {
WsAbnormal: {
code: 1006,
reason: "服务异常断连"
},
Kickout: {
code: 3103,
reason: "下推异常,服务重启"
},
User: {
code: 4e3,
reason: "用户自主断连"
},
PingTimeout: {
code: 4001,
reason: "长连接心跳超时断连"
},
HealthCheck: {
code: 4002,
reason: "健康检查失败关闭"
},
ReconnectClose: {
code: 4004,
reason: "用户重连断连"
},
ConnectTimeoutClose: {
code: 4005,
reason: "连接超时关闭"
},
Frequent: {
code: 5104300,
reason: "长连接频繁断连"
},
Abnormal: {
code: 5104301,
reason: "长连接异常断连"
},
NetworkFail: {
code: 5104302,
reason: "长连接因网络断开被关闭"
}
},
r.createClose = createClose
},
44509: function(e, r, i) {
"use strict";
var a = i(35329)
, s = i(46490)
, u = i(27292)
, c = i(30961);
i(41593),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.CustomAggregateError = void 0;
var l = function(e) {
function CustomAggregateError(e) {
var r, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "Multiple errors occurred", u = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
return s._(this, CustomAggregateError),
(r = a._(this, CustomAggregateError, [i])).errors = e,
r.message = i,
r.cnt = u,
r.name = "CustomAggregateError",
r.errors = e,
r
}
return u._(CustomAggregateError, e),
CustomAggregateError
}(c._(Error));
r.CustomAggregateError = l
},
79066: function(e, r, i) {
"use strict";
var a = i(35329)
, s = i(46490)
, u = i(27292);
i(75973),
i(82427),
i(36062),
i(57057),
i(97357),
i(34333),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.LonglinkError = r.ERR_CODE = r.ERR_TYPE = void 0;
var c = i(70594);
r.ERR_TYPE = {
WebSocketErrorCreate: {
code: 5104100,
message: "创建 WebSocket 错误"
},
WebSocketErrorEvent: {
code: 5104101,
message: "WebSocket 运行时错误"
},
BridgeErrorCreate: {
code: 5104102,
message: "Bridge 通道连接错误"
},
BridgeErrorEvent: {
code: 5104103,
message: "Bridge 通道运行时错误"
},
TransportErrorWriteData: {
code: 5104200,
message: "上行数据错误"
},
TransportUnknowPacket: {
code: 5104201,
message: "收到未知类型的包"
},
TransportConnFailed: {
code: 5104202,
message: "通道连接失败"
},
TransportAuthFailed: {
code: 5104203,
message: "通道鉴权失败"
},
TransportBindFailed: {
code: 5104204,
message: "虚拟绑定失败"
},
TransportPingTimeout: {
code: 5104205,
message: "通道心跳超时"
},
TransportWrongType: {
code: 5104206,
message: "不支持该类型包"
},
TransportReconnectFailed: {
code: 5104207,
message: "通道重连失败"
},
TransportDownMsgFailed: {
code: 5104208,
message: "解析下行消息失败"
},
FrequentClose: {
code: 5104209,
message: "通道频繁断连"
},
AbnormalClose: {
code: 5104210,
message: "通道异常断连"
},
TransportSendMsgFailed: {
code: 5104211,
message: "发送消息失败"
},
TransportMsgMapFailed: {
code: 5104212,
message: "消息 smid 映射查找失败"
},
TransportErrorStatus: {
code: 5104213,
message: "长连不在正确状态下操作"
},
TransportPreConnectClose: {
code: 5104214,
message: "上次连接 close 回调"
}
},
r.ERR_CODE = Object.keys(r.ERR_TYPE).reduce(function(e, i) {
return e[i] = r.ERR_TYPE[i].code,
e
}, {});
var l = function(e) {
function LonglinkError(e) {
return s._(this, LonglinkError),
a._(this, LonglinkError, [e])
}
return u._(LonglinkError, e),
LonglinkError
}(c.BaseError);
r.LonglinkError = l
},
70594: function(e, r, i) {
"use strict";
var a = i(35329)
, s = i(46490)
, u = i(90251)
, c = i(27292)
, l = i(30961);
i(75973),
i(82427),
i(36062),
i(57057),
i(97357),
i(34333),
i(41593),
i(7608),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.BaseError = r.ERR_CODE = r.ERR_TYPE_BASE = r.EMPTY_ERROR_CODE = void 0,
r.EMPTY_ERROR_CODE = -1,
r.ERR_TYPE_BASE = {
DefaultError: {
code: 5104001,
message: "sdk default error"
},
TimeoutError: {
code: 5104002,
message: "sdk timeout error"
},
HttpFetchError: {
code: 5104003,
message: "http fetch error"
}
},
r.ERR_CODE = Object.keys(r.ERR_TYPE_BASE).reduce(function(e, i) {
return e[i] = r.ERR_TYPE_BASE[i].code,
e
}, {});
var d = function(e) {
function BaseError(e) {
s._(this, BaseError);
var r, i = e.errType, u = e.message, c = e.detail;
return (r = a._(this, BaseError, [u])).retryTimes = 0,
r.retryErrors = [],
r.code = i.code,
r.detail = c,
r
}
return c._(BaseError, e),
u._(BaseError, [{
key: "toString",
value: function toString() {
return JSON.stringify({
code: this.code,
message: this.message,
detail: this.detail,
retryTimes: this.retryTimes,
retryErrors: this.retryErrors
})
}
}], [{
key: "create",
value: function create() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : r.ERR_TYPE_BASE.DefaultError
, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e.message
, a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}
, s = {};
return (null == a ? void 0 : a.code) && (s.code = a.code),
(null == a ? void 0 : a.reason) && (s.reason = a.reason),
(null == a ? void 0 : a.message) && (s.message = a.message),
(null == a ? void 0 : a.wasClean) && (s.wasClean = a.wasClean),
(null == a ? void 0 : a.isTrusted) && (s.wasClean = a.isTrusted),
new this({
errType: e,
message: i || e.message,
detail: {}
})
}
}]),
BaseError
}(l._(Error));
r.BaseError = d,
d.ERR_CODE = r.ERR_CODE
},
87853: function(e, r, i) {
"use strict";
i(34885),
i(95477),
i(58486),
i(72169),
i(87989),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.getDefaultDeviceInfo = r.getUA = r.getDeviceInfo = r.networkStatus = void 0;
var a = i(1266)
, s = i(74794);
r.networkStatus = function() {
return 1
}
;
function getFingerPrint() {
return "".concat((0,
s.now)())
}
function getPlatform() {
return a.EPlatformType.BROWSER
}
function getOS() {
return a.EOSType.WEB
}
function getUA() {
return "undefined" == typeof window || window.navigator ? "not-browser-ua" : window.navigator.userAgent
}
function getDefaultDeviceInfo(e) {
if (null !== e.deviceInfo)
return e.deviceInfo;
var i = (0,
r.getDeviceInfo)()
, a = {
deviceId: (0,
s.genUuid)(),
fingerprint: getFingerPrint(),
platform: getPlatform(),
os: getOS(),
osVersion: i.osVersion,
deviceName: i.browserName,
appVersion: i.browserVersion,
userAgent: i.userAgent || "ua"
};
return e.deviceInfo = a,
a
}
r.getDeviceInfo = function() {
var e, r, i, a, s, u, c = null !== (r = null === (e = navigator) || void 0 === e ? void 0 : e.userAgent) && void 0 !== r ? r : "";
return c.indexOf("Opera") > -1 || c.indexOf("OPR") > -1 ? (i = "Opera",
a = (a = c.match(/(Opera|OPR)\/?\s*(\.?\d+(\.\d+)*)/i)) ? a[2] : "0.0.0") : c.indexOf("Edg") > -1 ? (i = "Microsoft Edge",
a = (a = c.match(/(Edg)\/?\s*(\.?\d+(\.\d+)*)/i)) ? a[2] : "0.0.0") : c.indexOf("Chrome") > -1 ? (i = "Chrome",
a = (a = c.match(/(Chrome)\/?\s*(\.?\d+(\.\d+)*)/i)) ? a[2] : "0.0.0") : c.indexOf("Safari") > -1 ? (i = "Safari",
a = (a = c.match(/(Safari)\/?\s*(\.?\d+(\.\d+)*)/i)) ? a[2] : "0.0.0") : c.indexOf("Firefox") > -1 ? (i = "Firefox",
a = (a = c.match(/(Firefox)\/?\s*(\.?\d+(\.\d+)*)/i)) ? a[2] : "0.0.0") : (i = "Unknown",
a = "0.0.0"),
-1 !== c.indexOf("Windows") ? (s = "Windows",
u = (u = c.match(/Windows NT\s*(\d+\.\d+)/)) ? u[1] : "Unknown") : -1 !== c.indexOf("Mac OS X") ? (s = "macOS",
u = (u = c.match(/Mac OS X\s*(\d+[_.]\d+)/)) ? u[1].replace(/_/g, ".") : "Unknown") : -1 !== c.indexOf("Android") ? (s = "Android",
u = (u = c.match(/Android\s*(\d+\.\d+)/)) ? u[1] : "Unknown") : (-1 !== c.indexOf("Linux") ? s = "Linux" : s = "Unknown",
u = "Unknown"),
{
browserName: i,
browserVersion: a,
osName: s,
osVersion: u,
userAgent: c
}
}
,
r.getUA = getUA,
r.getDefaultDeviceInfo = getDefaultDeviceInfo
},
34493: function(e, r, i) {
"use strict";
var a, s = i(70879), u = i(27337);
i(42876),
i(33933),
i(36277),
i(34333),
i(87989);
var c = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
}
;
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.setFetchCtx = r.getFetchCtx = r.httpFetch = void 0;
var l = c(i(86246))
, d = i(70594)
, p = i(25834)
, f = i(74794)
, v = l.default.create({
timeout: 1e4,
headers: {
"Content-Type": "application/json"
}
});
v.interceptors.response.use(function(e) {
var r, i;
if (!(null == e ? void 0 : null === (i = e.config) || void 0 === i ? void 0 : null === (r = i.url) || void 0 === r ? void 0 : r.includes("apm-fe"))) {
var a = (0,
p.processHttpRes)(e);
if (200 !== a.status) {
var s = a.headers
, u = (null == a ? void 0 : a.statusText) || "http request failed";
return Promise.reject(d.BaseError.create({
code: a.status || -1,
message: u
}, u, {
status: a.status,
traceId: (null == s ? void 0 : s["request-id"]) || "empty-trace-id",
data: a.data
}))
}
}
return e
}, function(e) {
return Promise.reject(e)
});
var g = function(e, r, i) {
var a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "POST"
, c = arguments.length > 4 ? arguments[4] : void 0;
return new Promise(function(l, p) {
var g = (c || {}).disbaleTrace
, h = s._({
"Content-Type": "application/json"
}, r);
!g && (h["x-b3-traceid"] = (0,
f.genTraceId)()),
v({
url: e,
method: a,
params: "GET" === a ? i : void 0,
headers: h,
data: "POST" === a ? i : void 0
}).then(function(e) {
l(u._(s._({}, e.data), {
headers: e.headers
}))
}).catch(function(r) {
r.response ? p(d.BaseError.create(d.ERR_TYPE_BASE.HttpFetchError, "request(".concat(e, ") send but response code = ").concat(r.response.status), r.response)) : r.request ? p(d.BaseError.create(d.ERR_TYPE_BASE.HttpFetchError, "request(".concat(e, ") send with no response"), null == r ? void 0 : r.config)) : p(r)
})
}
)
}
, h = function() {
return a
}
, m = function(e) {
a = e
};
r.httpFetch = g,
r.getFetchCtx = h,
r.setFetchCtx = m
},
15876: function(e, r, i) {
"use strict";
var a = i(41622)
, s = i(36102);
i(7608),
i(86651),
i(36277),
i(34333),
i(87989),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.destroy = void 0;
var u = i(34493)
, c = Function("return this")();
c.__APM_COMBO_CACHE_GROUP__ = null;
var l = !1
, d = null;
function sendByHttp(e, r) {
return (0,
u.httpFetch)(e, {
"Biz-Type": "apm_fe",
Batch: !0
}, r, "POST", {
disbaleTrace: !0
})
}
function requestCombo(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}
, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}
, u = i.request
, p = void 0 === u ? null : u
, f = i.isCombo
, v = void 0 === f || f
, g = i.maxComboNum
, h = void 0 === g ? 5 : g
, m = i.collectTime
, _ = void 0 === m ? 1e3 * h : m
, y = i.callback
, w = void 0 === y ? null : y;
if (e && "{}" !== JSON.stringify(r)) {
var E, S = (E = a._(function() {
var e, r, i, a, u;
return s._(this, function(s) {
switch (s.label) {
case 0:
if (s.trys.push([0, 3, , 4]),
!(null === (e = c.__APM_COMBO_CACHE_GROUP__) || void 0 === e ? void 0 : e.data.length))
return [3, 2];
return i = (r = c.__APM_COMBO_CACHE_GROUP__).key,
a = r.data,
clearTimeout(r.timer),
c.__APM_COMBO_CACHE_GROUP__ = null,
[4, (p || sendByHttp).call(null, i, a)];
case 1:
return [2, s.sent()];
case 2:
return [3, 4];
case 3:
return s.sent(),
[3, 4];
case 4:
return [2, null]
}
})
}),
function fetch() {
return E.apply(this, arguments)
}
);
return !l && (l = !0),
new Promise(function(i, a) {
if (v) {
if (e) {
var s;
if (d = e,
!(null === (s = c.__APM_COMBO_CACHE_GROUP__) || void 0 === s ? void 0 : s.key) && (c.__APM_COMBO_CACHE_GROUP__ = {
key: e,
data: [],
timer: setTimeout(function() {
var e, r = null === (e = c.__APM_COMBO_CACHE_GROUP__) || void 0 === e ? void 0 : e.data;
S().then(function(e) {
null == w || w(r),
i(e)
}).catch(function(e) {
a(e)
})
}, _)
}),
c.__APM_COMBO_CACHE_GROUP__.data.push(r),
c.__APM_COMBO_CACHE_GROUP__.data.length >= h) {
var u, l = null === (u = c.__APM_COMBO_CACHE_GROUP__) || void 0 === u ? void 0 : u.data;
S().then(function(e) {
null == w || w(l),
i(e)
}).catch(function(e) {
a(e)
})
}
} else
a("接口 url: ".concat(e, " 不能为空"))
} else
p.call(null, e, r).then(function(e) {
i(e)
}).catch(function(e) {
a(e)
})
}
)
}
}
function destroy() {
var e;
(null === (e = c.__APM_COMBO_CACHE_GROUP__) || void 0 === e ? void 0 : e.data.length) && d && (navigator.sendBeacon(d, JSON.stringify(c.__APM_COMBO_CACHE_GROUP__.data)),
c.__APM_COMBO_CACHE_GROUP__ = null)
}
r.default = requestCombo,
r.destroy = destroy
},
92381: function(e, r, i) {
"use strict";
var a, s, u, c = i(41622), l = i(36102);
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.defaultStorage = void 0;
var d = {
setItem: (a = c._(function(e, r) {
return l._(this, function(i) {
try {
return localStorage.setItem(e, r),
[2, r]
} catch (e) {
return [2, null]
}
return [2]
})
}),
function(e, r) {
return a.apply(this, arguments)
}
),
getItem: (s = c._(function(e) {
var r;
return l._(this, function(i) {
try {
if (r = localStorage.getItem(e),
null !== r)
return [2, r];
return [2, null]
} catch (e) {
return [2, null]
}
return [2]
})
}),
function(e) {
return s.apply(this, arguments)
}
),
removeItem: (u = c._(function(e) {
return l._(this, function(r) {
try {
localStorage.removeItem(e)
} catch (e) {}
return [2]
})
}),
function(e) {
return u.apply(this, arguments)
}
)
};
r.defaultStorage = d
},
74794: function(e, r, i) {
"use strict";
var a = i(15313).Buffer
, s = i(41622)
, u = i(70879)
, c = i(36102);
i(6045),
i(10364),
i(67673),
i(19077),
i(75973),
i(42876),
i(33933),
i(87394),
i(94941),
i(48421),
i(97357),
i(34333),
i(34885),
i(36277),
i(27461),
i(23339),
i(51109),
i(87989),
i(9557),
i(55947),
i(87535),
i(75204),
i(86651),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.promiseTimeoutAndRetry = r.isString = r.merge = r.formatMetricsError = r.isEmptyString = r.isCloseEvent = r.isObject = r.isRawData = r.genTraceId = r.genMidId = r.genUuid = r.isAbnormalClose = r.notNeedEmitClose = r.isUserClose = r.diffTime = r.ptime = r.now = r.timeoutPromise = r.uniq = r.octopusErrorCodeScope = r.string2Object = r.formatErrors = r.log = void 0;
var l = i(50142)
, d = i(10727)
, p = i(41172)
, f = i(44509)
, v = i(70594)
, g = i(34493);
r.log = console.log.bind(console);
r.formatErrors = function(e) {
return (null == e ? void 0 : e.map(function(e) {
return {
code: e.code,
message: e.message
}
})) || []
}
;
r.string2Object = function(e) {
return "string" == typeof e ? JSON.parse(e) : e
}
;
r.octopusErrorCodeScope = function(e) {
if (e) {
if ([v.ERR_TYPE_BASE.DefaultError.code, v.ERR_TYPE_BASE.TimeoutError.code, v.ERR_TYPE_BASE.HttpFetchError.code].includes(e) || -1 === e || e >= 5e6 && e < 5003e3)
return d.EErrorAvailable.Available;
if (5104213 === e || e >= 2e6 && e <= 2009999 || e >= 3e6 && e <= 3009999 || e >= 31e5 && e <= 3109999)
return d.EErrorAvailable.UnAvailable
}
return d.EErrorAvailable.Other
}
;
function timeoutPromise() {
var e, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 5e3, i = arguments.length > 1 ? arguments[1] : void 0, a = arguments.length > 2 ? arguments[2] : void 0, s = arguments.length > 3 ? arguments[3] : void 0;
return Promise.race([new Promise(function(i, u) {
e = setTimeout(function() {
s && s(),
u(a)
}, r)
}
), i]).then(function(r) {
return clearTimeout(e),
r
}).catch(function(r) {
throw clearTimeout(e),
r
})
}
function now() {
return new Date().getTime()
}
function ptime() {
return now()
}
function diffTime(e) {
if (e)
return now() - e
}
function isUserClose(e) {
return [p.CLOSE_TYPE.User.code, p.CLOSE_TYPE.ReconnectClose.code].includes(null == e ? void 0 : e.code)
}
function notNeedEmitClose(e) {
return [p.CLOSE_TYPE.ReconnectClose.code, p.CLOSE_TYPE.HealthCheck.code, p.CLOSE_TYPE.PingTimeout.code].includes(null == e ? void 0 : e.code)
}
function isAbnormalClose(e) {
return [p.CLOSE_TYPE.WsAbnormal.code, p.CLOSE_TYPE.Kickout.code, p.CLOSE_TYPE.PingTimeout.code].includes(e.code)
}
function genUuid() {
return "".concat(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16), "-").concat(new Date().getTime().toString(16))
}
function genMidId() {
return genUuid()
}
function genTraceId() {
var e = (0,
l.traceId)();
return (0,
g.setFetchCtx)(e),
e
}
r.uniq = function(e) {
return e ? e.filter(function(r, i) {
return e.indexOf(r, 0) === i
}) : []
}
,
r.timeoutPromise = timeoutPromise,
r.now = now,
r.ptime = ptime,
r.diffTime = diffTime,
r.isUserClose = isUserClose,
r.notNeedEmitClose = notNeedEmitClose,
r.isAbnormalClose = isAbnormalClose,
r.genUuid = genUuid,
r.genMidId = genMidId,
r.genTraceId = genTraceId;
r.isRawData = function(e) {
return "string" == typeof e || e instanceof a
}
;
r.isObject = function(e) {
return "[object Object]" === Object.prototype.toString.call(e)
}
;
r.isCloseEvent = function(e) {
return "[object CloseEvent]" === Object.prototype.toString.call(e)
}
;
function formatMetricsError(e, r) {
return {
type: e,
detail: r
}
}
function merge(e) {
for (var i = arguments.length, a = Array(i > 1 ? i - 1 : 0), s = 1; s < i; s++)
a[s - 1] = arguments[s];
var c = u._({}, e);
return e && a ? (null == a || a.forEach(function(e) {
e && Object.keys(e).forEach(function(i) {
var a = c[i]
, s = e[i];
Array.isArray(a) && Array.isArray(s) ? c[i] = a.concat(s) : (0,
r.isObject)(a) && (0,
r.isObject)(s) ? c[i] = merge(a, s) : (0,
r.isObject)(s) ? c[i] = merge({}, s) : c[i] = s
})
}),
c) : c
}
function isString(e) {
return "string" == typeof e || e instanceof String
}
function promiseTimeoutAndRetry(e) {
return _promiseTimeoutAndRetry.apply(this, arguments)
}
function _promiseTimeoutAndRetry() {
return (_promiseTimeoutAndRetry = s._(function(e) {
var i, a, u, l, d, p, g, h, m = arguments;
function getArrayItem(e) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0
, i = e || [5e3]
, a = h[r];
if (a < i.length) {
var s = i[a];
return h[r] += 1,
s
}
return i[i.length - 1]
}
function sendOrRetry(e, r) {
return _sendOrRetry.apply(this, arguments)
}
function _sendOrRetry() {
return (_sendOrRetry = s._(function(e, s) {
var h, m, _, y, w, E, S, T, b, k;
return c._(this, function(c) {
switch (c.label) {
case 0:
_ = (m = (h = e)()).promise,
y = m.info,
w = m.transportType,
c.label = 1;
case 1:
return c.trys.push([1, 3, , 7]),
[4, Promise.race([_, new Promise(function(e, r) {
return setTimeout(function() {
return r(v.BaseError.create(v.ERR_TYPE_BASE.TimeoutError, "", {
transportType: w,
info: y
}))
}, Array.isArray(p) ? getArrayItem(p, 1) : p)
}
)])];
case 2:
return E = c.sent(),
u && u(E),
[2, {
result: E,
retryTimes: s,
retryErrors: (0,
r.formatErrors)(l),
transportType: w
}];
case 3:
if (S = c.sent(),
l.push(S),
!i.useRetry)
throw new f.CustomAggregateError(l,"no retry option",0);
if (T = !1,
!a)
return [3, 5];
return [4, a(s, S, w)];
case 4:
b = c.sent(),
(0,
r.isObject)(b) ? (T = b.stop,
b.newPromise && (h = b.newPromise)) : T = b,
c.label = 5;
case 5:
if (s >= d || T)
throw new f.CustomAggregateError(l,"[".concat(y, "] failed after retry ").concat(T ? s : d, " times"),s);
return k = Array.isArray(g) ? getArrayItem(g, 0) : g,
[4, new Promise(function(e) {
return setTimeout(e, k)
}
)];
case 6:
return c.sent(),
[2, sendOrRetry(h, s + 1)];
case 7:
return [2]
}
})
})).apply(this, arguments)
}
return c._(this, function(r) {
return i = m.length > 1 && void 0 !== m[1] ? m[1] : {
timeout: 3e3,
retryAttempts: 3,
retryInterval: 1e3,
useRetry: !0
},
a = m.length > 2 ? m[2] : void 0,
u = m.length > 3 ? m[3] : void 0,
l = [],
d = i.retryAttempts,
p = i.timeout,
g = i.retryInterval,
h = [0, 0],
[2, sendOrRetry(e, 0)]
})
})).apply(this, arguments)
}
r.isEmptyString = function(e) {
return void 0 === e || "" === e
}
,
r.formatMetricsError = formatMetricsError,
r.merge = merge,
r.isString = isString,
r.promiseTimeoutAndRetry = promiseTimeoutAndRetry
},
50142: function(e, r, i) {
"use strict";
i(87989),
i(34333),
i(55947),
i(57015),
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.traceId = void 0;
var a = i(73271)
, s = i(2044);
function traceId() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : Date.now();
return "".concat(s.fromNumber(e, !0).shiftLeft(23).or(a.Int.seq()).toString(16).padStart(16, "0")).concat(new s(a.Int.random(32),a.Int.random(32),!0).toString(16).padStart(16, "0"))
}
r.traceId = traceId
},
2605: function(e, r, i) {
"use strict";
var a = i(46490)
, s = i(90251)
, u = i(51606);
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.Int = void 0;
var c = function() {
function Int() {
a._(this, Int)
}
return s._(Int, null, [{
key: "random",
value: function random(e) {
return Math.floor(Math.random() * Math.pow(2, e))
}
}, {
key: "seq",
value: function seq() {
return Int.SEQ > Int.MAX_SEQ && (Int.SEQ = 0),
Int.SEQ++
}
}]),
Int
}();
u._(c, "MAX_SEQ", 8388607),
u._(c, "SEQ", c.random(23)),
r.Int = c
},
73271: function(e, r, i) {
"use strict";
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.Int = void 0;
var a = i(2605);
Object.defineProperty(r, "Int", {
enumerable: !0,
get: function get() {
return a.Int
}
})
},
49264: function(e, r) {
"use strict";
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.XRAY_TRACE_HEADER_NAME = void 0,
r.XRAY_TRACE_HEADER_NAME = "x-xray-traceid"
},
50934: function(e, r, i) {
"use strict";
i(87989),
i(34333),
i(55947),
i(57015);
r.XRAY_TRACE_HEADER_NAME = void 0;
var a, s = i(61327), u = i(7448), c = i(49264);
function traceId() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : Date.now();
return "".concat(u.fromNumber(e, !0).shiftLeft(23).or(s.Int.seq()).toString(16).padStart(16, "0")).concat(new u(s.Int.random(32),s.Int.random(32),!0).toString(16).padStart(16, "0"))
}
Object.defineProperty(r, "XRAY_TRACE_HEADER_NAME", {
enumerable: !0,
get: function get() {
return c.XRAY_TRACE_HEADER_NAME
}
})
},
80280: function(e, r, i) {
"use strict";
var a = i(46490)
, s = i(90251)
, u = i(51606);
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.Int = void 0;
var c = function() {
function Int() {
a._(this, Int)
}
return s._(Int, null, [{
key: "random",
value: function random(e) {
return Math.floor(Math.random() * Math.pow(2, e))
}
}, {
key: "seq",
value: function seq() {
return Int.SEQ > Int.MAX_SEQ && (Int.SEQ = 0),
Int.SEQ++
}
}]),
Int
}();
u._(c, "MAX_SEQ", 8388607),
u._(c, "SEQ", c.random(23)),
r.Int = c
},
61327: function(e, r, i) {
"use strict";
Object.defineProperty(r, "__esModule", {
value: !0
}),
r.Int = void 0;
var a = i(80280);
Object.defineProperty(r, "Int", {
enumerable: !0,
get: function get() {
return a.Int
}
})
},
51409: function(e) {
"use strict";
e.exports = JSON.parse('{"name":"@xhs/red-longlink","version":"2.0.15","keywords":["xhs","longlink","websocket","octopus"],"author":"yanhui <yanhui1@xiaohongshu.com>","description":"IM 长连层, 为上层 SDK 封装传输层能力, 提供事件、状态订阅能力","directories":{"test":"tests","lib":"dist"},"maintainers":["feci"],"scripts":{"dev":"tsc -w","prepublishOnly":"npm run build","build":"tsc","test":"DEBUG=longlink:test && jest"},"publishConfig":{"registry":"http://npm.devops.xiaohongshu.com:7001"},"files":["dist/**/*"],"license":"ISC","main":"dist/index.js","module":"dist/index.js","types":"dist/index.d.ts","dependencies":{"@xhs/ozone-schema":"1.142.0","@xhs/untrace":"0.0.1","axios":"0.19.2","esm":"^3.2.25","events":"^3.2.0","isomorphic-ws":"^4.0.1","tiny-typed-emitter":"^2.1.0"},"devDependencies":{"@types/events":"^3.0.0","@types/node":"^20.3.1","@types/ws":"^8.5.5","debug":"4.3.4","vue-tsc":"^1.0.9"},"peerDependencies":{"@react-native-async-storage/async-storage":"*"},"gitHead":"646a2358d50a82017cde8304bc3b2234ffd298d1"}')
}
}]);
//# sourceMappingURL=https://picasso-private-1251524319.cos.ap-shanghai.myqcloud.com/data/formula-static/formula/xhs-pc-web/vendor-dynamic.3e7bc84b.js.map