四川:成都尧棠公馆-全球奢华精品酒店、成都锦城原舍酒店(锦里武侯祠店)
浙江:天湖园博酒店、杭州大运河马可波罗豪廷酒店、杭州湘湖保亿开元名都度假酒店、宁波半山伴水渡假村
上海:上海临港锦江国际酒店
江苏:苏州湾华邑温泉度假酒店、苏州东太湖皇冠假日酒店、南京南部新城丽笙酒店、隐居天目湖WEI酒店
广西:北海香格里拉大酒店
北京:北京首都宾馆
广东:中旅阿那亚九龙湖·公主酒店
通兑:华南温德姆集团通兑、大乐之野通兑、华旅品牌通兑
老规矩,酒店预售不约可退,过期可退,放心囤货!
四川:成都尧棠公馆-全球奢华精品酒店、成都锦城原舍酒店(锦里武侯祠店)
浙江:天湖园博酒店、杭州大运河马可波罗豪廷酒店、杭州湘湖保亿开元名都度假酒店、宁波半山伴水渡假村
上海:上海临港锦江国际酒店
江苏:苏州湾华邑温泉度假酒店、苏州东太湖皇冠假日酒店、南京南部新城丽笙酒店、隐居天目湖WEI酒店
广西:北海香格里拉大酒店
北京:北京首都宾馆
广东:中旅阿那亚九龙湖·公主酒店
通兑:华南温德姆集团通兑、大乐之野通兑、华旅品牌通兑
老规矩,酒店预售不约可退,过期可退,放心囤货!
四川:成都尧棠公馆-全球奢华精品酒店、成都锦城原舍酒店(锦里武侯祠店)
浙江:天湖园博酒店、杭州大运河马可波罗豪廷酒店、杭州湘湖保亿开元名都度假酒店、宁波半山伴水渡假村
上海:上海临港锦江国际酒店
江苏:苏州湾华邑温泉度假酒店、苏州东太湖皇冠假日酒店、南京南部新城丽笙酒店、隐居天目湖WEI酒店
广西:北海香格里拉大酒店
北京:北京首都宾馆
广东:中旅阿那亚九龙湖·公主酒店
北京:北京首都宾馆
广东:中旅阿那亚九龙湖·公主酒店
通兑:华南温德姆集团通兑、大乐之野通兑、华旅品牌通兑
老规矩,酒店预售不约可退,过期可退,放心囤货!
天湖园博酒店
💰劲爆预售价:¥699 (¥1388)
园艺尊享大床房 2 晚(连住) + 早餐 2 份/天 + 下午茶 1 份 + 欢迎水果 1 份 + 迷你吧 1 份 + 天湖景区门票1张 4 份 有效期到2026年12月31日离店。全程可约不加价! ![图片]()
这家藏在温州的宝藏酒店很适合短途山野休闲!步行13分钟逛天湖、15分钟闲逛大月湾,自驾5分钟打卡刘伯温故里、6分钟奔赴百丈漈,四周山林环绕,满目青翠清幽。42㎡尊享大床配全景落地玻璃窗,原木简约客房静谧舒服。套餐权益丰厚,午后可以静享精致下午茶,还附赠4张天湖景区入园票,吃住玩乐全包。日历房两晚的价格要1300多,现在套餐价才699,差不多打了对折!关键是端午、暑假、中秋和国庆等热门日期都不加价,快囤~
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥699园艺高级双床房 2 晚(连住) + 早餐 2 份/天
成都尧棠公馆-全球奢华精品酒店
💰劲爆预售价:¥1588起 (¥2288)
棠厢大床房 2 晚(可拆分) + 早餐 2 份/天 + 迷你吧 1 份/天 + 旅拍礼包拍摄含3张精修照片及万昌洋服号服装试穿拍摄(未使用不可折现) 1 份/天 有效期到2026年12月31日离店。端午、暑假、中秋不加价!10.1-10.4加价200元/间/晚。 ![图片]()
这家尧棠公馆可不一般,是成都第一家SLH酒店,以巴金《家》中李家公馆为灵感,将民国式复古腔调拿捏到位,巴金先生的文学元素也随处可见,又融入了老成都鸟笼、麻将等传统韵味;强烈安利玻璃顶的天井和旋转楼梯,真是谁拍谁好看!酒店位置很好,7分钟逛锦城湖、14分钟直达铁像寺水街。房间有落地窗、宝格丽的洗漱用品!套餐同款房型平时两晚要2200+,现在1588就能入住,还送超值双人旅拍礼包,不用额外花钱就能拍复古写真,太划算了!点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1588起棠厢双床房 2 晚(可拆分) + 早餐 2 份/天
来成都玩也可以看看这家——成都锦城原舍酒店(锦里武侯祠店)!酒店就在锦里武侯祠文旅核心区,整体禅茶新中式装修,满满三国文化氛围感。出门步行3分钟即达高升桥地铁站,11分钟漫步至武侯祠、15分钟闲逛锦里古街,紧邻罗马假日广场。住在古街旁既能沉浸式打卡三国人文古迹,出门就能吃透成都地道烟火美食。平时日历房两晚要800多,现在499就能住,便宜了300多!可约日期都不加价哦~
还有其他好价套餐可选:
价格¥499雅居大床房(小度音箱+记忆枕+小冰箱) 2 晚(可拆分)
上海临港锦江国际酒店
💰劲爆预售价:¥1388 (¥2186)
城景豪华双床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份 有效期到2026年09月30日离店。端午、暑假、中秋热门日期不加价! ![图片]()
酒店坐落在滴水湖畔,步行2分钟抵达临港中心、4分钟直达临港演艺中心,顺路就可以打卡中国航海博物馆、滴水湖公园。高层客房在窗边就能欣赏限定烟花与无人机大秀,酒店自带全套亲子游乐设施,遛娃观景一举两得。日历房含早两晚要1800+,现在1388即可连住两晚,差不多打了七七折!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1388城景豪华大床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份
苏州湾华邑温泉度假酒店
💰劲爆预售价:¥1299起 (¥1899)
高级大床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份 有效期到2026年09月30日离店。全程可约,七夕不加价,端午、中秋+200元/间/晚。 ![图片]()
洲际酒店集团旗下,软硬件没得挑,设计又带着点中式古典感,置身于吴江东太湖生态旅游度假区中,周边绿地湖水围绕,又有王焰温泉这样的大咖加持,不管是宅酒店还是出去玩,都很ok!套餐价算下来一晚650,还送温泉票,比日历价便宜300多! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1299起高级双床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份
杭州大运河马可波罗豪廷酒店
💰劲爆预售价:¥599 (¥1399)
城景双床房(金可儿床垫+全屋智能+智能马桶) 2 晚(连住) + 早餐 2 份/天 + 【豪廷食街双人中式套餐】 1 份 + 双人免费西湖往返班车(双店行李寄存) 1 份 + 免费升级豪庭双床房(视房量房态) 1 份 + 现磨咖啡 2 份 + 房间欢迎饮料2瓶 1 份 有效期到2026年12月30日离店,全程可约不加价! ![图片]()
酒店在拱墅区,附近有中大银泰城、万融城、万达广场等商场,距离拱宸桥、京杭大运河博物馆、小河直街历史文化街区等景点不远。现在买套餐还送西湖往返班车,而且优惠价599两晚比平常单晚400+便宜了不少! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥599豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)价格¥999行政套房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住) 价格¥699豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)
杭州湘湖保亿开元名都度假酒店
有效期到2026年09月29日离店,全程可约,端午、中秋不加价! 来杭州玩还可以看看这家,很适合亲子游!酒店靠近湘湖,去森泊也方便,一脚油门也就几分钟,而且套餐价里连门票都包了!内部环境设计感拉满,水镜连廊与天光倒影,随手出片!配套也很齐全、健身房、游泳馆应有尽有。套餐同款暑期要800/晚,套餐价便宜了200,很划算! 还有其他好价套餐可选:
价格¥599豪华大床房 1 晚 价格¥698豪华双床房 2 晚(可拆分)
隐居天目湖WEI酒店
💰劲爆预售价:¥1299起 (¥4599)
隐谧•雅韵双床房【隐居山湖】 2 晚(连住) + 早餐 2 份/天 + 每日MINI吧 1 份 + 鱼头套餐9折券 1 份 + 隐湖寻幽特调双人下午茶 1 份 + 每日传统文化活动体验 + 多媒体放映室观影 + 单车林间骑行和报恩禅寺游览 + 旅拍体验(赠3张精选电子版照片)+ 周日-周四视房量房态免费升级至高级房型 有效期到2026年10月01日离店,全程可约,热门日期加价见详情。 ![图片]()
酒店太会选址了,正对着天目湖!从13米挑高的大堂望出去,无边泳池衔接着浩渺的湖水,那视野简直惊艳!设计偏中式简约风,青瓦白墙,绿树木椅,品上一杯茶,灵魂都要飘香气了。酒店有专属的湖心亭,园内还设了一座露天影院,躺在星空下看一场电影,太惬意!平常一晚就要1300+,套餐价直接5折还送超多礼遇! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1299起隐谧•雅韵大床房【雅致书香+分离式淋浴间】 2 晚(连住)
苏州东太湖皇冠假日酒店
💰劲爆预售价:¥999起 (¥1699)
高级房 超大床 2 晚(连住) 有效期到2026年08月31日离店。全程可约,周末不加价,端午+100元/间/晚。 ![图片]()
这家坐拥太湖新城核心商务区与商圈,而且紧邻苏州湾东地铁站,可直达苏州古城区及高铁苏州站。房间设计简约高级,将吴风雅韵与现代美学结合得很好!更不用说1.8米大床,房间足足50平,视野也很开阔。同款房型暑假要卖到700多,套餐价999两晚,省下来快500块! 点击下图,火速购买 👇👇👇 ![]()
南京南部新城丽笙酒店
💰劲爆预售价:¥1188起 (¥1698)
豪华双床房-全景落地窗带浴缸 2 晚(连住) + Kuksa下午茶 1 份 + 早餐 2 份/天 + 儿童自助早餐 1 份/天 + 迷你吧 1 份 + 欢迎水果 1 份 + 升级至甄选房(视房量房态) 1 份 + 提前至10:00入住(视房量房态) 1 份 + 延迟退房至14:00(视房量房态) 1 份 有效期到2026年09月01日离店。每周五、周六加价100元/间/晚。 ![图片]()
坐拥南部新城核心区位,临近大校场地铁站,距南京南站仅15分钟车程。紧邻京东MALL,雨花台,老门东历史街区等景点。客房以大校场百年航空文化为设计灵感,流畅线条交织怀旧质感与摩登氛围,空间感极强。日历房价格为600多一晚,套餐价为1100多,省下一顿午餐钱!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥618起豪华双床房-全景落地窗带浴缸 1 晚
宁波半山伴水渡假村
💰劲爆预售价:¥199起 (¥458)
清泉岗木屋双床房 1 晚 + 早餐 2 份/天 + 户外双人泳池门票(7月-9月) 1 份 + 2张中坡山森林公园门票 1 份 + 2张观顶湖门票 1 份 有效期到2026年09月24日离店。端午、每周六加价100元/间/晚。 ![图片]()
这个度假村藏于山林之间,距溪口站驾车约30分钟,出行便捷。酒店主打亲子度假,设有季节性开放的无边泳池、大型户外儿童乐园,配套棋牌室和各种拓展设施。酒店还配有八大项主题设施、100余项游乐项目还有德国原版引进的水晶塔!客房有一些是采用特色窑洞设计,还可携带宠物入住。平日日历房价格为400多1晚,套餐价格相当于4.3折,真的很划算!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥299起清泉岗木屋双床房 1 晚 + 早餐 2 份/天
北海香格里拉大酒店
💰劲爆预售价:¥1199 (¥1588)
高级城景双床房-静览珠城繁华烟火 2 晚(连住) + 咖啡苑双人自助早餐 1 份/天 + 参观南珠博物馆(提供讲解服务) 1 份 + 亲子体验活动 1 份 + 提升至高级海景房(视房量房态而定,节假日不适用) 1 份 + 周六日银滩/客运港/侨港接送服务(固定时间) 1 份 + 精美旅拍(壮族服饰体验,赠3张照片) 1 份 有效期到2026年09月30日离店。端午可约,全程不加价! ![]()
酒店紧邻金滩,步行9分钟可达,距北海站驾车约19分钟,出行便捷。自带沙滩泳池与儿童乐园,入住可免费体验赶海活动,还能打卡海上日落栈道。平日日历房价格为600多1晚,现在2晚可立省一顿早餐!附送很多活动体验,还可根据房态情况免费升级房型!
点击下图,火速购买 👇👇👇 ![]()
北京首都宾馆
💰劲爆预售价:¥599起 (¥704)
B座标准遮窗客房 1 晚 + 延迟退房至14:00(视房量房态) 1 份 有效期到2026年08月31日离店。7月1日起,加价179元/间/晚。 ![图片]()
地处前门核心地段,步行7分钟可达前门大街,10分钟至崇文门地铁站、崇文门地铁站,前往天安门广场很便捷。酒店内部自带五千平中式园林,还可体验汉服换装及古风拍摄。直线距离不到1公里可达新世纪百货,购物吃喝都很方便。日历房价格800多1晚,现在不到600元,套餐省了200+,性价比拉满了~
点击下图,火速购买 👇👇👇 ![]()
中旅阿那亚九龙湖·公主酒店
💰劲爆预售价:¥599起 (¥1198)
公主大床房 1 晚 + 双早 1 份/天 + 美茵家庭中式套餐 1 份 + 畅游中旅阿那亚中心小镇/九龙湖生态公园 1 份 + 草坪畅玩飞盘 1 份 + 醉美夕阳·山湖日落和园区接驳车定时接送 1 份 有效期到2026年07月21日离店。每周五加价100元/间/晚,每周六加价200元/间/晚。 ![图片]()
坐落于九龙湖生态区,临近广州白云机场,自驾出行便捷。酒店以欧式典雅建筑和复古小镇群落为主体,呈现欧式浪漫风情,提供专属管家服务,配套季节性开放的室外景观泳池、室内恒温泳池、美茵餐厅和大堂吧,并设有大型儿童乐园和多种休闲项目。平日日历房价格为700多1晚,套餐价格便宜了150+!
点击下图,火速购买 👇👇👇 ![]()
![]()
华南温德姆集团通兑2晚可拆分含早588元
超值特价¥588 ¥848
有效期到2026年08月31日离店
华南温德姆20城49店通兑覆盖长沙、张家界、武汉、广州等20座热门城市,49家门店随心任选,高铁中转、山林游玩、都市逛吃多种出行需求一站式适配,跨城出游灵活省心。
= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var doc$1 = {};
var isAcrossOrigin$1 = false;
var notFoundedMPPageAction = [];
var __moon_report$1 = window.__moon_report || function () {};
var MOON_JSAPI_KEY_OFFSET = 8;
try {
doc$1 = top.window.document;
} catch (e) {
isAcrossOrigin$1 = true;
}
if (!window.JSAPIEventCallbackMap) {
window.JSAPIEventCallbackMap = {};
}
function ready(onBridgeReady) {
var bridgeReady = function bridgeReady() {
try {
if (onBridgeReady) {
window.onBridgeReadyTime = window.onBridgeReadyTime || Date.now();
onBridgeReady();
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: 'ready',
e: e
}]);
throw e;
}
window.jsapiReadyTime = Date.now();
};
if (!isAcrossOrigin$1 && (typeof top.window.WeixinJSBridge === 'undefined' || !top.window.WeixinJSBridge.invoke)) {
if (doc$1.addEventListener) {
doc$1.addEventListener('WeixinJSBridgeReady', bridgeReady, false);
} else if (doc$1.attachEvent) {
doc$1.attachEvent('WeixinJSBridgeReady', bridgeReady);
doc$1.attachEvent('onWeixinJSBridgeReady', bridgeReady);
}
} else {
bridgeReady();
}
}
var invokeNotWaitA8key = ['notifyPageInfo', 'updatePageAuth'
];
var checkNotFoundedInvoke = function checkNotFoundedInvoke(methodName, args) {
if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && notFoundedMPPageAction.includes(args === null || args === void 0 ? void 0 : args.action)) {
return true;
}
return false;
};
function invoke$1(_x, _x2, _x3) {
return _invoke.apply(this, arguments);
}
function _invoke() {
_invoke = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee(methodName, args, callback) {
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__ && !invokeNotWaitA8key.includes(methodName))) {
_context.next = 3;
break;
}
_context.next = 3;
return window.__secPageAuthPromise;
case 3:
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object') {
alert('请在微信中打开此链接');
return false;
}
if (checkNotFoundedInvoke(methodName, args)) {
setTimeout(function () {
if (callback) {
callback.apply(window, [{
err_msg: "".concat(methodName, ":fail"),
err_desc: 'action isn\'t supported'
}]);
}
}, 0);
} else {
top.window.WeixinJSBridge.invoke(methodName, args, function () {
try {
for (var _len2 = arguments.length, rets = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
rets[_key2] = arguments[_key2];
}
var ret = rets[0];
var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : '';
if (['handleMPPageAction', 'handleVideoAction', 'handleHaokanAction'].indexOf(methodName) !== -1) {
var action = (args === null || args === void 0 ? void 0 : args.action) || '';
console.info('[system]', "[jsapi] invoke->".concat(methodName, ", action->").concat(action).concat(errMsg));
} else {
console.info('[system]', "[jsapi] invoke->".concat(methodName).concat(errMsg));
}
if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && ((ret === null || ret === void 0 ? void 0 : ret.err_desc) === 'action isn\'t supported' || (ret === null || ret === void 0 ? void 0 : ret.err_msg) === 'handleMPPageAction:fail action is not supported')) {
notFoundedMPPageAction.push(args === null || args === void 0 ? void 0 : args.action);
}
if (callback) {
callback.apply(window, rets);
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "invoke;methodName:".concat(methodName),
e: e
}]);
throw e;
}
});
}
});
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return _invoke.apply(this, arguments);
}
function call(_x4) {
return _call.apply(this, arguments);
}
function _call() {
_call = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee2(methodName) {
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__)) {
_context2.next = 3;
break;
}
_context2.next = 3;
return window.__secPageAuthPromise;
case 3:
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object') {
return false;
}
try {
top.window.WeixinJSBridge.call(methodName);
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "call;methodName:".concat(methodName),
e: e
}]);
throw e;
}
});
case 4:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _call.apply(this, arguments);
}
function on(eventName, callback) {
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object' || !top.window.WeixinJSBridge.on) {
return false;
}
if (!window.JSAPIEventCallbackMap[eventName]) {
window.JSAPIEventCallbackMap[eventName] = [];
}
window.JSAPIEventCallbackMap[eventName].push(callback);
if (window.JSAPIEventCallbackMap[eventName].length > 1) {
return false;
}
top.window.WeixinJSBridge.on(eventName, function () {
try {
for (var _len = arguments.length, rets = new Array(_len), _key = 0; _key < _len; _key++) {
rets[_key] = arguments[_key];
}
var ret = rets[0];
var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : '';
console.info('[system]', "[jsapi] event->".concat(eventName).concat(errMsg));
if (window.JSAPIEventCallbackMap[eventName] && window.JSAPIEventCallbackMap[eventName].length) {
var result;
for (var i = 0; i < window.JSAPIEventCallbackMap[eventName].length; i++) {
result = window.JSAPIEventCallbackMap[eventName][i].apply(window, rets);
}
return result;
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "on;eventName:".concat(eventName),
e: e
}]);
throw e;
}
});
});
}
function remove(eventName, callback) {
ready(function () {
if (!window.JSAPIEventCallbackMap[eventName]) {
return false;
}
var result = false;
for (var i = window.JSAPIEventCallbackMap[eventName].length - 1; i >= 0; i--) {
if (window.JSAPIEventCallbackMap[eventName][i] === callback) {
window.JSAPIEventCallbackMap[eventName].splice(i, 1);
result = true;
}
}
return result;
});
}
var JSAPI = {
ready: ready,
invoke: invoke$1,
call: call,
on: on,
remove: remove
};
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var ua = navigator.userAgent;
var is_ios = /(iPhone|iPad|iPod|iOS)/i.test(ua);
var is_wp = /Windows\sPhone/i.test(ua);
var is_android = /(Android)/i.test(ua);
var is_wechat = /MicroMessenger\/([\d\.]+)/i.test(ua);
var is_mac = /mac\sos/i.test(ua) && !is_ios;
var is_windows = /windows\snt/i.test(ua) && !is_wp;
var is_mpapp = /MPAPP\/([\d\.]+)/i.test(ua);
var is_ipad = /iPad/i.test(ua);
var is_windows_wechat = /WindowsWechat/i.test(ua);
var is_mac_wechat = /MacWechat/i.test(ua) || /wechat.*mac os/i.test(ua);
var is_prefetch = is_wechat && window.WeixinPrefecherJSBridge;
var is_donut_app = /SAAASDK/i.test(ua);
var is_harmony = /OpenHarmony|ArkWeb/i.test(ua);
var is_linux = /Linux\s/i.test(ua);
var xweb_match = ua.match(/XWEB\/([\d.]+)/i);
var xweb_version = xweb_match && xweb_match[1] ? parseInt(xweb_match[1], 10) : 0;
var is_unified_pc_wechat = /UnifiedPC\w+Wechat/i.test(ua);
var is_in_miniProgram = is_android && /miniprogram/.test(ua.toLowerCase()) || window.__wxjs_environment == 'miniprogram';
var is_wx_work = /wxwork/i.test(ua);
function getUrlParams() {
var vars = location.search.substring(1).split('&');
var params = {};
var _iterator = _createForOfIteratorHelper(vars),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var ele = _step.value;
var pair = ele.split('=');
var key = decodeURIComponent(pair[0]);
if (typeof params[key] === 'undefined') {
params[key] = decodeURIComponent(pair[1]);
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return params;
}
function get() {
var reg = /MicroMessenger\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMac() {
var reg = /MacWechat\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMacOS() {
var reg = /Mac OS X ([\d_]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1].replace(/_/g, '.');
}
return false;
}
function getWindows() {
var reg = /WindowsWechat\(0x(.+?)\)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getWxWork() {
var reg = /wxwork\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMpApp() {
var appVersion = [2, 4, 5];
var match = navigator.userAgent.match(/MPAPP\/(\d+(\.\d+)*)/);
if (match) {
appVersion = match[1].split('.').map(function (v) {
return Number(v);
});
}
return appVersion.join('.');
}
function getUnifiedPcVer() {
var versionInfo = navigator.userAgent.match(/UnifiedPC\w+Wechat\(0xf\w{2}(\w+?)\w{2}\)/);
if (versionInfo && versionInfo.length === 2) {
var version = versionInfo[1];
var mainVersion = getVersionNumber(version.slice(0, 1));
var subVersion = getVersionNumber(version.slice(1, 2));
var subVersion2 = getVersionNumber(version.slice(2, 3));
return [mainVersion, subVersion, subVersion2].join('.');
}
}
function getVersionNumber(hexStr) {
return Number(Number("0x".concat(hexStr)).toString(10));
}
function getWindowsVersionFormat() {
var versionInfo = navigator.userAgent.match(/WindowsWechat\(0x(\w+?)\)/);
if (versionInfo && versionInfo.length === 2) {
var version = versionInfo[1];
var mainVersion = getVersionNumber(version.slice(1, 2));
var subVersion = getVersionNumber(version.slice(2, 4));
var subVersion2 = getVersionNumber(version.slice(4, 6));
return [mainVersion, subVersion, subVersion2].join('.');
}
return false;
}
function getInner() {
var reg = /MicroMessenger\/[\d\.]+\(0x(.+?)\)/i;
var ret = ua.match(reg);
if (ret && ret[1] && ret[1] != null) {
return ret[1];
}
if (!ret && /MicroMessenger\/[\d\.]+/i.test(ua)) {
var urlParams = getUrlParams();
if (urlParams.version) {
return urlParams.version;
}
}
return false;
}
var opfunc = {
'cp-1': function cp1(a, b) {
return a < b;
},
cp0: function cp0(a, b) {
return a === b;
},
cp1: function cp1(a, b) {
return a > b;
}
};
function cpVersion(ver, op, canEq, type) {
var mmver = false;
switch (type) {
case 'mac':
mmver = getMac();
break;
case 'windows':
mmver = getWindowsVersionFormat();
break;
case 'wxwork':
mmver = getWxWork();
break;
case 'mpapp':
mmver = getMpApp();
break;
case 'unifiedpc':
mmver = getUnifiedPcVer();
break;
default:
mmver = get();
break;
}
if (!mmver) {
return;
}
var mmversion = mmver.split('.');
var version = ver.split('.');
if (!/\d+/g.test(mmversion[mmversion.length - 1])) {
mmversion.pop();
}
for (var i = 0, len = Math.max(mmversion.length, version.length); i < len; ++i) {
var mmv = mmversion[i] || '';
var v = version[i] || '';
var mmvn = parseInt(mmv, 10) || 0;
var vn = parseInt(v, 10) || 0;
var eq = opfunc.cp0(mmvn, vn);
if (eq) {
continue;
}
var cp = opfunc["cp".concat(op)];
return cp(mmvn, vn);
}
return canEq || op === 0;
}
function eqVersion(version) {
return cpVersion(version, 0);
}
function gtVersion(version, canEq) {
return cpVersion(version, 1, canEq);
}
function ltVersion(version, canEq) {
return cpVersion(version, -1, canEq);
}
function getPlatform() {
if (is_ios) {
return 'ios';
}
if (is_android) {
return 'android';
}
if (is_mac) {
return 'mac_os';
}
if (is_windows) {
return 'windows';
}
return 'unknown';
}
var is_google_play = false;
var inner_ver_for_google_play_check = getInner();
if (is_android && inner_ver_for_google_play_check) {
var v = "0x".concat(inner_ver_for_google_play_check.substr(-2));
if (parseInt(v) >= 64 && parseInt(v) <= 79) {
is_google_play = true;
}
}
function compareHexVersion(hexNum) {
var innerVersion = getInner();
if (innerVersion && hexNum) {
if (typeof hexNum === 'string') {
hexNum = parseInt(hexNum, 16);
}
var version = parseInt(innerVersion, 16);
return version >= hexNum;
}
return false;
}
var mmVersion = {
get: get,
getMac: getMac,
getMacOS: getMacOS,
getWindows: getWindows,
getInner: getInner,
getWxWork: getWxWork,
getMpApp: getMpApp,
cpVersion: cpVersion,
eqVersion: eqVersion,
gtVersion: gtVersion,
ltVersion: ltVersion,
getPlatform: getPlatform,
getVersionNumber: getVersionNumber,
isWp: is_wp,
isIOS: is_ios,
isAndroid: is_android,
isHarmony: is_harmony,
isHarmonyWechat: is_harmony && is_wechat && cpVersion('1.0.0', 1, true),
isInMiniProgram: is_in_miniProgram,
isWechat: is_wechat,
isMac: is_mac,
isWindows: is_windows,
isLinux: is_linux,
isMacWechat: is_mac_wechat,
isWindowsWechat: is_windows_wechat,
isWxWork: is_wx_work,
isOnlyWechat: is_wechat && !is_wx_work,
isMpapp: is_mpapp,
isIPad: is_ipad,
isGooglePlay: is_google_play,
isPrefetch: is_prefetch,
isDonutAPP: is_donut_app,
compareHexVersion: compareHexVersion,
isPcWechat: is_windows_wechat || is_mac_wechat,
xwebVersion: xweb_version,
isUnifiedPcWechat: is_unified_pc_wechat
};
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toPrimitive(input, hint) {
if (_typeof(input) !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (_typeof(res) !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return _typeof(key) === "symbol" ? key : String(key);
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
var Device = {};
function detect(ua) {
var MQQBrowser = ua.match(/MQQBrowser\/(\d+\.\d+)/i);
var MQQClient = ua.match(/QQ\/(\d+\.(\d+)\.(\d+)\.(\d+))/i) || ua.match(/V1_AND_SQ_([\d\.]+)/);
var WeChat = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/) || ua.match(/MicroMessenger\/((\d+)\.(\d+))/);
var MacOS = ua.match(/Mac\sOS\sX\s(\d+[\.|_]\d+)/);
var WinOS = ua.match(/Windows(\s+\w+)?\s+?(\d+\.\d+)/);
var Linux = ua.match(/Linux\s/);
var MiuiBrowser = ua.match(/MiuiBrowser\/(\d+\.\d+)/i);
var M1 = ua.match(/MI-ONE/);
var MIPAD = ua.match(/MI PAD/);
var UC = ua.match(/UCBrowser\/(\d+\.\d+(\.\d+\.\d+)?)/) || ua.match(/\sUC\s/);
var IEMobile = ua.match(/IEMobile(\/|\s+)(\d+\.\d+)/) || ua.match(/WPDesktop/);
var ipod = ua.match(/(ipod).*\s([\d_]+)/i);
var ipad = ua.match(/(ipad).*\s([\d_]+)/i);
var iphone = ua.match(/(iphone)\sos\s([\d_]+)/i);
var Chrome = ua.match(/Chrome\/(\d+\.\d+)/);
var AndriodBrowser = ua.match(/Mozilla.*Linux.*Android.*AppleWebKit.*Mobile Safari/);
var android = ua.match(/(android)\s([\d\.]+)/i);
var harmony = ua.match(/(OpenHarmony)\s([\d\.]+)/i);
Device.browser = Device.browser || {}, Device.os = Device.os || {};
Device.os.type = -1;
Device.os.unifiedPC = ua.match(/UnifiedPC/);
Device.os.unifiedMac = /UnifiedPCMac/i.test(ua);
Device.os.unifiedWindows = /UnifiedPCWindows/i.test(ua);
if (window.ActiveXObject) {
var vie = 6;
(window.XMLHttpRequest || ua.indexOf('MSIE 7.0') > -1) && (vie = 7);
(window.XDomainRequest || ua.indexOf('Trident/4.0') > -1) && (vie = 8);
ua.indexOf('Trident/5.0') > -1 && (vie = 9);
ua.indexOf('Trident/6.0') > -1 && (vie = 10);
Device.browser.ie = true, Device.browser.version = vie;
} else if (ua.indexOf('Trident/7.0') > -1) {
Device.browser.ie = true, Device.browser.version = 11;
}
if (android) {
Device.os.android = true;
Device.os.version = android[2];
Device.os.type = 2;
}
if (harmony) {
Device.os.harmony = true;
Device.os.version = harmony[2];
Device.os.type = 42;
}
if (ipod) {
Device.os.ios = Device.os.ipod = true;
Device.os.version = ipod[2].replace(/_/g, '.');
}
if (ipad) {
Device.os.ios = Device.os.ipad = true;
Device.os.version = ipad[2].replace(/_/g, '.');
Device.os.type = 13;
}
if (iphone) {
Device.os.iphone = Device.os.ios = true;
Device.os.version = iphone[2].replace(/_/g, '.');
Device.os.type = 1;
}
if (WinOS) Device.os.windows = true, Device.os.version = WinOS[2], Device.os.type = 15;
if (MacOS) Device.os.Mac = true, Device.os.version = MacOS[1], Device.os.type = 14;
if (Linux) Device.os.Linux = true, Device.os.type = 33;
if (ua.indexOf('lepad_hls') > 0) Device.os.LePad = true;
if (MIPAD) Device.os.MIPAD = true;
if (MQQBrowser) Device.browser.MQQ = true, Device.browser.version = MQQBrowser[1];
if (MQQClient) Device.browser.MQQClient = true, Device.browser.version = MQQClient[1];
if (WeChat) Device.browser.WeChat = true, Device.browser.mmversion = Device.browser.version = WeChat[1];
if (MiuiBrowser) Device.browser.MIUI = true, Device.browser.version = MiuiBrowser[1];
if (UC) Device.browser.UC = true, Device.browser.version = UC[1] || NaN;
if (IEMobile) Device.browser.IEMobile = true, Device.browser.version = IEMobile[2];
if (AndriodBrowser) {
Device.browser.AndriodBrowser = true;
}
if (M1) {
Device.browser.M1 = true;
}
if (Chrome) {
Device.browser.Chrome = true, Device.browser.version = Chrome[1];
}
if (Device.os.windows) {
if (typeof navigator.platform !== "undefined" && navigator.platform.toLowerCase() == "win64") {
Device.os.win64 = true;
} else {
Device.os.win64 = false;
}
}
if (Device.os.Mac || Device.os.windows || Device.os.Linux || Device.os.unifiedPC || /OpenHarmony/i.test(ua) && /pc/i.test(ua)) {
Device.os.pc = true;
}
var osType = {
iPad7: 'iPad; CPU OS 7',
LePad: 'lepad_hls',
XiaoMi: 'MI-ONE',
SonyDTV: "SonyDTV",
SamSung: 'SAMSUNG',
HTC: 'HTC',
VIVO: 'vivo'
};
for (var os in osType) {
Device.os[os] = ua.indexOf(osType[os]) !== -1;
}
Device.os.phone = Device.os.phone || /windows phone/i.test(ua);
Device.os.getNumVersion = function () {
return parseFloat(Device.os.version);
};
Device.os.hasTouch = 'ontouchstart' in window;
if (Device.os.hasTouch && Device.os.ios && Device.os.getNumVersion() < 6) {
Device.os.hasTouch = false;
}
if (Device.browser.WeChat && Device.browser.version < 5.0) {
Device.os.hasTouch = false;
}
Device.browser.getNumVersion = function () {
return parseFloat(Device.browser.version);
};
Device.browser.isFFCanOcx = function () {
return !!Device.browser.firefox && Device.browser.getNumVersion() >= 3.0;
};
Device.browser.isCanOcx = function () {
return !!Device.os.windows && (!!Device.browser.ie || Device.browser.isFFCanOcx() || !!Device.browser.webkit);
};
Device.browser.isNotIESupport = function () {
return !!Device.os.windows && (!!Device.browser.webkit || Device.browser.isFFCanOcx());
};
Device.userAgent = {};
Device.userAgent.browserVersion = Device.browser.version;
Device.userAgent.osVersion = Device.os.version;
if (Device.os.unifiedPC) {
if (Device.os.unifiedWindows) Device.os.type = 37;else if (Device.os.unifiedMac) Device.os.type = 38;else Device.os.type = 39;
}
delete Device.userAgent.version;
}
detect(window.navigator.userAgent);
function canSupportH5Video() {
var ua = window.navigator.userAgent,
m = null;
if (!!Device.os.android) {
if (Device.browser.MQQ && Device.browser.getNumVersion() >= 4.2) {
return true;
}
if (ua.indexOf('MI2') != -1) {
return true;
}
if (Device.os.version >= '4' && (m = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/))) {
if (parseFloat(m[1]) >= 4.2) {
return true;
}
}
if (Device.os.version >= '4.1') {
return true;
}
}
return false;
}
function canSupportVideoMp4() {
var video = document.createElement('video');
if (typeof video.canPlayType === 'function') {
if (video.canPlayType('video/mp4; codecs="mp4v.20.8"') === 'probably') {
return true;
}
if (video.canPlayType('video/mp4; codecs="avc1.42E01E"') === 'probably' || video.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"') === 'probably') {
return true;
}
}
return false;
}
function canSupportAutoPlay() {
if (Device.os.ios && Device.os.getNumVersion() < 10) {
return false;
}
return true;
}
function isLockdownMode() {
if (!Device.os.ios || Device.os.getNumVersion() < 16) {
return false;
}
if (typeof WebAssembly === 'undefined' && typeof OfflineAudioContext === 'undefined' && typeof WebGLRenderingContext === 'undefined') {
return true;
}
return false;
}
Device.canSupportVideo = canSupportVideoMp4 || canSupportH5Video;
Device.canSupportVideoMp4 = canSupportVideoMp4;
Device.canSupportH5Video = canSupportH5Video;
Device.canSupportAutoPlay = canSupportAutoPlay;
Device.isLockdownMode = isLockdownMode;
Device.cpVersion = function (version) {
var cp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var canEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var nowVersionStr = Device.os.version;
if (!nowVersionStr) return false;
var versionArr = version.split('.');
var nowVersionArr = nowVersionStr.split('.');
for (var i = 0; i < Math.max(nowVersionArr.length, versionArr.length); i++) {
var vi = +versionArr[i];
var nvi = +nowVersionArr[i];
if (vi === nvi) continue;
if (cp > 0) return vi > nvi;
if (cp < 0) return vi < nvi;
}
return canEqual || cp === 0;
};
var initJsBridge = false;
if (!window.JSAPIEventCallbackMap) {
window.JSAPIEventCallbackMap = {};
}
function connectWebViewJavascriptBridge(callback) {
if (window.WebViewMPapp || window.WebViewJavascriptBridge) {
return callback(window.WebViewMPapp || window.WebViewJavascriptBridge);
}
if (window.WVJBCallbacks) {
return window.WVJBCallbacks.push(callback);
}
window.WVJBCallbacks = [callback];
if (!mmVersion.isMpapp) {
return false;
}
if (!initJsBridge) {
initJsBridge = true;
var WVJBIframe = document.createElement('iframe');
WVJBIframe.style.display = 'none';
WVJBIframe.src = 'https://__bridge_loaded__';
document.body.appendChild(WVJBIframe);
setTimeout(function () {
initJsBridge = false;
document.body.removeChild(WVJBIframe);
}, 0);
}
return false;
}
function invoke(jsapiName, opt, callback) {
connectWebViewJavascriptBridge(function (bridge) {
try {
if (typeof opt === 'function') {
callback = opt;
}
if (_typeof(opt) !== 'object' && typeof opt !== 'string') {
opt = {};
}
bridge.callHandler(jsapiName, opt, function (res) {
try {
var ret = _typeof(res) === 'object' ? res : JSON.parse(res);
var errMsg = ret.err_msg || ret.errMsg;
console.info("[mpapp jsapi] invoke->".concat(jsapiName, " ").concat(opt.action || '', " ").concat(errMsg));
typeof callback === 'function' && callback(ret);
} catch (e) {
window.WX_BJ_REPORT.BadJs.report('invoke', "callback ".concat(jsapiName, " error:"), {
mid: 'mmbizwebapp:js_brridge',
_info: e
});
console.error("[mpapp jsapi] ".concat(jsapiName, " ").concat(opt.action || ''), e, res);
}
});
} catch (e) {
window.WX_BJ_REPORT.BadJs.report('invoke', 'callback error:', {
mid: 'mmbizwebapp:js_brridge',
_info: e
});
console.error('[mpapp jsapi]', e);
}
});
}
function _log(level, msg) {
if (level === 'log') {
level = 'info';
msg = "[WechatFe]".concat(msg);
} else {
var prefix = "__wap__".concat(window.__second_open__ ? ' (sec)' : '');
msg = "".concat(prefix, " ").concat(msg, " location:[").concat(location.href, "]");
}
msg += new Error().stack;
if (mmVersion.isMpapp) {
invoke('WNNativeCallbackLog', msg);
} else if (mmVersion.isWechat) {
if (mmVersion.isAndroid) {
console.warn('[system]', "[MicroMsg.JsApiLog][".concat(level, "] jslog : ").concat(msg));
} else if (mmVersion.isIOS) {
JSAPI.invoke('writeLog', {
level: level,
msg: msg
});
} else {
JSAPI.invoke('log', {
level: level,
msg: msg
});
}
}
}
var Log = {
info: function info() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_log('info', args.join(' '));
},
warn: function warn() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_log('warn', args.join(' '));
},
error: function error() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
_log('error', args.join(' '));
},
debug: function debug() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
_log('debug', args.join(' '));
},
log: function log() {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
_log('info', args.join(' '));
}
};
var reportLogs = [];
var reportExtraLogs = [];
var sendUrl = '/mp/jsmonitor?#wechat_redirect';
var monitor = {};
monitor._reportOptions = {
idkey: {}
};
function ObjWithoutProperty(source, exclude) {
if (source === null) return {};
var target = {};
var sourceKeys = Object.keys(source);
for (var i = 0; i < sourceKeys.length; i++) {
var key = sourceKeys[i];
if (exclude.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function formatDataToString(data) {
var reportData = [];
for (var key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
reportData.push(key + '=' + encodeURIComponent(data[key]));
}
}
return reportData.join('&');
}
monitor.getReportData = function (opt) {
opt = opt || {};
var idkey = monitor._reportOptions.idkey || {};
var key = null;
var reportData = {};
var nextKey;
try {
for (key in idkey) {
if (Object.prototype.hasOwnProperty.call(idkey, key) && idkey[key]) {
reportLogs.push(key + '_' + idkey[key]);
}
}
} catch (e) {
return false;
}
if (reportLogs.length === 0) {
return false;
}
if (reportExtraLogs.length) {
reportData.lc = reportExtraLogs.length;
reportExtraLogs.forEach(function (extraLog, index) {
reportData["log".concat(index)] = extraLog;
});
}
try {
var reportOptions = monitor._reportOptions;
if (reportOptions !== null && reportOptions !== undefined) {
for (nextKey in reportOptions) {
if (Object.prototype.hasOwnProperty.call(reportOptions, nextKey)) {
reportData[nextKey] = reportOptions[nextKey];
}
}
}
} catch (e) {
reportData = {};
}
reportData.idkey = reportLogs.join(';');
reportData.t = Math.random();
if (opt.remove !== false) {
reportLogs = [];
reportExtraLogs = [];
monitor._reportOptions = {
idkey: {}
};
}
return reportData;
};
monitor.setLogs = function (opt) {
var id = opt.id;
var key = opt.key;
var value = opt.value;
var extraLog = opt.log;
var others = ObjWithoutProperty(opt, ['id', 'key', 'value', 'log']);
var idkey = monitor._reportOptions.idkey || {};
var param = id + '_' + key;
if (idkey[param]) {
idkey[param] += value;
} else {
idkey[param] = value;
}
monitor._reportOptions.idkey = idkey;
if (extraLog) {
reportExtraLogs.push(extraLog);
}
try {
if (others !== null && others !== undefined) {
for (var otherKey in others) {
if (Object.prototype.hasOwnProperty.call(others, otherKey)) {
monitor._reportOptions[otherKey] = others[otherKey];
}
}
}
} catch (e) {
console.log(e);
}
return monitor;
};
monitor.setAvg = function (id, key, value) {
var idkey = monitor._reportOptions.idkey || {};
var param1 = id + '_' + key;
var param2 = id + '_' + (key - 1);
if (idkey[param1]) {
idkey[param1] += value;
} else {
idkey[param1] = value;
}
if (idkey[param2]) {
idkey[param2] += 1;
} else {
idkey[param2] = 1;
}
monitor._reportOptions.idkey = idkey;
return monitor;
};
monitor.setSum = function (id, key) {
var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var idkey = monitor._reportOptions.idkey;
var param = id + '_' + key;
if (idkey[param]) {
idkey[param] += value;
} else {
idkey[param] = value;
}
monitor._reportOptions.idkey = idkey;
return monitor;
};
monitor.send = function (async, ajax, origin) {
if (async !== false) {
async = true;
}
var data = monitor.getReportData();
origin = origin || '';
if (!data) {
return;
}
if (!!ajax && ajax instanceof Function) {
ajax({
url: origin + sendUrl,
type: 'POST',
mayAbort: true,
data: data,
async: async,
timeout: 2000,
dontReport: true
});
} else {
new Image().src = origin + '/mp/jsmonitor?' + formatDataToString(data) + '#wechat_redirect';
}
};
if (typeof window !== 'undefined' && window.__monitor) {
monitor = window.__monitor;
} else {
typeof window !== 'undefined' && (window.__monitor = monitor);
}
var monitor$1 = monitor;
var logList = [];
var log = function log(msg) {
logList.push(msg);
};
var printLog = function printLog() {
for (var i = 0, len = logList.length; i < len; ++i) {
console.log("[RespType]".concat(logList[i]));
}
};
var isArray = function isArray(val) {
return Object.prototype.toString.call(val) === '[object Array]';
};
var getValueType = function getValueType(value) {
if (isArray(value)) {
return 'array';
}
return _typeof(value);
};
var parseRtDesc = function parseRtDesc(rtDesc, k) {
var type = 'mix';
var isRequired = false;
var key = k;
if (k) {
var requireKeyWord = '_R';
var pos = k.indexOf(requireKeyWord);
var len = k.length - requireKeyWord.length;
isRequired = pos !== -1 && pos === len;
key = isRequired ? k.substring(0, len) : k;
}
if (typeof rtDesc === 'string') {
type = rtDesc;
} else if (isArray(rtDesc)) {
type = 'array';
} else if (_typeof(rtDesc) === 'object') {
type = 'object';
}
return {
key: key,
type: type,
isRequired: isRequired
};
};
var checkForArrayRtDesc = function checkForArrayRtDesc(arr, rtDescs) {
if (!isArray(arr)) {
return false;
}
for (var i = 0, len = arr.length; i < len; ++i) {
var value = arr[i];
var rtDesc = void 0;
var j = 0;
var flag = rtDescs.length === 0;
while (rtDesc = rtDescs[j++]) {
if (checkForRtDesc(value, rtDesc)) {
flag = true;
break;
}
}
if (!flag) {
return false;
}
}
return true;
};
var checkForStringRtDesc = function checkForStringRtDesc(value, rtDesc) {
var valueType = getValueType(value);
var desc = parseRtDesc(rtDesc);
var ret = desc.type === valueType;
if (!ret) {
log("miss match type : ".concat(valueType, " !== ").concat(desc.type));
}
return ret;
};
var checkForObjectRtDesc = function checkForObjectRtDesc(json, rtDesc) {
if (_typeof(json) !== 'object' || isArray(json)) {
log('must be object');
return false;
}
var rootJson = json;
var nowCheckValue = json;
for (var k in rtDesc) {
if (rtDesc.hasOwnProperty(k)) {
var nowCheckDesc = rtDesc[k];
var desc = parseRtDesc(nowCheckDesc, k);
var key = desc.key;
nowCheckValue = rootJson[key];
var valueType = getValueType(nowCheckValue);
if (desc.isRequired && nowCheckValue === undefined) {
log("is required @key=".concat(key));
return false;
}
if (nowCheckValue !== undefined) {
if (valueType !== desc.type && desc.type !== 'mix') {
log("miss match type : ".concat(valueType, " !== ").concat(desc.type, " @key=").concat(key));
return false;
}
if ((valueType === 'array' || valueType === 'object') && desc.type !== 'mix') {
if (!checkForRtDesc(nowCheckValue, nowCheckDesc)) {
return false;
}
}
}
}
}
return true;
};
var checkForRtDesc = function checkForRtDesc(json, rtDesc) {
if (isArray(rtDesc)) {
return checkForArrayRtDesc(json, rtDesc);
}
if (_typeof(rtDesc) === 'object') {
return checkForObjectRtDesc(json, rtDesc);
}
if (typeof rtDesc === 'string') {
return checkForStringRtDesc(json, rtDesc);
}
return false;
};
var _check = function check(json, rtDescs) {
if (typeof json === 'string') {
try {
json = eval("(".concat(json, ")"));
} catch (e) {
log('parse json error');
return false;
}
}
if (_typeof(json) !== 'object') {
log('must be object');
return false;
}
if (!isArray(rtDescs)) {
rtDescs = [rtDescs];
}
var rtDesc;
var i = 0;
while (rtDesc = rtDescs[i++]) {
if (checkForRtDesc(json, rtDesc)) {
return true;
}
}
return false;
};
var RespTypes = {
check: function check(json, rtDesc) {
logList = [];
try {
var ret = _check(json, rtDesc);
if (!ret) {
printLog();
}
return ret;
} catch (e) {
logList.push("[rtException]".concat(e.toString()));
printLog();
return false;
}
},
getMsg: function getMsg() {
return logList.join(';');
}
};
function getInflightMap() {
if (!window.__dedupe_promise_inflight__) {
window.__dedupe_promise_inflight__ = new Map();
}
return window.__dedupe_promise_inflight__;
}
function dedupePromise(key, factory) {
var inflightMap = getInflightMap();
var existing = inflightMap.get(key);
console.log("dedupePromise key=".concat(key, " existing=").concat(existing));
if (existing) {
return existing;
}
var promise = Promise.resolve().then(factory)["finally"](function () {
inflightMap["delete"](key);
});
inflightMap.set(key, promise);
return promise;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
var prefix = '__WXLS__';
var localStorage$1 = window.localStorage || {
getItem: function getItem() {},
setItem: function setItem() {},
removeItem: function removeItem() {},
key: function key() {},
clear: function clear() {
var _a, _b;
(_b = (_a = window.localStorage) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a);
},
length: 0
};
var evictionPolicies = {
noeviction: function noeviction(data) {
return data;
},
'allkeys-random': function allkeysRandom(data, size) {
var keys = Object.keys(data);
var memCnt = 0;
while (memCnt < size) {
var len = keys.length;
var randomKeyIdx = Math.floor(Math.random() * len);
var randomKey = keys[randomKeyIdx];
memCnt += JSON.stringify(data[randomKey]).length;
delete data[randomKey];
keys = Object.keys(data);
}
return data;
},
'volatile-ttl': function volatileTtl(data, size) {
var keys = Object.keys(data);
keys = keys.sort(function (key1, key2) {
var d1 = data[key1];
var d2 = data[key2];
if (d1.exp < d2.exp) return -1;
if (d1.exp > d2.exp) return 1;
return 0;
});
var memCnt = 0;
for (var i = 0; i < keys.length; i++) {
if (memCnt >= size) break;
var key = keys[i];
memCnt += JSON.stringify(data[key]).length;
delete data[key];
}
return data;
},
'clear-all': function clearAll() {
localStorage$1.clear();
return {};
}
};
function formatLogMsg(str) {
return "[WXLS] ".concat(str);
}
var LS = function () {
function LS(func, evictionPolicy, logger) {
_classCallCheck(this, LS);
this.logger = function () {};
if (!func) throw 'require function name.';
this.evictionPolicy = 'noeviction';
this.key = func;
if (typeof logger === 'function') {
this.logger = function (str, type) {
return logger(formatLogMsg(str), type);
};
}
if (evictionPolicy && Object.keys(evictionPolicies).indexOf(evictionPolicy) !== -1) {
this.evictionPolicy = evictionPolicy;
}
this.init();
}
_createClass(LS, [{
key: "init",
value: function init() {
var _a, _b;
this.check();
if (Math.random() * 1000 < 1) {
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.call(this, "LSlen: ".concat(((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length) || localStorage$1.length), 'report');
}
}
}, {
key: "getData",
value: function getData() {
var data = LS.getItem(this.key) || '{}';
try {
data = JSON.parse(data);
} catch (e) {
this.logger("getData error: ".concat(e), 'error');
localStorage$1.removeItem(prefix + this.key);
data = {};
}
return data;
}
}, {
key: "check",
value: function check(isReturn) {
var data = this.getData();
var temp = {};
var now = +new Date();
var key;
var val;
for (key in data) {
val = data[key];
if (+val.exp > now) {
temp[key] = val;
}
}
this.logger("check info: isReturn:".concat(isReturn, " data:").concat(JSON.stringify(temp)), 'info');
if (isReturn) return temp;
LS.setItem(this.key, JSON.stringify(temp), this.logger);
}
}, {
key: "set",
value: function set(key, val, exp) {
var _a, _b;
var data = this.check(true);
data[key] = {
val: val,
exp: exp || +new Date()
};
try {
if (localStorage$1.getItem(prefix + this.key)) localStorage$1.removeItem(prefix + this.key);
localStorage$1.setItem(prefix + this.key, JSON.stringify(data));
this.logger("first set success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data)), 'success');
} catch (e) {
this.logger("first set error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data), " k:").concat(key, " v:").concat(val, " exp:").concat(exp), 'error');
localStorage$1.clear();
LS.setItem(this.key, JSON.stringify(_defineProperty({}, key, {
val: val,
exp: exp || +new Date()
})), this.logger);
}
}
}, {
key: "get",
value: function get(key) {
var data = this.getData();
data = data[key];
return data ? data.val || null : null;
}
}, {
key: "remove",
value: function remove(key) {
var data = this.getData();
if (data[key]) delete data[key];
LS.setItem(this.key, JSON.stringify(data), this.logger);
}
}], [{
key: "getItem",
value: function getItem(key) {
key = prefix + key;
return localStorage$1.getItem(key);
}
}, {
key: "setItem",
value: function setItem(key, val, logger) {
var _a, _b;
key = prefix + key;
var n = 3;
while (n--) {
try {
if (localStorage$1.getItem(key)) localStorage$1.removeItem(key);
localStorage$1.setItem(key, val);
typeof logger === 'function' && logger("setItem success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(key, " val:").concat(val), 'success');
break;
} catch (e) {
typeof logger === 'function' && logger("setItem error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(key, " val:").concat(val), 'error');
LS.clear();
}
}
}
}, {
key: "clear",
value: function clear() {
var i;
var k;
for (i = localStorage$1.length - 1; i >= 0; i--) {
k = localStorage$1.key(i);
if (k.indexOf(prefix) == 0) {
localStorage$1.removeItem(k);
}
}
}
}, {
key: "getSupportEvicationPolicy",
value: function getSupportEvicationPolicy() {
return Object.keys(evictionPolicies);
}
}]);
return LS;
}();
var innerVersion = (mmVersion.getInner() || '').toUpperCase();
var getBizLS = new LS('get_biz_result');
function getBizMap() {
if (!window.__get_biz_map__) {
window.__get_biz_map__ = {};
}
return window.__get_biz_map__;
}
var isGetBizSupported = mmVersion.isOnlyWechat && mmVersion.isIOS && innerVersion >= '18003C2A' || mmVersion.isOnlyWechat && mmVersion.isAndroid && innerVersion >= '28003D3C' || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc');
function invokeGetBiz(needCheckBiz, bizType) {
return dedupePromise("getBiz:".concat(needCheckBiz, ":").concat(bizType), function () {
return new Promise(function (resolve, reject) {
if (!isGetBizSupported) {
reject('Not support');
} else {
JSAPI.invoke('handleMPPageAction', {
action: 'getBiz',
needCheckBiz: needCheckBiz,
bizType: bizType
}, function (res) {
console.log("getBiz needCheckBiz=".concat(needCheckBiz, " bizType=").concat(bizType, " res: ").concat(JSON.stringify(res)));
if (res && res.err_msg && res.err_msg.indexOf('ok') > -1) {
var bizMap = getBizMap();
bizMap[bizType] = res.biz;
resolve(res.biz);
getBizLS.set("".concat(bizType, "_get_biz_result"), res.biz, +new Date() + 3 * 24 * 60 * 60 * 1000);
} else {
reject('Failed to get biz');
}
});
}
});
});
}
function getBiz(needCheckBiz, bizType) {
var _a;
if (needCheckBiz === void 0) {
needCheckBiz = false;
}
if (bizType === void 0) {
bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1;
}
var bizMap = getBizMap();
if (!needCheckBiz && bizMap[bizType] !== undefined) {
return Promise.resolve(bizMap[bizType]);
}
return invokeGetBiz(needCheckBiz, bizType);
}
mmVersion.isOnlyWechat && mmVersion.isIOS || mmVersion.isOnlyWechat && mmVersion.isAndroid || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc');
var getIsAuthor = function getIsAuthor(cb, bizuin, needCheckBiz, bizType) {
var _a;
if (bizuin === void 0) {
bizuin = window.biz;
}
if (needCheckBiz === void 0) {
needCheckBiz = false;
}
if (bizType === void 0) {
bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1;
}
getBiz(needCheckBiz, bizType).then(function (biz) {
cb(biz && biz === bizuin);
})["catch"](function () {
cb(false);
});
};
function parseUrl(url) {
var len = url.length;
var ques_pos = url.indexOf('?');
var hash_pos = url.indexOf('#');
hash_pos = hash_pos == -1 ? len : hash_pos;
ques_pos = ques_pos == -1 ? hash_pos : ques_pos;
var host = url.substring(0, ques_pos);
var query_str = url.substring(ques_pos + 1, hash_pos);
var hash = url.substring(hash_pos + 1);
return {
host: host,
query_str: query_str,
hash: hash
};
}
function join(url, args, noEncode) {
var ret = parseUrl(url);
var query_str = ret.query_str;
var args_arr = [];
if (_typeof(args) === 'object') {
for (var key in args) {
if (args.hasOwnProperty(key)) {
args_arr.push("".concat(key, "=").concat(noEncode ? args[key] : encodeURIComponent(args[key])));
}
}
} else {
args_arr.push(noEncode ? args : encodeURIComponent(args));
}
if (args_arr.length > 0) {
query_str += (query_str !== "" ? "&" : "") + args_arr.join("&");
}
return ret.host + (query_str !== "" ? "?".concat(query_str) : "") + (ret.hash !== "" ? "#".concat(ret.hash) : "");
}
function addParam(url, param, value, forceReplace) {
url = url || location.href;
var firstAndPos = url.indexOf("&");
var len = url.length;
var reverseUrl = url.replace(/^[\w\d]+:[/\\]+/g, "").split("").reverse();
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement, fromIndex) {
var k;
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var O = Object(this);
var len = O.length >>> 0;
if (len === 0) {
return -1;
}
var n = fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
if (n >= len) {
return -1;
}
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {
if (k in O && O[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
}
var lastSlashPos = len - 1 - reverseUrl.indexOf("/");
if (firstAndPos !== -1 && url.indexOf("?") == -1 && firstAndPos > lastSlashPos) {
url = url.replace("&", "?");
}
var reg = new RegExp("([\\?&]".concat(param, "=)[^&#]*"));
if (!url.match(reg)) {
var urlInfo = parseUrl(url);
var hash = urlInfo.hash ? '#' + urlInfo.hash : '';
url = url.replace(hash, '');
var _pos = url.indexOf("?");
if (_pos == -1) {
return "".concat(url, "?").concat(param, "=").concat(value).concat(hash);
}
if (_pos == url.length - 1) {
return "".concat(url + param, "=").concat(value).concat(hash);
}
return "".concat(url, "&").concat(param, "=").concat(value).concat(hash);
}
if (forceReplace === true) {
return url.replace(reg, "$1".concat(value));
}
return url;
}
function addWxfrom(src, wxfrom) {
var offset = window.service_type === 1 ? 10000 : 0;
return addParam(src, 'wxfrom', offset + Number(wxfrom), true);
}
function removeParam(url, param) {
var _URL = new URL(url),
protocol = _URL.protocol,
host = _URL.host,
pathname = _URL.pathname,
search = _URL.search,
hash = _URL.hash;
var queryParams = new URLSearchParams(search);
queryParams["delete"](param);
var newSearch = queryParams.toString();
var newUrl = new URL("".concat(protocol, "//").concat(host).concat(pathname).concat(newSearch ? "?".concat(decodeURIComponent(newSearch)) : "").concat(hash));
return newUrl.toString();
}
function getQuery(name, url) {
var u = url || window.location.search;
var reg = new RegExp("(^|&)".concat(name, "=([^&]*)(&|$)"));
var r = u.substring(u.indexOf('?') + 1).match(reg);
return r !== null ? r[2] : '';
}
function encodeBase64(value) {
try {
return window.btoa(value);
} catch (e) {
return '';
}
}
function decodeBase64(value) {
try {
return window.atob(value);
} catch (e) {
return '';
}
}
function joinUrl$1(url) {
var obj = {};
if (typeof window.uin !== 'undefined') {
obj.uin = window.uin;
}
if (typeof window.key !== 'undefined') {
obj.key = window.key;
}
if (typeof window.pass_ticket !== 'undefined') {
obj.pass_ticket = window.pass_ticket;
}
if (typeof window.wxtoken !== 'undefined') {
obj.wxtoken = window.wxtoken;
}
if (typeof window.devicetype !== 'undefined') {
obj.devicetype = window.devicetype;
}
if (typeof window.clientversion !== 'undefined') {
obj.clientversion = window.clientversion || mmVersion.getInner();
}
obj.version = obj.clientversion;
if (window.biz) {
obj.__biz = window.biz;
}
if (getQuery('enterid')) {
obj.enterid = getQuery('enterid');
}
if (typeof window.appmsg_token !== 'undefined') {
obj.appmsg_token = window.appmsg_token;
} else if (url.indexOf('advertisement_report') > -1) {
new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random());
}
obj.x5 = navigator.userAgent.indexOf('TBS/') !== -1 ? '1' : '0';
obj.f = 'json';
return join(url, obj);
}
function joinUserArticleRole(url, notJoin, cb) {
var bizuin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : window.biz;
var needCheckBiz = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
if (notJoin) {
cb(url);
} else {
getIsAuthor(function (isAuthor) {
cb(addParam(url, 'user_article_role', isAuthor ? 1 : 0, true));
}, bizuin, needCheckBiz);
}
}
function getA8keyQuery(name, url) {
return new Promise(function (resolve) {
if (window.__secPageAuthPromise) {
window.__secPageAuthPromise.then(function () {
resolve(getQuery(name, url));
});
} else {
resolve(getQuery(name, url));
}
});
}
function addHash(url, hash) {
var isReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (isReplace) {
return "".concat(url.split('#')[0]).concat(hash);
}
return "".concat(url).concat(url.indexOf('#') === -1 ? '#' : '').concat(hash);
}
function decodeUrl(url) {
var _url = url;
while (_url.indexOf('&') !== -1) {
_url = _url.htmlDecode();
}
return _url;
}
var Url = {
parseUrl: parseUrl,
join: join,
addParam: addParam,
addWxfrom: addWxfrom,
addHash: addHash,
getQuery: getQuery,
getA8keyQuery: getA8keyQuery,
encodeBase64: encodeBase64,
decodeBase64: decodeBase64,
joinUrl: joinUrl$1,
joinUserArticleRole: joinUserArticleRole,
removeParam: removeParam,
decodeUrl: decodeUrl
};
var _a;
var doc;
var isAcrossOrigin = false;
try {
doc = (_a = window.top) === null || _a === void 0 ? void 0 : _a.window.document;
} catch (e) {
isAcrossOrigin = true;
}
var StatusTextMap = {
200: 'OK',
302: 'Found',
400: 'Bad Request',
500: 'Internal Server Error'
};
function getIsAcrossOrigin() {
return isAcrossOrigin;
}
function networkStartLog(item) {
var _a, _b, _c, _d, _e;
console.log('[system]', "< [request ".concat(item.requestType, "]"), item.url, item.method, item);
var rdevRequestId;
var requestTime = performance.now() / 1000;
if ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) {
try {
var willBeSentOptions = {
url: item.url,
method: item.method,
requestHeaders: Object.assign({}, item.requestHeader || {}, {
RDEV_REQUEST_TYPE: item.requestType
}),
requestBody: item.postData,
requestTime: requestTime
};
rdevRequestId = window.RemoteDevSdk.instance.Network.customRequestWillBeSent(willBeSentOptions);
} catch (err) {}
}
if ((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) {
try {
var vconsoleNetworkItem = (_e = (_d = window.vConsole.network).add) === null || _e === void 0 ? void 0 : _e.call(_d, Object.assign({}, item, {
startTime: Date.now(),
endTime: Date.now(),
status: 0,
readyState: 2,
response: ''
}));
vconsoleNetworkItem.rdevRequestId = rdevRequestId;
vconsoleNetworkItem.requestTime = requestTime;
return vconsoleNetworkItem;
} catch (err) {}
}
if (rdevRequestId) {
return Object.assign(Object.assign({}, item), {
id: '__only_rdev_log__',
rdevRequestId: rdevRequestId,
requestTime: requestTime
});
}
return Object.assign({}, item, {
id: '__system_log__'
});
}
function networkEndLog(item) {
var _a, _b, _c, _d, _e;
console.log('[system]', "> [response ".concat(item.requestType, "]"), item.url, item.response, item);
if (item.rdevRequestId && ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) && item.id !== '__system_log__') {
try {
var finishedOptions = {
requestId: item.rdevRequestId,
url: item.url,
status: +(item.status || '500'),
statusText: StatusTextMap[+(item.status || '500')] || 'Error',
responseHeaders: {
RDEV_RESPONSE_TYPE: item.requestType
},
responseBody: item.response,
requestTime: item.requestTime || 0,
duration: item.costTime || (item.endTime && item.startTime ? item.endTime - item.startTime : performance.now() / 1000 - (item.requestTime || 0))
};
window.RemoteDevSdk.instance.Network.customRequestFinished(finishedOptions);
} catch (err) {}
}
if (((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) && item.id !== '__system_log__') {
try {
item.statusText = "".concat(item.status);
item.responseSize = item.response.length;
item.responseSizeText = "".concat(item.response.length);
return (_e = (_d = window.vConsole.network).update) === null || _e === void 0 ? void 0 : _e.call(_d, item.id, Object.assign({}, item, {
readyState: 4
}));
} catch (err) {}
}
}
function reqType(obj, path) {
return obj.url.indexOf(path) > -1 && obj.url.indexOf('action=') === -1 && (!obj.data || !obj.data.action);
}
function findAjaxScopeByConfig(url, config) {
var pathname = new URL(url, location.href).pathname || '';
var scope = config[pathname.slice(1)];
if (scope) {
return scope;
}
}
function getAjaxScope(ajaxUrl) {
if (Url.getQuery('no_transfer', location.href) !== '1' && mmVersion.isWechat && !mmVersion.isInMiniProgram && !mmVersion.isWxWork && !mmVersion.isMpapp && !isAcrossOrigin && window.__ajaxTransferConfig && _typeof(window.__ajaxTransferConfig) === 'object' && (
mmVersion.isIOS && mmVersion.compareHexVersion('1800282F') || mmVersion.isAndroid && mmVersion.compareHexVersion('28002234') || mmVersion.isWindowsWechat && mmVersion.cpVersion('3.9.5', 1, true, 'windows') || mmVersion.isMacWechat && mmVersion.cpVersion('3.8.4', 1, true, 'mac') || mmVersion.isHarmonyWechat && mmVersion.compareHexVersion('0xf3100b00') && !mmVersion.compareHexVersion('0xf3100c00') || mmVersion.compareHexVersion('0xf3800b00'))) {
try {
return findAjaxScopeByConfig(ajaxUrl, window.__ajaxTransferConfig);
} catch (err) {
}
}
}
function getActionByData(data) {
var _a, _b;
if (_typeof(data) === 'object' && !(data instanceof Blob)) {
if (data.hasOwnProperty('data') && typeof data.data === 'string') {
try {
var workedData = JSON.parse(data.data);
return workedData.action || '';
} catch (e) {}
}
return data.action || '';
}
if (typeof data === 'string') {
return ((_b = (_a = data.split(/[?&]/).find(function (x) {
return x.indexOf('action=') >= 0;
})) === null || _a === void 0 ? void 0 : _a.split('=')) === null || _b === void 0 ? void 0 : _b[1]) || '';
}
return '';
}
var METHOD_ENUM = {
GET: 0,
POST: 1
};
var __moon_report = window.__moon_report || function () {};
var MOON_AJAX_SUCCESS_OFFSET = 3;
var MOON_AJAX_NETWORK_OFFSET = 4;
var MOON_AJAX_ERROR_OFFSET = 5;
var MOON_AJAX_TIMEOUT_OFFSET = 6;
var MOON_AJAX_COMPLETE_OFFSET = 7;
var LENGTH_LIMIT = 4096;
function reportRtError(type, id, key, content) {
var log = '';
var prefix = type === 'rt' ? 'rtCheckError' : 'Ajax Length Limit';
if (content === null || content === void 0 ? void 0 : content.length) {
var loglen = 1000;
var len = content.length;
var lc = Math.ceil(len / loglen);
log = ["&lc=".concat(lc)];
for (var i = 0; i < lc; ++i) {
log.push("&log".concat(i, "=") + "[".concat(prefix, "][").concat(i, "]").concat(encodeURIComponent(content.substring(i * loglen, i * loglen + loglen))));
}
log = log.join('');
}
var data = "idkey=".concat(id, "_").concat(key, "_1").concat(log, "&r=").concat(Math.random());
var xmlobj = new XMLHttpRequest();
xmlobj.open('POST', "".concat(location.protocol, "//").concat(location.host, "/mp/jsmonitor?"), true);
xmlobj.setRequestHeader('cache-control', 'no-cache');
xmlobj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlobj.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xmlobj.send(data);
if (type === 'ajaxLen') {
monitor$1.setLogs({
id: id,
key: key,
value: 1,
log: log
});
}
}
function reportRt(id, key, content) {
reportRtError('rt', id, key, content);
}
function reportAjaxLength(id, key, content) {
reportRtError('ajaxLen', id, key, content);
}
function setXhrHeader(xhr, type, opt) {
if (opt.contentType) {
xhr.setRequestHeader('Content-Type', opt.contentType);
} else if (type === 'POST') {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
}
if (!opt.noXRequestedWidthHeader) {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
}
}
function Ajax(obj) {
var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {};
if (obj.usePb) {
obj.type = 'POST';
obj.data = {
data: JSON.stringify(obj.data)
};
}
var ajaxScope = getAjaxScope(obj.url);
var type = (obj.type || 'GET').toUpperCase();
var timer;
var _url;
if (obj.notJoinUrl) {
_url = obj.url;
} else {
_url = Url.joinUrl(obj.url);
}
Url.joinUserArticleRole(_url, !!obj.notJoinUrl, function (url) {
var urlObj = new URL(url, location.origin);
if (obj.f === 'html') {
url = url.replace('&f=json', '');
}
var data = null;
if (obj.data instanceof Blob) {
data = obj.data;
} else if (_typeof(obj.data) === 'object') {
var d = obj.data;
var ds = [];
for (var k in d) {
if (d.hasOwnProperty(k)) {
ds.push("".concat(k, "=").concat(encodeURIComponent(d[k])));
}
}
data = ds.join('&');
} else {
data = typeof obj.data === 'string' ? obj.data : null;
}
var beginTs;
var beforeReq = function beforeReq() {
if (reqType(obj, '/mp/getappmsgext')) {
window.startGetAppmsgExtTime = Date.now();
Log.log('start get appmsgext, url: ', obj.url);
}
if (reqType(obj, '/mp/getappmsgad')) {
window.startGetAppmsgAdTime = Date.now();
Log.log('start get appmsgad, url: ', obj.url);
}
beginTs = Date.now();
};
var beforeResp = function beforeResp(xhr) {
if (reqType(obj, '/mp/getappmsgext')) {
window.receiveGetAppmsgExt = "".concat(xhr.status, "|").concat(Date.now());
Log.log("receive appmsgext response, status: ".concat(xhr.status));
}
if (reqType(obj, '/mp/getappmsgad')) {
window.receiveGetAppmsgAd = "".concat(xhr.status, "|").concat(Date.now());
Log.log("receive appmsgad response, status: ".concat(xhr.status));
}
if (Math.random() < 0.001 && window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) {
try {
var key = ajaxScope ? 'transfer' : 'xhr';
var interval = 250;
var time = Date.now() - beginTs;
var range = Math.floor(time / interval) * interval;
var pathname = new URL(obj.url, location.href).pathname || '';
window.WX_BJ_REPORT.BadJs.report("".concat(key, "_perf:").concat(pathname), JSON.stringify({
status: xhr.status,
time: "[".concat(range, "-").concat(range + interval, ")")
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
} catch (err) {}
}
};
var handleRespSucc = function handleRespSucc(xhr, requestType) {
var _a, _b, _c, _d;
try {
var responseText = xhr.responseText;
var resp = responseText;
if (obj.dataType === 'json') {
try {
if (JSON && JSON.parse) {
resp = JSON.parse(resp);
} else {
resp = eval("(".concat(resp, ")"));
monitor$1.setSum(523105, 127, 1).send();
}
var rtId = obj.rtId;
var rtKey = obj.rtKey || 0;
var rtDesc = obj.rtDesc;
if (rtId && rtDesc && RespTypes && !RespTypes.check(resp, rtDesc)) {
reportRt(+rtId, +rtKey, "".concat(RespTypes.getMsg(), "[detail]").concat(responseText, ";").concat(obj.url));
}
if (resp && resp.base_resp && ((_a = resp.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) {
var reportUrl = url;
if (url.indexOf('?') !== -1) {
reportUrl = url.substring(0, url.indexOf('?'));
if (Url.getQuery('action', url)) {
reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', url));
}
}
if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resp.base_resp.ret === 'undefined')) {
window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resp.base_resp.ret), {
mid: window.PAGE_MID,
view: 'wap_retcode'
});
}
}
} catch (e) {
obj.error && obj.error(xhr, {
type: 1,
error: e,
status: xhr.status
});
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 1,
HttpCode: xhr.status || 0,
Ret: 0
});
}
return;
}
}
if (_typeof(resp) === 'object' && ((_b = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _b === void 0 ? void 0 : _b.ret) !== 0) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 4,
HttpCode: xhr.status || 0,
Ret: ((_c = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0
});
}
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 0,
HttpCode: xhr.status || 0,
Ret: ((_d = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _d === void 0 ? void 0 : _d.ret) || 0
});
}
}
obj.success && obj.success(resp);
} catch (e) {
__moon_report({
offset: MOON_AJAX_SUCCESS_OFFSET,
e: e
});
throw e;
}
};
var handleRespErr = function handleRespErr(xhr, error, requestType) {
try {
obj.error && obj.error(xhr, {
type: 2,
error: error,
status: xhr.status
});
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type,
RequestType: requestType,
RetType: 2,
HttpCode: xhr.status,
Ret: 0
});
}
} catch (e) {
__moon_report({
offset: MOON_AJAX_ERROR_OFFSET,
e: e
});
throw e;
}
};
var handleRespComplete = function handleRespComplete() {
clearTimeout(timer);
try {
obj.complete && obj.complete();
} catch (e) {
__moon_report({
offset: MOON_AJAX_COMPLETE_OFFSET,
e: e
});
throw e;
}
obj.complete = null;
};
var handleReqTimeout = function handleReqTimeout(xhr) {
if (typeof obj.timeout !== 'undefined') {
timer = setTimeout(function () {
xhr.abort();
try {
obj.complete && obj.complete();
} catch (e) {
__moon_report({
offset: MOON_AJAX_COMPLETE_OFFSET,
e: e
});
throw e;
}
obj.complete = null;
__moon_report({
offset: MOON_AJAX_TIMEOUT_OFFSET,
log: "ajax_timeout_error: ".concat(url),
e: ''
});
}, obj.timeout);
}
};
var retryXhrFn = function retryXhrFn(res, isTimeout, reqLogItem) {
var retryXhr = new XMLHttpRequest();
try {
retryXhr._noVConsole = true;
} catch (err) {}
retryXhr.open(type, url);
retryXhr.onreadystatechange = function () {
if (isTimeout) return;
if (retryXhr.readyState === 3) {
obj.received && obj.received(retryXhr);
}
if (retryXhr.readyState === 4) {
beforeResp(retryXhr);
var retryStatus = retryXhr.status;
if (retryStatus >= 200 && retryStatus < 400) {
handleRespSucc(retryXhr, 1);
} else {
handleRespErr(retryXhr, res, 1);
window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure', JSON.stringify({
retryXhrStatus: retryStatus,
transferRes: res
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
}
reqLogItem.status = retryStatus;
reqLogItem.endTime = Date.now();
reqLogItem.response = retryXhr.responseText;
handleRespComplete();
networkEndLog(reqLogItem);
}
};
setXhrHeader(retryXhr, type, obj);
retryXhr.send(data);
};
if (ajaxScope && !obj.pureHttp) {
var header = {
'User-Agent': navigator.userAgent,
'Cookie': (window.__test_env__ ? 'uniproxy_route=1; ' : '') + document.cookie,
'Referer': location.href
};
if (obj.contentType) {
header['Content-Type'] = obj.contentType;
} else if (type === 'POST') {
header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
if (!obj.noXRequestedWidthHeader) {
header['X-Requested-With'] = 'XMLHttpRequest';
}
var reqUrl = new URL(url, location.href).href;
var method = METHOD_ENUM[type] || 0;
var params = Device.os.pc ? {
url: reqUrl,
req_json: data || '',
scope: ajaxScope,
webcgi_method: method,
webcgi_header: Object.keys(header).map(function (headerItemKey) {
return Device.os.Mac ? _defineProperty({}, headerItemKey, header[headerItemKey]) : {
key: headerItemKey,
value: header[headerItemKey]
};
}),
cgi_type: 1
} : {
reqUrl: reqUrl,
reqBody: data,
scope: ajaxScope,
method: method,
header: header
};
var reqLogItem = networkStartLog({
method: type,
url: url,
postData: obj.data || {},
requestHeader: header,
requestType: 'transfer',
startTime: Date.now(),
responseType: url.indexOf('f=json') > 0 ? 'json' : undefined
});
var isTimeout = false;
handleReqTimeout({
abort: function abort() {
isTimeout = true;
reqLogItem.endTime = Date.now();
reqLogItem.response = 'timeout';
networkEndLog(reqLogItem);
}
});
Device.os.pc && monitor$1.setSum(115849, 69, 1);
JSAPI.invoke(Device.os.pc ? 'H5ExtTransfer' : 'webTransfer', params, function (res) {
var _a, _b, _c, _d, _e, _f;
if (isTimeout) return;
var status = 400;
var result = '';
if (Device.os.pc) {
try {
var retFlag = res.base_resp.ret === 0 && res.jsapi_resp.ret === 0 && res.err_msg.indexOf(':ok') > -1;
var respJsonFlag = res.jsapi_resp.resp_json;
status = retFlag && respJsonFlag ? 200 : 400;
result = res.jsapi_resp.resp_json;
} catch (err) {
console.error(err);
}
} else {
status = res && res.errCode * 1 === 0 && typeof res.result === 'string' && res.result ? 200 : 400;
result = res.result;
}
try {
Log.log("ajax transfer, status: ".concat(status, ", reqUrl: ").concat(reqUrl));
} catch (err) {
console.error(err);
}
if (status >= 200 && status < 400) {
obj.received && obj.received(null);
beforeResp({
status: status
});
handleRespSucc({
status: status,
responseText: result
}, 10);
reqLogItem.status = status;
reqLogItem.endTime = Date.now();
reqLogItem.response = result;
handleRespComplete();
networkEndLog(reqLogItem);
} else if (window.__second_open__) {
JSAPI.invoke('request', {
url: reqUrl,
method: type,
data: data,
header: header
}, function (retryRes) {
try {
Log.log("ajax retry request, retryStatus: ".concat((retryRes === null || retryRes === void 0 ? void 0 : retryRes.statusCode) || '', ", reqUrl: ").concat(reqUrl));
} catch (err) {
console.error(err);
}
if (isTimeout) return;
var retryStatus = retryRes.statusCode;
obj.received && obj.received(null);
beforeResp({
status: retryStatus
});
if (retryRes.err_msg.indexOf(':ok') > -1 && retryStatus >= 200 && retryStatus < 400) {
handleRespSucc({
status: retryStatus,
responseText: retryRes.data
}, 20);
} else {
retryXhrFn(res, isTimeout, reqLogItem);
handleRespErr({
status: retryStatus
}, res, 20);
window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure_sec_open', JSON.stringify({
retryReqJsapiRes: retryRes,
transferRes: res,
url: reqUrl
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
}
reqLogItem.status = retryStatus;
reqLogItem.endTime = Date.now();
reqLogItem.response = retryRes.data;
handleRespComplete();
networkEndLog(reqLogItem);
});
} else {
retryXhrFn(res, isTimeout, reqLogItem);
}
if (Device.os.pc) {
if (!res.err_msg.includes(':ok')) {
(_b = (_a = window.WX_BJ_REPORT) === null || _a === void 0 ? void 0 : _a.BadJs) === null || _b === void 0 ? void 0 : _b.report("pc transfer res no ok: ".concat(res.err_msg), params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
try {
if (res.jsapi_resp.resp_json && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 0 && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 190001 || res.base_resp.ret !== 0 || res.jsapi_resp.ret !== 0) {
(_d = (_c = window.WX_BJ_REPORT) === null || _c === void 0 ? void 0 : _c.BadJs) === null || _d === void 0 ? void 0 : _d.report("pc transfer res invalid ret", params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
} catch (err) {}
} else {
try {
if (res.errCode !== 0) {
(_f = (_e = window.WX_BJ_REPORT) === null || _e === void 0 ? void 0 : _e.BadJs) === null || _f === void 0 ? void 0 : _f.report("mobile transfer res invalid ret", params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
} catch (err) {}
}
});
beforeReq();
return;
}
var xhr = new XMLHttpRequest();
var mayAbort = !!obj.mayAbort;
var async = typeof obj.async === 'undefined' ? true : obj.async;
var _onreadystatechange = xhr.onreadystatechange;
xhr.open(type, url, async);
xhr.onreadystatechange = function () {
if (typeof _onreadystatechange === 'function') {
_onreadystatechange.apply(xhr);
}
if (xhr.readyState === 3) {
obj.received && obj.received(xhr);
}
if (xhr.readyState === 4) {
beforeResp(xhr);
xhr.onreadystatechange = null;
var status = xhr.status;
if (status >= 200 && status < 400) {
handleRespSucc(xhr, 1);
} else {
handleRespErr(xhr, 'status error', 1);
if (!!status || !mayAbort) {
var __ajaxtest = window.__ajaxtest || '0';
__moon_report({
offset: MOON_AJAX_NETWORK_OFFSET,
log: "ajax_network_error[".concat(status, "][").concat(__ajaxtest, "]: ").concat(url, ";host:").concat(location.host),
e: ''
});
}
}
handleRespComplete();
}
};
setXhrHeader(xhr, type, obj);
handleReqTimeout(xhr);
try {
xhr.send(data);
try {
if (url && url.length > LENGTH_LIMIT) {
reportAjaxLength(27613, 17, "ajax get limit[length: ".concat(url.length, "]").concat(url.substring(0, 1024)));
}
if (data && !(data instanceof Blob) && data.length > LENGTH_LIMIT) {
reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.length, "]").concat(data.substring(0, 1024)));
}
if (data && data instanceof Blob && data.size > LENGTH_LIMIT) {
reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.size, "]blob"));
}
} catch (e) {
}
} catch (e) {
obj.error && obj.error(xhr, {
type: 3,
error: e,
status: 0
});
}
beforeReq();
});
}
mmVersion.isWindowsWechat && mmVersion.compareHexVersion('0xf2550000') || mmVersion.isMacWechat && mmVersion.compareHexVersion('0xf2650000');
var getBrandServiceType = function getBrandServiceType() {
var serviceType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.service_type;
var _a, _b;
var brandServiceType = 0;
if (serviceType !== undefined) brandServiceType = serviceType + 1;
if (((_b = (_a = window.cgiData) === null || _a === void 0 ? void 0 : _a.trans_appmsg_info) === null || _b === void 0 ? void 0 : _b.trans_type) * 1 === 1) brandServiceType = 3;
return brandServiceType;
};
function setCurrentMpInfo(ifShow) {
var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true) || mmVersion.isAndroid && mmVersion.gtVersion('7.0.12', true);
var supportLiveStatus = mmVersion.isIOS && mmVersion.gtVersion('8.0.46', true) || mmVersion.isAndroid && mmVersion.gtVersion('8.0.46', true);
JSAPI.invoke('currentMpInfo', {
userName: window.user_name,
brandName: !!supportNewTopBar && window.nickname === '' ? '未命名账号' : window.title,
title: window.msg_title || '',
brandIcon: window.hd_head_img.replace(/\/0$/, '/132'),
itemShowType: window.item_show_type,
isPaySubscribe: window.isPaySubscribe,
topBarStyle: supportNewTopBar ? 1 : 0,
topBarShowed: ifShow,
disableShowFinderLiveTopBar: !ifShow && supportLiveStatus ? 1 : 0,
brandServiceType: getBrandServiceType()
}, function () {});
}
function AjaxWx(obj) {
var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {};
obj.url += obj.url.indexOf('?') === -1 ? '?fasttmplajax=1' : '&fasttmplajax=1';
if (getAjaxScope(obj.url)) {
Ajax(obj);
return;
}
if (obj.usePb) {
obj.type = 'POST';
obj.data = {
data: JSON.stringify(obj.data)
};
}
if (!/^(http:\/\/|https:\/\/|\/\/)/.test(obj.url)) {
obj.url = "https://mp.weixin.qq.com/".concat(obj.url.replace(/^\//, ''));
} else if (/^\/\//.test(obj.url)) {
obj.url = "https:".concat(obj.url);
}
if (obj.f !== 'html' && (obj.url.indexOf('?f=json') === -1 || obj.url.indexOf('&f=json') === -1)) {
obj.url += '&f=json';
}
if (!obj.notJoinUrl && obj.f !== 'html') {
obj.url = Url.joinUrl(obj.url);
}
Url.joinUserArticleRole(obj.url, !!obj.notJoinUrl, function (url) {
obj.url = url;
var urlObj = new URL(url, location.origin);
var data = null;
if (_typeof(obj.data) === 'object') {
var d = obj.data;
var ds = [];
for (var k in d) {
if (d.hasOwnProperty(k)) {
ds.push("".concat(k, "=").concat(encodeURIComponent(d[k])));
}
}
data = ds.join('&');
} else {
data = typeof obj.data === 'string' ? obj.data : null;
}
var header = {
Cookie: document.cookie,
referer: location.href
};
if (obj.contentType) {
header['Content-Type'] = obj.contentType;
} else if ((obj.type || 'GET').toUpperCase() === 'POST') {
header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
var reqLogItem = networkStartLog({
method: obj.type || 'GET',
url: obj.url,
postData: obj.data || {},
requestHeader: header,
requestType: 'jsapi',
startTime: Date.now()
});
var retryTime = 1;
var jsapiRequest = function jsapiRequest(obj, data) {
return JSAPI.invoke('request', {
url: obj.url,
method: obj.type,
data: data,
header: header
}, function (res) {
var _a, _b, _c, _d, _e, _f;
if (res.err_msg.indexOf(':ok') > -1 && (!res.statusCode || res.statusCode >= 200 && res.statusCode < 400)) {
if (reqType(obj, '/mp/getappmsgext')) {
window.receiveGetAppmsgExt = "".concat(res.statusCode, "|").concat(Date.now());
}
if (reqType(obj, '/mp/getappmsgad')) {
window.receiveGetAppmsgAd = "".concat(res.statusCode, "|").concat(Date.now());
}
if (retryTime === 1) {
obj.received && obj.received(null);
}
var resData = {};
if (res.data) {
try {
if (obj.dataType === 'json') {
resData = JSON.parse(res.data);
} else {
resData = res.data;
}
if (resData && resData.base_resp && ((_a = resData.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) {
var reportUrl = obj.url;
if (obj.url.indexOf('?') !== -1) {
reportUrl = obj.url.substring(0, obj.url.indexOf('?'));
if (Url.getQuery('action', obj.url)) {
reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', obj.url));
}
}
if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resData.base_resp.ret === 'undefined')) {
window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resData.base_resp.ret), {
mid: window.PAGE_MID,
view: 'wap_retcode'
});
}
}
} catch (e) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: ((_b = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _b === void 0 ? void 0 : _b.ret) || 0
});
}
console.error(e);
obj.error && obj.error(null, {
type: 1,
error: e,
status: res.statusCode
});
obj.complete && obj.complete();
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
return;
}
}
var tmpResData = {};
try {
tmpResData = JSON.parse(res.data);
} catch (e) {}
if (tmpResData && tmpResData.base_resp && tmpResData.base_resp.ret === -3 && retryTime < 2 && (mmVersion.isIOS || mmVersion.isAndroid && mmVersion.getInner() > '27000600')) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: ((_c = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0
});
}
var _retryTime = retryTime++;
JSAPI.invoke('updatePageAuth', {}, function (res) {
console.log('[skeleton] updatePageAuth', res);
monitor$1.setSum(112287, 3, 1);
if (res && res.err_msg && res.err_msg.indexOf(':ok') > -1) {
window.top.pass_ticket = encodeURIComponent(Url.getQuery('pass_ticket', res.fullUrl).html(false).replace(/\s/g, '+'));
if (obj.pass_ticket) {
obj.pass_ticket = window.top.pass_ticket;
}
console.warn('[skeleton] updatePageAuth resetTopbar');
var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true);
var showBottomBar = !!window.is_login;
if (window.top.item_show_type === '0' && supportNewTopBar) {
var top = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0;
setCurrentMpInfo(top > 40 && !showBottomBar);
}
try {
obj.url = Url.addParam(obj.url, 'retry', _retryTime, true);
} catch (err) {
console.error(err);
}
jsapiRequest(obj, data);
monitor$1.setSum(112287, 4, 1);
} else {
obj.success && obj.success(resData);
obj.complete && obj.complete();
if (mmVersion.isIOS) {
monitor$1.setSum(112287, 35, 1);
} else {
monitor$1.setSum(112287, 36, 1);
}
reqLogItem.status = 200;
reqLogItem.endTime = Date.now();
reqLogItem.response = resData;
networkEndLog(reqLogItem);
}
});
} else {
if (((_d = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _d === void 0 ? void 0 : _d.ret) !== 0) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 4,
HttpCode: res.statusCode || 0,
Ret: ((_e = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _e === void 0 ? void 0 : _e.ret) || 0
});
}
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 0,
HttpCode: res.statusCode || 0,
Ret: ((_f = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _f === void 0 ? void 0 : _f.ret) || 0
});
}
}
obj.success && obj.success(resData);
obj.complete && obj.complete();
reqLogItem.status = 200;
reqLogItem.endTime = Date.now();
reqLogItem.response = resData;
networkEndLog(reqLogItem);
}
} else if (res.err_msg.indexOf('no permission') > -1 || !mmVersion.isOnlyWechat) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: 0
});
}
Ajax(obj);
if (res.err_msg.indexOf('no permission') > -1) {
console.warn('[JSAPI Request] No permission');
monitor$1.setSum(112287, 31, 1);
}
reqLogItem.status = 302;
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 2,
HttpCode: res.statusCode || 0,
Ret: 0
});
}
obj.error && obj.error(null, {
type: 3,
error: res,
status: 0
});
obj.complete && obj.complete();
monitor$1.setSum(112287, 32, 1);
var sample = 0.001;
if (Math.random() < sample) {
var msg = "request: ".concat(JSON.stringify(obj.type), " ").concat(JSON.stringify(obj.url), " ;;;; cookie: ").concat(JSON.stringify(document.cookie), " ;;;; data: ").concat(JSON.stringify(data), " ;;;; resp: ").concat(JSON.stringify(res));
if (window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) {
window.WX_BJ_REPORT.BadJs.report('ajax_wx_request_error', msg, {
mid: 'mmbizwap:Monitor'
});
}
}
reqLogItem.status = 400;
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
}
});
};
if (reqType(obj, '/mp/getappmsgext')) {
window.startGetAppmsgExtTime = Date.now();
}
if (reqType(obj, '/mp/getappmsgad')) {
window.startGetAppmsgAdTime = Date.now();
}
jsapiRequest(obj, data);
});
}
function _regeneratorRuntime() { _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var AjaxRouter = function () {
var _ref = _asyncToGenerator( _regeneratorRuntime().mark(function _callee(obj) {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!window.__secPageAuthPromise) {
_context.next = 3;
break;
}
_context.next = 3;
return window.__secPageAuthPromise;
case 3:
if (!(!mmVersion.isWxWork && (window.__second_open__ || !getIsAcrossOrigin() && top.window.__second_open__) && window.__is_page_auth_return__ && !obj.pureHttp)) {
_context.next = 5;
break;
}
return _context.abrupt("return", AjaxWx(obj));
case 5:
return _context.abrupt("return", Ajax(obj));
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return function AjaxRouter(_x) {
return _ref.apply(this, arguments);
};
}();
var isx5 = navigator.userAgent.indexOf('TBS/') !== -1;
var getDataFunc = [];
var reportData = [];
var specificData = {};
function joinUrl(url) {
var obj = {};
if (typeof window.uin !== 'undefined') {
obj.uin = window.uin;
}
if (typeof window.key !== 'undefined') {
obj.key = window.key;
}
if (typeof window.pass_ticket !== 'undefined') {
obj.pass_ticket = window.pass_ticket;
}
if (typeof window.wxtoken !== 'undefined') {
obj.wxtoken = window.wxtoken;
}
if (typeof window.devicetype !== 'undefined') {
obj.devicetype = window.devicetype;
}
if (typeof window.clientversion !== 'undefined') {
obj.clientversion = window.clientversion;
}
if (typeof window.appmsg_token !== 'undefined') {
obj.appmsg_token = window.appmsg_token;
} else if (url.indexOf('advertisement_report') > -1) {
new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random());
}
obj.x5 = isx5 ? '1' : '0';
obj.f = 'json';
return Url.join(url, obj);
}
function isObj(obj) {
return obj && _typeof(obj) === 'object';
}
function assign(target, source) {
if (isObj(target) && isObj(source)) {
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
function assembleReportData(initiative) {
var leaveReportLog = [];
leaveReportLog.push({
content: "[LeaveReport] specificData keys: ".concat(Object.keys(specificData)),
timestamp: Date.now()
});
Log.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData)));
console.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData)));
var allReportData = {};
for (var reportField in specificData) {
if (!allReportData[reportField]) {
allReportData[reportField] = {};
}
for (var i = 0; i < specificData[reportField].length; i++) {
var param = specificData[reportField][i];
if (typeof param === 'function') {
try {
assign(allReportData[reportField], param(initiative));
} catch (err) {
leaveReportLog.push({
content: "[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)),
timestamp: Date.now()
});
Log.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)));
console.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)));
}
} else if (isObj(param)) {
assign(allReportData[reportField], param);
}
}
}
leaveReportLog.push({
content: "[LeaveReport] reportData.length: ".concat(reportData.length),
timestamp: Date.now()
});
Log.log("[LeaveReport] reportData.length: ".concat(reportData.length));
console.log("[LeaveReport] reportData.length: ".concat(reportData.length));
leaveReportLog.push({
content: "[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length),
timestamp: Date.now()
});
Log.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length));
console.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length));
for (var _i = 0; _i < getDataFunc.length; _i++) {
try {
var data = getDataFunc[_i](initiative);
if (isObj(data)) {
reportData.push(data);
}
} catch (err) {
leaveReportLog.push({
content: "[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)),
timestamp: Date.now()
});
Log.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)));
console.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)));
}
}
for (var _i2 = 0; _i2 < reportData.length; _i2++) {
if (reportData[_i2].reportUrl) {
reportData[_i2].reportUrl = joinUrl(reportData[_i2].reportUrl);
}
}
allReportData.data = {
'requestList': reportData
};
leaveReportLog.push({
content: "[LeaveReport] final reportData.length: ".concat(reportData.length, ", data=").concat(JSON.stringify(reportData)),
timestamp: Date.now()
});
Log.log("[LeaveReport] final reportData.length: ".concat(reportData.length));
console.log("[LeaveReport] final reportData.length: ".concat(reportData.length));
allReportData.info = leaveReportLog;
return allReportData;
}
function addReport(param) {
if (typeof param === 'function') {
getDataFunc.push(param);
} else if (isObj(param)) {
reportData.push(param);
}
}
function addSpecificReport(reportField, param) {
if (!specificData[reportField]) {
specificData[reportField] = [];
}
specificData[reportField].push(param);
}
function reportNow(callback) {
var allReportData = assembleReportData(true);
JSAPI.invoke('handleMPPageAction', {
action: 'reportByLeaveForMPGateway',
reportData: allReportData
}, function (res) {
if (res && res.err_msg && res.err_msg.indexOf(':ok') !== -1) {
getDataFunc = [];
reportData = [];
specificData = {};
typeof callback === 'function' && callback(res);
} else {
getDataFunc = [];
reportData = [];
var len = allReportData.data.requestList.length;
allReportData.data.requestList.forEach(function (req) {
if (req.reportUrl) {
AjaxRouter({
type: req.method || 'GET',
url: req.reportUrl,
data: req.reportData,
async: false,
success: function success(resp) {
if (--len < 0) {
typeof callback === 'function' && callback({
err_msg: 'handleMPPageAction:ok',
fallback: true,
resp: resp
});
}
},
error: function error(xhr, err) {
if (--len < 0) {
typeof callback === 'function' && callback({
err_msg: 'handleMPPageAction:fail',
fallback: true,
err: err
});
}
}
});
}
});
}
});
}
var leaveReport = {
reportNow: reportNow,
addReport: addReport,
addSpecificReport: addSpecificReport
};
var _leaveReport = (function () {
var doc = {};
var isCrossOrigin = false;
try {
doc = top.window.document;
} catch (e) {
isCrossOrigin = true;
}
if (!isCrossOrigin && top.window.__leaveReport) {
return top.window.__leaveReport;
}
if (window.__leaveReport) {
return window.__leaveReport;
}
JSAPI.on('reportOnLeaveForMP', function () {
return assembleReportData(false);
});
return window.__leaveReport = leaveReport;
})();
var getReportJson = function getReportJson(logId, rawData) {
var data = JSON.parse(JSON.stringify(rawData));
data.log_id = Number(logId);
data.TimeStamp = Math.round(Date.now() / 1000);
console.log('[comm_report] reportjson: ', data);
return JSON.stringify(data);
};
var getSuccessHandler = function getSuccessHandler(logId, data, opt) {
return function (res) {
if (res && res.err_code !== 0) {
console.warn("[comm_report] report ".concat(logId, " fail: "), res.err_msg, data);
}
if (typeof opt.success === 'function') {
opt.success(res);
}
};
};
var getErrorHandler = function getErrorHandler(logId, data, opt) {
return function (xhr, info) {
console.error("[comm_report] report ".concat(logId, " error: "), info, data);
if (typeof opt.error === 'function') {
opt.error(xhr, info);
}
};
};
var batchReportDataArr = [];
var blackLogId = [25587, 18832, 28208, 25574, 29139, 10945];
var BATCH_SIZE = 4;
var BATCH_TIME = 1000;
var getRepeatedReportJson = function getRepeatedReportJson() {
if (!batchReportDataArr || !batchReportDataArr.length) return false;
var reportData = {
count: 0
};
reportData.count = batchReportDataArr.length;
batchReportDataArr.forEach(function (data, index) {
reportData["reportjson".concat(index)] = data;
});
batchReportDataArr = [];
console.log('[reportData]: ', reportData);
return reportData;
};
var timeOutId;
function batchReport() {
if (!batchReportDataArr || !batchReportDataArr.length) return;
var repeatedReportJson = getRepeatedReportJson();
if (!repeatedReportJson) return;
AjaxRouter({
type: 'POST',
dataType: 'json',
url: '/mp/wapcommreport?action=batch_report',
data: repeatedReportJson,
dontReport: true,
success: function success(res) {
if (res && res.err_code) {
console.warn("[comm_report] batch report fail: ", res.err_msg, batchReportDataArr);
}
},
error: function error(xhr, info) {
console.error("[comm_report] batch report error: ", info, batchReportDataArr);
}
});
}
function batchReportThrottle(logId, rawData) {
var reportJsonData = getReportJson(logId, rawData);
if (!reportJsonData) return;
batchReportDataArr.push(reportJsonData);
if (batchReportDataArr.length >= BATCH_SIZE) {
batchReport();
} else {
if (!timeOutId) {
timeOutId = setTimeout(function () {
batchReport();
clearTimeout(timeOutId);
timeOutId = null;
}, BATCH_TIME);
}
}
}
_leaveReport.addReport(function () {
var repeatedReportJson = getRepeatedReportJson();
if (!repeatedReportJson) return false;
var reportData = [];
for (var _i = 0, _Object$entries = Object.entries(repeatedReportJson); _i < _Object$entries.length; _i++) {
var _Object_i = _slicedToArray(_Object$entries[_i], 2),
key = _Object_i[0],
value = _Object_i[1];
reportData.push("".concat(key, "=").concat(encodeURIComponent(value)));
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport?action=batch_report',
reportData: reportData.join('&'),
method: 'POST'
};
});
var commReport = {
report: function report(logId, rawData, rawOpt) {
var opt = rawOpt || {};
if (!opt.realTime && !blackLogId.includes(logId)) {
batchReportThrottle(logId, rawData);
} else {
AjaxRouter({
type: 'POST',
dataType: 'json',
url: '/mp/wapcommreport',
data: {
reportjson: getReportJson(logId, rawData)
},
async: opt.async,
success: getSuccessHandler(logId, rawData, opt),
error: getErrorHandler(logId, rawData, opt)
});
}
},
leaveReport: function leaveReport(logId, rawData) {
_leaveReport.addReport(function () {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport',
reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))),
method: 'POST'
};
});
},
reportByBeacon: function reportByBeacon(logId, rawData) {
try {
if (!Device.os.android && !Device.os.ios && !Device.os.harmony) {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
var url = '/mp/wapcommreport';
var reportJsonData = encodeURIComponent(getReportJson(logId, data));
console.log("reportByBeacon", JSON.stringify(reportJsonData));
navigator.sendBeacon(Url.joinUrl(url), "reportjson=".concat(reportJsonData));
} else {
_leaveReport.addReport(function () {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport',
reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))),
method: 'POST'
};
});
}
} catch (error) {
console.log(error);
}
}
};
var html = function html(_str, encode) {
if (!_str) return '';
var replace = ['`', '`', ''', '\'', '"', '"', ' ', ' ', '>', '>', '<', '<', '¥', '¥', '&', '&', '<', '<', '>', '>'];
var replaceReverse = ['&', '&', '¥', '¥', '<', '<', '>', '>', ' ', ' ', '"', '"', '\'', ''', '`', '`'];
var str = _str;
var target;
if (encode) {
target = replaceReverse;
} else {
target = replace;
}
for (var i = 0; i < target.length; i += 2) {
str = str.replace(new RegExp(target[i], 'g'), target[i + 1]);
}
return str;
};
var htmlLite = function htmlLite(_str, encode) {
if (!_str) return '';
var replace = ['`', '`', ''', '\'', '"', '"', '>', '>', '<', '<', '&', '&'];
var replaceReverse = ['&', '&', '<', '<', '>', '>', '"', '"', '\'', ''', '`', '`'];
var str = _str;
var target;
if (encode) {
target = replaceReverse;
} else {
target = replace;
}
for (var i = 0; i < target.length; i += 2) {
str = str.replace(new RegExp(target[i], 'g'), target[i + 1]);
}
return str;
};
var htmlEncode = function htmlEncode(str) {
return html(str, true);
};
var htmlDecode = function htmlDecode(str) {
return html(str, false);
};
var htmlEncodeLite = function htmlEncodeLite(str) {
return htmlLite(str, true);
};
var htmlDecodeLite = function htmlDecodeLite(str) {
return htmlLite(str, false);
};
String.prototype.html = function (encode) {
return html(this.toString(), encode);
};
String.prototype.htmlEncode = function () {
return htmlEncode(this.toString());
};
String.prototype.htmlDecode = function () {
return htmlDecode(this.toString());
};
String.prototype.htmlLite = function (encode) {
return htmlLite(this.toString(), encode);
};
String.prototype.htmlEncodeLite = function () {
return htmlEncodeLite(this.toString());
};
String.prototype.htmlDecodeLite = function () {
return htmlDecodeLite(this.toString());
};
var isIOS = mmVersion.isIOS,
isAndroid = mmVersion.isAndroid;
var renderDom = function renderDom(dom, cnt, hasStar) {
if (dom) {
if (hasStar) {
dom.innerText = "已星标";
} else {
dom.innerText = "星标";
}
if (hasStar) {
dom.classList.add('rich_media_meta_star');
dom.classList.remove('rich_media_meta_star_cancel');
} else {
dom.classList.add('rich_media_meta_star_cancel');
dom.classList.remove('rich_media_meta_star');
}
dom.style.removeProperty('display');
localStorage.setItem('star_info', JSON.stringify({
mid: window.mid,
idx: window.idx,
has_star: !!hasStar
}));
}
};
var __setStar = function __setStar(dom, cnt, statStatus) {
var hasReportExpose = false;
var hasStar = statStatus;
var realCnt = cnt;
function addStar() {
var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
hasStar = 1;
realCnt = realCnt + 1;
renderDom(dom, realCnt, hasStar);
if (dispatchEvent) window.dispatchEvent(new CustomEvent('star'));
}
function cancelStar() {
var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
hasStar = 0;
realCnt = realCnt - 1;
renderDom(dom, realCnt, hasStar);
if (dispatchEvent) window.dispatchEvent(new CustomEvent('cancel-star'));
}
if (dom) {
renderDom(dom, cnt, statStatus);
var clickHander = function clickHander() {
if (hasStar === 0) {
JSAPI.invoke('operateStar', {
opType: 'addStar'
}, function (res) {
if (res.err_msg && /:ok$/.test(res.err_msg)) addStar();
});
} else {
JSAPI.invoke('operateStar', {
opType: 'cancelStar'
}, function (res) {
if (res.err_msg && /:ok$/.test(res.err_msg)) cancelStar();
});
}
var data = {
BizUin: window.biz,
AppMsgID: window.mid * 1,
ItemIndex: window.idx * 1,
Scene: window.scene,
SubScene: window.subscene * 1,
EnterId: window.enterid,
SessionId: "".concat(window.sessionid),
Event: hasStar ? 8 : 7,
ItemShowType: window.item_show_type * 1
};
commReport.report(17335, data);
};
var exposeHandler = function exposeHandler() {
if (hasReportExpose) return;
var data = {
BizUin: window.biz,
AppMsgID: window.mid * 1,
ItemIndex: window.idx * 1,
Scene: window.scene,
SubScene: window.subscene * 1,
EnterId: window.enterid,
SessionId: "".concat(window.sessionid),
Event: 6,
ItemShowType: window.item_show_type * 1
};
commReport.report(17335, data);
hasReportExpose = true;
};
dom.addEventListener('click', clickHander);
JSAPI.on('onPageStarStateChanged', function (res) {
console.log('onPageStarStateChanged', res);
if (res.state) addStar();else cancelStar();
window.__hasStarInLifecycle = !!hasStar;
});
var intersectionObserver = new IntersectionObserver(exposeHandler);
intersectionObserver.observe(dom);
window.addEventListener('star', function (e) {
if (e && e.detail && e.detail.from === 'frontend') addStar(false);
});
window.addEventListener('cancel-star', function (e) {
if (e && e.detail && e.detail.from === 'frontend') cancelStar(false);
});
document.addEventListener('visibilitychange', function () {
var visible = document.visibilityState === 'visible';
if (!visible) return;
window.__hasStarInLifecycle = !!hasStar;
});
}
};
if (!window.__second_open__) {
var starDom = document.querySelector('#js_star');
var canUseStar = window.canUseStar || isIOS && mmVersion.compareHexVersion('18003623') || isAndroid && mmVersion.compareHexVersion('28003630');
var startPersonCnt = window.star_person_cnt || '';
console.log('canUseStar, startPersonCnt', canUseStar, startPersonCnt);
if (!!(canUseStar * 1)) {
var starSwitch = localStorage.getItem('mp_star_switch');
if (starSwitch === 'true') {
var starInfo = localStorage.getItem('star_info');
var hasStar = 0;
if (starInfo) {
var parseStarInfo = JSON.parse(starInfo);
if (Number(parseStarInfo.mid) === Number(window.mid) && Number(parseStarInfo.idx) === Number(window.idx) && parseStarInfo.has_star) {
hasStar = 1;
}
}
starDom && renderDom(starDom, startPersonCnt * 1, hasStar);
var spanElement = document.getElementById('meta_content_hide_info');
spanElement && spanElement.classList.remove('rich_media_meta_padding');
} else {
starDom && starDom.parentNode.removeChild(starDom);
}
} else {
starDom && starDom.parentNode.removeChild(starDom);
}
window.__setStar = __setStar;
}
exports.__setStar = __setStar;
exports.renderDom = renderDom;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
})({});
天湖园博酒店
💰劲爆预售价:¥699 (¥1388)
园艺尊享大床房 2 晚(连住) + 早餐 2 份/天 + 下午茶 1 份 + 欢迎水果 1 份 + 迷你吧 1 份 + 天湖景区门票1张 4 份 有效期到2026年12月31日离店。全程可约不加价! ![图片]()
这家藏在温州的宝藏酒店很适合短途山野休闲!步行13分钟逛天湖、15分钟闲逛大月湾,自驾5分钟打卡刘伯温故里、6分钟奔赴百丈漈,四周山林环绕,满目青翠清幽。42㎡尊享大床配全景落地玻璃窗,原木简约客房静谧舒服。套餐权益丰厚,午后可以静享精致下午茶,还附赠4张天湖景区入园票,吃住玩乐全包。日历房两晚的价格要1300多,现在套餐价才699,差不多打了对折!关键是端午、暑假、中秋和国庆等热门日期都不加价,快囤~
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥699园艺高级双床房 2 晚(连住) + 早餐 2 份/天
成都尧棠公馆-全球奢华精品酒店
💰劲爆预售价:¥1588起 (¥2288)
棠厢大床房 2 晚(可拆分) + 早餐 2 份/天 + 迷你吧 1 份/天 + 旅拍礼包拍摄含3张精修照片及万昌洋服号服装试穿拍摄(未使用不可折现) 1 份/天 有效期到2026年12月31日离店。端午、暑假、中秋不加价!10.1-10.4加价200元/间/晚。 ![图片]()
这家尧棠公馆可不一般,是成都第一家SLH酒店,以巴金《家》中李家公馆为灵感,将民国式复古腔调拿捏到位,巴金先生的文学元素也随处可见,又融入了老成都鸟笼、麻将等传统韵味;强烈安利玻璃顶的天井和旋转楼梯,真是谁拍谁好看!酒店位置很好,7分钟逛锦城湖、14分钟直达铁像寺水街。房间有落地窗、宝格丽的洗漱用品!套餐同款房型平时两晚要2200+,现在1588就能入住,还送超值双人旅拍礼包,不用额外花钱就能拍复古写真,太划算了!点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1588起棠厢双床房 2 晚(可拆分) + 早餐 2 份/天
来成都玩也可以看看这家——成都锦城原舍酒店(锦里武侯祠店)!酒店就在锦里武侯祠文旅核心区,整体禅茶新中式装修,满满三国文化氛围感。出门步行3分钟即达高升桥地铁站,11分钟漫步至武侯祠、15分钟闲逛锦里古街,紧邻罗马假日广场。住在古街旁既能沉浸式打卡三国人文古迹,出门就能吃透成都地道烟火美食。平时日历房两晚要800多,现在499就能住,便宜了300多!可约日期都不加价哦~
还有其他好价套餐可选:
价格¥499雅居大床房(小度音箱+记忆枕+小冰箱) 2 晚(可拆分)
上海临港锦江国际酒店
💰劲爆预售价:¥1388 (¥2186)
城景豪华双床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份 有效期到2026年09月30日离店。端午、暑假、中秋热门日期不加价! ![图片]()
酒店坐落在滴水湖畔,步行2分钟抵达临港中心、4分钟直达临港演艺中心,顺路就可以打卡中国航海博物馆、滴水湖公园。高层客房在窗边就能欣赏限定烟花与无人机大秀,酒店自带全套亲子游乐设施,遛娃观景一举两得。日历房含早两晚要1800+,现在1388即可连住两晚,差不多打了七七折!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1388城景豪华大床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份
苏州湾华邑温泉度假酒店
💰劲爆预售价:¥1299起 (¥1899)
高级大床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份 有效期到2026年09月30日离店。全程可约,七夕不加价,端午、中秋+200元/间/晚。 ![图片]()
洲际酒店集团旗下,软硬件没得挑,设计又带着点中式古典感,置身于吴江东太湖生态旅游度假区中,周边绿地湖水围绕,又有王焰温泉这样的大咖加持,不管是宅酒店还是出去玩,都很ok!套餐价算下来一晚650,还送温泉票,比日历价便宜300多! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1299起高级双床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份
杭州大运河马可波罗豪廷酒店
💰劲爆预售价:¥599 (¥1399)
城景双床房(金可儿床垫+全屋智能+智能马桶) 2 晚(连住) + 早餐 2 份/天 + 【豪廷食街双人中式套餐】 1 份 + 双人免费西湖往返班车(双店行李寄存) 1 份 + 免费升级豪庭双床房(视房量房态) 1 份 + 现磨咖啡 2 份 + 房间欢迎饮料2瓶 1 份 有效期到2026年12月30日离店,全程可约不加价! ![图片]()
酒店在拱墅区,附近有中大银泰城、万融城、万达广场等商场,距离拱宸桥、京杭大运河博物馆、小河直街历史文化街区等景点不远。现在买套餐还送西湖往返班车,而且优惠价599两晚比平常单晚400+便宜了不少! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥599豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)价格¥999行政套房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住) 价格¥699豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)
杭州湘湖保亿开元名都度假酒店
有效期到2026年09月29日离店,全程可约,端午、中秋不加价! 来杭州玩还可以看看这家,很适合亲子游!酒店靠近湘湖,去森泊也方便,一脚油门也就几分钟,而且套餐价里连门票都包了!内部环境设计感拉满,水镜连廊与天光倒影,随手出片!配套也很齐全、健身房、游泳馆应有尽有。套餐同款暑期要800/晚,套餐价便宜了200,很划算! 还有其他好价套餐可选:
价格¥599豪华大床房 1 晚 价格¥698豪华双床房 2 晚(可拆分)
隐居天目湖WEI酒店
💰劲爆预售价:¥1299起 (¥4599)
隐谧•雅韵双床房【隐居山湖】 2 晚(连住) + 早餐 2 份/天 + 每日MINI吧 1 份 + 鱼头套餐9折券 1 份 + 隐湖寻幽特调双人下午茶 1 份 + 每日传统文化活动体验 + 多媒体放映室观影 + 单车林间骑行和报恩禅寺游览 + 旅拍体验(赠3张精选电子版照片)+ 周日-周四视房量房态免费升级至高级房型 有效期到2026年10月01日离店,全程可约,热门日期加价见详情。 ![图片]()
酒店太会选址了,正对着天目湖!从13米挑高的大堂望出去,无边泳池衔接着浩渺的湖水,那视野简直惊艳!设计偏中式简约风,青瓦白墙,绿树木椅,品上一杯茶,灵魂都要飘香气了。酒店有专属的湖心亭,园内还设了一座露天影院,躺在星空下看一场电影,太惬意!平常一晚就要1300+,套餐价直接5折还送超多礼遇! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1299起隐谧•雅韵大床房【雅致书香+分离式淋浴间】 2 晚(连住)
苏州东太湖皇冠假日酒店
💰劲爆预售价:¥999起 (¥1699)
高级房 超大床 2 晚(连住) 有效期到2026年08月31日离店。全程可约,周末不加价,端午+100元/间/晚。 ![图片]()
这家坐拥太湖新城核心商务区与商圈,而且紧邻苏州湾东地铁站,可直达苏州古城区及高铁苏州站。房间设计简约高级,将吴风雅韵与现代美学结合得很好!更不用说1.8米大床,房间足足50平,视野也很开阔。同款房型暑假要卖到700多,套餐价999两晚,省下来快500块! 点击下图,火速购买 👇👇👇 ![]()
南京南部新城丽笙酒店
💰劲爆预售价:¥1188起 (¥1698)
豪华双床房-全景落地窗带浴缸 2 晚(连住) + Kuksa下午茶 1 份 + 早餐 2 份/天 + 儿童自助早餐 1 份/天 + 迷你吧 1 份 + 欢迎水果 1 份 + 升级至甄选房(视房量房态) 1 份 + 提前至10:00入住(视房量房态) 1 份 + 延迟退房至14:00(视房量房态) 1 份 有效期到2026年09月01日离店。每周五、周六加价100元/间/晚。 ![图片]()
坐拥南部新城核心区位,临近大校场地铁站,距南京南站仅15分钟车程。紧邻京东MALL,雨花台,老门东历史街区等景点。客房以大校场百年航空文化为设计灵感,流畅线条交织怀旧质感与摩登氛围,空间感极强。日历房价格为600多一晚,套餐价为1100多,省下一顿午餐钱!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥618起豪华双床房-全景落地窗带浴缸 1 晚
宁波半山伴水渡假村
💰劲爆预售价:¥199起 (¥458)
清泉岗木屋双床房 1 晚 + 早餐 2 份/天 + 户外双人泳池门票(7月-9月) 1 份 + 2张中坡山森林公园门票 1 份 + 2张观顶湖门票 1 份 有效期到2026年09月24日离店。端午、每周六加价100元/间/晚。 ![图片]()
这个度假村藏于山林之间,距溪口站驾车约30分钟,出行便捷。酒店主打亲子度假,设有季节性开放的无边泳池、大型户外儿童乐园,配套棋牌室和各种拓展设施。酒店还配有八大项主题设施、100余项游乐项目还有德国原版引进的水晶塔!客房有一些是采用特色窑洞设计,还可携带宠物入住。平日日历房价格为400多1晚,套餐价格相当于4.3折,真的很划算!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥299起清泉岗木屋双床房 1 晚 + 早餐 2 份/天
北海香格里拉大酒店
💰劲爆预售价:¥1199 (¥1588)
高级城景双床房-静览珠城繁华烟火 2 晚(连住) + 咖啡苑双人自助早餐 1 份/天 + 参观南珠博物馆(提供讲解服务) 1 份 + 亲子体验活动 1 份 + 提升至高级海景房(视房量房态而定,节假日不适用) 1 份 + 周六日银滩/客运港/侨港接送服务(固定时间) 1 份 + 精美旅拍(壮族服饰体验,赠3张照片) 1 份 有效期到2026年09月30日离店。端午可约,全程不加价! ![]()
酒店紧邻金滩,步行9分钟可达,距北海站驾车约19分钟,出行便捷。自带沙滩泳池与儿童乐园,入住可免费体验赶海活动,还能打卡海上日落栈道。平日日历房价格为600多1晚,现在2晚可立省一顿早餐!附送很多活动体验,还可根据房态情况免费升级房型!
点击下图,火速购买 👇👇👇 ![]()
北京首都宾馆
💰劲爆预售价:¥599起 (¥704)
B座标准遮窗客房 1 晚 + 延迟退房至14:00(视房量房态) 1 份 有效期到2026年08月31日离店。7月1日起,加价179元/间/晚。 ![图片]()
地处前门核心地段,步行7分钟可达前门大街,10分钟至崇文门地铁站、崇文门地铁站,前往天安门广场很便捷。酒店内部自带五千平中式园林,还可体验汉服换装及古风拍摄。直线距离不到1公里可达新世纪百货,购物吃喝都很方便。日历房价格800多1晚,现在不到600元,套餐省了200+,性价比拉满了~
点击下图,火速购买 👇👇👇 ![]()
中旅阿那亚九龙湖·公主酒店
💰劲爆预售价:¥599起 (¥1198)
公主大床房 1 晚 + 双早 1 份/天 + 美茵家庭中式套餐 1 份 + 畅游中旅阿那亚中心小镇/九龙湖生态公园 1 份 + 草坪畅玩飞盘 1 份 + 醉美夕阳·山湖日落和园区接驳车定时接送 1 份 有效期到2026年07月21日离店。每周五加价100元/间/晚,每周六加价200元/间/晚。 ![图片]()
坐落于九龙湖生态区,临近广州白云机场,自驾出行便捷。酒店以欧式典雅建筑和复古小镇群落为主体,呈现欧式浪漫风情,提供专属管家服务,配套季节性开放的室外景观泳池、室内恒温泳池、美茵餐厅和大堂吧,并设有大型儿童乐园和多种休闲项目。平日日历房价格为700多1晚,套餐价格便宜了150+!
点击下图,火速购买 👇👇👇 ![]()
![]()
华南温德姆集团通兑2晚可拆分含早588元
超值特价¥588 ¥848
有效期到2026年08月31日离店
华南温德姆20城49店通兑覆盖长沙、张家界、武汉、广州等20座热门城市,49家门店随心任选,高铁中转、山林游玩、都市逛吃多种出行需求一站式适配,跨城出游灵活省心。
= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var doc$1 = {};
var isAcrossOrigin$1 = false;
var notFoundedMPPageAction = [];
var __moon_report$1 = window.__moon_report || function () {};
var MOON_JSAPI_KEY_OFFSET = 8;
try {
doc$1 = top.window.document;
} catch (e) {
isAcrossOrigin$1 = true;
}
if (!window.JSAPIEventCallbackMap) {
window.JSAPIEventCallbackMap = {};
}
function ready(onBridgeReady) {
var bridgeReady = function bridgeReady() {
try {
if (onBridgeReady) {
window.onBridgeReadyTime = window.onBridgeReadyTime || Date.now();
onBridgeReady();
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: 'ready',
e: e
}]);
throw e;
}
window.jsapiReadyTime = Date.now();
};
if (!isAcrossOrigin$1 && (typeof top.window.WeixinJSBridge === 'undefined' || !top.window.WeixinJSBridge.invoke)) {
if (doc$1.addEventListener) {
doc$1.addEventListener('WeixinJSBridgeReady', bridgeReady, false);
} else if (doc$1.attachEvent) {
doc$1.attachEvent('WeixinJSBridgeReady', bridgeReady);
doc$1.attachEvent('onWeixinJSBridgeReady', bridgeReady);
}
} else {
bridgeReady();
}
}
var invokeNotWaitA8key = ['notifyPageInfo', 'updatePageAuth'
];
var checkNotFoundedInvoke = function checkNotFoundedInvoke(methodName, args) {
if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && notFoundedMPPageAction.includes(args === null || args === void 0 ? void 0 : args.action)) {
return true;
}
return false;
};
function invoke$1(_x, _x2, _x3) {
return _invoke.apply(this, arguments);
}
function _invoke() {
_invoke = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee(methodName, args, callback) {
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__ && !invokeNotWaitA8key.includes(methodName))) {
_context.next = 3;
break;
}
_context.next = 3;
return window.__secPageAuthPromise;
case 3:
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object') {
alert('请在微信中打开此链接');
return false;
}
if (checkNotFoundedInvoke(methodName, args)) {
setTimeout(function () {
if (callback) {
callback.apply(window, [{
err_msg: "".concat(methodName, ":fail"),
err_desc: 'action isn\'t supported'
}]);
}
}, 0);
} else {
top.window.WeixinJSBridge.invoke(methodName, args, function () {
try {
for (var _len2 = arguments.length, rets = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
rets[_key2] = arguments[_key2];
}
var ret = rets[0];
var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : '';
if (['handleMPPageAction', 'handleVideoAction', 'handleHaokanAction'].indexOf(methodName) !== -1) {
var action = (args === null || args === void 0 ? void 0 : args.action) || '';
console.info('[system]', "[jsapi] invoke->".concat(methodName, ", action->").concat(action).concat(errMsg));
} else {
console.info('[system]', "[jsapi] invoke->".concat(methodName).concat(errMsg));
}
if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && ((ret === null || ret === void 0 ? void 0 : ret.err_desc) === 'action isn\'t supported' || (ret === null || ret === void 0 ? void 0 : ret.err_msg) === 'handleMPPageAction:fail action is not supported')) {
notFoundedMPPageAction.push(args === null || args === void 0 ? void 0 : args.action);
}
if (callback) {
callback.apply(window, rets);
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "invoke;methodName:".concat(methodName),
e: e
}]);
throw e;
}
});
}
});
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return _invoke.apply(this, arguments);
}
function call(_x4) {
return _call.apply(this, arguments);
}
function _call() {
_call = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee2(methodName) {
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__)) {
_context2.next = 3;
break;
}
_context2.next = 3;
return window.__secPageAuthPromise;
case 3:
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object') {
return false;
}
try {
top.window.WeixinJSBridge.call(methodName);
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "call;methodName:".concat(methodName),
e: e
}]);
throw e;
}
});
case 4:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _call.apply(this, arguments);
}
function on(eventName, callback) {
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object' || !top.window.WeixinJSBridge.on) {
return false;
}
if (!window.JSAPIEventCallbackMap[eventName]) {
window.JSAPIEventCallbackMap[eventName] = [];
}
window.JSAPIEventCallbackMap[eventName].push(callback);
if (window.JSAPIEventCallbackMap[eventName].length > 1) {
return false;
}
top.window.WeixinJSBridge.on(eventName, function () {
try {
for (var _len = arguments.length, rets = new Array(_len), _key = 0; _key < _len; _key++) {
rets[_key] = arguments[_key];
}
var ret = rets[0];
var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : '';
console.info('[system]', "[jsapi] event->".concat(eventName).concat(errMsg));
if (window.JSAPIEventCallbackMap[eventName] && window.JSAPIEventCallbackMap[eventName].length) {
var result;
for (var i = 0; i < window.JSAPIEventCallbackMap[eventName].length; i++) {
result = window.JSAPIEventCallbackMap[eventName][i].apply(window, rets);
}
return result;
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "on;eventName:".concat(eventName),
e: e
}]);
throw e;
}
});
});
}
function remove(eventName, callback) {
ready(function () {
if (!window.JSAPIEventCallbackMap[eventName]) {
return false;
}
var result = false;
for (var i = window.JSAPIEventCallbackMap[eventName].length - 1; i >= 0; i--) {
if (window.JSAPIEventCallbackMap[eventName][i] === callback) {
window.JSAPIEventCallbackMap[eventName].splice(i, 1);
result = true;
}
}
return result;
});
}
var JSAPI = {
ready: ready,
invoke: invoke$1,
call: call,
on: on,
remove: remove
};
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var ua = navigator.userAgent;
var is_ios = /(iPhone|iPad|iPod|iOS)/i.test(ua);
var is_wp = /Windows\sPhone/i.test(ua);
var is_android = /(Android)/i.test(ua);
var is_wechat = /MicroMessenger\/([\d\.]+)/i.test(ua);
var is_mac = /mac\sos/i.test(ua) && !is_ios;
var is_windows = /windows\snt/i.test(ua) && !is_wp;
var is_mpapp = /MPAPP\/([\d\.]+)/i.test(ua);
var is_ipad = /iPad/i.test(ua);
var is_windows_wechat = /WindowsWechat/i.test(ua);
var is_mac_wechat = /MacWechat/i.test(ua) || /wechat.*mac os/i.test(ua);
var is_prefetch = is_wechat && window.WeixinPrefecherJSBridge;
var is_donut_app = /SAAASDK/i.test(ua);
var is_harmony = /OpenHarmony|ArkWeb/i.test(ua);
var is_linux = /Linux\s/i.test(ua);
var xweb_match = ua.match(/XWEB\/([\d.]+)/i);
var xweb_version = xweb_match && xweb_match[1] ? parseInt(xweb_match[1], 10) : 0;
var is_unified_pc_wechat = /UnifiedPC\w+Wechat/i.test(ua);
var is_in_miniProgram = is_android && /miniprogram/.test(ua.toLowerCase()) || window.__wxjs_environment == 'miniprogram';
var is_wx_work = /wxwork/i.test(ua);
function getUrlParams() {
var vars = location.search.substring(1).split('&');
var params = {};
var _iterator = _createForOfIteratorHelper(vars),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var ele = _step.value;
var pair = ele.split('=');
var key = decodeURIComponent(pair[0]);
if (typeof params[key] === 'undefined') {
params[key] = decodeURIComponent(pair[1]);
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return params;
}
function get() {
var reg = /MicroMessenger\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMac() {
var reg = /MacWechat\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMacOS() {
var reg = /Mac OS X ([\d_]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1].replace(/_/g, '.');
}
return false;
}
function getWindows() {
var reg = /WindowsWechat\(0x(.+?)\)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getWxWork() {
var reg = /wxwork\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMpApp() {
var appVersion = [2, 4, 5];
var match = navigator.userAgent.match(/MPAPP\/(\d+(\.\d+)*)/);
if (match) {
appVersion = match[1].split('.').map(function (v) {
return Number(v);
});
}
return appVersion.join('.');
}
function getUnifiedPcVer() {
var versionInfo = navigator.userAgent.match(/UnifiedPC\w+Wechat\(0xf\w{2}(\w+?)\w{2}\)/);
if (versionInfo && versionInfo.length === 2) {
var version = versionInfo[1];
var mainVersion = getVersionNumber(version.slice(0, 1));
var subVersion = getVersionNumber(version.slice(1, 2));
var subVersion2 = getVersionNumber(version.slice(2, 3));
return [mainVersion, subVersion, subVersion2].join('.');
}
}
function getVersionNumber(hexStr) {
return Number(Number("0x".concat(hexStr)).toString(10));
}
function getWindowsVersionFormat() {
var versionInfo = navigator.userAgent.match(/WindowsWechat\(0x(\w+?)\)/);
if (versionInfo && versionInfo.length === 2) {
var version = versionInfo[1];
var mainVersion = getVersionNumber(version.slice(1, 2));
var subVersion = getVersionNumber(version.slice(2, 4));
var subVersion2 = getVersionNumber(version.slice(4, 6));
return [mainVersion, subVersion, subVersion2].join('.');
}
return false;
}
function getInner() {
var reg = /MicroMessenger\/[\d\.]+\(0x(.+?)\)/i;
var ret = ua.match(reg);
if (ret && ret[1] && ret[1] != null) {
return ret[1];
}
if (!ret && /MicroMessenger\/[\d\.]+/i.test(ua)) {
var urlParams = getUrlParams();
if (urlParams.version) {
return urlParams.version;
}
}
return false;
}
var opfunc = {
'cp-1': function cp1(a, b) {
return a < b;
},
cp0: function cp0(a, b) {
return a === b;
},
cp1: function cp1(a, b) {
return a > b;
}
};
function cpVersion(ver, op, canEq, type) {
var mmver = false;
switch (type) {
case 'mac':
mmver = getMac();
break;
case 'windows':
mmver = getWindowsVersionFormat();
break;
case 'wxwork':
mmver = getWxWork();
break;
case 'mpapp':
mmver = getMpApp();
break;
case 'unifiedpc':
mmver = getUnifiedPcVer();
break;
default:
mmver = get();
break;
}
if (!mmver) {
return;
}
var mmversion = mmver.split('.');
var version = ver.split('.');
if (!/\d+/g.test(mmversion[mmversion.length - 1])) {
mmversion.pop();
}
for (var i = 0, len = Math.max(mmversion.length, version.length); i < len; ++i) {
var mmv = mmversion[i] || '';
var v = version[i] || '';
var mmvn = parseInt(mmv, 10) || 0;
var vn = parseInt(v, 10) || 0;
var eq = opfunc.cp0(mmvn, vn);
if (eq) {
continue;
}
var cp = opfunc["cp".concat(op)];
return cp(mmvn, vn);
}
return canEq || op === 0;
}
function eqVersion(version) {
return cpVersion(version, 0);
}
function gtVersion(version, canEq) {
return cpVersion(version, 1, canEq);
}
function ltVersion(version, canEq) {
return cpVersion(version, -1, canEq);
}
function getPlatform() {
if (is_ios) {
return 'ios';
}
if (is_android) {
return 'android';
}
if (is_mac) {
return 'mac_os';
}
if (is_windows) {
return 'windows';
}
return 'unknown';
}
var is_google_play = false;
var inner_ver_for_google_play_check = getInner();
if (is_android && inner_ver_for_google_play_check) {
var v = "0x".concat(inner_ver_for_google_play_check.substr(-2));
if (parseInt(v) >= 64 && parseInt(v) <= 79) {
is_google_play = true;
}
}
function compareHexVersion(hexNum) {
var innerVersion = getInner();
if (innerVersion && hexNum) {
if (typeof hexNum === 'string') {
hexNum = parseInt(hexNum, 16);
}
var version = parseInt(innerVersion, 16);
return version >= hexNum;
}
return false;
}
var mmVersion = {
get: get,
getMac: getMac,
getMacOS: getMacOS,
getWindows: getWindows,
getInner: getInner,
getWxWork: getWxWork,
getMpApp: getMpApp,
cpVersion: cpVersion,
eqVersion: eqVersion,
gtVersion: gtVersion,
ltVersion: ltVersion,
getPlatform: getPlatform,
getVersionNumber: getVersionNumber,
isWp: is_wp,
isIOS: is_ios,
isAndroid: is_android,
isHarmony: is_harmony,
isHarmonyWechat: is_harmony && is_wechat && cpVersion('1.0.0', 1, true),
isInMiniProgram: is_in_miniProgram,
isWechat: is_wechat,
isMac: is_mac,
isWindows: is_windows,
isLinux: is_linux,
isMacWechat: is_mac_wechat,
isWindowsWechat: is_windows_wechat,
isWxWork: is_wx_work,
isOnlyWechat: is_wechat && !is_wx_work,
isMpapp: is_mpapp,
isIPad: is_ipad,
isGooglePlay: is_google_play,
isPrefetch: is_prefetch,
isDonutAPP: is_donut_app,
compareHexVersion: compareHexVersion,
isPcWechat: is_windows_wechat || is_mac_wechat,
xwebVersion: xweb_version,
isUnifiedPcWechat: is_unified_pc_wechat
};
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toPrimitive(input, hint) {
if (_typeof(input) !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (_typeof(res) !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return _typeof(key) === "symbol" ? key : String(key);
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
var Device = {};
function detect(ua) {
var MQQBrowser = ua.match(/MQQBrowser\/(\d+\.\d+)/i);
var MQQClient = ua.match(/QQ\/(\d+\.(\d+)\.(\d+)\.(\d+))/i) || ua.match(/V1_AND_SQ_([\d\.]+)/);
var WeChat = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/) || ua.match(/MicroMessenger\/((\d+)\.(\d+))/);
var MacOS = ua.match(/Mac\sOS\sX\s(\d+[\.|_]\d+)/);
var WinOS = ua.match(/Windows(\s+\w+)?\s+?(\d+\.\d+)/);
var Linux = ua.match(/Linux\s/);
var MiuiBrowser = ua.match(/MiuiBrowser\/(\d+\.\d+)/i);
var M1 = ua.match(/MI-ONE/);
var MIPAD = ua.match(/MI PAD/);
var UC = ua.match(/UCBrowser\/(\d+\.\d+(\.\d+\.\d+)?)/) || ua.match(/\sUC\s/);
var IEMobile = ua.match(/IEMobile(\/|\s+)(\d+\.\d+)/) || ua.match(/WPDesktop/);
var ipod = ua.match(/(ipod).*\s([\d_]+)/i);
var ipad = ua.match(/(ipad).*\s([\d_]+)/i);
var iphone = ua.match(/(iphone)\sos\s([\d_]+)/i);
var Chrome = ua.match(/Chrome\/(\d+\.\d+)/);
var AndriodBrowser = ua.match(/Mozilla.*Linux.*Android.*AppleWebKit.*Mobile Safari/);
var android = ua.match(/(android)\s([\d\.]+)/i);
var harmony = ua.match(/(OpenHarmony)\s([\d\.]+)/i);
Device.browser = Device.browser || {}, Device.os = Device.os || {};
Device.os.type = -1;
Device.os.unifiedPC = ua.match(/UnifiedPC/);
Device.os.unifiedMac = /UnifiedPCMac/i.test(ua);
Device.os.unifiedWindows = /UnifiedPCWindows/i.test(ua);
if (window.ActiveXObject) {
var vie = 6;
(window.XMLHttpRequest || ua.indexOf('MSIE 7.0') > -1) && (vie = 7);
(window.XDomainRequest || ua.indexOf('Trident/4.0') > -1) && (vie = 8);
ua.indexOf('Trident/5.0') > -1 && (vie = 9);
ua.indexOf('Trident/6.0') > -1 && (vie = 10);
Device.browser.ie = true, Device.browser.version = vie;
} else if (ua.indexOf('Trident/7.0') > -1) {
Device.browser.ie = true, Device.browser.version = 11;
}
if (android) {
Device.os.android = true;
Device.os.version = android[2];
Device.os.type = 2;
}
if (harmony) {
Device.os.harmony = true;
Device.os.version = harmony[2];
Device.os.type = 42;
}
if (ipod) {
Device.os.ios = Device.os.ipod = true;
Device.os.version = ipod[2].replace(/_/g, '.');
}
if (ipad) {
Device.os.ios = Device.os.ipad = true;
Device.os.version = ipad[2].replace(/_/g, '.');
Device.os.type = 13;
}
if (iphone) {
Device.os.iphone = Device.os.ios = true;
Device.os.version = iphone[2].replace(/_/g, '.');
Device.os.type = 1;
}
if (WinOS) Device.os.windows = true, Device.os.version = WinOS[2], Device.os.type = 15;
if (MacOS) Device.os.Mac = true, Device.os.version = MacOS[1], Device.os.type = 14;
if (Linux) Device.os.Linux = true, Device.os.type = 33;
if (ua.indexOf('lepad_hls') > 0) Device.os.LePad = true;
if (MIPAD) Device.os.MIPAD = true;
if (MQQBrowser) Device.browser.MQQ = true, Device.browser.version = MQQBrowser[1];
if (MQQClient) Device.browser.MQQClient = true, Device.browser.version = MQQClient[1];
if (WeChat) Device.browser.WeChat = true, Device.browser.mmversion = Device.browser.version = WeChat[1];
if (MiuiBrowser) Device.browser.MIUI = true, Device.browser.version = MiuiBrowser[1];
if (UC) Device.browser.UC = true, Device.browser.version = UC[1] || NaN;
if (IEMobile) Device.browser.IEMobile = true, Device.browser.version = IEMobile[2];
if (AndriodBrowser) {
Device.browser.AndriodBrowser = true;
}
if (M1) {
Device.browser.M1 = true;
}
if (Chrome) {
Device.browser.Chrome = true, Device.browser.version = Chrome[1];
}
if (Device.os.windows) {
if (typeof navigator.platform !== "undefined" && navigator.platform.toLowerCase() == "win64") {
Device.os.win64 = true;
} else {
Device.os.win64 = false;
}
}
if (Device.os.Mac || Device.os.windows || Device.os.Linux || Device.os.unifiedPC || /OpenHarmony/i.test(ua) && /pc/i.test(ua)) {
Device.os.pc = true;
}
var osType = {
iPad7: 'iPad; CPU OS 7',
LePad: 'lepad_hls',
XiaoMi: 'MI-ONE',
SonyDTV: "SonyDTV",
SamSung: 'SAMSUNG',
HTC: 'HTC',
VIVO: 'vivo'
};
for (var os in osType) {
Device.os[os] = ua.indexOf(osType[os]) !== -1;
}
Device.os.phone = Device.os.phone || /windows phone/i.test(ua);
Device.os.getNumVersion = function () {
return parseFloat(Device.os.version);
};
Device.os.hasTouch = 'ontouchstart' in window;
if (Device.os.hasTouch && Device.os.ios && Device.os.getNumVersion() < 6) {
Device.os.hasTouch = false;
}
if (Device.browser.WeChat && Device.browser.version < 5.0) {
Device.os.hasTouch = false;
}
Device.browser.getNumVersion = function () {
return parseFloat(Device.browser.version);
};
Device.browser.isFFCanOcx = function () {
return !!Device.browser.firefox && Device.browser.getNumVersion() >= 3.0;
};
Device.browser.isCanOcx = function () {
return !!Device.os.windows && (!!Device.browser.ie || Device.browser.isFFCanOcx() || !!Device.browser.webkit);
};
Device.browser.isNotIESupport = function () {
return !!Device.os.windows && (!!Device.browser.webkit || Device.browser.isFFCanOcx());
};
Device.userAgent = {};
Device.userAgent.browserVersion = Device.browser.version;
Device.userAgent.osVersion = Device.os.version;
if (Device.os.unifiedPC) {
if (Device.os.unifiedWindows) Device.os.type = 37;else if (Device.os.unifiedMac) Device.os.type = 38;else Device.os.type = 39;
}
delete Device.userAgent.version;
}
detect(window.navigator.userAgent);
function canSupportH5Video() {
var ua = window.navigator.userAgent,
m = null;
if (!!Device.os.android) {
if (Device.browser.MQQ && Device.browser.getNumVersion() >= 4.2) {
return true;
}
if (ua.indexOf('MI2') != -1) {
return true;
}
if (Device.os.version >= '4' && (m = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/))) {
if (parseFloat(m[1]) >= 4.2) {
return true;
}
}
if (Device.os.version >= '4.1') {
return true;
}
}
return false;
}
function canSupportVideoMp4() {
var video = document.createElement('video');
if (typeof video.canPlayType === 'function') {
if (video.canPlayType('video/mp4; codecs="mp4v.20.8"') === 'probably') {
return true;
}
if (video.canPlayType('video/mp4; codecs="avc1.42E01E"') === 'probably' || video.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"') === 'probably') {
return true;
}
}
return false;
}
function canSupportAutoPlay() {
if (Device.os.ios && Device.os.getNumVersion() < 10) {
return false;
}
return true;
}
function isLockdownMode() {
if (!Device.os.ios || Device.os.getNumVersion() < 16) {
return false;
}
if (typeof WebAssembly === 'undefined' && typeof OfflineAudioContext === 'undefined' && typeof WebGLRenderingContext === 'undefined') {
return true;
}
return false;
}
Device.canSupportVideo = canSupportVideoMp4 || canSupportH5Video;
Device.canSupportVideoMp4 = canSupportVideoMp4;
Device.canSupportH5Video = canSupportH5Video;
Device.canSupportAutoPlay = canSupportAutoPlay;
Device.isLockdownMode = isLockdownMode;
Device.cpVersion = function (version) {
var cp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var canEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var nowVersionStr = Device.os.version;
if (!nowVersionStr) return false;
var versionArr = version.split('.');
var nowVersionArr = nowVersionStr.split('.');
for (var i = 0; i < Math.max(nowVersionArr.length, versionArr.length); i++) {
var vi = +versionArr[i];
var nvi = +nowVersionArr[i];
if (vi === nvi) continue;
if (cp > 0) return vi > nvi;
if (cp < 0) return vi < nvi;
}
return canEqual || cp === 0;
};
var initJsBridge = false;
if (!window.JSAPIEventCallbackMap) {
window.JSAPIEventCallbackMap = {};
}
function connectWebViewJavascriptBridge(callback) {
if (window.WebViewMPapp || window.WebViewJavascriptBridge) {
return callback(window.WebViewMPapp || window.WebViewJavascriptBridge);
}
if (window.WVJBCallbacks) {
return window.WVJBCallbacks.push(callback);
}
window.WVJBCallbacks = [callback];
if (!mmVersion.isMpapp) {
return false;
}
if (!initJsBridge) {
initJsBridge = true;
var WVJBIframe = document.createElement('iframe');
WVJBIframe.style.display = 'none';
WVJBIframe.src = 'https://__bridge_loaded__';
document.body.appendChild(WVJBIframe);
setTimeout(function () {
initJsBridge = false;
document.body.removeChild(WVJBIframe);
}, 0);
}
return false;
}
function invoke(jsapiName, opt, callback) {
connectWebViewJavascriptBridge(function (bridge) {
try {
if (typeof opt === 'function') {
callback = opt;
}
if (_typeof(opt) !== 'object' && typeof opt !== 'string') {
opt = {};
}
bridge.callHandler(jsapiName, opt, function (res) {
try {
var ret = _typeof(res) === 'object' ? res : JSON.parse(res);
var errMsg = ret.err_msg || ret.errMsg;
console.info("[mpapp jsapi] invoke->".concat(jsapiName, " ").concat(opt.action || '', " ").concat(errMsg));
typeof callback === 'function' && callback(ret);
} catch (e) {
window.WX_BJ_REPORT.BadJs.report('invoke', "callback ".concat(jsapiName, " error:"), {
mid: 'mmbizwebapp:js_brridge',
_info: e
});
console.error("[mpapp jsapi] ".concat(jsapiName, " ").concat(opt.action || ''), e, res);
}
});
} catch (e) {
window.WX_BJ_REPORT.BadJs.report('invoke', 'callback error:', {
mid: 'mmbizwebapp:js_brridge',
_info: e
});
console.error('[mpapp jsapi]', e);
}
});
}
function _log(level, msg) {
if (level === 'log') {
level = 'info';
msg = "[WechatFe]".concat(msg);
} else {
var prefix = "__wap__".concat(window.__second_open__ ? ' (sec)' : '');
msg = "".concat(prefix, " ").concat(msg, " location:[").concat(location.href, "]");
}
msg += new Error().stack;
if (mmVersion.isMpapp) {
invoke('WNNativeCallbackLog', msg);
} else if (mmVersion.isWechat) {
if (mmVersion.isAndroid) {
console.warn('[system]', "[MicroMsg.JsApiLog][".concat(level, "] jslog : ").concat(msg));
} else if (mmVersion.isIOS) {
JSAPI.invoke('writeLog', {
level: level,
msg: msg
});
} else {
JSAPI.invoke('log', {
level: level,
msg: msg
});
}
}
}
var Log = {
info: function info() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_log('info', args.join(' '));
},
warn: function warn() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_log('warn', args.join(' '));
},
error: function error() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
_log('error', args.join(' '));
},
debug: function debug() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
_log('debug', args.join(' '));
},
log: function log() {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
_log('info', args.join(' '));
}
};
var reportLogs = [];
var reportExtraLogs = [];
var sendUrl = '/mp/jsmonitor?#wechat_redirect';
var monitor = {};
monitor._reportOptions = {
idkey: {}
};
function ObjWithoutProperty(source, exclude) {
if (source === null) return {};
var target = {};
var sourceKeys = Object.keys(source);
for (var i = 0; i < sourceKeys.length; i++) {
var key = sourceKeys[i];
if (exclude.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function formatDataToString(data) {
var reportData = [];
for (var key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
reportData.push(key + '=' + encodeURIComponent(data[key]));
}
}
return reportData.join('&');
}
monitor.getReportData = function (opt) {
opt = opt || {};
var idkey = monitor._reportOptions.idkey || {};
var key = null;
var reportData = {};
var nextKey;
try {
for (key in idkey) {
if (Object.prototype.hasOwnProperty.call(idkey, key) && idkey[key]) {
reportLogs.push(key + '_' + idkey[key]);
}
}
} catch (e) {
return false;
}
if (reportLogs.length === 0) {
return false;
}
if (reportExtraLogs.length) {
reportData.lc = reportExtraLogs.length;
reportExtraLogs.forEach(function (extraLog, index) {
reportData["log".concat(index)] = extraLog;
});
}
try {
var reportOptions = monitor._reportOptions;
if (reportOptions !== null && reportOptions !== undefined) {
for (nextKey in reportOptions) {
if (Object.prototype.hasOwnProperty.call(reportOptions, nextKey)) {
reportData[nextKey] = reportOptions[nextKey];
}
}
}
} catch (e) {
reportData = {};
}
reportData.idkey = reportLogs.join(';');
reportData.t = Math.random();
if (opt.remove !== false) {
reportLogs = [];
reportExtraLogs = [];
monitor._reportOptions = {
idkey: {}
};
}
return reportData;
};
monitor.setLogs = function (opt) {
var id = opt.id;
var key = opt.key;
var value = opt.value;
var extraLog = opt.log;
var others = ObjWithoutProperty(opt, ['id', 'key', 'value', 'log']);
var idkey = monitor._reportOptions.idkey || {};
var param = id + '_' + key;
if (idkey[param]) {
idkey[param] += value;
} else {
idkey[param] = value;
}
monitor._reportOptions.idkey = idkey;
if (extraLog) {
reportExtraLogs.push(extraLog);
}
try {
if (others !== null && others !== undefined) {
for (var otherKey in others) {
if (Object.prototype.hasOwnProperty.call(others, otherKey)) {
monitor._reportOptions[otherKey] = others[otherKey];
}
}
}
} catch (e) {
console.log(e);
}
return monitor;
};
monitor.setAvg = function (id, key, value) {
var idkey = monitor._reportOptions.idkey || {};
var param1 = id + '_' + key;
var param2 = id + '_' + (key - 1);
if (idkey[param1]) {
idkey[param1] += value;
} else {
idkey[param1] = value;
}
if (idkey[param2]) {
idkey[param2] += 1;
} else {
idkey[param2] = 1;
}
monitor._reportOptions.idkey = idkey;
return monitor;
};
monitor.setSum = function (id, key) {
var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var idkey = monitor._reportOptions.idkey;
var param = id + '_' + key;
if (idkey[param]) {
idkey[param] += value;
} else {
idkey[param] = value;
}
monitor._reportOptions.idkey = idkey;
return monitor;
};
monitor.send = function (async, ajax, origin) {
if (async !== false) {
async = true;
}
var data = monitor.getReportData();
origin = origin || '';
if (!data) {
return;
}
if (!!ajax && ajax instanceof Function) {
ajax({
url: origin + sendUrl,
type: 'POST',
mayAbort: true,
data: data,
async: async,
timeout: 2000,
dontReport: true
});
} else {
new Image().src = origin + '/mp/jsmonitor?' + formatDataToString(data) + '#wechat_redirect';
}
};
if (typeof window !== 'undefined' && window.__monitor) {
monitor = window.__monitor;
} else {
typeof window !== 'undefined' && (window.__monitor = monitor);
}
var monitor$1 = monitor;
var logList = [];
var log = function log(msg) {
logList.push(msg);
};
var printLog = function printLog() {
for (var i = 0, len = logList.length; i < len; ++i) {
console.log("[RespType]".concat(logList[i]));
}
};
var isArray = function isArray(val) {
return Object.prototype.toString.call(val) === '[object Array]';
};
var getValueType = function getValueType(value) {
if (isArray(value)) {
return 'array';
}
return _typeof(value);
};
var parseRtDesc = function parseRtDesc(rtDesc, k) {
var type = 'mix';
var isRequired = false;
var key = k;
if (k) {
var requireKeyWord = '_R';
var pos = k.indexOf(requireKeyWord);
var len = k.length - requireKeyWord.length;
isRequired = pos !== -1 && pos === len;
key = isRequired ? k.substring(0, len) : k;
}
if (typeof rtDesc === 'string') {
type = rtDesc;
} else if (isArray(rtDesc)) {
type = 'array';
} else if (_typeof(rtDesc) === 'object') {
type = 'object';
}
return {
key: key,
type: type,
isRequired: isRequired
};
};
var checkForArrayRtDesc = function checkForArrayRtDesc(arr, rtDescs) {
if (!isArray(arr)) {
return false;
}
for (var i = 0, len = arr.length; i < len; ++i) {
var value = arr[i];
var rtDesc = void 0;
var j = 0;
var flag = rtDescs.length === 0;
while (rtDesc = rtDescs[j++]) {
if (checkForRtDesc(value, rtDesc)) {
flag = true;
break;
}
}
if (!flag) {
return false;
}
}
return true;
};
var checkForStringRtDesc = function checkForStringRtDesc(value, rtDesc) {
var valueType = getValueType(value);
var desc = parseRtDesc(rtDesc);
var ret = desc.type === valueType;
if (!ret) {
log("miss match type : ".concat(valueType, " !== ").concat(desc.type));
}
return ret;
};
var checkForObjectRtDesc = function checkForObjectRtDesc(json, rtDesc) {
if (_typeof(json) !== 'object' || isArray(json)) {
log('must be object');
return false;
}
var rootJson = json;
var nowCheckValue = json;
for (var k in rtDesc) {
if (rtDesc.hasOwnProperty(k)) {
var nowCheckDesc = rtDesc[k];
var desc = parseRtDesc(nowCheckDesc, k);
var key = desc.key;
nowCheckValue = rootJson[key];
var valueType = getValueType(nowCheckValue);
if (desc.isRequired && nowCheckValue === undefined) {
log("is required @key=".concat(key));
return false;
}
if (nowCheckValue !== undefined) {
if (valueType !== desc.type && desc.type !== 'mix') {
log("miss match type : ".concat(valueType, " !== ").concat(desc.type, " @key=").concat(key));
return false;
}
if ((valueType === 'array' || valueType === 'object') && desc.type !== 'mix') {
if (!checkForRtDesc(nowCheckValue, nowCheckDesc)) {
return false;
}
}
}
}
}
return true;
};
var checkForRtDesc = function checkForRtDesc(json, rtDesc) {
if (isArray(rtDesc)) {
return checkForArrayRtDesc(json, rtDesc);
}
if (_typeof(rtDesc) === 'object') {
return checkForObjectRtDesc(json, rtDesc);
}
if (typeof rtDesc === 'string') {
return checkForStringRtDesc(json, rtDesc);
}
return false;
};
var _check = function check(json, rtDescs) {
if (typeof json === 'string') {
try {
json = eval("(".concat(json, ")"));
} catch (e) {
log('parse json error');
return false;
}
}
if (_typeof(json) !== 'object') {
log('must be object');
return false;
}
if (!isArray(rtDescs)) {
rtDescs = [rtDescs];
}
var rtDesc;
var i = 0;
while (rtDesc = rtDescs[i++]) {
if (checkForRtDesc(json, rtDesc)) {
return true;
}
}
return false;
};
var RespTypes = {
check: function check(json, rtDesc) {
logList = [];
try {
var ret = _check(json, rtDesc);
if (!ret) {
printLog();
}
return ret;
} catch (e) {
logList.push("[rtException]".concat(e.toString()));
printLog();
return false;
}
},
getMsg: function getMsg() {
return logList.join(';');
}
};
function getInflightMap() {
if (!window.__dedupe_promise_inflight__) {
window.__dedupe_promise_inflight__ = new Map();
}
return window.__dedupe_promise_inflight__;
}
function dedupePromise(key, factory) {
var inflightMap = getInflightMap();
var existing = inflightMap.get(key);
console.log("dedupePromise key=".concat(key, " existing=").concat(existing));
if (existing) {
return existing;
}
var promise = Promise.resolve().then(factory)["finally"](function () {
inflightMap["delete"](key);
});
inflightMap.set(key, promise);
return promise;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
var prefix = '__WXLS__';
var localStorage$1 = window.localStorage || {
getItem: function getItem() {},
setItem: function setItem() {},
removeItem: function removeItem() {},
key: function key() {},
clear: function clear() {
var _a, _b;
(_b = (_a = window.localStorage) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a);
},
length: 0
};
var evictionPolicies = {
noeviction: function noeviction(data) {
return data;
},
'allkeys-random': function allkeysRandom(data, size) {
var keys = Object.keys(data);
var memCnt = 0;
while (memCnt < size) {
var len = keys.length;
var randomKeyIdx = Math.floor(Math.random() * len);
var randomKey = keys[randomKeyIdx];
memCnt += JSON.stringify(data[randomKey]).length;
delete data[randomKey];
keys = Object.keys(data);
}
return data;
},
'volatile-ttl': function volatileTtl(data, size) {
var keys = Object.keys(data);
keys = keys.sort(function (key1, key2) {
var d1 = data[key1];
var d2 = data[key2];
if (d1.exp < d2.exp) return -1;
if (d1.exp > d2.exp) return 1;
return 0;
});
var memCnt = 0;
for (var i = 0; i < keys.length; i++) {
if (memCnt >= size) break;
var key = keys[i];
memCnt += JSON.stringify(data[key]).length;
delete data[key];
}
return data;
},
'clear-all': function clearAll() {
localStorage$1.clear();
return {};
}
};
function formatLogMsg(str) {
return "[WXLS] ".concat(str);
}
var LS = function () {
function LS(func, evictionPolicy, logger) {
_classCallCheck(this, LS);
this.logger = function () {};
if (!func) throw 'require function name.';
this.evictionPolicy = 'noeviction';
this.key = func;
if (typeof logger === 'function') {
this.logger = function (str, type) {
return logger(formatLogMsg(str), type);
};
}
if (evictionPolicy && Object.keys(evictionPolicies).indexOf(evictionPolicy) !== -1) {
this.evictionPolicy = evictionPolicy;
}
this.init();
}
_createClass(LS, [{
key: "init",
value: function init() {
var _a, _b;
this.check();
if (Math.random() * 1000 < 1) {
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.call(this, "LSlen: ".concat(((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length) || localStorage$1.length), 'report');
}
}
}, {
key: "getData",
value: function getData() {
var data = LS.getItem(this.key) || '{}';
try {
data = JSON.parse(data);
} catch (e) {
this.logger("getData error: ".concat(e), 'error');
localStorage$1.removeItem(prefix + this.key);
data = {};
}
return data;
}
}, {
key: "check",
value: function check(isReturn) {
var data = this.getData();
var temp = {};
var now = +new Date();
var key;
var val;
for (key in data) {
val = data[key];
if (+val.exp > now) {
temp[key] = val;
}
}
this.logger("check info: isReturn:".concat(isReturn, " data:").concat(JSON.stringify(temp)), 'info');
if (isReturn) return temp;
LS.setItem(this.key, JSON.stringify(temp), this.logger);
}
}, {
key: "set",
value: function set(key, val, exp) {
var _a, _b;
var data = this.check(true);
data[key] = {
val: val,
exp: exp || +new Date()
};
try {
if (localStorage$1.getItem(prefix + this.key)) localStorage$1.removeItem(prefix + this.key);
localStorage$1.setItem(prefix + this.key, JSON.stringify(data));
this.logger("first set success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data)), 'success');
} catch (e) {
this.logger("first set error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data), " k:").concat(key, " v:").concat(val, " exp:").concat(exp), 'error');
localStorage$1.clear();
LS.setItem(this.key, JSON.stringify(_defineProperty({}, key, {
val: val,
exp: exp || +new Date()
})), this.logger);
}
}
}, {
key: "get",
value: function get(key) {
var data = this.getData();
data = data[key];
return data ? data.val || null : null;
}
}, {
key: "remove",
value: function remove(key) {
var data = this.getData();
if (data[key]) delete data[key];
LS.setItem(this.key, JSON.stringify(data), this.logger);
}
}], [{
key: "getItem",
value: function getItem(key) {
key = prefix + key;
return localStorage$1.getItem(key);
}
}, {
key: "setItem",
value: function setItem(key, val, logger) {
var _a, _b;
key = prefix + key;
var n = 3;
while (n--) {
try {
if (localStorage$1.getItem(key)) localStorage$1.removeItem(key);
localStorage$1.setItem(key, val);
typeof logger === 'function' && logger("setItem success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(key, " val:").concat(val), 'success');
break;
} catch (e) {
typeof logger === 'function' && logger("setItem error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(key, " val:").concat(val), 'error');
LS.clear();
}
}
}
}, {
key: "clear",
value: function clear() {
var i;
var k;
for (i = localStorage$1.length - 1; i >= 0; i--) {
k = localStorage$1.key(i);
if (k.indexOf(prefix) == 0) {
localStorage$1.removeItem(k);
}
}
}
}, {
key: "getSupportEvicationPolicy",
value: function getSupportEvicationPolicy() {
return Object.keys(evictionPolicies);
}
}]);
return LS;
}();
var innerVersion = (mmVersion.getInner() || '').toUpperCase();
var getBizLS = new LS('get_biz_result');
function getBizMap() {
if (!window.__get_biz_map__) {
window.__get_biz_map__ = {};
}
return window.__get_biz_map__;
}
var isGetBizSupported = mmVersion.isOnlyWechat && mmVersion.isIOS && innerVersion >= '18003C2A' || mmVersion.isOnlyWechat && mmVersion.isAndroid && innerVersion >= '28003D3C' || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc');
function invokeGetBiz(needCheckBiz, bizType) {
return dedupePromise("getBiz:".concat(needCheckBiz, ":").concat(bizType), function () {
return new Promise(function (resolve, reject) {
if (!isGetBizSupported) {
reject('Not support');
} else {
JSAPI.invoke('handleMPPageAction', {
action: 'getBiz',
needCheckBiz: needCheckBiz,
bizType: bizType
}, function (res) {
console.log("getBiz needCheckBiz=".concat(needCheckBiz, " bizType=").concat(bizType, " res: ").concat(JSON.stringify(res)));
if (res && res.err_msg && res.err_msg.indexOf('ok') > -1) {
var bizMap = getBizMap();
bizMap[bizType] = res.biz;
resolve(res.biz);
getBizLS.set("".concat(bizType, "_get_biz_result"), res.biz, +new Date() + 3 * 24 * 60 * 60 * 1000);
} else {
reject('Failed to get biz');
}
});
}
});
});
}
function getBiz(needCheckBiz, bizType) {
var _a;
if (needCheckBiz === void 0) {
needCheckBiz = false;
}
if (bizType === void 0) {
bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1;
}
var bizMap = getBizMap();
if (!needCheckBiz && bizMap[bizType] !== undefined) {
return Promise.resolve(bizMap[bizType]);
}
return invokeGetBiz(needCheckBiz, bizType);
}
mmVersion.isOnlyWechat && mmVersion.isIOS || mmVersion.isOnlyWechat && mmVersion.isAndroid || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc');
var getIsAuthor = function getIsAuthor(cb, bizuin, needCheckBiz, bizType) {
var _a;
if (bizuin === void 0) {
bizuin = window.biz;
}
if (needCheckBiz === void 0) {
needCheckBiz = false;
}
if (bizType === void 0) {
bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1;
}
getBiz(needCheckBiz, bizType).then(function (biz) {
cb(biz && biz === bizuin);
})["catch"](function () {
cb(false);
});
};
function parseUrl(url) {
var len = url.length;
var ques_pos = url.indexOf('?');
var hash_pos = url.indexOf('#');
hash_pos = hash_pos == -1 ? len : hash_pos;
ques_pos = ques_pos == -1 ? hash_pos : ques_pos;
var host = url.substring(0, ques_pos);
var query_str = url.substring(ques_pos + 1, hash_pos);
var hash = url.substring(hash_pos + 1);
return {
host: host,
query_str: query_str,
hash: hash
};
}
function join(url, args, noEncode) {
var ret = parseUrl(url);
var query_str = ret.query_str;
var args_arr = [];
if (_typeof(args) === 'object') {
for (var key in args) {
if (args.hasOwnProperty(key)) {
args_arr.push("".concat(key, "=").concat(noEncode ? args[key] : encodeURIComponent(args[key])));
}
}
} else {
args_arr.push(noEncode ? args : encodeURIComponent(args));
}
if (args_arr.length > 0) {
query_str += (query_str !== "" ? "&" : "") + args_arr.join("&");
}
return ret.host + (query_str !== "" ? "?".concat(query_str) : "") + (ret.hash !== "" ? "#".concat(ret.hash) : "");
}
function addParam(url, param, value, forceReplace) {
url = url || location.href;
var firstAndPos = url.indexOf("&");
var len = url.length;
var reverseUrl = url.replace(/^[\w\d]+:[/\\]+/g, "").split("").reverse();
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement, fromIndex) {
var k;
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var O = Object(this);
var len = O.length >>> 0;
if (len === 0) {
return -1;
}
var n = fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
if (n >= len) {
return -1;
}
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {
if (k in O && O[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
}
var lastSlashPos = len - 1 - reverseUrl.indexOf("/");
if (firstAndPos !== -1 && url.indexOf("?") == -1 && firstAndPos > lastSlashPos) {
url = url.replace("&", "?");
}
var reg = new RegExp("([\\?&]".concat(param, "=)[^&#]*"));
if (!url.match(reg)) {
var urlInfo = parseUrl(url);
var hash = urlInfo.hash ? '#' + urlInfo.hash : '';
url = url.replace(hash, '');
var _pos = url.indexOf("?");
if (_pos == -1) {
return "".concat(url, "?").concat(param, "=").concat(value).concat(hash);
}
if (_pos == url.length - 1) {
return "".concat(url + param, "=").concat(value).concat(hash);
}
return "".concat(url, "&").concat(param, "=").concat(value).concat(hash);
}
if (forceReplace === true) {
return url.replace(reg, "$1".concat(value));
}
return url;
}
function addWxfrom(src, wxfrom) {
var offset = window.service_type === 1 ? 10000 : 0;
return addParam(src, 'wxfrom', offset + Number(wxfrom), true);
}
function removeParam(url, param) {
var _URL = new URL(url),
protocol = _URL.protocol,
host = _URL.host,
pathname = _URL.pathname,
search = _URL.search,
hash = _URL.hash;
var queryParams = new URLSearchParams(search);
queryParams["delete"](param);
var newSearch = queryParams.toString();
var newUrl = new URL("".concat(protocol, "//").concat(host).concat(pathname).concat(newSearch ? "?".concat(decodeURIComponent(newSearch)) : "").concat(hash));
return newUrl.toString();
}
function getQuery(name, url) {
var u = url || window.location.search;
var reg = new RegExp("(^|&)".concat(name, "=([^&]*)(&|$)"));
var r = u.substring(u.indexOf('?') + 1).match(reg);
return r !== null ? r[2] : '';
}
function encodeBase64(value) {
try {
return window.btoa(value);
} catch (e) {
return '';
}
}
function decodeBase64(value) {
try {
return window.atob(value);
} catch (e) {
return '';
}
}
function joinUrl$1(url) {
var obj = {};
if (typeof window.uin !== 'undefined') {
obj.uin = window.uin;
}
if (typeof window.key !== 'undefined') {
obj.key = window.key;
}
if (typeof window.pass_ticket !== 'undefined') {
obj.pass_ticket = window.pass_ticket;
}
if (typeof window.wxtoken !== 'undefined') {
obj.wxtoken = window.wxtoken;
}
if (typeof window.devicetype !== 'undefined') {
obj.devicetype = window.devicetype;
}
if (typeof window.clientversion !== 'undefined') {
obj.clientversion = window.clientversion || mmVersion.getInner();
}
obj.version = obj.clientversion;
if (window.biz) {
obj.__biz = window.biz;
}
if (getQuery('enterid')) {
obj.enterid = getQuery('enterid');
}
if (typeof window.appmsg_token !== 'undefined') {
obj.appmsg_token = window.appmsg_token;
} else if (url.indexOf('advertisement_report') > -1) {
new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random());
}
obj.x5 = navigator.userAgent.indexOf('TBS/') !== -1 ? '1' : '0';
obj.f = 'json';
return join(url, obj);
}
function joinUserArticleRole(url, notJoin, cb) {
var bizuin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : window.biz;
var needCheckBiz = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
if (notJoin) {
cb(url);
} else {
getIsAuthor(function (isAuthor) {
cb(addParam(url, 'user_article_role', isAuthor ? 1 : 0, true));
}, bizuin, needCheckBiz);
}
}
function getA8keyQuery(name, url) {
return new Promise(function (resolve) {
if (window.__secPageAuthPromise) {
window.__secPageAuthPromise.then(function () {
resolve(getQuery(name, url));
});
} else {
resolve(getQuery(name, url));
}
});
}
function addHash(url, hash) {
var isReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (isReplace) {
return "".concat(url.split('#')[0]).concat(hash);
}
return "".concat(url).concat(url.indexOf('#') === -1 ? '#' : '').concat(hash);
}
function decodeUrl(url) {
var _url = url;
while (_url.indexOf('&') !== -1) {
_url = _url.htmlDecode();
}
return _url;
}
var Url = {
parseUrl: parseUrl,
join: join,
addParam: addParam,
addWxfrom: addWxfrom,
addHash: addHash,
getQuery: getQuery,
getA8keyQuery: getA8keyQuery,
encodeBase64: encodeBase64,
decodeBase64: decodeBase64,
joinUrl: joinUrl$1,
joinUserArticleRole: joinUserArticleRole,
removeParam: removeParam,
decodeUrl: decodeUrl
};
var _a;
var doc;
var isAcrossOrigin = false;
try {
doc = (_a = window.top) === null || _a === void 0 ? void 0 : _a.window.document;
} catch (e) {
isAcrossOrigin = true;
}
var StatusTextMap = {
200: 'OK',
302: 'Found',
400: 'Bad Request',
500: 'Internal Server Error'
};
function getIsAcrossOrigin() {
return isAcrossOrigin;
}
function networkStartLog(item) {
var _a, _b, _c, _d, _e;
console.log('[system]', "< [request ".concat(item.requestType, "]"), item.url, item.method, item);
var rdevRequestId;
var requestTime = performance.now() / 1000;
if ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) {
try {
var willBeSentOptions = {
url: item.url,
method: item.method,
requestHeaders: Object.assign({}, item.requestHeader || {}, {
RDEV_REQUEST_TYPE: item.requestType
}),
requestBody: item.postData,
requestTime: requestTime
};
rdevRequestId = window.RemoteDevSdk.instance.Network.customRequestWillBeSent(willBeSentOptions);
} catch (err) {}
}
if ((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) {
try {
var vconsoleNetworkItem = (_e = (_d = window.vConsole.network).add) === null || _e === void 0 ? void 0 : _e.call(_d, Object.assign({}, item, {
startTime: Date.now(),
endTime: Date.now(),
status: 0,
readyState: 2,
response: ''
}));
vconsoleNetworkItem.rdevRequestId = rdevRequestId;
vconsoleNetworkItem.requestTime = requestTime;
return vconsoleNetworkItem;
} catch (err) {}
}
if (rdevRequestId) {
return Object.assign(Object.assign({}, item), {
id: '__only_rdev_log__',
rdevRequestId: rdevRequestId,
requestTime: requestTime
});
}
return Object.assign({}, item, {
id: '__system_log__'
});
}
function networkEndLog(item) {
var _a, _b, _c, _d, _e;
console.log('[system]', "> [response ".concat(item.requestType, "]"), item.url, item.response, item);
if (item.rdevRequestId && ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) && item.id !== '__system_log__') {
try {
var finishedOptions = {
requestId: item.rdevRequestId,
url: item.url,
status: +(item.status || '500'),
statusText: StatusTextMap[+(item.status || '500')] || 'Error',
responseHeaders: {
RDEV_RESPONSE_TYPE: item.requestType
},
responseBody: item.response,
requestTime: item.requestTime || 0,
duration: item.costTime || (item.endTime && item.startTime ? item.endTime - item.startTime : performance.now() / 1000 - (item.requestTime || 0))
};
window.RemoteDevSdk.instance.Network.customRequestFinished(finishedOptions);
} catch (err) {}
}
if (((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) && item.id !== '__system_log__') {
try {
item.statusText = "".concat(item.status);
item.responseSize = item.response.length;
item.responseSizeText = "".concat(item.response.length);
return (_e = (_d = window.vConsole.network).update) === null || _e === void 0 ? void 0 : _e.call(_d, item.id, Object.assign({}, item, {
readyState: 4
}));
} catch (err) {}
}
}
function reqType(obj, path) {
return obj.url.indexOf(path) > -1 && obj.url.indexOf('action=') === -1 && (!obj.data || !obj.data.action);
}
function findAjaxScopeByConfig(url, config) {
var pathname = new URL(url, location.href).pathname || '';
var scope = config[pathname.slice(1)];
if (scope) {
return scope;
}
}
function getAjaxScope(ajaxUrl) {
if (Url.getQuery('no_transfer', location.href) !== '1' && mmVersion.isWechat && !mmVersion.isInMiniProgram && !mmVersion.isWxWork && !mmVersion.isMpapp && !isAcrossOrigin && window.__ajaxTransferConfig && _typeof(window.__ajaxTransferConfig) === 'object' && (
mmVersion.isIOS && mmVersion.compareHexVersion('1800282F') || mmVersion.isAndroid && mmVersion.compareHexVersion('28002234') || mmVersion.isWindowsWechat && mmVersion.cpVersion('3.9.5', 1, true, 'windows') || mmVersion.isMacWechat && mmVersion.cpVersion('3.8.4', 1, true, 'mac') || mmVersion.isHarmonyWechat && mmVersion.compareHexVersion('0xf3100b00') && !mmVersion.compareHexVersion('0xf3100c00') || mmVersion.compareHexVersion('0xf3800b00'))) {
try {
return findAjaxScopeByConfig(ajaxUrl, window.__ajaxTransferConfig);
} catch (err) {
}
}
}
function getActionByData(data) {
var _a, _b;
if (_typeof(data) === 'object' && !(data instanceof Blob)) {
if (data.hasOwnProperty('data') && typeof data.data === 'string') {
try {
var workedData = JSON.parse(data.data);
return workedData.action || '';
} catch (e) {}
}
return data.action || '';
}
if (typeof data === 'string') {
return ((_b = (_a = data.split(/[?&]/).find(function (x) {
return x.indexOf('action=') >= 0;
})) === null || _a === void 0 ? void 0 : _a.split('=')) === null || _b === void 0 ? void 0 : _b[1]) || '';
}
return '';
}
var METHOD_ENUM = {
GET: 0,
POST: 1
};
var __moon_report = window.__moon_report || function () {};
var MOON_AJAX_SUCCESS_OFFSET = 3;
var MOON_AJAX_NETWORK_OFFSET = 4;
var MOON_AJAX_ERROR_OFFSET = 5;
var MOON_AJAX_TIMEOUT_OFFSET = 6;
var MOON_AJAX_COMPLETE_OFFSET = 7;
var LENGTH_LIMIT = 4096;
function reportRtError(type, id, key, content) {
var log = '';
var prefix = type === 'rt' ? 'rtCheckError' : 'Ajax Length Limit';
if (content === null || content === void 0 ? void 0 : content.length) {
var loglen = 1000;
var len = content.length;
var lc = Math.ceil(len / loglen);
log = ["&lc=".concat(lc)];
for (var i = 0; i < lc; ++i) {
log.push("&log".concat(i, "=") + "[".concat(prefix, "][").concat(i, "]").concat(encodeURIComponent(content.substring(i * loglen, i * loglen + loglen))));
}
log = log.join('');
}
var data = "idkey=".concat(id, "_").concat(key, "_1").concat(log, "&r=").concat(Math.random());
var xmlobj = new XMLHttpRequest();
xmlobj.open('POST', "".concat(location.protocol, "//").concat(location.host, "/mp/jsmonitor?"), true);
xmlobj.setRequestHeader('cache-control', 'no-cache');
xmlobj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlobj.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xmlobj.send(data);
if (type === 'ajaxLen') {
monitor$1.setLogs({
id: id,
key: key,
value: 1,
log: log
});
}
}
function reportRt(id, key, content) {
reportRtError('rt', id, key, content);
}
function reportAjaxLength(id, key, content) {
reportRtError('ajaxLen', id, key, content);
}
function setXhrHeader(xhr, type, opt) {
if (opt.contentType) {
xhr.setRequestHeader('Content-Type', opt.contentType);
} else if (type === 'POST') {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
}
if (!opt.noXRequestedWidthHeader) {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
}
}
function Ajax(obj) {
var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {};
if (obj.usePb) {
obj.type = 'POST';
obj.data = {
data: JSON.stringify(obj.data)
};
}
var ajaxScope = getAjaxScope(obj.url);
var type = (obj.type || 'GET').toUpperCase();
var timer;
var _url;
if (obj.notJoinUrl) {
_url = obj.url;
} else {
_url = Url.joinUrl(obj.url);
}
Url.joinUserArticleRole(_url, !!obj.notJoinUrl, function (url) {
var urlObj = new URL(url, location.origin);
if (obj.f === 'html') {
url = url.replace('&f=json', '');
}
var data = null;
if (obj.data instanceof Blob) {
data = obj.data;
} else if (_typeof(obj.data) === 'object') {
var d = obj.data;
var ds = [];
for (var k in d) {
if (d.hasOwnProperty(k)) {
ds.push("".concat(k, "=").concat(encodeURIComponent(d[k])));
}
}
data = ds.join('&');
} else {
data = typeof obj.data === 'string' ? obj.data : null;
}
var beginTs;
var beforeReq = function beforeReq() {
if (reqType(obj, '/mp/getappmsgext')) {
window.startGetAppmsgExtTime = Date.now();
Log.log('start get appmsgext, url: ', obj.url);
}
if (reqType(obj, '/mp/getappmsgad')) {
window.startGetAppmsgAdTime = Date.now();
Log.log('start get appmsgad, url: ', obj.url);
}
beginTs = Date.now();
};
var beforeResp = function beforeResp(xhr) {
if (reqType(obj, '/mp/getappmsgext')) {
window.receiveGetAppmsgExt = "".concat(xhr.status, "|").concat(Date.now());
Log.log("receive appmsgext response, status: ".concat(xhr.status));
}
if (reqType(obj, '/mp/getappmsgad')) {
window.receiveGetAppmsgAd = "".concat(xhr.status, "|").concat(Date.now());
Log.log("receive appmsgad response, status: ".concat(xhr.status));
}
if (Math.random() < 0.001 && window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) {
try {
var key = ajaxScope ? 'transfer' : 'xhr';
var interval = 250;
var time = Date.now() - beginTs;
var range = Math.floor(time / interval) * interval;
var pathname = new URL(obj.url, location.href).pathname || '';
window.WX_BJ_REPORT.BadJs.report("".concat(key, "_perf:").concat(pathname), JSON.stringify({
status: xhr.status,
time: "[".concat(range, "-").concat(range + interval, ")")
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
} catch (err) {}
}
};
var handleRespSucc = function handleRespSucc(xhr, requestType) {
var _a, _b, _c, _d;
try {
var responseText = xhr.responseText;
var resp = responseText;
if (obj.dataType === 'json') {
try {
if (JSON && JSON.parse) {
resp = JSON.parse(resp);
} else {
resp = eval("(".concat(resp, ")"));
monitor$1.setSum(523105, 127, 1).send();
}
var rtId = obj.rtId;
var rtKey = obj.rtKey || 0;
var rtDesc = obj.rtDesc;
if (rtId && rtDesc && RespTypes && !RespTypes.check(resp, rtDesc)) {
reportRt(+rtId, +rtKey, "".concat(RespTypes.getMsg(), "[detail]").concat(responseText, ";").concat(obj.url));
}
if (resp && resp.base_resp && ((_a = resp.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) {
var reportUrl = url;
if (url.indexOf('?') !== -1) {
reportUrl = url.substring(0, url.indexOf('?'));
if (Url.getQuery('action', url)) {
reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', url));
}
}
if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resp.base_resp.ret === 'undefined')) {
window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resp.base_resp.ret), {
mid: window.PAGE_MID,
view: 'wap_retcode'
});
}
}
} catch (e) {
obj.error && obj.error(xhr, {
type: 1,
error: e,
status: xhr.status
});
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 1,
HttpCode: xhr.status || 0,
Ret: 0
});
}
return;
}
}
if (_typeof(resp) === 'object' && ((_b = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _b === void 0 ? void 0 : _b.ret) !== 0) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 4,
HttpCode: xhr.status || 0,
Ret: ((_c = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0
});
}
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 0,
HttpCode: xhr.status || 0,
Ret: ((_d = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _d === void 0 ? void 0 : _d.ret) || 0
});
}
}
obj.success && obj.success(resp);
} catch (e) {
__moon_report({
offset: MOON_AJAX_SUCCESS_OFFSET,
e: e
});
throw e;
}
};
var handleRespErr = function handleRespErr(xhr, error, requestType) {
try {
obj.error && obj.error(xhr, {
type: 2,
error: error,
status: xhr.status
});
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type,
RequestType: requestType,
RetType: 2,
HttpCode: xhr.status,
Ret: 0
});
}
} catch (e) {
__moon_report({
offset: MOON_AJAX_ERROR_OFFSET,
e: e
});
throw e;
}
};
var handleRespComplete = function handleRespComplete() {
clearTimeout(timer);
try {
obj.complete && obj.complete();
} catch (e) {
__moon_report({
offset: MOON_AJAX_COMPLETE_OFFSET,
e: e
});
throw e;
}
obj.complete = null;
};
var handleReqTimeout = function handleReqTimeout(xhr) {
if (typeof obj.timeout !== 'undefined') {
timer = setTimeout(function () {
xhr.abort();
try {
obj.complete && obj.complete();
} catch (e) {
__moon_report({
offset: MOON_AJAX_COMPLETE_OFFSET,
e: e
});
throw e;
}
obj.complete = null;
__moon_report({
offset: MOON_AJAX_TIMEOUT_OFFSET,
log: "ajax_timeout_error: ".concat(url),
e: ''
});
}, obj.timeout);
}
};
var retryXhrFn = function retryXhrFn(res, isTimeout, reqLogItem) {
var retryXhr = new XMLHttpRequest();
try {
retryXhr._noVConsole = true;
} catch (err) {}
retryXhr.open(type, url);
retryXhr.onreadystatechange = function () {
if (isTimeout) return;
if (retryXhr.readyState === 3) {
obj.received && obj.received(retryXhr);
}
if (retryXhr.readyState === 4) {
beforeResp(retryXhr);
var retryStatus = retryXhr.status;
if (retryStatus >= 200 && retryStatus < 400) {
handleRespSucc(retryXhr, 1);
} else {
handleRespErr(retryXhr, res, 1);
window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure', JSON.stringify({
retryXhrStatus: retryStatus,
transferRes: res
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
}
reqLogItem.status = retryStatus;
reqLogItem.endTime = Date.now();
reqLogItem.response = retryXhr.responseText;
handleRespComplete();
networkEndLog(reqLogItem);
}
};
setXhrHeader(retryXhr, type, obj);
retryXhr.send(data);
};
if (ajaxScope && !obj.pureHttp) {
var header = {
'User-Agent': navigator.userAgent,
'Cookie': (window.__test_env__ ? 'uniproxy_route=1; ' : '') + document.cookie,
'Referer': location.href
};
if (obj.contentType) {
header['Content-Type'] = obj.contentType;
} else if (type === 'POST') {
header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
if (!obj.noXRequestedWidthHeader) {
header['X-Requested-With'] = 'XMLHttpRequest';
}
var reqUrl = new URL(url, location.href).href;
var method = METHOD_ENUM[type] || 0;
var params = Device.os.pc ? {
url: reqUrl,
req_json: data || '',
scope: ajaxScope,
webcgi_method: method,
webcgi_header: Object.keys(header).map(function (headerItemKey) {
return Device.os.Mac ? _defineProperty({}, headerItemKey, header[headerItemKey]) : {
key: headerItemKey,
value: header[headerItemKey]
};
}),
cgi_type: 1
} : {
reqUrl: reqUrl,
reqBody: data,
scope: ajaxScope,
method: method,
header: header
};
var reqLogItem = networkStartLog({
method: type,
url: url,
postData: obj.data || {},
requestHeader: header,
requestType: 'transfer',
startTime: Date.now(),
responseType: url.indexOf('f=json') > 0 ? 'json' : undefined
});
var isTimeout = false;
handleReqTimeout({
abort: function abort() {
isTimeout = true;
reqLogItem.endTime = Date.now();
reqLogItem.response = 'timeout';
networkEndLog(reqLogItem);
}
});
Device.os.pc && monitor$1.setSum(115849, 69, 1);
JSAPI.invoke(Device.os.pc ? 'H5ExtTransfer' : 'webTransfer', params, function (res) {
var _a, _b, _c, _d, _e, _f;
if (isTimeout) return;
var status = 400;
var result = '';
if (Device.os.pc) {
try {
var retFlag = res.base_resp.ret === 0 && res.jsapi_resp.ret === 0 && res.err_msg.indexOf(':ok') > -1;
var respJsonFlag = res.jsapi_resp.resp_json;
status = retFlag && respJsonFlag ? 200 : 400;
result = res.jsapi_resp.resp_json;
} catch (err) {
console.error(err);
}
} else {
status = res && res.errCode * 1 === 0 && typeof res.result === 'string' && res.result ? 200 : 400;
result = res.result;
}
try {
Log.log("ajax transfer, status: ".concat(status, ", reqUrl: ").concat(reqUrl));
} catch (err) {
console.error(err);
}
if (status >= 200 && status < 400) {
obj.received && obj.received(null);
beforeResp({
status: status
});
handleRespSucc({
status: status,
responseText: result
}, 10);
reqLogItem.status = status;
reqLogItem.endTime = Date.now();
reqLogItem.response = result;
handleRespComplete();
networkEndLog(reqLogItem);
} else if (window.__second_open__) {
JSAPI.invoke('request', {
url: reqUrl,
method: type,
data: data,
header: header
}, function (retryRes) {
try {
Log.log("ajax retry request, retryStatus: ".concat((retryRes === null || retryRes === void 0 ? void 0 : retryRes.statusCode) || '', ", reqUrl: ").concat(reqUrl));
} catch (err) {
console.error(err);
}
if (isTimeout) return;
var retryStatus = retryRes.statusCode;
obj.received && obj.received(null);
beforeResp({
status: retryStatus
});
if (retryRes.err_msg.indexOf(':ok') > -1 && retryStatus >= 200 && retryStatus < 400) {
handleRespSucc({
status: retryStatus,
responseText: retryRes.data
}, 20);
} else {
retryXhrFn(res, isTimeout, reqLogItem);
handleRespErr({
status: retryStatus
}, res, 20);
window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure_sec_open', JSON.stringify({
retryReqJsapiRes: retryRes,
transferRes: res,
url: reqUrl
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
}
reqLogItem.status = retryStatus;
reqLogItem.endTime = Date.now();
reqLogItem.response = retryRes.data;
handleRespComplete();
networkEndLog(reqLogItem);
});
} else {
retryXhrFn(res, isTimeout, reqLogItem);
}
if (Device.os.pc) {
if (!res.err_msg.includes(':ok')) {
(_b = (_a = window.WX_BJ_REPORT) === null || _a === void 0 ? void 0 : _a.BadJs) === null || _b === void 0 ? void 0 : _b.report("pc transfer res no ok: ".concat(res.err_msg), params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
try {
if (res.jsapi_resp.resp_json && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 0 && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 190001 || res.base_resp.ret !== 0 || res.jsapi_resp.ret !== 0) {
(_d = (_c = window.WX_BJ_REPORT) === null || _c === void 0 ? void 0 : _c.BadJs) === null || _d === void 0 ? void 0 : _d.report("pc transfer res invalid ret", params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
} catch (err) {}
} else {
try {
if (res.errCode !== 0) {
(_f = (_e = window.WX_BJ_REPORT) === null || _e === void 0 ? void 0 : _e.BadJs) === null || _f === void 0 ? void 0 : _f.report("mobile transfer res invalid ret", params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
} catch (err) {}
}
});
beforeReq();
return;
}
var xhr = new XMLHttpRequest();
var mayAbort = !!obj.mayAbort;
var async = typeof obj.async === 'undefined' ? true : obj.async;
var _onreadystatechange = xhr.onreadystatechange;
xhr.open(type, url, async);
xhr.onreadystatechange = function () {
if (typeof _onreadystatechange === 'function') {
_onreadystatechange.apply(xhr);
}
if (xhr.readyState === 3) {
obj.received && obj.received(xhr);
}
if (xhr.readyState === 4) {
beforeResp(xhr);
xhr.onreadystatechange = null;
var status = xhr.status;
if (status >= 200 && status < 400) {
handleRespSucc(xhr, 1);
} else {
handleRespErr(xhr, 'status error', 1);
if (!!status || !mayAbort) {
var __ajaxtest = window.__ajaxtest || '0';
__moon_report({
offset: MOON_AJAX_NETWORK_OFFSET,
log: "ajax_network_error[".concat(status, "][").concat(__ajaxtest, "]: ").concat(url, ";host:").concat(location.host),
e: ''
});
}
}
handleRespComplete();
}
};
setXhrHeader(xhr, type, obj);
handleReqTimeout(xhr);
try {
xhr.send(data);
try {
if (url && url.length > LENGTH_LIMIT) {
reportAjaxLength(27613, 17, "ajax get limit[length: ".concat(url.length, "]").concat(url.substring(0, 1024)));
}
if (data && !(data instanceof Blob) && data.length > LENGTH_LIMIT) {
reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.length, "]").concat(data.substring(0, 1024)));
}
if (data && data instanceof Blob && data.size > LENGTH_LIMIT) {
reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.size, "]blob"));
}
} catch (e) {
}
} catch (e) {
obj.error && obj.error(xhr, {
type: 3,
error: e,
status: 0
});
}
beforeReq();
});
}
mmVersion.isWindowsWechat && mmVersion.compareHexVersion('0xf2550000') || mmVersion.isMacWechat && mmVersion.compareHexVersion('0xf2650000');
var getBrandServiceType = function getBrandServiceType() {
var serviceType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.service_type;
var _a, _b;
var brandServiceType = 0;
if (serviceType !== undefined) brandServiceType = serviceType + 1;
if (((_b = (_a = window.cgiData) === null || _a === void 0 ? void 0 : _a.trans_appmsg_info) === null || _b === void 0 ? void 0 : _b.trans_type) * 1 === 1) brandServiceType = 3;
return brandServiceType;
};
function setCurrentMpInfo(ifShow) {
var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true) || mmVersion.isAndroid && mmVersion.gtVersion('7.0.12', true);
var supportLiveStatus = mmVersion.isIOS && mmVersion.gtVersion('8.0.46', true) || mmVersion.isAndroid && mmVersion.gtVersion('8.0.46', true);
JSAPI.invoke('currentMpInfo', {
userName: window.user_name,
brandName: !!supportNewTopBar && window.nickname === '' ? '未命名账号' : window.title,
title: window.msg_title || '',
brandIcon: window.hd_head_img.replace(/\/0$/, '/132'),
itemShowType: window.item_show_type,
isPaySubscribe: window.isPaySubscribe,
topBarStyle: supportNewTopBar ? 1 : 0,
topBarShowed: ifShow,
disableShowFinderLiveTopBar: !ifShow && supportLiveStatus ? 1 : 0,
brandServiceType: getBrandServiceType()
}, function () {});
}
function AjaxWx(obj) {
var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {};
obj.url += obj.url.indexOf('?') === -1 ? '?fasttmplajax=1' : '&fasttmplajax=1';
if (getAjaxScope(obj.url)) {
Ajax(obj);
return;
}
if (obj.usePb) {
obj.type = 'POST';
obj.data = {
data: JSON.stringify(obj.data)
};
}
if (!/^(http:\/\/|https:\/\/|\/\/)/.test(obj.url)) {
obj.url = "https://mp.weixin.qq.com/".concat(obj.url.replace(/^\//, ''));
} else if (/^\/\//.test(obj.url)) {
obj.url = "https:".concat(obj.url);
}
if (obj.f !== 'html' && (obj.url.indexOf('?f=json') === -1 || obj.url.indexOf('&f=json') === -1)) {
obj.url += '&f=json';
}
if (!obj.notJoinUrl && obj.f !== 'html') {
obj.url = Url.joinUrl(obj.url);
}
Url.joinUserArticleRole(obj.url, !!obj.notJoinUrl, function (url) {
obj.url = url;
var urlObj = new URL(url, location.origin);
var data = null;
if (_typeof(obj.data) === 'object') {
var d = obj.data;
var ds = [];
for (var k in d) {
if (d.hasOwnProperty(k)) {
ds.push("".concat(k, "=").concat(encodeURIComponent(d[k])));
}
}
data = ds.join('&');
} else {
data = typeof obj.data === 'string' ? obj.data : null;
}
var header = {
Cookie: document.cookie,
referer: location.href
};
if (obj.contentType) {
header['Content-Type'] = obj.contentType;
} else if ((obj.type || 'GET').toUpperCase() === 'POST') {
header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
var reqLogItem = networkStartLog({
method: obj.type || 'GET',
url: obj.url,
postData: obj.data || {},
requestHeader: header,
requestType: 'jsapi',
startTime: Date.now()
});
var retryTime = 1;
var jsapiRequest = function jsapiRequest(obj, data) {
return JSAPI.invoke('request', {
url: obj.url,
method: obj.type,
data: data,
header: header
}, function (res) {
var _a, _b, _c, _d, _e, _f;
if (res.err_msg.indexOf(':ok') > -1 && (!res.statusCode || res.statusCode >= 200 && res.statusCode < 400)) {
if (reqType(obj, '/mp/getappmsgext')) {
window.receiveGetAppmsgExt = "".concat(res.statusCode, "|").concat(Date.now());
}
if (reqType(obj, '/mp/getappmsgad')) {
window.receiveGetAppmsgAd = "".concat(res.statusCode, "|").concat(Date.now());
}
if (retryTime === 1) {
obj.received && obj.received(null);
}
var resData = {};
if (res.data) {
try {
if (obj.dataType === 'json') {
resData = JSON.parse(res.data);
} else {
resData = res.data;
}
if (resData && resData.base_resp && ((_a = resData.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) {
var reportUrl = obj.url;
if (obj.url.indexOf('?') !== -1) {
reportUrl = obj.url.substring(0, obj.url.indexOf('?'));
if (Url.getQuery('action', obj.url)) {
reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', obj.url));
}
}
if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resData.base_resp.ret === 'undefined')) {
window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resData.base_resp.ret), {
mid: window.PAGE_MID,
view: 'wap_retcode'
});
}
}
} catch (e) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: ((_b = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _b === void 0 ? void 0 : _b.ret) || 0
});
}
console.error(e);
obj.error && obj.error(null, {
type: 1,
error: e,
status: res.statusCode
});
obj.complete && obj.complete();
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
return;
}
}
var tmpResData = {};
try {
tmpResData = JSON.parse(res.data);
} catch (e) {}
if (tmpResData && tmpResData.base_resp && tmpResData.base_resp.ret === -3 && retryTime < 2 && (mmVersion.isIOS || mmVersion.isAndroid && mmVersion.getInner() > '27000600')) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: ((_c = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0
});
}
var _retryTime = retryTime++;
JSAPI.invoke('updatePageAuth', {}, function (res) {
console.log('[skeleton] updatePageAuth', res);
monitor$1.setSum(112287, 3, 1);
if (res && res.err_msg && res.err_msg.indexOf(':ok') > -1) {
window.top.pass_ticket = encodeURIComponent(Url.getQuery('pass_ticket', res.fullUrl).html(false).replace(/\s/g, '+'));
if (obj.pass_ticket) {
obj.pass_ticket = window.top.pass_ticket;
}
console.warn('[skeleton] updatePageAuth resetTopbar');
var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true);
var showBottomBar = !!window.is_login;
if (window.top.item_show_type === '0' && supportNewTopBar) {
var top = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0;
setCurrentMpInfo(top > 40 && !showBottomBar);
}
try {
obj.url = Url.addParam(obj.url, 'retry', _retryTime, true);
} catch (err) {
console.error(err);
}
jsapiRequest(obj, data);
monitor$1.setSum(112287, 4, 1);
} else {
obj.success && obj.success(resData);
obj.complete && obj.complete();
if (mmVersion.isIOS) {
monitor$1.setSum(112287, 35, 1);
} else {
monitor$1.setSum(112287, 36, 1);
}
reqLogItem.status = 200;
reqLogItem.endTime = Date.now();
reqLogItem.response = resData;
networkEndLog(reqLogItem);
}
});
} else {
if (((_d = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _d === void 0 ? void 0 : _d.ret) !== 0) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 4,
HttpCode: res.statusCode || 0,
Ret: ((_e = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _e === void 0 ? void 0 : _e.ret) || 0
});
}
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 0,
HttpCode: res.statusCode || 0,
Ret: ((_f = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _f === void 0 ? void 0 : _f.ret) || 0
});
}
}
obj.success && obj.success(resData);
obj.complete && obj.complete();
reqLogItem.status = 200;
reqLogItem.endTime = Date.now();
reqLogItem.response = resData;
networkEndLog(reqLogItem);
}
} else if (res.err_msg.indexOf('no permission') > -1 || !mmVersion.isOnlyWechat) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: 0
});
}
Ajax(obj);
if (res.err_msg.indexOf('no permission') > -1) {
console.warn('[JSAPI Request] No permission');
monitor$1.setSum(112287, 31, 1);
}
reqLogItem.status = 302;
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 2,
HttpCode: res.statusCode || 0,
Ret: 0
});
}
obj.error && obj.error(null, {
type: 3,
error: res,
status: 0
});
obj.complete && obj.complete();
monitor$1.setSum(112287, 32, 1);
var sample = 0.001;
if (Math.random() < sample) {
var msg = "request: ".concat(JSON.stringify(obj.type), " ").concat(JSON.stringify(obj.url), " ;;;; cookie: ").concat(JSON.stringify(document.cookie), " ;;;; data: ").concat(JSON.stringify(data), " ;;;; resp: ").concat(JSON.stringify(res));
if (window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) {
window.WX_BJ_REPORT.BadJs.report('ajax_wx_request_error', msg, {
mid: 'mmbizwap:Monitor'
});
}
}
reqLogItem.status = 400;
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
}
});
};
if (reqType(obj, '/mp/getappmsgext')) {
window.startGetAppmsgExtTime = Date.now();
}
if (reqType(obj, '/mp/getappmsgad')) {
window.startGetAppmsgAdTime = Date.now();
}
jsapiRequest(obj, data);
});
}
function _regeneratorRuntime() { _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var AjaxRouter = function () {
var _ref = _asyncToGenerator( _regeneratorRuntime().mark(function _callee(obj) {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!window.__secPageAuthPromise) {
_context.next = 3;
break;
}
_context.next = 3;
return window.__secPageAuthPromise;
case 3:
if (!(!mmVersion.isWxWork && (window.__second_open__ || !getIsAcrossOrigin() && top.window.__second_open__) && window.__is_page_auth_return__ && !obj.pureHttp)) {
_context.next = 5;
break;
}
return _context.abrupt("return", AjaxWx(obj));
case 5:
return _context.abrupt("return", Ajax(obj));
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return function AjaxRouter(_x) {
return _ref.apply(this, arguments);
};
}();
var isx5 = navigator.userAgent.indexOf('TBS/') !== -1;
var getDataFunc = [];
var reportData = [];
var specificData = {};
function joinUrl(url) {
var obj = {};
if (typeof window.uin !== 'undefined') {
obj.uin = window.uin;
}
if (typeof window.key !== 'undefined') {
obj.key = window.key;
}
if (typeof window.pass_ticket !== 'undefined') {
obj.pass_ticket = window.pass_ticket;
}
if (typeof window.wxtoken !== 'undefined') {
obj.wxtoken = window.wxtoken;
}
if (typeof window.devicetype !== 'undefined') {
obj.devicetype = window.devicetype;
}
if (typeof window.clientversion !== 'undefined') {
obj.clientversion = window.clientversion;
}
if (typeof window.appmsg_token !== 'undefined') {
obj.appmsg_token = window.appmsg_token;
} else if (url.indexOf('advertisement_report') > -1) {
new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random());
}
obj.x5 = isx5 ? '1' : '0';
obj.f = 'json';
return Url.join(url, obj);
}
function isObj(obj) {
return obj && _typeof(obj) === 'object';
}
function assign(target, source) {
if (isObj(target) && isObj(source)) {
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
function assembleReportData(initiative) {
var leaveReportLog = [];
leaveReportLog.push({
content: "[LeaveReport] specificData keys: ".concat(Object.keys(specificData)),
timestamp: Date.now()
});
Log.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData)));
console.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData)));
var allReportData = {};
for (var reportField in specificData) {
if (!allReportData[reportField]) {
allReportData[reportField] = {};
}
for (var i = 0; i < specificData[reportField].length; i++) {
var param = specificData[reportField][i];
if (typeof param === 'function') {
try {
assign(allReportData[reportField], param(initiative));
} catch (err) {
leaveReportLog.push({
content: "[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)),
timestamp: Date.now()
});
Log.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)));
console.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)));
}
} else if (isObj(param)) {
assign(allReportData[reportField], param);
}
}
}
leaveReportLog.push({
content: "[LeaveReport] reportData.length: ".concat(reportData.length),
timestamp: Date.now()
});
Log.log("[LeaveReport] reportData.length: ".concat(reportData.length));
console.log("[LeaveReport] reportData.length: ".concat(reportData.length));
leaveReportLog.push({
content: "[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length),
timestamp: Date.now()
});
Log.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length));
console.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length));
for (var _i = 0; _i < getDataFunc.length; _i++) {
try {
var data = getDataFunc[_i](initiative);
if (isObj(data)) {
reportData.push(data);
}
} catch (err) {
leaveReportLog.push({
content: "[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)),
timestamp: Date.now()
});
Log.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)));
console.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)));
}
}
for (var _i2 = 0; _i2 < reportData.length; _i2++) {
if (reportData[_i2].reportUrl) {
reportData[_i2].reportUrl = joinUrl(reportData[_i2].reportUrl);
}
}
allReportData.data = {
'requestList': reportData
};
leaveReportLog.push({
content: "[LeaveReport] final reportData.length: ".concat(reportData.length, ", data=").concat(JSON.stringify(reportData)),
timestamp: Date.now()
});
Log.log("[LeaveReport] final reportData.length: ".concat(reportData.length));
console.log("[LeaveReport] final reportData.length: ".concat(reportData.length));
allReportData.info = leaveReportLog;
return allReportData;
}
function addReport(param) {
if (typeof param === 'function') {
getDataFunc.push(param);
} else if (isObj(param)) {
reportData.push(param);
}
}
function addSpecificReport(reportField, param) {
if (!specificData[reportField]) {
specificData[reportField] = [];
}
specificData[reportField].push(param);
}
function reportNow(callback) {
var allReportData = assembleReportData(true);
JSAPI.invoke('handleMPPageAction', {
action: 'reportByLeaveForMPGateway',
reportData: allReportData
}, function (res) {
if (res && res.err_msg && res.err_msg.indexOf(':ok') !== -1) {
getDataFunc = [];
reportData = [];
specificData = {};
typeof callback === 'function' && callback(res);
} else {
getDataFunc = [];
reportData = [];
var len = allReportData.data.requestList.length;
allReportData.data.requestList.forEach(function (req) {
if (req.reportUrl) {
AjaxRouter({
type: req.method || 'GET',
url: req.reportUrl,
data: req.reportData,
async: false,
success: function success(resp) {
if (--len < 0) {
typeof callback === 'function' && callback({
err_msg: 'handleMPPageAction:ok',
fallback: true,
resp: resp
});
}
},
error: function error(xhr, err) {
if (--len < 0) {
typeof callback === 'function' && callback({
err_msg: 'handleMPPageAction:fail',
fallback: true,
err: err
});
}
}
});
}
});
}
});
}
var leaveReport = {
reportNow: reportNow,
addReport: addReport,
addSpecificReport: addSpecificReport
};
var _leaveReport = (function () {
var doc = {};
var isCrossOrigin = false;
try {
doc = top.window.document;
} catch (e) {
isCrossOrigin = true;
}
if (!isCrossOrigin && top.window.__leaveReport) {
return top.window.__leaveReport;
}
if (window.__leaveReport) {
return window.__leaveReport;
}
JSAPI.on('reportOnLeaveForMP', function () {
return assembleReportData(false);
});
return window.__leaveReport = leaveReport;
})();
var getReportJson = function getReportJson(logId, rawData) {
var data = JSON.parse(JSON.stringify(rawData));
data.log_id = Number(logId);
data.TimeStamp = Math.round(Date.now() / 1000);
console.log('[comm_report] reportjson: ', data);
return JSON.stringify(data);
};
var getSuccessHandler = function getSuccessHandler(logId, data, opt) {
return function (res) {
if (res && res.err_code !== 0) {
console.warn("[comm_report] report ".concat(logId, " fail: "), res.err_msg, data);
}
if (typeof opt.success === 'function') {
opt.success(res);
}
};
};
var getErrorHandler = function getErrorHandler(logId, data, opt) {
return function (xhr, info) {
console.error("[comm_report] report ".concat(logId, " error: "), info, data);
if (typeof opt.error === 'function') {
opt.error(xhr, info);
}
};
};
var batchReportDataArr = [];
var blackLogId = [25587, 18832, 28208, 25574, 29139, 10945];
var BATCH_SIZE = 4;
var BATCH_TIME = 1000;
var getRepeatedReportJson = function getRepeatedReportJson() {
if (!batchReportDataArr || !batchReportDataArr.length) return false;
var reportData = {
count: 0
};
reportData.count = batchReportDataArr.length;
batchReportDataArr.forEach(function (data, index) {
reportData["reportjson".concat(index)] = data;
});
batchReportDataArr = [];
console.log('[reportData]: ', reportData);
return reportData;
};
var timeOutId;
function batchReport() {
if (!batchReportDataArr || !batchReportDataArr.length) return;
var repeatedReportJson = getRepeatedReportJson();
if (!repeatedReportJson) return;
AjaxRouter({
type: 'POST',
dataType: 'json',
url: '/mp/wapcommreport?action=batch_report',
data: repeatedReportJson,
dontReport: true,
success: function success(res) {
if (res && res.err_code) {
console.warn("[comm_report] batch report fail: ", res.err_msg, batchReportDataArr);
}
},
error: function error(xhr, info) {
console.error("[comm_report] batch report error: ", info, batchReportDataArr);
}
});
}
function batchReportThrottle(logId, rawData) {
var reportJsonData = getReportJson(logId, rawData);
if (!reportJsonData) return;
batchReportDataArr.push(reportJsonData);
if (batchReportDataArr.length >= BATCH_SIZE) {
batchReport();
} else {
if (!timeOutId) {
timeOutId = setTimeout(function () {
batchReport();
clearTimeout(timeOutId);
timeOutId = null;
}, BATCH_TIME);
}
}
}
_leaveReport.addReport(function () {
var repeatedReportJson = getRepeatedReportJson();
if (!repeatedReportJson) return false;
var reportData = [];
for (var _i = 0, _Object$entries = Object.entries(repeatedReportJson); _i < _Object$entries.length; _i++) {
var _Object_i = _slicedToArray(_Object$entries[_i], 2),
key = _Object_i[0],
value = _Object_i[1];
reportData.push("".concat(key, "=").concat(encodeURIComponent(value)));
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport?action=batch_report',
reportData: reportData.join('&'),
method: 'POST'
};
});
var commReport = {
report: function report(logId, rawData, rawOpt) {
var opt = rawOpt || {};
if (!opt.realTime && !blackLogId.includes(logId)) {
batchReportThrottle(logId, rawData);
} else {
AjaxRouter({
type: 'POST',
dataType: 'json',
url: '/mp/wapcommreport',
data: {
reportjson: getReportJson(logId, rawData)
},
async: opt.async,
success: getSuccessHandler(logId, rawData, opt),
error: getErrorHandler(logId, rawData, opt)
});
}
},
leaveReport: function leaveReport(logId, rawData) {
_leaveReport.addReport(function () {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport',
reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))),
method: 'POST'
};
});
},
reportByBeacon: function reportByBeacon(logId, rawData) {
try {
if (!Device.os.android && !Device.os.ios && !Device.os.harmony) {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
var url = '/mp/wapcommreport';
var reportJsonData = encodeURIComponent(getReportJson(logId, data));
console.log("reportByBeacon", JSON.stringify(reportJsonData));
navigator.sendBeacon(Url.joinUrl(url), "reportjson=".concat(reportJsonData));
} else {
_leaveReport.addReport(function () {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport',
reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))),
method: 'POST'
};
});
}
} catch (error) {
console.log(error);
}
}
};
var html = function html(_str, encode) {
if (!_str) return '';
var replace = ['`', '`', ''', '\'', '"', '"', ' ', ' ', '>', '>', '<', '<', '¥', '¥', '&', '&', '<', '<', '>', '>'];
var replaceReverse = ['&', '&', '¥', '¥', '<', '<', '>', '>', ' ', ' ', '"', '"', '\'', ''', '`', '`'];
var str = _str;
var target;
if (encode) {
target = replaceReverse;
} else {
target = replace;
}
for (var i = 0; i < target.length; i += 2) {
str = str.replace(new RegExp(target[i], 'g'), target[i + 1]);
}
return str;
};
var htmlLite = function htmlLite(_str, encode) {
if (!_str) return '';
var replace = ['`', '`', ''', '\'', '"', '"', '>', '>', '<', '<', '&', '&'];
var replaceReverse = ['&', '&', '<', '<', '>', '>', '"', '"', '\'', ''', '`', '`'];
var str = _str;
var target;
if (encode) {
target = replaceReverse;
} else {
target = replace;
}
for (var i = 0; i < target.length; i += 2) {
str = str.replace(new RegExp(target[i], 'g'), target[i + 1]);
}
return str;
};
var htmlEncode = function htmlEncode(str) {
return html(str, true);
};
var htmlDecode = function htmlDecode(str) {
return html(str, false);
};
var htmlEncodeLite = function htmlEncodeLite(str) {
return htmlLite(str, true);
};
var htmlDecodeLite = function htmlDecodeLite(str) {
return htmlLite(str, false);
};
String.prototype.html = function (encode) {
return html(this.toString(), encode);
};
String.prototype.htmlEncode = function () {
return htmlEncode(this.toString());
};
String.prototype.htmlDecode = function () {
return htmlDecode(this.toString());
};
String.prototype.htmlLite = function (encode) {
return htmlLite(this.toString(), encode);
};
String.prototype.htmlEncodeLite = function () {
return htmlEncodeLite(this.toString());
};
String.prototype.htmlDecodeLite = function () {
return htmlDecodeLite(this.toString());
};
var isIOS = mmVersion.isIOS,
isAndroid = mmVersion.isAndroid;
var renderDom = function renderDom(dom, cnt, hasStar) {
if (dom) {
if (hasStar) {
dom.innerText = "已星标";
} else {
dom.innerText = "星标";
}
if (hasStar) {
dom.classList.add('rich_media_meta_star');
dom.classList.remove('rich_media_meta_star_cancel');
} else {
dom.classList.add('rich_media_meta_star_cancel');
dom.classList.remove('rich_media_meta_star');
}
dom.style.removeProperty('display');
localStorage.setItem('star_info', JSON.stringify({
mid: window.mid,
idx: window.idx,
has_star: !!hasStar
}));
}
};
var __setStar = function __setStar(dom, cnt, statStatus) {
var hasReportExpose = false;
var hasStar = statStatus;
var realCnt = cnt;
function addStar() {
var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
hasStar = 1;
realCnt = realCnt + 1;
renderDom(dom, realCnt, hasStar);
if (dispatchEvent) window.dispatchEvent(new CustomEvent('star'));
}
function cancelStar() {
var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
hasStar = 0;
realCnt = realCnt - 1;
renderDom(dom, realCnt, hasStar);
if (dispatchEvent) window.dispatchEvent(new CustomEvent('cancel-star'));
}
if (dom) {
renderDom(dom, cnt, statStatus);
var clickHander = function clickHander() {
if (hasStar === 0) {
JSAPI.invoke('operateStar', {
opType: 'addStar'
}, function (res) {
if (res.err_msg && /:ok$/.test(res.err_msg)) addStar();
});
} else {
JSAPI.invoke('operateStar', {
opType: 'cancelStar'
}, function (res) {
if (res.err_msg && /:ok$/.test(res.err_msg)) cancelStar();
});
}
var data = {
BizUin: window.biz,
AppMsgID: window.mid * 1,
ItemIndex: window.idx * 1,
Scene: window.scene,
SubScene: window.subscene * 1,
EnterId: window.enterid,
SessionId: "".concat(window.sessionid),
Event: hasStar ? 8 : 7,
ItemShowType: window.item_show_type * 1
};
commReport.report(17335, data);
};
var exposeHandler = function exposeHandler() {
if (hasReportExpose) return;
var data = {
BizUin: window.biz,
AppMsgID: window.mid * 1,
ItemIndex: window.idx * 1,
Scene: window.scene,
SubScene: window.subscene * 1,
EnterId: window.enterid,
SessionId: "".concat(window.sessionid),
Event: 6,
ItemShowType: window.item_show_type * 1
};
commReport.report(17335, data);
hasReportExpose = true;
};
dom.addEventListener('click', clickHander);
JSAPI.on('onPageStarStateChanged', function (res) {
console.log('onPageStarStateChanged', res);
if (res.state) addStar();else cancelStar();
window.__hasStarInLifecycle = !!hasStar;
});
var intersectionObserver = new IntersectionObserver(exposeHandler);
intersectionObserver.observe(dom);
window.addEventListener('star', function (e) {
if (e && e.detail && e.detail.from === 'frontend') addStar(false);
});
window.addEventListener('cancel-star', function (e) {
if (e && e.detail && e.detail.from === 'frontend') cancelStar(false);
});
document.addEventListener('visibilitychange', function () {
var visible = document.visibilityState === 'visible';
if (!visible) return;
window.__hasStarInLifecycle = !!hasStar;
});
}
};
if (!window.__second_open__) {
var starDom = document.querySelector('#js_star');
var canUseStar = window.canUseStar || isIOS && mmVersion.compareHexVersion('18003623') || isAndroid && mmVersion.compareHexVersion('28003630');
var startPersonCnt = window.star_person_cnt || '';
console.log('canUseStar, startPersonCnt', canUseStar, startPersonCnt);
if (!!(canUseStar * 1)) {
var starSwitch = localStorage.getItem('mp_star_switch');
if (starSwitch === 'true') {
var starInfo = localStorage.getItem('star_info');
var hasStar = 0;
if (starInfo) {
var parseStarInfo = JSON.parse(starInfo);
if (Number(parseStarInfo.mid) === Number(window.mid) && Number(parseStarInfo.idx) === Number(window.idx) && parseStarInfo.has_star) {
hasStar = 1;
}
}
starDom && renderDom(starDom, startPersonCnt * 1, hasStar);
var spanElement = document.getElementById('meta_content_hide_info');
spanElement && spanElement.classList.remove('rich_media_meta_padding');
} else {
starDom && starDom.parentNode.removeChild(starDom);
}
} else {
starDom && starDom.parentNode.removeChild(starDom);
}
window.__setStar = __setStar;
}
exports.__setStar = __setStar;
exports.renderDom = renderDom;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
})({});
天湖园博酒店
💰劲爆预售价:¥699 (¥1388)
园艺尊享大床房 2 晚(连住) + 早餐 2 份/天 + 下午茶 1 份 + 欢迎水果 1 份 + 迷你吧 1 份 + 天湖景区门票1张 4 份 有效期到2026年12月31日离店。全程可约不加价! ![图片]()
这家藏在温州的宝藏酒店很适合短途山野休闲!步行13分钟逛天湖、15分钟闲逛大月湾,自驾5分钟打卡刘伯温故里、6分钟奔赴百丈漈,四周山林环绕,满目青翠清幽。42㎡尊享大床配全景落地玻璃窗,原木简约客房静谧舒服。套餐权益丰厚,午后可以静享精致下午茶,还附赠4张天湖景区入园票,吃住玩乐全包。日历房两晚的价格要1300多,现在套餐价才699,差不多打了对折!关键是端午、暑假、中秋和国庆等热门日期都不加价,快囤~
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥699园艺高级双床房 2 晚(连住) + 早餐 2 份/天
成都尧棠公馆-全球奢华精品酒店
💰劲爆预售价:¥1588起 (¥2288)
棠厢大床房 2 晚(可拆分) + 早餐 2 份/天 + 迷你吧 1 份/天 + 旅拍礼包拍摄含3张精修照片及万昌洋服号服装试穿拍摄(未使用不可折现) 1 份/天 有效期到2026年12月31日离店。端午、暑假、中秋不加价!10.1-10.4加价200元/间/晚。 ![图片]()
这家尧棠公馆可不一般,是成都第一家SLH酒店,以巴金《家》中李家公馆为灵感,将民国式复古腔调拿捏到位,巴金先生的文学元素也随处可见,又融入了老成都鸟笼、麻将等传统韵味;强烈安利玻璃顶的天井和旋转楼梯,真是谁拍谁好看!酒店位置很好,7分钟逛锦城湖、14分钟直达铁像寺水街。房间有落地窗、宝格丽的洗漱用品!套餐同款房型平时两晚要2200+,现在1588就能入住,还送超值双人旅拍礼包,不用额外花钱就能拍复古写真,太划算了!点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1588起棠厢双床房 2 晚(可拆分) + 早餐 2 份/天
来成都玩也可以看看这家——成都锦城原舍酒店(锦里武侯祠店)!酒店就在锦里武侯祠文旅核心区,整体禅茶新中式装修,满满三国文化氛围感。出门步行3分钟即达高升桥地铁站,11分钟漫步至武侯祠、15分钟闲逛锦里古街,紧邻罗马假日广场。住在古街旁既能沉浸式打卡三国人文古迹,出门就能吃透成都地道烟火美食。平时日历房两晚要800多,现在499就能住,便宜了300多!可约日期都不加价哦~
还有其他好价套餐可选:
价格¥499雅居大床房(小度音箱+记忆枕+小冰箱) 2 晚(可拆分)
上海临港锦江国际酒店
💰劲爆预售价:¥1388 (¥2186)
城景豪华双床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份 有效期到2026年09月30日离店。端午、暑假、中秋热门日期不加价! ![图片]()
酒店坐落在滴水湖畔,步行2分钟抵达临港中心、4分钟直达临港演艺中心,顺路就可以打卡中国航海博物馆、滴水湖公园。高层客房在窗边就能欣赏限定烟花与无人机大秀,酒店自带全套亲子游乐设施,遛娃观景一举两得。日历房含早两晚要1800+,现在1388即可连住两晚,差不多打了七七折!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1388城景豪华大床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份
苏州湾华邑温泉度假酒店
💰劲爆预售价:¥1299起 (¥1899)
高级大床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份 有效期到2026年09月30日离店。全程可约,七夕不加价,端午、中秋+200元/间/晚。 ![图片]()
洲际酒店集团旗下,软硬件没得挑,设计又带着点中式古典感,置身于吴江东太湖生态旅游度假区中,周边绿地湖水围绕,又有王焰温泉这样的大咖加持,不管是宅酒店还是出去玩,都很ok!套餐价算下来一晚650,还送温泉票,比日历价便宜300多! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1299起高级双床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份
杭州大运河马可波罗豪廷酒店
💰劲爆预售价:¥599 (¥1399)
城景双床房(金可儿床垫+全屋智能+智能马桶) 2 晚(连住) + 早餐 2 份/天 + 【豪廷食街双人中式套餐】 1 份 + 双人免费西湖往返班车(双店行李寄存) 1 份 + 免费升级豪庭双床房(视房量房态) 1 份 + 现磨咖啡 2 份 + 房间欢迎饮料2瓶 1 份 有效期到2026年12月30日离店,全程可约不加价! ![图片]()
酒店在拱墅区,附近有中大银泰城、万融城、万达广场等商场,距离拱宸桥、京杭大运河博物馆、小河直街历史文化街区等景点不远。现在买套餐还送西湖往返班车,而且优惠价599两晚比平常单晚400+便宜了不少! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥599豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)价格¥999行政套房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住) 价格¥699豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)
杭州湘湖保亿开元名都度假酒店
有效期到2026年09月29日离店,全程可约,端午、中秋不加价! 来杭州玩还可以看看这家,很适合亲子游!酒店靠近湘湖,去森泊也方便,一脚油门也就几分钟,而且套餐价里连门票都包了!内部环境设计感拉满,水镜连廊与天光倒影,随手出片!配套也很齐全、健身房、游泳馆应有尽有。套餐同款暑期要800/晚,套餐价便宜了200,很划算! 还有其他好价套餐可选:
价格¥599豪华大床房 1 晚 价格¥698豪华双床房 2 晚(可拆分)
隐居天目湖WEI酒店
💰劲爆预售价:¥1299起 (¥4599)
隐谧•雅韵双床房【隐居山湖】 2 晚(连住) + 早餐 2 份/天 + 每日MINI吧 1 份 + 鱼头套餐9折券 1 份 + 隐湖寻幽特调双人下午茶 1 份 + 每日传统文化活动体验 + 多媒体放映室观影 + 单车林间骑行和报恩禅寺游览 + 旅拍体验(赠3张精选电子版照片)+ 周日-周四视房量房态免费升级至高级房型 有效期到2026年10月01日离店,全程可约,热门日期加价见详情。 ![图片]()
酒店太会选址了,正对着天目湖!从13米挑高的大堂望出去,无边泳池衔接着浩渺的湖水,那视野简直惊艳!设计偏中式简约风,青瓦白墙,绿树木椅,品上一杯茶,灵魂都要飘香气了。酒店有专属的湖心亭,园内还设了一座露天影院,躺在星空下看一场电影,太惬意!平常一晚就要1300+,套餐价直接5折还送超多礼遇! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1299起隐谧•雅韵大床房【雅致书香+分离式淋浴间】 2 晚(连住)
苏州东太湖皇冠假日酒店
💰劲爆预售价:¥999起 (¥1699)
高级房 超大床 2 晚(连住) 有效期到2026年08月31日离店。全程可约,周末不加价,端午+100元/间/晚。 ![图片]()
这家坐拥太湖新城核心商务区与商圈,而且紧邻苏州湾东地铁站,可直达苏州古城区及高铁苏州站。房间设计简约高级,将吴风雅韵与现代美学结合得很好!更不用说1.8米大床,房间足足50平,视野也很开阔。同款房型暑假要卖到700多,套餐价999两晚,省下来快500块! 点击下图,火速购买 👇👇👇 ![]()
南京南部新城丽笙酒店
💰劲爆预售价:¥1188起 (¥1698)
豪华双床房-全景落地窗带浴缸 2 晚(连住) + Kuksa下午茶 1 份 + 早餐 2 份/天 + 儿童自助早餐 1 份/天 + 迷你吧 1 份 + 欢迎水果 1 份 + 升级至甄选房(视房量房态) 1 份 + 提前至10:00入住(视房量房态) 1 份 + 延迟退房至14:00(视房量房态) 1 份 有效期到2026年09月01日离店。每周五、周六加价100元/间/晚。 ![图片]()
坐拥南部新城核心区位,临近大校场地铁站,距南京南站仅15分钟车程。紧邻京东MALL,雨花台,老门东历史街区等景点。客房以大校场百年航空文化为设计灵感,流畅线条交织怀旧质感与摩登氛围,空间感极强。日历房价格为600多一晚,套餐价为1100多,省下一顿午餐钱!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥618起豪华双床房-全景落地窗带浴缸 1 晚
宁波半山伴水渡假村
💰劲爆预售价:¥199起 (¥458)
清泉岗木屋双床房 1 晚 + 早餐 2 份/天 + 户外双人泳池门票(7月-9月) 1 份 + 2张中坡山森林公园门票 1 份 + 2张观顶湖门票 1 份 有效期到2026年09月24日离店。端午、每周六加价100元/间/晚。 ![图片]()
这个度假村藏于山林之间,距溪口站驾车约30分钟,出行便捷。酒店主打亲子度假,设有季节性开放的无边泳池、大型户外儿童乐园,配套棋牌室和各种拓展设施。酒店还配有八大项主题设施、100余项游乐项目还有德国原版引进的水晶塔!客房有一些是采用特色窑洞设计,还可携带宠物入住。平日日历房价格为400多1晚,套餐价格相当于4.3折,真的很划算!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥299起清泉岗木屋双床房 1 晚 + 早餐 2 份/天
北海香格里拉大酒店
💰劲爆预售价:¥1199 (¥1588)
高级城景双床房-静览珠城繁华烟火 2 晚(连住) + 咖啡苑双人自助早餐 1 份/天 + 参观南珠博物馆(提供讲解服务) 1 份 + 亲子体验活动 1 份 + 提升至高级海景房(视房量房态而定,节假日不适用) 1 份 + 周六日银滩/客运港/侨港接送服务(固定时间) 1 份 + 精美旅拍(壮族服饰体验,赠3张照片) 1 份 有效期到2026年09月30日离店。端午可约,全程不加价! ![]()
酒店紧邻金滩,步行9分钟可达,距北海站驾车约19分钟,出行便捷。自带沙滩泳池与儿童乐园,入住可免费体验赶海活动,还能打卡海上日落栈道。平日日历房价格为600多1晚,现在2晚可立省一顿早餐!附送很多活动体验,还可根据房态情况免费升级房型!
点击下图,火速购买 👇👇👇 ![]()
北京首都宾馆
💰劲爆预售价:¥599起 (¥704)
B座标准遮窗客房 1 晚 + 延迟退房至14:00(视房量房态) 1 份 有效期到2026年08月31日离店。7月1日起,加价179元/间/晚。 ![图片]()
地处前门核心地段,步行7分钟可达前门大街,10分钟至崇文门地铁站、崇文门地铁站,前往天安门广场很便捷。酒店内部自带五千平中式园林,还可体验汉服换装及古风拍摄。直线距离不到1公里可达新世纪百货,购物吃喝都很方便。日历房价格800多1晚,现在不到600元,套餐省了200+,性价比拉满了~
点击下图,火速购买 👇👇👇 ![]()
中旅阿那亚九龙湖·公主酒店
💰劲爆预售价:¥599起 (¥1198)
公主大床房 1 晚 + 双早 1 份/天 + 美茵家庭中式套餐 1 份 + 畅游中旅阿那亚中心小镇/九龙湖生态公园 1 份 + 草坪畅玩飞盘 1 份 + 醉美夕阳·山湖日落和园区接驳车定时接送 1 份 有效期到2026年07月21日离店。每周五加价100元/间/晚,每周六加价200元/间/晚。 ![图片]()
坐落于九龙湖生态区,临近广州白云机场,自驾出行便捷。酒店以欧式典雅建筑和复古小镇群落为主体,呈现欧式浪漫风情,提供专属管家服务,配套季节性开放的室外景观泳池、室内恒温泳池、美茵餐厅和大堂吧,并设有大型儿童乐园和多种休闲项目。平日日历房价格为700多1晚,套餐价格便宜了150+!
点击下图,火速购买 👇👇👇 ![]()
![]()
华南温德姆集团通兑2晚可拆分含早588元
超值特价¥588 ¥848
有效期到2026年08月31日离店
华南温德姆20城49店通兑覆盖长沙、张家界、武汉、广州等20座热门城市,49家门店随心任选,高铁中转、山林游玩、都市逛吃多种出行需求一站式适配,跨城出游灵活省心。
= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var doc$1 = {};
var isAcrossOrigin$1 = false;
var notFoundedMPPageAction = [];
var __moon_report$1 = window.__moon_report || function () {};
var MOON_JSAPI_KEY_OFFSET = 8;
try {
doc$1 = top.window.document;
} catch (e) {
isAcrossOrigin$1 = true;
}
if (!window.JSAPIEventCallbackMap) {
window.JSAPIEventCallbackMap = {};
}
function ready(onBridgeReady) {
var bridgeReady = function bridgeReady() {
try {
if (onBridgeReady) {
window.onBridgeReadyTime = window.onBridgeReadyTime || Date.now();
onBridgeReady();
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: 'ready',
e: e
}]);
throw e;
}
window.jsapiReadyTime = Date.now();
};
if (!isAcrossOrigin$1 && (typeof top.window.WeixinJSBridge === 'undefined' || !top.window.WeixinJSBridge.invoke)) {
if (doc$1.addEventListener) {
doc$1.addEventListener('WeixinJSBridgeReady', bridgeReady, false);
} else if (doc$1.attachEvent) {
doc$1.attachEvent('WeixinJSBridgeReady', bridgeReady);
doc$1.attachEvent('onWeixinJSBridgeReady', bridgeReady);
}
} else {
bridgeReady();
}
}
var invokeNotWaitA8key = ['notifyPageInfo', 'updatePageAuth'
];
var checkNotFoundedInvoke = function checkNotFoundedInvoke(methodName, args) {
if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && notFoundedMPPageAction.includes(args === null || args === void 0 ? void 0 : args.action)) {
return true;
}
return false;
};
function invoke$1(_x, _x2, _x3) {
return _invoke.apply(this, arguments);
}
function _invoke() {
_invoke = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee(methodName, args, callback) {
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__ && !invokeNotWaitA8key.includes(methodName))) {
_context.next = 3;
break;
}
_context.next = 3;
return window.__secPageAuthPromise;
case 3:
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object') {
alert('请在微信中打开此链接');
return false;
}
if (checkNotFoundedInvoke(methodName, args)) {
setTimeout(function () {
if (callback) {
callback.apply(window, [{
err_msg: "".concat(methodName, ":fail"),
err_desc: 'action isn\'t supported'
}]);
}
}, 0);
} else {
top.window.WeixinJSBridge.invoke(methodName, args, function () {
try {
for (var _len2 = arguments.length, rets = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
rets[_key2] = arguments[_key2];
}
var ret = rets[0];
var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : '';
if (['handleMPPageAction', 'handleVideoAction', 'handleHaokanAction'].indexOf(methodName) !== -1) {
var action = (args === null || args === void 0 ? void 0 : args.action) || '';
console.info('[system]', "[jsapi] invoke->".concat(methodName, ", action->").concat(action).concat(errMsg));
} else {
console.info('[system]', "[jsapi] invoke->".concat(methodName).concat(errMsg));
}
if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && ((ret === null || ret === void 0 ? void 0 : ret.err_desc) === 'action isn\'t supported' || (ret === null || ret === void 0 ? void 0 : ret.err_msg) === 'handleMPPageAction:fail action is not supported')) {
notFoundedMPPageAction.push(args === null || args === void 0 ? void 0 : args.action);
}
if (callback) {
callback.apply(window, rets);
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "invoke;methodName:".concat(methodName),
e: e
}]);
throw e;
}
});
}
});
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return _invoke.apply(this, arguments);
}
function call(_x4) {
return _call.apply(this, arguments);
}
function _call() {
_call = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee2(methodName) {
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__)) {
_context2.next = 3;
break;
}
_context2.next = 3;
return window.__secPageAuthPromise;
case 3:
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object') {
return false;
}
try {
top.window.WeixinJSBridge.call(methodName);
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "call;methodName:".concat(methodName),
e: e
}]);
throw e;
}
});
case 4:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _call.apply(this, arguments);
}
function on(eventName, callback) {
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object' || !top.window.WeixinJSBridge.on) {
return false;
}
if (!window.JSAPIEventCallbackMap[eventName]) {
window.JSAPIEventCallbackMap[eventName] = [];
}
window.JSAPIEventCallbackMap[eventName].push(callback);
if (window.JSAPIEventCallbackMap[eventName].length > 1) {
return false;
}
top.window.WeixinJSBridge.on(eventName, function () {
try {
for (var _len = arguments.length, rets = new Array(_len), _key = 0; _key < _len; _key++) {
rets[_key] = arguments[_key];
}
var ret = rets[0];
var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : '';
console.info('[system]', "[jsapi] event->".concat(eventName).concat(errMsg));
if (window.JSAPIEventCallbackMap[eventName] && window.JSAPIEventCallbackMap[eventName].length) {
var result;
for (var i = 0; i < window.JSAPIEventCallbackMap[eventName].length; i++) {
result = window.JSAPIEventCallbackMap[eventName][i].apply(window, rets);
}
return result;
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "on;eventName:".concat(eventName),
e: e
}]);
throw e;
}
});
});
}
function remove(eventName, callback) {
ready(function () {
if (!window.JSAPIEventCallbackMap[eventName]) {
return false;
}
var result = false;
for (var i = window.JSAPIEventCallbackMap[eventName].length - 1; i >= 0; i--) {
if (window.JSAPIEventCallbackMap[eventName][i] === callback) {
window.JSAPIEventCallbackMap[eventName].splice(i, 1);
result = true;
}
}
return result;
});
}
var JSAPI = {
ready: ready,
invoke: invoke$1,
call: call,
on: on,
remove: remove
};
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var ua = navigator.userAgent;
var is_ios = /(iPhone|iPad|iPod|iOS)/i.test(ua);
var is_wp = /Windows\sPhone/i.test(ua);
var is_android = /(Android)/i.test(ua);
var is_wechat = /MicroMessenger\/([\d\.]+)/i.test(ua);
var is_mac = /mac\sos/i.test(ua) && !is_ios;
var is_windows = /windows\snt/i.test(ua) && !is_wp;
var is_mpapp = /MPAPP\/([\d\.]+)/i.test(ua);
var is_ipad = /iPad/i.test(ua);
var is_windows_wechat = /WindowsWechat/i.test(ua);
var is_mac_wechat = /MacWechat/i.test(ua) || /wechat.*mac os/i.test(ua);
var is_prefetch = is_wechat && window.WeixinPrefecherJSBridge;
var is_donut_app = /SAAASDK/i.test(ua);
var is_harmony = /OpenHarmony|ArkWeb/i.test(ua);
var is_linux = /Linux\s/i.test(ua);
var xweb_match = ua.match(/XWEB\/([\d.]+)/i);
var xweb_version = xweb_match && xweb_match[1] ? parseInt(xweb_match[1], 10) : 0;
var is_unified_pc_wechat = /UnifiedPC\w+Wechat/i.test(ua);
var is_in_miniProgram = is_android && /miniprogram/.test(ua.toLowerCase()) || window.__wxjs_environment == 'miniprogram';
var is_wx_work = /wxwork/i.test(ua);
function getUrlParams() {
var vars = location.search.substring(1).split('&');
var params = {};
var _iterator = _createForOfIteratorHelper(vars),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var ele = _step.value;
var pair = ele.split('=');
var key = decodeURIComponent(pair[0]);
if (typeof params[key] === 'undefined') {
params[key] = decodeURIComponent(pair[1]);
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return params;
}
function get() {
var reg = /MicroMessenger\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMac() {
var reg = /MacWechat\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMacOS() {
var reg = /Mac OS X ([\d_]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1].replace(/_/g, '.');
}
return false;
}
function getWindows() {
var reg = /WindowsWechat\(0x(.+?)\)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getWxWork() {
var reg = /wxwork\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMpApp() {
var appVersion = [2, 4, 5];
var match = navigator.userAgent.match(/MPAPP\/(\d+(\.\d+)*)/);
if (match) {
appVersion = match[1].split('.').map(function (v) {
return Number(v);
});
}
return appVersion.join('.');
}
function getUnifiedPcVer() {
var versionInfo = navigator.userAgent.match(/UnifiedPC\w+Wechat\(0xf\w{2}(\w+?)\w{2}\)/);
if (versionInfo && versionInfo.length === 2) {
var version = versionInfo[1];
var mainVersion = getVersionNumber(version.slice(0, 1));
var subVersion = getVersionNumber(version.slice(1, 2));
var subVersion2 = getVersionNumber(version.slice(2, 3));
return [mainVersion, subVersion, subVersion2].join('.');
}
}
function getVersionNumber(hexStr) {
return Number(Number("0x".concat(hexStr)).toString(10));
}
function getWindowsVersionFormat() {
var versionInfo = navigator.userAgent.match(/WindowsWechat\(0x(\w+?)\)/);
if (versionInfo && versionInfo.length === 2) {
var version = versionInfo[1];
var mainVersion = getVersionNumber(version.slice(1, 2));
var subVersion = getVersionNumber(version.slice(2, 4));
var subVersion2 = getVersionNumber(version.slice(4, 6));
return [mainVersion, subVersion, subVersion2].join('.');
}
return false;
}
function getInner() {
var reg = /MicroMessenger\/[\d\.]+\(0x(.+?)\)/i;
var ret = ua.match(reg);
if (ret && ret[1] && ret[1] != null) {
return ret[1];
}
if (!ret && /MicroMessenger\/[\d\.]+/i.test(ua)) {
var urlParams = getUrlParams();
if (urlParams.version) {
return urlParams.version;
}
}
return false;
}
var opfunc = {
'cp-1': function cp1(a, b) {
return a < b;
},
cp0: function cp0(a, b) {
return a === b;
},
cp1: function cp1(a, b) {
return a > b;
}
};
function cpVersion(ver, op, canEq, type) {
var mmver = false;
switch (type) {
case 'mac':
mmver = getMac();
break;
case 'windows':
mmver = getWindowsVersionFormat();
break;
case 'wxwork':
mmver = getWxWork();
break;
case 'mpapp':
mmver = getMpApp();
break;
case 'unifiedpc':
mmver = getUnifiedPcVer();
break;
default:
mmver = get();
break;
}
if (!mmver) {
return;
}
var mmversion = mmver.split('.');
var version = ver.split('.');
if (!/\d+/g.test(mmversion[mmversion.length - 1])) {
mmversion.pop();
}
for (var i = 0, len = Math.max(mmversion.length, version.length); i < len; ++i) {
var mmv = mmversion[i] || '';
var v = version[i] || '';
var mmvn = parseInt(mmv, 10) || 0;
var vn = parseInt(v, 10) || 0;
var eq = opfunc.cp0(mmvn, vn);
if (eq) {
continue;
}
var cp = opfunc["cp".concat(op)];
return cp(mmvn, vn);
}
return canEq || op === 0;
}
function eqVersion(version) {
return cpVersion(version, 0);
}
function gtVersion(version, canEq) {
return cpVersion(version, 1, canEq);
}
function ltVersion(version, canEq) {
return cpVersion(version, -1, canEq);
}
function getPlatform() {
if (is_ios) {
return 'ios';
}
if (is_android) {
return 'android';
}
if (is_mac) {
return 'mac_os';
}
if (is_windows) {
return 'windows';
}
return 'unknown';
}
var is_google_play = false;
var inner_ver_for_google_play_check = getInner();
if (is_android && inner_ver_for_google_play_check) {
var v = "0x".concat(inner_ver_for_google_play_check.substr(-2));
if (parseInt(v) >= 64 && parseInt(v) <= 79) {
is_google_play = true;
}
}
function compareHexVersion(hexNum) {
var innerVersion = getInner();
if (innerVersion && hexNum) {
if (typeof hexNum === 'string') {
hexNum = parseInt(hexNum, 16);
}
var version = parseInt(innerVersion, 16);
return version >= hexNum;
}
return false;
}
var mmVersion = {
get: get,
getMac: getMac,
getMacOS: getMacOS,
getWindows: getWindows,
getInner: getInner,
getWxWork: getWxWork,
getMpApp: getMpApp,
cpVersion: cpVersion,
eqVersion: eqVersion,
gtVersion: gtVersion,
ltVersion: ltVersion,
getPlatform: getPlatform,
getVersionNumber: getVersionNumber,
isWp: is_wp,
isIOS: is_ios,
isAndroid: is_android,
isHarmony: is_harmony,
isHarmonyWechat: is_harmony && is_wechat && cpVersion('1.0.0', 1, true),
isInMiniProgram: is_in_miniProgram,
isWechat: is_wechat,
isMac: is_mac,
isWindows: is_windows,
isLinux: is_linux,
isMacWechat: is_mac_wechat,
isWindowsWechat: is_windows_wechat,
isWxWork: is_wx_work,
isOnlyWechat: is_wechat && !is_wx_work,
isMpapp: is_mpapp,
isIPad: is_ipad,
isGooglePlay: is_google_play,
isPrefetch: is_prefetch,
isDonutAPP: is_donut_app,
compareHexVersion: compareHexVersion,
isPcWechat: is_windows_wechat || is_mac_wechat,
xwebVersion: xweb_version,
isUnifiedPcWechat: is_unified_pc_wechat
};
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toPrimitive(input, hint) {
if (_typeof(input) !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (_typeof(res) !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return _typeof(key) === "symbol" ? key : String(key);
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
var Device = {};
function detect(ua) {
var MQQBrowser = ua.match(/MQQBrowser\/(\d+\.\d+)/i);
var MQQClient = ua.match(/QQ\/(\d+\.(\d+)\.(\d+)\.(\d+))/i) || ua.match(/V1_AND_SQ_([\d\.]+)/);
var WeChat = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/) || ua.match(/MicroMessenger\/((\d+)\.(\d+))/);
var MacOS = ua.match(/Mac\sOS\sX\s(\d+[\.|_]\d+)/);
var WinOS = ua.match(/Windows(\s+\w+)?\s+?(\d+\.\d+)/);
var Linux = ua.match(/Linux\s/);
var MiuiBrowser = ua.match(/MiuiBrowser\/(\d+\.\d+)/i);
var M1 = ua.match(/MI-ONE/);
var MIPAD = ua.match(/MI PAD/);
var UC = ua.match(/UCBrowser\/(\d+\.\d+(\.\d+\.\d+)?)/) || ua.match(/\sUC\s/);
var IEMobile = ua.match(/IEMobile(\/|\s+)(\d+\.\d+)/) || ua.match(/WPDesktop/);
var ipod = ua.match(/(ipod).*\s([\d_]+)/i);
var ipad = ua.match(/(ipad).*\s([\d_]+)/i);
var iphone = ua.match(/(iphone)\sos\s([\d_]+)/i);
var Chrome = ua.match(/Chrome\/(\d+\.\d+)/);
var AndriodBrowser = ua.match(/Mozilla.*Linux.*Android.*AppleWebKit.*Mobile Safari/);
var android = ua.match(/(android)\s([\d\.]+)/i);
var harmony = ua.match(/(OpenHarmony)\s([\d\.]+)/i);
Device.browser = Device.browser || {}, Device.os = Device.os || {};
Device.os.type = -1;
Device.os.unifiedPC = ua.match(/UnifiedPC/);
Device.os.unifiedMac = /UnifiedPCMac/i.test(ua);
Device.os.unifiedWindows = /UnifiedPCWindows/i.test(ua);
if (window.ActiveXObject) {
var vie = 6;
(window.XMLHttpRequest || ua.indexOf('MSIE 7.0') > -1) && (vie = 7);
(window.XDomainRequest || ua.indexOf('Trident/4.0') > -1) && (vie = 8);
ua.indexOf('Trident/5.0') > -1 && (vie = 9);
ua.indexOf('Trident/6.0') > -1 && (vie = 10);
Device.browser.ie = true, Device.browser.version = vie;
} else if (ua.indexOf('Trident/7.0') > -1) {
Device.browser.ie = true, Device.browser.version = 11;
}
if (android) {
Device.os.android = true;
Device.os.version = android[2];
Device.os.type = 2;
}
if (harmony) {
Device.os.harmony = true;
Device.os.version = harmony[2];
Device.os.type = 42;
}
if (ipod) {
Device.os.ios = Device.os.ipod = true;
Device.os.version = ipod[2].replace(/_/g, '.');
}
if (ipad) {
Device.os.ios = Device.os.ipad = true;
Device.os.version = ipad[2].replace(/_/g, '.');
Device.os.type = 13;
}
if (iphone) {
Device.os.iphone = Device.os.ios = true;
Device.os.version = iphone[2].replace(/_/g, '.');
Device.os.type = 1;
}
if (WinOS) Device.os.windows = true, Device.os.version = WinOS[2], Device.os.type = 15;
if (MacOS) Device.os.Mac = true, Device.os.version = MacOS[1], Device.os.type = 14;
if (Linux) Device.os.Linux = true, Device.os.type = 33;
if (ua.indexOf('lepad_hls') > 0) Device.os.LePad = true;
if (MIPAD) Device.os.MIPAD = true;
if (MQQBrowser) Device.browser.MQQ = true, Device.browser.version = MQQBrowser[1];
if (MQQClient) Device.browser.MQQClient = true, Device.browser.version = MQQClient[1];
if (WeChat) Device.browser.WeChat = true, Device.browser.mmversion = Device.browser.version = WeChat[1];
if (MiuiBrowser) Device.browser.MIUI = true, Device.browser.version = MiuiBrowser[1];
if (UC) Device.browser.UC = true, Device.browser.version = UC[1] || NaN;
if (IEMobile) Device.browser.IEMobile = true, Device.browser.version = IEMobile[2];
if (AndriodBrowser) {
Device.browser.AndriodBrowser = true;
}
if (M1) {
Device.browser.M1 = true;
}
if (Chrome) {
Device.browser.Chrome = true, Device.browser.version = Chrome[1];
}
if (Device.os.windows) {
if (typeof navigator.platform !== "undefined" && navigator.platform.toLowerCase() == "win64") {
Device.os.win64 = true;
} else {
Device.os.win64 = false;
}
}
if (Device.os.Mac || Device.os.windows || Device.os.Linux || Device.os.unifiedPC || /OpenHarmony/i.test(ua) && /pc/i.test(ua)) {
Device.os.pc = true;
}
var osType = {
iPad7: 'iPad; CPU OS 7',
LePad: 'lepad_hls',
XiaoMi: 'MI-ONE',
SonyDTV: "SonyDTV",
SamSung: 'SAMSUNG',
HTC: 'HTC',
VIVO: 'vivo'
};
for (var os in osType) {
Device.os[os] = ua.indexOf(osType[os]) !== -1;
}
Device.os.phone = Device.os.phone || /windows phone/i.test(ua);
Device.os.getNumVersion = function () {
return parseFloat(Device.os.version);
};
Device.os.hasTouch = 'ontouchstart' in window;
if (Device.os.hasTouch && Device.os.ios && Device.os.getNumVersion() < 6) {
Device.os.hasTouch = false;
}
if (Device.browser.WeChat && Device.browser.version < 5.0) {
Device.os.hasTouch = false;
}
Device.browser.getNumVersion = function () {
return parseFloat(Device.browser.version);
};
Device.browser.isFFCanOcx = function () {
return !!Device.browser.firefox && Device.browser.getNumVersion() >= 3.0;
};
Device.browser.isCanOcx = function () {
return !!Device.os.windows && (!!Device.browser.ie || Device.browser.isFFCanOcx() || !!Device.browser.webkit);
};
Device.browser.isNotIESupport = function () {
return !!Device.os.windows && (!!Device.browser.webkit || Device.browser.isFFCanOcx());
};
Device.userAgent = {};
Device.userAgent.browserVersion = Device.browser.version;
Device.userAgent.osVersion = Device.os.version;
if (Device.os.unifiedPC) {
if (Device.os.unifiedWindows) Device.os.type = 37;else if (Device.os.unifiedMac) Device.os.type = 38;else Device.os.type = 39;
}
delete Device.userAgent.version;
}
detect(window.navigator.userAgent);
function canSupportH5Video() {
var ua = window.navigator.userAgent,
m = null;
if (!!Device.os.android) {
if (Device.browser.MQQ && Device.browser.getNumVersion() >= 4.2) {
return true;
}
if (ua.indexOf('MI2') != -1) {
return true;
}
if (Device.os.version >= '4' && (m = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/))) {
if (parseFloat(m[1]) >= 4.2) {
return true;
}
}
if (Device.os.version >= '4.1') {
return true;
}
}
return false;
}
function canSupportVideoMp4() {
var video = document.createElement('video');
if (typeof video.canPlayType === 'function') {
if (video.canPlayType('video/mp4; codecs="mp4v.20.8"') === 'probably') {
return true;
}
if (video.canPlayType('video/mp4; codecs="avc1.42E01E"') === 'probably' || video.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"') === 'probably') {
return true;
}
}
return false;
}
function canSupportAutoPlay() {
if (Device.os.ios && Device.os.getNumVersion() < 10) {
return false;
}
return true;
}
function isLockdownMode() {
if (!Device.os.ios || Device.os.getNumVersion() < 16) {
return false;
}
if (typeof WebAssembly === 'undefined' && typeof OfflineAudioContext === 'undefined' && typeof WebGLRenderingContext === 'undefined') {
return true;
}
return false;
}
Device.canSupportVideo = canSupportVideoMp4 || canSupportH5Video;
Device.canSupportVideoMp4 = canSupportVideoMp4;
Device.canSupportH5Video = canSupportH5Video;
Device.canSupportAutoPlay = canSupportAutoPlay;
Device.isLockdownMode = isLockdownMode;
Device.cpVersion = function (version) {
var cp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var canEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var nowVersionStr = Device.os.version;
if (!nowVersionStr) return false;
var versionArr = version.split('.');
var nowVersionArr = nowVersionStr.split('.');
for (var i = 0; i < Math.max(nowVersionArr.length, versionArr.length); i++) {
var vi = +versionArr[i];
var nvi = +nowVersionArr[i];
if (vi === nvi) continue;
if (cp > 0) return vi > nvi;
if (cp < 0) return vi < nvi;
}
return canEqual || cp === 0;
};
var initJsBridge = false;
if (!window.JSAPIEventCallbackMap) {
window.JSAPIEventCallbackMap = {};
}
function connectWebViewJavascriptBridge(callback) {
if (window.WebViewMPapp || window.WebViewJavascriptBridge) {
return callback(window.WebViewMPapp || window.WebViewJavascriptBridge);
}
if (window.WVJBCallbacks) {
return window.WVJBCallbacks.push(callback);
}
window.WVJBCallbacks = [callback];
if (!mmVersion.isMpapp) {
return false;
}
if (!initJsBridge) {
initJsBridge = true;
var WVJBIframe = document.createElement('iframe');
WVJBIframe.style.display = 'none';
WVJBIframe.src = 'https://__bridge_loaded__';
document.body.appendChild(WVJBIframe);
setTimeout(function () {
initJsBridge = false;
document.body.removeChild(WVJBIframe);
}, 0);
}
return false;
}
function invoke(jsapiName, opt, callback) {
connectWebViewJavascriptBridge(function (bridge) {
try {
if (typeof opt === 'function') {
callback = opt;
}
if (_typeof(opt) !== 'object' && typeof opt !== 'string') {
opt = {};
}
bridge.callHandler(jsapiName, opt, function (res) {
try {
var ret = _typeof(res) === 'object' ? res : JSON.parse(res);
var errMsg = ret.err_msg || ret.errMsg;
console.info("[mpapp jsapi] invoke->".concat(jsapiName, " ").concat(opt.action || '', " ").concat(errMsg));
typeof callback === 'function' && callback(ret);
} catch (e) {
window.WX_BJ_REPORT.BadJs.report('invoke', "callback ".concat(jsapiName, " error:"), {
mid: 'mmbizwebapp:js_brridge',
_info: e
});
console.error("[mpapp jsapi] ".concat(jsapiName, " ").concat(opt.action || ''), e, res);
}
});
} catch (e) {
window.WX_BJ_REPORT.BadJs.report('invoke', 'callback error:', {
mid: 'mmbizwebapp:js_brridge',
_info: e
});
console.error('[mpapp jsapi]', e);
}
});
}
function _log(level, msg) {
if (level === 'log') {
level = 'info';
msg = "[WechatFe]".concat(msg);
} else {
var prefix = "__wap__".concat(window.__second_open__ ? ' (sec)' : '');
msg = "".concat(prefix, " ").concat(msg, " location:[").concat(location.href, "]");
}
msg += new Error().stack;
if (mmVersion.isMpapp) {
invoke('WNNativeCallbackLog', msg);
} else if (mmVersion.isWechat) {
if (mmVersion.isAndroid) {
console.warn('[system]', "[MicroMsg.JsApiLog][".concat(level, "] jslog : ").concat(msg));
} else if (mmVersion.isIOS) {
JSAPI.invoke('writeLog', {
level: level,
msg: msg
});
} else {
JSAPI.invoke('log', {
level: level,
msg: msg
});
}
}
}
var Log = {
info: function info() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_log('info', args.join(' '));
},
warn: function warn() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_log('warn', args.join(' '));
},
error: function error() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
_log('error', args.join(' '));
},
debug: function debug() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
_log('debug', args.join(' '));
},
log: function log() {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
_log('info', args.join(' '));
}
};
var reportLogs = [];
var reportExtraLogs = [];
var sendUrl = '/mp/jsmonitor?#wechat_redirect';
var monitor = {};
monitor._reportOptions = {
idkey: {}
};
function ObjWithoutProperty(source, exclude) {
if (source === null) return {};
var target = {};
var sourceKeys = Object.keys(source);
for (var i = 0; i < sourceKeys.length; i++) {
var key = sourceKeys[i];
if (exclude.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function formatDataToString(data) {
var reportData = [];
for (var key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
reportData.push(key + '=' + encodeURIComponent(data[key]));
}
}
return reportData.join('&');
}
monitor.getReportData = function (opt) {
opt = opt || {};
var idkey = monitor._reportOptions.idkey || {};
var key = null;
var reportData = {};
var nextKey;
try {
for (key in idkey) {
if (Object.prototype.hasOwnProperty.call(idkey, key) && idkey[key]) {
reportLogs.push(key + '_' + idkey[key]);
}
}
} catch (e) {
return false;
}
if (reportLogs.length === 0) {
return false;
}
if (reportExtraLogs.length) {
reportData.lc = reportExtraLogs.length;
reportExtraLogs.forEach(function (extraLog, index) {
reportData["log".concat(index)] = extraLog;
});
}
try {
var reportOptions = monitor._reportOptions;
if (reportOptions !== null && reportOptions !== undefined) {
for (nextKey in reportOptions) {
if (Object.prototype.hasOwnProperty.call(reportOptions, nextKey)) {
reportData[nextKey] = reportOptions[nextKey];
}
}
}
} catch (e) {
reportData = {};
}
reportData.idkey = reportLogs.join(';');
reportData.t = Math.random();
if (opt.remove !== false) {
reportLogs = [];
reportExtraLogs = [];
monitor._reportOptions = {
idkey: {}
};
}
return reportData;
};
monitor.setLogs = function (opt) {
var id = opt.id;
var key = opt.key;
var value = opt.value;
var extraLog = opt.log;
var others = ObjWithoutProperty(opt, ['id', 'key', 'value', 'log']);
var idkey = monitor._reportOptions.idkey || {};
var param = id + '_' + key;
if (idkey[param]) {
idkey[param] += value;
} else {
idkey[param] = value;
}
monitor._reportOptions.idkey = idkey;
if (extraLog) {
reportExtraLogs.push(extraLog);
}
try {
if (others !== null && others !== undefined) {
for (var otherKey in others) {
if (Object.prototype.hasOwnProperty.call(others, otherKey)) {
monitor._reportOptions[otherKey] = others[otherKey];
}
}
}
} catch (e) {
console.log(e);
}
return monitor;
};
monitor.setAvg = function (id, key, value) {
var idkey = monitor._reportOptions.idkey || {};
var param1 = id + '_' + key;
var param2 = id + '_' + (key - 1);
if (idkey[param1]) {
idkey[param1] += value;
} else {
idkey[param1] = value;
}
if (idkey[param2]) {
idkey[param2] += 1;
} else {
idkey[param2] = 1;
}
monitor._reportOptions.idkey = idkey;
return monitor;
};
monitor.setSum = function (id, key) {
var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var idkey = monitor._reportOptions.idkey;
var param = id + '_' + key;
if (idkey[param]) {
idkey[param] += value;
} else {
idkey[param] = value;
}
monitor._reportOptions.idkey = idkey;
return monitor;
};
monitor.send = function (async, ajax, origin) {
if (async !== false) {
async = true;
}
var data = monitor.getReportData();
origin = origin || '';
if (!data) {
return;
}
if (!!ajax && ajax instanceof Function) {
ajax({
url: origin + sendUrl,
type: 'POST',
mayAbort: true,
data: data,
async: async,
timeout: 2000,
dontReport: true
});
} else {
new Image().src = origin + '/mp/jsmonitor?' + formatDataToString(data) + '#wechat_redirect';
}
};
if (typeof window !== 'undefined' && window.__monitor) {
monitor = window.__monitor;
} else {
typeof window !== 'undefined' && (window.__monitor = monitor);
}
var monitor$1 = monitor;
var logList = [];
var log = function log(msg) {
logList.push(msg);
};
var printLog = function printLog() {
for (var i = 0, len = logList.length; i < len; ++i) {
console.log("[RespType]".concat(logList[i]));
}
};
var isArray = function isArray(val) {
return Object.prototype.toString.call(val) === '[object Array]';
};
var getValueType = function getValueType(value) {
if (isArray(value)) {
return 'array';
}
return _typeof(value);
};
var parseRtDesc = function parseRtDesc(rtDesc, k) {
var type = 'mix';
var isRequired = false;
var key = k;
if (k) {
var requireKeyWord = '_R';
var pos = k.indexOf(requireKeyWord);
var len = k.length - requireKeyWord.length;
isRequired = pos !== -1 && pos === len;
key = isRequired ? k.substring(0, len) : k;
}
if (typeof rtDesc === 'string') {
type = rtDesc;
} else if (isArray(rtDesc)) {
type = 'array';
} else if (_typeof(rtDesc) === 'object') {
type = 'object';
}
return {
key: key,
type: type,
isRequired: isRequired
};
};
var checkForArrayRtDesc = function checkForArrayRtDesc(arr, rtDescs) {
if (!isArray(arr)) {
return false;
}
for (var i = 0, len = arr.length; i < len; ++i) {
var value = arr[i];
var rtDesc = void 0;
var j = 0;
var flag = rtDescs.length === 0;
while (rtDesc = rtDescs[j++]) {
if (checkForRtDesc(value, rtDesc)) {
flag = true;
break;
}
}
if (!flag) {
return false;
}
}
return true;
};
var checkForStringRtDesc = function checkForStringRtDesc(value, rtDesc) {
var valueType = getValueType(value);
var desc = parseRtDesc(rtDesc);
var ret = desc.type === valueType;
if (!ret) {
log("miss match type : ".concat(valueType, " !== ").concat(desc.type));
}
return ret;
};
var checkForObjectRtDesc = function checkForObjectRtDesc(json, rtDesc) {
if (_typeof(json) !== 'object' || isArray(json)) {
log('must be object');
return false;
}
var rootJson = json;
var nowCheckValue = json;
for (var k in rtDesc) {
if (rtDesc.hasOwnProperty(k)) {
var nowCheckDesc = rtDesc[k];
var desc = parseRtDesc(nowCheckDesc, k);
var key = desc.key;
nowCheckValue = rootJson[key];
var valueType = getValueType(nowCheckValue);
if (desc.isRequired && nowCheckValue === undefined) {
log("is required @key=".concat(key));
return false;
}
if (nowCheckValue !== undefined) {
if (valueType !== desc.type && desc.type !== 'mix') {
log("miss match type : ".concat(valueType, " !== ").concat(desc.type, " @key=").concat(key));
return false;
}
if ((valueType === 'array' || valueType === 'object') && desc.type !== 'mix') {
if (!checkForRtDesc(nowCheckValue, nowCheckDesc)) {
return false;
}
}
}
}
}
return true;
};
var checkForRtDesc = function checkForRtDesc(json, rtDesc) {
if (isArray(rtDesc)) {
return checkForArrayRtDesc(json, rtDesc);
}
if (_typeof(rtDesc) === 'object') {
return checkForObjectRtDesc(json, rtDesc);
}
if (typeof rtDesc === 'string') {
return checkForStringRtDesc(json, rtDesc);
}
return false;
};
var _check = function check(json, rtDescs) {
if (typeof json === 'string') {
try {
json = eval("(".concat(json, ")"));
} catch (e) {
log('parse json error');
return false;
}
}
if (_typeof(json) !== 'object') {
log('must be object');
return false;
}
if (!isArray(rtDescs)) {
rtDescs = [rtDescs];
}
var rtDesc;
var i = 0;
while (rtDesc = rtDescs[i++]) {
if (checkForRtDesc(json, rtDesc)) {
return true;
}
}
return false;
};
var RespTypes = {
check: function check(json, rtDesc) {
logList = [];
try {
var ret = _check(json, rtDesc);
if (!ret) {
printLog();
}
return ret;
} catch (e) {
logList.push("[rtException]".concat(e.toString()));
printLog();
return false;
}
},
getMsg: function getMsg() {
return logList.join(';');
}
};
function getInflightMap() {
if (!window.__dedupe_promise_inflight__) {
window.__dedupe_promise_inflight__ = new Map();
}
return window.__dedupe_promise_inflight__;
}
function dedupePromise(key, factory) {
var inflightMap = getInflightMap();
var existing = inflightMap.get(key);
console.log("dedupePromise key=".concat(key, " existing=").concat(existing));
if (existing) {
return existing;
}
var promise = Promise.resolve().then(factory)["finally"](function () {
inflightMap["delete"](key);
});
inflightMap.set(key, promise);
return promise;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
var prefix = '__WXLS__';
var localStorage$1 = window.localStorage || {
getItem: function getItem() {},
setItem: function setItem() {},
removeItem: function removeItem() {},
key: function key() {},
clear: function clear() {
var _a, _b;
(_b = (_a = window.localStorage) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a);
},
length: 0
};
var evictionPolicies = {
noeviction: function noeviction(data) {
return data;
},
'allkeys-random': function allkeysRandom(data, size) {
var keys = Object.keys(data);
var memCnt = 0;
while (memCnt < size) {
var len = keys.length;
var randomKeyIdx = Math.floor(Math.random() * len);
var randomKey = keys[randomKeyIdx];
memCnt += JSON.stringify(data[randomKey]).length;
delete data[randomKey];
keys = Object.keys(data);
}
return data;
},
'volatile-ttl': function volatileTtl(data, size) {
var keys = Object.keys(data);
keys = keys.sort(function (key1, key2) {
var d1 = data[key1];
var d2 = data[key2];
if (d1.exp < d2.exp) return -1;
if (d1.exp > d2.exp) return 1;
return 0;
});
var memCnt = 0;
for (var i = 0; i < keys.length; i++) {
if (memCnt >= size) break;
var key = keys[i];
memCnt += JSON.stringify(data[key]).length;
delete data[key];
}
return data;
},
'clear-all': function clearAll() {
localStorage$1.clear();
return {};
}
};
function formatLogMsg(str) {
return "[WXLS] ".concat(str);
}
var LS = function () {
function LS(func, evictionPolicy, logger) {
_classCallCheck(this, LS);
this.logger = function () {};
if (!func) throw 'require function name.';
this.evictionPolicy = 'noeviction';
this.key = func;
if (typeof logger === 'function') {
this.logger = function (str, type) {
return logger(formatLogMsg(str), type);
};
}
if (evictionPolicy && Object.keys(evictionPolicies).indexOf(evictionPolicy) !== -1) {
this.evictionPolicy = evictionPolicy;
}
this.init();
}
_createClass(LS, [{
key: "init",
value: function init() {
var _a, _b;
this.check();
if (Math.random() * 1000 < 1) {
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.call(this, "LSlen: ".concat(((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length) || localStorage$1.length), 'report');
}
}
}, {
key: "getData",
value: function getData() {
var data = LS.getItem(this.key) || '{}';
try {
data = JSON.parse(data);
} catch (e) {
this.logger("getData error: ".concat(e), 'error');
localStorage$1.removeItem(prefix + this.key);
data = {};
}
return data;
}
}, {
key: "check",
value: function check(isReturn) {
var data = this.getData();
var temp = {};
var now = +new Date();
var key;
var val;
for (key in data) {
val = data[key];
if (+val.exp > now) {
temp[key] = val;
}
}
this.logger("check info: isReturn:".concat(isReturn, " data:").concat(JSON.stringify(temp)), 'info');
if (isReturn) return temp;
LS.setItem(this.key, JSON.stringify(temp), this.logger);
}
}, {
key: "set",
value: function set(key, val, exp) {
var _a, _b;
var data = this.check(true);
data[key] = {
val: val,
exp: exp || +new Date()
};
try {
if (localStorage$1.getItem(prefix + this.key)) localStorage$1.removeItem(prefix + this.key);
localStorage$1.setItem(prefix + this.key, JSON.stringify(data));
this.logger("first set success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data)), 'success');
} catch (e) {
this.logger("first set error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data), " k:").concat(key, " v:").concat(val, " exp:").concat(exp), 'error');
localStorage$1.clear();
LS.setItem(this.key, JSON.stringify(_defineProperty({}, key, {
val: val,
exp: exp || +new Date()
})), this.logger);
}
}
}, {
key: "get",
value: function get(key) {
var data = this.getData();
data = data[key];
return data ? data.val || null : null;
}
}, {
key: "remove",
value: function remove(key) {
var data = this.getData();
if (data[key]) delete data[key];
LS.setItem(this.key, JSON.stringify(data), this.logger);
}
}], [{
key: "getItem",
value: function getItem(key) {
key = prefix + key;
return localStorage$1.getItem(key);
}
}, {
key: "setItem",
value: function setItem(key, val, logger) {
var _a, _b;
key = prefix + key;
var n = 3;
while (n--) {
try {
if (localStorage$1.getItem(key)) localStorage$1.removeItem(key);
localStorage$1.setItem(key, val);
typeof logger === 'function' && logger("setItem success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(key, " val:").concat(val), 'success');
break;
} catch (e) {
typeof logger === 'function' && logger("setItem error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(key, " val:").concat(val), 'error');
LS.clear();
}
}
}
}, {
key: "clear",
value: function clear() {
var i;
var k;
for (i = localStorage$1.length - 1; i >= 0; i--) {
k = localStorage$1.key(i);
if (k.indexOf(prefix) == 0) {
localStorage$1.removeItem(k);
}
}
}
}, {
key: "getSupportEvicationPolicy",
value: function getSupportEvicationPolicy() {
return Object.keys(evictionPolicies);
}
}]);
return LS;
}();
var innerVersion = (mmVersion.getInner() || '').toUpperCase();
var getBizLS = new LS('get_biz_result');
function getBizMap() {
if (!window.__get_biz_map__) {
window.__get_biz_map__ = {};
}
return window.__get_biz_map__;
}
var isGetBizSupported = mmVersion.isOnlyWechat && mmVersion.isIOS && innerVersion >= '18003C2A' || mmVersion.isOnlyWechat && mmVersion.isAndroid && innerVersion >= '28003D3C' || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc');
function invokeGetBiz(needCheckBiz, bizType) {
return dedupePromise("getBiz:".concat(needCheckBiz, ":").concat(bizType), function () {
return new Promise(function (resolve, reject) {
if (!isGetBizSupported) {
reject('Not support');
} else {
JSAPI.invoke('handleMPPageAction', {
action: 'getBiz',
needCheckBiz: needCheckBiz,
bizType: bizType
}, function (res) {
console.log("getBiz needCheckBiz=".concat(needCheckBiz, " bizType=").concat(bizType, " res: ").concat(JSON.stringify(res)));
if (res && res.err_msg && res.err_msg.indexOf('ok') > -1) {
var bizMap = getBizMap();
bizMap[bizType] = res.biz;
resolve(res.biz);
getBizLS.set("".concat(bizType, "_get_biz_result"), res.biz, +new Date() + 3 * 24 * 60 * 60 * 1000);
} else {
reject('Failed to get biz');
}
});
}
});
});
}
function getBiz(needCheckBiz, bizType) {
var _a;
if (needCheckBiz === void 0) {
needCheckBiz = false;
}
if (bizType === void 0) {
bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1;
}
var bizMap = getBizMap();
if (!needCheckBiz && bizMap[bizType] !== undefined) {
return Promise.resolve(bizMap[bizType]);
}
return invokeGetBiz(needCheckBiz, bizType);
}
mmVersion.isOnlyWechat && mmVersion.isIOS || mmVersion.isOnlyWechat && mmVersion.isAndroid || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc');
var getIsAuthor = function getIsAuthor(cb, bizuin, needCheckBiz, bizType) {
var _a;
if (bizuin === void 0) {
bizuin = window.biz;
}
if (needCheckBiz === void 0) {
needCheckBiz = false;
}
if (bizType === void 0) {
bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1;
}
getBiz(needCheckBiz, bizType).then(function (biz) {
cb(biz && biz === bizuin);
})["catch"](function () {
cb(false);
});
};
function parseUrl(url) {
var len = url.length;
var ques_pos = url.indexOf('?');
var hash_pos = url.indexOf('#');
hash_pos = hash_pos == -1 ? len : hash_pos;
ques_pos = ques_pos == -1 ? hash_pos : ques_pos;
var host = url.substring(0, ques_pos);
var query_str = url.substring(ques_pos + 1, hash_pos);
var hash = url.substring(hash_pos + 1);
return {
host: host,
query_str: query_str,
hash: hash
};
}
function join(url, args, noEncode) {
var ret = parseUrl(url);
var query_str = ret.query_str;
var args_arr = [];
if (_typeof(args) === 'object') {
for (var key in args) {
if (args.hasOwnProperty(key)) {
args_arr.push("".concat(key, "=").concat(noEncode ? args[key] : encodeURIComponent(args[key])));
}
}
} else {
args_arr.push(noEncode ? args : encodeURIComponent(args));
}
if (args_arr.length > 0) {
query_str += (query_str !== "" ? "&" : "") + args_arr.join("&");
}
return ret.host + (query_str !== "" ? "?".concat(query_str) : "") + (ret.hash !== "" ? "#".concat(ret.hash) : "");
}
function addParam(url, param, value, forceReplace) {
url = url || location.href;
var firstAndPos = url.indexOf("&");
var len = url.length;
var reverseUrl = url.replace(/^[\w\d]+:[/\\]+/g, "").split("").reverse();
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement, fromIndex) {
var k;
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var O = Object(this);
var len = O.length >>> 0;
if (len === 0) {
return -1;
}
var n = fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
if (n >= len) {
return -1;
}
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {
if (k in O && O[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
}
var lastSlashPos = len - 1 - reverseUrl.indexOf("/");
if (firstAndPos !== -1 && url.indexOf("?") == -1 && firstAndPos > lastSlashPos) {
url = url.replace("&", "?");
}
var reg = new RegExp("([\\?&]".concat(param, "=)[^&#]*"));
if (!url.match(reg)) {
var urlInfo = parseUrl(url);
var hash = urlInfo.hash ? '#' + urlInfo.hash : '';
url = url.replace(hash, '');
var _pos = url.indexOf("?");
if (_pos == -1) {
return "".concat(url, "?").concat(param, "=").concat(value).concat(hash);
}
if (_pos == url.length - 1) {
return "".concat(url + param, "=").concat(value).concat(hash);
}
return "".concat(url, "&").concat(param, "=").concat(value).concat(hash);
}
if (forceReplace === true) {
return url.replace(reg, "$1".concat(value));
}
return url;
}
function addWxfrom(src, wxfrom) {
var offset = window.service_type === 1 ? 10000 : 0;
return addParam(src, 'wxfrom', offset + Number(wxfrom), true);
}
function removeParam(url, param) {
var _URL = new URL(url),
protocol = _URL.protocol,
host = _URL.host,
pathname = _URL.pathname,
search = _URL.search,
hash = _URL.hash;
var queryParams = new URLSearchParams(search);
queryParams["delete"](param);
var newSearch = queryParams.toString();
var newUrl = new URL("".concat(protocol, "//").concat(host).concat(pathname).concat(newSearch ? "?".concat(decodeURIComponent(newSearch)) : "").concat(hash));
return newUrl.toString();
}
function getQuery(name, url) {
var u = url || window.location.search;
var reg = new RegExp("(^|&)".concat(name, "=([^&]*)(&|$)"));
var r = u.substring(u.indexOf('?') + 1).match(reg);
return r !== null ? r[2] : '';
}
function encodeBase64(value) {
try {
return window.btoa(value);
} catch (e) {
return '';
}
}
function decodeBase64(value) {
try {
return window.atob(value);
} catch (e) {
return '';
}
}
function joinUrl$1(url) {
var obj = {};
if (typeof window.uin !== 'undefined') {
obj.uin = window.uin;
}
if (typeof window.key !== 'undefined') {
obj.key = window.key;
}
if (typeof window.pass_ticket !== 'undefined') {
obj.pass_ticket = window.pass_ticket;
}
if (typeof window.wxtoken !== 'undefined') {
obj.wxtoken = window.wxtoken;
}
if (typeof window.devicetype !== 'undefined') {
obj.devicetype = window.devicetype;
}
if (typeof window.clientversion !== 'undefined') {
obj.clientversion = window.clientversion || mmVersion.getInner();
}
obj.version = obj.clientversion;
if (window.biz) {
obj.__biz = window.biz;
}
if (getQuery('enterid')) {
obj.enterid = getQuery('enterid');
}
if (typeof window.appmsg_token !== 'undefined') {
obj.appmsg_token = window.appmsg_token;
} else if (url.indexOf('advertisement_report') > -1) {
new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random());
}
obj.x5 = navigator.userAgent.indexOf('TBS/') !== -1 ? '1' : '0';
obj.f = 'json';
return join(url, obj);
}
function joinUserArticleRole(url, notJoin, cb) {
var bizuin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : window.biz;
var needCheckBiz = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
if (notJoin) {
cb(url);
} else {
getIsAuthor(function (isAuthor) {
cb(addParam(url, 'user_article_role', isAuthor ? 1 : 0, true));
}, bizuin, needCheckBiz);
}
}
function getA8keyQuery(name, url) {
return new Promise(function (resolve) {
if (window.__secPageAuthPromise) {
window.__secPageAuthPromise.then(function () {
resolve(getQuery(name, url));
});
} else {
resolve(getQuery(name, url));
}
});
}
function addHash(url, hash) {
var isReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (isReplace) {
return "".concat(url.split('#')[0]).concat(hash);
}
return "".concat(url).concat(url.indexOf('#') === -1 ? '#' : '').concat(hash);
}
function decodeUrl(url) {
var _url = url;
while (_url.indexOf('&') !== -1) {
_url = _url.htmlDecode();
}
return _url;
}
var Url = {
parseUrl: parseUrl,
join: join,
addParam: addParam,
addWxfrom: addWxfrom,
addHash: addHash,
getQuery: getQuery,
getA8keyQuery: getA8keyQuery,
encodeBase64: encodeBase64,
decodeBase64: decodeBase64,
joinUrl: joinUrl$1,
joinUserArticleRole: joinUserArticleRole,
removeParam: removeParam,
decodeUrl: decodeUrl
};
var _a;
var doc;
var isAcrossOrigin = false;
try {
doc = (_a = window.top) === null || _a === void 0 ? void 0 : _a.window.document;
} catch (e) {
isAcrossOrigin = true;
}
var StatusTextMap = {
200: 'OK',
302: 'Found',
400: 'Bad Request',
500: 'Internal Server Error'
};
function getIsAcrossOrigin() {
return isAcrossOrigin;
}
function networkStartLog(item) {
var _a, _b, _c, _d, _e;
console.log('[system]', "< [request ".concat(item.requestType, "]"), item.url, item.method, item);
var rdevRequestId;
var requestTime = performance.now() / 1000;
if ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) {
try {
var willBeSentOptions = {
url: item.url,
method: item.method,
requestHeaders: Object.assign({}, item.requestHeader || {}, {
RDEV_REQUEST_TYPE: item.requestType
}),
requestBody: item.postData,
requestTime: requestTime
};
rdevRequestId = window.RemoteDevSdk.instance.Network.customRequestWillBeSent(willBeSentOptions);
} catch (err) {}
}
if ((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) {
try {
var vconsoleNetworkItem = (_e = (_d = window.vConsole.network).add) === null || _e === void 0 ? void 0 : _e.call(_d, Object.assign({}, item, {
startTime: Date.now(),
endTime: Date.now(),
status: 0,
readyState: 2,
response: ''
}));
vconsoleNetworkItem.rdevRequestId = rdevRequestId;
vconsoleNetworkItem.requestTime = requestTime;
return vconsoleNetworkItem;
} catch (err) {}
}
if (rdevRequestId) {
return Object.assign(Object.assign({}, item), {
id: '__only_rdev_log__',
rdevRequestId: rdevRequestId,
requestTime: requestTime
});
}
return Object.assign({}, item, {
id: '__system_log__'
});
}
function networkEndLog(item) {
var _a, _b, _c, _d, _e;
console.log('[system]', "> [response ".concat(item.requestType, "]"), item.url, item.response, item);
if (item.rdevRequestId && ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) && item.id !== '__system_log__') {
try {
var finishedOptions = {
requestId: item.rdevRequestId,
url: item.url,
status: +(item.status || '500'),
statusText: StatusTextMap[+(item.status || '500')] || 'Error',
responseHeaders: {
RDEV_RESPONSE_TYPE: item.requestType
},
responseBody: item.response,
requestTime: item.requestTime || 0,
duration: item.costTime || (item.endTime && item.startTime ? item.endTime - item.startTime : performance.now() / 1000 - (item.requestTime || 0))
};
window.RemoteDevSdk.instance.Network.customRequestFinished(finishedOptions);
} catch (err) {}
}
if (((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) && item.id !== '__system_log__') {
try {
item.statusText = "".concat(item.status);
item.responseSize = item.response.length;
item.responseSizeText = "".concat(item.response.length);
return (_e = (_d = window.vConsole.network).update) === null || _e === void 0 ? void 0 : _e.call(_d, item.id, Object.assign({}, item, {
readyState: 4
}));
} catch (err) {}
}
}
function reqType(obj, path) {
return obj.url.indexOf(path) > -1 && obj.url.indexOf('action=') === -1 && (!obj.data || !obj.data.action);
}
function findAjaxScopeByConfig(url, config) {
var pathname = new URL(url, location.href).pathname || '';
var scope = config[pathname.slice(1)];
if (scope) {
return scope;
}
}
function getAjaxScope(ajaxUrl) {
if (Url.getQuery('no_transfer', location.href) !== '1' && mmVersion.isWechat && !mmVersion.isInMiniProgram && !mmVersion.isWxWork && !mmVersion.isMpapp && !isAcrossOrigin && window.__ajaxTransferConfig && _typeof(window.__ajaxTransferConfig) === 'object' && (
mmVersion.isIOS && mmVersion.compareHexVersion('1800282F') || mmVersion.isAndroid && mmVersion.compareHexVersion('28002234') || mmVersion.isWindowsWechat && mmVersion.cpVersion('3.9.5', 1, true, 'windows') || mmVersion.isMacWechat && mmVersion.cpVersion('3.8.4', 1, true, 'mac') || mmVersion.isHarmonyWechat && mmVersion.compareHexVersion('0xf3100b00') && !mmVersion.compareHexVersion('0xf3100c00') || mmVersion.compareHexVersion('0xf3800b00'))) {
try {
return findAjaxScopeByConfig(ajaxUrl, window.__ajaxTransferConfig);
} catch (err) {
}
}
}
function getActionByData(data) {
var _a, _b;
if (_typeof(data) === 'object' && !(data instanceof Blob)) {
if (data.hasOwnProperty('data') && typeof data.data === 'string') {
try {
var workedData = JSON.parse(data.data);
return workedData.action || '';
} catch (e) {}
}
return data.action || '';
}
if (typeof data === 'string') {
return ((_b = (_a = data.split(/[?&]/).find(function (x) {
return x.indexOf('action=') >= 0;
})) === null || _a === void 0 ? void 0 : _a.split('=')) === null || _b === void 0 ? void 0 : _b[1]) || '';
}
return '';
}
var METHOD_ENUM = {
GET: 0,
POST: 1
};
var __moon_report = window.__moon_report || function () {};
var MOON_AJAX_SUCCESS_OFFSET = 3;
var MOON_AJAX_NETWORK_OFFSET = 4;
var MOON_AJAX_ERROR_OFFSET = 5;
var MOON_AJAX_TIMEOUT_OFFSET = 6;
var MOON_AJAX_COMPLETE_OFFSET = 7;
var LENGTH_LIMIT = 4096;
function reportRtError(type, id, key, content) {
var log = '';
var prefix = type === 'rt' ? 'rtCheckError' : 'Ajax Length Limit';
if (content === null || content === void 0 ? void 0 : content.length) {
var loglen = 1000;
var len = content.length;
var lc = Math.ceil(len / loglen);
log = ["&lc=".concat(lc)];
for (var i = 0; i < lc; ++i) {
log.push("&log".concat(i, "=") + "[".concat(prefix, "][").concat(i, "]").concat(encodeURIComponent(content.substring(i * loglen, i * loglen + loglen))));
}
log = log.join('');
}
var data = "idkey=".concat(id, "_").concat(key, "_1").concat(log, "&r=").concat(Math.random());
var xmlobj = new XMLHttpRequest();
xmlobj.open('POST', "".concat(location.protocol, "//").concat(location.host, "/mp/jsmonitor?"), true);
xmlobj.setRequestHeader('cache-control', 'no-cache');
xmlobj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlobj.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xmlobj.send(data);
if (type === 'ajaxLen') {
monitor$1.setLogs({
id: id,
key: key,
value: 1,
log: log
});
}
}
function reportRt(id, key, content) {
reportRtError('rt', id, key, content);
}
function reportAjaxLength(id, key, content) {
reportRtError('ajaxLen', id, key, content);
}
function setXhrHeader(xhr, type, opt) {
if (opt.contentType) {
xhr.setRequestHeader('Content-Type', opt.contentType);
} else if (type === 'POST') {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
}
if (!opt.noXRequestedWidthHeader) {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
}
}
function Ajax(obj) {
var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {};
if (obj.usePb) {
obj.type = 'POST';
obj.data = {
data: JSON.stringify(obj.data)
};
}
var ajaxScope = getAjaxScope(obj.url);
var type = (obj.type || 'GET').toUpperCase();
var timer;
var _url;
if (obj.notJoinUrl) {
_url = obj.url;
} else {
_url = Url.joinUrl(obj.url);
}
Url.joinUserArticleRole(_url, !!obj.notJoinUrl, function (url) {
var urlObj = new URL(url, location.origin);
if (obj.f === 'html') {
url = url.replace('&f=json', '');
}
var data = null;
if (obj.data instanceof Blob) {
data = obj.data;
} else if (_typeof(obj.data) === 'object') {
var d = obj.data;
var ds = [];
for (var k in d) {
if (d.hasOwnProperty(k)) {
ds.push("".concat(k, "=").concat(encodeURIComponent(d[k])));
}
}
data = ds.join('&');
} else {
data = typeof obj.data === 'string' ? obj.data : null;
}
var beginTs;
var beforeReq = function beforeReq() {
if (reqType(obj, '/mp/getappmsgext')) {
window.startGetAppmsgExtTime = Date.now();
Log.log('start get appmsgext, url: ', obj.url);
}
if (reqType(obj, '/mp/getappmsgad')) {
window.startGetAppmsgAdTime = Date.now();
Log.log('start get appmsgad, url: ', obj.url);
}
beginTs = Date.now();
};
var beforeResp = function beforeResp(xhr) {
if (reqType(obj, '/mp/getappmsgext')) {
window.receiveGetAppmsgExt = "".concat(xhr.status, "|").concat(Date.now());
Log.log("receive appmsgext response, status: ".concat(xhr.status));
}
if (reqType(obj, '/mp/getappmsgad')) {
window.receiveGetAppmsgAd = "".concat(xhr.status, "|").concat(Date.now());
Log.log("receive appmsgad response, status: ".concat(xhr.status));
}
if (Math.random() < 0.001 && window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) {
try {
var key = ajaxScope ? 'transfer' : 'xhr';
var interval = 250;
var time = Date.now() - beginTs;
var range = Math.floor(time / interval) * interval;
var pathname = new URL(obj.url, location.href).pathname || '';
window.WX_BJ_REPORT.BadJs.report("".concat(key, "_perf:").concat(pathname), JSON.stringify({
status: xhr.status,
time: "[".concat(range, "-").concat(range + interval, ")")
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
} catch (err) {}
}
};
var handleRespSucc = function handleRespSucc(xhr, requestType) {
var _a, _b, _c, _d;
try {
var responseText = xhr.responseText;
var resp = responseText;
if (obj.dataType === 'json') {
try {
if (JSON && JSON.parse) {
resp = JSON.parse(resp);
} else {
resp = eval("(".concat(resp, ")"));
monitor$1.setSum(523105, 127, 1).send();
}
var rtId = obj.rtId;
var rtKey = obj.rtKey || 0;
var rtDesc = obj.rtDesc;
if (rtId && rtDesc && RespTypes && !RespTypes.check(resp, rtDesc)) {
reportRt(+rtId, +rtKey, "".concat(RespTypes.getMsg(), "[detail]").concat(responseText, ";").concat(obj.url));
}
if (resp && resp.base_resp && ((_a = resp.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) {
var reportUrl = url;
if (url.indexOf('?') !== -1) {
reportUrl = url.substring(0, url.indexOf('?'));
if (Url.getQuery('action', url)) {
reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', url));
}
}
if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resp.base_resp.ret === 'undefined')) {
window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resp.base_resp.ret), {
mid: window.PAGE_MID,
view: 'wap_retcode'
});
}
}
} catch (e) {
obj.error && obj.error(xhr, {
type: 1,
error: e,
status: xhr.status
});
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 1,
HttpCode: xhr.status || 0,
Ret: 0
});
}
return;
}
}
if (_typeof(resp) === 'object' && ((_b = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _b === void 0 ? void 0 : _b.ret) !== 0) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 4,
HttpCode: xhr.status || 0,
Ret: ((_c = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0
});
}
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 0,
HttpCode: xhr.status || 0,
Ret: ((_d = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _d === void 0 ? void 0 : _d.ret) || 0
});
}
}
obj.success && obj.success(resp);
} catch (e) {
__moon_report({
offset: MOON_AJAX_SUCCESS_OFFSET,
e: e
});
throw e;
}
};
var handleRespErr = function handleRespErr(xhr, error, requestType) {
try {
obj.error && obj.error(xhr, {
type: 2,
error: error,
status: xhr.status
});
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type,
RequestType: requestType,
RetType: 2,
HttpCode: xhr.status,
Ret: 0
});
}
} catch (e) {
__moon_report({
offset: MOON_AJAX_ERROR_OFFSET,
e: e
});
throw e;
}
};
var handleRespComplete = function handleRespComplete() {
clearTimeout(timer);
try {
obj.complete && obj.complete();
} catch (e) {
__moon_report({
offset: MOON_AJAX_COMPLETE_OFFSET,
e: e
});
throw e;
}
obj.complete = null;
};
var handleReqTimeout = function handleReqTimeout(xhr) {
if (typeof obj.timeout !== 'undefined') {
timer = setTimeout(function () {
xhr.abort();
try {
obj.complete && obj.complete();
} catch (e) {
__moon_report({
offset: MOON_AJAX_COMPLETE_OFFSET,
e: e
});
throw e;
}
obj.complete = null;
__moon_report({
offset: MOON_AJAX_TIMEOUT_OFFSET,
log: "ajax_timeout_error: ".concat(url),
e: ''
});
}, obj.timeout);
}
};
var retryXhrFn = function retryXhrFn(res, isTimeout, reqLogItem) {
var retryXhr = new XMLHttpRequest();
try {
retryXhr._noVConsole = true;
} catch (err) {}
retryXhr.open(type, url);
retryXhr.onreadystatechange = function () {
if (isTimeout) return;
if (retryXhr.readyState === 3) {
obj.received && obj.received(retryXhr);
}
if (retryXhr.readyState === 4) {
beforeResp(retryXhr);
var retryStatus = retryXhr.status;
if (retryStatus >= 200 && retryStatus < 400) {
handleRespSucc(retryXhr, 1);
} else {
handleRespErr(retryXhr, res, 1);
window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure', JSON.stringify({
retryXhrStatus: retryStatus,
transferRes: res
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
}
reqLogItem.status = retryStatus;
reqLogItem.endTime = Date.now();
reqLogItem.response = retryXhr.responseText;
handleRespComplete();
networkEndLog(reqLogItem);
}
};
setXhrHeader(retryXhr, type, obj);
retryXhr.send(data);
};
if (ajaxScope && !obj.pureHttp) {
var header = {
'User-Agent': navigator.userAgent,
'Cookie': (window.__test_env__ ? 'uniproxy_route=1; ' : '') + document.cookie,
'Referer': location.href
};
if (obj.contentType) {
header['Content-Type'] = obj.contentType;
} else if (type === 'POST') {
header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
if (!obj.noXRequestedWidthHeader) {
header['X-Requested-With'] = 'XMLHttpRequest';
}
var reqUrl = new URL(url, location.href).href;
var method = METHOD_ENUM[type] || 0;
var params = Device.os.pc ? {
url: reqUrl,
req_json: data || '',
scope: ajaxScope,
webcgi_method: method,
webcgi_header: Object.keys(header).map(function (headerItemKey) {
return Device.os.Mac ? _defineProperty({}, headerItemKey, header[headerItemKey]) : {
key: headerItemKey,
value: header[headerItemKey]
};
}),
cgi_type: 1
} : {
reqUrl: reqUrl,
reqBody: data,
scope: ajaxScope,
method: method,
header: header
};
var reqLogItem = networkStartLog({
method: type,
url: url,
postData: obj.data || {},
requestHeader: header,
requestType: 'transfer',
startTime: Date.now(),
responseType: url.indexOf('f=json') > 0 ? 'json' : undefined
});
var isTimeout = false;
handleReqTimeout({
abort: function abort() {
isTimeout = true;
reqLogItem.endTime = Date.now();
reqLogItem.response = 'timeout';
networkEndLog(reqLogItem);
}
});
Device.os.pc && monitor$1.setSum(115849, 69, 1);
JSAPI.invoke(Device.os.pc ? 'H5ExtTransfer' : 'webTransfer', params, function (res) {
var _a, _b, _c, _d, _e, _f;
if (isTimeout) return;
var status = 400;
var result = '';
if (Device.os.pc) {
try {
var retFlag = res.base_resp.ret === 0 && res.jsapi_resp.ret === 0 && res.err_msg.indexOf(':ok') > -1;
var respJsonFlag = res.jsapi_resp.resp_json;
status = retFlag && respJsonFlag ? 200 : 400;
result = res.jsapi_resp.resp_json;
} catch (err) {
console.error(err);
}
} else {
status = res && res.errCode * 1 === 0 && typeof res.result === 'string' && res.result ? 200 : 400;
result = res.result;
}
try {
Log.log("ajax transfer, status: ".concat(status, ", reqUrl: ").concat(reqUrl));
} catch (err) {
console.error(err);
}
if (status >= 200 && status < 400) {
obj.received && obj.received(null);
beforeResp({
status: status
});
handleRespSucc({
status: status,
responseText: result
}, 10);
reqLogItem.status = status;
reqLogItem.endTime = Date.now();
reqLogItem.response = result;
handleRespComplete();
networkEndLog(reqLogItem);
} else if (window.__second_open__) {
JSAPI.invoke('request', {
url: reqUrl,
method: type,
data: data,
header: header
}, function (retryRes) {
try {
Log.log("ajax retry request, retryStatus: ".concat((retryRes === null || retryRes === void 0 ? void 0 : retryRes.statusCode) || '', ", reqUrl: ").concat(reqUrl));
} catch (err) {
console.error(err);
}
if (isTimeout) return;
var retryStatus = retryRes.statusCode;
obj.received && obj.received(null);
beforeResp({
status: retryStatus
});
if (retryRes.err_msg.indexOf(':ok') > -1 && retryStatus >= 200 && retryStatus < 400) {
handleRespSucc({
status: retryStatus,
responseText: retryRes.data
}, 20);
} else {
retryXhrFn(res, isTimeout, reqLogItem);
handleRespErr({
status: retryStatus
}, res, 20);
window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure_sec_open', JSON.stringify({
retryReqJsapiRes: retryRes,
transferRes: res,
url: reqUrl
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
}
reqLogItem.status = retryStatus;
reqLogItem.endTime = Date.now();
reqLogItem.response = retryRes.data;
handleRespComplete();
networkEndLog(reqLogItem);
});
} else {
retryXhrFn(res, isTimeout, reqLogItem);
}
if (Device.os.pc) {
if (!res.err_msg.includes(':ok')) {
(_b = (_a = window.WX_BJ_REPORT) === null || _a === void 0 ? void 0 : _a.BadJs) === null || _b === void 0 ? void 0 : _b.report("pc transfer res no ok: ".concat(res.err_msg), params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
try {
if (res.jsapi_resp.resp_json && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 0 && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 190001 || res.base_resp.ret !== 0 || res.jsapi_resp.ret !== 0) {
(_d = (_c = window.WX_BJ_REPORT) === null || _c === void 0 ? void 0 : _c.BadJs) === null || _d === void 0 ? void 0 : _d.report("pc transfer res invalid ret", params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
} catch (err) {}
} else {
try {
if (res.errCode !== 0) {
(_f = (_e = window.WX_BJ_REPORT) === null || _e === void 0 ? void 0 : _e.BadJs) === null || _f === void 0 ? void 0 : _f.report("mobile transfer res invalid ret", params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
} catch (err) {}
}
});
beforeReq();
return;
}
var xhr = new XMLHttpRequest();
var mayAbort = !!obj.mayAbort;
var async = typeof obj.async === 'undefined' ? true : obj.async;
var _onreadystatechange = xhr.onreadystatechange;
xhr.open(type, url, async);
xhr.onreadystatechange = function () {
if (typeof _onreadystatechange === 'function') {
_onreadystatechange.apply(xhr);
}
if (xhr.readyState === 3) {
obj.received && obj.received(xhr);
}
if (xhr.readyState === 4) {
beforeResp(xhr);
xhr.onreadystatechange = null;
var status = xhr.status;
if (status >= 200 && status < 400) {
handleRespSucc(xhr, 1);
} else {
handleRespErr(xhr, 'status error', 1);
if (!!status || !mayAbort) {
var __ajaxtest = window.__ajaxtest || '0';
__moon_report({
offset: MOON_AJAX_NETWORK_OFFSET,
log: "ajax_network_error[".concat(status, "][").concat(__ajaxtest, "]: ").concat(url, ";host:").concat(location.host),
e: ''
});
}
}
handleRespComplete();
}
};
setXhrHeader(xhr, type, obj);
handleReqTimeout(xhr);
try {
xhr.send(data);
try {
if (url && url.length > LENGTH_LIMIT) {
reportAjaxLength(27613, 17, "ajax get limit[length: ".concat(url.length, "]").concat(url.substring(0, 1024)));
}
if (data && !(data instanceof Blob) && data.length > LENGTH_LIMIT) {
reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.length, "]").concat(data.substring(0, 1024)));
}
if (data && data instanceof Blob && data.size > LENGTH_LIMIT) {
reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.size, "]blob"));
}
} catch (e) {
}
} catch (e) {
obj.error && obj.error(xhr, {
type: 3,
error: e,
status: 0
});
}
beforeReq();
});
}
mmVersion.isWindowsWechat && mmVersion.compareHexVersion('0xf2550000') || mmVersion.isMacWechat && mmVersion.compareHexVersion('0xf2650000');
var getBrandServiceType = function getBrandServiceType() {
var serviceType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.service_type;
var _a, _b;
var brandServiceType = 0;
if (serviceType !== undefined) brandServiceType = serviceType + 1;
if (((_b = (_a = window.cgiData) === null || _a === void 0 ? void 0 : _a.trans_appmsg_info) === null || _b === void 0 ? void 0 : _b.trans_type) * 1 === 1) brandServiceType = 3;
return brandServiceType;
};
function setCurrentMpInfo(ifShow) {
var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true) || mmVersion.isAndroid && mmVersion.gtVersion('7.0.12', true);
var supportLiveStatus = mmVersion.isIOS && mmVersion.gtVersion('8.0.46', true) || mmVersion.isAndroid && mmVersion.gtVersion('8.0.46', true);
JSAPI.invoke('currentMpInfo', {
userName: window.user_name,
brandName: !!supportNewTopBar && window.nickname === '' ? '未命名账号' : window.title,
title: window.msg_title || '',
brandIcon: window.hd_head_img.replace(/\/0$/, '/132'),
itemShowType: window.item_show_type,
isPaySubscribe: window.isPaySubscribe,
topBarStyle: supportNewTopBar ? 1 : 0,
topBarShowed: ifShow,
disableShowFinderLiveTopBar: !ifShow && supportLiveStatus ? 1 : 0,
brandServiceType: getBrandServiceType()
}, function () {});
}
function AjaxWx(obj) {
var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {};
obj.url += obj.url.indexOf('?') === -1 ? '?fasttmplajax=1' : '&fasttmplajax=1';
if (getAjaxScope(obj.url)) {
Ajax(obj);
return;
}
if (obj.usePb) {
obj.type = 'POST';
obj.data = {
data: JSON.stringify(obj.data)
};
}
if (!/^(http:\/\/|https:\/\/|\/\/)/.test(obj.url)) {
obj.url = "https://mp.weixin.qq.com/".concat(obj.url.replace(/^\//, ''));
} else if (/^\/\//.test(obj.url)) {
obj.url = "https:".concat(obj.url);
}
if (obj.f !== 'html' && (obj.url.indexOf('?f=json') === -1 || obj.url.indexOf('&f=json') === -1)) {
obj.url += '&f=json';
}
if (!obj.notJoinUrl && obj.f !== 'html') {
obj.url = Url.joinUrl(obj.url);
}
Url.joinUserArticleRole(obj.url, !!obj.notJoinUrl, function (url) {
obj.url = url;
var urlObj = new URL(url, location.origin);
var data = null;
if (_typeof(obj.data) === 'object') {
var d = obj.data;
var ds = [];
for (var k in d) {
if (d.hasOwnProperty(k)) {
ds.push("".concat(k, "=").concat(encodeURIComponent(d[k])));
}
}
data = ds.join('&');
} else {
data = typeof obj.data === 'string' ? obj.data : null;
}
var header = {
Cookie: document.cookie,
referer: location.href
};
if (obj.contentType) {
header['Content-Type'] = obj.contentType;
} else if ((obj.type || 'GET').toUpperCase() === 'POST') {
header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
var reqLogItem = networkStartLog({
method: obj.type || 'GET',
url: obj.url,
postData: obj.data || {},
requestHeader: header,
requestType: 'jsapi',
startTime: Date.now()
});
var retryTime = 1;
var jsapiRequest = function jsapiRequest(obj, data) {
return JSAPI.invoke('request', {
url: obj.url,
method: obj.type,
data: data,
header: header
}, function (res) {
var _a, _b, _c, _d, _e, _f;
if (res.err_msg.indexOf(':ok') > -1 && (!res.statusCode || res.statusCode >= 200 && res.statusCode < 400)) {
if (reqType(obj, '/mp/getappmsgext')) {
window.receiveGetAppmsgExt = "".concat(res.statusCode, "|").concat(Date.now());
}
if (reqType(obj, '/mp/getappmsgad')) {
window.receiveGetAppmsgAd = "".concat(res.statusCode, "|").concat(Date.now());
}
if (retryTime === 1) {
obj.received && obj.received(null);
}
var resData = {};
if (res.data) {
try {
if (obj.dataType === 'json') {
resData = JSON.parse(res.data);
} else {
resData = res.data;
}
if (resData && resData.base_resp && ((_a = resData.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) {
var reportUrl = obj.url;
if (obj.url.indexOf('?') !== -1) {
reportUrl = obj.url.substring(0, obj.url.indexOf('?'));
if (Url.getQuery('action', obj.url)) {
reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', obj.url));
}
}
if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resData.base_resp.ret === 'undefined')) {
window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resData.base_resp.ret), {
mid: window.PAGE_MID,
view: 'wap_retcode'
});
}
}
} catch (e) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: ((_b = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _b === void 0 ? void 0 : _b.ret) || 0
});
}
console.error(e);
obj.error && obj.error(null, {
type: 1,
error: e,
status: res.statusCode
});
obj.complete && obj.complete();
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
return;
}
}
var tmpResData = {};
try {
tmpResData = JSON.parse(res.data);
} catch (e) {}
if (tmpResData && tmpResData.base_resp && tmpResData.base_resp.ret === -3 && retryTime < 2 && (mmVersion.isIOS || mmVersion.isAndroid && mmVersion.getInner() > '27000600')) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: ((_c = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0
});
}
var _retryTime = retryTime++;
JSAPI.invoke('updatePageAuth', {}, function (res) {
console.log('[skeleton] updatePageAuth', res);
monitor$1.setSum(112287, 3, 1);
if (res && res.err_msg && res.err_msg.indexOf(':ok') > -1) {
window.top.pass_ticket = encodeURIComponent(Url.getQuery('pass_ticket', res.fullUrl).html(false).replace(/\s/g, '+'));
if (obj.pass_ticket) {
obj.pass_ticket = window.top.pass_ticket;
}
console.warn('[skeleton] updatePageAuth resetTopbar');
var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true);
var showBottomBar = !!window.is_login;
if (window.top.item_show_type === '0' && supportNewTopBar) {
var top = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0;
setCurrentMpInfo(top > 40 && !showBottomBar);
}
try {
obj.url = Url.addParam(obj.url, 'retry', _retryTime, true);
} catch (err) {
console.error(err);
}
jsapiRequest(obj, data);
monitor$1.setSum(112287, 4, 1);
} else {
obj.success && obj.success(resData);
obj.complete && obj.complete();
if (mmVersion.isIOS) {
monitor$1.setSum(112287, 35, 1);
} else {
monitor$1.setSum(112287, 36, 1);
}
reqLogItem.status = 200;
reqLogItem.endTime = Date.now();
reqLogItem.response = resData;
networkEndLog(reqLogItem);
}
});
} else {
if (((_d = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _d === void 0 ? void 0 : _d.ret) !== 0) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 4,
HttpCode: res.statusCode || 0,
Ret: ((_e = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _e === void 0 ? void 0 : _e.ret) || 0
});
}
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 0,
HttpCode: res.statusCode || 0,
Ret: ((_f = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _f === void 0 ? void 0 : _f.ret) || 0
});
}
}
obj.success && obj.success(resData);
obj.complete && obj.complete();
reqLogItem.status = 200;
reqLogItem.endTime = Date.now();
reqLogItem.response = resData;
networkEndLog(reqLogItem);
}
} else if (res.err_msg.indexOf('no permission') > -1 || !mmVersion.isOnlyWechat) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: 0
});
}
Ajax(obj);
if (res.err_msg.indexOf('no permission') > -1) {
console.warn('[JSAPI Request] No permission');
monitor$1.setSum(112287, 31, 1);
}
reqLogItem.status = 302;
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 2,
HttpCode: res.statusCode || 0,
Ret: 0
});
}
obj.error && obj.error(null, {
type: 3,
error: res,
status: 0
});
obj.complete && obj.complete();
monitor$1.setSum(112287, 32, 1);
var sample = 0.001;
if (Math.random() < sample) {
var msg = "request: ".concat(JSON.stringify(obj.type), " ").concat(JSON.stringify(obj.url), " ;;;; cookie: ").concat(JSON.stringify(document.cookie), " ;;;; data: ").concat(JSON.stringify(data), " ;;;; resp: ").concat(JSON.stringify(res));
if (window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) {
window.WX_BJ_REPORT.BadJs.report('ajax_wx_request_error', msg, {
mid: 'mmbizwap:Monitor'
});
}
}
reqLogItem.status = 400;
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
}
});
};
if (reqType(obj, '/mp/getappmsgext')) {
window.startGetAppmsgExtTime = Date.now();
}
if (reqType(obj, '/mp/getappmsgad')) {
window.startGetAppmsgAdTime = Date.now();
}
jsapiRequest(obj, data);
});
}
function _regeneratorRuntime() { _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var AjaxRouter = function () {
var _ref = _asyncToGenerator( _regeneratorRuntime().mark(function _callee(obj) {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!window.__secPageAuthPromise) {
_context.next = 3;
break;
}
_context.next = 3;
return window.__secPageAuthPromise;
case 3:
if (!(!mmVersion.isWxWork && (window.__second_open__ || !getIsAcrossOrigin() && top.window.__second_open__) && window.__is_page_auth_return__ && !obj.pureHttp)) {
_context.next = 5;
break;
}
return _context.abrupt("return", AjaxWx(obj));
case 5:
return _context.abrupt("return", Ajax(obj));
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return function AjaxRouter(_x) {
return _ref.apply(this, arguments);
};
}();
var isx5 = navigator.userAgent.indexOf('TBS/') !== -1;
var getDataFunc = [];
var reportData = [];
var specificData = {};
function joinUrl(url) {
var obj = {};
if (typeof window.uin !== 'undefined') {
obj.uin = window.uin;
}
if (typeof window.key !== 'undefined') {
obj.key = window.key;
}
if (typeof window.pass_ticket !== 'undefined') {
obj.pass_ticket = window.pass_ticket;
}
if (typeof window.wxtoken !== 'undefined') {
obj.wxtoken = window.wxtoken;
}
if (typeof window.devicetype !== 'undefined') {
obj.devicetype = window.devicetype;
}
if (typeof window.clientversion !== 'undefined') {
obj.clientversion = window.clientversion;
}
if (typeof window.appmsg_token !== 'undefined') {
obj.appmsg_token = window.appmsg_token;
} else if (url.indexOf('advertisement_report') > -1) {
new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random());
}
obj.x5 = isx5 ? '1' : '0';
obj.f = 'json';
return Url.join(url, obj);
}
function isObj(obj) {
return obj && _typeof(obj) === 'object';
}
function assign(target, source) {
if (isObj(target) && isObj(source)) {
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
function assembleReportData(initiative) {
var leaveReportLog = [];
leaveReportLog.push({
content: "[LeaveReport] specificData keys: ".concat(Object.keys(specificData)),
timestamp: Date.now()
});
Log.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData)));
console.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData)));
var allReportData = {};
for (var reportField in specificData) {
if (!allReportData[reportField]) {
allReportData[reportField] = {};
}
for (var i = 0; i < specificData[reportField].length; i++) {
var param = specificData[reportField][i];
if (typeof param === 'function') {
try {
assign(allReportData[reportField], param(initiative));
} catch (err) {
leaveReportLog.push({
content: "[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)),
timestamp: Date.now()
});
Log.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)));
console.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)));
}
} else if (isObj(param)) {
assign(allReportData[reportField], param);
}
}
}
leaveReportLog.push({
content: "[LeaveReport] reportData.length: ".concat(reportData.length),
timestamp: Date.now()
});
Log.log("[LeaveReport] reportData.length: ".concat(reportData.length));
console.log("[LeaveReport] reportData.length: ".concat(reportData.length));
leaveReportLog.push({
content: "[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length),
timestamp: Date.now()
});
Log.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length));
console.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length));
for (var _i = 0; _i < getDataFunc.length; _i++) {
try {
var data = getDataFunc[_i](initiative);
if (isObj(data)) {
reportData.push(data);
}
} catch (err) {
leaveReportLog.push({
content: "[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)),
timestamp: Date.now()
});
Log.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)));
console.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)));
}
}
for (var _i2 = 0; _i2 < reportData.length; _i2++) {
if (reportData[_i2].reportUrl) {
reportData[_i2].reportUrl = joinUrl(reportData[_i2].reportUrl);
}
}
allReportData.data = {
'requestList': reportData
};
leaveReportLog.push({
content: "[LeaveReport] final reportData.length: ".concat(reportData.length, ", data=").concat(JSON.stringify(reportData)),
timestamp: Date.now()
});
Log.log("[LeaveReport] final reportData.length: ".concat(reportData.length));
console.log("[LeaveReport] final reportData.length: ".concat(reportData.length));
allReportData.info = leaveReportLog;
return allReportData;
}
function addReport(param) {
if (typeof param === 'function') {
getDataFunc.push(param);
} else if (isObj(param)) {
reportData.push(param);
}
}
function addSpecificReport(reportField, param) {
if (!specificData[reportField]) {
specificData[reportField] = [];
}
specificData[reportField].push(param);
}
function reportNow(callback) {
var allReportData = assembleReportData(true);
JSAPI.invoke('handleMPPageAction', {
action: 'reportByLeaveForMPGateway',
reportData: allReportData
}, function (res) {
if (res && res.err_msg && res.err_msg.indexOf(':ok') !== -1) {
getDataFunc = [];
reportData = [];
specificData = {};
typeof callback === 'function' && callback(res);
} else {
getDataFunc = [];
reportData = [];
var len = allReportData.data.requestList.length;
allReportData.data.requestList.forEach(function (req) {
if (req.reportUrl) {
AjaxRouter({
type: req.method || 'GET',
url: req.reportUrl,
data: req.reportData,
async: false,
success: function success(resp) {
if (--len < 0) {
typeof callback === 'function' && callback({
err_msg: 'handleMPPageAction:ok',
fallback: true,
resp: resp
});
}
},
error: function error(xhr, err) {
if (--len < 0) {
typeof callback === 'function' && callback({
err_msg: 'handleMPPageAction:fail',
fallback: true,
err: err
});
}
}
});
}
});
}
});
}
var leaveReport = {
reportNow: reportNow,
addReport: addReport,
addSpecificReport: addSpecificReport
};
var _leaveReport = (function () {
var doc = {};
var isCrossOrigin = false;
try {
doc = top.window.document;
} catch (e) {
isCrossOrigin = true;
}
if (!isCrossOrigin && top.window.__leaveReport) {
return top.window.__leaveReport;
}
if (window.__leaveReport) {
return window.__leaveReport;
}
JSAPI.on('reportOnLeaveForMP', function () {
return assembleReportData(false);
});
return window.__leaveReport = leaveReport;
})();
var getReportJson = function getReportJson(logId, rawData) {
var data = JSON.parse(JSON.stringify(rawData));
data.log_id = Number(logId);
data.TimeStamp = Math.round(Date.now() / 1000);
console.log('[comm_report] reportjson: ', data);
return JSON.stringify(data);
};
var getSuccessHandler = function getSuccessHandler(logId, data, opt) {
return function (res) {
if (res && res.err_code !== 0) {
console.warn("[comm_report] report ".concat(logId, " fail: "), res.err_msg, data);
}
if (typeof opt.success === 'function') {
opt.success(res);
}
};
};
var getErrorHandler = function getErrorHandler(logId, data, opt) {
return function (xhr, info) {
console.error("[comm_report] report ".concat(logId, " error: "), info, data);
if (typeof opt.error === 'function') {
opt.error(xhr, info);
}
};
};
var batchReportDataArr = [];
var blackLogId = [25587, 18832, 28208, 25574, 29139, 10945];
var BATCH_SIZE = 4;
var BATCH_TIME = 1000;
var getRepeatedReportJson = function getRepeatedReportJson() {
if (!batchReportDataArr || !batchReportDataArr.length) return false;
var reportData = {
count: 0
};
reportData.count = batchReportDataArr.length;
batchReportDataArr.forEach(function (data, index) {
reportData["reportjson".concat(index)] = data;
});
batchReportDataArr = [];
console.log('[reportData]: ', reportData);
return reportData;
};
var timeOutId;
function batchReport() {
if (!batchReportDataArr || !batchReportDataArr.length) return;
var repeatedReportJson = getRepeatedReportJson();
if (!repeatedReportJson) return;
AjaxRouter({
type: 'POST',
dataType: 'json',
url: '/mp/wapcommreport?action=batch_report',
data: repeatedReportJson,
dontReport: true,
success: function success(res) {
if (res && res.err_code) {
console.warn("[comm_report] batch report fail: ", res.err_msg, batchReportDataArr);
}
},
error: function error(xhr, info) {
console.error("[comm_report] batch report error: ", info, batchReportDataArr);
}
});
}
function batchReportThrottle(logId, rawData) {
var reportJsonData = getReportJson(logId, rawData);
if (!reportJsonData) return;
batchReportDataArr.push(reportJsonData);
if (batchReportDataArr.length >= BATCH_SIZE) {
batchReport();
} else {
if (!timeOutId) {
timeOutId = setTimeout(function () {
batchReport();
clearTimeout(timeOutId);
timeOutId = null;
}, BATCH_TIME);
}
}
}
_leaveReport.addReport(function () {
var repeatedReportJson = getRepeatedReportJson();
if (!repeatedReportJson) return false;
var reportData = [];
for (var _i = 0, _Object$entries = Object.entries(repeatedReportJson); _i < _Object$entries.length; _i++) {
var _Object_i = _slicedToArray(_Object$entries[_i], 2),
key = _Object_i[0],
value = _Object_i[1];
reportData.push("".concat(key, "=").concat(encodeURIComponent(value)));
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport?action=batch_report',
reportData: reportData.join('&'),
method: 'POST'
};
});
var commReport = {
report: function report(logId, rawData, rawOpt) {
var opt = rawOpt || {};
if (!opt.realTime && !blackLogId.includes(logId)) {
batchReportThrottle(logId, rawData);
} else {
AjaxRouter({
type: 'POST',
dataType: 'json',
url: '/mp/wapcommreport',
data: {
reportjson: getReportJson(logId, rawData)
},
async: opt.async,
success: getSuccessHandler(logId, rawData, opt),
error: getErrorHandler(logId, rawData, opt)
});
}
},
leaveReport: function leaveReport(logId, rawData) {
_leaveReport.addReport(function () {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport',
reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))),
method: 'POST'
};
});
},
reportByBeacon: function reportByBeacon(logId, rawData) {
try {
if (!Device.os.android && !Device.os.ios && !Device.os.harmony) {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
var url = '/mp/wapcommreport';
var reportJsonData = encodeURIComponent(getReportJson(logId, data));
console.log("reportByBeacon", JSON.stringify(reportJsonData));
navigator.sendBeacon(Url.joinUrl(url), "reportjson=".concat(reportJsonData));
} else {
_leaveReport.addReport(function () {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport',
reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))),
method: 'POST'
};
});
}
} catch (error) {
console.log(error);
}
}
};
var html = function html(_str, encode) {
if (!_str) return '';
var replace = ['`', '`', ''', '\'', '"', '"', ' ', ' ', '>', '>', '<', '<', '¥', '¥', '&', '&', '<', '<', '>', '>'];
var replaceReverse = ['&', '&', '¥', '¥', '<', '<', '>', '>', ' ', ' ', '"', '"', '\'', ''', '`', '`'];
var str = _str;
var target;
if (encode) {
target = replaceReverse;
} else {
target = replace;
}
for (var i = 0; i < target.length; i += 2) {
str = str.replace(new RegExp(target[i], 'g'), target[i + 1]);
}
return str;
};
var htmlLite = function htmlLite(_str, encode) {
if (!_str) return '';
var replace = ['`', '`', ''', '\'', '"', '"', '>', '>', '<', '<', '&', '&'];
var replaceReverse = ['&', '&', '<', '<', '>', '>', '"', '"', '\'', ''', '`', '`'];
var str = _str;
var target;
if (encode) {
target = replaceReverse;
} else {
target = replace;
}
for (var i = 0; i < target.length; i += 2) {
str = str.replace(new RegExp(target[i], 'g'), target[i + 1]);
}
return str;
};
var htmlEncode = function htmlEncode(str) {
return html(str, true);
};
var htmlDecode = function htmlDecode(str) {
return html(str, false);
};
var htmlEncodeLite = function htmlEncodeLite(str) {
return htmlLite(str, true);
};
var htmlDecodeLite = function htmlDecodeLite(str) {
return htmlLite(str, false);
};
String.prototype.html = function (encode) {
return html(this.toString(), encode);
};
String.prototype.htmlEncode = function () {
return htmlEncode(this.toString());
};
String.prototype.htmlDecode = function () {
return htmlDecode(this.toString());
};
String.prototype.htmlLite = function (encode) {
return htmlLite(this.toString(), encode);
};
String.prototype.htmlEncodeLite = function () {
return htmlEncodeLite(this.toString());
};
String.prototype.htmlDecodeLite = function () {
return htmlDecodeLite(this.toString());
};
var isIOS = mmVersion.isIOS,
isAndroid = mmVersion.isAndroid;
var renderDom = function renderDom(dom, cnt, hasStar) {
if (dom) {
if (hasStar) {
dom.innerText = "已星标";
} else {
dom.innerText = "星标";
}
if (hasStar) {
dom.classList.add('rich_media_meta_star');
dom.classList.remove('rich_media_meta_star_cancel');
} else {
dom.classList.add('rich_media_meta_star_cancel');
dom.classList.remove('rich_media_meta_star');
}
dom.style.removeProperty('display');
localStorage.setItem('star_info', JSON.stringify({
mid: window.mid,
idx: window.idx,
has_star: !!hasStar
}));
}
};
var __setStar = function __setStar(dom, cnt, statStatus) {
var hasReportExpose = false;
var hasStar = statStatus;
var realCnt = cnt;
function addStar() {
var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
hasStar = 1;
realCnt = realCnt + 1;
renderDom(dom, realCnt, hasStar);
if (dispatchEvent) window.dispatchEvent(new CustomEvent('star'));
}
function cancelStar() {
var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
hasStar = 0;
realCnt = realCnt - 1;
renderDom(dom, realCnt, hasStar);
if (dispatchEvent) window.dispatchEvent(new CustomEvent('cancel-star'));
}
if (dom) {
renderDom(dom, cnt, statStatus);
var clickHander = function clickHander() {
if (hasStar === 0) {
JSAPI.invoke('operateStar', {
opType: 'addStar'
}, function (res) {
if (res.err_msg && /:ok$/.test(res.err_msg)) addStar();
});
} else {
JSAPI.invoke('operateStar', {
opType: 'cancelStar'
}, function (res) {
if (res.err_msg && /:ok$/.test(res.err_msg)) cancelStar();
});
}
var data = {
BizUin: window.biz,
AppMsgID: window.mid * 1,
ItemIndex: window.idx * 1,
Scene: window.scene,
SubScene: window.subscene * 1,
EnterId: window.enterid,
SessionId: "".concat(window.sessionid),
Event: hasStar ? 8 : 7,
ItemShowType: window.item_show_type * 1
};
commReport.report(17335, data);
};
var exposeHandler = function exposeHandler() {
if (hasReportExpose) return;
var data = {
BizUin: window.biz,
AppMsgID: window.mid * 1,
ItemIndex: window.idx * 1,
Scene: window.scene,
SubScene: window.subscene * 1,
EnterId: window.enterid,
SessionId: "".concat(window.sessionid),
Event: 6,
ItemShowType: window.item_show_type * 1
};
commReport.report(17335, data);
hasReportExpose = true;
};
dom.addEventListener('click', clickHander);
JSAPI.on('onPageStarStateChanged', function (res) {
console.log('onPageStarStateChanged', res);
if (res.state) addStar();else cancelStar();
window.__hasStarInLifecycle = !!hasStar;
});
var intersectionObserver = new IntersectionObserver(exposeHandler);
intersectionObserver.observe(dom);
window.addEventListener('star', function (e) {
if (e && e.detail && e.detail.from === 'frontend') addStar(false);
});
window.addEventListener('cancel-star', function (e) {
if (e && e.detail && e.detail.from === 'frontend') cancelStar(false);
});
document.addEventListener('visibilitychange', function () {
var visible = document.visibilityState === 'visible';
if (!visible) return;
window.__hasStarInLifecycle = !!hasStar;
});
}
};
if (!window.__second_open__) {
var starDom = document.querySelector('#js_star');
var canUseStar = window.canUseStar || isIOS && mmVersion.compareHexVersion('18003623') || isAndroid && mmVersion.compareHexVersion('28003630');
var startPersonCnt = window.star_person_cnt || '';
console.log('canUseStar, startPersonCnt', canUseStar, startPersonCnt);
if (!!(canUseStar * 1)) {
var starSwitch = localStorage.getItem('mp_star_switch');
if (starSwitch === 'true') {
var starInfo = localStorage.getItem('star_info');
var hasStar = 0;
if (starInfo) {
var parseStarInfo = JSON.parse(starInfo);
if (Number(parseStarInfo.mid) === Number(window.mid) && Number(parseStarInfo.idx) === Number(window.idx) && parseStarInfo.has_star) {
hasStar = 1;
}
}
starDom && renderDom(starDom, startPersonCnt * 1, hasStar);
var spanElement = document.getElementById('meta_content_hide_info');
spanElement && spanElement.classList.remove('rich_media_meta_padding');
} else {
starDom && starDom.parentNode.removeChild(starDom);
}
} else {
starDom && starDom.parentNode.removeChild(starDom);
}
window.__setStar = __setStar;
}
exports.__setStar = __setStar;
exports.renderDom = renderDom;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
})({});
天湖园博酒店
💰劲爆预售价:¥699 (¥1388)
园艺尊享大床房 2 晚(连住) + 早餐 2 份/天 + 下午茶 1 份 + 欢迎水果 1 份 + 迷你吧 1 份 + 天湖景区门票1张 4 份 有效期到2026年12月31日离店。全程可约不加价! ![图片]()
这家藏在温州的宝藏酒店很适合短途山野休闲!步行13分钟逛天湖、15分钟闲逛大月湾,自驾5分钟打卡刘伯温故里、6分钟奔赴百丈漈,四周山林环绕,满目青翠清幽。42㎡尊享大床配全景落地玻璃窗,原木简约客房静谧舒服。套餐权益丰厚,午后可以静享精致下午茶,还附赠4张天湖景区入园票,吃住玩乐全包。日历房两晚的价格要1300多,现在套餐价才699,差不多打了对折!关键是端午、暑假、中秋和国庆等热门日期都不加价,快囤~
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥699园艺高级双床房 2 晚(连住) + 早餐 2 份/天
成都尧棠公馆-全球奢华精品酒店
💰劲爆预售价:¥1588起 (¥2288)
棠厢大床房 2 晚(可拆分) + 早餐 2 份/天 + 迷你吧 1 份/天 + 旅拍礼包拍摄含3张精修照片及万昌洋服号服装试穿拍摄(未使用不可折现) 1 份/天 有效期到2026年12月31日离店。端午、暑假、中秋不加价!10.1-10.4加价200元/间/晚。 ![图片]()
这家尧棠公馆可不一般,是成都第一家SLH酒店,以巴金《家》中李家公馆为灵感,将民国式复古腔调拿捏到位,巴金先生的文学元素也随处可见,又融入了老成都鸟笼、麻将等传统韵味;强烈安利玻璃顶的天井和旋转楼梯,真是谁拍谁好看!酒店位置很好,7分钟逛锦城湖、14分钟直达铁像寺水街。房间有落地窗、宝格丽的洗漱用品!套餐同款房型平时两晚要2200+,现在1588就能入住,还送超值双人旅拍礼包,不用额外花钱就能拍复古写真,太划算了!点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1588起棠厢双床房 2 晚(可拆分) + 早餐 2 份/天
来成都玩也可以看看这家——成都锦城原舍酒店(锦里武侯祠店)!酒店就在锦里武侯祠文旅核心区,整体禅茶新中式装修,满满三国文化氛围感。出门步行3分钟即达高升桥地铁站,11分钟漫步至武侯祠、15分钟闲逛锦里古街,紧邻罗马假日广场。住在古街旁既能沉浸式打卡三国人文古迹,出门就能吃透成都地道烟火美食。平时日历房两晚要800多,现在499就能住,便宜了300多!可约日期都不加价哦~
还有其他好价套餐可选:
价格¥499雅居大床房(小度音箱+记忆枕+小冰箱) 2 晚(可拆分)
上海临港锦江国际酒店
💰劲爆预售价:¥1388 (¥2186)
城景豪华双床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份 有效期到2026年09月30日离店。端午、暑假、中秋热门日期不加价! ![图片]()
酒店坐落在滴水湖畔,步行2分钟抵达临港中心、4分钟直达临港演艺中心,顺路就可以打卡中国航海博物馆、滴水湖公园。高层客房在窗边就能欣赏限定烟花与无人机大秀,酒店自带全套亲子游乐设施,遛娃观景一举两得。日历房含早两晚要1800+,现在1388即可连住两晚,差不多打了七七折!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1388城景豪华大床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份
苏州湾华邑温泉度假酒店
💰劲爆预售价:¥1299起 (¥1899)
高级大床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份 有效期到2026年09月30日离店。全程可约,七夕不加价,端午、中秋+200元/间/晚。 ![图片]()
洲际酒店集团旗下,软硬件没得挑,设计又带着点中式古典感,置身于吴江东太湖生态旅游度假区中,周边绿地湖水围绕,又有王焰温泉这样的大咖加持,不管是宅酒店还是出去玩,都很ok!套餐价算下来一晚650,还送温泉票,比日历价便宜300多! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1299起高级双床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份
杭州大运河马可波罗豪廷酒店
💰劲爆预售价:¥599 (¥1399)
城景双床房(金可儿床垫+全屋智能+智能马桶) 2 晚(连住) + 早餐 2 份/天 + 【豪廷食街双人中式套餐】 1 份 + 双人免费西湖往返班车(双店行李寄存) 1 份 + 免费升级豪庭双床房(视房量房态) 1 份 + 现磨咖啡 2 份 + 房间欢迎饮料2瓶 1 份 有效期到2026年12月30日离店,全程可约不加价! ![图片]()
酒店在拱墅区,附近有中大银泰城、万融城、万达广场等商场,距离拱宸桥、京杭大运河博物馆、小河直街历史文化街区等景点不远。现在买套餐还送西湖往返班车,而且优惠价599两晚比平常单晚400+便宜了不少! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥599豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)价格¥999行政套房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住) 价格¥699豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)
杭州湘湖保亿开元名都度假酒店
有效期到2026年09月29日离店,全程可约,端午、中秋不加价! 来杭州玩还可以看看这家,很适合亲子游!酒店靠近湘湖,去森泊也方便,一脚油门也就几分钟,而且套餐价里连门票都包了!内部环境设计感拉满,水镜连廊与天光倒影,随手出片!配套也很齐全、健身房、游泳馆应有尽有。套餐同款暑期要800/晚,套餐价便宜了200,很划算! 还有其他好价套餐可选:
价格¥599豪华大床房 1 晚 价格¥698豪华双床房 2 晚(可拆分)
隐居天目湖WEI酒店
💰劲爆预售价:¥1299起 (¥4599)
隐谧•雅韵双床房【隐居山湖】 2 晚(连住) + 早餐 2 份/天 + 每日MINI吧 1 份 + 鱼头套餐9折券 1 份 + 隐湖寻幽特调双人下午茶 1 份 + 每日传统文化活动体验 + 多媒体放映室观影 + 单车林间骑行和报恩禅寺游览 + 旅拍体验(赠3张精选电子版照片)+ 周日-周四视房量房态免费升级至高级房型 有效期到2026年10月01日离店,全程可约,热门日期加价见详情。 ![图片]()
酒店太会选址了,正对着天目湖!从13米挑高的大堂望出去,无边泳池衔接着浩渺的湖水,那视野简直惊艳!设计偏中式简约风,青瓦白墙,绿树木椅,品上一杯茶,灵魂都要飘香气了。酒店有专属的湖心亭,园内还设了一座露天影院,躺在星空下看一场电影,太惬意!平常一晚就要1300+,套餐价直接5折还送超多礼遇! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1299起隐谧•雅韵大床房【雅致书香+分离式淋浴间】 2 晚(连住)
苏州东太湖皇冠假日酒店
💰劲爆预售价:¥999起 (¥1699)
高级房 超大床 2 晚(连住) 有效期到2026年08月31日离店。全程可约,周末不加价,端午+100元/间/晚。 ![图片]()
这家坐拥太湖新城核心商务区与商圈,而且紧邻苏州湾东地铁站,可直达苏州古城区及高铁苏州站。房间设计简约高级,将吴风雅韵与现代美学结合得很好!更不用说1.8米大床,房间足足50平,视野也很开阔。同款房型暑假要卖到700多,套餐价999两晚,省下来快500块! 点击下图,火速购买 👇👇👇 ![]()
南京南部新城丽笙酒店
💰劲爆预售价:¥1188起 (¥1698)
豪华双床房-全景落地窗带浴缸 2 晚(连住) + Kuksa下午茶 1 份 + 早餐 2 份/天 + 儿童自助早餐 1 份/天 + 迷你吧 1 份 + 欢迎水果 1 份 + 升级至甄选房(视房量房态) 1 份 + 提前至10:00入住(视房量房态) 1 份 + 延迟退房至14:00(视房量房态) 1 份 有效期到2026年09月01日离店。每周五、周六加价100元/间/晚。 ![图片]()
坐拥南部新城核心区位,临近大校场地铁站,距南京南站仅15分钟车程。紧邻京东MALL,雨花台,老门东历史街区等景点。客房以大校场百年航空文化为设计灵感,流畅线条交织怀旧质感与摩登氛围,空间感极强。日历房价格为600多一晚,套餐价为1100多,省下一顿午餐钱!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥618起豪华双床房-全景落地窗带浴缸 1 晚
宁波半山伴水渡假村
💰劲爆预售价:¥199起 (¥458)
清泉岗木屋双床房 1 晚 + 早餐 2 份/天 + 户外双人泳池门票(7月-9月) 1 份 + 2张中坡山森林公园门票 1 份 + 2张观顶湖门票 1 份 有效期到2026年09月24日离店。端午、每周六加价100元/间/晚。 ![图片]()
这个度假村藏于山林之间,距溪口站驾车约30分钟,出行便捷。酒店主打亲子度假,设有季节性开放的无边泳池、大型户外儿童乐园,配套棋牌室和各种拓展设施。酒店还配有八大项主题设施、100余项游乐项目还有德国原版引进的水晶塔!客房有一些是采用特色窑洞设计,还可携带宠物入住。平日日历房价格为400多1晚,套餐价格相当于4.3折,真的很划算!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥299起清泉岗木屋双床房 1 晚 + 早餐 2 份/天
北海香格里拉大酒店
💰劲爆预售价:¥1199 (¥1588)
高级城景双床房-静览珠城繁华烟火 2 晚(连住) + 咖啡苑双人自助早餐 1 份/天 + 参观南珠博物馆(提供讲解服务) 1 份 + 亲子体验活动 1 份 + 提升至高级海景房(视房量房态而定,节假日不适用) 1 份 + 周六日银滩/客运港/侨港接送服务(固定时间) 1 份 + 精美旅拍(壮族服饰体验,赠3张照片) 1 份 有效期到2026年09月30日离店。端午可约,全程不加价! ![]()
酒店紧邻金滩,步行9分钟可达,距北海站驾车约19分钟,出行便捷。自带沙滩泳池与儿童乐园,入住可免费体验赶海活动,还能打卡海上日落栈道。平日日历房价格为600多1晚,现在2晚可立省一顿早餐!附送很多活动体验,还可根据房态情况免费升级房型!
点击下图,火速购买 👇👇👇 ![]()
北京首都宾馆
💰劲爆预售价:¥599起 (¥704)
B座标准遮窗客房 1 晚 + 延迟退房至14:00(视房量房态) 1 份 有效期到2026年08月31日离店。7月1日起,加价179元/间/晚。 ![图片]()
地处前门核心地段,步行7分钟可达前门大街,10分钟至崇文门地铁站、崇文门地铁站,前往天安门广场很便捷。酒店内部自带五千平中式园林,还可体验汉服换装及古风拍摄。直线距离不到1公里可达新世纪百货,购物吃喝都很方便。日历房价格800多1晚,现在不到600元,套餐省了200+,性价比拉满了~
点击下图,火速购买 👇👇👇 ![]()
中旅阿那亚九龙湖·公主酒店
💰劲爆预售价:¥599起 (¥1198)
公主大床房 1 晚 + 双早 1 份/天 + 美茵家庭中式套餐 1 份 + 畅游中旅阿那亚中心小镇/九龙湖生态公园 1 份 + 草坪畅玩飞盘 1 份 + 醉美夕阳·山湖日落和园区接驳车定时接送 1 份 有效期到2026年07月21日离店。每周五加价100元/间/晚,每周六加价200元/间/晚。 ![图片]()
坐落于九龙湖生态区,临近广州白云机场,自驾出行便捷。酒店以欧式典雅建筑和复古小镇群落为主体,呈现欧式浪漫风情,提供专属管家服务,配套季节性开放的室外景观泳池、室内恒温泳池、美茵餐厅和大堂吧,并设有大型儿童乐园和多种休闲项目。平日日历房价格为700多1晚,套餐价格便宜了150+!
点击下图,火速购买 👇👇👇 ![]()
![]()
华南温德姆集团通兑2晚可拆分含早588元
超值特价¥588 ¥848
有效期到2026年08月31日离店
华南温德姆20城49店通兑覆盖长沙、张家界、武汉、广州等20座热门城市,49家门店随心任选,高铁中转、山林游玩、都市逛吃多种出行需求一站式适配,跨城出游灵活省心。
= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var doc$1 = {};
var isAcrossOrigin$1 = false;
var notFoundedMPPageAction = [];
var __moon_report$1 = window.__moon_report || function () {};
var MOON_JSAPI_KEY_OFFSET = 8;
try {
doc$1 = top.window.document;
} catch (e) {
isAcrossOrigin$1 = true;
}
if (!window.JSAPIEventCallbackMap) {
window.JSAPIEventCallbackMap = {};
}
function ready(onBridgeReady) {
var bridgeReady = function bridgeReady() {
try {
if (onBridgeReady) {
window.onBridgeReadyTime = window.onBridgeReadyTime || Date.now();
onBridgeReady();
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: 'ready',
e: e
}]);
throw e;
}
window.jsapiReadyTime = Date.now();
};
if (!isAcrossOrigin$1 && (typeof top.window.WeixinJSBridge === 'undefined' || !top.window.WeixinJSBridge.invoke)) {
if (doc$1.addEventListener) {
doc$1.addEventListener('WeixinJSBridgeReady', bridgeReady, false);
} else if (doc$1.attachEvent) {
doc$1.attachEvent('WeixinJSBridgeReady', bridgeReady);
doc$1.attachEvent('onWeixinJSBridgeReady', bridgeReady);
}
} else {
bridgeReady();
}
}
var invokeNotWaitA8key = ['notifyPageInfo', 'updatePageAuth'
];
var checkNotFoundedInvoke = function checkNotFoundedInvoke(methodName, args) {
if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && notFoundedMPPageAction.includes(args === null || args === void 0 ? void 0 : args.action)) {
return true;
}
return false;
};
function invoke$1(_x, _x2, _x3) {
return _invoke.apply(this, arguments);
}
function _invoke() {
_invoke = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee(methodName, args, callback) {
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__ && !invokeNotWaitA8key.includes(methodName))) {
_context.next = 3;
break;
}
_context.next = 3;
return window.__secPageAuthPromise;
case 3:
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object') {
alert('请在微信中打开此链接');
return false;
}
if (checkNotFoundedInvoke(methodName, args)) {
setTimeout(function () {
if (callback) {
callback.apply(window, [{
err_msg: "".concat(methodName, ":fail"),
err_desc: 'action isn\'t supported'
}]);
}
}, 0);
} else {
top.window.WeixinJSBridge.invoke(methodName, args, function () {
try {
for (var _len2 = arguments.length, rets = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
rets[_key2] = arguments[_key2];
}
var ret = rets[0];
var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : '';
if (['handleMPPageAction', 'handleVideoAction', 'handleHaokanAction'].indexOf(methodName) !== -1) {
var action = (args === null || args === void 0 ? void 0 : args.action) || '';
console.info('[system]', "[jsapi] invoke->".concat(methodName, ", action->").concat(action).concat(errMsg));
} else {
console.info('[system]', "[jsapi] invoke->".concat(methodName).concat(errMsg));
}
if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && ((ret === null || ret === void 0 ? void 0 : ret.err_desc) === 'action isn\'t supported' || (ret === null || ret === void 0 ? void 0 : ret.err_msg) === 'handleMPPageAction:fail action is not supported')) {
notFoundedMPPageAction.push(args === null || args === void 0 ? void 0 : args.action);
}
if (callback) {
callback.apply(window, rets);
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "invoke;methodName:".concat(methodName),
e: e
}]);
throw e;
}
});
}
});
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return _invoke.apply(this, arguments);
}
function call(_x4) {
return _call.apply(this, arguments);
}
function _call() {
_call = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee2(methodName) {
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__)) {
_context2.next = 3;
break;
}
_context2.next = 3;
return window.__secPageAuthPromise;
case 3:
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object') {
return false;
}
try {
top.window.WeixinJSBridge.call(methodName);
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "call;methodName:".concat(methodName),
e: e
}]);
throw e;
}
});
case 4:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _call.apply(this, arguments);
}
function on(eventName, callback) {
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object' || !top.window.WeixinJSBridge.on) {
return false;
}
if (!window.JSAPIEventCallbackMap[eventName]) {
window.JSAPIEventCallbackMap[eventName] = [];
}
window.JSAPIEventCallbackMap[eventName].push(callback);
if (window.JSAPIEventCallbackMap[eventName].length > 1) {
return false;
}
top.window.WeixinJSBridge.on(eventName, function () {
try {
for (var _len = arguments.length, rets = new Array(_len), _key = 0; _key < _len; _key++) {
rets[_key] = arguments[_key];
}
var ret = rets[0];
var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : '';
console.info('[system]', "[jsapi] event->".concat(eventName).concat(errMsg));
if (window.JSAPIEventCallbackMap[eventName] && window.JSAPIEventCallbackMap[eventName].length) {
var result;
for (var i = 0; i < window.JSAPIEventCallbackMap[eventName].length; i++) {
result = window.JSAPIEventCallbackMap[eventName][i].apply(window, rets);
}
return result;
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "on;eventName:".concat(eventName),
e: e
}]);
throw e;
}
});
});
}
function remove(eventName, callback) {
ready(function () {
if (!window.JSAPIEventCallbackMap[eventName]) {
return false;
}
var result = false;
for (var i = window.JSAPIEventCallbackMap[eventName].length - 1; i >= 0; i--) {
if (window.JSAPIEventCallbackMap[eventName][i] === callback) {
window.JSAPIEventCallbackMap[eventName].splice(i, 1);
result = true;
}
}
return result;
});
}
var JSAPI = {
ready: ready,
invoke: invoke$1,
call: call,
on: on,
remove: remove
};
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var ua = navigator.userAgent;
var is_ios = /(iPhone|iPad|iPod|iOS)/i.test(ua);
var is_wp = /Windows\sPhone/i.test(ua);
var is_android = /(Android)/i.test(ua);
var is_wechat = /MicroMessenger\/([\d\.]+)/i.test(ua);
var is_mac = /mac\sos/i.test(ua) && !is_ios;
var is_windows = /windows\snt/i.test(ua) && !is_wp;
var is_mpapp = /MPAPP\/([\d\.]+)/i.test(ua);
var is_ipad = /iPad/i.test(ua);
var is_windows_wechat = /WindowsWechat/i.test(ua);
var is_mac_wechat = /MacWechat/i.test(ua) || /wechat.*mac os/i.test(ua);
var is_prefetch = is_wechat && window.WeixinPrefecherJSBridge;
var is_donut_app = /SAAASDK/i.test(ua);
var is_harmony = /OpenHarmony|ArkWeb/i.test(ua);
var is_linux = /Linux\s/i.test(ua);
var xweb_match = ua.match(/XWEB\/([\d.]+)/i);
var xweb_version = xweb_match && xweb_match[1] ? parseInt(xweb_match[1], 10) : 0;
var is_unified_pc_wechat = /UnifiedPC\w+Wechat/i.test(ua);
var is_in_miniProgram = is_android && /miniprogram/.test(ua.toLowerCase()) || window.__wxjs_environment == 'miniprogram';
var is_wx_work = /wxwork/i.test(ua);
function getUrlParams() {
var vars = location.search.substring(1).split('&');
var params = {};
var _iterator = _createForOfIteratorHelper(vars),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var ele = _step.value;
var pair = ele.split('=');
var key = decodeURIComponent(pair[0]);
if (typeof params[key] === 'undefined') {
params[key] = decodeURIComponent(pair[1]);
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return params;
}
function get() {
var reg = /MicroMessenger\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMac() {
var reg = /MacWechat\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMacOS() {
var reg = /Mac OS X ([\d_]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1].replace(/_/g, '.');
}
return false;
}
function getWindows() {
var reg = /WindowsWechat\(0x(.+?)\)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getWxWork() {
var reg = /wxwork\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMpApp() {
var appVersion = [2, 4, 5];
var match = navigator.userAgent.match(/MPAPP\/(\d+(\.\d+)*)/);
if (match) {
appVersion = match[1].split('.').map(function (v) {
return Number(v);
});
}
return appVersion.join('.');
}
function getUnifiedPcVer() {
var versionInfo = navigator.userAgent.match(/UnifiedPC\w+Wechat\(0xf\w{2}(\w+?)\w{2}\)/);
if (versionInfo && versionInfo.length === 2) {
var version = versionInfo[1];
var mainVersion = getVersionNumber(version.slice(0, 1));
var subVersion = getVersionNumber(version.slice(1, 2));
var subVersion2 = getVersionNumber(version.slice(2, 3));
return [mainVersion, subVersion, subVersion2].join('.');
}
}
function getVersionNumber(hexStr) {
return Number(Number("0x".concat(hexStr)).toString(10));
}
function getWindowsVersionFormat() {
var versionInfo = navigator.userAgent.match(/WindowsWechat\(0x(\w+?)\)/);
if (versionInfo && versionInfo.length === 2) {
var version = versionInfo[1];
var mainVersion = getVersionNumber(version.slice(1, 2));
var subVersion = getVersionNumber(version.slice(2, 4));
var subVersion2 = getVersionNumber(version.slice(4, 6));
return [mainVersion, subVersion, subVersion2].join('.');
}
return false;
}
function getInner() {
var reg = /MicroMessenger\/[\d\.]+\(0x(.+?)\)/i;
var ret = ua.match(reg);
if (ret && ret[1] && ret[1] != null) {
return ret[1];
}
if (!ret && /MicroMessenger\/[\d\.]+/i.test(ua)) {
var urlParams = getUrlParams();
if (urlParams.version) {
return urlParams.version;
}
}
return false;
}
var opfunc = {
'cp-1': function cp1(a, b) {
return a < b;
},
cp0: function cp0(a, b) {
return a === b;
},
cp1: function cp1(a, b) {
return a > b;
}
};
function cpVersion(ver, op, canEq, type) {
var mmver = false;
switch (type) {
case 'mac':
mmver = getMac();
break;
case 'windows':
mmver = getWindowsVersionFormat();
break;
case 'wxwork':
mmver = getWxWork();
break;
case 'mpapp':
mmver = getMpApp();
break;
case 'unifiedpc':
mmver = getUnifiedPcVer();
break;
default:
mmver = get();
break;
}
if (!mmver) {
return;
}
var mmversion = mmver.split('.');
var version = ver.split('.');
if (!/\d+/g.test(mmversion[mmversion.length - 1])) {
mmversion.pop();
}
for (var i = 0, len = Math.max(mmversion.length, version.length); i < len; ++i) {
var mmv = mmversion[i] || '';
var v = version[i] || '';
var mmvn = parseInt(mmv, 10) || 0;
var vn = parseInt(v, 10) || 0;
var eq = opfunc.cp0(mmvn, vn);
if (eq) {
continue;
}
var cp = opfunc["cp".concat(op)];
return cp(mmvn, vn);
}
return canEq || op === 0;
}
function eqVersion(version) {
return cpVersion(version, 0);
}
function gtVersion(version, canEq) {
return cpVersion(version, 1, canEq);
}
function ltVersion(version, canEq) {
return cpVersion(version, -1, canEq);
}
function getPlatform() {
if (is_ios) {
return 'ios';
}
if (is_android) {
return 'android';
}
if (is_mac) {
return 'mac_os';
}
if (is_windows) {
return 'windows';
}
return 'unknown';
}
var is_google_play = false;
var inner_ver_for_google_play_check = getInner();
if (is_android && inner_ver_for_google_play_check) {
var v = "0x".concat(inner_ver_for_google_play_check.substr(-2));
if (parseInt(v) >= 64 && parseInt(v) <= 79) {
is_google_play = true;
}
}
function compareHexVersion(hexNum) {
var innerVersion = getInner();
if (innerVersion && hexNum) {
if (typeof hexNum === 'string') {
hexNum = parseInt(hexNum, 16);
}
var version = parseInt(innerVersion, 16);
return version >= hexNum;
}
return false;
}
var mmVersion = {
get: get,
getMac: getMac,
getMacOS: getMacOS,
getWindows: getWindows,
getInner: getInner,
getWxWork: getWxWork,
getMpApp: getMpApp,
cpVersion: cpVersion,
eqVersion: eqVersion,
gtVersion: gtVersion,
ltVersion: ltVersion,
getPlatform: getPlatform,
getVersionNumber: getVersionNumber,
isWp: is_wp,
isIOS: is_ios,
isAndroid: is_android,
isHarmony: is_harmony,
isHarmonyWechat: is_harmony && is_wechat && cpVersion('1.0.0', 1, true),
isInMiniProgram: is_in_miniProgram,
isWechat: is_wechat,
isMac: is_mac,
isWindows: is_windows,
isLinux: is_linux,
isMacWechat: is_mac_wechat,
isWindowsWechat: is_windows_wechat,
isWxWork: is_wx_work,
isOnlyWechat: is_wechat && !is_wx_work,
isMpapp: is_mpapp,
isIPad: is_ipad,
isGooglePlay: is_google_play,
isPrefetch: is_prefetch,
isDonutAPP: is_donut_app,
compareHexVersion: compareHexVersion,
isPcWechat: is_windows_wechat || is_mac_wechat,
xwebVersion: xweb_version,
isUnifiedPcWechat: is_unified_pc_wechat
};
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toPrimitive(input, hint) {
if (_typeof(input) !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (_typeof(res) !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return _typeof(key) === "symbol" ? key : String(key);
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
var Device = {};
function detect(ua) {
var MQQBrowser = ua.match(/MQQBrowser\/(\d+\.\d+)/i);
var MQQClient = ua.match(/QQ\/(\d+\.(\d+)\.(\d+)\.(\d+))/i) || ua.match(/V1_AND_SQ_([\d\.]+)/);
var WeChat = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/) || ua.match(/MicroMessenger\/((\d+)\.(\d+))/);
var MacOS = ua.match(/Mac\sOS\sX\s(\d+[\.|_]\d+)/);
var WinOS = ua.match(/Windows(\s+\w+)?\s+?(\d+\.\d+)/);
var Linux = ua.match(/Linux\s/);
var MiuiBrowser = ua.match(/MiuiBrowser\/(\d+\.\d+)/i);
var M1 = ua.match(/MI-ONE/);
var MIPAD = ua.match(/MI PAD/);
var UC = ua.match(/UCBrowser\/(\d+\.\d+(\.\d+\.\d+)?)/) || ua.match(/\sUC\s/);
var IEMobile = ua.match(/IEMobile(\/|\s+)(\d+\.\d+)/) || ua.match(/WPDesktop/);
var ipod = ua.match(/(ipod).*\s([\d_]+)/i);
var ipad = ua.match(/(ipad).*\s([\d_]+)/i);
var iphone = ua.match(/(iphone)\sos\s([\d_]+)/i);
var Chrome = ua.match(/Chrome\/(\d+\.\d+)/);
var AndriodBrowser = ua.match(/Mozilla.*Linux.*Android.*AppleWebKit.*Mobile Safari/);
var android = ua.match(/(android)\s([\d\.]+)/i);
var harmony = ua.match(/(OpenHarmony)\s([\d\.]+)/i);
Device.browser = Device.browser || {}, Device.os = Device.os || {};
Device.os.type = -1;
Device.os.unifiedPC = ua.match(/UnifiedPC/);
Device.os.unifiedMac = /UnifiedPCMac/i.test(ua);
Device.os.unifiedWindows = /UnifiedPCWindows/i.test(ua);
if (window.ActiveXObject) {
var vie = 6;
(window.XMLHttpRequest || ua.indexOf('MSIE 7.0') > -1) && (vie = 7);
(window.XDomainRequest || ua.indexOf('Trident/4.0') > -1) && (vie = 8);
ua.indexOf('Trident/5.0') > -1 && (vie = 9);
ua.indexOf('Trident/6.0') > -1 && (vie = 10);
Device.browser.ie = true, Device.browser.version = vie;
} else if (ua.indexOf('Trident/7.0') > -1) {
Device.browser.ie = true, Device.browser.version = 11;
}
if (android) {
Device.os.android = true;
Device.os.version = android[2];
Device.os.type = 2;
}
if (harmony) {
Device.os.harmony = true;
Device.os.version = harmony[2];
Device.os.type = 42;
}
if (ipod) {
Device.os.ios = Device.os.ipod = true;
Device.os.version = ipod[2].replace(/_/g, '.');
}
if (ipad) {
Device.os.ios = Device.os.ipad = true;
Device.os.version = ipad[2].replace(/_/g, '.');
Device.os.type = 13;
}
if (iphone) {
Device.os.iphone = Device.os.ios = true;
Device.os.version = iphone[2].replace(/_/g, '.');
Device.os.type = 1;
}
if (WinOS) Device.os.windows = true, Device.os.version = WinOS[2], Device.os.type = 15;
if (MacOS) Device.os.Mac = true, Device.os.version = MacOS[1], Device.os.type = 14;
if (Linux) Device.os.Linux = true, Device.os.type = 33;
if (ua.indexOf('lepad_hls') > 0) Device.os.LePad = true;
if (MIPAD) Device.os.MIPAD = true;
if (MQQBrowser) Device.browser.MQQ = true, Device.browser.version = MQQBrowser[1];
if (MQQClient) Device.browser.MQQClient = true, Device.browser.version = MQQClient[1];
if (WeChat) Device.browser.WeChat = true, Device.browser.mmversion = Device.browser.version = WeChat[1];
if (MiuiBrowser) Device.browser.MIUI = true, Device.browser.version = MiuiBrowser[1];
if (UC) Device.browser.UC = true, Device.browser.version = UC[1] || NaN;
if (IEMobile) Device.browser.IEMobile = true, Device.browser.version = IEMobile[2];
if (AndriodBrowser) {
Device.browser.AndriodBrowser = true;
}
if (M1) {
Device.browser.M1 = true;
}
if (Chrome) {
Device.browser.Chrome = true, Device.browser.version = Chrome[1];
}
if (Device.os.windows) {
if (typeof navigator.platform !== "undefined" && navigator.platform.toLowerCase() == "win64") {
Device.os.win64 = true;
} else {
Device.os.win64 = false;
}
}
if (Device.os.Mac || Device.os.windows || Device.os.Linux || Device.os.unifiedPC || /OpenHarmony/i.test(ua) && /pc/i.test(ua)) {
Device.os.pc = true;
}
var osType = {
iPad7: 'iPad; CPU OS 7',
LePad: 'lepad_hls',
XiaoMi: 'MI-ONE',
SonyDTV: "SonyDTV",
SamSung: 'SAMSUNG',
HTC: 'HTC',
VIVO: 'vivo'
};
for (var os in osType) {
Device.os[os] = ua.indexOf(osType[os]) !== -1;
}
Device.os.phone = Device.os.phone || /windows phone/i.test(ua);
Device.os.getNumVersion = function () {
return parseFloat(Device.os.version);
};
Device.os.hasTouch = 'ontouchstart' in window;
if (Device.os.hasTouch && Device.os.ios && Device.os.getNumVersion() < 6) {
Device.os.hasTouch = false;
}
if (Device.browser.WeChat && Device.browser.version < 5.0) {
Device.os.hasTouch = false;
}
Device.browser.getNumVersion = function () {
return parseFloat(Device.browser.version);
};
Device.browser.isFFCanOcx = function () {
return !!Device.browser.firefox && Device.browser.getNumVersion() >= 3.0;
};
Device.browser.isCanOcx = function () {
return !!Device.os.windows && (!!Device.browser.ie || Device.browser.isFFCanOcx() || !!Device.browser.webkit);
};
Device.browser.isNotIESupport = function () {
return !!Device.os.windows && (!!Device.browser.webkit || Device.browser.isFFCanOcx());
};
Device.userAgent = {};
Device.userAgent.browserVersion = Device.browser.version;
Device.userAgent.osVersion = Device.os.version;
if (Device.os.unifiedPC) {
if (Device.os.unifiedWindows) Device.os.type = 37;else if (Device.os.unifiedMac) Device.os.type = 38;else Device.os.type = 39;
}
delete Device.userAgent.version;
}
detect(window.navigator.userAgent);
function canSupportH5Video() {
var ua = window.navigator.userAgent,
m = null;
if (!!Device.os.android) {
if (Device.browser.MQQ && Device.browser.getNumVersion() >= 4.2) {
return true;
}
if (ua.indexOf('MI2') != -1) {
return true;
}
if (Device.os.version >= '4' && (m = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/))) {
if (parseFloat(m[1]) >= 4.2) {
return true;
}
}
if (Device.os.version >= '4.1') {
return true;
}
}
return false;
}
function canSupportVideoMp4() {
var video = document.createElement('video');
if (typeof video.canPlayType === 'function') {
if (video.canPlayType('video/mp4; codecs="mp4v.20.8"') === 'probably') {
return true;
}
if (video.canPlayType('video/mp4; codecs="avc1.42E01E"') === 'probably' || video.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"') === 'probably') {
return true;
}
}
return false;
}
function canSupportAutoPlay() {
if (Device.os.ios && Device.os.getNumVersion() < 10) {
return false;
}
return true;
}
function isLockdownMode() {
if (!Device.os.ios || Device.os.getNumVersion() < 16) {
return false;
}
if (typeof WebAssembly === 'undefined' && typeof OfflineAudioContext === 'undefined' && typeof WebGLRenderingContext === 'undefined') {
return true;
}
return false;
}
Device.canSupportVideo = canSupportVideoMp4 || canSupportH5Video;
Device.canSupportVideoMp4 = canSupportVideoMp4;
Device.canSupportH5Video = canSupportH5Video;
Device.canSupportAutoPlay = canSupportAutoPlay;
Device.isLockdownMode = isLockdownMode;
Device.cpVersion = function (version) {
var cp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var canEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var nowVersionStr = Device.os.version;
if (!nowVersionStr) return false;
var versionArr = version.split('.');
var nowVersionArr = nowVersionStr.split('.');
for (var i = 0; i < Math.max(nowVersionArr.length, versionArr.length); i++) {
var vi = +versionArr[i];
var nvi = +nowVersionArr[i];
if (vi === nvi) continue;
if (cp > 0) return vi > nvi;
if (cp < 0) return vi < nvi;
}
return canEqual || cp === 0;
};
var initJsBridge = false;
if (!window.JSAPIEventCallbackMap) {
window.JSAPIEventCallbackMap = {};
}
function connectWebViewJavascriptBridge(callback) {
if (window.WebViewMPapp || window.WebViewJavascriptBridge) {
return callback(window.WebViewMPapp || window.WebViewJavascriptBridge);
}
if (window.WVJBCallbacks) {
return window.WVJBCallbacks.push(callback);
}
window.WVJBCallbacks = [callback];
if (!mmVersion.isMpapp) {
return false;
}
if (!initJsBridge) {
initJsBridge = true;
var WVJBIframe = document.createElement('iframe');
WVJBIframe.style.display = 'none';
WVJBIframe.src = 'https://__bridge_loaded__';
document.body.appendChild(WVJBIframe);
setTimeout(function () {
initJsBridge = false;
document.body.removeChild(WVJBIframe);
}, 0);
}
return false;
}
function invoke(jsapiName, opt, callback) {
connectWebViewJavascriptBridge(function (bridge) {
try {
if (typeof opt === 'function') {
callback = opt;
}
if (_typeof(opt) !== 'object' && typeof opt !== 'string') {
opt = {};
}
bridge.callHandler(jsapiName, opt, function (res) {
try {
var ret = _typeof(res) === 'object' ? res : JSON.parse(res);
var errMsg = ret.err_msg || ret.errMsg;
console.info("[mpapp jsapi] invoke->".concat(jsapiName, " ").concat(opt.action || '', " ").concat(errMsg));
typeof callback === 'function' && callback(ret);
} catch (e) {
window.WX_BJ_REPORT.BadJs.report('invoke', "callback ".concat(jsapiName, " error:"), {
mid: 'mmbizwebapp:js_brridge',
_info: e
});
console.error("[mpapp jsapi] ".concat(jsapiName, " ").concat(opt.action || ''), e, res);
}
});
} catch (e) {
window.WX_BJ_REPORT.BadJs.report('invoke', 'callback error:', {
mid: 'mmbizwebapp:js_brridge',
_info: e
});
console.error('[mpapp jsapi]', e);
}
});
}
function _log(level, msg) {
if (level === 'log') {
level = 'info';
msg = "[WechatFe]".concat(msg);
} else {
var prefix = "__wap__".concat(window.__second_open__ ? ' (sec)' : '');
msg = "".concat(prefix, " ").concat(msg, " location:[").concat(location.href, "]");
}
msg += new Error().stack;
if (mmVersion.isMpapp) {
invoke('WNNativeCallbackLog', msg);
} else if (mmVersion.isWechat) {
if (mmVersion.isAndroid) {
console.warn('[system]', "[MicroMsg.JsApiLog][".concat(level, "] jslog : ").concat(msg));
} else if (mmVersion.isIOS) {
JSAPI.invoke('writeLog', {
level: level,
msg: msg
});
} else {
JSAPI.invoke('log', {
level: level,
msg: msg
});
}
}
}
var Log = {
info: function info() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_log('info', args.join(' '));
},
warn: function warn() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_log('warn', args.join(' '));
},
error: function error() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
_log('error', args.join(' '));
},
debug: function debug() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
_log('debug', args.join(' '));
},
log: function log() {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
_log('info', args.join(' '));
}
};
var reportLogs = [];
var reportExtraLogs = [];
var sendUrl = '/mp/jsmonitor?#wechat_redirect';
var monitor = {};
monitor._reportOptions = {
idkey: {}
};
function ObjWithoutProperty(source, exclude) {
if (source === null) return {};
var target = {};
var sourceKeys = Object.keys(source);
for (var i = 0; i < sourceKeys.length; i++) {
var key = sourceKeys[i];
if (exclude.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function formatDataToString(data) {
var reportData = [];
for (var key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
reportData.push(key + '=' + encodeURIComponent(data[key]));
}
}
return reportData.join('&');
}
monitor.getReportData = function (opt) {
opt = opt || {};
var idkey = monitor._reportOptions.idkey || {};
var key = null;
var reportData = {};
var nextKey;
try {
for (key in idkey) {
if (Object.prototype.hasOwnProperty.call(idkey, key) && idkey[key]) {
reportLogs.push(key + '_' + idkey[key]);
}
}
} catch (e) {
return false;
}
if (reportLogs.length === 0) {
return false;
}
if (reportExtraLogs.length) {
reportData.lc = reportExtraLogs.length;
reportExtraLogs.forEach(function (extraLog, index) {
reportData["log".concat(index)] = extraLog;
});
}
try {
var reportOptions = monitor._reportOptions;
if (reportOptions !== null && reportOptions !== undefined) {
for (nextKey in reportOptions) {
if (Object.prototype.hasOwnProperty.call(reportOptions, nextKey)) {
reportData[nextKey] = reportOptions[nextKey];
}
}
}
} catch (e) {
reportData = {};
}
reportData.idkey = reportLogs.join(';');
reportData.t = Math.random();
if (opt.remove !== false) {
reportLogs = [];
reportExtraLogs = [];
monitor._reportOptions = {
idkey: {}
};
}
return reportData;
};
monitor.setLogs = function (opt) {
var id = opt.id;
var key = opt.key;
var value = opt.value;
var extraLog = opt.log;
var others = ObjWithoutProperty(opt, ['id', 'key', 'value', 'log']);
var idkey = monitor._reportOptions.idkey || {};
var param = id + '_' + key;
if (idkey[param]) {
idkey[param] += value;
} else {
idkey[param] = value;
}
monitor._reportOptions.idkey = idkey;
if (extraLog) {
reportExtraLogs.push(extraLog);
}
try {
if (others !== null && others !== undefined) {
for (var otherKey in others) {
if (Object.prototype.hasOwnProperty.call(others, otherKey)) {
monitor._reportOptions[otherKey] = others[otherKey];
}
}
}
} catch (e) {
console.log(e);
}
return monitor;
};
monitor.setAvg = function (id, key, value) {
var idkey = monitor._reportOptions.idkey || {};
var param1 = id + '_' + key;
var param2 = id + '_' + (key - 1);
if (idkey[param1]) {
idkey[param1] += value;
} else {
idkey[param1] = value;
}
if (idkey[param2]) {
idkey[param2] += 1;
} else {
idkey[param2] = 1;
}
monitor._reportOptions.idkey = idkey;
return monitor;
};
monitor.setSum = function (id, key) {
var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var idkey = monitor._reportOptions.idkey;
var param = id + '_' + key;
if (idkey[param]) {
idkey[param] += value;
} else {
idkey[param] = value;
}
monitor._reportOptions.idkey = idkey;
return monitor;
};
monitor.send = function (async, ajax, origin) {
if (async !== false) {
async = true;
}
var data = monitor.getReportData();
origin = origin || '';
if (!data) {
return;
}
if (!!ajax && ajax instanceof Function) {
ajax({
url: origin + sendUrl,
type: 'POST',
mayAbort: true,
data: data,
async: async,
timeout: 2000,
dontReport: true
});
} else {
new Image().src = origin + '/mp/jsmonitor?' + formatDataToString(data) + '#wechat_redirect';
}
};
if (typeof window !== 'undefined' && window.__monitor) {
monitor = window.__monitor;
} else {
typeof window !== 'undefined' && (window.__monitor = monitor);
}
var monitor$1 = monitor;
var logList = [];
var log = function log(msg) {
logList.push(msg);
};
var printLog = function printLog() {
for (var i = 0, len = logList.length; i < len; ++i) {
console.log("[RespType]".concat(logList[i]));
}
};
var isArray = function isArray(val) {
return Object.prototype.toString.call(val) === '[object Array]';
};
var getValueType = function getValueType(value) {
if (isArray(value)) {
return 'array';
}
return _typeof(value);
};
var parseRtDesc = function parseRtDesc(rtDesc, k) {
var type = 'mix';
var isRequired = false;
var key = k;
if (k) {
var requireKeyWord = '_R';
var pos = k.indexOf(requireKeyWord);
var len = k.length - requireKeyWord.length;
isRequired = pos !== -1 && pos === len;
key = isRequired ? k.substring(0, len) : k;
}
if (typeof rtDesc === 'string') {
type = rtDesc;
} else if (isArray(rtDesc)) {
type = 'array';
} else if (_typeof(rtDesc) === 'object') {
type = 'object';
}
return {
key: key,
type: type,
isRequired: isRequired
};
};
var checkForArrayRtDesc = function checkForArrayRtDesc(arr, rtDescs) {
if (!isArray(arr)) {
return false;
}
for (var i = 0, len = arr.length; i < len; ++i) {
var value = arr[i];
var rtDesc = void 0;
var j = 0;
var flag = rtDescs.length === 0;
while (rtDesc = rtDescs[j++]) {
if (checkForRtDesc(value, rtDesc)) {
flag = true;
break;
}
}
if (!flag) {
return false;
}
}
return true;
};
var checkForStringRtDesc = function checkForStringRtDesc(value, rtDesc) {
var valueType = getValueType(value);
var desc = parseRtDesc(rtDesc);
var ret = desc.type === valueType;
if (!ret) {
log("miss match type : ".concat(valueType, " !== ").concat(desc.type));
}
return ret;
};
var checkForObjectRtDesc = function checkForObjectRtDesc(json, rtDesc) {
if (_typeof(json) !== 'object' || isArray(json)) {
log('must be object');
return false;
}
var rootJson = json;
var nowCheckValue = json;
for (var k in rtDesc) {
if (rtDesc.hasOwnProperty(k)) {
var nowCheckDesc = rtDesc[k];
var desc = parseRtDesc(nowCheckDesc, k);
var key = desc.key;
nowCheckValue = rootJson[key];
var valueType = getValueType(nowCheckValue);
if (desc.isRequired && nowCheckValue === undefined) {
log("is required @key=".concat(key));
return false;
}
if (nowCheckValue !== undefined) {
if (valueType !== desc.type && desc.type !== 'mix') {
log("miss match type : ".concat(valueType, " !== ").concat(desc.type, " @key=").concat(key));
return false;
}
if ((valueType === 'array' || valueType === 'object') && desc.type !== 'mix') {
if (!checkForRtDesc(nowCheckValue, nowCheckDesc)) {
return false;
}
}
}
}
}
return true;
};
var checkForRtDesc = function checkForRtDesc(json, rtDesc) {
if (isArray(rtDesc)) {
return checkForArrayRtDesc(json, rtDesc);
}
if (_typeof(rtDesc) === 'object') {
return checkForObjectRtDesc(json, rtDesc);
}
if (typeof rtDesc === 'string') {
return checkForStringRtDesc(json, rtDesc);
}
return false;
};
var _check = function check(json, rtDescs) {
if (typeof json === 'string') {
try {
json = eval("(".concat(json, ")"));
} catch (e) {
log('parse json error');
return false;
}
}
if (_typeof(json) !== 'object') {
log('must be object');
return false;
}
if (!isArray(rtDescs)) {
rtDescs = [rtDescs];
}
var rtDesc;
var i = 0;
while (rtDesc = rtDescs[i++]) {
if (checkForRtDesc(json, rtDesc)) {
return true;
}
}
return false;
};
var RespTypes = {
check: function check(json, rtDesc) {
logList = [];
try {
var ret = _check(json, rtDesc);
if (!ret) {
printLog();
}
return ret;
} catch (e) {
logList.push("[rtException]".concat(e.toString()));
printLog();
return false;
}
},
getMsg: function getMsg() {
return logList.join(';');
}
};
function getInflightMap() {
if (!window.__dedupe_promise_inflight__) {
window.__dedupe_promise_inflight__ = new Map();
}
return window.__dedupe_promise_inflight__;
}
function dedupePromise(key, factory) {
var inflightMap = getInflightMap();
var existing = inflightMap.get(key);
console.log("dedupePromise key=".concat(key, " existing=").concat(existing));
if (existing) {
return existing;
}
var promise = Promise.resolve().then(factory)["finally"](function () {
inflightMap["delete"](key);
});
inflightMap.set(key, promise);
return promise;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
var prefix = '__WXLS__';
var localStorage$1 = window.localStorage || {
getItem: function getItem() {},
setItem: function setItem() {},
removeItem: function removeItem() {},
key: function key() {},
clear: function clear() {
var _a, _b;
(_b = (_a = window.localStorage) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a);
},
length: 0
};
var evictionPolicies = {
noeviction: function noeviction(data) {
return data;
},
'allkeys-random': function allkeysRandom(data, size) {
var keys = Object.keys(data);
var memCnt = 0;
while (memCnt < size) {
var len = keys.length;
var randomKeyIdx = Math.floor(Math.random() * len);
var randomKey = keys[randomKeyIdx];
memCnt += JSON.stringify(data[randomKey]).length;
delete data[randomKey];
keys = Object.keys(data);
}
return data;
},
'volatile-ttl': function volatileTtl(data, size) {
var keys = Object.keys(data);
keys = keys.sort(function (key1, key2) {
var d1 = data[key1];
var d2 = data[key2];
if (d1.exp < d2.exp) return -1;
if (d1.exp > d2.exp) return 1;
return 0;
});
var memCnt = 0;
for (var i = 0; i < keys.length; i++) {
if (memCnt >= size) break;
var key = keys[i];
memCnt += JSON.stringify(data[key]).length;
delete data[key];
}
return data;
},
'clear-all': function clearAll() {
localStorage$1.clear();
return {};
}
};
function formatLogMsg(str) {
return "[WXLS] ".concat(str);
}
var LS = function () {
function LS(func, evictionPolicy, logger) {
_classCallCheck(this, LS);
this.logger = function () {};
if (!func) throw 'require function name.';
this.evictionPolicy = 'noeviction';
this.key = func;
if (typeof logger === 'function') {
this.logger = function (str, type) {
return logger(formatLogMsg(str), type);
};
}
if (evictionPolicy && Object.keys(evictionPolicies).indexOf(evictionPolicy) !== -1) {
this.evictionPolicy = evictionPolicy;
}
this.init();
}
_createClass(LS, [{
key: "init",
value: function init() {
var _a, _b;
this.check();
if (Math.random() * 1000 < 1) {
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.call(this, "LSlen: ".concat(((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length) || localStorage$1.length), 'report');
}
}
}, {
key: "getData",
value: function getData() {
var data = LS.getItem(this.key) || '{}';
try {
data = JSON.parse(data);
} catch (e) {
this.logger("getData error: ".concat(e), 'error');
localStorage$1.removeItem(prefix + this.key);
data = {};
}
return data;
}
}, {
key: "check",
value: function check(isReturn) {
var data = this.getData();
var temp = {};
var now = +new Date();
var key;
var val;
for (key in data) {
val = data[key];
if (+val.exp > now) {
temp[key] = val;
}
}
this.logger("check info: isReturn:".concat(isReturn, " data:").concat(JSON.stringify(temp)), 'info');
if (isReturn) return temp;
LS.setItem(this.key, JSON.stringify(temp), this.logger);
}
}, {
key: "set",
value: function set(key, val, exp) {
var _a, _b;
var data = this.check(true);
data[key] = {
val: val,
exp: exp || +new Date()
};
try {
if (localStorage$1.getItem(prefix + this.key)) localStorage$1.removeItem(prefix + this.key);
localStorage$1.setItem(prefix + this.key, JSON.stringify(data));
this.logger("first set success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data)), 'success');
} catch (e) {
this.logger("first set error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data), " k:").concat(key, " v:").concat(val, " exp:").concat(exp), 'error');
localStorage$1.clear();
LS.setItem(this.key, JSON.stringify(_defineProperty({}, key, {
val: val,
exp: exp || +new Date()
})), this.logger);
}
}
}, {
key: "get",
value: function get(key) {
var data = this.getData();
data = data[key];
return data ? data.val || null : null;
}
}, {
key: "remove",
value: function remove(key) {
var data = this.getData();
if (data[key]) delete data[key];
LS.setItem(this.key, JSON.stringify(data), this.logger);
}
}], [{
key: "getItem",
value: function getItem(key) {
key = prefix + key;
return localStorage$1.getItem(key);
}
}, {
key: "setItem",
value: function setItem(key, val, logger) {
var _a, _b;
key = prefix + key;
var n = 3;
while (n--) {
try {
if (localStorage$1.getItem(key)) localStorage$1.removeItem(key);
localStorage$1.setItem(key, val);
typeof logger === 'function' && logger("setItem success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(key, " val:").concat(val), 'success');
break;
} catch (e) {
typeof logger === 'function' && logger("setItem error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(key, " val:").concat(val), 'error');
LS.clear();
}
}
}
}, {
key: "clear",
value: function clear() {
var i;
var k;
for (i = localStorage$1.length - 1; i >= 0; i--) {
k = localStorage$1.key(i);
if (k.indexOf(prefix) == 0) {
localStorage$1.removeItem(k);
}
}
}
}, {
key: "getSupportEvicationPolicy",
value: function getSupportEvicationPolicy() {
return Object.keys(evictionPolicies);
}
}]);
return LS;
}();
var innerVersion = (mmVersion.getInner() || '').toUpperCase();
var getBizLS = new LS('get_biz_result');
function getBizMap() {
if (!window.__get_biz_map__) {
window.__get_biz_map__ = {};
}
return window.__get_biz_map__;
}
var isGetBizSupported = mmVersion.isOnlyWechat && mmVersion.isIOS && innerVersion >= '18003C2A' || mmVersion.isOnlyWechat && mmVersion.isAndroid && innerVersion >= '28003D3C' || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc');
function invokeGetBiz(needCheckBiz, bizType) {
return dedupePromise("getBiz:".concat(needCheckBiz, ":").concat(bizType), function () {
return new Promise(function (resolve, reject) {
if (!isGetBizSupported) {
reject('Not support');
} else {
JSAPI.invoke('handleMPPageAction', {
action: 'getBiz',
needCheckBiz: needCheckBiz,
bizType: bizType
}, function (res) {
console.log("getBiz needCheckBiz=".concat(needCheckBiz, " bizType=").concat(bizType, " res: ").concat(JSON.stringify(res)));
if (res && res.err_msg && res.err_msg.indexOf('ok') > -1) {
var bizMap = getBizMap();
bizMap[bizType] = res.biz;
resolve(res.biz);
getBizLS.set("".concat(bizType, "_get_biz_result"), res.biz, +new Date() + 3 * 24 * 60 * 60 * 1000);
} else {
reject('Failed to get biz');
}
});
}
});
});
}
function getBiz(needCheckBiz, bizType) {
var _a;
if (needCheckBiz === void 0) {
needCheckBiz = false;
}
if (bizType === void 0) {
bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1;
}
var bizMap = getBizMap();
if (!needCheckBiz && bizMap[bizType] !== undefined) {
return Promise.resolve(bizMap[bizType]);
}
return invokeGetBiz(needCheckBiz, bizType);
}
mmVersion.isOnlyWechat && mmVersion.isIOS || mmVersion.isOnlyWechat && mmVersion.isAndroid || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc');
var getIsAuthor = function getIsAuthor(cb, bizuin, needCheckBiz, bizType) {
var _a;
if (bizuin === void 0) {
bizuin = window.biz;
}
if (needCheckBiz === void 0) {
needCheckBiz = false;
}
if (bizType === void 0) {
bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1;
}
getBiz(needCheckBiz, bizType).then(function (biz) {
cb(biz && biz === bizuin);
})["catch"](function () {
cb(false);
});
};
function parseUrl(url) {
var len = url.length;
var ques_pos = url.indexOf('?');
var hash_pos = url.indexOf('#');
hash_pos = hash_pos == -1 ? len : hash_pos;
ques_pos = ques_pos == -1 ? hash_pos : ques_pos;
var host = url.substring(0, ques_pos);
var query_str = url.substring(ques_pos + 1, hash_pos);
var hash = url.substring(hash_pos + 1);
return {
host: host,
query_str: query_str,
hash: hash
};
}
function join(url, args, noEncode) {
var ret = parseUrl(url);
var query_str = ret.query_str;
var args_arr = [];
if (_typeof(args) === 'object') {
for (var key in args) {
if (args.hasOwnProperty(key)) {
args_arr.push("".concat(key, "=").concat(noEncode ? args[key] : encodeURIComponent(args[key])));
}
}
} else {
args_arr.push(noEncode ? args : encodeURIComponent(args));
}
if (args_arr.length > 0) {
query_str += (query_str !== "" ? "&" : "") + args_arr.join("&");
}
return ret.host + (query_str !== "" ? "?".concat(query_str) : "") + (ret.hash !== "" ? "#".concat(ret.hash) : "");
}
function addParam(url, param, value, forceReplace) {
url = url || location.href;
var firstAndPos = url.indexOf("&");
var len = url.length;
var reverseUrl = url.replace(/^[\w\d]+:[/\\]+/g, "").split("").reverse();
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement, fromIndex) {
var k;
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var O = Object(this);
var len = O.length >>> 0;
if (len === 0) {
return -1;
}
var n = fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
if (n >= len) {
return -1;
}
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {
if (k in O && O[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
}
var lastSlashPos = len - 1 - reverseUrl.indexOf("/");
if (firstAndPos !== -1 && url.indexOf("?") == -1 && firstAndPos > lastSlashPos) {
url = url.replace("&", "?");
}
var reg = new RegExp("([\\?&]".concat(param, "=)[^&#]*"));
if (!url.match(reg)) {
var urlInfo = parseUrl(url);
var hash = urlInfo.hash ? '#' + urlInfo.hash : '';
url = url.replace(hash, '');
var _pos = url.indexOf("?");
if (_pos == -1) {
return "".concat(url, "?").concat(param, "=").concat(value).concat(hash);
}
if (_pos == url.length - 1) {
return "".concat(url + param, "=").concat(value).concat(hash);
}
return "".concat(url, "&").concat(param, "=").concat(value).concat(hash);
}
if (forceReplace === true) {
return url.replace(reg, "$1".concat(value));
}
return url;
}
function addWxfrom(src, wxfrom) {
var offset = window.service_type === 1 ? 10000 : 0;
return addParam(src, 'wxfrom', offset + Number(wxfrom), true);
}
function removeParam(url, param) {
var _URL = new URL(url),
protocol = _URL.protocol,
host = _URL.host,
pathname = _URL.pathname,
search = _URL.search,
hash = _URL.hash;
var queryParams = new URLSearchParams(search);
queryParams["delete"](param);
var newSearch = queryParams.toString();
var newUrl = new URL("".concat(protocol, "//").concat(host).concat(pathname).concat(newSearch ? "?".concat(decodeURIComponent(newSearch)) : "").concat(hash));
return newUrl.toString();
}
function getQuery(name, url) {
var u = url || window.location.search;
var reg = new RegExp("(^|&)".concat(name, "=([^&]*)(&|$)"));
var r = u.substring(u.indexOf('?') + 1).match(reg);
return r !== null ? r[2] : '';
}
function encodeBase64(value) {
try {
return window.btoa(value);
} catch (e) {
return '';
}
}
function decodeBase64(value) {
try {
return window.atob(value);
} catch (e) {
return '';
}
}
function joinUrl$1(url) {
var obj = {};
if (typeof window.uin !== 'undefined') {
obj.uin = window.uin;
}
if (typeof window.key !== 'undefined') {
obj.key = window.key;
}
if (typeof window.pass_ticket !== 'undefined') {
obj.pass_ticket = window.pass_ticket;
}
if (typeof window.wxtoken !== 'undefined') {
obj.wxtoken = window.wxtoken;
}
if (typeof window.devicetype !== 'undefined') {
obj.devicetype = window.devicetype;
}
if (typeof window.clientversion !== 'undefined') {
obj.clientversion = window.clientversion || mmVersion.getInner();
}
obj.version = obj.clientversion;
if (window.biz) {
obj.__biz = window.biz;
}
if (getQuery('enterid')) {
obj.enterid = getQuery('enterid');
}
if (typeof window.appmsg_token !== 'undefined') {
obj.appmsg_token = window.appmsg_token;
} else if (url.indexOf('advertisement_report') > -1) {
new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random());
}
obj.x5 = navigator.userAgent.indexOf('TBS/') !== -1 ? '1' : '0';
obj.f = 'json';
return join(url, obj);
}
function joinUserArticleRole(url, notJoin, cb) {
var bizuin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : window.biz;
var needCheckBiz = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
if (notJoin) {
cb(url);
} else {
getIsAuthor(function (isAuthor) {
cb(addParam(url, 'user_article_role', isAuthor ? 1 : 0, true));
}, bizuin, needCheckBiz);
}
}
function getA8keyQuery(name, url) {
return new Promise(function (resolve) {
if (window.__secPageAuthPromise) {
window.__secPageAuthPromise.then(function () {
resolve(getQuery(name, url));
});
} else {
resolve(getQuery(name, url));
}
});
}
function addHash(url, hash) {
var isReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (isReplace) {
return "".concat(url.split('#')[0]).concat(hash);
}
return "".concat(url).concat(url.indexOf('#') === -1 ? '#' : '').concat(hash);
}
function decodeUrl(url) {
var _url = url;
while (_url.indexOf('&') !== -1) {
_url = _url.htmlDecode();
}
return _url;
}
var Url = {
parseUrl: parseUrl,
join: join,
addParam: addParam,
addWxfrom: addWxfrom,
addHash: addHash,
getQuery: getQuery,
getA8keyQuery: getA8keyQuery,
encodeBase64: encodeBase64,
decodeBase64: decodeBase64,
joinUrl: joinUrl$1,
joinUserArticleRole: joinUserArticleRole,
removeParam: removeParam,
decodeUrl: decodeUrl
};
var _a;
var doc;
var isAcrossOrigin = false;
try {
doc = (_a = window.top) === null || _a === void 0 ? void 0 : _a.window.document;
} catch (e) {
isAcrossOrigin = true;
}
var StatusTextMap = {
200: 'OK',
302: 'Found',
400: 'Bad Request',
500: 'Internal Server Error'
};
function getIsAcrossOrigin() {
return isAcrossOrigin;
}
function networkStartLog(item) {
var _a, _b, _c, _d, _e;
console.log('[system]', "< [request ".concat(item.requestType, "]"), item.url, item.method, item);
var rdevRequestId;
var requestTime = performance.now() / 1000;
if ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) {
try {
var willBeSentOptions = {
url: item.url,
method: item.method,
requestHeaders: Object.assign({}, item.requestHeader || {}, {
RDEV_REQUEST_TYPE: item.requestType
}),
requestBody: item.postData,
requestTime: requestTime
};
rdevRequestId = window.RemoteDevSdk.instance.Network.customRequestWillBeSent(willBeSentOptions);
} catch (err) {}
}
if ((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) {
try {
var vconsoleNetworkItem = (_e = (_d = window.vConsole.network).add) === null || _e === void 0 ? void 0 : _e.call(_d, Object.assign({}, item, {
startTime: Date.now(),
endTime: Date.now(),
status: 0,
readyState: 2,
response: ''
}));
vconsoleNetworkItem.rdevRequestId = rdevRequestId;
vconsoleNetworkItem.requestTime = requestTime;
return vconsoleNetworkItem;
} catch (err) {}
}
if (rdevRequestId) {
return Object.assign(Object.assign({}, item), {
id: '__only_rdev_log__',
rdevRequestId: rdevRequestId,
requestTime: requestTime
});
}
return Object.assign({}, item, {
id: '__system_log__'
});
}
function networkEndLog(item) {
var _a, _b, _c, _d, _e;
console.log('[system]', "> [response ".concat(item.requestType, "]"), item.url, item.response, item);
if (item.rdevRequestId && ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) && item.id !== '__system_log__') {
try {
var finishedOptions = {
requestId: item.rdevRequestId,
url: item.url,
status: +(item.status || '500'),
statusText: StatusTextMap[+(item.status || '500')] || 'Error',
responseHeaders: {
RDEV_RESPONSE_TYPE: item.requestType
},
responseBody: item.response,
requestTime: item.requestTime || 0,
duration: item.costTime || (item.endTime && item.startTime ? item.endTime - item.startTime : performance.now() / 1000 - (item.requestTime || 0))
};
window.RemoteDevSdk.instance.Network.customRequestFinished(finishedOptions);
} catch (err) {}
}
if (((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) && item.id !== '__system_log__') {
try {
item.statusText = "".concat(item.status);
item.responseSize = item.response.length;
item.responseSizeText = "".concat(item.response.length);
return (_e = (_d = window.vConsole.network).update) === null || _e === void 0 ? void 0 : _e.call(_d, item.id, Object.assign({}, item, {
readyState: 4
}));
} catch (err) {}
}
}
function reqType(obj, path) {
return obj.url.indexOf(path) > -1 && obj.url.indexOf('action=') === -1 && (!obj.data || !obj.data.action);
}
function findAjaxScopeByConfig(url, config) {
var pathname = new URL(url, location.href).pathname || '';
var scope = config[pathname.slice(1)];
if (scope) {
return scope;
}
}
function getAjaxScope(ajaxUrl) {
if (Url.getQuery('no_transfer', location.href) !== '1' && mmVersion.isWechat && !mmVersion.isInMiniProgram && !mmVersion.isWxWork && !mmVersion.isMpapp && !isAcrossOrigin && window.__ajaxTransferConfig && _typeof(window.__ajaxTransferConfig) === 'object' && (
mmVersion.isIOS && mmVersion.compareHexVersion('1800282F') || mmVersion.isAndroid && mmVersion.compareHexVersion('28002234') || mmVersion.isWindowsWechat && mmVersion.cpVersion('3.9.5', 1, true, 'windows') || mmVersion.isMacWechat && mmVersion.cpVersion('3.8.4', 1, true, 'mac') || mmVersion.isHarmonyWechat && mmVersion.compareHexVersion('0xf3100b00') && !mmVersion.compareHexVersion('0xf3100c00') || mmVersion.compareHexVersion('0xf3800b00'))) {
try {
return findAjaxScopeByConfig(ajaxUrl, window.__ajaxTransferConfig);
} catch (err) {
}
}
}
function getActionByData(data) {
var _a, _b;
if (_typeof(data) === 'object' && !(data instanceof Blob)) {
if (data.hasOwnProperty('data') && typeof data.data === 'string') {
try {
var workedData = JSON.parse(data.data);
return workedData.action || '';
} catch (e) {}
}
return data.action || '';
}
if (typeof data === 'string') {
return ((_b = (_a = data.split(/[?&]/).find(function (x) {
return x.indexOf('action=') >= 0;
})) === null || _a === void 0 ? void 0 : _a.split('=')) === null || _b === void 0 ? void 0 : _b[1]) || '';
}
return '';
}
var METHOD_ENUM = {
GET: 0,
POST: 1
};
var __moon_report = window.__moon_report || function () {};
var MOON_AJAX_SUCCESS_OFFSET = 3;
var MOON_AJAX_NETWORK_OFFSET = 4;
var MOON_AJAX_ERROR_OFFSET = 5;
var MOON_AJAX_TIMEOUT_OFFSET = 6;
var MOON_AJAX_COMPLETE_OFFSET = 7;
var LENGTH_LIMIT = 4096;
function reportRtError(type, id, key, content) {
var log = '';
var prefix = type === 'rt' ? 'rtCheckError' : 'Ajax Length Limit';
if (content === null || content === void 0 ? void 0 : content.length) {
var loglen = 1000;
var len = content.length;
var lc = Math.ceil(len / loglen);
log = ["&lc=".concat(lc)];
for (var i = 0; i < lc; ++i) {
log.push("&log".concat(i, "=") + "[".concat(prefix, "][").concat(i, "]").concat(encodeURIComponent(content.substring(i * loglen, i * loglen + loglen))));
}
log = log.join('');
}
var data = "idkey=".concat(id, "_").concat(key, "_1").concat(log, "&r=").concat(Math.random());
var xmlobj = new XMLHttpRequest();
xmlobj.open('POST', "".concat(location.protocol, "//").concat(location.host, "/mp/jsmonitor?"), true);
xmlobj.setRequestHeader('cache-control', 'no-cache');
xmlobj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlobj.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xmlobj.send(data);
if (type === 'ajaxLen') {
monitor$1.setLogs({
id: id,
key: key,
value: 1,
log: log
});
}
}
function reportRt(id, key, content) {
reportRtError('rt', id, key, content);
}
function reportAjaxLength(id, key, content) {
reportRtError('ajaxLen', id, key, content);
}
function setXhrHeader(xhr, type, opt) {
if (opt.contentType) {
xhr.setRequestHeader('Content-Type', opt.contentType);
} else if (type === 'POST') {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
}
if (!opt.noXRequestedWidthHeader) {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
}
}
function Ajax(obj) {
var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {};
if (obj.usePb) {
obj.type = 'POST';
obj.data = {
data: JSON.stringify(obj.data)
};
}
var ajaxScope = getAjaxScope(obj.url);
var type = (obj.type || 'GET').toUpperCase();
var timer;
var _url;
if (obj.notJoinUrl) {
_url = obj.url;
} else {
_url = Url.joinUrl(obj.url);
}
Url.joinUserArticleRole(_url, !!obj.notJoinUrl, function (url) {
var urlObj = new URL(url, location.origin);
if (obj.f === 'html') {
url = url.replace('&f=json', '');
}
var data = null;
if (obj.data instanceof Blob) {
data = obj.data;
} else if (_typeof(obj.data) === 'object') {
var d = obj.data;
var ds = [];
for (var k in d) {
if (d.hasOwnProperty(k)) {
ds.push("".concat(k, "=").concat(encodeURIComponent(d[k])));
}
}
data = ds.join('&');
} else {
data = typeof obj.data === 'string' ? obj.data : null;
}
var beginTs;
var beforeReq = function beforeReq() {
if (reqType(obj, '/mp/getappmsgext')) {
window.startGetAppmsgExtTime = Date.now();
Log.log('start get appmsgext, url: ', obj.url);
}
if (reqType(obj, '/mp/getappmsgad')) {
window.startGetAppmsgAdTime = Date.now();
Log.log('start get appmsgad, url: ', obj.url);
}
beginTs = Date.now();
};
var beforeResp = function beforeResp(xhr) {
if (reqType(obj, '/mp/getappmsgext')) {
window.receiveGetAppmsgExt = "".concat(xhr.status, "|").concat(Date.now());
Log.log("receive appmsgext response, status: ".concat(xhr.status));
}
if (reqType(obj, '/mp/getappmsgad')) {
window.receiveGetAppmsgAd = "".concat(xhr.status, "|").concat(Date.now());
Log.log("receive appmsgad response, status: ".concat(xhr.status));
}
if (Math.random() < 0.001 && window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) {
try {
var key = ajaxScope ? 'transfer' : 'xhr';
var interval = 250;
var time = Date.now() - beginTs;
var range = Math.floor(time / interval) * interval;
var pathname = new URL(obj.url, location.href).pathname || '';
window.WX_BJ_REPORT.BadJs.report("".concat(key, "_perf:").concat(pathname), JSON.stringify({
status: xhr.status,
time: "[".concat(range, "-").concat(range + interval, ")")
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
} catch (err) {}
}
};
var handleRespSucc = function handleRespSucc(xhr, requestType) {
var _a, _b, _c, _d;
try {
var responseText = xhr.responseText;
var resp = responseText;
if (obj.dataType === 'json') {
try {
if (JSON && JSON.parse) {
resp = JSON.parse(resp);
} else {
resp = eval("(".concat(resp, ")"));
monitor$1.setSum(523105, 127, 1).send();
}
var rtId = obj.rtId;
var rtKey = obj.rtKey || 0;
var rtDesc = obj.rtDesc;
if (rtId && rtDesc && RespTypes && !RespTypes.check(resp, rtDesc)) {
reportRt(+rtId, +rtKey, "".concat(RespTypes.getMsg(), "[detail]").concat(responseText, ";").concat(obj.url));
}
if (resp && resp.base_resp && ((_a = resp.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) {
var reportUrl = url;
if (url.indexOf('?') !== -1) {
reportUrl = url.substring(0, url.indexOf('?'));
if (Url.getQuery('action', url)) {
reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', url));
}
}
if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resp.base_resp.ret === 'undefined')) {
window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resp.base_resp.ret), {
mid: window.PAGE_MID,
view: 'wap_retcode'
});
}
}
} catch (e) {
obj.error && obj.error(xhr, {
type: 1,
error: e,
status: xhr.status
});
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 1,
HttpCode: xhr.status || 0,
Ret: 0
});
}
return;
}
}
if (_typeof(resp) === 'object' && ((_b = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _b === void 0 ? void 0 : _b.ret) !== 0) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 4,
HttpCode: xhr.status || 0,
Ret: ((_c = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0
});
}
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 0,
HttpCode: xhr.status || 0,
Ret: ((_d = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _d === void 0 ? void 0 : _d.ret) || 0
});
}
}
obj.success && obj.success(resp);
} catch (e) {
__moon_report({
offset: MOON_AJAX_SUCCESS_OFFSET,
e: e
});
throw e;
}
};
var handleRespErr = function handleRespErr(xhr, error, requestType) {
try {
obj.error && obj.error(xhr, {
type: 2,
error: error,
status: xhr.status
});
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type,
RequestType: requestType,
RetType: 2,
HttpCode: xhr.status,
Ret: 0
});
}
} catch (e) {
__moon_report({
offset: MOON_AJAX_ERROR_OFFSET,
e: e
});
throw e;
}
};
var handleRespComplete = function handleRespComplete() {
clearTimeout(timer);
try {
obj.complete && obj.complete();
} catch (e) {
__moon_report({
offset: MOON_AJAX_COMPLETE_OFFSET,
e: e
});
throw e;
}
obj.complete = null;
};
var handleReqTimeout = function handleReqTimeout(xhr) {
if (typeof obj.timeout !== 'undefined') {
timer = setTimeout(function () {
xhr.abort();
try {
obj.complete && obj.complete();
} catch (e) {
__moon_report({
offset: MOON_AJAX_COMPLETE_OFFSET,
e: e
});
throw e;
}
obj.complete = null;
__moon_report({
offset: MOON_AJAX_TIMEOUT_OFFSET,
log: "ajax_timeout_error: ".concat(url),
e: ''
});
}, obj.timeout);
}
};
var retryXhrFn = function retryXhrFn(res, isTimeout, reqLogItem) {
var retryXhr = new XMLHttpRequest();
try {
retryXhr._noVConsole = true;
} catch (err) {}
retryXhr.open(type, url);
retryXhr.onreadystatechange = function () {
if (isTimeout) return;
if (retryXhr.readyState === 3) {
obj.received && obj.received(retryXhr);
}
if (retryXhr.readyState === 4) {
beforeResp(retryXhr);
var retryStatus = retryXhr.status;
if (retryStatus >= 200 && retryStatus < 400) {
handleRespSucc(retryXhr, 1);
} else {
handleRespErr(retryXhr, res, 1);
window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure', JSON.stringify({
retryXhrStatus: retryStatus,
transferRes: res
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
}
reqLogItem.status = retryStatus;
reqLogItem.endTime = Date.now();
reqLogItem.response = retryXhr.responseText;
handleRespComplete();
networkEndLog(reqLogItem);
}
};
setXhrHeader(retryXhr, type, obj);
retryXhr.send(data);
};
if (ajaxScope && !obj.pureHttp) {
var header = {
'User-Agent': navigator.userAgent,
'Cookie': (window.__test_env__ ? 'uniproxy_route=1; ' : '') + document.cookie,
'Referer': location.href
};
if (obj.contentType) {
header['Content-Type'] = obj.contentType;
} else if (type === 'POST') {
header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
if (!obj.noXRequestedWidthHeader) {
header['X-Requested-With'] = 'XMLHttpRequest';
}
var reqUrl = new URL(url, location.href).href;
var method = METHOD_ENUM[type] || 0;
var params = Device.os.pc ? {
url: reqUrl,
req_json: data || '',
scope: ajaxScope,
webcgi_method: method,
webcgi_header: Object.keys(header).map(function (headerItemKey) {
return Device.os.Mac ? _defineProperty({}, headerItemKey, header[headerItemKey]) : {
key: headerItemKey,
value: header[headerItemKey]
};
}),
cgi_type: 1
} : {
reqUrl: reqUrl,
reqBody: data,
scope: ajaxScope,
method: method,
header: header
};
var reqLogItem = networkStartLog({
method: type,
url: url,
postData: obj.data || {},
requestHeader: header,
requestType: 'transfer',
startTime: Date.now(),
responseType: url.indexOf('f=json') > 0 ? 'json' : undefined
});
var isTimeout = false;
handleReqTimeout({
abort: function abort() {
isTimeout = true;
reqLogItem.endTime = Date.now();
reqLogItem.response = 'timeout';
networkEndLog(reqLogItem);
}
});
Device.os.pc && monitor$1.setSum(115849, 69, 1);
JSAPI.invoke(Device.os.pc ? 'H5ExtTransfer' : 'webTransfer', params, function (res) {
var _a, _b, _c, _d, _e, _f;
if (isTimeout) return;
var status = 400;
var result = '';
if (Device.os.pc) {
try {
var retFlag = res.base_resp.ret === 0 && res.jsapi_resp.ret === 0 && res.err_msg.indexOf(':ok') > -1;
var respJsonFlag = res.jsapi_resp.resp_json;
status = retFlag && respJsonFlag ? 200 : 400;
result = res.jsapi_resp.resp_json;
} catch (err) {
console.error(err);
}
} else {
status = res && res.errCode * 1 === 0 && typeof res.result === 'string' && res.result ? 200 : 400;
result = res.result;
}
try {
Log.log("ajax transfer, status: ".concat(status, ", reqUrl: ").concat(reqUrl));
} catch (err) {
console.error(err);
}
if (status >= 200 && status < 400) {
obj.received && obj.received(null);
beforeResp({
status: status
});
handleRespSucc({
status: status,
responseText: result
}, 10);
reqLogItem.status = status;
reqLogItem.endTime = Date.now();
reqLogItem.response = result;
handleRespComplete();
networkEndLog(reqLogItem);
} else if (window.__second_open__) {
JSAPI.invoke('request', {
url: reqUrl,
method: type,
data: data,
header: header
}, function (retryRes) {
try {
Log.log("ajax retry request, retryStatus: ".concat((retryRes === null || retryRes === void 0 ? void 0 : retryRes.statusCode) || '', ", reqUrl: ").concat(reqUrl));
} catch (err) {
console.error(err);
}
if (isTimeout) return;
var retryStatus = retryRes.statusCode;
obj.received && obj.received(null);
beforeResp({
status: retryStatus
});
if (retryRes.err_msg.indexOf(':ok') > -1 && retryStatus >= 200 && retryStatus < 400) {
handleRespSucc({
status: retryStatus,
responseText: retryRes.data
}, 20);
} else {
retryXhrFn(res, isTimeout, reqLogItem);
handleRespErr({
status: retryStatus
}, res, 20);
window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure_sec_open', JSON.stringify({
retryReqJsapiRes: retryRes,
transferRes: res,
url: reqUrl
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
}
reqLogItem.status = retryStatus;
reqLogItem.endTime = Date.now();
reqLogItem.response = retryRes.data;
handleRespComplete();
networkEndLog(reqLogItem);
});
} else {
retryXhrFn(res, isTimeout, reqLogItem);
}
if (Device.os.pc) {
if (!res.err_msg.includes(':ok')) {
(_b = (_a = window.WX_BJ_REPORT) === null || _a === void 0 ? void 0 : _a.BadJs) === null || _b === void 0 ? void 0 : _b.report("pc transfer res no ok: ".concat(res.err_msg), params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
try {
if (res.jsapi_resp.resp_json && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 0 && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 190001 || res.base_resp.ret !== 0 || res.jsapi_resp.ret !== 0) {
(_d = (_c = window.WX_BJ_REPORT) === null || _c === void 0 ? void 0 : _c.BadJs) === null || _d === void 0 ? void 0 : _d.report("pc transfer res invalid ret", params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
} catch (err) {}
} else {
try {
if (res.errCode !== 0) {
(_f = (_e = window.WX_BJ_REPORT) === null || _e === void 0 ? void 0 : _e.BadJs) === null || _f === void 0 ? void 0 : _f.report("mobile transfer res invalid ret", params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
} catch (err) {}
}
});
beforeReq();
return;
}
var xhr = new XMLHttpRequest();
var mayAbort = !!obj.mayAbort;
var async = typeof obj.async === 'undefined' ? true : obj.async;
var _onreadystatechange = xhr.onreadystatechange;
xhr.open(type, url, async);
xhr.onreadystatechange = function () {
if (typeof _onreadystatechange === 'function') {
_onreadystatechange.apply(xhr);
}
if (xhr.readyState === 3) {
obj.received && obj.received(xhr);
}
if (xhr.readyState === 4) {
beforeResp(xhr);
xhr.onreadystatechange = null;
var status = xhr.status;
if (status >= 200 && status < 400) {
handleRespSucc(xhr, 1);
} else {
handleRespErr(xhr, 'status error', 1);
if (!!status || !mayAbort) {
var __ajaxtest = window.__ajaxtest || '0';
__moon_report({
offset: MOON_AJAX_NETWORK_OFFSET,
log: "ajax_network_error[".concat(status, "][").concat(__ajaxtest, "]: ").concat(url, ";host:").concat(location.host),
e: ''
});
}
}
handleRespComplete();
}
};
setXhrHeader(xhr, type, obj);
handleReqTimeout(xhr);
try {
xhr.send(data);
try {
if (url && url.length > LENGTH_LIMIT) {
reportAjaxLength(27613, 17, "ajax get limit[length: ".concat(url.length, "]").concat(url.substring(0, 1024)));
}
if (data && !(data instanceof Blob) && data.length > LENGTH_LIMIT) {
reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.length, "]").concat(data.substring(0, 1024)));
}
if (data && data instanceof Blob && data.size > LENGTH_LIMIT) {
reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.size, "]blob"));
}
} catch (e) {
}
} catch (e) {
obj.error && obj.error(xhr, {
type: 3,
error: e,
status: 0
});
}
beforeReq();
});
}
mmVersion.isWindowsWechat && mmVersion.compareHexVersion('0xf2550000') || mmVersion.isMacWechat && mmVersion.compareHexVersion('0xf2650000');
var getBrandServiceType = function getBrandServiceType() {
var serviceType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.service_type;
var _a, _b;
var brandServiceType = 0;
if (serviceType !== undefined) brandServiceType = serviceType + 1;
if (((_b = (_a = window.cgiData) === null || _a === void 0 ? void 0 : _a.trans_appmsg_info) === null || _b === void 0 ? void 0 : _b.trans_type) * 1 === 1) brandServiceType = 3;
return brandServiceType;
};
function setCurrentMpInfo(ifShow) {
var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true) || mmVersion.isAndroid && mmVersion.gtVersion('7.0.12', true);
var supportLiveStatus = mmVersion.isIOS && mmVersion.gtVersion('8.0.46', true) || mmVersion.isAndroid && mmVersion.gtVersion('8.0.46', true);
JSAPI.invoke('currentMpInfo', {
userName: window.user_name,
brandName: !!supportNewTopBar && window.nickname === '' ? '未命名账号' : window.title,
title: window.msg_title || '',
brandIcon: window.hd_head_img.replace(/\/0$/, '/132'),
itemShowType: window.item_show_type,
isPaySubscribe: window.isPaySubscribe,
topBarStyle: supportNewTopBar ? 1 : 0,
topBarShowed: ifShow,
disableShowFinderLiveTopBar: !ifShow && supportLiveStatus ? 1 : 0,
brandServiceType: getBrandServiceType()
}, function () {});
}
function AjaxWx(obj) {
var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {};
obj.url += obj.url.indexOf('?') === -1 ? '?fasttmplajax=1' : '&fasttmplajax=1';
if (getAjaxScope(obj.url)) {
Ajax(obj);
return;
}
if (obj.usePb) {
obj.type = 'POST';
obj.data = {
data: JSON.stringify(obj.data)
};
}
if (!/^(http:\/\/|https:\/\/|\/\/)/.test(obj.url)) {
obj.url = "https://mp.weixin.qq.com/".concat(obj.url.replace(/^\//, ''));
} else if (/^\/\//.test(obj.url)) {
obj.url = "https:".concat(obj.url);
}
if (obj.f !== 'html' && (obj.url.indexOf('?f=json') === -1 || obj.url.indexOf('&f=json') === -1)) {
obj.url += '&f=json';
}
if (!obj.notJoinUrl && obj.f !== 'html') {
obj.url = Url.joinUrl(obj.url);
}
Url.joinUserArticleRole(obj.url, !!obj.notJoinUrl, function (url) {
obj.url = url;
var urlObj = new URL(url, location.origin);
var data = null;
if (_typeof(obj.data) === 'object') {
var d = obj.data;
var ds = [];
for (var k in d) {
if (d.hasOwnProperty(k)) {
ds.push("".concat(k, "=").concat(encodeURIComponent(d[k])));
}
}
data = ds.join('&');
} else {
data = typeof obj.data === 'string' ? obj.data : null;
}
var header = {
Cookie: document.cookie,
referer: location.href
};
if (obj.contentType) {
header['Content-Type'] = obj.contentType;
} else if ((obj.type || 'GET').toUpperCase() === 'POST') {
header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
var reqLogItem = networkStartLog({
method: obj.type || 'GET',
url: obj.url,
postData: obj.data || {},
requestHeader: header,
requestType: 'jsapi',
startTime: Date.now()
});
var retryTime = 1;
var jsapiRequest = function jsapiRequest(obj, data) {
return JSAPI.invoke('request', {
url: obj.url,
method: obj.type,
data: data,
header: header
}, function (res) {
var _a, _b, _c, _d, _e, _f;
if (res.err_msg.indexOf(':ok') > -1 && (!res.statusCode || res.statusCode >= 200 && res.statusCode < 400)) {
if (reqType(obj, '/mp/getappmsgext')) {
window.receiveGetAppmsgExt = "".concat(res.statusCode, "|").concat(Date.now());
}
if (reqType(obj, '/mp/getappmsgad')) {
window.receiveGetAppmsgAd = "".concat(res.statusCode, "|").concat(Date.now());
}
if (retryTime === 1) {
obj.received && obj.received(null);
}
var resData = {};
if (res.data) {
try {
if (obj.dataType === 'json') {
resData = JSON.parse(res.data);
} else {
resData = res.data;
}
if (resData && resData.base_resp && ((_a = resData.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) {
var reportUrl = obj.url;
if (obj.url.indexOf('?') !== -1) {
reportUrl = obj.url.substring(0, obj.url.indexOf('?'));
if (Url.getQuery('action', obj.url)) {
reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', obj.url));
}
}
if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resData.base_resp.ret === 'undefined')) {
window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resData.base_resp.ret), {
mid: window.PAGE_MID,
view: 'wap_retcode'
});
}
}
} catch (e) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: ((_b = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _b === void 0 ? void 0 : _b.ret) || 0
});
}
console.error(e);
obj.error && obj.error(null, {
type: 1,
error: e,
status: res.statusCode
});
obj.complete && obj.complete();
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
return;
}
}
var tmpResData = {};
try {
tmpResData = JSON.parse(res.data);
} catch (e) {}
if (tmpResData && tmpResData.base_resp && tmpResData.base_resp.ret === -3 && retryTime < 2 && (mmVersion.isIOS || mmVersion.isAndroid && mmVersion.getInner() > '27000600')) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: ((_c = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0
});
}
var _retryTime = retryTime++;
JSAPI.invoke('updatePageAuth', {}, function (res) {
console.log('[skeleton] updatePageAuth', res);
monitor$1.setSum(112287, 3, 1);
if (res && res.err_msg && res.err_msg.indexOf(':ok') > -1) {
window.top.pass_ticket = encodeURIComponent(Url.getQuery('pass_ticket', res.fullUrl).html(false).replace(/\s/g, '+'));
if (obj.pass_ticket) {
obj.pass_ticket = window.top.pass_ticket;
}
console.warn('[skeleton] updatePageAuth resetTopbar');
var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true);
var showBottomBar = !!window.is_login;
if (window.top.item_show_type === '0' && supportNewTopBar) {
var top = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0;
setCurrentMpInfo(top > 40 && !showBottomBar);
}
try {
obj.url = Url.addParam(obj.url, 'retry', _retryTime, true);
} catch (err) {
console.error(err);
}
jsapiRequest(obj, data);
monitor$1.setSum(112287, 4, 1);
} else {
obj.success && obj.success(resData);
obj.complete && obj.complete();
if (mmVersion.isIOS) {
monitor$1.setSum(112287, 35, 1);
} else {
monitor$1.setSum(112287, 36, 1);
}
reqLogItem.status = 200;
reqLogItem.endTime = Date.now();
reqLogItem.response = resData;
networkEndLog(reqLogItem);
}
});
} else {
if (((_d = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _d === void 0 ? void 0 : _d.ret) !== 0) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 4,
HttpCode: res.statusCode || 0,
Ret: ((_e = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _e === void 0 ? void 0 : _e.ret) || 0
});
}
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 0,
HttpCode: res.statusCode || 0,
Ret: ((_f = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _f === void 0 ? void 0 : _f.ret) || 0
});
}
}
obj.success && obj.success(resData);
obj.complete && obj.complete();
reqLogItem.status = 200;
reqLogItem.endTime = Date.now();
reqLogItem.response = resData;
networkEndLog(reqLogItem);
}
} else if (res.err_msg.indexOf('no permission') > -1 || !mmVersion.isOnlyWechat) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: 0
});
}
Ajax(obj);
if (res.err_msg.indexOf('no permission') > -1) {
console.warn('[JSAPI Request] No permission');
monitor$1.setSum(112287, 31, 1);
}
reqLogItem.status = 302;
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 2,
HttpCode: res.statusCode || 0,
Ret: 0
});
}
obj.error && obj.error(null, {
type: 3,
error: res,
status: 0
});
obj.complete && obj.complete();
monitor$1.setSum(112287, 32, 1);
var sample = 0.001;
if (Math.random() < sample) {
var msg = "request: ".concat(JSON.stringify(obj.type), " ").concat(JSON.stringify(obj.url), " ;;;; cookie: ").concat(JSON.stringify(document.cookie), " ;;;; data: ").concat(JSON.stringify(data), " ;;;; resp: ").concat(JSON.stringify(res));
if (window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) {
window.WX_BJ_REPORT.BadJs.report('ajax_wx_request_error', msg, {
mid: 'mmbizwap:Monitor'
});
}
}
reqLogItem.status = 400;
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
}
});
};
if (reqType(obj, '/mp/getappmsgext')) {
window.startGetAppmsgExtTime = Date.now();
}
if (reqType(obj, '/mp/getappmsgad')) {
window.startGetAppmsgAdTime = Date.now();
}
jsapiRequest(obj, data);
});
}
function _regeneratorRuntime() { _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var AjaxRouter = function () {
var _ref = _asyncToGenerator( _regeneratorRuntime().mark(function _callee(obj) {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!window.__secPageAuthPromise) {
_context.next = 3;
break;
}
_context.next = 3;
return window.__secPageAuthPromise;
case 3:
if (!(!mmVersion.isWxWork && (window.__second_open__ || !getIsAcrossOrigin() && top.window.__second_open__) && window.__is_page_auth_return__ && !obj.pureHttp)) {
_context.next = 5;
break;
}
return _context.abrupt("return", AjaxWx(obj));
case 5:
return _context.abrupt("return", Ajax(obj));
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return function AjaxRouter(_x) {
return _ref.apply(this, arguments);
};
}();
var isx5 = navigator.userAgent.indexOf('TBS/') !== -1;
var getDataFunc = [];
var reportData = [];
var specificData = {};
function joinUrl(url) {
var obj = {};
if (typeof window.uin !== 'undefined') {
obj.uin = window.uin;
}
if (typeof window.key !== 'undefined') {
obj.key = window.key;
}
if (typeof window.pass_ticket !== 'undefined') {
obj.pass_ticket = window.pass_ticket;
}
if (typeof window.wxtoken !== 'undefined') {
obj.wxtoken = window.wxtoken;
}
if (typeof window.devicetype !== 'undefined') {
obj.devicetype = window.devicetype;
}
if (typeof window.clientversion !== 'undefined') {
obj.clientversion = window.clientversion;
}
if (typeof window.appmsg_token !== 'undefined') {
obj.appmsg_token = window.appmsg_token;
} else if (url.indexOf('advertisement_report') > -1) {
new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random());
}
obj.x5 = isx5 ? '1' : '0';
obj.f = 'json';
return Url.join(url, obj);
}
function isObj(obj) {
return obj && _typeof(obj) === 'object';
}
function assign(target, source) {
if (isObj(target) && isObj(source)) {
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
function assembleReportData(initiative) {
var leaveReportLog = [];
leaveReportLog.push({
content: "[LeaveReport] specificData keys: ".concat(Object.keys(specificData)),
timestamp: Date.now()
});
Log.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData)));
console.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData)));
var allReportData = {};
for (var reportField in specificData) {
if (!allReportData[reportField]) {
allReportData[reportField] = {};
}
for (var i = 0; i < specificData[reportField].length; i++) {
var param = specificData[reportField][i];
if (typeof param === 'function') {
try {
assign(allReportData[reportField], param(initiative));
} catch (err) {
leaveReportLog.push({
content: "[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)),
timestamp: Date.now()
});
Log.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)));
console.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)));
}
} else if (isObj(param)) {
assign(allReportData[reportField], param);
}
}
}
leaveReportLog.push({
content: "[LeaveReport] reportData.length: ".concat(reportData.length),
timestamp: Date.now()
});
Log.log("[LeaveReport] reportData.length: ".concat(reportData.length));
console.log("[LeaveReport] reportData.length: ".concat(reportData.length));
leaveReportLog.push({
content: "[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length),
timestamp: Date.now()
});
Log.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length));
console.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length));
for (var _i = 0; _i < getDataFunc.length; _i++) {
try {
var data = getDataFunc[_i](initiative);
if (isObj(data)) {
reportData.push(data);
}
} catch (err) {
leaveReportLog.push({
content: "[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)),
timestamp: Date.now()
});
Log.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)));
console.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)));
}
}
for (var _i2 = 0; _i2 < reportData.length; _i2++) {
if (reportData[_i2].reportUrl) {
reportData[_i2].reportUrl = joinUrl(reportData[_i2].reportUrl);
}
}
allReportData.data = {
'requestList': reportData
};
leaveReportLog.push({
content: "[LeaveReport] final reportData.length: ".concat(reportData.length, ", data=").concat(JSON.stringify(reportData)),
timestamp: Date.now()
});
Log.log("[LeaveReport] final reportData.length: ".concat(reportData.length));
console.log("[LeaveReport] final reportData.length: ".concat(reportData.length));
allReportData.info = leaveReportLog;
return allReportData;
}
function addReport(param) {
if (typeof param === 'function') {
getDataFunc.push(param);
} else if (isObj(param)) {
reportData.push(param);
}
}
function addSpecificReport(reportField, param) {
if (!specificData[reportField]) {
specificData[reportField] = [];
}
specificData[reportField].push(param);
}
function reportNow(callback) {
var allReportData = assembleReportData(true);
JSAPI.invoke('handleMPPageAction', {
action: 'reportByLeaveForMPGateway',
reportData: allReportData
}, function (res) {
if (res && res.err_msg && res.err_msg.indexOf(':ok') !== -1) {
getDataFunc = [];
reportData = [];
specificData = {};
typeof callback === 'function' && callback(res);
} else {
getDataFunc = [];
reportData = [];
var len = allReportData.data.requestList.length;
allReportData.data.requestList.forEach(function (req) {
if (req.reportUrl) {
AjaxRouter({
type: req.method || 'GET',
url: req.reportUrl,
data: req.reportData,
async: false,
success: function success(resp) {
if (--len < 0) {
typeof callback === 'function' && callback({
err_msg: 'handleMPPageAction:ok',
fallback: true,
resp: resp
});
}
},
error: function error(xhr, err) {
if (--len < 0) {
typeof callback === 'function' && callback({
err_msg: 'handleMPPageAction:fail',
fallback: true,
err: err
});
}
}
});
}
});
}
});
}
var leaveReport = {
reportNow: reportNow,
addReport: addReport,
addSpecificReport: addSpecificReport
};
var _leaveReport = (function () {
var doc = {};
var isCrossOrigin = false;
try {
doc = top.window.document;
} catch (e) {
isCrossOrigin = true;
}
if (!isCrossOrigin && top.window.__leaveReport) {
return top.window.__leaveReport;
}
if (window.__leaveReport) {
return window.__leaveReport;
}
JSAPI.on('reportOnLeaveForMP', function () {
return assembleReportData(false);
});
return window.__leaveReport = leaveReport;
})();
var getReportJson = function getReportJson(logId, rawData) {
var data = JSON.parse(JSON.stringify(rawData));
data.log_id = Number(logId);
data.TimeStamp = Math.round(Date.now() / 1000);
console.log('[comm_report] reportjson: ', data);
return JSON.stringify(data);
};
var getSuccessHandler = function getSuccessHandler(logId, data, opt) {
return function (res) {
if (res && res.err_code !== 0) {
console.warn("[comm_report] report ".concat(logId, " fail: "), res.err_msg, data);
}
if (typeof opt.success === 'function') {
opt.success(res);
}
};
};
var getErrorHandler = function getErrorHandler(logId, data, opt) {
return function (xhr, info) {
console.error("[comm_report] report ".concat(logId, " error: "), info, data);
if (typeof opt.error === 'function') {
opt.error(xhr, info);
}
};
};
var batchReportDataArr = [];
var blackLogId = [25587, 18832, 28208, 25574, 29139, 10945];
var BATCH_SIZE = 4;
var BATCH_TIME = 1000;
var getRepeatedReportJson = function getRepeatedReportJson() {
if (!batchReportDataArr || !batchReportDataArr.length) return false;
var reportData = {
count: 0
};
reportData.count = batchReportDataArr.length;
batchReportDataArr.forEach(function (data, index) {
reportData["reportjson".concat(index)] = data;
});
batchReportDataArr = [];
console.log('[reportData]: ', reportData);
return reportData;
};
var timeOutId;
function batchReport() {
if (!batchReportDataArr || !batchReportDataArr.length) return;
var repeatedReportJson = getRepeatedReportJson();
if (!repeatedReportJson) return;
AjaxRouter({
type: 'POST',
dataType: 'json',
url: '/mp/wapcommreport?action=batch_report',
data: repeatedReportJson,
dontReport: true,
success: function success(res) {
if (res && res.err_code) {
console.warn("[comm_report] batch report fail: ", res.err_msg, batchReportDataArr);
}
},
error: function error(xhr, info) {
console.error("[comm_report] batch report error: ", info, batchReportDataArr);
}
});
}
function batchReportThrottle(logId, rawData) {
var reportJsonData = getReportJson(logId, rawData);
if (!reportJsonData) return;
batchReportDataArr.push(reportJsonData);
if (batchReportDataArr.length >= BATCH_SIZE) {
batchReport();
} else {
if (!timeOutId) {
timeOutId = setTimeout(function () {
batchReport();
clearTimeout(timeOutId);
timeOutId = null;
}, BATCH_TIME);
}
}
}
_leaveReport.addReport(function () {
var repeatedReportJson = getRepeatedReportJson();
if (!repeatedReportJson) return false;
var reportData = [];
for (var _i = 0, _Object$entries = Object.entries(repeatedReportJson); _i < _Object$entries.length; _i++) {
var _Object_i = _slicedToArray(_Object$entries[_i], 2),
key = _Object_i[0],
value = _Object_i[1];
reportData.push("".concat(key, "=").concat(encodeURIComponent(value)));
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport?action=batch_report',
reportData: reportData.join('&'),
method: 'POST'
};
});
var commReport = {
report: function report(logId, rawData, rawOpt) {
var opt = rawOpt || {};
if (!opt.realTime && !blackLogId.includes(logId)) {
batchReportThrottle(logId, rawData);
} else {
AjaxRouter({
type: 'POST',
dataType: 'json',
url: '/mp/wapcommreport',
data: {
reportjson: getReportJson(logId, rawData)
},
async: opt.async,
success: getSuccessHandler(logId, rawData, opt),
error: getErrorHandler(logId, rawData, opt)
});
}
},
leaveReport: function leaveReport(logId, rawData) {
_leaveReport.addReport(function () {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport',
reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))),
method: 'POST'
};
});
},
reportByBeacon: function reportByBeacon(logId, rawData) {
try {
if (!Device.os.android && !Device.os.ios && !Device.os.harmony) {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
var url = '/mp/wapcommreport';
var reportJsonData = encodeURIComponent(getReportJson(logId, data));
console.log("reportByBeacon", JSON.stringify(reportJsonData));
navigator.sendBeacon(Url.joinUrl(url), "reportjson=".concat(reportJsonData));
} else {
_leaveReport.addReport(function () {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport',
reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))),
method: 'POST'
};
});
}
} catch (error) {
console.log(error);
}
}
};
var html = function html(_str, encode) {
if (!_str) return '';
var replace = ['`', '`', ''', '\'', '"', '"', ' ', ' ', '>', '>', '<', '<', '¥', '¥', '&', '&', '<', '<', '>', '>'];
var replaceReverse = ['&', '&', '¥', '¥', '<', '<', '>', '>', ' ', ' ', '"', '"', '\'', ''', '`', '`'];
var str = _str;
var target;
if (encode) {
target = replaceReverse;
} else {
target = replace;
}
for (var i = 0; i < target.length; i += 2) {
str = str.replace(new RegExp(target[i], 'g'), target[i + 1]);
}
return str;
};
var htmlLite = function htmlLite(_str, encode) {
if (!_str) return '';
var replace = ['`', '`', ''', '\'', '"', '"', '>', '>', '<', '<', '&', '&'];
var replaceReverse = ['&', '&', '<', '<', '>', '>', '"', '"', '\'', ''', '`', '`'];
var str = _str;
var target;
if (encode) {
target = replaceReverse;
} else {
target = replace;
}
for (var i = 0; i < target.length; i += 2) {
str = str.replace(new RegExp(target[i], 'g'), target[i + 1]);
}
return str;
};
var htmlEncode = function htmlEncode(str) {
return html(str, true);
};
var htmlDecode = function htmlDecode(str) {
return html(str, false);
};
var htmlEncodeLite = function htmlEncodeLite(str) {
return htmlLite(str, true);
};
var htmlDecodeLite = function htmlDecodeLite(str) {
return htmlLite(str, false);
};
String.prototype.html = function (encode) {
return html(this.toString(), encode);
};
String.prototype.htmlEncode = function () {
return htmlEncode(this.toString());
};
String.prototype.htmlDecode = function () {
return htmlDecode(this.toString());
};
String.prototype.htmlLite = function (encode) {
return htmlLite(this.toString(), encode);
};
String.prototype.htmlEncodeLite = function () {
return htmlEncodeLite(this.toString());
};
String.prototype.htmlDecodeLite = function () {
return htmlDecodeLite(this.toString());
};
var isIOS = mmVersion.isIOS,
isAndroid = mmVersion.isAndroid;
var renderDom = function renderDom(dom, cnt, hasStar) {
if (dom) {
if (hasStar) {
dom.innerText = "已星标";
} else {
dom.innerText = "星标";
}
if (hasStar) {
dom.classList.add('rich_media_meta_star');
dom.classList.remove('rich_media_meta_star_cancel');
} else {
dom.classList.add('rich_media_meta_star_cancel');
dom.classList.remove('rich_media_meta_star');
}
dom.style.removeProperty('display');
localStorage.setItem('star_info', JSON.stringify({
mid: window.mid,
idx: window.idx,
has_star: !!hasStar
}));
}
};
var __setStar = function __setStar(dom, cnt, statStatus) {
var hasReportExpose = false;
var hasStar = statStatus;
var realCnt = cnt;
function addStar() {
var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
hasStar = 1;
realCnt = realCnt + 1;
renderDom(dom, realCnt, hasStar);
if (dispatchEvent) window.dispatchEvent(new CustomEvent('star'));
}
function cancelStar() {
var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
hasStar = 0;
realCnt = realCnt - 1;
renderDom(dom, realCnt, hasStar);
if (dispatchEvent) window.dispatchEvent(new CustomEvent('cancel-star'));
}
if (dom) {
renderDom(dom, cnt, statStatus);
var clickHander = function clickHander() {
if (hasStar === 0) {
JSAPI.invoke('operateStar', {
opType: 'addStar'
}, function (res) {
if (res.err_msg && /:ok$/.test(res.err_msg)) addStar();
});
} else {
JSAPI.invoke('operateStar', {
opType: 'cancelStar'
}, function (res) {
if (res.err_msg && /:ok$/.test(res.err_msg)) cancelStar();
});
}
var data = {
BizUin: window.biz,
AppMsgID: window.mid * 1,
ItemIndex: window.idx * 1,
Scene: window.scene,
SubScene: window.subscene * 1,
EnterId: window.enterid,
SessionId: "".concat(window.sessionid),
Event: hasStar ? 8 : 7,
ItemShowType: window.item_show_type * 1
};
commReport.report(17335, data);
};
var exposeHandler = function exposeHandler() {
if (hasReportExpose) return;
var data = {
BizUin: window.biz,
AppMsgID: window.mid * 1,
ItemIndex: window.idx * 1,
Scene: window.scene,
SubScene: window.subscene * 1,
EnterId: window.enterid,
SessionId: "".concat(window.sessionid),
Event: 6,
ItemShowType: window.item_show_type * 1
};
commReport.report(17335, data);
hasReportExpose = true;
};
dom.addEventListener('click', clickHander);
JSAPI.on('onPageStarStateChanged', function (res) {
console.log('onPageStarStateChanged', res);
if (res.state) addStar();else cancelStar();
window.__hasStarInLifecycle = !!hasStar;
});
var intersectionObserver = new IntersectionObserver(exposeHandler);
intersectionObserver.observe(dom);
window.addEventListener('star', function (e) {
if (e && e.detail && e.detail.from === 'frontend') addStar(false);
});
window.addEventListener('cancel-star', function (e) {
if (e && e.detail && e.detail.from === 'frontend') cancelStar(false);
});
document.addEventListener('visibilitychange', function () {
var visible = document.visibilityState === 'visible';
if (!visible) return;
window.__hasStarInLifecycle = !!hasStar;
});
}
};
if (!window.__second_open__) {
var starDom = document.querySelector('#js_star');
var canUseStar = window.canUseStar || isIOS && mmVersion.compareHexVersion('18003623') || isAndroid && mmVersion.compareHexVersion('28003630');
var startPersonCnt = window.star_person_cnt || '';
console.log('canUseStar, startPersonCnt', canUseStar, startPersonCnt);
if (!!(canUseStar * 1)) {
var starSwitch = localStorage.getItem('mp_star_switch');
if (starSwitch === 'true') {
var starInfo = localStorage.getItem('star_info');
var hasStar = 0;
if (starInfo) {
var parseStarInfo = JSON.parse(starInfo);
if (Number(parseStarInfo.mid) === Number(window.mid) && Number(parseStarInfo.idx) === Number(window.idx) && parseStarInfo.has_star) {
hasStar = 1;
}
}
starDom && renderDom(starDom, startPersonCnt * 1, hasStar);
var spanElement = document.getElementById('meta_content_hide_info');
spanElement && spanElement.classList.remove('rich_media_meta_padding');
} else {
starDom && starDom.parentNode.removeChild(starDom);
}
} else {
starDom && starDom.parentNode.removeChild(starDom);
}
window.__setStar = __setStar;
}
exports.__setStar = __setStar;
exports.renderDom = renderDom;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
})({});
天湖园博酒店
💰劲爆预售价:¥699 (¥1388)
园艺尊享大床房 2 晚(连住) + 早餐 2 份/天 + 下午茶 1 份 + 欢迎水果 1 份 + 迷你吧 1 份 + 天湖景区门票1张 4 份 有效期到2026年12月31日离店。全程可约不加价! ![图片]()
这家藏在温州的宝藏酒店很适合短途山野休闲!步行13分钟逛天湖、15分钟闲逛大月湾,自驾5分钟打卡刘伯温故里、6分钟奔赴百丈漈,四周山林环绕,满目青翠清幽。42㎡尊享大床配全景落地玻璃窗,原木简约客房静谧舒服。套餐权益丰厚,午后可以静享精致下午茶,还附赠4张天湖景区入园票,吃住玩乐全包。日历房两晚的价格要1300多,现在套餐价才699,差不多打了对折!关键是端午、暑假、中秋和国庆等热门日期都不加价,快囤~
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥699园艺高级双床房 2 晚(连住) + 早餐 2 份/天
成都尧棠公馆-全球奢华精品酒店
💰劲爆预售价:¥1588起 (¥2288)
棠厢大床房 2 晚(可拆分) + 早餐 2 份/天 + 迷你吧 1 份/天 + 旅拍礼包拍摄含3张精修照片及万昌洋服号服装试穿拍摄(未使用不可折现) 1 份/天 有效期到2026年12月31日离店。端午、暑假、中秋不加价!10.1-10.4加价200元/间/晚。 ![图片]()
这家尧棠公馆可不一般,是成都第一家SLH酒店,以巴金《家》中李家公馆为灵感,将民国式复古腔调拿捏到位,巴金先生的文学元素也随处可见,又融入了老成都鸟笼、麻将等传统韵味;强烈安利玻璃顶的天井和旋转楼梯,真是谁拍谁好看!酒店位置很好,7分钟逛锦城湖、14分钟直达铁像寺水街。房间有落地窗、宝格丽的洗漱用品!套餐同款房型平时两晚要2200+,现在1588就能入住,还送超值双人旅拍礼包,不用额外花钱就能拍复古写真,太划算了!点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1588起棠厢双床房 2 晚(可拆分) + 早餐 2 份/天
来成都玩也可以看看这家——成都锦城原舍酒店(锦里武侯祠店)!酒店就在锦里武侯祠文旅核心区,整体禅茶新中式装修,满满三国文化氛围感。出门步行3分钟即达高升桥地铁站,11分钟漫步至武侯祠、15分钟闲逛锦里古街,紧邻罗马假日广场。住在古街旁既能沉浸式打卡三国人文古迹,出门就能吃透成都地道烟火美食。平时日历房两晚要800多,现在499就能住,便宜了300多!可约日期都不加价哦~
还有其他好价套餐可选:
价格¥499雅居大床房(小度音箱+记忆枕+小冰箱) 2 晚(可拆分)
上海临港锦江国际酒店
💰劲爆预售价:¥1388 (¥2186)
城景豪华双床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份 有效期到2026年09月30日离店。端午、暑假、中秋热门日期不加价! ![图片]()
酒店坐落在滴水湖畔,步行2分钟抵达临港中心、4分钟直达临港演艺中心,顺路就可以打卡中国航海博物馆、滴水湖公园。高层客房在窗边就能欣赏限定烟花与无人机大秀,酒店自带全套亲子游乐设施,遛娃观景一举两得。日历房含早两晚要1800+,现在1388即可连住两晚,差不多打了七七折!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1388城景豪华大床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份
苏州湾华邑温泉度假酒店
💰劲爆预售价:¥1299起 (¥1899)
高级大床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份 有效期到2026年09月30日离店。全程可约,七夕不加价,端午、中秋+200元/间/晚。 ![图片]()
洲际酒店集团旗下,软硬件没得挑,设计又带着点中式古典感,置身于吴江东太湖生态旅游度假区中,周边绿地湖水围绕,又有王焰温泉这样的大咖加持,不管是宅酒店还是出去玩,都很ok!套餐价算下来一晚650,还送温泉票,比日历价便宜300多! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1299起高级双床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份
杭州大运河马可波罗豪廷酒店
💰劲爆预售价:¥599 (¥1399)
城景双床房(金可儿床垫+全屋智能+智能马桶) 2 晚(连住) + 早餐 2 份/天 + 【豪廷食街双人中式套餐】 1 份 + 双人免费西湖往返班车(双店行李寄存) 1 份 + 免费升级豪庭双床房(视房量房态) 1 份 + 现磨咖啡 2 份 + 房间欢迎饮料2瓶 1 份 有效期到2026年12月30日离店,全程可约不加价! ![图片]()
酒店在拱墅区,附近有中大银泰城、万融城、万达广场等商场,距离拱宸桥、京杭大运河博物馆、小河直街历史文化街区等景点不远。现在买套餐还送西湖往返班车,而且优惠价599两晚比平常单晚400+便宜了不少! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥599豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)价格¥999行政套房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住) 价格¥699豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)
杭州湘湖保亿开元名都度假酒店
有效期到2026年09月29日离店,全程可约,端午、中秋不加价! 来杭州玩还可以看看这家,很适合亲子游!酒店靠近湘湖,去森泊也方便,一脚油门也就几分钟,而且套餐价里连门票都包了!内部环境设计感拉满,水镜连廊与天光倒影,随手出片!配套也很齐全、健身房、游泳馆应有尽有。套餐同款暑期要800/晚,套餐价便宜了200,很划算! 还有其他好价套餐可选:
价格¥599豪华大床房 1 晚 价格¥698豪华双床房 2 晚(可拆分)
隐居天目湖WEI酒店
💰劲爆预售价:¥1299起 (¥4599)
隐谧•雅韵双床房【隐居山湖】 2 晚(连住) + 早餐 2 份/天 + 每日MINI吧 1 份 + 鱼头套餐9折券 1 份 + 隐湖寻幽特调双人下午茶 1 份 + 每日传统文化活动体验 + 多媒体放映室观影 + 单车林间骑行和报恩禅寺游览 + 旅拍体验(赠3张精选电子版照片)+ 周日-周四视房量房态免费升级至高级房型 有效期到2026年10月01日离店,全程可约,热门日期加价见详情。 ![图片]()
酒店太会选址了,正对着天目湖!从13米挑高的大堂望出去,无边泳池衔接着浩渺的湖水,那视野简直惊艳!设计偏中式简约风,青瓦白墙,绿树木椅,品上一杯茶,灵魂都要飘香气了。酒店有专属的湖心亭,园内还设了一座露天影院,躺在星空下看一场电影,太惬意!平常一晚就要1300+,套餐价直接5折还送超多礼遇! 点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥1299起隐谧•雅韵大床房【雅致书香+分离式淋浴间】 2 晚(连住)
苏州东太湖皇冠假日酒店
💰劲爆预售价:¥999起 (¥1699)
高级房 超大床 2 晚(连住) 有效期到2026年08月31日离店。全程可约,周末不加价,端午+100元/间/晚。 ![图片]()
这家坐拥太湖新城核心商务区与商圈,而且紧邻苏州湾东地铁站,可直达苏州古城区及高铁苏州站。房间设计简约高级,将吴风雅韵与现代美学结合得很好!更不用说1.8米大床,房间足足50平,视野也很开阔。同款房型暑假要卖到700多,套餐价999两晚,省下来快500块! 点击下图,火速购买 👇👇👇 ![]()
南京南部新城丽笙酒店
💰劲爆预售价:¥1188起 (¥1698)
豪华双床房-全景落地窗带浴缸 2 晚(连住) + Kuksa下午茶 1 份 + 早餐 2 份/天 + 儿童自助早餐 1 份/天 + 迷你吧 1 份 + 欢迎水果 1 份 + 升级至甄选房(视房量房态) 1 份 + 提前至10:00入住(视房量房态) 1 份 + 延迟退房至14:00(视房量房态) 1 份 有效期到2026年09月01日离店。每周五、周六加价100元/间/晚。 ![图片]()
坐拥南部新城核心区位,临近大校场地铁站,距南京南站仅15分钟车程。紧邻京东MALL,雨花台,老门东历史街区等景点。客房以大校场百年航空文化为设计灵感,流畅线条交织怀旧质感与摩登氛围,空间感极强。日历房价格为600多一晚,套餐价为1100多,省下一顿午餐钱!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥618起豪华双床房-全景落地窗带浴缸 1 晚
宁波半山伴水渡假村
💰劲爆预售价:¥199起 (¥458)
清泉岗木屋双床房 1 晚 + 早餐 2 份/天 + 户外双人泳池门票(7月-9月) 1 份 + 2张中坡山森林公园门票 1 份 + 2张观顶湖门票 1 份 有效期到2026年09月24日离店。端午、每周六加价100元/间/晚。 ![图片]()
这个度假村藏于山林之间,距溪口站驾车约30分钟,出行便捷。酒店主打亲子度假,设有季节性开放的无边泳池、大型户外儿童乐园,配套棋牌室和各种拓展设施。酒店还配有八大项主题设施、100余项游乐项目还有德国原版引进的水晶塔!客房有一些是采用特色窑洞设计,还可携带宠物入住。平日日历房价格为400多1晚,套餐价格相当于4.3折,真的很划算!
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥299起清泉岗木屋双床房 1 晚 + 早餐 2 份/天
北海香格里拉大酒店
💰劲爆预售价:¥1199 (¥1588)
高级城景双床房-静览珠城繁华烟火 2 晚(连住) + 咖啡苑双人自助早餐 1 份/天 + 参观南珠博物馆(提供讲解服务) 1 份 + 亲子体验活动 1 份 + 提升至高级海景房(视房量房态而定,节假日不适用) 1 份 + 周六日银滩/客运港/侨港接送服务(固定时间) 1 份 + 精美旅拍(壮族服饰体验,赠3张照片) 1 份 有效期到2026年09月30日离店。端午可约,全程不加价! ![]()
酒店紧邻金滩,步行9分钟可达,距北海站驾车约19分钟,出行便捷。自带沙滩泳池与儿童乐园,入住可免费体验赶海活动,还能打卡海上日落栈道。平日日历房价格为600多1晚,现在2晚可立省一顿早餐!附送很多活动体验,还可根据房态情况免费升级房型!
点击下图,火速购买 👇👇👇 ![]()
北京首都宾馆
💰劲爆预售价:¥599起 (¥704)
B座标准遮窗客房 1 晚 + 延迟退房至14:00(视房量房态) 1 份 有效期到2026年08月31日离店。7月1日起,加价179元/间/晚。 ![图片]()
地处前门核心地段,步行7分钟可达前门大街,10分钟至崇文门地铁站、崇文门地铁站,前往天安门广场很便捷。酒店内部自带五千平中式园林,还可体验汉服换装及古风拍摄。直线距离不到1公里可达新世纪百货,购物吃喝都很方便。日历房价格800多1晚,现在不到600元,套餐省了200+,性价比拉满了~
点击下图,火速购买 👇👇👇 ![]()
中旅阿那亚九龙湖·公主酒店
💰劲爆预售价:¥599起 (¥1198)
公主大床房 1 晚 + 双早 1 份/天 + 美茵家庭中式套餐 1 份 + 畅游中旅阿那亚中心小镇/九龙湖生态公园 1 份 + 草坪畅玩飞盘 1 份 + 醉美夕阳·山湖日落和园区接驳车定时接送 1 份 有效期到2026年07月21日离店。每周五加价100元/间/晚,每周六加价200元/间/晚。 ![图片]()
坐落于九龙湖生态区,临近广州白云机场,自驾出行便捷。酒店以欧式典雅建筑和复古小镇群落为主体,呈现欧式浪漫风情,提供专属管家服务,配套季节性开放的室外景观泳池、室内恒温泳池、美茵餐厅和大堂吧,并设有大型儿童乐园和多种休闲项目。平日日历房价格为700多1晚,套餐价格便宜了150+!
点击下图,火速购买 👇👇👇 ![]()
![]()
天湖园博酒店
💰劲爆预售价:¥699 (¥1388)
园艺尊享大床房 2 晚(连住) + 早餐 2 份/天 + 下午茶 1 份 + 欢迎水果 1 份 + 迷你吧 1 份 + 天湖景区门票1张 4 份 有效期到2026年12月31日离店。全程可约不加价! ![图片]()
这家藏在温州的宝藏酒店很适合短途山野休闲!步行13分钟逛天湖、15分钟闲逛大月湾,自驾5分钟打卡刘伯温故里、6分钟奔赴百丈漈,四周山林环绕,满目青翠清幽。42㎡尊享大床配全景落地玻璃窗,原木简约客房静谧舒服。套餐权益丰厚,午后可以静享精致下午茶,还附赠4张天湖景区入园票,吃住玩乐全包。日历房两晚的价格要1300多,现在套餐价才699,差不多打了对折!关键是端午、暑假、中秋和国庆等热门日期都不加价,快囤~
点击下图,火速购买 👇👇👇 ![]()
还有其他好价套餐可选:
价格¥699园艺高级双床房 2 晚(连住) + 早餐 2 份/天
天湖园博酒店
这家藏在温州的宝藏酒店很适合短途山野休闲!步行13分钟逛天湖、15分钟闲逛大月湾,自驾5分钟打卡刘伯温故里、6分钟奔赴百丈漈,四周山林环绕,满目青翠清幽。42㎡尊享大床配全景落地玻璃窗,原木简约客房静谧舒服。套餐权益丰厚,午后可以静享精致下午茶,还附赠4张天湖景区入园票,吃住玩乐全包。日历房两晚的价格要1300多,现在套餐价才699,差不多打了对折!关键是端午、暑假、中秋和国庆等热门日期都不加价,快囤~
还有其他好价套餐可选:
价格¥699园艺高级双床房 2 晚(连住) + 早餐 2 份/天还有其他好价套餐可选:
成都尧棠公馆-全球奢华精品酒店
还有其他好价套餐可选:
价格¥1588起棠厢双床房 2 晚(可拆分) + 早餐 2 份/天
还有其他好价套餐可选:
来成都玩也可以看看这家——成都锦城原舍酒店(锦里武侯祠店)!酒店就在锦里武侯祠文旅核心区,整体禅茶新中式装修,满满三国文化氛围感。出门步行3分钟即达高升桥地铁站,11分钟漫步至武侯祠、15分钟闲逛锦里古街,紧邻罗马假日广场。住在古街旁既能沉浸式打卡三国人文古迹,出门就能吃透成都地道烟火美食。平时日历房两晚要800多,现在499就能住,便宜了300多!可约日期都不加价哦~
还有其他好价套餐可选:
价格¥499雅居大床房(小度音箱+记忆枕+小冰箱) 2 晚(可拆分)
还有其他好价套餐可选:
上海临港锦江国际酒店
酒店坐落在滴水湖畔,步行2分钟抵达临港中心、4分钟直达临港演艺中心,顺路就可以打卡中国航海博物馆、滴水湖公园。高层客房在窗边就能欣赏限定烟花与无人机大秀,酒店自带全套亲子游乐设施,遛娃观景一举两得。日历房含早两晚要1800+,现在1388即可连住两晚,差不多打了七七折!
还有其他好价套餐可选:
价格¥1388城景豪华大床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份
还有其他好价套餐可选:
价格¥1388城景豪华大床房 2 晚(连住) + 早餐 2 份/天 + 首轮mini bar(不含酒精饮料) 1 份 + 专享旅拍跟拍礼遇 1 份
苏州湾华邑温泉度假酒店
苏州湾华邑温泉度假酒店
还有其他好价套餐可选:
价格¥1299起高级双床房 2 晚(连住) + 早餐 2 份/天 + 双人温泉一次 1 份还有其他好价套餐可选:
还有其他好价套餐可选:
杭州大运河马可波罗豪廷酒店
还有其他好价套餐可选:
价格¥599豪廷大床房(金可儿床垫+零压枕+全屋智能+智能马桶) 2 晚(连住)还有其他好价套餐可选:
杭州湘湖保亿开元名都度假酒店
还有其他好价套餐可选:
价格¥599豪华大床房 1 晚 还有其他好价套餐可选:
还有其他好价套餐可选:
隐居天目湖WEI酒店
还有其他好价套餐可选:
价格¥1299起隐谧•雅韵大床房【雅致书香+分离式淋浴间】 2 晚(连住) 还有其他好价套餐可选:
苏州东太湖皇冠假日酒店
南京南部新城丽笙酒店
坐拥南部新城核心区位,临近大校场地铁站,距南京南站仅15分钟车程。紧邻京东MALL,雨花台,老门东历史街区等景点。客房以大校场百年航空文化为设计灵感,流畅线条交织怀旧质感与摩登氛围,空间感极强。日历房价格为600多一晚,套餐价为1100多,省下一顿午餐钱!
还有其他好价套餐可选:
还有其他好价套餐可选:
宁波半山伴水渡假村
这个度假村藏于山林之间,距溪口站驾车约30分钟,出行便捷。酒店主打亲子度假,设有季节性开放的无边泳池、大型户外儿童乐园,配套棋牌室和各种拓展设施。酒店还配有八大项主题设施、100余项游乐项目还有德国原版引进的水晶塔!客房有一些是采用特色窑洞设计,还可携带宠物入住。平日日历房价格为400多1晚,套餐价格相当于4.3折,真的很划算!
还有其他好价套餐可选:
还有其他好价套餐可选:
北海香格里拉大酒店
酒店紧邻金滩,步行9分钟可达,距北海站驾车约19分钟,出行便捷。自带沙滩泳池与儿童乐园,入住可免费体验赶海活动,还能打卡海上日落栈道。平日日历房价格为600多1晚,现在2晚可立省一顿早餐!附送很多活动体验,还可根据房态情况免费升级房型!
北京首都宾馆
地处前门核心地段,步行7分钟可达前门大街,10分钟至崇文门地铁站、崇文门地铁站,前往天安门广场很便捷。酒店内部自带五千平中式园林,还可体验汉服换装及古风拍摄。直线距离不到1公里可达新世纪百货,购物吃喝都很方便。日历房价格800多1晚,现在不到600元,套餐省了200+,性价比拉满了~
中旅阿那亚九龙湖·公主酒店
坐落于九龙湖生态区,临近广州白云机场,自驾出行便捷。酒店以欧式典雅建筑和复古小镇群落为主体,呈现欧式浪漫风情,提供专属管家服务,配套季节性开放的室外景观泳池、室内恒温泳池、美茵餐厅和大堂吧,并设有大型儿童乐园和多种休闲项目。平日日历房价格为700多1晚,套餐价格便宜了150+!
华南温德姆集团通兑2晚可拆分含早588元
超值特价¥588 ¥848
有效期到2026年08月31日离店
华南温德姆20城49店通兑覆盖长沙、张家界、武汉、广州等20座热门城市,49家门店随心任选,高铁中转、山林游玩、都市逛吃多种出行需求一站式适配,跨城出游灵活省心。
= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var doc$1 = {};
var isAcrossOrigin$1 = false;
var notFoundedMPPageAction = [];
var __moon_report$1 = window.__moon_report || function () {};
var MOON_JSAPI_KEY_OFFSET = 8;
try {
doc$1 = top.window.document;
} catch (e) {
isAcrossOrigin$1 = true;
}
if (!window.JSAPIEventCallbackMap) {
window.JSAPIEventCallbackMap = {};
}
function ready(onBridgeReady) {
var bridgeReady = function bridgeReady() {
try {
if (onBridgeReady) {
window.onBridgeReadyTime = window.onBridgeReadyTime || Date.now();
onBridgeReady();
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: 'ready',
e: e
}]);
throw e;
}
window.jsapiReadyTime = Date.now();
};
if (!isAcrossOrigin$1 && (typeof top.window.WeixinJSBridge === 'undefined' || !top.window.WeixinJSBridge.invoke)) {
if (doc$1.addEventListener) {
doc$1.addEventListener('WeixinJSBridgeReady', bridgeReady, false);
} else if (doc$1.attachEvent) {
doc$1.attachEvent('WeixinJSBridgeReady', bridgeReady);
doc$1.attachEvent('onWeixinJSBridgeReady', bridgeReady);
}
} else {
bridgeReady();
}
}
var invokeNotWaitA8key = ['notifyPageInfo', 'updatePageAuth'
];
var checkNotFoundedInvoke = function checkNotFoundedInvoke(methodName, args) {
if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && notFoundedMPPageAction.includes(args === null || args === void 0 ? void 0 : args.action)) {
return true;
}
return false;
};
function invoke$1(_x, _x2, _x3) {
return _invoke.apply(this, arguments);
}
function _invoke() {
_invoke = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee(methodName, args, callback) {
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__ && !invokeNotWaitA8key.includes(methodName))) {
_context.next = 3;
break;
}
_context.next = 3;
return window.__secPageAuthPromise;
case 3:
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object') {
alert('请在微信中打开此链接');
return false;
}
if (checkNotFoundedInvoke(methodName, args)) {
setTimeout(function () {
if (callback) {
callback.apply(window, [{
err_msg: "".concat(methodName, ":fail"),
err_desc: 'action isn\'t supported'
}]);
}
}, 0);
} else {
top.window.WeixinJSBridge.invoke(methodName, args, function () {
try {
for (var _len2 = arguments.length, rets = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
rets[_key2] = arguments[_key2];
}
var ret = rets[0];
var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : '';
if (['handleMPPageAction', 'handleVideoAction', 'handleHaokanAction'].indexOf(methodName) !== -1) {
var action = (args === null || args === void 0 ? void 0 : args.action) || '';
console.info('[system]', "[jsapi] invoke->".concat(methodName, ", action->").concat(action).concat(errMsg));
} else {
console.info('[system]', "[jsapi] invoke->".concat(methodName).concat(errMsg));
}
if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && ((ret === null || ret === void 0 ? void 0 : ret.err_desc) === 'action isn\'t supported' || (ret === null || ret === void 0 ? void 0 : ret.err_msg) === 'handleMPPageAction:fail action is not supported')) {
notFoundedMPPageAction.push(args === null || args === void 0 ? void 0 : args.action);
}
if (callback) {
callback.apply(window, rets);
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "invoke;methodName:".concat(methodName),
e: e
}]);
throw e;
}
});
}
});
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return _invoke.apply(this, arguments);
}
function call(_x4) {
return _call.apply(this, arguments);
}
function _call() {
_call = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee2(methodName) {
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__)) {
_context2.next = 3;
break;
}
_context2.next = 3;
return window.__secPageAuthPromise;
case 3:
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object') {
return false;
}
try {
top.window.WeixinJSBridge.call(methodName);
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "call;methodName:".concat(methodName),
e: e
}]);
throw e;
}
});
case 4:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _call.apply(this, arguments);
}
function on(eventName, callback) {
ready(function () {
if (isAcrossOrigin$1) return false;
if (_typeof(top.window.WeixinJSBridge) !== 'object' || !top.window.WeixinJSBridge.on) {
return false;
}
if (!window.JSAPIEventCallbackMap[eventName]) {
window.JSAPIEventCallbackMap[eventName] = [];
}
window.JSAPIEventCallbackMap[eventName].push(callback);
if (window.JSAPIEventCallbackMap[eventName].length > 1) {
return false;
}
top.window.WeixinJSBridge.on(eventName, function () {
try {
for (var _len = arguments.length, rets = new Array(_len), _key = 0; _key < _len; _key++) {
rets[_key] = arguments[_key];
}
var ret = rets[0];
var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : '';
console.info('[system]', "[jsapi] event->".concat(eventName).concat(errMsg));
if (window.JSAPIEventCallbackMap[eventName] && window.JSAPIEventCallbackMap[eventName].length) {
var result;
for (var i = 0; i < window.JSAPIEventCallbackMap[eventName].length; i++) {
result = window.JSAPIEventCallbackMap[eventName][i].apply(window, rets);
}
return result;
}
} catch (e) {
__moon_report$1([{
offset: MOON_JSAPI_KEY_OFFSET,
log: "on;eventName:".concat(eventName),
e: e
}]);
throw e;
}
});
});
}
function remove(eventName, callback) {
ready(function () {
if (!window.JSAPIEventCallbackMap[eventName]) {
return false;
}
var result = false;
for (var i = window.JSAPIEventCallbackMap[eventName].length - 1; i >= 0; i--) {
if (window.JSAPIEventCallbackMap[eventName][i] === callback) {
window.JSAPIEventCallbackMap[eventName].splice(i, 1);
result = true;
}
}
return result;
});
}
var JSAPI = {
ready: ready,
invoke: invoke$1,
call: call,
on: on,
remove: remove
};
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var ua = navigator.userAgent;
var is_ios = /(iPhone|iPad|iPod|iOS)/i.test(ua);
var is_wp = /Windows\sPhone/i.test(ua);
var is_android = /(Android)/i.test(ua);
var is_wechat = /MicroMessenger\/([\d\.]+)/i.test(ua);
var is_mac = /mac\sos/i.test(ua) && !is_ios;
var is_windows = /windows\snt/i.test(ua) && !is_wp;
var is_mpapp = /MPAPP\/([\d\.]+)/i.test(ua);
var is_ipad = /iPad/i.test(ua);
var is_windows_wechat = /WindowsWechat/i.test(ua);
var is_mac_wechat = /MacWechat/i.test(ua) || /wechat.*mac os/i.test(ua);
var is_prefetch = is_wechat && window.WeixinPrefecherJSBridge;
var is_donut_app = /SAAASDK/i.test(ua);
var is_harmony = /OpenHarmony|ArkWeb/i.test(ua);
var is_linux = /Linux\s/i.test(ua);
var xweb_match = ua.match(/XWEB\/([\d.]+)/i);
var xweb_version = xweb_match && xweb_match[1] ? parseInt(xweb_match[1], 10) : 0;
var is_unified_pc_wechat = /UnifiedPC\w+Wechat/i.test(ua);
var is_in_miniProgram = is_android && /miniprogram/.test(ua.toLowerCase()) || window.__wxjs_environment == 'miniprogram';
var is_wx_work = /wxwork/i.test(ua);
function getUrlParams() {
var vars = location.search.substring(1).split('&');
var params = {};
var _iterator = _createForOfIteratorHelper(vars),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var ele = _step.value;
var pair = ele.split('=');
var key = decodeURIComponent(pair[0]);
if (typeof params[key] === 'undefined') {
params[key] = decodeURIComponent(pair[1]);
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return params;
}
function get() {
var reg = /MicroMessenger\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMac() {
var reg = /MacWechat\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMacOS() {
var reg = /Mac OS X ([\d_]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1].replace(/_/g, '.');
}
return false;
}
function getWindows() {
var reg = /WindowsWechat\(0x(.+?)\)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getWxWork() {
var reg = /wxwork\/([\d\.]+)/i;
var ret = ua.match(reg);
if (ret && ret[1]) {
return ret[1];
}
return false;
}
function getMpApp() {
var appVersion = [2, 4, 5];
var match = navigator.userAgent.match(/MPAPP\/(\d+(\.\d+)*)/);
if (match) {
appVersion = match[1].split('.').map(function (v) {
return Number(v);
});
}
return appVersion.join('.');
}
function getUnifiedPcVer() {
var versionInfo = navigator.userAgent.match(/UnifiedPC\w+Wechat\(0xf\w{2}(\w+?)\w{2}\)/);
if (versionInfo && versionInfo.length === 2) {
var version = versionInfo[1];
var mainVersion = getVersionNumber(version.slice(0, 1));
var subVersion = getVersionNumber(version.slice(1, 2));
var subVersion2 = getVersionNumber(version.slice(2, 3));
return [mainVersion, subVersion, subVersion2].join('.');
}
}
function getVersionNumber(hexStr) {
return Number(Number("0x".concat(hexStr)).toString(10));
}
function getWindowsVersionFormat() {
var versionInfo = navigator.userAgent.match(/WindowsWechat\(0x(\w+?)\)/);
if (versionInfo && versionInfo.length === 2) {
var version = versionInfo[1];
var mainVersion = getVersionNumber(version.slice(1, 2));
var subVersion = getVersionNumber(version.slice(2, 4));
var subVersion2 = getVersionNumber(version.slice(4, 6));
return [mainVersion, subVersion, subVersion2].join('.');
}
return false;
}
function getInner() {
var reg = /MicroMessenger\/[\d\.]+\(0x(.+?)\)/i;
var ret = ua.match(reg);
if (ret && ret[1] && ret[1] != null) {
return ret[1];
}
if (!ret && /MicroMessenger\/[\d\.]+/i.test(ua)) {
var urlParams = getUrlParams();
if (urlParams.version) {
return urlParams.version;
}
}
return false;
}
var opfunc = {
'cp-1': function cp1(a, b) {
return a < b;
},
cp0: function cp0(a, b) {
return a === b;
},
cp1: function cp1(a, b) {
return a > b;
}
};
function cpVersion(ver, op, canEq, type) {
var mmver = false;
switch (type) {
case 'mac':
mmver = getMac();
break;
case 'windows':
mmver = getWindowsVersionFormat();
break;
case 'wxwork':
mmver = getWxWork();
break;
case 'mpapp':
mmver = getMpApp();
break;
case 'unifiedpc':
mmver = getUnifiedPcVer();
break;
default:
mmver = get();
break;
}
if (!mmver) {
return;
}
var mmversion = mmver.split('.');
var version = ver.split('.');
if (!/\d+/g.test(mmversion[mmversion.length - 1])) {
mmversion.pop();
}
for (var i = 0, len = Math.max(mmversion.length, version.length); i < len; ++i) {
var mmv = mmversion[i] || '';
var v = version[i] || '';
var mmvn = parseInt(mmv, 10) || 0;
var vn = parseInt(v, 10) || 0;
var eq = opfunc.cp0(mmvn, vn);
if (eq) {
continue;
}
var cp = opfunc["cp".concat(op)];
return cp(mmvn, vn);
}
return canEq || op === 0;
}
function eqVersion(version) {
return cpVersion(version, 0);
}
function gtVersion(version, canEq) {
return cpVersion(version, 1, canEq);
}
function ltVersion(version, canEq) {
return cpVersion(version, -1, canEq);
}
function getPlatform() {
if (is_ios) {
return 'ios';
}
if (is_android) {
return 'android';
}
if (is_mac) {
return 'mac_os';
}
if (is_windows) {
return 'windows';
}
return 'unknown';
}
var is_google_play = false;
var inner_ver_for_google_play_check = getInner();
if (is_android && inner_ver_for_google_play_check) {
var v = "0x".concat(inner_ver_for_google_play_check.substr(-2));
if (parseInt(v) >= 64 && parseInt(v) <= 79) {
is_google_play = true;
}
}
function compareHexVersion(hexNum) {
var innerVersion = getInner();
if (innerVersion && hexNum) {
if (typeof hexNum === 'string') {
hexNum = parseInt(hexNum, 16);
}
var version = parseInt(innerVersion, 16);
return version >= hexNum;
}
return false;
}
var mmVersion = {
get: get,
getMac: getMac,
getMacOS: getMacOS,
getWindows: getWindows,
getInner: getInner,
getWxWork: getWxWork,
getMpApp: getMpApp,
cpVersion: cpVersion,
eqVersion: eqVersion,
gtVersion: gtVersion,
ltVersion: ltVersion,
getPlatform: getPlatform,
getVersionNumber: getVersionNumber,
isWp: is_wp,
isIOS: is_ios,
isAndroid: is_android,
isHarmony: is_harmony,
isHarmonyWechat: is_harmony && is_wechat && cpVersion('1.0.0', 1, true),
isInMiniProgram: is_in_miniProgram,
isWechat: is_wechat,
isMac: is_mac,
isWindows: is_windows,
isLinux: is_linux,
isMacWechat: is_mac_wechat,
isWindowsWechat: is_windows_wechat,
isWxWork: is_wx_work,
isOnlyWechat: is_wechat && !is_wx_work,
isMpapp: is_mpapp,
isIPad: is_ipad,
isGooglePlay: is_google_play,
isPrefetch: is_prefetch,
isDonutAPP: is_donut_app,
compareHexVersion: compareHexVersion,
isPcWechat: is_windows_wechat || is_mac_wechat,
xwebVersion: xweb_version,
isUnifiedPcWechat: is_unified_pc_wechat
};
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toPrimitive(input, hint) {
if (_typeof(input) !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (_typeof(res) !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return _typeof(key) === "symbol" ? key : String(key);
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
var Device = {};
function detect(ua) {
var MQQBrowser = ua.match(/MQQBrowser\/(\d+\.\d+)/i);
var MQQClient = ua.match(/QQ\/(\d+\.(\d+)\.(\d+)\.(\d+))/i) || ua.match(/V1_AND_SQ_([\d\.]+)/);
var WeChat = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/) || ua.match(/MicroMessenger\/((\d+)\.(\d+))/);
var MacOS = ua.match(/Mac\sOS\sX\s(\d+[\.|_]\d+)/);
var WinOS = ua.match(/Windows(\s+\w+)?\s+?(\d+\.\d+)/);
var Linux = ua.match(/Linux\s/);
var MiuiBrowser = ua.match(/MiuiBrowser\/(\d+\.\d+)/i);
var M1 = ua.match(/MI-ONE/);
var MIPAD = ua.match(/MI PAD/);
var UC = ua.match(/UCBrowser\/(\d+\.\d+(\.\d+\.\d+)?)/) || ua.match(/\sUC\s/);
var IEMobile = ua.match(/IEMobile(\/|\s+)(\d+\.\d+)/) || ua.match(/WPDesktop/);
var ipod = ua.match(/(ipod).*\s([\d_]+)/i);
var ipad = ua.match(/(ipad).*\s([\d_]+)/i);
var iphone = ua.match(/(iphone)\sos\s([\d_]+)/i);
var Chrome = ua.match(/Chrome\/(\d+\.\d+)/);
var AndriodBrowser = ua.match(/Mozilla.*Linux.*Android.*AppleWebKit.*Mobile Safari/);
var android = ua.match(/(android)\s([\d\.]+)/i);
var harmony = ua.match(/(OpenHarmony)\s([\d\.]+)/i);
Device.browser = Device.browser || {}, Device.os = Device.os || {};
Device.os.type = -1;
Device.os.unifiedPC = ua.match(/UnifiedPC/);
Device.os.unifiedMac = /UnifiedPCMac/i.test(ua);
Device.os.unifiedWindows = /UnifiedPCWindows/i.test(ua);
if (window.ActiveXObject) {
var vie = 6;
(window.XMLHttpRequest || ua.indexOf('MSIE 7.0') > -1) && (vie = 7);
(window.XDomainRequest || ua.indexOf('Trident/4.0') > -1) && (vie = 8);
ua.indexOf('Trident/5.0') > -1 && (vie = 9);
ua.indexOf('Trident/6.0') > -1 && (vie = 10);
Device.browser.ie = true, Device.browser.version = vie;
} else if (ua.indexOf('Trident/7.0') > -1) {
Device.browser.ie = true, Device.browser.version = 11;
}
if (android) {
Device.os.android = true;
Device.os.version = android[2];
Device.os.type = 2;
}
if (harmony) {
Device.os.harmony = true;
Device.os.version = harmony[2];
Device.os.type = 42;
}
if (ipod) {
Device.os.ios = Device.os.ipod = true;
Device.os.version = ipod[2].replace(/_/g, '.');
}
if (ipad) {
Device.os.ios = Device.os.ipad = true;
Device.os.version = ipad[2].replace(/_/g, '.');
Device.os.type = 13;
}
if (iphone) {
Device.os.iphone = Device.os.ios = true;
Device.os.version = iphone[2].replace(/_/g, '.');
Device.os.type = 1;
}
if (WinOS) Device.os.windows = true, Device.os.version = WinOS[2], Device.os.type = 15;
if (MacOS) Device.os.Mac = true, Device.os.version = MacOS[1], Device.os.type = 14;
if (Linux) Device.os.Linux = true, Device.os.type = 33;
if (ua.indexOf('lepad_hls') > 0) Device.os.LePad = true;
if (MIPAD) Device.os.MIPAD = true;
if (MQQBrowser) Device.browser.MQQ = true, Device.browser.version = MQQBrowser[1];
if (MQQClient) Device.browser.MQQClient = true, Device.browser.version = MQQClient[1];
if (WeChat) Device.browser.WeChat = true, Device.browser.mmversion = Device.browser.version = WeChat[1];
if (MiuiBrowser) Device.browser.MIUI = true, Device.browser.version = MiuiBrowser[1];
if (UC) Device.browser.UC = true, Device.browser.version = UC[1] || NaN;
if (IEMobile) Device.browser.IEMobile = true, Device.browser.version = IEMobile[2];
if (AndriodBrowser) {
Device.browser.AndriodBrowser = true;
}
if (M1) {
Device.browser.M1 = true;
}
if (Chrome) {
Device.browser.Chrome = true, Device.browser.version = Chrome[1];
}
if (Device.os.windows) {
if (typeof navigator.platform !== "undefined" && navigator.platform.toLowerCase() == "win64") {
Device.os.win64 = true;
} else {
Device.os.win64 = false;
}
}
if (Device.os.Mac || Device.os.windows || Device.os.Linux || Device.os.unifiedPC || /OpenHarmony/i.test(ua) && /pc/i.test(ua)) {
Device.os.pc = true;
}
var osType = {
iPad7: 'iPad; CPU OS 7',
LePad: 'lepad_hls',
XiaoMi: 'MI-ONE',
SonyDTV: "SonyDTV",
SamSung: 'SAMSUNG',
HTC: 'HTC',
VIVO: 'vivo'
};
for (var os in osType) {
Device.os[os] = ua.indexOf(osType[os]) !== -1;
}
Device.os.phone = Device.os.phone || /windows phone/i.test(ua);
Device.os.getNumVersion = function () {
return parseFloat(Device.os.version);
};
Device.os.hasTouch = 'ontouchstart' in window;
if (Device.os.hasTouch && Device.os.ios && Device.os.getNumVersion() < 6) {
Device.os.hasTouch = false;
}
if (Device.browser.WeChat && Device.browser.version < 5.0) {
Device.os.hasTouch = false;
}
Device.browser.getNumVersion = function () {
return parseFloat(Device.browser.version);
};
Device.browser.isFFCanOcx = function () {
return !!Device.browser.firefox && Device.browser.getNumVersion() >= 3.0;
};
Device.browser.isCanOcx = function () {
return !!Device.os.windows && (!!Device.browser.ie || Device.browser.isFFCanOcx() || !!Device.browser.webkit);
};
Device.browser.isNotIESupport = function () {
return !!Device.os.windows && (!!Device.browser.webkit || Device.browser.isFFCanOcx());
};
Device.userAgent = {};
Device.userAgent.browserVersion = Device.browser.version;
Device.userAgent.osVersion = Device.os.version;
if (Device.os.unifiedPC) {
if (Device.os.unifiedWindows) Device.os.type = 37;else if (Device.os.unifiedMac) Device.os.type = 38;else Device.os.type = 39;
}
delete Device.userAgent.version;
}
detect(window.navigator.userAgent);
function canSupportH5Video() {
var ua = window.navigator.userAgent,
m = null;
if (!!Device.os.android) {
if (Device.browser.MQQ && Device.browser.getNumVersion() >= 4.2) {
return true;
}
if (ua.indexOf('MI2') != -1) {
return true;
}
if (Device.os.version >= '4' && (m = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/))) {
if (parseFloat(m[1]) >= 4.2) {
return true;
}
}
if (Device.os.version >= '4.1') {
return true;
}
}
return false;
}
function canSupportVideoMp4() {
var video = document.createElement('video');
if (typeof video.canPlayType === 'function') {
if (video.canPlayType('video/mp4; codecs="mp4v.20.8"') === 'probably') {
return true;
}
if (video.canPlayType('video/mp4; codecs="avc1.42E01E"') === 'probably' || video.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"') === 'probably') {
return true;
}
}
return false;
}
function canSupportAutoPlay() {
if (Device.os.ios && Device.os.getNumVersion() < 10) {
return false;
}
return true;
}
function isLockdownMode() {
if (!Device.os.ios || Device.os.getNumVersion() < 16) {
return false;
}
if (typeof WebAssembly === 'undefined' && typeof OfflineAudioContext === 'undefined' && typeof WebGLRenderingContext === 'undefined') {
return true;
}
return false;
}
Device.canSupportVideo = canSupportVideoMp4 || canSupportH5Video;
Device.canSupportVideoMp4 = canSupportVideoMp4;
Device.canSupportH5Video = canSupportH5Video;
Device.canSupportAutoPlay = canSupportAutoPlay;
Device.isLockdownMode = isLockdownMode;
Device.cpVersion = function (version) {
var cp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var canEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var nowVersionStr = Device.os.version;
if (!nowVersionStr) return false;
var versionArr = version.split('.');
var nowVersionArr = nowVersionStr.split('.');
for (var i = 0; i < Math.max(nowVersionArr.length, versionArr.length); i++) {
var vi = +versionArr[i];
var nvi = +nowVersionArr[i];
if (vi === nvi) continue;
if (cp > 0) return vi > nvi;
if (cp < 0) return vi < nvi;
}
return canEqual || cp === 0;
};
var initJsBridge = false;
if (!window.JSAPIEventCallbackMap) {
window.JSAPIEventCallbackMap = {};
}
function connectWebViewJavascriptBridge(callback) {
if (window.WebViewMPapp || window.WebViewJavascriptBridge) {
return callback(window.WebViewMPapp || window.WebViewJavascriptBridge);
}
if (window.WVJBCallbacks) {
return window.WVJBCallbacks.push(callback);
}
window.WVJBCallbacks = [callback];
if (!mmVersion.isMpapp) {
return false;
}
if (!initJsBridge) {
initJsBridge = true;
var WVJBIframe = document.createElement('iframe');
WVJBIframe.style.display = 'none';
WVJBIframe.src = 'https://__bridge_loaded__';
document.body.appendChild(WVJBIframe);
setTimeout(function () {
initJsBridge = false;
document.body.removeChild(WVJBIframe);
}, 0);
}
return false;
}
function invoke(jsapiName, opt, callback) {
connectWebViewJavascriptBridge(function (bridge) {
try {
if (typeof opt === 'function') {
callback = opt;
}
if (_typeof(opt) !== 'object' && typeof opt !== 'string') {
opt = {};
}
bridge.callHandler(jsapiName, opt, function (res) {
try {
var ret = _typeof(res) === 'object' ? res : JSON.parse(res);
var errMsg = ret.err_msg || ret.errMsg;
console.info("[mpapp jsapi] invoke->".concat(jsapiName, " ").concat(opt.action || '', " ").concat(errMsg));
typeof callback === 'function' && callback(ret);
} catch (e) {
window.WX_BJ_REPORT.BadJs.report('invoke', "callback ".concat(jsapiName, " error:"), {
mid: 'mmbizwebapp:js_brridge',
_info: e
});
console.error("[mpapp jsapi] ".concat(jsapiName, " ").concat(opt.action || ''), e, res);
}
});
} catch (e) {
window.WX_BJ_REPORT.BadJs.report('invoke', 'callback error:', {
mid: 'mmbizwebapp:js_brridge',
_info: e
});
console.error('[mpapp jsapi]', e);
}
});
}
function _log(level, msg) {
if (level === 'log') {
level = 'info';
msg = "[WechatFe]".concat(msg);
} else {
var prefix = "__wap__".concat(window.__second_open__ ? ' (sec)' : '');
msg = "".concat(prefix, " ").concat(msg, " location:[").concat(location.href, "]");
}
msg += new Error().stack;
if (mmVersion.isMpapp) {
invoke('WNNativeCallbackLog', msg);
} else if (mmVersion.isWechat) {
if (mmVersion.isAndroid) {
console.warn('[system]', "[MicroMsg.JsApiLog][".concat(level, "] jslog : ").concat(msg));
} else if (mmVersion.isIOS) {
JSAPI.invoke('writeLog', {
level: level,
msg: msg
});
} else {
JSAPI.invoke('log', {
level: level,
msg: msg
});
}
}
}
var Log = {
info: function info() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_log('info', args.join(' '));
},
warn: function warn() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_log('warn', args.join(' '));
},
error: function error() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
_log('error', args.join(' '));
},
debug: function debug() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
_log('debug', args.join(' '));
},
log: function log() {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
_log('info', args.join(' '));
}
};
var reportLogs = [];
var reportExtraLogs = [];
var sendUrl = '/mp/jsmonitor?#wechat_redirect';
var monitor = {};
monitor._reportOptions = {
idkey: {}
};
function ObjWithoutProperty(source, exclude) {
if (source === null) return {};
var target = {};
var sourceKeys = Object.keys(source);
for (var i = 0; i < sourceKeys.length; i++) {
var key = sourceKeys[i];
if (exclude.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function formatDataToString(data) {
var reportData = [];
for (var key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
reportData.push(key + '=' + encodeURIComponent(data[key]));
}
}
return reportData.join('&');
}
monitor.getReportData = function (opt) {
opt = opt || {};
var idkey = monitor._reportOptions.idkey || {};
var key = null;
var reportData = {};
var nextKey;
try {
for (key in idkey) {
if (Object.prototype.hasOwnProperty.call(idkey, key) && idkey[key]) {
reportLogs.push(key + '_' + idkey[key]);
}
}
} catch (e) {
return false;
}
if (reportLogs.length === 0) {
return false;
}
if (reportExtraLogs.length) {
reportData.lc = reportExtraLogs.length;
reportExtraLogs.forEach(function (extraLog, index) {
reportData["log".concat(index)] = extraLog;
});
}
try {
var reportOptions = monitor._reportOptions;
if (reportOptions !== null && reportOptions !== undefined) {
for (nextKey in reportOptions) {
if (Object.prototype.hasOwnProperty.call(reportOptions, nextKey)) {
reportData[nextKey] = reportOptions[nextKey];
}
}
}
} catch (e) {
reportData = {};
}
reportData.idkey = reportLogs.join(';');
reportData.t = Math.random();
if (opt.remove !== false) {
reportLogs = [];
reportExtraLogs = [];
monitor._reportOptions = {
idkey: {}
};
}
return reportData;
};
monitor.setLogs = function (opt) {
var id = opt.id;
var key = opt.key;
var value = opt.value;
var extraLog = opt.log;
var others = ObjWithoutProperty(opt, ['id', 'key', 'value', 'log']);
var idkey = monitor._reportOptions.idkey || {};
var param = id + '_' + key;
if (idkey[param]) {
idkey[param] += value;
} else {
idkey[param] = value;
}
monitor._reportOptions.idkey = idkey;
if (extraLog) {
reportExtraLogs.push(extraLog);
}
try {
if (others !== null && others !== undefined) {
for (var otherKey in others) {
if (Object.prototype.hasOwnProperty.call(others, otherKey)) {
monitor._reportOptions[otherKey] = others[otherKey];
}
}
}
} catch (e) {
console.log(e);
}
return monitor;
};
monitor.setAvg = function (id, key, value) {
var idkey = monitor._reportOptions.idkey || {};
var param1 = id + '_' + key;
var param2 = id + '_' + (key - 1);
if (idkey[param1]) {
idkey[param1] += value;
} else {
idkey[param1] = value;
}
if (idkey[param2]) {
idkey[param2] += 1;
} else {
idkey[param2] = 1;
}
monitor._reportOptions.idkey = idkey;
return monitor;
};
monitor.setSum = function (id, key) {
var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var idkey = monitor._reportOptions.idkey;
var param = id + '_' + key;
if (idkey[param]) {
idkey[param] += value;
} else {
idkey[param] = value;
}
monitor._reportOptions.idkey = idkey;
return monitor;
};
monitor.send = function (async, ajax, origin) {
if (async !== false) {
async = true;
}
var data = monitor.getReportData();
origin = origin || '';
if (!data) {
return;
}
if (!!ajax && ajax instanceof Function) {
ajax({
url: origin + sendUrl,
type: 'POST',
mayAbort: true,
data: data,
async: async,
timeout: 2000,
dontReport: true
});
} else {
new Image().src = origin + '/mp/jsmonitor?' + formatDataToString(data) + '#wechat_redirect';
}
};
if (typeof window !== 'undefined' && window.__monitor) {
monitor = window.__monitor;
} else {
typeof window !== 'undefined' && (window.__monitor = monitor);
}
var monitor$1 = monitor;
var logList = [];
var log = function log(msg) {
logList.push(msg);
};
var printLog = function printLog() {
for (var i = 0, len = logList.length; i < len; ++i) {
console.log("[RespType]".concat(logList[i]));
}
};
var isArray = function isArray(val) {
return Object.prototype.toString.call(val) === '[object Array]';
};
var getValueType = function getValueType(value) {
if (isArray(value)) {
return 'array';
}
return _typeof(value);
};
var parseRtDesc = function parseRtDesc(rtDesc, k) {
var type = 'mix';
var isRequired = false;
var key = k;
if (k) {
var requireKeyWord = '_R';
var pos = k.indexOf(requireKeyWord);
var len = k.length - requireKeyWord.length;
isRequired = pos !== -1 && pos === len;
key = isRequired ? k.substring(0, len) : k;
}
if (typeof rtDesc === 'string') {
type = rtDesc;
} else if (isArray(rtDesc)) {
type = 'array';
} else if (_typeof(rtDesc) === 'object') {
type = 'object';
}
return {
key: key,
type: type,
isRequired: isRequired
};
};
var checkForArrayRtDesc = function checkForArrayRtDesc(arr, rtDescs) {
if (!isArray(arr)) {
return false;
}
for (var i = 0, len = arr.length; i < len; ++i) {
var value = arr[i];
var rtDesc = void 0;
var j = 0;
var flag = rtDescs.length === 0;
while (rtDesc = rtDescs[j++]) {
if (checkForRtDesc(value, rtDesc)) {
flag = true;
break;
}
}
if (!flag) {
return false;
}
}
return true;
};
var checkForStringRtDesc = function checkForStringRtDesc(value, rtDesc) {
var valueType = getValueType(value);
var desc = parseRtDesc(rtDesc);
var ret = desc.type === valueType;
if (!ret) {
log("miss match type : ".concat(valueType, " !== ").concat(desc.type));
}
return ret;
};
var checkForObjectRtDesc = function checkForObjectRtDesc(json, rtDesc) {
if (_typeof(json) !== 'object' || isArray(json)) {
log('must be object');
return false;
}
var rootJson = json;
var nowCheckValue = json;
for (var k in rtDesc) {
if (rtDesc.hasOwnProperty(k)) {
var nowCheckDesc = rtDesc[k];
var desc = parseRtDesc(nowCheckDesc, k);
var key = desc.key;
nowCheckValue = rootJson[key];
var valueType = getValueType(nowCheckValue);
if (desc.isRequired && nowCheckValue === undefined) {
log("is required @key=".concat(key));
return false;
}
if (nowCheckValue !== undefined) {
if (valueType !== desc.type && desc.type !== 'mix') {
log("miss match type : ".concat(valueType, " !== ").concat(desc.type, " @key=").concat(key));
return false;
}
if ((valueType === 'array' || valueType === 'object') && desc.type !== 'mix') {
if (!checkForRtDesc(nowCheckValue, nowCheckDesc)) {
return false;
}
}
}
}
}
return true;
};
var checkForRtDesc = function checkForRtDesc(json, rtDesc) {
if (isArray(rtDesc)) {
return checkForArrayRtDesc(json, rtDesc);
}
if (_typeof(rtDesc) === 'object') {
return checkForObjectRtDesc(json, rtDesc);
}
if (typeof rtDesc === 'string') {
return checkForStringRtDesc(json, rtDesc);
}
return false;
};
var _check = function check(json, rtDescs) {
if (typeof json === 'string') {
try {
json = eval("(".concat(json, ")"));
} catch (e) {
log('parse json error');
return false;
}
}
if (_typeof(json) !== 'object') {
log('must be object');
return false;
}
if (!isArray(rtDescs)) {
rtDescs = [rtDescs];
}
var rtDesc;
var i = 0;
while (rtDesc = rtDescs[i++]) {
if (checkForRtDesc(json, rtDesc)) {
return true;
}
}
return false;
};
var RespTypes = {
check: function check(json, rtDesc) {
logList = [];
try {
var ret = _check(json, rtDesc);
if (!ret) {
printLog();
}
return ret;
} catch (e) {
logList.push("[rtException]".concat(e.toString()));
printLog();
return false;
}
},
getMsg: function getMsg() {
return logList.join(';');
}
};
function getInflightMap() {
if (!window.__dedupe_promise_inflight__) {
window.__dedupe_promise_inflight__ = new Map();
}
return window.__dedupe_promise_inflight__;
}
function dedupePromise(key, factory) {
var inflightMap = getInflightMap();
var existing = inflightMap.get(key);
console.log("dedupePromise key=".concat(key, " existing=").concat(existing));
if (existing) {
return existing;
}
var promise = Promise.resolve().then(factory)["finally"](function () {
inflightMap["delete"](key);
});
inflightMap.set(key, promise);
return promise;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
var prefix = '__WXLS__';
var localStorage$1 = window.localStorage || {
getItem: function getItem() {},
setItem: function setItem() {},
removeItem: function removeItem() {},
key: function key() {},
clear: function clear() {
var _a, _b;
(_b = (_a = window.localStorage) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a);
},
length: 0
};
var evictionPolicies = {
noeviction: function noeviction(data) {
return data;
},
'allkeys-random': function allkeysRandom(data, size) {
var keys = Object.keys(data);
var memCnt = 0;
while (memCnt < size) {
var len = keys.length;
var randomKeyIdx = Math.floor(Math.random() * len);
var randomKey = keys[randomKeyIdx];
memCnt += JSON.stringify(data[randomKey]).length;
delete data[randomKey];
keys = Object.keys(data);
}
return data;
},
'volatile-ttl': function volatileTtl(data, size) {
var keys = Object.keys(data);
keys = keys.sort(function (key1, key2) {
var d1 = data[key1];
var d2 = data[key2];
if (d1.exp < d2.exp) return -1;
if (d1.exp > d2.exp) return 1;
return 0;
});
var memCnt = 0;
for (var i = 0; i < keys.length; i++) {
if (memCnt >= size) break;
var key = keys[i];
memCnt += JSON.stringify(data[key]).length;
delete data[key];
}
return data;
},
'clear-all': function clearAll() {
localStorage$1.clear();
return {};
}
};
function formatLogMsg(str) {
return "[WXLS] ".concat(str);
}
var LS = function () {
function LS(func, evictionPolicy, logger) {
_classCallCheck(this, LS);
this.logger = function () {};
if (!func) throw 'require function name.';
this.evictionPolicy = 'noeviction';
this.key = func;
if (typeof logger === 'function') {
this.logger = function (str, type) {
return logger(formatLogMsg(str), type);
};
}
if (evictionPolicy && Object.keys(evictionPolicies).indexOf(evictionPolicy) !== -1) {
this.evictionPolicy = evictionPolicy;
}
this.init();
}
_createClass(LS, [{
key: "init",
value: function init() {
var _a, _b;
this.check();
if (Math.random() * 1000 < 1) {
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.call(this, "LSlen: ".concat(((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length) || localStorage$1.length), 'report');
}
}
}, {
key: "getData",
value: function getData() {
var data = LS.getItem(this.key) || '{}';
try {
data = JSON.parse(data);
} catch (e) {
this.logger("getData error: ".concat(e), 'error');
localStorage$1.removeItem(prefix + this.key);
data = {};
}
return data;
}
}, {
key: "check",
value: function check(isReturn) {
var data = this.getData();
var temp = {};
var now = +new Date();
var key;
var val;
for (key in data) {
val = data[key];
if (+val.exp > now) {
temp[key] = val;
}
}
this.logger("check info: isReturn:".concat(isReturn, " data:").concat(JSON.stringify(temp)), 'info');
if (isReturn) return temp;
LS.setItem(this.key, JSON.stringify(temp), this.logger);
}
}, {
key: "set",
value: function set(key, val, exp) {
var _a, _b;
var data = this.check(true);
data[key] = {
val: val,
exp: exp || +new Date()
};
try {
if (localStorage$1.getItem(prefix + this.key)) localStorage$1.removeItem(prefix + this.key);
localStorage$1.setItem(prefix + this.key, JSON.stringify(data));
this.logger("first set success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data)), 'success');
} catch (e) {
this.logger("first set error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data), " k:").concat(key, " v:").concat(val, " exp:").concat(exp), 'error');
localStorage$1.clear();
LS.setItem(this.key, JSON.stringify(_defineProperty({}, key, {
val: val,
exp: exp || +new Date()
})), this.logger);
}
}
}, {
key: "get",
value: function get(key) {
var data = this.getData();
data = data[key];
return data ? data.val || null : null;
}
}, {
key: "remove",
value: function remove(key) {
var data = this.getData();
if (data[key]) delete data[key];
LS.setItem(this.key, JSON.stringify(data), this.logger);
}
}], [{
key: "getItem",
value: function getItem(key) {
key = prefix + key;
return localStorage$1.getItem(key);
}
}, {
key: "setItem",
value: function setItem(key, val, logger) {
var _a, _b;
key = prefix + key;
var n = 3;
while (n--) {
try {
if (localStorage$1.getItem(key)) localStorage$1.removeItem(key);
localStorage$1.setItem(key, val);
typeof logger === 'function' && logger("setItem success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(key, " val:").concat(val), 'success');
break;
} catch (e) {
typeof logger === 'function' && logger("setItem error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(key, " val:").concat(val), 'error');
LS.clear();
}
}
}
}, {
key: "clear",
value: function clear() {
var i;
var k;
for (i = localStorage$1.length - 1; i >= 0; i--) {
k = localStorage$1.key(i);
if (k.indexOf(prefix) == 0) {
localStorage$1.removeItem(k);
}
}
}
}, {
key: "getSupportEvicationPolicy",
value: function getSupportEvicationPolicy() {
return Object.keys(evictionPolicies);
}
}]);
return LS;
}();
var innerVersion = (mmVersion.getInner() || '').toUpperCase();
var getBizLS = new LS('get_biz_result');
function getBizMap() {
if (!window.__get_biz_map__) {
window.__get_biz_map__ = {};
}
return window.__get_biz_map__;
}
var isGetBizSupported = mmVersion.isOnlyWechat && mmVersion.isIOS && innerVersion >= '18003C2A' || mmVersion.isOnlyWechat && mmVersion.isAndroid && innerVersion >= '28003D3C' || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc');
function invokeGetBiz(needCheckBiz, bizType) {
return dedupePromise("getBiz:".concat(needCheckBiz, ":").concat(bizType), function () {
return new Promise(function (resolve, reject) {
if (!isGetBizSupported) {
reject('Not support');
} else {
JSAPI.invoke('handleMPPageAction', {
action: 'getBiz',
needCheckBiz: needCheckBiz,
bizType: bizType
}, function (res) {
console.log("getBiz needCheckBiz=".concat(needCheckBiz, " bizType=").concat(bizType, " res: ").concat(JSON.stringify(res)));
if (res && res.err_msg && res.err_msg.indexOf('ok') > -1) {
var bizMap = getBizMap();
bizMap[bizType] = res.biz;
resolve(res.biz);
getBizLS.set("".concat(bizType, "_get_biz_result"), res.biz, +new Date() + 3 * 24 * 60 * 60 * 1000);
} else {
reject('Failed to get biz');
}
});
}
});
});
}
function getBiz(needCheckBiz, bizType) {
var _a;
if (needCheckBiz === void 0) {
needCheckBiz = false;
}
if (bizType === void 0) {
bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1;
}
var bizMap = getBizMap();
if (!needCheckBiz && bizMap[bizType] !== undefined) {
return Promise.resolve(bizMap[bizType]);
}
return invokeGetBiz(needCheckBiz, bizType);
}
mmVersion.isOnlyWechat && mmVersion.isIOS || mmVersion.isOnlyWechat && mmVersion.isAndroid || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc');
var getIsAuthor = function getIsAuthor(cb, bizuin, needCheckBiz, bizType) {
var _a;
if (bizuin === void 0) {
bizuin = window.biz;
}
if (needCheckBiz === void 0) {
needCheckBiz = false;
}
if (bizType === void 0) {
bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1;
}
getBiz(needCheckBiz, bizType).then(function (biz) {
cb(biz && biz === bizuin);
})["catch"](function () {
cb(false);
});
};
function parseUrl(url) {
var len = url.length;
var ques_pos = url.indexOf('?');
var hash_pos = url.indexOf('#');
hash_pos = hash_pos == -1 ? len : hash_pos;
ques_pos = ques_pos == -1 ? hash_pos : ques_pos;
var host = url.substring(0, ques_pos);
var query_str = url.substring(ques_pos + 1, hash_pos);
var hash = url.substring(hash_pos + 1);
return {
host: host,
query_str: query_str,
hash: hash
};
}
function join(url, args, noEncode) {
var ret = parseUrl(url);
var query_str = ret.query_str;
var args_arr = [];
if (_typeof(args) === 'object') {
for (var key in args) {
if (args.hasOwnProperty(key)) {
args_arr.push("".concat(key, "=").concat(noEncode ? args[key] : encodeURIComponent(args[key])));
}
}
} else {
args_arr.push(noEncode ? args : encodeURIComponent(args));
}
if (args_arr.length > 0) {
query_str += (query_str !== "" ? "&" : "") + args_arr.join("&");
}
return ret.host + (query_str !== "" ? "?".concat(query_str) : "") + (ret.hash !== "" ? "#".concat(ret.hash) : "");
}
function addParam(url, param, value, forceReplace) {
url = url || location.href;
var firstAndPos = url.indexOf("&");
var len = url.length;
var reverseUrl = url.replace(/^[\w\d]+:[/\\]+/g, "").split("").reverse();
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement, fromIndex) {
var k;
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var O = Object(this);
var len = O.length >>> 0;
if (len === 0) {
return -1;
}
var n = fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
if (n >= len) {
return -1;
}
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {
if (k in O && O[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
}
var lastSlashPos = len - 1 - reverseUrl.indexOf("/");
if (firstAndPos !== -1 && url.indexOf("?") == -1 && firstAndPos > lastSlashPos) {
url = url.replace("&", "?");
}
var reg = new RegExp("([\\?&]".concat(param, "=)[^&#]*"));
if (!url.match(reg)) {
var urlInfo = parseUrl(url);
var hash = urlInfo.hash ? '#' + urlInfo.hash : '';
url = url.replace(hash, '');
var _pos = url.indexOf("?");
if (_pos == -1) {
return "".concat(url, "?").concat(param, "=").concat(value).concat(hash);
}
if (_pos == url.length - 1) {
return "".concat(url + param, "=").concat(value).concat(hash);
}
return "".concat(url, "&").concat(param, "=").concat(value).concat(hash);
}
if (forceReplace === true) {
return url.replace(reg, "$1".concat(value));
}
return url;
}
function addWxfrom(src, wxfrom) {
var offset = window.service_type === 1 ? 10000 : 0;
return addParam(src, 'wxfrom', offset + Number(wxfrom), true);
}
function removeParam(url, param) {
var _URL = new URL(url),
protocol = _URL.protocol,
host = _URL.host,
pathname = _URL.pathname,
search = _URL.search,
hash = _URL.hash;
var queryParams = new URLSearchParams(search);
queryParams["delete"](param);
var newSearch = queryParams.toString();
var newUrl = new URL("".concat(protocol, "//").concat(host).concat(pathname).concat(newSearch ? "?".concat(decodeURIComponent(newSearch)) : "").concat(hash));
return newUrl.toString();
}
function getQuery(name, url) {
var u = url || window.location.search;
var reg = new RegExp("(^|&)".concat(name, "=([^&]*)(&|$)"));
var r = u.substring(u.indexOf('?') + 1).match(reg);
return r !== null ? r[2] : '';
}
function encodeBase64(value) {
try {
return window.btoa(value);
} catch (e) {
return '';
}
}
function decodeBase64(value) {
try {
return window.atob(value);
} catch (e) {
return '';
}
}
function joinUrl$1(url) {
var obj = {};
if (typeof window.uin !== 'undefined') {
obj.uin = window.uin;
}
if (typeof window.key !== 'undefined') {
obj.key = window.key;
}
if (typeof window.pass_ticket !== 'undefined') {
obj.pass_ticket = window.pass_ticket;
}
if (typeof window.wxtoken !== 'undefined') {
obj.wxtoken = window.wxtoken;
}
if (typeof window.devicetype !== 'undefined') {
obj.devicetype = window.devicetype;
}
if (typeof window.clientversion !== 'undefined') {
obj.clientversion = window.clientversion || mmVersion.getInner();
}
obj.version = obj.clientversion;
if (window.biz) {
obj.__biz = window.biz;
}
if (getQuery('enterid')) {
obj.enterid = getQuery('enterid');
}
if (typeof window.appmsg_token !== 'undefined') {
obj.appmsg_token = window.appmsg_token;
} else if (url.indexOf('advertisement_report') > -1) {
new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random());
}
obj.x5 = navigator.userAgent.indexOf('TBS/') !== -1 ? '1' : '0';
obj.f = 'json';
return join(url, obj);
}
function joinUserArticleRole(url, notJoin, cb) {
var bizuin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : window.biz;
var needCheckBiz = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
if (notJoin) {
cb(url);
} else {
getIsAuthor(function (isAuthor) {
cb(addParam(url, 'user_article_role', isAuthor ? 1 : 0, true));
}, bizuin, needCheckBiz);
}
}
function getA8keyQuery(name, url) {
return new Promise(function (resolve) {
if (window.__secPageAuthPromise) {
window.__secPageAuthPromise.then(function () {
resolve(getQuery(name, url));
});
} else {
resolve(getQuery(name, url));
}
});
}
function addHash(url, hash) {
var isReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (isReplace) {
return "".concat(url.split('#')[0]).concat(hash);
}
return "".concat(url).concat(url.indexOf('#') === -1 ? '#' : '').concat(hash);
}
function decodeUrl(url) {
var _url = url;
while (_url.indexOf('&') !== -1) {
_url = _url.htmlDecode();
}
return _url;
}
var Url = {
parseUrl: parseUrl,
join: join,
addParam: addParam,
addWxfrom: addWxfrom,
addHash: addHash,
getQuery: getQuery,
getA8keyQuery: getA8keyQuery,
encodeBase64: encodeBase64,
decodeBase64: decodeBase64,
joinUrl: joinUrl$1,
joinUserArticleRole: joinUserArticleRole,
removeParam: removeParam,
decodeUrl: decodeUrl
};
var _a;
var doc;
var isAcrossOrigin = false;
try {
doc = (_a = window.top) === null || _a === void 0 ? void 0 : _a.window.document;
} catch (e) {
isAcrossOrigin = true;
}
var StatusTextMap = {
200: 'OK',
302: 'Found',
400: 'Bad Request',
500: 'Internal Server Error'
};
function getIsAcrossOrigin() {
return isAcrossOrigin;
}
function networkStartLog(item) {
var _a, _b, _c, _d, _e;
console.log('[system]', "< [request ".concat(item.requestType, "]"), item.url, item.method, item);
var rdevRequestId;
var requestTime = performance.now() / 1000;
if ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) {
try {
var willBeSentOptions = {
url: item.url,
method: item.method,
requestHeaders: Object.assign({}, item.requestHeader || {}, {
RDEV_REQUEST_TYPE: item.requestType
}),
requestBody: item.postData,
requestTime: requestTime
};
rdevRequestId = window.RemoteDevSdk.instance.Network.customRequestWillBeSent(willBeSentOptions);
} catch (err) {}
}
if ((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) {
try {
var vconsoleNetworkItem = (_e = (_d = window.vConsole.network).add) === null || _e === void 0 ? void 0 : _e.call(_d, Object.assign({}, item, {
startTime: Date.now(),
endTime: Date.now(),
status: 0,
readyState: 2,
response: ''
}));
vconsoleNetworkItem.rdevRequestId = rdevRequestId;
vconsoleNetworkItem.requestTime = requestTime;
return vconsoleNetworkItem;
} catch (err) {}
}
if (rdevRequestId) {
return Object.assign(Object.assign({}, item), {
id: '__only_rdev_log__',
rdevRequestId: rdevRequestId,
requestTime: requestTime
});
}
return Object.assign({}, item, {
id: '__system_log__'
});
}
function networkEndLog(item) {
var _a, _b, _c, _d, _e;
console.log('[system]', "> [response ".concat(item.requestType, "]"), item.url, item.response, item);
if (item.rdevRequestId && ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) && item.id !== '__system_log__') {
try {
var finishedOptions = {
requestId: item.rdevRequestId,
url: item.url,
status: +(item.status || '500'),
statusText: StatusTextMap[+(item.status || '500')] || 'Error',
responseHeaders: {
RDEV_RESPONSE_TYPE: item.requestType
},
responseBody: item.response,
requestTime: item.requestTime || 0,
duration: item.costTime || (item.endTime && item.startTime ? item.endTime - item.startTime : performance.now() / 1000 - (item.requestTime || 0))
};
window.RemoteDevSdk.instance.Network.customRequestFinished(finishedOptions);
} catch (err) {}
}
if (((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) && item.id !== '__system_log__') {
try {
item.statusText = "".concat(item.status);
item.responseSize = item.response.length;
item.responseSizeText = "".concat(item.response.length);
return (_e = (_d = window.vConsole.network).update) === null || _e === void 0 ? void 0 : _e.call(_d, item.id, Object.assign({}, item, {
readyState: 4
}));
} catch (err) {}
}
}
function reqType(obj, path) {
return obj.url.indexOf(path) > -1 && obj.url.indexOf('action=') === -1 && (!obj.data || !obj.data.action);
}
function findAjaxScopeByConfig(url, config) {
var pathname = new URL(url, location.href).pathname || '';
var scope = config[pathname.slice(1)];
if (scope) {
return scope;
}
}
function getAjaxScope(ajaxUrl) {
if (Url.getQuery('no_transfer', location.href) !== '1' && mmVersion.isWechat && !mmVersion.isInMiniProgram && !mmVersion.isWxWork && !mmVersion.isMpapp && !isAcrossOrigin && window.__ajaxTransferConfig && _typeof(window.__ajaxTransferConfig) === 'object' && (
mmVersion.isIOS && mmVersion.compareHexVersion('1800282F') || mmVersion.isAndroid && mmVersion.compareHexVersion('28002234') || mmVersion.isWindowsWechat && mmVersion.cpVersion('3.9.5', 1, true, 'windows') || mmVersion.isMacWechat && mmVersion.cpVersion('3.8.4', 1, true, 'mac') || mmVersion.isHarmonyWechat && mmVersion.compareHexVersion('0xf3100b00') && !mmVersion.compareHexVersion('0xf3100c00') || mmVersion.compareHexVersion('0xf3800b00'))) {
try {
return findAjaxScopeByConfig(ajaxUrl, window.__ajaxTransferConfig);
} catch (err) {
}
}
}
function getActionByData(data) {
var _a, _b;
if (_typeof(data) === 'object' && !(data instanceof Blob)) {
if (data.hasOwnProperty('data') && typeof data.data === 'string') {
try {
var workedData = JSON.parse(data.data);
return workedData.action || '';
} catch (e) {}
}
return data.action || '';
}
if (typeof data === 'string') {
return ((_b = (_a = data.split(/[?&]/).find(function (x) {
return x.indexOf('action=') >= 0;
})) === null || _a === void 0 ? void 0 : _a.split('=')) === null || _b === void 0 ? void 0 : _b[1]) || '';
}
return '';
}
var METHOD_ENUM = {
GET: 0,
POST: 1
};
var __moon_report = window.__moon_report || function () {};
var MOON_AJAX_SUCCESS_OFFSET = 3;
var MOON_AJAX_NETWORK_OFFSET = 4;
var MOON_AJAX_ERROR_OFFSET = 5;
var MOON_AJAX_TIMEOUT_OFFSET = 6;
var MOON_AJAX_COMPLETE_OFFSET = 7;
var LENGTH_LIMIT = 4096;
function reportRtError(type, id, key, content) {
var log = '';
var prefix = type === 'rt' ? 'rtCheckError' : 'Ajax Length Limit';
if (content === null || content === void 0 ? void 0 : content.length) {
var loglen = 1000;
var len = content.length;
var lc = Math.ceil(len / loglen);
log = ["&lc=".concat(lc)];
for (var i = 0; i < lc; ++i) {
log.push("&log".concat(i, "=") + "[".concat(prefix, "][").concat(i, "]").concat(encodeURIComponent(content.substring(i * loglen, i * loglen + loglen))));
}
log = log.join('');
}
var data = "idkey=".concat(id, "_").concat(key, "_1").concat(log, "&r=").concat(Math.random());
var xmlobj = new XMLHttpRequest();
xmlobj.open('POST', "".concat(location.protocol, "//").concat(location.host, "/mp/jsmonitor?"), true);
xmlobj.setRequestHeader('cache-control', 'no-cache');
xmlobj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlobj.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xmlobj.send(data);
if (type === 'ajaxLen') {
monitor$1.setLogs({
id: id,
key: key,
value: 1,
log: log
});
}
}
function reportRt(id, key, content) {
reportRtError('rt', id, key, content);
}
function reportAjaxLength(id, key, content) {
reportRtError('ajaxLen', id, key, content);
}
function setXhrHeader(xhr, type, opt) {
if (opt.contentType) {
xhr.setRequestHeader('Content-Type', opt.contentType);
} else if (type === 'POST') {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
}
if (!opt.noXRequestedWidthHeader) {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
}
}
function Ajax(obj) {
var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {};
if (obj.usePb) {
obj.type = 'POST';
obj.data = {
data: JSON.stringify(obj.data)
};
}
var ajaxScope = getAjaxScope(obj.url);
var type = (obj.type || 'GET').toUpperCase();
var timer;
var _url;
if (obj.notJoinUrl) {
_url = obj.url;
} else {
_url = Url.joinUrl(obj.url);
}
Url.joinUserArticleRole(_url, !!obj.notJoinUrl, function (url) {
var urlObj = new URL(url, location.origin);
if (obj.f === 'html') {
url = url.replace('&f=json', '');
}
var data = null;
if (obj.data instanceof Blob) {
data = obj.data;
} else if (_typeof(obj.data) === 'object') {
var d = obj.data;
var ds = [];
for (var k in d) {
if (d.hasOwnProperty(k)) {
ds.push("".concat(k, "=").concat(encodeURIComponent(d[k])));
}
}
data = ds.join('&');
} else {
data = typeof obj.data === 'string' ? obj.data : null;
}
var beginTs;
var beforeReq = function beforeReq() {
if (reqType(obj, '/mp/getappmsgext')) {
window.startGetAppmsgExtTime = Date.now();
Log.log('start get appmsgext, url: ', obj.url);
}
if (reqType(obj, '/mp/getappmsgad')) {
window.startGetAppmsgAdTime = Date.now();
Log.log('start get appmsgad, url: ', obj.url);
}
beginTs = Date.now();
};
var beforeResp = function beforeResp(xhr) {
if (reqType(obj, '/mp/getappmsgext')) {
window.receiveGetAppmsgExt = "".concat(xhr.status, "|").concat(Date.now());
Log.log("receive appmsgext response, status: ".concat(xhr.status));
}
if (reqType(obj, '/mp/getappmsgad')) {
window.receiveGetAppmsgAd = "".concat(xhr.status, "|").concat(Date.now());
Log.log("receive appmsgad response, status: ".concat(xhr.status));
}
if (Math.random() < 0.001 && window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) {
try {
var key = ajaxScope ? 'transfer' : 'xhr';
var interval = 250;
var time = Date.now() - beginTs;
var range = Math.floor(time / interval) * interval;
var pathname = new URL(obj.url, location.href).pathname || '';
window.WX_BJ_REPORT.BadJs.report("".concat(key, "_perf:").concat(pathname), JSON.stringify({
status: xhr.status,
time: "[".concat(range, "-").concat(range + interval, ")")
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
} catch (err) {}
}
};
var handleRespSucc = function handleRespSucc(xhr, requestType) {
var _a, _b, _c, _d;
try {
var responseText = xhr.responseText;
var resp = responseText;
if (obj.dataType === 'json') {
try {
if (JSON && JSON.parse) {
resp = JSON.parse(resp);
} else {
resp = eval("(".concat(resp, ")"));
monitor$1.setSum(523105, 127, 1).send();
}
var rtId = obj.rtId;
var rtKey = obj.rtKey || 0;
var rtDesc = obj.rtDesc;
if (rtId && rtDesc && RespTypes && !RespTypes.check(resp, rtDesc)) {
reportRt(+rtId, +rtKey, "".concat(RespTypes.getMsg(), "[detail]").concat(responseText, ";").concat(obj.url));
}
if (resp && resp.base_resp && ((_a = resp.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) {
var reportUrl = url;
if (url.indexOf('?') !== -1) {
reportUrl = url.substring(0, url.indexOf('?'));
if (Url.getQuery('action', url)) {
reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', url));
}
}
if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resp.base_resp.ret === 'undefined')) {
window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resp.base_resp.ret), {
mid: window.PAGE_MID,
view: 'wap_retcode'
});
}
}
} catch (e) {
obj.error && obj.error(xhr, {
type: 1,
error: e,
status: xhr.status
});
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 1,
HttpCode: xhr.status || 0,
Ret: 0
});
}
return;
}
}
if (_typeof(resp) === 'object' && ((_b = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _b === void 0 ? void 0 : _b.ret) !== 0) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 4,
HttpCode: xhr.status || 0,
Ret: ((_c = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0
});
}
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type || '',
RequestType: requestType || 0,
RetType: 0,
HttpCode: xhr.status || 0,
Ret: ((_d = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _d === void 0 ? void 0 : _d.ret) || 0
});
}
}
obj.success && obj.success(resp);
} catch (e) {
__moon_report({
offset: MOON_AJAX_SUCCESS_OFFSET,
e: e
});
throw e;
}
};
var handleRespErr = function handleRespErr(xhr, error, requestType) {
try {
obj.error && obj.error(xhr, {
type: 2,
error: error,
status: xhr.status
});
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '',
Method: type,
RequestType: requestType,
RetType: 2,
HttpCode: xhr.status,
Ret: 0
});
}
} catch (e) {
__moon_report({
offset: MOON_AJAX_ERROR_OFFSET,
e: e
});
throw e;
}
};
var handleRespComplete = function handleRespComplete() {
clearTimeout(timer);
try {
obj.complete && obj.complete();
} catch (e) {
__moon_report({
offset: MOON_AJAX_COMPLETE_OFFSET,
e: e
});
throw e;
}
obj.complete = null;
};
var handleReqTimeout = function handleReqTimeout(xhr) {
if (typeof obj.timeout !== 'undefined') {
timer = setTimeout(function () {
xhr.abort();
try {
obj.complete && obj.complete();
} catch (e) {
__moon_report({
offset: MOON_AJAX_COMPLETE_OFFSET,
e: e
});
throw e;
}
obj.complete = null;
__moon_report({
offset: MOON_AJAX_TIMEOUT_OFFSET,
log: "ajax_timeout_error: ".concat(url),
e: ''
});
}, obj.timeout);
}
};
var retryXhrFn = function retryXhrFn(res, isTimeout, reqLogItem) {
var retryXhr = new XMLHttpRequest();
try {
retryXhr._noVConsole = true;
} catch (err) {}
retryXhr.open(type, url);
retryXhr.onreadystatechange = function () {
if (isTimeout) return;
if (retryXhr.readyState === 3) {
obj.received && obj.received(retryXhr);
}
if (retryXhr.readyState === 4) {
beforeResp(retryXhr);
var retryStatus = retryXhr.status;
if (retryStatus >= 200 && retryStatus < 400) {
handleRespSucc(retryXhr, 1);
} else {
handleRespErr(retryXhr, res, 1);
window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure', JSON.stringify({
retryXhrStatus: retryStatus,
transferRes: res
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
}
reqLogItem.status = retryStatus;
reqLogItem.endTime = Date.now();
reqLogItem.response = retryXhr.responseText;
handleRespComplete();
networkEndLog(reqLogItem);
}
};
setXhrHeader(retryXhr, type, obj);
retryXhr.send(data);
};
if (ajaxScope && !obj.pureHttp) {
var header = {
'User-Agent': navigator.userAgent,
'Cookie': (window.__test_env__ ? 'uniproxy_route=1; ' : '') + document.cookie,
'Referer': location.href
};
if (obj.contentType) {
header['Content-Type'] = obj.contentType;
} else if (type === 'POST') {
header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
if (!obj.noXRequestedWidthHeader) {
header['X-Requested-With'] = 'XMLHttpRequest';
}
var reqUrl = new URL(url, location.href).href;
var method = METHOD_ENUM[type] || 0;
var params = Device.os.pc ? {
url: reqUrl,
req_json: data || '',
scope: ajaxScope,
webcgi_method: method,
webcgi_header: Object.keys(header).map(function (headerItemKey) {
return Device.os.Mac ? _defineProperty({}, headerItemKey, header[headerItemKey]) : {
key: headerItemKey,
value: header[headerItemKey]
};
}),
cgi_type: 1
} : {
reqUrl: reqUrl,
reqBody: data,
scope: ajaxScope,
method: method,
header: header
};
var reqLogItem = networkStartLog({
method: type,
url: url,
postData: obj.data || {},
requestHeader: header,
requestType: 'transfer',
startTime: Date.now(),
responseType: url.indexOf('f=json') > 0 ? 'json' : undefined
});
var isTimeout = false;
handleReqTimeout({
abort: function abort() {
isTimeout = true;
reqLogItem.endTime = Date.now();
reqLogItem.response = 'timeout';
networkEndLog(reqLogItem);
}
});
Device.os.pc && monitor$1.setSum(115849, 69, 1);
JSAPI.invoke(Device.os.pc ? 'H5ExtTransfer' : 'webTransfer', params, function (res) {
var _a, _b, _c, _d, _e, _f;
if (isTimeout) return;
var status = 400;
var result = '';
if (Device.os.pc) {
try {
var retFlag = res.base_resp.ret === 0 && res.jsapi_resp.ret === 0 && res.err_msg.indexOf(':ok') > -1;
var respJsonFlag = res.jsapi_resp.resp_json;
status = retFlag && respJsonFlag ? 200 : 400;
result = res.jsapi_resp.resp_json;
} catch (err) {
console.error(err);
}
} else {
status = res && res.errCode * 1 === 0 && typeof res.result === 'string' && res.result ? 200 : 400;
result = res.result;
}
try {
Log.log("ajax transfer, status: ".concat(status, ", reqUrl: ").concat(reqUrl));
} catch (err) {
console.error(err);
}
if (status >= 200 && status < 400) {
obj.received && obj.received(null);
beforeResp({
status: status
});
handleRespSucc({
status: status,
responseText: result
}, 10);
reqLogItem.status = status;
reqLogItem.endTime = Date.now();
reqLogItem.response = result;
handleRespComplete();
networkEndLog(reqLogItem);
} else if (window.__second_open__) {
JSAPI.invoke('request', {
url: reqUrl,
method: type,
data: data,
header: header
}, function (retryRes) {
try {
Log.log("ajax retry request, retryStatus: ".concat((retryRes === null || retryRes === void 0 ? void 0 : retryRes.statusCode) || '', ", reqUrl: ").concat(reqUrl));
} catch (err) {
console.error(err);
}
if (isTimeout) return;
var retryStatus = retryRes.statusCode;
obj.received && obj.received(null);
beforeResp({
status: retryStatus
});
if (retryRes.err_msg.indexOf(':ok') > -1 && retryStatus >= 200 && retryStatus < 400) {
handleRespSucc({
status: retryStatus,
responseText: retryRes.data
}, 20);
} else {
retryXhrFn(res, isTimeout, reqLogItem);
handleRespErr({
status: retryStatus
}, res, 20);
window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure_sec_open', JSON.stringify({
retryReqJsapiRes: retryRes,
transferRes: res,
url: reqUrl
}), {
mid: 'mmbizwap:ajaxtransfer',
view: 'wap_business'
});
}
reqLogItem.status = retryStatus;
reqLogItem.endTime = Date.now();
reqLogItem.response = retryRes.data;
handleRespComplete();
networkEndLog(reqLogItem);
});
} else {
retryXhrFn(res, isTimeout, reqLogItem);
}
if (Device.os.pc) {
if (!res.err_msg.includes(':ok')) {
(_b = (_a = window.WX_BJ_REPORT) === null || _a === void 0 ? void 0 : _a.BadJs) === null || _b === void 0 ? void 0 : _b.report("pc transfer res no ok: ".concat(res.err_msg), params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
try {
if (res.jsapi_resp.resp_json && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 0 && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 190001 || res.base_resp.ret !== 0 || res.jsapi_resp.ret !== 0) {
(_d = (_c = window.WX_BJ_REPORT) === null || _c === void 0 ? void 0 : _c.BadJs) === null || _d === void 0 ? void 0 : _d.report("pc transfer res invalid ret", params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
} catch (err) {}
} else {
try {
if (res.errCode !== 0) {
(_f = (_e = window.WX_BJ_REPORT) === null || _e === void 0 ? void 0 : _e.BadJs) === null || _f === void 0 ? void 0 : _f.report("mobile transfer res invalid ret", params.url || '', {
mid: window.PAGE_MID,
_info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res))
});
}
} catch (err) {}
}
});
beforeReq();
return;
}
var xhr = new XMLHttpRequest();
var mayAbort = !!obj.mayAbort;
var async = typeof obj.async === 'undefined' ? true : obj.async;
var _onreadystatechange = xhr.onreadystatechange;
xhr.open(type, url, async);
xhr.onreadystatechange = function () {
if (typeof _onreadystatechange === 'function') {
_onreadystatechange.apply(xhr);
}
if (xhr.readyState === 3) {
obj.received && obj.received(xhr);
}
if (xhr.readyState === 4) {
beforeResp(xhr);
xhr.onreadystatechange = null;
var status = xhr.status;
if (status >= 200 && status < 400) {
handleRespSucc(xhr, 1);
} else {
handleRespErr(xhr, 'status error', 1);
if (!!status || !mayAbort) {
var __ajaxtest = window.__ajaxtest || '0';
__moon_report({
offset: MOON_AJAX_NETWORK_OFFSET,
log: "ajax_network_error[".concat(status, "][").concat(__ajaxtest, "]: ").concat(url, ";host:").concat(location.host),
e: ''
});
}
}
handleRespComplete();
}
};
setXhrHeader(xhr, type, obj);
handleReqTimeout(xhr);
try {
xhr.send(data);
try {
if (url && url.length > LENGTH_LIMIT) {
reportAjaxLength(27613, 17, "ajax get limit[length: ".concat(url.length, "]").concat(url.substring(0, 1024)));
}
if (data && !(data instanceof Blob) && data.length > LENGTH_LIMIT) {
reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.length, "]").concat(data.substring(0, 1024)));
}
if (data && data instanceof Blob && data.size > LENGTH_LIMIT) {
reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.size, "]blob"));
}
} catch (e) {
}
} catch (e) {
obj.error && obj.error(xhr, {
type: 3,
error: e,
status: 0
});
}
beforeReq();
});
}
mmVersion.isWindowsWechat && mmVersion.compareHexVersion('0xf2550000') || mmVersion.isMacWechat && mmVersion.compareHexVersion('0xf2650000');
var getBrandServiceType = function getBrandServiceType() {
var serviceType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.service_type;
var _a, _b;
var brandServiceType = 0;
if (serviceType !== undefined) brandServiceType = serviceType + 1;
if (((_b = (_a = window.cgiData) === null || _a === void 0 ? void 0 : _a.trans_appmsg_info) === null || _b === void 0 ? void 0 : _b.trans_type) * 1 === 1) brandServiceType = 3;
return brandServiceType;
};
function setCurrentMpInfo(ifShow) {
var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true) || mmVersion.isAndroid && mmVersion.gtVersion('7.0.12', true);
var supportLiveStatus = mmVersion.isIOS && mmVersion.gtVersion('8.0.46', true) || mmVersion.isAndroid && mmVersion.gtVersion('8.0.46', true);
JSAPI.invoke('currentMpInfo', {
userName: window.user_name,
brandName: !!supportNewTopBar && window.nickname === '' ? '未命名账号' : window.title,
title: window.msg_title || '',
brandIcon: window.hd_head_img.replace(/\/0$/, '/132'),
itemShowType: window.item_show_type,
isPaySubscribe: window.isPaySubscribe,
topBarStyle: supportNewTopBar ? 1 : 0,
topBarShowed: ifShow,
disableShowFinderLiveTopBar: !ifShow && supportLiveStatus ? 1 : 0,
brandServiceType: getBrandServiceType()
}, function () {});
}
function AjaxWx(obj) {
var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {};
obj.url += obj.url.indexOf('?') === -1 ? '?fasttmplajax=1' : '&fasttmplajax=1';
if (getAjaxScope(obj.url)) {
Ajax(obj);
return;
}
if (obj.usePb) {
obj.type = 'POST';
obj.data = {
data: JSON.stringify(obj.data)
};
}
if (!/^(http:\/\/|https:\/\/|\/\/)/.test(obj.url)) {
obj.url = "https://mp.weixin.qq.com/".concat(obj.url.replace(/^\//, ''));
} else if (/^\/\//.test(obj.url)) {
obj.url = "https:".concat(obj.url);
}
if (obj.f !== 'html' && (obj.url.indexOf('?f=json') === -1 || obj.url.indexOf('&f=json') === -1)) {
obj.url += '&f=json';
}
if (!obj.notJoinUrl && obj.f !== 'html') {
obj.url = Url.joinUrl(obj.url);
}
Url.joinUserArticleRole(obj.url, !!obj.notJoinUrl, function (url) {
obj.url = url;
var urlObj = new URL(url, location.origin);
var data = null;
if (_typeof(obj.data) === 'object') {
var d = obj.data;
var ds = [];
for (var k in d) {
if (d.hasOwnProperty(k)) {
ds.push("".concat(k, "=").concat(encodeURIComponent(d[k])));
}
}
data = ds.join('&');
} else {
data = typeof obj.data === 'string' ? obj.data : null;
}
var header = {
Cookie: document.cookie,
referer: location.href
};
if (obj.contentType) {
header['Content-Type'] = obj.contentType;
} else if ((obj.type || 'GET').toUpperCase() === 'POST') {
header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
var reqLogItem = networkStartLog({
method: obj.type || 'GET',
url: obj.url,
postData: obj.data || {},
requestHeader: header,
requestType: 'jsapi',
startTime: Date.now()
});
var retryTime = 1;
var jsapiRequest = function jsapiRequest(obj, data) {
return JSAPI.invoke('request', {
url: obj.url,
method: obj.type,
data: data,
header: header
}, function (res) {
var _a, _b, _c, _d, _e, _f;
if (res.err_msg.indexOf(':ok') > -1 && (!res.statusCode || res.statusCode >= 200 && res.statusCode < 400)) {
if (reqType(obj, '/mp/getappmsgext')) {
window.receiveGetAppmsgExt = "".concat(res.statusCode, "|").concat(Date.now());
}
if (reqType(obj, '/mp/getappmsgad')) {
window.receiveGetAppmsgAd = "".concat(res.statusCode, "|").concat(Date.now());
}
if (retryTime === 1) {
obj.received && obj.received(null);
}
var resData = {};
if (res.data) {
try {
if (obj.dataType === 'json') {
resData = JSON.parse(res.data);
} else {
resData = res.data;
}
if (resData && resData.base_resp && ((_a = resData.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) {
var reportUrl = obj.url;
if (obj.url.indexOf('?') !== -1) {
reportUrl = obj.url.substring(0, obj.url.indexOf('?'));
if (Url.getQuery('action', obj.url)) {
reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', obj.url));
}
}
if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resData.base_resp.ret === 'undefined')) {
window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resData.base_resp.ret), {
mid: window.PAGE_MID,
view: 'wap_retcode'
});
}
}
} catch (e) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: ((_b = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _b === void 0 ? void 0 : _b.ret) || 0
});
}
console.error(e);
obj.error && obj.error(null, {
type: 1,
error: e,
status: res.statusCode
});
obj.complete && obj.complete();
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
return;
}
}
var tmpResData = {};
try {
tmpResData = JSON.parse(res.data);
} catch (e) {}
if (tmpResData && tmpResData.base_resp && tmpResData.base_resp.ret === -3 && retryTime < 2 && (mmVersion.isIOS || mmVersion.isAndroid && mmVersion.getInner() > '27000600')) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: ((_c = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0
});
}
var _retryTime = retryTime++;
JSAPI.invoke('updatePageAuth', {}, function (res) {
console.log('[skeleton] updatePageAuth', res);
monitor$1.setSum(112287, 3, 1);
if (res && res.err_msg && res.err_msg.indexOf(':ok') > -1) {
window.top.pass_ticket = encodeURIComponent(Url.getQuery('pass_ticket', res.fullUrl).html(false).replace(/\s/g, '+'));
if (obj.pass_ticket) {
obj.pass_ticket = window.top.pass_ticket;
}
console.warn('[skeleton] updatePageAuth resetTopbar');
var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true);
var showBottomBar = !!window.is_login;
if (window.top.item_show_type === '0' && supportNewTopBar) {
var top = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0;
setCurrentMpInfo(top > 40 && !showBottomBar);
}
try {
obj.url = Url.addParam(obj.url, 'retry', _retryTime, true);
} catch (err) {
console.error(err);
}
jsapiRequest(obj, data);
monitor$1.setSum(112287, 4, 1);
} else {
obj.success && obj.success(resData);
obj.complete && obj.complete();
if (mmVersion.isIOS) {
monitor$1.setSum(112287, 35, 1);
} else {
monitor$1.setSum(112287, 36, 1);
}
reqLogItem.status = 200;
reqLogItem.endTime = Date.now();
reqLogItem.response = resData;
networkEndLog(reqLogItem);
}
});
} else {
if (((_d = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _d === void 0 ? void 0 : _d.ret) !== 0) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 4,
HttpCode: res.statusCode || 0,
Ret: ((_e = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _e === void 0 ? void 0 : _e.ret) || 0
});
}
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 0,
HttpCode: res.statusCode || 0,
Ret: ((_f = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _f === void 0 ? void 0 : _f.ret) || 0
});
}
}
obj.success && obj.success(resData);
obj.complete && obj.complete();
reqLogItem.status = 200;
reqLogItem.endTime = Date.now();
reqLogItem.response = resData;
networkEndLog(reqLogItem);
}
} else if (res.err_msg.indexOf('no permission') > -1 || !mmVersion.isOnlyWechat) {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 1,
HttpCode: res.statusCode || 0,
Ret: 0
});
}
Ajax(obj);
if (res.err_msg.indexOf('no permission') > -1) {
console.warn('[JSAPI Request] No permission');
monitor$1.setSum(112287, 31, 1);
}
reqLogItem.status = 302;
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
} else {
if (!obj.dontReport) {
report36408({
CgiPath: urlObj.pathname || '',
Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '',
Query: urlObj.search || '',
PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '',
Method: obj.type || '',
RequestType: 20,
RetType: 2,
HttpCode: res.statusCode || 0,
Ret: 0
});
}
obj.error && obj.error(null, {
type: 3,
error: res,
status: 0
});
obj.complete && obj.complete();
monitor$1.setSum(112287, 32, 1);
var sample = 0.001;
if (Math.random() < sample) {
var msg = "request: ".concat(JSON.stringify(obj.type), " ").concat(JSON.stringify(obj.url), " ;;;; cookie: ").concat(JSON.stringify(document.cookie), " ;;;; data: ").concat(JSON.stringify(data), " ;;;; resp: ").concat(JSON.stringify(res));
if (window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) {
window.WX_BJ_REPORT.BadJs.report('ajax_wx_request_error', msg, {
mid: 'mmbizwap:Monitor'
});
}
}
reqLogItem.status = 400;
reqLogItem.endTime = Date.now();
reqLogItem.response = res;
networkEndLog(reqLogItem);
}
});
};
if (reqType(obj, '/mp/getappmsgext')) {
window.startGetAppmsgExtTime = Date.now();
}
if (reqType(obj, '/mp/getappmsgad')) {
window.startGetAppmsgAdTime = Date.now();
}
jsapiRequest(obj, data);
});
}
function _regeneratorRuntime() { _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var AjaxRouter = function () {
var _ref = _asyncToGenerator( _regeneratorRuntime().mark(function _callee(obj) {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!window.__secPageAuthPromise) {
_context.next = 3;
break;
}
_context.next = 3;
return window.__secPageAuthPromise;
case 3:
if (!(!mmVersion.isWxWork && (window.__second_open__ || !getIsAcrossOrigin() && top.window.__second_open__) && window.__is_page_auth_return__ && !obj.pureHttp)) {
_context.next = 5;
break;
}
return _context.abrupt("return", AjaxWx(obj));
case 5:
return _context.abrupt("return", Ajax(obj));
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return function AjaxRouter(_x) {
return _ref.apply(this, arguments);
};
}();
var isx5 = navigator.userAgent.indexOf('TBS/') !== -1;
var getDataFunc = [];
var reportData = [];
var specificData = {};
function joinUrl(url) {
var obj = {};
if (typeof window.uin !== 'undefined') {
obj.uin = window.uin;
}
if (typeof window.key !== 'undefined') {
obj.key = window.key;
}
if (typeof window.pass_ticket !== 'undefined') {
obj.pass_ticket = window.pass_ticket;
}
if (typeof window.wxtoken !== 'undefined') {
obj.wxtoken = window.wxtoken;
}
if (typeof window.devicetype !== 'undefined') {
obj.devicetype = window.devicetype;
}
if (typeof window.clientversion !== 'undefined') {
obj.clientversion = window.clientversion;
}
if (typeof window.appmsg_token !== 'undefined') {
obj.appmsg_token = window.appmsg_token;
} else if (url.indexOf('advertisement_report') > -1) {
new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random());
}
obj.x5 = isx5 ? '1' : '0';
obj.f = 'json';
return Url.join(url, obj);
}
function isObj(obj) {
return obj && _typeof(obj) === 'object';
}
function assign(target, source) {
if (isObj(target) && isObj(source)) {
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
function assembleReportData(initiative) {
var leaveReportLog = [];
leaveReportLog.push({
content: "[LeaveReport] specificData keys: ".concat(Object.keys(specificData)),
timestamp: Date.now()
});
Log.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData)));
console.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData)));
var allReportData = {};
for (var reportField in specificData) {
if (!allReportData[reportField]) {
allReportData[reportField] = {};
}
for (var i = 0; i < specificData[reportField].length; i++) {
var param = specificData[reportField][i];
if (typeof param === 'function') {
try {
assign(allReportData[reportField], param(initiative));
} catch (err) {
leaveReportLog.push({
content: "[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)),
timestamp: Date.now()
});
Log.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)));
console.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)));
}
} else if (isObj(param)) {
assign(allReportData[reportField], param);
}
}
}
leaveReportLog.push({
content: "[LeaveReport] reportData.length: ".concat(reportData.length),
timestamp: Date.now()
});
Log.log("[LeaveReport] reportData.length: ".concat(reportData.length));
console.log("[LeaveReport] reportData.length: ".concat(reportData.length));
leaveReportLog.push({
content: "[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length),
timestamp: Date.now()
});
Log.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length));
console.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length));
for (var _i = 0; _i < getDataFunc.length; _i++) {
try {
var data = getDataFunc[_i](initiative);
if (isObj(data)) {
reportData.push(data);
}
} catch (err) {
leaveReportLog.push({
content: "[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)),
timestamp: Date.now()
});
Log.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)));
console.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)));
}
}
for (var _i2 = 0; _i2 < reportData.length; _i2++) {
if (reportData[_i2].reportUrl) {
reportData[_i2].reportUrl = joinUrl(reportData[_i2].reportUrl);
}
}
allReportData.data = {
'requestList': reportData
};
leaveReportLog.push({
content: "[LeaveReport] final reportData.length: ".concat(reportData.length, ", data=").concat(JSON.stringify(reportData)),
timestamp: Date.now()
});
Log.log("[LeaveReport] final reportData.length: ".concat(reportData.length));
console.log("[LeaveReport] final reportData.length: ".concat(reportData.length));
allReportData.info = leaveReportLog;
return allReportData;
}
function addReport(param) {
if (typeof param === 'function') {
getDataFunc.push(param);
} else if (isObj(param)) {
reportData.push(param);
}
}
function addSpecificReport(reportField, param) {
if (!specificData[reportField]) {
specificData[reportField] = [];
}
specificData[reportField].push(param);
}
function reportNow(callback) {
var allReportData = assembleReportData(true);
JSAPI.invoke('handleMPPageAction', {
action: 'reportByLeaveForMPGateway',
reportData: allReportData
}, function (res) {
if (res && res.err_msg && res.err_msg.indexOf(':ok') !== -1) {
getDataFunc = [];
reportData = [];
specificData = {};
typeof callback === 'function' && callback(res);
} else {
getDataFunc = [];
reportData = [];
var len = allReportData.data.requestList.length;
allReportData.data.requestList.forEach(function (req) {
if (req.reportUrl) {
AjaxRouter({
type: req.method || 'GET',
url: req.reportUrl,
data: req.reportData,
async: false,
success: function success(resp) {
if (--len < 0) {
typeof callback === 'function' && callback({
err_msg: 'handleMPPageAction:ok',
fallback: true,
resp: resp
});
}
},
error: function error(xhr, err) {
if (--len < 0) {
typeof callback === 'function' && callback({
err_msg: 'handleMPPageAction:fail',
fallback: true,
err: err
});
}
}
});
}
});
}
});
}
var leaveReport = {
reportNow: reportNow,
addReport: addReport,
addSpecificReport: addSpecificReport
};
var _leaveReport = (function () {
var doc = {};
var isCrossOrigin = false;
try {
doc = top.window.document;
} catch (e) {
isCrossOrigin = true;
}
if (!isCrossOrigin && top.window.__leaveReport) {
return top.window.__leaveReport;
}
if (window.__leaveReport) {
return window.__leaveReport;
}
JSAPI.on('reportOnLeaveForMP', function () {
return assembleReportData(false);
});
return window.__leaveReport = leaveReport;
})();
var getReportJson = function getReportJson(logId, rawData) {
var data = JSON.parse(JSON.stringify(rawData));
data.log_id = Number(logId);
data.TimeStamp = Math.round(Date.now() / 1000);
console.log('[comm_report] reportjson: ', data);
return JSON.stringify(data);
};
var getSuccessHandler = function getSuccessHandler(logId, data, opt) {
return function (res) {
if (res && res.err_code !== 0) {
console.warn("[comm_report] report ".concat(logId, " fail: "), res.err_msg, data);
}
if (typeof opt.success === 'function') {
opt.success(res);
}
};
};
var getErrorHandler = function getErrorHandler(logId, data, opt) {
return function (xhr, info) {
console.error("[comm_report] report ".concat(logId, " error: "), info, data);
if (typeof opt.error === 'function') {
opt.error(xhr, info);
}
};
};
var batchReportDataArr = [];
var blackLogId = [25587, 18832, 28208, 25574, 29139, 10945];
var BATCH_SIZE = 4;
var BATCH_TIME = 1000;
var getRepeatedReportJson = function getRepeatedReportJson() {
if (!batchReportDataArr || !batchReportDataArr.length) return false;
var reportData = {
count: 0
};
reportData.count = batchReportDataArr.length;
batchReportDataArr.forEach(function (data, index) {
reportData["reportjson".concat(index)] = data;
});
batchReportDataArr = [];
console.log('[reportData]: ', reportData);
return reportData;
};
var timeOutId;
function batchReport() {
if (!batchReportDataArr || !batchReportDataArr.length) return;
var repeatedReportJson = getRepeatedReportJson();
if (!repeatedReportJson) return;
AjaxRouter({
type: 'POST',
dataType: 'json',
url: '/mp/wapcommreport?action=batch_report',
data: repeatedReportJson,
dontReport: true,
success: function success(res) {
if (res && res.err_code) {
console.warn("[comm_report] batch report fail: ", res.err_msg, batchReportDataArr);
}
},
error: function error(xhr, info) {
console.error("[comm_report] batch report error: ", info, batchReportDataArr);
}
});
}
function batchReportThrottle(logId, rawData) {
var reportJsonData = getReportJson(logId, rawData);
if (!reportJsonData) return;
batchReportDataArr.push(reportJsonData);
if (batchReportDataArr.length >= BATCH_SIZE) {
batchReport();
} else {
if (!timeOutId) {
timeOutId = setTimeout(function () {
batchReport();
clearTimeout(timeOutId);
timeOutId = null;
}, BATCH_TIME);
}
}
}
_leaveReport.addReport(function () {
var repeatedReportJson = getRepeatedReportJson();
if (!repeatedReportJson) return false;
var reportData = [];
for (var _i = 0, _Object$entries = Object.entries(repeatedReportJson); _i < _Object$entries.length; _i++) {
var _Object_i = _slicedToArray(_Object$entries[_i], 2),
key = _Object_i[0],
value = _Object_i[1];
reportData.push("".concat(key, "=").concat(encodeURIComponent(value)));
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport?action=batch_report',
reportData: reportData.join('&'),
method: 'POST'
};
});
var commReport = {
report: function report(logId, rawData, rawOpt) {
var opt = rawOpt || {};
if (!opt.realTime && !blackLogId.includes(logId)) {
batchReportThrottle(logId, rawData);
} else {
AjaxRouter({
type: 'POST',
dataType: 'json',
url: '/mp/wapcommreport',
data: {
reportjson: getReportJson(logId, rawData)
},
async: opt.async,
success: getSuccessHandler(logId, rawData, opt),
error: getErrorHandler(logId, rawData, opt)
});
}
},
leaveReport: function leaveReport(logId, rawData) {
_leaveReport.addReport(function () {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport',
reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))),
method: 'POST'
};
});
},
reportByBeacon: function reportByBeacon(logId, rawData) {
try {
if (!Device.os.android && !Device.os.ios && !Device.os.harmony) {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
var url = '/mp/wapcommreport';
var reportJsonData = encodeURIComponent(getReportJson(logId, data));
console.log("reportByBeacon", JSON.stringify(reportJsonData));
navigator.sendBeacon(Url.joinUrl(url), "reportjson=".concat(reportJsonData));
} else {
_leaveReport.addReport(function () {
var data = typeof rawData === 'function' ? rawData() : rawData;
if (!data) {
return false;
}
return {
reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport',
reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))),
method: 'POST'
};
});
}
} catch (error) {
console.log(error);
}
}
};
var html = function html(_str, encode) {
if (!_str) return '';
var replace = ['`', '`', ''', '\'', '"', '"', ' ', ' ', '>', '>', '<', '<', '¥', '¥', '&', '&', '<', '<', '>', '>'];
var replaceReverse = ['&', '&', '¥', '¥', '<', '<', '>', '>', ' ', ' ', '"', '"', '\'', ''', '`', '`'];
var str = _str;
var target;
if (encode) {
target = replaceReverse;
} else {
target = replace;
}
for (var i = 0; i < target.length; i += 2) {
str = str.replace(new RegExp(target[i], 'g'), target[i + 1]);
}
return str;
};
var htmlLite = function htmlLite(_str, encode) {
if (!_str) return '';
var replace = ['`', '`', ''', '\'', '"', '"', '>', '>', '<', '<', '&', '&'];
var replaceReverse = ['&', '&', '<', '<', '>', '>', '"', '"', '\'', ''', '`', '`'];
var str = _str;
var target;
if (encode) {
target = replaceReverse;
} else {
target = replace;
}
for (var i = 0; i < target.length; i += 2) {
str = str.replace(new RegExp(target[i], 'g'), target[i + 1]);
}
return str;
};
var htmlEncode = function htmlEncode(str) {
return html(str, true);
};
var htmlDecode = function htmlDecode(str) {
return html(str, false);
};
var htmlEncodeLite = function htmlEncodeLite(str) {
return htmlLite(str, true);
};
var htmlDecodeLite = function htmlDecodeLite(str) {
return htmlLite(str, false);
};
String.prototype.html = function (encode) {
return html(this.toString(), encode);
};
String.prototype.htmlEncode = function () {
return htmlEncode(this.toString());
};
String.prototype.htmlDecode = function () {
return htmlDecode(this.toString());
};
String.prototype.htmlLite = function (encode) {
return htmlLite(this.toString(), encode);
};
String.prototype.htmlEncodeLite = function () {
return htmlEncodeLite(this.toString());
};
String.prototype.htmlDecodeLite = function () {
return htmlDecodeLite(this.toString());
};
var isIOS = mmVersion.isIOS,
isAndroid = mmVersion.isAndroid;
var renderDom = function renderDom(dom, cnt, hasStar) {
if (dom) {
if (hasStar) {
dom.innerText = "已星标";
} else {
dom.innerText = "星标";
}
if (hasStar) {
dom.classList.add('rich_media_meta_star');
dom.classList.remove('rich_media_meta_star_cancel');
} else {
dom.classList.add('rich_media_meta_star_cancel');
dom.classList.remove('rich_media_meta_star');
}
dom.style.removeProperty('display');
localStorage.setItem('star_info', JSON.stringify({
mid: window.mid,
idx: window.idx,
has_star: !!hasStar
}));
}
};
var __setStar = function __setStar(dom, cnt, statStatus) {
var hasReportExpose = false;
var hasStar = statStatus;
var realCnt = cnt;
function addStar() {
var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
hasStar = 1;
realCnt = realCnt + 1;
renderDom(dom, realCnt, hasStar);
if (dispatchEvent) window.dispatchEvent(new CustomEvent('star'));
}
function cancelStar() {
var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
hasStar = 0;
realCnt = realCnt - 1;
renderDom(dom, realCnt, hasStar);
if (dispatchEvent) window.dispatchEvent(new CustomEvent('cancel-star'));
}
if (dom) {
renderDom(dom, cnt, statStatus);
var clickHander = function clickHander() {
if (hasStar === 0) {
JSAPI.invoke('operateStar', {
opType: 'addStar'
}, function (res) {
if (res.err_msg && /:ok$/.test(res.err_msg)) addStar();
});
} else {
JSAPI.invoke('operateStar', {
opType: 'cancelStar'
}, function (res) {
if (res.err_msg && /:ok$/.test(res.err_msg)) cancelStar();
});
}
var data = {
BizUin: window.biz,
AppMsgID: window.mid * 1,
ItemIndex: window.idx * 1,
Scene: window.scene,
SubScene: window.subscene * 1,
EnterId: window.enterid,
SessionId: "".concat(window.sessionid),
Event: hasStar ? 8 : 7,
ItemShowType: window.item_show_type * 1
};
commReport.report(17335, data);
};
var exposeHandler = function exposeHandler() {
if (hasReportExpose) return;
var data = {
BizUin: window.biz,
AppMsgID: window.mid * 1,
ItemIndex: window.idx * 1,
Scene: window.scene,
SubScene: window.subscene * 1,
EnterId: window.enterid,
SessionId: "".concat(window.sessionid),
Event: 6,
ItemShowType: window.item_show_type * 1
};
commReport.report(17335, data);
hasReportExpose = true;
};
dom.addEventListener('click', clickHander);
JSAPI.on('onPageStarStateChanged', function (res) {
console.log('onPageStarStateChanged', res);
if (res.state) addStar();else cancelStar();
window.__hasStarInLifecycle = !!hasStar;
});
var intersectionObserver = new IntersectionObserver(exposeHandler);
intersectionObserver.observe(dom);
window.addEventListener('star', function (e) {
if (e && e.detail && e.detail.from === 'frontend') addStar(false);
});
window.addEventListener('cancel-star', function (e) {
if (e && e.detail && e.detail.from === 'frontend') cancelStar(false);
});
document.addEventListener('visibilitychange', function () {
var visible = document.visibilityState === 'visible';
if (!visible) return;
window.__hasStarInLifecycle = !!hasStar;
});
}
};
if (!window.__second_open__) {
var starDom = document.querySelector('#js_star');
var canUseStar = window.canUseStar || isIOS && mmVersion.compareHexVersion('18003623') || isAndroid && mmVersion.compareHexVersion('28003630');
var startPersonCnt = window.star_person_cnt || '';
console.log('canUseStar, startPersonCnt', canUseStar, startPersonCnt);
if (!!(canUseStar * 1)) {
var starSwitch = localStorage.getItem('mp_star_switch');
if (starSwitch === 'true') {
var starInfo = localStorage.getItem('star_info');
var hasStar = 0;
if (starInfo) {
var parseStarInfo = JSON.parse(starInfo);
if (Number(parseStarInfo.mid) === Number(window.mid) && Number(parseStarInfo.idx) === Number(window.idx) && parseStarInfo.has_star) {
hasStar = 1;
}
}
starDom && renderDom(starDom, startPersonCnt * 1, hasStar);
var spanElement = document.getElementById('meta_content_hide_info');
spanElement && spanElement.classList.remove('rich_media_meta_padding');
} else {
starDom && starDom.parentNode.removeChild(starDom);
}
} else {
starDom && starDom.parentNode.removeChild(starDom);
}
window.__setStar = __setStar;
}
exports.__setStar = __setStar;
exports.renderDom = renderDom;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
})({});
华南温德姆20城49店通兑覆盖长沙、张家界、武汉、广州等20座热门城市,49家门店随心任选,高铁中转、山林游玩、都市逛吃多种出行需求一站式适配,跨城出游灵活省心。
= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } var doc$1 = {}; var isAcrossOrigin$1 = false; var notFoundedMPPageAction = []; var __moon_report$1 = window.__moon_report || function () {}; var MOON_JSAPI_KEY_OFFSET = 8; try { doc$1 = top.window.document; } catch (e) { isAcrossOrigin$1 = true; } if (!window.JSAPIEventCallbackMap) { window.JSAPIEventCallbackMap = {}; } function ready(onBridgeReady) { var bridgeReady = function bridgeReady() { try { if (onBridgeReady) { window.onBridgeReadyTime = window.onBridgeReadyTime || Date.now(); onBridgeReady(); } } catch (e) { __moon_report$1([{ offset: MOON_JSAPI_KEY_OFFSET, log: 'ready', e: e }]); throw e; } window.jsapiReadyTime = Date.now(); }; if (!isAcrossOrigin$1 && (typeof top.window.WeixinJSBridge === 'undefined' || !top.window.WeixinJSBridge.invoke)) { if (doc$1.addEventListener) { doc$1.addEventListener('WeixinJSBridgeReady', bridgeReady, false); } else if (doc$1.attachEvent) { doc$1.attachEvent('WeixinJSBridgeReady', bridgeReady); doc$1.attachEvent('onWeixinJSBridgeReady', bridgeReady); } } else { bridgeReady(); } } var invokeNotWaitA8key = ['notifyPageInfo', 'updatePageAuth' ]; var checkNotFoundedInvoke = function checkNotFoundedInvoke(methodName, args) { if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && notFoundedMPPageAction.includes(args === null || args === void 0 ? void 0 : args.action)) { return true; } return false; }; function invoke$1(_x, _x2, _x3) { return _invoke.apply(this, arguments); } function _invoke() { _invoke = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee(methodName, args, callback) { return _regeneratorRuntime$1().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__ && !invokeNotWaitA8key.includes(methodName))) { _context.next = 3; break; } _context.next = 3; return window.__secPageAuthPromise; case 3: ready(function () { if (isAcrossOrigin$1) return false; if (_typeof(top.window.WeixinJSBridge) !== 'object') { alert('请在微信中打开此链接'); return false; } if (checkNotFoundedInvoke(methodName, args)) { setTimeout(function () { if (callback) { callback.apply(window, [{ err_msg: "".concat(methodName, ":fail"), err_desc: 'action isn\'t supported' }]); } }, 0); } else { top.window.WeixinJSBridge.invoke(methodName, args, function () { try { for (var _len2 = arguments.length, rets = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { rets[_key2] = arguments[_key2]; } var ret = rets[0]; var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : ''; if (['handleMPPageAction', 'handleVideoAction', 'handleHaokanAction'].indexOf(methodName) !== -1) { var action = (args === null || args === void 0 ? void 0 : args.action) || ''; console.info('[system]', "[jsapi] invoke->".concat(methodName, ", action->").concat(action).concat(errMsg)); } else { console.info('[system]', "[jsapi] invoke->".concat(methodName).concat(errMsg)); } if (methodName === 'handleMPPageAction' && (args === null || args === void 0 ? void 0 : args.action) && ((ret === null || ret === void 0 ? void 0 : ret.err_desc) === 'action isn\'t supported' || (ret === null || ret === void 0 ? void 0 : ret.err_msg) === 'handleMPPageAction:fail action is not supported')) { notFoundedMPPageAction.push(args === null || args === void 0 ? void 0 : args.action); } if (callback) { callback.apply(window, rets); } } catch (e) { __moon_report$1([{ offset: MOON_JSAPI_KEY_OFFSET, log: "invoke;methodName:".concat(methodName), e: e }]); throw e; } }); } }); case 4: case "end": return _context.stop(); } }, _callee); })); return _invoke.apply(this, arguments); } function call(_x4) { return _call.apply(this, arguments); } function _call() { _call = _asyncToGenerator( _regeneratorRuntime$1().mark(function _callee2(methodName) { return _regeneratorRuntime$1().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (!(window.__secPageAuthPromise && !window.__is_page_auth_ok__)) { _context2.next = 3; break; } _context2.next = 3; return window.__secPageAuthPromise; case 3: ready(function () { if (isAcrossOrigin$1) return false; if (_typeof(top.window.WeixinJSBridge) !== 'object') { return false; } try { top.window.WeixinJSBridge.call(methodName); } catch (e) { __moon_report$1([{ offset: MOON_JSAPI_KEY_OFFSET, log: "call;methodName:".concat(methodName), e: e }]); throw e; } }); case 4: case "end": return _context2.stop(); } }, _callee2); })); return _call.apply(this, arguments); } function on(eventName, callback) { ready(function () { if (isAcrossOrigin$1) return false; if (_typeof(top.window.WeixinJSBridge) !== 'object' || !top.window.WeixinJSBridge.on) { return false; } if (!window.JSAPIEventCallbackMap[eventName]) { window.JSAPIEventCallbackMap[eventName] = []; } window.JSAPIEventCallbackMap[eventName].push(callback); if (window.JSAPIEventCallbackMap[eventName].length > 1) { return false; } top.window.WeixinJSBridge.on(eventName, function () { try { for (var _len = arguments.length, rets = new Array(_len), _key = 0; _key < _len; _key++) { rets[_key] = arguments[_key]; } var ret = rets[0]; var errMsg = ret && ret.err_msg ? ", err_msg-> ".concat(ret.err_msg) : ''; console.info('[system]', "[jsapi] event->".concat(eventName).concat(errMsg)); if (window.JSAPIEventCallbackMap[eventName] && window.JSAPIEventCallbackMap[eventName].length) { var result; for (var i = 0; i < window.JSAPIEventCallbackMap[eventName].length; i++) { result = window.JSAPIEventCallbackMap[eventName][i].apply(window, rets); } return result; } } catch (e) { __moon_report$1([{ offset: MOON_JSAPI_KEY_OFFSET, log: "on;eventName:".concat(eventName), e: e }]); throw e; } }); }); } function remove(eventName, callback) { ready(function () { if (!window.JSAPIEventCallbackMap[eventName]) { return false; } var result = false; for (var i = window.JSAPIEventCallbackMap[eventName].length - 1; i >= 0; i--) { if (window.JSAPIEventCallbackMap[eventName][i] === callback) { window.JSAPIEventCallbackMap[eventName].splice(i, 1); result = true; } } return result; }); } var JSAPI = { ready: ready, invoke: invoke$1, call: call, on: on, remove: remove }; function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); } function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } var ua = navigator.userAgent; var is_ios = /(iPhone|iPad|iPod|iOS)/i.test(ua); var is_wp = /Windows\sPhone/i.test(ua); var is_android = /(Android)/i.test(ua); var is_wechat = /MicroMessenger\/([\d\.]+)/i.test(ua); var is_mac = /mac\sos/i.test(ua) && !is_ios; var is_windows = /windows\snt/i.test(ua) && !is_wp; var is_mpapp = /MPAPP\/([\d\.]+)/i.test(ua); var is_ipad = /iPad/i.test(ua); var is_windows_wechat = /WindowsWechat/i.test(ua); var is_mac_wechat = /MacWechat/i.test(ua) || /wechat.*mac os/i.test(ua); var is_prefetch = is_wechat && window.WeixinPrefecherJSBridge; var is_donut_app = /SAAASDK/i.test(ua); var is_harmony = /OpenHarmony|ArkWeb/i.test(ua); var is_linux = /Linux\s/i.test(ua); var xweb_match = ua.match(/XWEB\/([\d.]+)/i); var xweb_version = xweb_match && xweb_match[1] ? parseInt(xweb_match[1], 10) : 0; var is_unified_pc_wechat = /UnifiedPC\w+Wechat/i.test(ua); var is_in_miniProgram = is_android && /miniprogram/.test(ua.toLowerCase()) || window.__wxjs_environment == 'miniprogram'; var is_wx_work = /wxwork/i.test(ua); function getUrlParams() { var vars = location.search.substring(1).split('&'); var params = {}; var _iterator = _createForOfIteratorHelper(vars), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var ele = _step.value; var pair = ele.split('='); var key = decodeURIComponent(pair[0]); if (typeof params[key] === 'undefined') { params[key] = decodeURIComponent(pair[1]); } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } return params; } function get() { var reg = /MicroMessenger\/([\d\.]+)/i; var ret = ua.match(reg); if (ret && ret[1]) { return ret[1]; } return false; } function getMac() { var reg = /MacWechat\/([\d\.]+)/i; var ret = ua.match(reg); if (ret && ret[1]) { return ret[1]; } return false; } function getMacOS() { var reg = /Mac OS X ([\d_]+)/i; var ret = ua.match(reg); if (ret && ret[1]) { return ret[1].replace(/_/g, '.'); } return false; } function getWindows() { var reg = /WindowsWechat\(0x(.+?)\)/i; var ret = ua.match(reg); if (ret && ret[1]) { return ret[1]; } return false; } function getWxWork() { var reg = /wxwork\/([\d\.]+)/i; var ret = ua.match(reg); if (ret && ret[1]) { return ret[1]; } return false; } function getMpApp() { var appVersion = [2, 4, 5]; var match = navigator.userAgent.match(/MPAPP\/(\d+(\.\d+)*)/); if (match) { appVersion = match[1].split('.').map(function (v) { return Number(v); }); } return appVersion.join('.'); } function getUnifiedPcVer() { var versionInfo = navigator.userAgent.match(/UnifiedPC\w+Wechat\(0xf\w{2}(\w+?)\w{2}\)/); if (versionInfo && versionInfo.length === 2) { var version = versionInfo[1]; var mainVersion = getVersionNumber(version.slice(0, 1)); var subVersion = getVersionNumber(version.slice(1, 2)); var subVersion2 = getVersionNumber(version.slice(2, 3)); return [mainVersion, subVersion, subVersion2].join('.'); } } function getVersionNumber(hexStr) { return Number(Number("0x".concat(hexStr)).toString(10)); } function getWindowsVersionFormat() { var versionInfo = navigator.userAgent.match(/WindowsWechat\(0x(\w+?)\)/); if (versionInfo && versionInfo.length === 2) { var version = versionInfo[1]; var mainVersion = getVersionNumber(version.slice(1, 2)); var subVersion = getVersionNumber(version.slice(2, 4)); var subVersion2 = getVersionNumber(version.slice(4, 6)); return [mainVersion, subVersion, subVersion2].join('.'); } return false; } function getInner() { var reg = /MicroMessenger\/[\d\.]+\(0x(.+?)\)/i; var ret = ua.match(reg); if (ret && ret[1] && ret[1] != null) { return ret[1]; } if (!ret && /MicroMessenger\/[\d\.]+/i.test(ua)) { var urlParams = getUrlParams(); if (urlParams.version) { return urlParams.version; } } return false; } var opfunc = { 'cp-1': function cp1(a, b) { return a < b; }, cp0: function cp0(a, b) { return a === b; }, cp1: function cp1(a, b) { return a > b; } }; function cpVersion(ver, op, canEq, type) { var mmver = false; switch (type) { case 'mac': mmver = getMac(); break; case 'windows': mmver = getWindowsVersionFormat(); break; case 'wxwork': mmver = getWxWork(); break; case 'mpapp': mmver = getMpApp(); break; case 'unifiedpc': mmver = getUnifiedPcVer(); break; default: mmver = get(); break; } if (!mmver) { return; } var mmversion = mmver.split('.'); var version = ver.split('.'); if (!/\d+/g.test(mmversion[mmversion.length - 1])) { mmversion.pop(); } for (var i = 0, len = Math.max(mmversion.length, version.length); i < len; ++i) { var mmv = mmversion[i] || ''; var v = version[i] || ''; var mmvn = parseInt(mmv, 10) || 0; var vn = parseInt(v, 10) || 0; var eq = opfunc.cp0(mmvn, vn); if (eq) { continue; } var cp = opfunc["cp".concat(op)]; return cp(mmvn, vn); } return canEq || op === 0; } function eqVersion(version) { return cpVersion(version, 0); } function gtVersion(version, canEq) { return cpVersion(version, 1, canEq); } function ltVersion(version, canEq) { return cpVersion(version, -1, canEq); } function getPlatform() { if (is_ios) { return 'ios'; } if (is_android) { return 'android'; } if (is_mac) { return 'mac_os'; } if (is_windows) { return 'windows'; } return 'unknown'; } var is_google_play = false; var inner_ver_for_google_play_check = getInner(); if (is_android && inner_ver_for_google_play_check) { var v = "0x".concat(inner_ver_for_google_play_check.substr(-2)); if (parseInt(v) >= 64 && parseInt(v) <= 79) { is_google_play = true; } } function compareHexVersion(hexNum) { var innerVersion = getInner(); if (innerVersion && hexNum) { if (typeof hexNum === 'string') { hexNum = parseInt(hexNum, 16); } var version = parseInt(innerVersion, 16); return version >= hexNum; } return false; } var mmVersion = { get: get, getMac: getMac, getMacOS: getMacOS, getWindows: getWindows, getInner: getInner, getWxWork: getWxWork, getMpApp: getMpApp, cpVersion: cpVersion, eqVersion: eqVersion, gtVersion: gtVersion, ltVersion: ltVersion, getPlatform: getPlatform, getVersionNumber: getVersionNumber, isWp: is_wp, isIOS: is_ios, isAndroid: is_android, isHarmony: is_harmony, isHarmonyWechat: is_harmony && is_wechat && cpVersion('1.0.0', 1, true), isInMiniProgram: is_in_miniProgram, isWechat: is_wechat, isMac: is_mac, isWindows: is_windows, isLinux: is_linux, isMacWechat: is_mac_wechat, isWindowsWechat: is_windows_wechat, isWxWork: is_wx_work, isOnlyWechat: is_wechat && !is_wx_work, isMpapp: is_mpapp, isIPad: is_ipad, isGooglePlay: is_google_play, isPrefetch: is_prefetch, isDonutAPP: is_donut_app, compareHexVersion: compareHexVersion, isPcWechat: is_windows_wechat || is_mac_wechat, xwebVersion: xweb_version, isUnifiedPcWechat: is_unified_pc_wechat }; function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var Device = {}; function detect(ua) { var MQQBrowser = ua.match(/MQQBrowser\/(\d+\.\d+)/i); var MQQClient = ua.match(/QQ\/(\d+\.(\d+)\.(\d+)\.(\d+))/i) || ua.match(/V1_AND_SQ_([\d\.]+)/); var WeChat = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/) || ua.match(/MicroMessenger\/((\d+)\.(\d+))/); var MacOS = ua.match(/Mac\sOS\sX\s(\d+[\.|_]\d+)/); var WinOS = ua.match(/Windows(\s+\w+)?\s+?(\d+\.\d+)/); var Linux = ua.match(/Linux\s/); var MiuiBrowser = ua.match(/MiuiBrowser\/(\d+\.\d+)/i); var M1 = ua.match(/MI-ONE/); var MIPAD = ua.match(/MI PAD/); var UC = ua.match(/UCBrowser\/(\d+\.\d+(\.\d+\.\d+)?)/) || ua.match(/\sUC\s/); var IEMobile = ua.match(/IEMobile(\/|\s+)(\d+\.\d+)/) || ua.match(/WPDesktop/); var ipod = ua.match(/(ipod).*\s([\d_]+)/i); var ipad = ua.match(/(ipad).*\s([\d_]+)/i); var iphone = ua.match(/(iphone)\sos\s([\d_]+)/i); var Chrome = ua.match(/Chrome\/(\d+\.\d+)/); var AndriodBrowser = ua.match(/Mozilla.*Linux.*Android.*AppleWebKit.*Mobile Safari/); var android = ua.match(/(android)\s([\d\.]+)/i); var harmony = ua.match(/(OpenHarmony)\s([\d\.]+)/i); Device.browser = Device.browser || {}, Device.os = Device.os || {}; Device.os.type = -1; Device.os.unifiedPC = ua.match(/UnifiedPC/); Device.os.unifiedMac = /UnifiedPCMac/i.test(ua); Device.os.unifiedWindows = /UnifiedPCWindows/i.test(ua); if (window.ActiveXObject) { var vie = 6; (window.XMLHttpRequest || ua.indexOf('MSIE 7.0') > -1) && (vie = 7); (window.XDomainRequest || ua.indexOf('Trident/4.0') > -1) && (vie = 8); ua.indexOf('Trident/5.0') > -1 && (vie = 9); ua.indexOf('Trident/6.0') > -1 && (vie = 10); Device.browser.ie = true, Device.browser.version = vie; } else if (ua.indexOf('Trident/7.0') > -1) { Device.browser.ie = true, Device.browser.version = 11; } if (android) { Device.os.android = true; Device.os.version = android[2]; Device.os.type = 2; } if (harmony) { Device.os.harmony = true; Device.os.version = harmony[2]; Device.os.type = 42; } if (ipod) { Device.os.ios = Device.os.ipod = true; Device.os.version = ipod[2].replace(/_/g, '.'); } if (ipad) { Device.os.ios = Device.os.ipad = true; Device.os.version = ipad[2].replace(/_/g, '.'); Device.os.type = 13; } if (iphone) { Device.os.iphone = Device.os.ios = true; Device.os.version = iphone[2].replace(/_/g, '.'); Device.os.type = 1; } if (WinOS) Device.os.windows = true, Device.os.version = WinOS[2], Device.os.type = 15; if (MacOS) Device.os.Mac = true, Device.os.version = MacOS[1], Device.os.type = 14; if (Linux) Device.os.Linux = true, Device.os.type = 33; if (ua.indexOf('lepad_hls') > 0) Device.os.LePad = true; if (MIPAD) Device.os.MIPAD = true; if (MQQBrowser) Device.browser.MQQ = true, Device.browser.version = MQQBrowser[1]; if (MQQClient) Device.browser.MQQClient = true, Device.browser.version = MQQClient[1]; if (WeChat) Device.browser.WeChat = true, Device.browser.mmversion = Device.browser.version = WeChat[1]; if (MiuiBrowser) Device.browser.MIUI = true, Device.browser.version = MiuiBrowser[1]; if (UC) Device.browser.UC = true, Device.browser.version = UC[1] || NaN; if (IEMobile) Device.browser.IEMobile = true, Device.browser.version = IEMobile[2]; if (AndriodBrowser) { Device.browser.AndriodBrowser = true; } if (M1) { Device.browser.M1 = true; } if (Chrome) { Device.browser.Chrome = true, Device.browser.version = Chrome[1]; } if (Device.os.windows) { if (typeof navigator.platform !== "undefined" && navigator.platform.toLowerCase() == "win64") { Device.os.win64 = true; } else { Device.os.win64 = false; } } if (Device.os.Mac || Device.os.windows || Device.os.Linux || Device.os.unifiedPC || /OpenHarmony/i.test(ua) && /pc/i.test(ua)) { Device.os.pc = true; } var osType = { iPad7: 'iPad; CPU OS 7', LePad: 'lepad_hls', XiaoMi: 'MI-ONE', SonyDTV: "SonyDTV", SamSung: 'SAMSUNG', HTC: 'HTC', VIVO: 'vivo' }; for (var os in osType) { Device.os[os] = ua.indexOf(osType[os]) !== -1; } Device.os.phone = Device.os.phone || /windows phone/i.test(ua); Device.os.getNumVersion = function () { return parseFloat(Device.os.version); }; Device.os.hasTouch = 'ontouchstart' in window; if (Device.os.hasTouch && Device.os.ios && Device.os.getNumVersion() < 6) { Device.os.hasTouch = false; } if (Device.browser.WeChat && Device.browser.version < 5.0) { Device.os.hasTouch = false; } Device.browser.getNumVersion = function () { return parseFloat(Device.browser.version); }; Device.browser.isFFCanOcx = function () { return !!Device.browser.firefox && Device.browser.getNumVersion() >= 3.0; }; Device.browser.isCanOcx = function () { return !!Device.os.windows && (!!Device.browser.ie || Device.browser.isFFCanOcx() || !!Device.browser.webkit); }; Device.browser.isNotIESupport = function () { return !!Device.os.windows && (!!Device.browser.webkit || Device.browser.isFFCanOcx()); }; Device.userAgent = {}; Device.userAgent.browserVersion = Device.browser.version; Device.userAgent.osVersion = Device.os.version; if (Device.os.unifiedPC) { if (Device.os.unifiedWindows) Device.os.type = 37;else if (Device.os.unifiedMac) Device.os.type = 38;else Device.os.type = 39; } delete Device.userAgent.version; } detect(window.navigator.userAgent); function canSupportH5Video() { var ua = window.navigator.userAgent, m = null; if (!!Device.os.android) { if (Device.browser.MQQ && Device.browser.getNumVersion() >= 4.2) { return true; } if (ua.indexOf('MI2') != -1) { return true; } if (Device.os.version >= '4' && (m = ua.match(/MicroMessenger\/((\d+)\.(\d+))\.(\d+)/))) { if (parseFloat(m[1]) >= 4.2) { return true; } } if (Device.os.version >= '4.1') { return true; } } return false; } function canSupportVideoMp4() { var video = document.createElement('video'); if (typeof video.canPlayType === 'function') { if (video.canPlayType('video/mp4; codecs="mp4v.20.8"') === 'probably') { return true; } if (video.canPlayType('video/mp4; codecs="avc1.42E01E"') === 'probably' || video.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"') === 'probably') { return true; } } return false; } function canSupportAutoPlay() { if (Device.os.ios && Device.os.getNumVersion() < 10) { return false; } return true; } function isLockdownMode() { if (!Device.os.ios || Device.os.getNumVersion() < 16) { return false; } if (typeof WebAssembly === 'undefined' && typeof OfflineAudioContext === 'undefined' && typeof WebGLRenderingContext === 'undefined') { return true; } return false; } Device.canSupportVideo = canSupportVideoMp4 || canSupportH5Video; Device.canSupportVideoMp4 = canSupportVideoMp4; Device.canSupportH5Video = canSupportH5Video; Device.canSupportAutoPlay = canSupportAutoPlay; Device.isLockdownMode = isLockdownMode; Device.cpVersion = function (version) { var cp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var canEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var nowVersionStr = Device.os.version; if (!nowVersionStr) return false; var versionArr = version.split('.'); var nowVersionArr = nowVersionStr.split('.'); for (var i = 0; i < Math.max(nowVersionArr.length, versionArr.length); i++) { var vi = +versionArr[i]; var nvi = +nowVersionArr[i]; if (vi === nvi) continue; if (cp > 0) return vi > nvi; if (cp < 0) return vi < nvi; } return canEqual || cp === 0; }; var initJsBridge = false; if (!window.JSAPIEventCallbackMap) { window.JSAPIEventCallbackMap = {}; } function connectWebViewJavascriptBridge(callback) { if (window.WebViewMPapp || window.WebViewJavascriptBridge) { return callback(window.WebViewMPapp || window.WebViewJavascriptBridge); } if (window.WVJBCallbacks) { return window.WVJBCallbacks.push(callback); } window.WVJBCallbacks = [callback]; if (!mmVersion.isMpapp) { return false; } if (!initJsBridge) { initJsBridge = true; var WVJBIframe = document.createElement('iframe'); WVJBIframe.style.display = 'none'; WVJBIframe.src = 'https://__bridge_loaded__'; document.body.appendChild(WVJBIframe); setTimeout(function () { initJsBridge = false; document.body.removeChild(WVJBIframe); }, 0); } return false; } function invoke(jsapiName, opt, callback) { connectWebViewJavascriptBridge(function (bridge) { try { if (typeof opt === 'function') { callback = opt; } if (_typeof(opt) !== 'object' && typeof opt !== 'string') { opt = {}; } bridge.callHandler(jsapiName, opt, function (res) { try { var ret = _typeof(res) === 'object' ? res : JSON.parse(res); var errMsg = ret.err_msg || ret.errMsg; console.info("[mpapp jsapi] invoke->".concat(jsapiName, " ").concat(opt.action || '', " ").concat(errMsg)); typeof callback === 'function' && callback(ret); } catch (e) { window.WX_BJ_REPORT.BadJs.report('invoke', "callback ".concat(jsapiName, " error:"), { mid: 'mmbizwebapp:js_brridge', _info: e }); console.error("[mpapp jsapi] ".concat(jsapiName, " ").concat(opt.action || ''), e, res); } }); } catch (e) { window.WX_BJ_REPORT.BadJs.report('invoke', 'callback error:', { mid: 'mmbizwebapp:js_brridge', _info: e }); console.error('[mpapp jsapi]', e); } }); } function _log(level, msg) { if (level === 'log') { level = 'info'; msg = "[WechatFe]".concat(msg); } else { var prefix = "__wap__".concat(window.__second_open__ ? ' (sec)' : ''); msg = "".concat(prefix, " ").concat(msg, " location:[").concat(location.href, "]"); } msg += new Error().stack; if (mmVersion.isMpapp) { invoke('WNNativeCallbackLog', msg); } else if (mmVersion.isWechat) { if (mmVersion.isAndroid) { console.warn('[system]', "[MicroMsg.JsApiLog][".concat(level, "] jslog : ").concat(msg)); } else if (mmVersion.isIOS) { JSAPI.invoke('writeLog', { level: level, msg: msg }); } else { JSAPI.invoke('log', { level: level, msg: msg }); } } } var Log = { info: function info() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _log('info', args.join(' ')); }, warn: function warn() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } _log('warn', args.join(' ')); }, error: function error() { for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } _log('error', args.join(' ')); }, debug: function debug() { for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } _log('debug', args.join(' ')); }, log: function log() { for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { args[_key5] = arguments[_key5]; } _log('info', args.join(' ')); } }; var reportLogs = []; var reportExtraLogs = []; var sendUrl = '/mp/jsmonitor?#wechat_redirect'; var monitor = {}; monitor._reportOptions = { idkey: {} }; function ObjWithoutProperty(source, exclude) { if (source === null) return {}; var target = {}; var sourceKeys = Object.keys(source); for (var i = 0; i < sourceKeys.length; i++) { var key = sourceKeys[i]; if (exclude.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function formatDataToString(data) { var reportData = []; for (var key in data) { if (Object.prototype.hasOwnProperty.call(data, key)) { reportData.push(key + '=' + encodeURIComponent(data[key])); } } return reportData.join('&'); } monitor.getReportData = function (opt) { opt = opt || {}; var idkey = monitor._reportOptions.idkey || {}; var key = null; var reportData = {}; var nextKey; try { for (key in idkey) { if (Object.prototype.hasOwnProperty.call(idkey, key) && idkey[key]) { reportLogs.push(key + '_' + idkey[key]); } } } catch (e) { return false; } if (reportLogs.length === 0) { return false; } if (reportExtraLogs.length) { reportData.lc = reportExtraLogs.length; reportExtraLogs.forEach(function (extraLog, index) { reportData["log".concat(index)] = extraLog; }); } try { var reportOptions = monitor._reportOptions; if (reportOptions !== null && reportOptions !== undefined) { for (nextKey in reportOptions) { if (Object.prototype.hasOwnProperty.call(reportOptions, nextKey)) { reportData[nextKey] = reportOptions[nextKey]; } } } } catch (e) { reportData = {}; } reportData.idkey = reportLogs.join(';'); reportData.t = Math.random(); if (opt.remove !== false) { reportLogs = []; reportExtraLogs = []; monitor._reportOptions = { idkey: {} }; } return reportData; }; monitor.setLogs = function (opt) { var id = opt.id; var key = opt.key; var value = opt.value; var extraLog = opt.log; var others = ObjWithoutProperty(opt, ['id', 'key', 'value', 'log']); var idkey = monitor._reportOptions.idkey || {}; var param = id + '_' + key; if (idkey[param]) { idkey[param] += value; } else { idkey[param] = value; } monitor._reportOptions.idkey = idkey; if (extraLog) { reportExtraLogs.push(extraLog); } try { if (others !== null && others !== undefined) { for (var otherKey in others) { if (Object.prototype.hasOwnProperty.call(others, otherKey)) { monitor._reportOptions[otherKey] = others[otherKey]; } } } } catch (e) { console.log(e); } return monitor; }; monitor.setAvg = function (id, key, value) { var idkey = monitor._reportOptions.idkey || {}; var param1 = id + '_' + key; var param2 = id + '_' + (key - 1); if (idkey[param1]) { idkey[param1] += value; } else { idkey[param1] = value; } if (idkey[param2]) { idkey[param2] += 1; } else { idkey[param2] = 1; } monitor._reportOptions.idkey = idkey; return monitor; }; monitor.setSum = function (id, key) { var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; var idkey = monitor._reportOptions.idkey; var param = id + '_' + key; if (idkey[param]) { idkey[param] += value; } else { idkey[param] = value; } monitor._reportOptions.idkey = idkey; return monitor; }; monitor.send = function (async, ajax, origin) { if (async !== false) { async = true; } var data = monitor.getReportData(); origin = origin || ''; if (!data) { return; } if (!!ajax && ajax instanceof Function) { ajax({ url: origin + sendUrl, type: 'POST', mayAbort: true, data: data, async: async, timeout: 2000, dontReport: true }); } else { new Image().src = origin + '/mp/jsmonitor?' + formatDataToString(data) + '#wechat_redirect'; } }; if (typeof window !== 'undefined' && window.__monitor) { monitor = window.__monitor; } else { typeof window !== 'undefined' && (window.__monitor = monitor); } var monitor$1 = monitor; var logList = []; var log = function log(msg) { logList.push(msg); }; var printLog = function printLog() { for (var i = 0, len = logList.length; i < len; ++i) { console.log("[RespType]".concat(logList[i])); } }; var isArray = function isArray(val) { return Object.prototype.toString.call(val) === '[object Array]'; }; var getValueType = function getValueType(value) { if (isArray(value)) { return 'array'; } return _typeof(value); }; var parseRtDesc = function parseRtDesc(rtDesc, k) { var type = 'mix'; var isRequired = false; var key = k; if (k) { var requireKeyWord = '_R'; var pos = k.indexOf(requireKeyWord); var len = k.length - requireKeyWord.length; isRequired = pos !== -1 && pos === len; key = isRequired ? k.substring(0, len) : k; } if (typeof rtDesc === 'string') { type = rtDesc; } else if (isArray(rtDesc)) { type = 'array'; } else if (_typeof(rtDesc) === 'object') { type = 'object'; } return { key: key, type: type, isRequired: isRequired }; }; var checkForArrayRtDesc = function checkForArrayRtDesc(arr, rtDescs) { if (!isArray(arr)) { return false; } for (var i = 0, len = arr.length; i < len; ++i) { var value = arr[i]; var rtDesc = void 0; var j = 0; var flag = rtDescs.length === 0; while (rtDesc = rtDescs[j++]) { if (checkForRtDesc(value, rtDesc)) { flag = true; break; } } if (!flag) { return false; } } return true; }; var checkForStringRtDesc = function checkForStringRtDesc(value, rtDesc) { var valueType = getValueType(value); var desc = parseRtDesc(rtDesc); var ret = desc.type === valueType; if (!ret) { log("miss match type : ".concat(valueType, " !== ").concat(desc.type)); } return ret; }; var checkForObjectRtDesc = function checkForObjectRtDesc(json, rtDesc) { if (_typeof(json) !== 'object' || isArray(json)) { log('must be object'); return false; } var rootJson = json; var nowCheckValue = json; for (var k in rtDesc) { if (rtDesc.hasOwnProperty(k)) { var nowCheckDesc = rtDesc[k]; var desc = parseRtDesc(nowCheckDesc, k); var key = desc.key; nowCheckValue = rootJson[key]; var valueType = getValueType(nowCheckValue); if (desc.isRequired && nowCheckValue === undefined) { log("is required @key=".concat(key)); return false; } if (nowCheckValue !== undefined) { if (valueType !== desc.type && desc.type !== 'mix') { log("miss match type : ".concat(valueType, " !== ").concat(desc.type, " @key=").concat(key)); return false; } if ((valueType === 'array' || valueType === 'object') && desc.type !== 'mix') { if (!checkForRtDesc(nowCheckValue, nowCheckDesc)) { return false; } } } } } return true; }; var checkForRtDesc = function checkForRtDesc(json, rtDesc) { if (isArray(rtDesc)) { return checkForArrayRtDesc(json, rtDesc); } if (_typeof(rtDesc) === 'object') { return checkForObjectRtDesc(json, rtDesc); } if (typeof rtDesc === 'string') { return checkForStringRtDesc(json, rtDesc); } return false; }; var _check = function check(json, rtDescs) { if (typeof json === 'string') { try { json = eval("(".concat(json, ")")); } catch (e) { log('parse json error'); return false; } } if (_typeof(json) !== 'object') { log('must be object'); return false; } if (!isArray(rtDescs)) { rtDescs = [rtDescs]; } var rtDesc; var i = 0; while (rtDesc = rtDescs[i++]) { if (checkForRtDesc(json, rtDesc)) { return true; } } return false; }; var RespTypes = { check: function check(json, rtDesc) { logList = []; try { var ret = _check(json, rtDesc); if (!ret) { printLog(); } return ret; } catch (e) { logList.push("[rtException]".concat(e.toString())); printLog(); return false; } }, getMsg: function getMsg() { return logList.join(';'); } }; function getInflightMap() { if (!window.__dedupe_promise_inflight__) { window.__dedupe_promise_inflight__ = new Map(); } return window.__dedupe_promise_inflight__; } function dedupePromise(key, factory) { var inflightMap = getInflightMap(); var existing = inflightMap.get(key); console.log("dedupePromise key=".concat(key, " existing=").concat(existing)); if (existing) { return existing; } var promise = Promise.resolve().then(factory)["finally"](function () { inflightMap["delete"](key); }); inflightMap.set(key, promise); return promise; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var prefix = '__WXLS__'; var localStorage$1 = window.localStorage || { getItem: function getItem() {}, setItem: function setItem() {}, removeItem: function removeItem() {}, key: function key() {}, clear: function clear() { var _a, _b; (_b = (_a = window.localStorage) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a); }, length: 0 }; var evictionPolicies = { noeviction: function noeviction(data) { return data; }, 'allkeys-random': function allkeysRandom(data, size) { var keys = Object.keys(data); var memCnt = 0; while (memCnt < size) { var len = keys.length; var randomKeyIdx = Math.floor(Math.random() * len); var randomKey = keys[randomKeyIdx]; memCnt += JSON.stringify(data[randomKey]).length; delete data[randomKey]; keys = Object.keys(data); } return data; }, 'volatile-ttl': function volatileTtl(data, size) { var keys = Object.keys(data); keys = keys.sort(function (key1, key2) { var d1 = data[key1]; var d2 = data[key2]; if (d1.exp < d2.exp) return -1; if (d1.exp > d2.exp) return 1; return 0; }); var memCnt = 0; for (var i = 0; i < keys.length; i++) { if (memCnt >= size) break; var key = keys[i]; memCnt += JSON.stringify(data[key]).length; delete data[key]; } return data; }, 'clear-all': function clearAll() { localStorage$1.clear(); return {}; } }; function formatLogMsg(str) { return "[WXLS] ".concat(str); } var LS = function () { function LS(func, evictionPolicy, logger) { _classCallCheck(this, LS); this.logger = function () {}; if (!func) throw 'require function name.'; this.evictionPolicy = 'noeviction'; this.key = func; if (typeof logger === 'function') { this.logger = function (str, type) { return logger(formatLogMsg(str), type); }; } if (evictionPolicy && Object.keys(evictionPolicies).indexOf(evictionPolicy) !== -1) { this.evictionPolicy = evictionPolicy; } this.init(); } _createClass(LS, [{ key: "init", value: function init() { var _a, _b; this.check(); if (Math.random() * 1000 < 1) { (_a = this.logger) === null || _a === void 0 ? void 0 : _a.call(this, "LSlen: ".concat(((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length) || localStorage$1.length), 'report'); } } }, { key: "getData", value: function getData() { var data = LS.getItem(this.key) || '{}'; try { data = JSON.parse(data); } catch (e) { this.logger("getData error: ".concat(e), 'error'); localStorage$1.removeItem(prefix + this.key); data = {}; } return data; } }, { key: "check", value: function check(isReturn) { var data = this.getData(); var temp = {}; var now = +new Date(); var key; var val; for (key in data) { val = data[key]; if (+val.exp > now) { temp[key] = val; } } this.logger("check info: isReturn:".concat(isReturn, " data:").concat(JSON.stringify(temp)), 'info'); if (isReturn) return temp; LS.setItem(this.key, JSON.stringify(temp), this.logger); } }, { key: "set", value: function set(key, val, exp) { var _a, _b; var data = this.check(true); data[key] = { val: val, exp: exp || +new Date() }; try { if (localStorage$1.getItem(prefix + this.key)) localStorage$1.removeItem(prefix + this.key); localStorage$1.setItem(prefix + this.key, JSON.stringify(data)); this.logger("first set success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data)), 'success'); } catch (e) { this.logger("first set error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(prefix + this.key, " data:").concat(JSON.stringify(data), " k:").concat(key, " v:").concat(val, " exp:").concat(exp), 'error'); localStorage$1.clear(); LS.setItem(this.key, JSON.stringify(_defineProperty({}, key, { val: val, exp: exp || +new Date() })), this.logger); } } }, { key: "get", value: function get(key) { var data = this.getData(); data = data[key]; return data ? data.val || null : null; } }, { key: "remove", value: function remove(key) { var data = this.getData(); if (data[key]) delete data[key]; LS.setItem(this.key, JSON.stringify(data), this.logger); } }], [{ key: "getItem", value: function getItem(key) { key = prefix + key; return localStorage$1.getItem(key); } }, { key: "setItem", value: function setItem(key, val, logger) { var _a, _b; key = prefix + key; var n = 3; while (n--) { try { if (localStorage$1.getItem(key)) localStorage$1.removeItem(key); localStorage$1.setItem(key, val); typeof logger === 'function' && logger("setItem success: LSlen:".concat((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.length, " key:").concat(key, " val:").concat(val), 'success'); break; } catch (e) { typeof logger === 'function' && logger("setItem error: LSlen:".concat((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.length, " error:").concat(e, " key:").concat(key, " val:").concat(val), 'error'); LS.clear(); } } } }, { key: "clear", value: function clear() { var i; var k; for (i = localStorage$1.length - 1; i >= 0; i--) { k = localStorage$1.key(i); if (k.indexOf(prefix) == 0) { localStorage$1.removeItem(k); } } } }, { key: "getSupportEvicationPolicy", value: function getSupportEvicationPolicy() { return Object.keys(evictionPolicies); } }]); return LS; }(); var innerVersion = (mmVersion.getInner() || '').toUpperCase(); var getBizLS = new LS('get_biz_result'); function getBizMap() { if (!window.__get_biz_map__) { window.__get_biz_map__ = {}; } return window.__get_biz_map__; } var isGetBizSupported = mmVersion.isOnlyWechat && mmVersion.isIOS && innerVersion >= '18003C2A' || mmVersion.isOnlyWechat && mmVersion.isAndroid && innerVersion >= '28003D3C' || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc'); function invokeGetBiz(needCheckBiz, bizType) { return dedupePromise("getBiz:".concat(needCheckBiz, ":").concat(bizType), function () { return new Promise(function (resolve, reject) { if (!isGetBizSupported) { reject('Not support'); } else { JSAPI.invoke('handleMPPageAction', { action: 'getBiz', needCheckBiz: needCheckBiz, bizType: bizType }, function (res) { console.log("getBiz needCheckBiz=".concat(needCheckBiz, " bizType=").concat(bizType, " res: ").concat(JSON.stringify(res))); if (res && res.err_msg && res.err_msg.indexOf('ok') > -1) { var bizMap = getBizMap(); bizMap[bizType] = res.biz; resolve(res.biz); getBizLS.set("".concat(bizType, "_get_biz_result"), res.biz, +new Date() + 3 * 24 * 60 * 60 * 1000); } else { reject('Failed to get biz'); } }); } }); }); } function getBiz(needCheckBiz, bizType) { var _a; if (needCheckBiz === void 0) { needCheckBiz = false; } if (bizType === void 0) { bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1; } var bizMap = getBizMap(); if (!needCheckBiz && bizMap[bizType] !== undefined) { return Promise.resolve(bizMap[bizType]); } return invokeGetBiz(needCheckBiz, bizType); } mmVersion.isOnlyWechat && mmVersion.isIOS || mmVersion.isOnlyWechat && mmVersion.isAndroid || mmVersion.isUnifiedPcWechat && mmVersion.cpVersion('4.1.10', 1, true, 'unifiedpc'); var getIsAuthor = function getIsAuthor(cb, bizuin, needCheckBiz, bizType) { var _a; if (bizuin === void 0) { bizuin = window.biz; } if (needCheckBiz === void 0) { needCheckBiz = false; } if (bizType === void 0) { bizType = ((_a = window.cgiDataNew) === null || _a === void 0 ? void 0 : _a.biz_type) || 1; } getBiz(needCheckBiz, bizType).then(function (biz) { cb(biz && biz === bizuin); })["catch"](function () { cb(false); }); }; function parseUrl(url) { var len = url.length; var ques_pos = url.indexOf('?'); var hash_pos = url.indexOf('#'); hash_pos = hash_pos == -1 ? len : hash_pos; ques_pos = ques_pos == -1 ? hash_pos : ques_pos; var host = url.substring(0, ques_pos); var query_str = url.substring(ques_pos + 1, hash_pos); var hash = url.substring(hash_pos + 1); return { host: host, query_str: query_str, hash: hash }; } function join(url, args, noEncode) { var ret = parseUrl(url); var query_str = ret.query_str; var args_arr = []; if (_typeof(args) === 'object') { for (var key in args) { if (args.hasOwnProperty(key)) { args_arr.push("".concat(key, "=").concat(noEncode ? args[key] : encodeURIComponent(args[key]))); } } } else { args_arr.push(noEncode ? args : encodeURIComponent(args)); } if (args_arr.length > 0) { query_str += (query_str !== "" ? "&" : "") + args_arr.join("&"); } return ret.host + (query_str !== "" ? "?".concat(query_str) : "") + (ret.hash !== "" ? "#".concat(ret.hash) : ""); } function addParam(url, param, value, forceReplace) { url = url || location.href; var firstAndPos = url.indexOf("&"); var len = url.length; var reverseUrl = url.replace(/^[\w\d]+:[/\\]+/g, "").split("").reverse(); if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (searchElement, fromIndex) { var k; if (this == null) { throw new TypeError('"this" is null or not defined'); } var O = Object(this); var len = O.length >>> 0; if (len === 0) { return -1; } var n = fromIndex || 0; if (Math.abs(n) === Infinity) { n = 0; } if (n >= len) { return -1; } k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); while (k < len) { if (k in O && O[k] === searchElement) { return k; } k++; } return -1; }; } var lastSlashPos = len - 1 - reverseUrl.indexOf("/"); if (firstAndPos !== -1 && url.indexOf("?") == -1 && firstAndPos > lastSlashPos) { url = url.replace("&", "?"); } var reg = new RegExp("([\\?&]".concat(param, "=)[^&#]*")); if (!url.match(reg)) { var urlInfo = parseUrl(url); var hash = urlInfo.hash ? '#' + urlInfo.hash : ''; url = url.replace(hash, ''); var _pos = url.indexOf("?"); if (_pos == -1) { return "".concat(url, "?").concat(param, "=").concat(value).concat(hash); } if (_pos == url.length - 1) { return "".concat(url + param, "=").concat(value).concat(hash); } return "".concat(url, "&").concat(param, "=").concat(value).concat(hash); } if (forceReplace === true) { return url.replace(reg, "$1".concat(value)); } return url; } function addWxfrom(src, wxfrom) { var offset = window.service_type === 1 ? 10000 : 0; return addParam(src, 'wxfrom', offset + Number(wxfrom), true); } function removeParam(url, param) { var _URL = new URL(url), protocol = _URL.protocol, host = _URL.host, pathname = _URL.pathname, search = _URL.search, hash = _URL.hash; var queryParams = new URLSearchParams(search); queryParams["delete"](param); var newSearch = queryParams.toString(); var newUrl = new URL("".concat(protocol, "//").concat(host).concat(pathname).concat(newSearch ? "?".concat(decodeURIComponent(newSearch)) : "").concat(hash)); return newUrl.toString(); } function getQuery(name, url) { var u = url || window.location.search; var reg = new RegExp("(^|&)".concat(name, "=([^&]*)(&|$)")); var r = u.substring(u.indexOf('?') + 1).match(reg); return r !== null ? r[2] : ''; } function encodeBase64(value) { try { return window.btoa(value); } catch (e) { return ''; } } function decodeBase64(value) { try { return window.atob(value); } catch (e) { return ''; } } function joinUrl$1(url) { var obj = {}; if (typeof window.uin !== 'undefined') { obj.uin = window.uin; } if (typeof window.key !== 'undefined') { obj.key = window.key; } if (typeof window.pass_ticket !== 'undefined') { obj.pass_ticket = window.pass_ticket; } if (typeof window.wxtoken !== 'undefined') { obj.wxtoken = window.wxtoken; } if (typeof window.devicetype !== 'undefined') { obj.devicetype = window.devicetype; } if (typeof window.clientversion !== 'undefined') { obj.clientversion = window.clientversion || mmVersion.getInner(); } obj.version = obj.clientversion; if (window.biz) { obj.__biz = window.biz; } if (getQuery('enterid')) { obj.enterid = getQuery('enterid'); } if (typeof window.appmsg_token !== 'undefined') { obj.appmsg_token = window.appmsg_token; } else if (url.indexOf('advertisement_report') > -1) { new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random()); } obj.x5 = navigator.userAgent.indexOf('TBS/') !== -1 ? '1' : '0'; obj.f = 'json'; return join(url, obj); } function joinUserArticleRole(url, notJoin, cb) { var bizuin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : window.biz; var needCheckBiz = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; if (notJoin) { cb(url); } else { getIsAuthor(function (isAuthor) { cb(addParam(url, 'user_article_role', isAuthor ? 1 : 0, true)); }, bizuin, needCheckBiz); } } function getA8keyQuery(name, url) { return new Promise(function (resolve) { if (window.__secPageAuthPromise) { window.__secPageAuthPromise.then(function () { resolve(getQuery(name, url)); }); } else { resolve(getQuery(name, url)); } }); } function addHash(url, hash) { var isReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (isReplace) { return "".concat(url.split('#')[0]).concat(hash); } return "".concat(url).concat(url.indexOf('#') === -1 ? '#' : '').concat(hash); } function decodeUrl(url) { var _url = url; while (_url.indexOf('&') !== -1) { _url = _url.htmlDecode(); } return _url; } var Url = { parseUrl: parseUrl, join: join, addParam: addParam, addWxfrom: addWxfrom, addHash: addHash, getQuery: getQuery, getA8keyQuery: getA8keyQuery, encodeBase64: encodeBase64, decodeBase64: decodeBase64, joinUrl: joinUrl$1, joinUserArticleRole: joinUserArticleRole, removeParam: removeParam, decodeUrl: decodeUrl }; var _a; var doc; var isAcrossOrigin = false; try { doc = (_a = window.top) === null || _a === void 0 ? void 0 : _a.window.document; } catch (e) { isAcrossOrigin = true; } var StatusTextMap = { 200: 'OK', 302: 'Found', 400: 'Bad Request', 500: 'Internal Server Error' }; function getIsAcrossOrigin() { return isAcrossOrigin; } function networkStartLog(item) { var _a, _b, _c, _d, _e; console.log('[system]', "< [request ".concat(item.requestType, "]"), item.url, item.method, item); var rdevRequestId; var requestTime = performance.now() / 1000; if ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) { try { var willBeSentOptions = { url: item.url, method: item.method, requestHeaders: Object.assign({}, item.requestHeader || {}, { RDEV_REQUEST_TYPE: item.requestType }), requestBody: item.postData, requestTime: requestTime }; rdevRequestId = window.RemoteDevSdk.instance.Network.customRequestWillBeSent(willBeSentOptions); } catch (err) {} } if ((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) { try { var vconsoleNetworkItem = (_e = (_d = window.vConsole.network).add) === null || _e === void 0 ? void 0 : _e.call(_d, Object.assign({}, item, { startTime: Date.now(), endTime: Date.now(), status: 0, readyState: 2, response: '' })); vconsoleNetworkItem.rdevRequestId = rdevRequestId; vconsoleNetworkItem.requestTime = requestTime; return vconsoleNetworkItem; } catch (err) {} } if (rdevRequestId) { return Object.assign(Object.assign({}, item), { id: '__only_rdev_log__', rdevRequestId: rdevRequestId, requestTime: requestTime }); } return Object.assign({}, item, { id: '__system_log__' }); } function networkEndLog(item) { var _a, _b, _c, _d, _e; console.log('[system]', "> [response ".concat(item.requestType, "]"), item.url, item.response, item); if (item.rdevRequestId && ((_b = (_a = window.RemoteDevSdk) === null || _a === void 0 ? void 0 : _a.instance) === null || _b === void 0 ? void 0 : _b.Network) && item.id !== '__system_log__') { try { var finishedOptions = { requestId: item.rdevRequestId, url: item.url, status: +(item.status || '500'), statusText: StatusTextMap[+(item.status || '500')] || 'Error', responseHeaders: { RDEV_RESPONSE_TYPE: item.requestType }, responseBody: item.response, requestTime: item.requestTime || 0, duration: item.costTime || (item.endTime && item.startTime ? item.endTime - item.startTime : performance.now() / 1000 - (item.requestTime || 0)) }; window.RemoteDevSdk.instance.Network.customRequestFinished(finishedOptions); } catch (err) {} } if (((_c = window.vConsole) === null || _c === void 0 ? void 0 : _c.network) && item.id !== '__system_log__') { try { item.statusText = "".concat(item.status); item.responseSize = item.response.length; item.responseSizeText = "".concat(item.response.length); return (_e = (_d = window.vConsole.network).update) === null || _e === void 0 ? void 0 : _e.call(_d, item.id, Object.assign({}, item, { readyState: 4 })); } catch (err) {} } } function reqType(obj, path) { return obj.url.indexOf(path) > -1 && obj.url.indexOf('action=') === -1 && (!obj.data || !obj.data.action); } function findAjaxScopeByConfig(url, config) { var pathname = new URL(url, location.href).pathname || ''; var scope = config[pathname.slice(1)]; if (scope) { return scope; } } function getAjaxScope(ajaxUrl) { if (Url.getQuery('no_transfer', location.href) !== '1' && mmVersion.isWechat && !mmVersion.isInMiniProgram && !mmVersion.isWxWork && !mmVersion.isMpapp && !isAcrossOrigin && window.__ajaxTransferConfig && _typeof(window.__ajaxTransferConfig) === 'object' && ( mmVersion.isIOS && mmVersion.compareHexVersion('1800282F') || mmVersion.isAndroid && mmVersion.compareHexVersion('28002234') || mmVersion.isWindowsWechat && mmVersion.cpVersion('3.9.5', 1, true, 'windows') || mmVersion.isMacWechat && mmVersion.cpVersion('3.8.4', 1, true, 'mac') || mmVersion.isHarmonyWechat && mmVersion.compareHexVersion('0xf3100b00') && !mmVersion.compareHexVersion('0xf3100c00') || mmVersion.compareHexVersion('0xf3800b00'))) { try { return findAjaxScopeByConfig(ajaxUrl, window.__ajaxTransferConfig); } catch (err) { } } } function getActionByData(data) { var _a, _b; if (_typeof(data) === 'object' && !(data instanceof Blob)) { if (data.hasOwnProperty('data') && typeof data.data === 'string') { try { var workedData = JSON.parse(data.data); return workedData.action || ''; } catch (e) {} } return data.action || ''; } if (typeof data === 'string') { return ((_b = (_a = data.split(/[?&]/).find(function (x) { return x.indexOf('action=') >= 0; })) === null || _a === void 0 ? void 0 : _a.split('=')) === null || _b === void 0 ? void 0 : _b[1]) || ''; } return ''; } var METHOD_ENUM = { GET: 0, POST: 1 }; var __moon_report = window.__moon_report || function () {}; var MOON_AJAX_SUCCESS_OFFSET = 3; var MOON_AJAX_NETWORK_OFFSET = 4; var MOON_AJAX_ERROR_OFFSET = 5; var MOON_AJAX_TIMEOUT_OFFSET = 6; var MOON_AJAX_COMPLETE_OFFSET = 7; var LENGTH_LIMIT = 4096; function reportRtError(type, id, key, content) { var log = ''; var prefix = type === 'rt' ? 'rtCheckError' : 'Ajax Length Limit'; if (content === null || content === void 0 ? void 0 : content.length) { var loglen = 1000; var len = content.length; var lc = Math.ceil(len / loglen); log = ["&lc=".concat(lc)]; for (var i = 0; i < lc; ++i) { log.push("&log".concat(i, "=") + "[".concat(prefix, "][").concat(i, "]").concat(encodeURIComponent(content.substring(i * loglen, i * loglen + loglen)))); } log = log.join(''); } var data = "idkey=".concat(id, "_").concat(key, "_1").concat(log, "&r=").concat(Math.random()); var xmlobj = new XMLHttpRequest(); xmlobj.open('POST', "".concat(location.protocol, "//").concat(location.host, "/mp/jsmonitor?"), true); xmlobj.setRequestHeader('cache-control', 'no-cache'); xmlobj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlobj.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xmlobj.send(data); if (type === 'ajaxLen') { monitor$1.setLogs({ id: id, key: key, value: 1, log: log }); } } function reportRt(id, key, content) { reportRtError('rt', id, key, content); } function reportAjaxLength(id, key, content) { reportRtError('ajaxLen', id, key, content); } function setXhrHeader(xhr, type, opt) { if (opt.contentType) { xhr.setRequestHeader('Content-Type', opt.contentType); } else if (type === 'POST') { xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); } if (!opt.noXRequestedWidthHeader) { xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); } } function Ajax(obj) { var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {}; if (obj.usePb) { obj.type = 'POST'; obj.data = { data: JSON.stringify(obj.data) }; } var ajaxScope = getAjaxScope(obj.url); var type = (obj.type || 'GET').toUpperCase(); var timer; var _url; if (obj.notJoinUrl) { _url = obj.url; } else { _url = Url.joinUrl(obj.url); } Url.joinUserArticleRole(_url, !!obj.notJoinUrl, function (url) { var urlObj = new URL(url, location.origin); if (obj.f === 'html') { url = url.replace('&f=json', ''); } var data = null; if (obj.data instanceof Blob) { data = obj.data; } else if (_typeof(obj.data) === 'object') { var d = obj.data; var ds = []; for (var k in d) { if (d.hasOwnProperty(k)) { ds.push("".concat(k, "=").concat(encodeURIComponent(d[k]))); } } data = ds.join('&'); } else { data = typeof obj.data === 'string' ? obj.data : null; } var beginTs; var beforeReq = function beforeReq() { if (reqType(obj, '/mp/getappmsgext')) { window.startGetAppmsgExtTime = Date.now(); Log.log('start get appmsgext, url: ', obj.url); } if (reqType(obj, '/mp/getappmsgad')) { window.startGetAppmsgAdTime = Date.now(); Log.log('start get appmsgad, url: ', obj.url); } beginTs = Date.now(); }; var beforeResp = function beforeResp(xhr) { if (reqType(obj, '/mp/getappmsgext')) { window.receiveGetAppmsgExt = "".concat(xhr.status, "|").concat(Date.now()); Log.log("receive appmsgext response, status: ".concat(xhr.status)); } if (reqType(obj, '/mp/getappmsgad')) { window.receiveGetAppmsgAd = "".concat(xhr.status, "|").concat(Date.now()); Log.log("receive appmsgad response, status: ".concat(xhr.status)); } if (Math.random() < 0.001 && window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) { try { var key = ajaxScope ? 'transfer' : 'xhr'; var interval = 250; var time = Date.now() - beginTs; var range = Math.floor(time / interval) * interval; var pathname = new URL(obj.url, location.href).pathname || ''; window.WX_BJ_REPORT.BadJs.report("".concat(key, "_perf:").concat(pathname), JSON.stringify({ status: xhr.status, time: "[".concat(range, "-").concat(range + interval, ")") }), { mid: 'mmbizwap:ajaxtransfer', view: 'wap_business' }); } catch (err) {} } }; var handleRespSucc = function handleRespSucc(xhr, requestType) { var _a, _b, _c, _d; try { var responseText = xhr.responseText; var resp = responseText; if (obj.dataType === 'json') { try { if (JSON && JSON.parse) { resp = JSON.parse(resp); } else { resp = eval("(".concat(resp, ")")); monitor$1.setSum(523105, 127, 1).send(); } var rtId = obj.rtId; var rtKey = obj.rtKey || 0; var rtDesc = obj.rtDesc; if (rtId && rtDesc && RespTypes && !RespTypes.check(resp, rtDesc)) { reportRt(+rtId, +rtKey, "".concat(RespTypes.getMsg(), "[detail]").concat(responseText, ";").concat(obj.url)); } if (resp && resp.base_resp && ((_a = resp.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) { var reportUrl = url; if (url.indexOf('?') !== -1) { reportUrl = url.substring(0, url.indexOf('?')); if (Url.getQuery('action', url)) { reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', url)); } } if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resp.base_resp.ret === 'undefined')) { window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resp.base_resp.ret), { mid: window.PAGE_MID, view: 'wap_retcode' }); } } } catch (e) { obj.error && obj.error(xhr, { type: 1, error: e, status: xhr.status }); if (!obj.dontReport) { report36408({ CgiPath: urlObj.pathname || '', Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '', Query: urlObj.search || '', PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '', Method: type || '', RequestType: requestType || 0, RetType: 1, HttpCode: xhr.status || 0, Ret: 0 }); } return; } } if (_typeof(resp) === 'object' && ((_b = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _b === void 0 ? void 0 : _b.ret) !== 0) { if (!obj.dontReport) { report36408({ CgiPath: urlObj.pathname || '', Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '', Query: urlObj.search || '', PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '', Method: type || '', RequestType: requestType || 0, RetType: 4, HttpCode: xhr.status || 0, Ret: ((_c = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0 }); } } else { if (!obj.dontReport) { report36408({ CgiPath: urlObj.pathname || '', Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '', Query: urlObj.search || '', PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '', Method: type || '', RequestType: requestType || 0, RetType: 0, HttpCode: xhr.status || 0, Ret: ((_d = resp === null || resp === void 0 ? void 0 : resp.base_resp) === null || _d === void 0 ? void 0 : _d.ret) || 0 }); } } obj.success && obj.success(resp); } catch (e) { __moon_report({ offset: MOON_AJAX_SUCCESS_OFFSET, e: e }); throw e; } }; var handleRespErr = function handleRespErr(xhr, error, requestType) { try { obj.error && obj.error(xhr, { type: 2, error: error, status: xhr.status }); if (!obj.dontReport) { report36408({ CgiPath: urlObj.pathname || '', Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '', Query: urlObj.search || '', PostData: type === 'POST' && !(obj.data instanceof Blob) ? data : '', Method: type, RequestType: requestType, RetType: 2, HttpCode: xhr.status, Ret: 0 }); } } catch (e) { __moon_report({ offset: MOON_AJAX_ERROR_OFFSET, e: e }); throw e; } }; var handleRespComplete = function handleRespComplete() { clearTimeout(timer); try { obj.complete && obj.complete(); } catch (e) { __moon_report({ offset: MOON_AJAX_COMPLETE_OFFSET, e: e }); throw e; } obj.complete = null; }; var handleReqTimeout = function handleReqTimeout(xhr) { if (typeof obj.timeout !== 'undefined') { timer = setTimeout(function () { xhr.abort(); try { obj.complete && obj.complete(); } catch (e) { __moon_report({ offset: MOON_AJAX_COMPLETE_OFFSET, e: e }); throw e; } obj.complete = null; __moon_report({ offset: MOON_AJAX_TIMEOUT_OFFSET, log: "ajax_timeout_error: ".concat(url), e: '' }); }, obj.timeout); } }; var retryXhrFn = function retryXhrFn(res, isTimeout, reqLogItem) { var retryXhr = new XMLHttpRequest(); try { retryXhr._noVConsole = true; } catch (err) {} retryXhr.open(type, url); retryXhr.onreadystatechange = function () { if (isTimeout) return; if (retryXhr.readyState === 3) { obj.received && obj.received(retryXhr); } if (retryXhr.readyState === 4) { beforeResp(retryXhr); var retryStatus = retryXhr.status; if (retryStatus >= 200 && retryStatus < 400) { handleRespSucc(retryXhr, 1); } else { handleRespErr(retryXhr, res, 1); window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure', JSON.stringify({ retryXhrStatus: retryStatus, transferRes: res }), { mid: 'mmbizwap:ajaxtransfer', view: 'wap_business' }); } reqLogItem.status = retryStatus; reqLogItem.endTime = Date.now(); reqLogItem.response = retryXhr.responseText; handleRespComplete(); networkEndLog(reqLogItem); } }; setXhrHeader(retryXhr, type, obj); retryXhr.send(data); }; if (ajaxScope && !obj.pureHttp) { var header = { 'User-Agent': navigator.userAgent, 'Cookie': (window.__test_env__ ? 'uniproxy_route=1; ' : '') + document.cookie, 'Referer': location.href }; if (obj.contentType) { header['Content-Type'] = obj.contentType; } else if (type === 'POST') { header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; } if (!obj.noXRequestedWidthHeader) { header['X-Requested-With'] = 'XMLHttpRequest'; } var reqUrl = new URL(url, location.href).href; var method = METHOD_ENUM[type] || 0; var params = Device.os.pc ? { url: reqUrl, req_json: data || '', scope: ajaxScope, webcgi_method: method, webcgi_header: Object.keys(header).map(function (headerItemKey) { return Device.os.Mac ? _defineProperty({}, headerItemKey, header[headerItemKey]) : { key: headerItemKey, value: header[headerItemKey] }; }), cgi_type: 1 } : { reqUrl: reqUrl, reqBody: data, scope: ajaxScope, method: method, header: header }; var reqLogItem = networkStartLog({ method: type, url: url, postData: obj.data || {}, requestHeader: header, requestType: 'transfer', startTime: Date.now(), responseType: url.indexOf('f=json') > 0 ? 'json' : undefined }); var isTimeout = false; handleReqTimeout({ abort: function abort() { isTimeout = true; reqLogItem.endTime = Date.now(); reqLogItem.response = 'timeout'; networkEndLog(reqLogItem); } }); Device.os.pc && monitor$1.setSum(115849, 69, 1); JSAPI.invoke(Device.os.pc ? 'H5ExtTransfer' : 'webTransfer', params, function (res) { var _a, _b, _c, _d, _e, _f; if (isTimeout) return; var status = 400; var result = ''; if (Device.os.pc) { try { var retFlag = res.base_resp.ret === 0 && res.jsapi_resp.ret === 0 && res.err_msg.indexOf(':ok') > -1; var respJsonFlag = res.jsapi_resp.resp_json; status = retFlag && respJsonFlag ? 200 : 400; result = res.jsapi_resp.resp_json; } catch (err) { console.error(err); } } else { status = res && res.errCode * 1 === 0 && typeof res.result === 'string' && res.result ? 200 : 400; result = res.result; } try { Log.log("ajax transfer, status: ".concat(status, ", reqUrl: ").concat(reqUrl)); } catch (err) { console.error(err); } if (status >= 200 && status < 400) { obj.received && obj.received(null); beforeResp({ status: status }); handleRespSucc({ status: status, responseText: result }, 10); reqLogItem.status = status; reqLogItem.endTime = Date.now(); reqLogItem.response = result; handleRespComplete(); networkEndLog(reqLogItem); } else if (window.__second_open__) { JSAPI.invoke('request', { url: reqUrl, method: type, data: data, header: header }, function (retryRes) { try { Log.log("ajax retry request, retryStatus: ".concat((retryRes === null || retryRes === void 0 ? void 0 : retryRes.statusCode) || '', ", reqUrl: ").concat(reqUrl)); } catch (err) { console.error(err); } if (isTimeout) return; var retryStatus = retryRes.statusCode; obj.received && obj.received(null); beforeResp({ status: retryStatus }); if (retryRes.err_msg.indexOf(':ok') > -1 && retryStatus >= 200 && retryStatus < 400) { handleRespSucc({ status: retryStatus, responseText: retryRes.data }, 20); } else { retryXhrFn(res, isTimeout, reqLogItem); handleRespErr({ status: retryStatus }, res, 20); window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs && window.WX_BJ_REPORT.BadJs.report('req_failure_sec_open', JSON.stringify({ retryReqJsapiRes: retryRes, transferRes: res, url: reqUrl }), { mid: 'mmbizwap:ajaxtransfer', view: 'wap_business' }); } reqLogItem.status = retryStatus; reqLogItem.endTime = Date.now(); reqLogItem.response = retryRes.data; handleRespComplete(); networkEndLog(reqLogItem); }); } else { retryXhrFn(res, isTimeout, reqLogItem); } if (Device.os.pc) { if (!res.err_msg.includes(':ok')) { (_b = (_a = window.WX_BJ_REPORT) === null || _a === void 0 ? void 0 : _a.BadJs) === null || _b === void 0 ? void 0 : _b.report("pc transfer res no ok: ".concat(res.err_msg), params.url || '', { mid: window.PAGE_MID, _info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res)) }); } try { if (res.jsapi_resp.resp_json && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 0 && JSON.parse(res.jsapi_resp.resp_json).base_resp.ret !== 190001 || res.base_resp.ret !== 0 || res.jsapi_resp.ret !== 0) { (_d = (_c = window.WX_BJ_REPORT) === null || _c === void 0 ? void 0 : _c.BadJs) === null || _d === void 0 ? void 0 : _d.report("pc transfer res invalid ret", params.url || '', { mid: window.PAGE_MID, _info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res)) }); } } catch (err) {} } else { try { if (res.errCode !== 0) { (_f = (_e = window.WX_BJ_REPORT) === null || _e === void 0 ? void 0 : _e.BadJs) === null || _f === void 0 ? void 0 : _f.report("mobile transfer res invalid ret", params.url || '', { mid: window.PAGE_MID, _info: "".concat(JSON.stringify(params), " || ").concat(JSON.stringify(res)) }); } } catch (err) {} } }); beforeReq(); return; } var xhr = new XMLHttpRequest(); var mayAbort = !!obj.mayAbort; var async = typeof obj.async === 'undefined' ? true : obj.async; var _onreadystatechange = xhr.onreadystatechange; xhr.open(type, url, async); xhr.onreadystatechange = function () { if (typeof _onreadystatechange === 'function') { _onreadystatechange.apply(xhr); } if (xhr.readyState === 3) { obj.received && obj.received(xhr); } if (xhr.readyState === 4) { beforeResp(xhr); xhr.onreadystatechange = null; var status = xhr.status; if (status >= 200 && status < 400) { handleRespSucc(xhr, 1); } else { handleRespErr(xhr, 'status error', 1); if (!!status || !mayAbort) { var __ajaxtest = window.__ajaxtest || '0'; __moon_report({ offset: MOON_AJAX_NETWORK_OFFSET, log: "ajax_network_error[".concat(status, "][").concat(__ajaxtest, "]: ").concat(url, ";host:").concat(location.host), e: '' }); } } handleRespComplete(); } }; setXhrHeader(xhr, type, obj); handleReqTimeout(xhr); try { xhr.send(data); try { if (url && url.length > LENGTH_LIMIT) { reportAjaxLength(27613, 17, "ajax get limit[length: ".concat(url.length, "]").concat(url.substring(0, 1024))); } if (data && !(data instanceof Blob) && data.length > LENGTH_LIMIT) { reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.length, "]").concat(data.substring(0, 1024))); } if (data && data instanceof Blob && data.size > LENGTH_LIMIT) { reportAjaxLength(27613, 18, "ajax post limit[length: ".concat(data.size, "]blob")); } } catch (e) { } } catch (e) { obj.error && obj.error(xhr, { type: 3, error: e, status: 0 }); } beforeReq(); }); } mmVersion.isWindowsWechat && mmVersion.compareHexVersion('0xf2550000') || mmVersion.isMacWechat && mmVersion.compareHexVersion('0xf2650000'); var getBrandServiceType = function getBrandServiceType() { var serviceType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.service_type; var _a, _b; var brandServiceType = 0; if (serviceType !== undefined) brandServiceType = serviceType + 1; if (((_b = (_a = window.cgiData) === null || _a === void 0 ? void 0 : _a.trans_appmsg_info) === null || _b === void 0 ? void 0 : _b.trans_type) * 1 === 1) brandServiceType = 3; return brandServiceType; }; function setCurrentMpInfo(ifShow) { var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true) || mmVersion.isAndroid && mmVersion.gtVersion('7.0.12', true); var supportLiveStatus = mmVersion.isIOS && mmVersion.gtVersion('8.0.46', true) || mmVersion.isAndroid && mmVersion.gtVersion('8.0.46', true); JSAPI.invoke('currentMpInfo', { userName: window.user_name, brandName: !!supportNewTopBar && window.nickname === '' ? '未命名账号' : window.title, title: window.msg_title || '', brandIcon: window.hd_head_img.replace(/\/0$/, '/132'), itemShowType: window.item_show_type, isPaySubscribe: window.isPaySubscribe, topBarStyle: supportNewTopBar ? 1 : 0, topBarShowed: ifShow, disableShowFinderLiveTopBar: !ifShow && supportLiveStatus ? 1 : 0, brandServiceType: getBrandServiceType() }, function () {}); } function AjaxWx(obj) { var report36408 = typeof obj.report36408 === 'function' ? obj.report36408 : function () {}; obj.url += obj.url.indexOf('?') === -1 ? '?fasttmplajax=1' : '&fasttmplajax=1'; if (getAjaxScope(obj.url)) { Ajax(obj); return; } if (obj.usePb) { obj.type = 'POST'; obj.data = { data: JSON.stringify(obj.data) }; } if (!/^(http:\/\/|https:\/\/|\/\/)/.test(obj.url)) { obj.url = "https://mp.weixin.qq.com/".concat(obj.url.replace(/^\//, '')); } else if (/^\/\//.test(obj.url)) { obj.url = "https:".concat(obj.url); } if (obj.f !== 'html' && (obj.url.indexOf('?f=json') === -1 || obj.url.indexOf('&f=json') === -1)) { obj.url += '&f=json'; } if (!obj.notJoinUrl && obj.f !== 'html') { obj.url = Url.joinUrl(obj.url); } Url.joinUserArticleRole(obj.url, !!obj.notJoinUrl, function (url) { obj.url = url; var urlObj = new URL(url, location.origin); var data = null; if (_typeof(obj.data) === 'object') { var d = obj.data; var ds = []; for (var k in d) { if (d.hasOwnProperty(k)) { ds.push("".concat(k, "=").concat(encodeURIComponent(d[k]))); } } data = ds.join('&'); } else { data = typeof obj.data === 'string' ? obj.data : null; } var header = { Cookie: document.cookie, referer: location.href }; if (obj.contentType) { header['Content-Type'] = obj.contentType; } else if ((obj.type || 'GET').toUpperCase() === 'POST') { header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; } var reqLogItem = networkStartLog({ method: obj.type || 'GET', url: obj.url, postData: obj.data || {}, requestHeader: header, requestType: 'jsapi', startTime: Date.now() }); var retryTime = 1; var jsapiRequest = function jsapiRequest(obj, data) { return JSAPI.invoke('request', { url: obj.url, method: obj.type, data: data, header: header }, function (res) { var _a, _b, _c, _d, _e, _f; if (res.err_msg.indexOf(':ok') > -1 && (!res.statusCode || res.statusCode >= 200 && res.statusCode < 400)) { if (reqType(obj, '/mp/getappmsgext')) { window.receiveGetAppmsgExt = "".concat(res.statusCode, "|").concat(Date.now()); } if (reqType(obj, '/mp/getappmsgad')) { window.receiveGetAppmsgAd = "".concat(res.statusCode, "|").concat(Date.now()); } if (retryTime === 1) { obj.received && obj.received(null); } var resData = {}; if (res.data) { try { if (obj.dataType === 'json') { resData = JSON.parse(res.data); } else { resData = res.data; } if (resData && resData.base_resp && ((_a = resData.base_resp) === null || _a === void 0 ? void 0 : _a.ret) !== 0 && typeof window.WX_BJ_REPORT !== 'undefined' && window.WX_BJ_REPORT.BadJs && Math.random() < 0.001) { var reportUrl = obj.url; if (obj.url.indexOf('?') !== -1) { reportUrl = obj.url.substring(0, obj.url.indexOf('?')); if (Url.getQuery('action', obj.url)) { reportUrl = "".concat(reportUrl, "?action=").concat(Url.getQuery('action', obj.url)); } } if (!((reportUrl === '/mp/getappmsgext' || reportUrl === '/mp/getappmsgad') && typeof resData.base_resp.ret === 'undefined')) { window.WX_BJ_REPORT.BadJs.report(reportUrl, "ret=".concat(resData.base_resp.ret), { mid: window.PAGE_MID, view: 'wap_retcode' }); } } } catch (e) { if (!obj.dontReport) { report36408({ CgiPath: urlObj.pathname || '', Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '', Query: urlObj.search || '', PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '', Method: obj.type || '', RequestType: 20, RetType: 1, HttpCode: res.statusCode || 0, Ret: ((_b = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _b === void 0 ? void 0 : _b.ret) || 0 }); } console.error(e); obj.error && obj.error(null, { type: 1, error: e, status: res.statusCode }); obj.complete && obj.complete(); reqLogItem.endTime = Date.now(); reqLogItem.response = res; networkEndLog(reqLogItem); return; } } var tmpResData = {}; try { tmpResData = JSON.parse(res.data); } catch (e) {} if (tmpResData && tmpResData.base_resp && tmpResData.base_resp.ret === -3 && retryTime < 2 && (mmVersion.isIOS || mmVersion.isAndroid && mmVersion.getInner() > '27000600')) { if (!obj.dontReport) { report36408({ CgiPath: urlObj.pathname || '', Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '', Query: urlObj.search || '', PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '', Method: obj.type || '', RequestType: 20, RetType: 1, HttpCode: res.statusCode || 0, Ret: ((_c = resData === null || resData === void 0 ? void 0 : resData.base_resp) === null || _c === void 0 ? void 0 : _c.ret) || 0 }); } var _retryTime = retryTime++; JSAPI.invoke('updatePageAuth', {}, function (res) { console.log('[skeleton] updatePageAuth', res); monitor$1.setSum(112287, 3, 1); if (res && res.err_msg && res.err_msg.indexOf(':ok') > -1) { window.top.pass_ticket = encodeURIComponent(Url.getQuery('pass_ticket', res.fullUrl).html(false).replace(/\s/g, '+')); if (obj.pass_ticket) { obj.pass_ticket = window.top.pass_ticket; } console.warn('[skeleton] updatePageAuth resetTopbar'); var supportNewTopBar = mmVersion.isIOS && mmVersion.gtVersion('7.0.10', true); var showBottomBar = !!window.is_login; if (window.top.item_show_type === '0' && supportNewTopBar) { var top = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0; setCurrentMpInfo(top > 40 && !showBottomBar); } try { obj.url = Url.addParam(obj.url, 'retry', _retryTime, true); } catch (err) { console.error(err); } jsapiRequest(obj, data); monitor$1.setSum(112287, 4, 1); } else { obj.success && obj.success(resData); obj.complete && obj.complete(); if (mmVersion.isIOS) { monitor$1.setSum(112287, 35, 1); } else { monitor$1.setSum(112287, 36, 1); } reqLogItem.status = 200; reqLogItem.endTime = Date.now(); reqLogItem.response = resData; networkEndLog(reqLogItem); } }); } else { if (((_d = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _d === void 0 ? void 0 : _d.ret) !== 0) { if (!obj.dontReport) { report36408({ CgiPath: urlObj.pathname || '', Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '', Query: urlObj.search || '', PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '', Method: obj.type || '', RequestType: 20, RetType: 4, HttpCode: res.statusCode || 0, Ret: ((_e = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _e === void 0 ? void 0 : _e.ret) || 0 }); } } else { if (!obj.dontReport) { report36408({ CgiPath: urlObj.pathname || '', Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '', Query: urlObj.search || '', PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '', Method: obj.type || '', RequestType: 20, RetType: 0, HttpCode: res.statusCode || 0, Ret: ((_f = tmpResData === null || tmpResData === void 0 ? void 0 : tmpResData.base_resp) === null || _f === void 0 ? void 0 : _f.ret) || 0 }); } } obj.success && obj.success(resData); obj.complete && obj.complete(); reqLogItem.status = 200; reqLogItem.endTime = Date.now(); reqLogItem.response = resData; networkEndLog(reqLogItem); } } else if (res.err_msg.indexOf('no permission') > -1 || !mmVersion.isOnlyWechat) { if (!obj.dontReport) { report36408({ CgiPath: urlObj.pathname || '', Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '', Query: urlObj.search || '', PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '', Method: obj.type || '', RequestType: 20, RetType: 1, HttpCode: res.statusCode || 0, Ret: 0 }); } Ajax(obj); if (res.err_msg.indexOf('no permission') > -1) { console.warn('[JSAPI Request] No permission'); monitor$1.setSum(112287, 31, 1); } reqLogItem.status = 302; reqLogItem.endTime = Date.now(); reqLogItem.response = res; networkEndLog(reqLogItem); } else { if (!obj.dontReport) { report36408({ CgiPath: urlObj.pathname || '', Action: urlObj.searchParams.get('action') || getActionByData(obj.data) || '', Query: urlObj.search || '', PostData: obj.type === 'POST' && !(data instanceof Blob) ? data : '', Method: obj.type || '', RequestType: 20, RetType: 2, HttpCode: res.statusCode || 0, Ret: 0 }); } obj.error && obj.error(null, { type: 3, error: res, status: 0 }); obj.complete && obj.complete(); monitor$1.setSum(112287, 32, 1); var sample = 0.001; if (Math.random() < sample) { var msg = "request: ".concat(JSON.stringify(obj.type), " ").concat(JSON.stringify(obj.url), " ;;;; cookie: ").concat(JSON.stringify(document.cookie), " ;;;; data: ").concat(JSON.stringify(data), " ;;;; resp: ").concat(JSON.stringify(res)); if (window.WX_BJ_REPORT && window.WX_BJ_REPORT.BadJs) { window.WX_BJ_REPORT.BadJs.report('ajax_wx_request_error', msg, { mid: 'mmbizwap:Monitor' }); } } reqLogItem.status = 400; reqLogItem.endTime = Date.now(); reqLogItem.response = res; networkEndLog(reqLogItem); } }); }; if (reqType(obj, '/mp/getappmsgext')) { window.startGetAppmsgExtTime = Date.now(); } if (reqType(obj, '/mp/getappmsgad')) { window.startGetAppmsgAdTime = Date.now(); } jsapiRequest(obj, data); }); } function _regeneratorRuntime() { _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } var AjaxRouter = function () { var _ref = _asyncToGenerator( _regeneratorRuntime().mark(function _callee(obj) { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (!window.__secPageAuthPromise) { _context.next = 3; break; } _context.next = 3; return window.__secPageAuthPromise; case 3: if (!(!mmVersion.isWxWork && (window.__second_open__ || !getIsAcrossOrigin() && top.window.__second_open__) && window.__is_page_auth_return__ && !obj.pureHttp)) { _context.next = 5; break; } return _context.abrupt("return", AjaxWx(obj)); case 5: return _context.abrupt("return", Ajax(obj)); case 6: case "end": return _context.stop(); } }, _callee); })); return function AjaxRouter(_x) { return _ref.apply(this, arguments); }; }(); var isx5 = navigator.userAgent.indexOf('TBS/') !== -1; var getDataFunc = []; var reportData = []; var specificData = {}; function joinUrl(url) { var obj = {}; if (typeof window.uin !== 'undefined') { obj.uin = window.uin; } if (typeof window.key !== 'undefined') { obj.key = window.key; } if (typeof window.pass_ticket !== 'undefined') { obj.pass_ticket = window.pass_ticket; } if (typeof window.wxtoken !== 'undefined') { obj.wxtoken = window.wxtoken; } if (typeof window.devicetype !== 'undefined') { obj.devicetype = window.devicetype; } if (typeof window.clientversion !== 'undefined') { obj.clientversion = window.clientversion; } if (typeof window.appmsg_token !== 'undefined') { obj.appmsg_token = window.appmsg_token; } else if (url.indexOf('advertisement_report') > -1) { new Image().src = "".concat(location.protocol, "//mp.weixin.qq.com/mp/jsmonitor?idkey=68064_13_1&r=").concat(Math.random()); } obj.x5 = isx5 ? '1' : '0'; obj.f = 'json'; return Url.join(url, obj); } function isObj(obj) { return obj && _typeof(obj) === 'object'; } function assign(target, source) { if (isObj(target) && isObj(source)) { for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } } function assembleReportData(initiative) { var leaveReportLog = []; leaveReportLog.push({ content: "[LeaveReport] specificData keys: ".concat(Object.keys(specificData)), timestamp: Date.now() }); Log.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData))); console.log("[LeaveReport] specificData keys: ".concat(Object.keys(specificData))); var allReportData = {}; for (var reportField in specificData) { if (!allReportData[reportField]) { allReportData[reportField] = {}; } for (var i = 0; i < specificData[reportField].length; i++) { var param = specificData[reportField][i]; if (typeof param === 'function') { try { assign(allReportData[reportField], param(initiative)); } catch (err) { leaveReportLog.push({ content: "[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50)), timestamp: Date.now() }); Log.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50))); console.error("[LeaveReport] specificData exec error: ".concat(param.toString().substring(0, 50))); } } else if (isObj(param)) { assign(allReportData[reportField], param); } } } leaveReportLog.push({ content: "[LeaveReport] reportData.length: ".concat(reportData.length), timestamp: Date.now() }); Log.log("[LeaveReport] reportData.length: ".concat(reportData.length)); console.log("[LeaveReport] reportData.length: ".concat(reportData.length)); leaveReportLog.push({ content: "[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length), timestamp: Date.now() }); Log.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length)); console.log("[LeaveReport] getDataFunc.length: ".concat(getDataFunc.length)); for (var _i = 0; _i < getDataFunc.length; _i++) { try { var data = getDataFunc[_i](initiative); if (isObj(data)) { reportData.push(data); } } catch (err) { leaveReportLog.push({ content: "[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50)), timestamp: Date.now() }); Log.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50))); console.error("[LeaveReport] getDataFunc exec error: ".concat(getDataFunc[_i].toString().substring(0, 50))); } } for (var _i2 = 0; _i2 < reportData.length; _i2++) { if (reportData[_i2].reportUrl) { reportData[_i2].reportUrl = joinUrl(reportData[_i2].reportUrl); } } allReportData.data = { 'requestList': reportData }; leaveReportLog.push({ content: "[LeaveReport] final reportData.length: ".concat(reportData.length, ", data=").concat(JSON.stringify(reportData)), timestamp: Date.now() }); Log.log("[LeaveReport] final reportData.length: ".concat(reportData.length)); console.log("[LeaveReport] final reportData.length: ".concat(reportData.length)); allReportData.info = leaveReportLog; return allReportData; } function addReport(param) { if (typeof param === 'function') { getDataFunc.push(param); } else if (isObj(param)) { reportData.push(param); } } function addSpecificReport(reportField, param) { if (!specificData[reportField]) { specificData[reportField] = []; } specificData[reportField].push(param); } function reportNow(callback) { var allReportData = assembleReportData(true); JSAPI.invoke('handleMPPageAction', { action: 'reportByLeaveForMPGateway', reportData: allReportData }, function (res) { if (res && res.err_msg && res.err_msg.indexOf(':ok') !== -1) { getDataFunc = []; reportData = []; specificData = {}; typeof callback === 'function' && callback(res); } else { getDataFunc = []; reportData = []; var len = allReportData.data.requestList.length; allReportData.data.requestList.forEach(function (req) { if (req.reportUrl) { AjaxRouter({ type: req.method || 'GET', url: req.reportUrl, data: req.reportData, async: false, success: function success(resp) { if (--len < 0) { typeof callback === 'function' && callback({ err_msg: 'handleMPPageAction:ok', fallback: true, resp: resp }); } }, error: function error(xhr, err) { if (--len < 0) { typeof callback === 'function' && callback({ err_msg: 'handleMPPageAction:fail', fallback: true, err: err }); } } }); } }); } }); } var leaveReport = { reportNow: reportNow, addReport: addReport, addSpecificReport: addSpecificReport }; var _leaveReport = (function () { var doc = {}; var isCrossOrigin = false; try { doc = top.window.document; } catch (e) { isCrossOrigin = true; } if (!isCrossOrigin && top.window.__leaveReport) { return top.window.__leaveReport; } if (window.__leaveReport) { return window.__leaveReport; } JSAPI.on('reportOnLeaveForMP', function () { return assembleReportData(false); }); return window.__leaveReport = leaveReport; })(); var getReportJson = function getReportJson(logId, rawData) { var data = JSON.parse(JSON.stringify(rawData)); data.log_id = Number(logId); data.TimeStamp = Math.round(Date.now() / 1000); console.log('[comm_report] reportjson: ', data); return JSON.stringify(data); }; var getSuccessHandler = function getSuccessHandler(logId, data, opt) { return function (res) { if (res && res.err_code !== 0) { console.warn("[comm_report] report ".concat(logId, " fail: "), res.err_msg, data); } if (typeof opt.success === 'function') { opt.success(res); } }; }; var getErrorHandler = function getErrorHandler(logId, data, opt) { return function (xhr, info) { console.error("[comm_report] report ".concat(logId, " error: "), info, data); if (typeof opt.error === 'function') { opt.error(xhr, info); } }; }; var batchReportDataArr = []; var blackLogId = [25587, 18832, 28208, 25574, 29139, 10945]; var BATCH_SIZE = 4; var BATCH_TIME = 1000; var getRepeatedReportJson = function getRepeatedReportJson() { if (!batchReportDataArr || !batchReportDataArr.length) return false; var reportData = { count: 0 }; reportData.count = batchReportDataArr.length; batchReportDataArr.forEach(function (data, index) { reportData["reportjson".concat(index)] = data; }); batchReportDataArr = []; console.log('[reportData]: ', reportData); return reportData; }; var timeOutId; function batchReport() { if (!batchReportDataArr || !batchReportDataArr.length) return; var repeatedReportJson = getRepeatedReportJson(); if (!repeatedReportJson) return; AjaxRouter({ type: 'POST', dataType: 'json', url: '/mp/wapcommreport?action=batch_report', data: repeatedReportJson, dontReport: true, success: function success(res) { if (res && res.err_code) { console.warn("[comm_report] batch report fail: ", res.err_msg, batchReportDataArr); } }, error: function error(xhr, info) { console.error("[comm_report] batch report error: ", info, batchReportDataArr); } }); } function batchReportThrottle(logId, rawData) { var reportJsonData = getReportJson(logId, rawData); if (!reportJsonData) return; batchReportDataArr.push(reportJsonData); if (batchReportDataArr.length >= BATCH_SIZE) { batchReport(); } else { if (!timeOutId) { timeOutId = setTimeout(function () { batchReport(); clearTimeout(timeOutId); timeOutId = null; }, BATCH_TIME); } } } _leaveReport.addReport(function () { var repeatedReportJson = getRepeatedReportJson(); if (!repeatedReportJson) return false; var reportData = []; for (var _i = 0, _Object$entries = Object.entries(repeatedReportJson); _i < _Object$entries.length; _i++) { var _Object_i = _slicedToArray(_Object$entries[_i], 2), key = _Object_i[0], value = _Object_i[1]; reportData.push("".concat(key, "=").concat(encodeURIComponent(value))); } return { reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport?action=batch_report', reportData: reportData.join('&'), method: 'POST' }; }); var commReport = { report: function report(logId, rawData, rawOpt) { var opt = rawOpt || {}; if (!opt.realTime && !blackLogId.includes(logId)) { batchReportThrottle(logId, rawData); } else { AjaxRouter({ type: 'POST', dataType: 'json', url: '/mp/wapcommreport', data: { reportjson: getReportJson(logId, rawData) }, async: opt.async, success: getSuccessHandler(logId, rawData, opt), error: getErrorHandler(logId, rawData, opt) }); } }, leaveReport: function leaveReport(logId, rawData) { _leaveReport.addReport(function () { var data = typeof rawData === 'function' ? rawData() : rawData; if (!data) { return false; } return { reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport', reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))), method: 'POST' }; }); }, reportByBeacon: function reportByBeacon(logId, rawData) { try { if (!Device.os.android && !Device.os.ios && !Device.os.harmony) { var data = typeof rawData === 'function' ? rawData() : rawData; if (!data) { return false; } var url = '/mp/wapcommreport'; var reportJsonData = encodeURIComponent(getReportJson(logId, data)); console.log("reportByBeacon", JSON.stringify(reportJsonData)); navigator.sendBeacon(Url.joinUrl(url), "reportjson=".concat(reportJsonData)); } else { _leaveReport.addReport(function () { var data = typeof rawData === 'function' ? rawData() : rawData; if (!data) { return false; } return { reportUrl: 'https://mp.weixin.qq.com/mp/wapcommreport', reportData: "reportjson=".concat(encodeURIComponent(getReportJson(logId, data))), method: 'POST' }; }); } } catch (error) { console.log(error); } } }; var html = function html(_str, encode) { if (!_str) return ''; var replace = ['`', '`', ''', '\'', '"', '"', ' ', ' ', '>', '>', '<', '<', '¥', '¥', '&', '&', '<', '<', '>', '>']; var replaceReverse = ['&', '&', '¥', '¥', '<', '<', '>', '>', ' ', ' ', '"', '"', '\'', ''', '`', '`']; var str = _str; var target; if (encode) { target = replaceReverse; } else { target = replace; } for (var i = 0; i < target.length; i += 2) { str = str.replace(new RegExp(target[i], 'g'), target[i + 1]); } return str; }; var htmlLite = function htmlLite(_str, encode) { if (!_str) return ''; var replace = ['`', '`', ''', '\'', '"', '"', '>', '>', '<', '<', '&', '&']; var replaceReverse = ['&', '&', '<', '<', '>', '>', '"', '"', '\'', ''', '`', '`']; var str = _str; var target; if (encode) { target = replaceReverse; } else { target = replace; } for (var i = 0; i < target.length; i += 2) { str = str.replace(new RegExp(target[i], 'g'), target[i + 1]); } return str; }; var htmlEncode = function htmlEncode(str) { return html(str, true); }; var htmlDecode = function htmlDecode(str) { return html(str, false); }; var htmlEncodeLite = function htmlEncodeLite(str) { return htmlLite(str, true); }; var htmlDecodeLite = function htmlDecodeLite(str) { return htmlLite(str, false); }; String.prototype.html = function (encode) { return html(this.toString(), encode); }; String.prototype.htmlEncode = function () { return htmlEncode(this.toString()); }; String.prototype.htmlDecode = function () { return htmlDecode(this.toString()); }; String.prototype.htmlLite = function (encode) { return htmlLite(this.toString(), encode); }; String.prototype.htmlEncodeLite = function () { return htmlEncodeLite(this.toString()); }; String.prototype.htmlDecodeLite = function () { return htmlDecodeLite(this.toString()); }; var isIOS = mmVersion.isIOS, isAndroid = mmVersion.isAndroid; var renderDom = function renderDom(dom, cnt, hasStar) { if (dom) { if (hasStar) { dom.innerText = "已星标"; } else { dom.innerText = "星标"; } if (hasStar) { dom.classList.add('rich_media_meta_star'); dom.classList.remove('rich_media_meta_star_cancel'); } else { dom.classList.add('rich_media_meta_star_cancel'); dom.classList.remove('rich_media_meta_star'); } dom.style.removeProperty('display'); localStorage.setItem('star_info', JSON.stringify({ mid: window.mid, idx: window.idx, has_star: !!hasStar })); } }; var __setStar = function __setStar(dom, cnt, statStatus) { var hasReportExpose = false; var hasStar = statStatus; var realCnt = cnt; function addStar() { var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; hasStar = 1; realCnt = realCnt + 1; renderDom(dom, realCnt, hasStar); if (dispatchEvent) window.dispatchEvent(new CustomEvent('star')); } function cancelStar() { var dispatchEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; hasStar = 0; realCnt = realCnt - 1; renderDom(dom, realCnt, hasStar); if (dispatchEvent) window.dispatchEvent(new CustomEvent('cancel-star')); } if (dom) { renderDom(dom, cnt, statStatus); var clickHander = function clickHander() { if (hasStar === 0) { JSAPI.invoke('operateStar', { opType: 'addStar' }, function (res) { if (res.err_msg && /:ok$/.test(res.err_msg)) addStar(); }); } else { JSAPI.invoke('operateStar', { opType: 'cancelStar' }, function (res) { if (res.err_msg && /:ok$/.test(res.err_msg)) cancelStar(); }); } var data = { BizUin: window.biz, AppMsgID: window.mid * 1, ItemIndex: window.idx * 1, Scene: window.scene, SubScene: window.subscene * 1, EnterId: window.enterid, SessionId: "".concat(window.sessionid), Event: hasStar ? 8 : 7, ItemShowType: window.item_show_type * 1 }; commReport.report(17335, data); }; var exposeHandler = function exposeHandler() { if (hasReportExpose) return; var data = { BizUin: window.biz, AppMsgID: window.mid * 1, ItemIndex: window.idx * 1, Scene: window.scene, SubScene: window.subscene * 1, EnterId: window.enterid, SessionId: "".concat(window.sessionid), Event: 6, ItemShowType: window.item_show_type * 1 }; commReport.report(17335, data); hasReportExpose = true; }; dom.addEventListener('click', clickHander); JSAPI.on('onPageStarStateChanged', function (res) { console.log('onPageStarStateChanged', res); if (res.state) addStar();else cancelStar(); window.__hasStarInLifecycle = !!hasStar; }); var intersectionObserver = new IntersectionObserver(exposeHandler); intersectionObserver.observe(dom); window.addEventListener('star', function (e) { if (e && e.detail && e.detail.from === 'frontend') addStar(false); }); window.addEventListener('cancel-star', function (e) { if (e && e.detail && e.detail.from === 'frontend') cancelStar(false); }); document.addEventListener('visibilitychange', function () { var visible = document.visibilityState === 'visible'; if (!visible) return; window.__hasStarInLifecycle = !!hasStar; }); } }; if (!window.__second_open__) { var starDom = document.querySelector('#js_star'); var canUseStar = window.canUseStar || isIOS && mmVersion.compareHexVersion('18003623') || isAndroid && mmVersion.compareHexVersion('28003630'); var startPersonCnt = window.star_person_cnt || ''; console.log('canUseStar, startPersonCnt', canUseStar, startPersonCnt); if (!!(canUseStar * 1)) { var starSwitch = localStorage.getItem('mp_star_switch'); if (starSwitch === 'true') { var starInfo = localStorage.getItem('star_info'); var hasStar = 0; if (starInfo) { var parseStarInfo = JSON.parse(starInfo); if (Number(parseStarInfo.mid) === Number(window.mid) && Number(parseStarInfo.idx) === Number(window.idx) && parseStarInfo.has_star) { hasStar = 1; } } starDom && renderDom(starDom, startPersonCnt * 1, hasStar); var spanElement = document.getElementById('meta_content_hide_info'); spanElement && spanElement.classList.remove('rich_media_meta_padding'); } else { starDom && starDom.parentNode.removeChild(starDom); } } else { starDom && starDom.parentNode.removeChild(starDom); } window.__setStar = __setStar; } exports.__setStar = __setStar; exports.renderDom = renderDom; Object.defineProperty(exports, '__esModule', { value: true }); return exports; })({});
























