vhall-mini-sdk 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/lib/components/player/components/online-hot/index.js +2 -2
  2. package/lib/sdk/main/index.js +1 -0
  3. package/package.json +2 -4
  4. package/postinstall.js +21 -51
  5. package/dist/components/chat/chat-edit/chat-edit.js +0 -127
  6. package/dist/components/chat/chat-edit/chat-edit.json +0 -4
  7. package/dist/components/chat/chat-edit/chat-edit.wxml +0 -7
  8. package/dist/components/chat/chat-edit/chat-edit.wxss +0 -1
  9. package/dist/components/chat/chat-item/chat-item.js +0 -253
  10. package/dist/components/chat/chat-item/chat-item.json +0 -3
  11. package/dist/components/chat/chat-item/chat-item.wxml +0 -96
  12. package/dist/components/chat/chat-item/chat-item.wxss +0 -1
  13. package/dist/components/chat/chat-list/chat-list.js +0 -216
  14. package/dist/components/chat/chat-list/chat-list.json +0 -6
  15. package/dist/components/chat/chat-list/chat-list.wxml +0 -9
  16. package/dist/components/chat/chat-list/chat-list.wxss +0 -1
  17. package/dist/components/chat/chat.js +0 -98
  18. package/dist/components/chat/chat.json +0 -7
  19. package/dist/components/chat/chat.wxml +0 -7
  20. package/dist/components/chat/chat.wxss +0 -1
  21. package/dist/components/gift/gift-display/gift-display.js +0 -118
  22. package/dist/components/gift/gift-display/gift-display.json +0 -3
  23. package/dist/components/gift/gift-display/gift-display.wxml +0 -16
  24. package/dist/components/gift/gift-display/gift-display.wxss +0 -1
  25. package/dist/components/gift/gift-sender/gift-sender.js +0 -63
  26. package/dist/components/gift/gift-sender/gift-sender.json +0 -6
  27. package/dist/components/gift/gift-sender/gift-sender.wxml +0 -19
  28. package/dist/components/gift/gift-sender/gift-sender.wxss +0 -1
  29. package/dist/components/introduction/introduction.js +0 -43
  30. package/dist/components/introduction/introduction.json +0 -3
  31. package/dist/components/introduction/introduction.wxml +0 -8
  32. package/dist/components/introduction/introduction.wxss +0 -1
  33. package/dist/components/invite-rank/img/bronze.png +0 -0
  34. package/dist/components/invite-rank/img/gold.png +0 -0
  35. package/dist/components/invite-rank/img/silver.png +0 -0
  36. package/dist/components/invite-rank/index.js +0 -135
  37. package/dist/components/invite-rank/index.json +0 -8
  38. package/dist/components/invite-rank/index.wxml +0 -42
  39. package/dist/components/invite-rank/index.wxss +0 -1
  40. package/dist/components/invite-rank/invite-rank-item.js +0 -12
  41. package/dist/components/invite-rank/invite-rank-item.json +0 -4
  42. package/dist/components/invite-rank/invite-rank-item.wxml +0 -21
  43. package/dist/components/invite-rank/invite-rank-item.wxss +0 -1
  44. package/dist/components/invite-rank/my-invite-detail.js +0 -82
  45. package/dist/components/invite-rank/my-invite-detail.json +0 -7
  46. package/dist/components/invite-rank/my-invite-detail.wxml +0 -27
  47. package/dist/components/invite-rank/my-invite-detail.wxss +0 -1
  48. package/dist/components/invite-rank/util.wxs +0 -21
  49. package/dist/components/live-landscape/live-landscape.js +0 -216
  50. package/dist/components/live-landscape/live-landscape.json +0 -39
  51. package/dist/components/live-landscape/live-landscape.wxml +0 -73
  52. package/dist/components/live-landscape/live-landscape.wxss +0 -1
  53. package/dist/components/live-portrait/live-portrait.js +0 -274
  54. package/dist/components/live-portrait/live-portrait.json +0 -38
  55. package/dist/components/live-portrait/live-portrait.wxml +0 -106
  56. package/dist/components/live-portrait/live-portrait.wxss +0 -1
  57. package/dist/components/lottery/lottery-accept/index.js +0 -249
  58. package/dist/components/lottery/lottery-accept/index.json +0 -4
  59. package/dist/components/lottery/lottery-accept/index.wxml +0 -49
  60. package/dist/components/lottery/lottery-accept/index.wxss +0 -1
  61. package/dist/components/lottery/lottery-history/index.js +0 -36
  62. package/dist/components/lottery/lottery-history/index.json +0 -3
  63. package/dist/components/lottery/lottery-history/index.wxml +0 -28
  64. package/dist/components/lottery/lottery-history/index.wxss +0 -1
  65. package/dist/components/lottery/lottery-shake/lottery-shake.js +0 -328
  66. package/dist/components/lottery/lottery-shake/lottery-shake.json +0 -1
  67. package/dist/components/lottery/lottery-shake/lottery-shake.wxml +0 -52
  68. package/dist/components/lottery/lottery-shake/lottery-shake.wxss +0 -1
  69. package/dist/components/lottery/lottery-slot/lottery-slot.js +0 -230
  70. package/dist/components/lottery/lottery-slot/lottery-slot.json +0 -1
  71. package/dist/components/lottery/lottery-slot/lottery-slot.wxml +0 -62
  72. package/dist/components/lottery/lottery-slot/lottery-slot.wxss +0 -1
  73. package/dist/components/lottery/lottery-wheel/lottery-wheel.js +0 -153
  74. package/dist/components/lottery/lottery-wheel/lottery-wheel.json +0 -4
  75. package/dist/components/lottery/lottery-wheel/lottery-wheel.wxml +0 -91
  76. package/dist/components/lottery/lottery-wheel/lottery-wheel.wxss +0 -1
  77. package/dist/components/lottery/lottery-winners/index.js +0 -101
  78. package/dist/components/lottery/lottery-winners/index.json +0 -4
  79. package/dist/components/lottery/lottery-winners/index.wxml +0 -39
  80. package/dist/components/lottery/lottery-winners/index.wxss +0 -1
  81. package/dist/components/lottery/lottery.js +0 -388
  82. package/dist/components/lottery/lottery.json +0 -11
  83. package/dist/components/lottery/lottery.wxml +0 -78
  84. package/dist/components/lottery/lottery.wxss +0 -1
  85. package/dist/components/lottery/wheel.json +0 -49
  86. package/dist/components/mall-reward/common/reward-card.wxss +0 -0
  87. package/dist/components/mall-reward/duration-icon/index.js +0 -101
  88. package/dist/components/mall-reward/duration-icon/index.json +0 -3
  89. package/dist/components/mall-reward/duration-icon/index.wxml +0 -7
  90. package/dist/components/mall-reward/duration-icon/index.wxss +0 -1
  91. package/dist/components/mall-reward/f-count-down/index.js +0 -61
  92. package/dist/components/mall-reward/f-count-down/index.json +0 -3
  93. package/dist/components/mall-reward/f-count-down/index.wxml +0 -9
  94. package/dist/components/mall-reward/f-count-down/index.wxss +0 -1
  95. package/dist/components/mall-reward/f-empty/index.js +0 -11
  96. package/dist/components/mall-reward/f-empty/index.json +0 -3
  97. package/dist/components/mall-reward/f-empty/index.wxml +0 -8
  98. package/dist/components/mall-reward/f-empty/index.wxss +0 -1
  99. package/dist/components/mall-reward/f-history/index.js +0 -84
  100. package/dist/components/mall-reward/f-history/index.json +0 -4
  101. package/dist/components/mall-reward/f-history/index.wxml +0 -38
  102. package/dist/components/mall-reward/f-history/index.wxss +0 -1
  103. package/dist/components/mall-reward/f-open/index.js +0 -36
  104. package/dist/components/mall-reward/f-open/index.json +0 -3
  105. package/dist/components/mall-reward/f-open/index.wxml +0 -10
  106. package/dist/components/mall-reward/f-open/index.wxss +0 -1
  107. package/dist/components/mall-reward/f-receive/index.js +0 -36
  108. package/dist/components/mall-reward/f-receive/index.json +0 -3
  109. package/dist/components/mall-reward/f-receive/index.wxml +0 -9
  110. package/dist/components/mall-reward/f-receive/index.wxss +0 -1
  111. package/dist/components/mall-reward/index.js +0 -374
  112. package/dist/components/mall-reward/index.json +0 -8
  113. package/dist/components/mall-reward/index.wxml +0 -4
  114. package/dist/components/mall-reward/index.wxss +0 -0
  115. package/dist/components/mall-reward/main-popup/index.js +0 -46
  116. package/dist/components/mall-reward/main-popup/index.json +0 -12
  117. package/dist/components/mall-reward/main-popup/index.wxml +0 -16
  118. package/dist/components/mall-reward/main-popup/index.wxss +0 -1
  119. package/dist/components/player/assets/image/arrow-left.png +0 -0
  120. package/dist/components/player/assets/image/arrow-right.png +0 -0
  121. package/dist/components/player/assets/image/enterFullScreen.png +0 -0
  122. package/dist/components/player/assets/image/exitFullScreen.png +0 -0
  123. package/dist/components/player/assets/image/fullscreen_1.png +0 -0
  124. package/dist/components/player/assets/image/fullscreen_2.png +0 -0
  125. package/dist/components/player/assets/image/pause.png +0 -0
  126. package/dist/components/player/assets/image/pause_1.png +0 -0
  127. package/dist/components/player/assets/image/play.png +0 -0
  128. package/dist/components/player/assets/image/play_1.png +0 -0
  129. package/dist/components/player/assets/image/refresh.png +0 -0
  130. package/dist/components/player/assets/image/refresh_1.png +0 -0
  131. package/dist/components/player/assets/image/subtitle_close.png +0 -0
  132. package/dist/components/player/assets/image/subtitle_default.png +0 -0
  133. package/dist/components/player/assets/image/volume-off.png +0 -0
  134. package/dist/components/player/assets/image/volume-on.png +0 -0
  135. package/dist/components/player/common/config.js +0 -7
  136. package/dist/components/player/common/veComponent.js +0 -4
  137. package/dist/components/player/components/barrage/barrage-canvas.js +0 -488
  138. package/dist/components/player/components/barrage/barrage-dom.js +0 -471
  139. package/dist/components/player/components/barrage/index.js +0 -62
  140. package/dist/components/player/components/barrage/index.json +0 -4
  141. package/dist/components/player/components/barrage/index.wxml +0 -39
  142. package/dist/components/player/components/barrage/index.wxss +0 -1
  143. package/dist/components/player/components/barrage/utils.js +0 -71
  144. package/dist/components/player/components/controls/controls.js +0 -93
  145. package/dist/components/player/components/controls/controls.json +0 -6
  146. package/dist/components/player/components/controls/controls.wxml +0 -60
  147. package/dist/components/player/components/controls/controls.wxss +0 -1
  148. package/dist/components/player/components/danmaku/danmaku.js +0 -23
  149. package/dist/components/player/components/danmaku/danmaku.json +0 -4
  150. package/dist/components/player/components/danmaku/danmaku.wxml +0 -1
  151. package/dist/components/player/components/danmaku/danmaku.wxss +0 -0
  152. package/dist/components/player/components/error/error.js +0 -15
  153. package/dist/components/player/components/error/error.json +0 -3
  154. package/dist/components/player/components/error/error.wxml +0 -6
  155. package/dist/components/player/components/error/error.wxss +0 -1
  156. package/dist/components/player/components/loading/loading.js +0 -9
  157. package/dist/components/player/components/loading/loading.json +0 -3
  158. package/dist/components/player/components/loading/loading.wxml +0 -4
  159. package/dist/components/player/components/loading/loading.wxss +0 -1
  160. package/dist/components/player/components/main/extensions/data.js +0 -8
  161. package/dist/components/player/components/main/extensions/export.js +0 -83
  162. package/dist/components/player/components/main/extensions/methods.js +0 -110
  163. package/dist/components/player/components/main/extensions/observers.js +0 -41
  164. package/dist/components/player/components/main/extensions/props.js +0 -177
  165. package/dist/components/player/components/main/index.js +0 -44
  166. package/dist/components/player/components/main/index.json +0 -4
  167. package/dist/components/player/components/main/index.wxml +0 -7
  168. package/dist/components/player/components/main/index.wxss +0 -1
  169. package/dist/components/player/components/marquee/marquee.js +0 -304
  170. package/dist/components/player/components/marquee/marquee.json +0 -4
  171. package/dist/components/player/components/marquee/marquee.wxml +0 -14
  172. package/dist/components/player/components/marquee/marquee.wxss +0 -1
  173. package/dist/components/player/components/online-hot/assets/line-hot.png +0 -0
  174. package/dist/components/player/components/online-hot/assets/line-user.png +0 -0
  175. package/dist/components/player/components/online-hot/index.js +0 -66
  176. package/dist/components/player/components/online-hot/index.json +0 -3
  177. package/dist/components/player/components/online-hot/index.wxml +0 -15
  178. package/dist/components/player/components/online-hot/index.wxss +0 -1
  179. package/dist/components/player/components/poster/poster.js +0 -12
  180. package/dist/components/player/components/poster/poster.json +0 -3
  181. package/dist/components/player/components/poster/poster.wxml +0 -5
  182. package/dist/components/player/components/poster/poster.wxss +0 -1
  183. package/dist/components/player/components/watermark/watermark.js +0 -52
  184. package/dist/components/player/components/watermark/watermark.json +0 -4
  185. package/dist/components/player/components/watermark/watermark.wxml +0 -8
  186. package/dist/components/player/components/watermark/watermark.wxss +0 -1
  187. package/dist/components/player/extensions/data.js +0 -63
  188. package/dist/components/player/extensions/export.js +0 -325
  189. package/dist/components/player/extensions/methods.js +0 -406
  190. package/dist/components/player/extensions/observers.js +0 -114
  191. package/dist/components/player/extensions/props.js +0 -162
  192. package/dist/components/player/player.js +0 -83
  193. package/dist/components/player/player.json +0 -33
  194. package/dist/components/player/player.wxml +0 -48
  195. package/dist/components/player/player.wxss +0 -1
  196. package/dist/components/praise/praise.js +0 -150
  197. package/dist/components/praise/praise.json +0 -5
  198. package/dist/components/praise/praise.wxml +0 -17
  199. package/dist/components/praise/praise.wxss +0 -1
  200. package/dist/components/product/product-card/product-card.js +0 -109
  201. package/dist/components/product/product-card/product-card.json +0 -3
  202. package/dist/components/product/product-card/product-card.wxml +0 -47
  203. package/dist/components/product/product-card/product-card.wxss +0 -1
  204. package/dist/components/product/product-detail/product-detail.js +0 -127
  205. package/dist/components/product/product-detail/product-detail.json +0 -3
  206. package/dist/components/product/product-detail/product-detail.wxml +0 -57
  207. package/dist/components/product/product-detail/product-detail.wxss +0 -1
  208. package/dist/components/product/product-item/product-item.js +0 -56
  209. package/dist/components/product/product-item/product-item.json +0 -3
  210. package/dist/components/product/product-item/product-item.wxml +0 -35
  211. package/dist/components/product/product-item/product-item.wxss +0 -1
  212. package/dist/components/product/product-list/product-list.js +0 -67
  213. package/dist/components/product/product-list/product-list.json +0 -6
  214. package/dist/components/product/product-list/product-list.wxml +0 -16
  215. package/dist/components/product/product-list/product-list.wxss +0 -1
  216. package/dist/components/product/product-order/product-order.js +0 -394
  217. package/dist/components/product/product-order/product-order.json +0 -3
  218. package/dist/components/product/product-order/product-order.wxml +0 -75
  219. package/dist/components/product/product-order/product-order.wxss +0 -1
  220. package/dist/components/signin/signin-dialog.js +0 -305
  221. package/dist/components/signin/signin-dialog.json +0 -7
  222. package/dist/components/signin/signin-dialog.wxml +0 -19
  223. package/dist/components/signin/signin-dialog.wxss +0 -1
  224. package/dist/components/top-notify/index.js +0 -14
  225. package/dist/components/top-notify/index.json +0 -3
  226. package/dist/components/top-notify/index.wxml +0 -2
  227. package/dist/components/top-notify/index.wxss +0 -1
  228. package/dist/pubComponents/countdown/countdown.js +0 -97
  229. package/dist/pubComponents/countdown/countdown.json +0 -5
  230. package/dist/pubComponents/countdown/countdown.wxml +0 -19
  231. package/dist/pubComponents/countdown/countdown.wxss +0 -1
  232. package/dist/pubComponents/error-page/index.js +0 -146
  233. package/dist/pubComponents/error-page/index.json +0 -5
  234. package/dist/pubComponents/error-page/index.wxml +0 -37
  235. package/dist/pubComponents/error-page/index.wxss +0 -1
  236. package/dist/pubComponents/popup/popup.js +0 -161
  237. package/dist/pubComponents/popup/popup.json +0 -5
  238. package/dist/pubComponents/popup/popup.wxml +0 -17
  239. package/dist/pubComponents/popup/popup.wxss +0 -1
  240. package/dist/pubComponents/tabs/index.js +0 -95
  241. package/dist/pubComponents/tabs/index.json +0 -4
  242. package/dist/pubComponents/tabs/index.wxml +0 -22
  243. package/dist/pubComponents/tabs/index.wxss +0 -1
  244. package/dist/sdk/config/index.js +0 -1
  245. package/dist/sdk/main/index.js +0 -1
  246. package/dist/sdk/player/index.js +0 -1
  247. package/dist/sdk/plugins/ChatServer.js +0 -1
  248. package/dist/sdk/plugins/CustomMenuServer.js +0 -1
  249. package/dist/sdk/plugins/InteractServer.js +0 -1
  250. package/dist/sdk/plugins/InviteCardServer.js +0 -1
  251. package/dist/sdk/plugins/LotteryServer.js +0 -1
  252. package/dist/sdk/plugins/MallRewardServer.js +0 -1
  253. package/dist/sdk/plugins/ProductServer.js +0 -1
  254. package/dist/shared/RequestUtil.js +0 -1
  255. package/dist/shared/SerializableMap.js +0 -1
  256. package/dist/shared/base.server.js +0 -1
  257. package/dist/shared/cacheUtil.js +0 -1
  258. package/dist/shared/dateUtil.js +0 -1
  259. package/dist/shared/logger.js +0 -1
  260. package/dist/shared/mpUtils.js +0 -1
  261. package/dist/shared/utils.js +0 -1
@@ -1 +1,2 @@
1
+ /* vhall-mini-sdk v0.1.1 */
1
2
  !function(){var J={2:function(J){var Z;window,Z=()=>(()=>{var J={155:J=>{var Z,ee,ne=J.exports={};function n(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(J){if(Z===setTimeout)return setTimeout(J,0);if((Z===n||!Z)&&setTimeout)return Z=setTimeout,setTimeout(J,0);try{return Z(J,0)}catch(ee){try{return Z.call(null,J,0)}catch(ee){return Z.call(this,J,0)}}}!function(){try{Z="function"==typeof setTimeout?setTimeout:n}catch(J){Z=n}try{ee="function"==typeof clearTimeout?clearTimeout:s}catch(J){ee=s}}();var se,re=[],ae=!1,le=-1;function f(){ae&&se&&(ae=!1,se.length?re=se.concat(re):le=-1,re.length&&l())}function l(){if(!ae){var J=o(f);ae=!0;for(var Z=re.length;Z;){for(se=re,re=[];++le<Z;)se&&se[le].run();le=-1,Z=re.length}se=null,ae=!1,function(J){if(ee===clearTimeout)return clearTimeout(J);if((ee===s||!ee)&&clearTimeout)return ee=clearTimeout,clearTimeout(J);try{return ee(J)}catch(Z){try{return ee.call(null,J)}catch(Z){return ee.call(this,J)}}}(J)}}function p(J,Z){this.fun=J,this.array=Z}function g(){}ne.nextTick=function(J){var Z=new Array(arguments.length-1);if(arguments.length>1)for(var ee=1;ee<arguments.length;ee++)Z[ee-1]=arguments[ee];re.push(new p(J,Z)),1!==re.length||ae||o(l)},p.prototype.run=function(){this.fun.apply(null,this.array)},ne.title="browser",ne.browser=!0,ne.env={},ne.argv=[],ne.version="",ne.versions={},ne.on=g,ne.addListener=g,ne.once=g,ne.off=g,ne.removeListener=g,ne.removeAllListeners=g,ne.emit=g,ne.prependListener=g,ne.prependOnceListener=g,ne.listeners=function(J){return[]},ne.binding=function(J){throw new Error("process.binding is not supported")},ne.cwd=function(){return"/"},ne.chdir=function(J){throw new Error("process.chdir is not supported")},ne.umask=function(){return 0}}},Z={};function i(ee){var ne=Z[ee];if(void 0!==ne)return ne.exports;var se=Z[ee]={exports:{}};return J[ee](se,se.exports,i),se.exports}i.d=(J,Z)=>{for(var ee in Z)i.o(Z,ee)&&!i.o(J,ee)&&Object.defineProperty(J,ee,{enumerable:!0,get:Z[ee]})},i.o=(J,Z)=>Object.prototype.hasOwnProperty.call(J,Z);var ee={};return(()=>{"use strict";function e(J){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(J)}function n(J,Z){return J&Z}function s(J,Z){return J|Z}function o(J,Z){return J^Z}function h(J,Z){return J&~Z}function a(J){if(0==J)return-1;var Z=0;return!(65535&J)&&(J>>=16,Z+=16),!(255&J)&&(J>>=8,Z+=8),!(15&J)&&(J>>=4,Z+=4),!(3&J)&&(J>>=2,Z+=2),!(1&J)&&++Z,Z}function u(J){for(var Z=0;0!=J;)J&=J-1,++Z;return Z}i.d(ee,{default:()=>Wt});var J,Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function p(J){var ee,ne,se="";for(ee=0;ee+3<=J.length;ee+=3)ne=parseInt(J.substring(ee,ee+3),16),se+=Z.charAt(ne>>6)+Z.charAt(63&ne);for(ee+1==J.length?(ne=parseInt(J.substring(ee,ee+1),16),se+=Z.charAt(ne<<2)):ee+2==J.length&&(ne=parseInt(J.substring(ee,ee+2),16),se+=Z.charAt(ne>>2)+Z.charAt((3&ne)<<4));(3&se.length)>0;)se+="=";return se}function g(J){var ee,ne="",se=0,re=0;for(ee=0;ee<J.length&&"="!=J.charAt(ee);++ee){var ae=Z.indexOf(J.charAt(ee));ae<0||(0==se?(ne+=e(ae>>2),re=3&ae,se=1):1==se?(ne+=e(re<<2|ae>>4),re=15&ae,se=2):2==se?(ne+=e(re),ne+=e(ae>>2),re=3&ae,se=3):(ne+=e(re<<2|ae>>4),ne+=e(15&ae),se=0))}return 1==se&&(ne+=e(re<<2)),ne}var ne,se={decode:function(J){var Z;if(void 0===ne){var ee="= \f\n\r\t \u2028\u2029";for(ne=Object.create(null),Z=0;Z<64;++Z)ne["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(Z)]=Z;for(ne["-"]=62,ne._=63,Z=0;Z<9;++Z)ne[ee.charAt(Z)]=-1}var se=[],re=0,ae=0;for(Z=0;Z<J.length;++Z){var le=J.charAt(Z);if("="==le)break;if(-1!=(le=ne[le])){if(void 0===le)throw new Error("Illegal character at offset "+Z);re|=le,++ae>=4?(se[se.length]=re>>16,se[se.length]=re>>8&255,se[se.length]=255&re,re=0,ae=0):re<<=6}}switch(ae){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:se[se.length]=re>>10;break;case 3:se[se.length]=re>>16,se[se.length]=re>>8&255}return se},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(J){var Z=se.re.exec(J);if(Z)if(Z[1])J=Z[1];else{if(!Z[2])throw new Error("RegExp out of sync");J=Z[2]}return se.decode(J)}},re=1e13,ae=function(){function t(J){this.buf=[+J||0]}return t.prototype.mulAdd=function(J,Z){var ee,ne,se=this.buf,ae=se.length;for(ee=0;ee<ae;++ee)(ne=se[ee]*J+Z)<re?Z=0:ne-=(Z=0|ne/re)*re,se[ee]=ne;Z>0&&(se[ee]=Z)},t.prototype.sub=function(J){var Z,ee,ne=this.buf,se=ne.length;for(Z=0;Z<se;++Z)(ee=ne[Z]-J)<0?(ee+=re,J=1):J=0,ne[Z]=ee;for(;0===ne[ne.length-1];)ne.pop()},t.prototype.toString=function(J){if(10!=(J||10))throw new Error("only base 10 is supported");for(var Z=this.buf,ee=Z[Z.length-1].toString(),ne=Z.length-2;ne>=0;--ne)ee+=(re+Z[ne]).toString().substring(1);return ee},t.prototype.valueOf=function(){for(var J=this.buf,Z=0,ee=J.length-1;ee>=0;--ee)Z=Z*re+J[ee];return Z},t.prototype.simplify=function(){var J=this.buf;return 1==J.length?J[0]:this},t}(),le=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,pe=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function E(J,Z){return J.length>Z&&(J=J.substring(0,Z)+"…"),J}var _e,ve=function(){function t(J,Z){this.hexDigits="0123456789ABCDEF",J instanceof t?(this.enc=J.enc,this.pos=J.pos):(this.enc=J,this.pos=Z)}return t.prototype.get=function(J){if(void 0===J&&(J=this.pos++),J>=this.enc.length)throw new Error("Requesting byte offset ".concat(J," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(J):this.enc[J]},t.prototype.hexByte=function(J){return this.hexDigits.charAt(J>>4&15)+this.hexDigits.charAt(15&J)},t.prototype.hexDump=function(J,Z,ee){for(var ne="",se=J;se<Z;++se)if(ne+=this.hexByte(this.get(se)),!0!==ee)switch(15&se){case 7:ne+=" ";break;case 15:ne+="\n";break;default:ne+=" "}return ne},t.prototype.isASCII=function(J,Z){for(var ee=J;ee<Z;++ee){var ne=this.get(ee);if(ne<32||ne>176)return!1}return!0},t.prototype.parseStringISO=function(J,Z){for(var ee="",ne=J;ne<Z;++ne)ee+=String.fromCharCode(this.get(ne));return ee},t.prototype.parseStringUTF=function(J,Z){for(var ee="",ne=J;ne<Z;){var se=this.get(ne++);ee+=se<128?String.fromCharCode(se):se>191&&se<224?String.fromCharCode((31&se)<<6|63&this.get(ne++)):String.fromCharCode((15&se)<<12|(63&this.get(ne++))<<6|63&this.get(ne++))}return ee},t.prototype.parseStringBMP=function(J,Z){for(var ee,ne,se="",re=J;re<Z;)ee=this.get(re++),ne=this.get(re++),se+=String.fromCharCode(ee<<8|ne);return se},t.prototype.parseTime=function(J,Z,ee){var ne=this.parseStringISO(J,Z),se=(ee?le:pe).exec(ne);return se?(ee&&(se[1]=+se[1],se[1]+=+se[1]<70?2e3:1900),ne=se[1]+"-"+se[2]+"-"+se[3]+" "+se[4],se[5]&&(ne+=":"+se[5],se[6]&&(ne+=":"+se[6],se[7]&&(ne+="."+se[7]))),se[8]&&(ne+=" UTC","Z"!=se[8]&&(ne+=se[8],se[9]&&(ne+=":"+se[9]))),ne):"Unrecognized time: "+ne},t.prototype.parseInteger=function(J,Z){for(var ee,ne=this.get(J),se=ne>127,re=se?255:0,le="";ne==re&&++J<Z;)ne=this.get(J);if(0==(ee=Z-J))return se?-1:0;if(ee>4){for(le=ne,ee<<=3;!(128&(+le^re));)le=+le<<1,--ee;le="("+ee+" bit)\n"}se&&(ne-=256);for(var pe=new ae(ne),_e=J+1;_e<Z;++_e)pe.mulAdd(256,this.get(_e));return le+pe.toString()},t.prototype.parseBitString=function(J,Z,ee){for(var ne=this.get(J),se="("+((Z-J-1<<3)-ne)+" bit)\n",re="",ae=J+1;ae<Z;++ae){for(var le=this.get(ae),pe=ae==Z-1?ne:0,_e=7;_e>=pe;--_e)re+=le>>_e&1?"1":"0";if(re.length>ee)return se+E(re,ee)}return se+re},t.prototype.parseOctetString=function(J,Z,ee){if(this.isASCII(J,Z))return E(this.parseStringISO(J,Z),ee);var ne=Z-J,se="("+ne+" byte)\n";ne>(ee/=2)&&(Z=J+ee);for(var re=J;re<Z;++re)se+=this.hexByte(this.get(re));return ne>ee&&(se+="…"),se},t.prototype.parseOID=function(J,Z,ee){for(var ne="",se=new ae,re=0,le=J;le<Z;++le){var pe=this.get(le);if(se.mulAdd(128,127&pe),re+=7,!(128&pe)){if(""===ne)if((se=se.simplify())instanceof ae)se.sub(80),ne="2."+se.toString();else{var _e=se<80?se<40?0:1:2;ne=_e+"."+(se-40*_e)}else ne+="."+se.toString();if(ne.length>ee)return E(ne,ee);se=new ae,re=0}}return re>0&&(ne+=".incomplete"),ne},t}(),ye=function(){function t(J,Z,ee,ne,se){if(!(ne instanceof Fe))throw new Error("Invalid tag value.");this.stream=J,this.header=Z,this.length=ee,this.tag=ne,this.sub=se}return t.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(J){if(void 0===this.tag)return null;void 0===J&&(J=1/0);var Z=this.posContent(),ee=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(Z,Z+ee,J);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(Z)?"false":"true";case 2:return this.stream.parseInteger(Z,Z+ee);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(Z,Z+ee,J);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(Z,Z+ee,J);case 6:return this.stream.parseOID(Z,Z+ee,J);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return E(this.stream.parseStringUTF(Z,Z+ee),J);case 18:case 19:case 20:case 21:case 22:case 26:return E(this.stream.parseStringISO(Z,Z+ee),J);case 30:return E(this.stream.parseStringBMP(Z,Z+ee),J);case 23:case 24:return this.stream.parseTime(Z,Z+ee,23==this.tag.tagNumber)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(J){void 0===J&&(J="");var Z=J+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(Z+="+"),Z+=this.length,this.tag.tagConstructed?Z+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(Z+=" (encapsulates)"),Z+="\n",null!==this.sub){J+=" ";for(var ee=0,ne=this.sub.length;ee<ne;++ee)Z+=this.sub[ee].toPrettyString(J)}return Z},t.prototype.posStart=function(){return this.stream.pos},t.prototype.posContent=function(){return this.stream.pos+this.header},t.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},t.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},t.decodeLength=function(J){var Z=J.get(),ee=127&Z;if(ee==Z)return ee;if(ee>6)throw new Error("Length over 48 bits not supported at position "+(J.pos-1));if(0===ee)return null;Z=0;for(var ne=0;ne<ee;++ne)Z=256*Z+J.get();return Z},t.prototype.getHexStringValue=function(){var J=this.toHexString(),Z=2*this.header,ee=2*this.length;return J.substr(Z,ee)},t.decode=function(J){var Z;Z=J instanceof ve?J:new ve(J,0);var ee=new ve(Z),ne=new Fe(Z),se=t.decodeLength(Z),re=Z.pos,ae=re-ee.pos,le=null,u=function(){var J=[];if(null!==se){for(var ee=re+se;Z.pos<ee;)J[J.length]=t.decode(Z);if(Z.pos!=ee)throw new Error("Content size is not correct for container starting at offset "+re)}else try{for(;;){var ne=t.decode(Z);if(ne.tag.isEOC())break;J[J.length]=ne}se=re-Z.pos}catch(J){throw new Error("Exception while decoding undefined length content: "+J)}return J};if(ne.tagConstructed)le=u();else if(ne.isUniversal()&&(3==ne.tagNumber||4==ne.tagNumber))try{if(3==ne.tagNumber&&0!=Z.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");le=u();for(var pe=0;pe<le.length;++pe)if(le[pe].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(J){le=null}if(null===le){if(null===se)throw new Error("We can't skip over an invalid tag with undefined length at offset "+re);Z.pos=re+Math.abs(se)}return new t(ee,ae,se,ne,le)},t}(),Fe=function(){function t(J){var Z=J.get();if(this.tagClass=Z>>6,this.tagConstructed=!!(32&Z),this.tagNumber=31&Z,31==this.tagNumber){var ee=new ae;do{Z=J.get(),ee.mulAdd(128,127&Z)}while(128&Z);this.tagNumber=ee.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),qe=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],$e=(1<<26)/qe[qe.length-1],He=function(){function t(J,Z,ee){null!=J&&("number"==typeof J?this.fromNumber(J,Z,ee):null==Z&&"string"!=typeof J?this.fromString(J,256):this.fromString(J,Z))}return t.prototype.toString=function(J){if(this.s<0)return"-"+this.negate().toString(J);var Z;if(16==J)Z=4;else if(8==J)Z=3;else if(2==J)Z=1;else if(32==J)Z=5;else{if(4!=J)return this.toRadix(J);Z=2}var ee,ne=(1<<Z)-1,se=!1,re="",ae=this.t,le=this.DB-ae*this.DB%Z;if(ae-- >0)for(le<this.DB&&(ee=this[ae]>>le)>0&&(se=!0,re=e(ee));ae>=0;)le<Z?(ee=(this[ae]&(1<<le)-1)<<Z-le,ee|=this[--ae]>>(le+=this.DB-Z)):(ee=this[ae]>>(le-=Z)&ne,le<=0&&(le+=this.DB,--ae)),ee>0&&(se=!0),se&&(re+=e(ee));return se?re:"0"},t.prototype.negate=function(){var J=M();return t.ZERO.subTo(this,J),J},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareTo=function(J){var Z=this.s-J.s;if(0!=Z)return Z;var ee=this.t;if(0!=(Z=ee-J.t))return this.s<0?-Z:Z;for(;--ee>=0;)if(0!=(Z=this[ee]-J[ee]))return Z;return 0},t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+K(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(J){var Z=M();return this.abs().divRemTo(J,null,Z),this.s<0&&Z.compareTo(t.ZERO)>0&&J.subTo(Z,Z),Z},t.prototype.modPowInt=function(J,Z){var ee;return ee=J<256||Z.isEven()?new Je(Z):new Xe(Z),this.exp(J,ee)},t.prototype.clone=function(){var J=M();return this.copyTo(J),J},t.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},t.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},t.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.toByteArray=function(){var J=this.t,Z=[];Z[0]=this.s;var ee,ne=this.DB-J*this.DB%8,se=0;if(J-- >0)for(ne<this.DB&&(ee=this[J]>>ne)!=(this.s&this.DM)>>ne&&(Z[se++]=ee|this.s<<this.DB-ne);J>=0;)ne<8?(ee=(this[J]&(1<<ne)-1)<<8-ne,ee|=this[--J]>>(ne+=this.DB-8)):(ee=this[J]>>(ne-=8)&255,ne<=0&&(ne+=this.DB,--J)),!!(128&ee)&&(ee|=-256),0==se&&(128&this.s)!=(128&ee)&&++se,(se>0||ee!=this.s)&&(Z[se++]=ee);return Z},t.prototype.equals=function(J){return 0==this.compareTo(J)},t.prototype.min=function(J){return this.compareTo(J)<0?this:J},t.prototype.max=function(J){return this.compareTo(J)>0?this:J},t.prototype.and=function(J){var Z=M();return this.bitwiseTo(J,n,Z),Z},t.prototype.or=function(J){var Z=M();return this.bitwiseTo(J,s,Z),Z},t.prototype.xor=function(J){var Z=M();return this.bitwiseTo(J,o,Z),Z},t.prototype.andNot=function(J){var Z=M();return this.bitwiseTo(J,h,Z),Z},t.prototype.not=function(){for(var J=M(),Z=0;Z<this.t;++Z)J[Z]=this.DM&~this[Z];return J.t=this.t,J.s=~this.s,J},t.prototype.shiftLeft=function(J){var Z=M();return J<0?this.rShiftTo(-J,Z):this.lShiftTo(J,Z),Z},t.prototype.shiftRight=function(J){var Z=M();return J<0?this.lShiftTo(-J,Z):this.rShiftTo(J,Z),Z},t.prototype.getLowestSetBit=function(){for(var J=0;J<this.t;++J)if(0!=this[J])return J*this.DB+a(this[J]);return this.s<0?this.t*this.DB:-1},t.prototype.bitCount=function(){for(var J=0,Z=this.s&this.DM,ee=0;ee<this.t;++ee)J+=u(this[ee]^Z);return J},t.prototype.testBit=function(J){var Z=Math.floor(J/this.DB);return Z>=this.t?0!=this.s:!!(this[Z]&1<<J%this.DB)},t.prototype.setBit=function(J){return this.changeBit(J,s)},t.prototype.clearBit=function(J){return this.changeBit(J,h)},t.prototype.flipBit=function(J){return this.changeBit(J,o)},t.prototype.add=function(J){var Z=M();return this.addTo(J,Z),Z},t.prototype.subtract=function(J){var Z=M();return this.subTo(J,Z),Z},t.prototype.multiply=function(J){var Z=M();return this.multiplyTo(J,Z),Z},t.prototype.divide=function(J){var Z=M();return this.divRemTo(J,Z,null),Z},t.prototype.remainder=function(J){var Z=M();return this.divRemTo(J,null,Z),Z},t.prototype.divideAndRemainder=function(J){var Z=M(),ee=M();return this.divRemTo(J,Z,ee),[Z,ee]},t.prototype.modPow=function(J,Z){var ee,ne,se=J.bitLength(),re=U(1);if(se<=0)return re;ee=se<18?1:se<48?3:se<144?4:se<768?5:6,ne=se<8?new Je(Z):Z.isEven()?new Qe(Z):new Xe(Z);var ae=[],le=3,pe=ee-1,_e=(1<<ee)-1;if(ae[1]=ne.convert(this),ee>1){var ve=M();for(ne.sqrTo(ae[1],ve);le<=_e;)ae[le]=M(),ne.mulTo(ve,ae[le-2],ae[le]),le+=2}var ye,Fe,qe=J.t-1,$e=!0,He=M();for(se=K(J[qe])-1;qe>=0;){for(se>=pe?ye=J[qe]>>se-pe&_e:(ye=(J[qe]&(1<<se+1)-1)<<pe-se,qe>0&&(ye|=J[qe-1]>>this.DB+se-pe)),le=ee;!(1&ye);)ye>>=1,--le;if((se-=le)<0&&(se+=this.DB,--qe),$e)ae[ye].copyTo(re),$e=!1;else{for(;le>1;)ne.sqrTo(re,He),ne.sqrTo(He,re),le-=2;le>0?ne.sqrTo(re,He):(Fe=re,re=He,He=Fe),ne.mulTo(He,ae[ye],re)}for(;qe>=0&&!(J[qe]&1<<se);)ne.sqrTo(re,He),Fe=re,re=He,He=Fe,--se<0&&(se=this.DB-1,--qe)}return ne.revert(re)},t.prototype.modInverse=function(J){var Z=J.isEven();if(this.isEven()&&Z||0==J.signum())return t.ZERO;for(var ee=J.clone(),ne=this.clone(),se=U(1),re=U(0),ae=U(0),le=U(1);0!=ee.signum();){for(;ee.isEven();)ee.rShiftTo(1,ee),Z?(se.isEven()&&re.isEven()||(se.addTo(this,se),re.subTo(J,re)),se.rShiftTo(1,se)):re.isEven()||re.subTo(J,re),re.rShiftTo(1,re);for(;ne.isEven();)ne.rShiftTo(1,ne),Z?(ae.isEven()&&le.isEven()||(ae.addTo(this,ae),le.subTo(J,le)),ae.rShiftTo(1,ae)):le.isEven()||le.subTo(J,le),le.rShiftTo(1,le);ee.compareTo(ne)>=0?(ee.subTo(ne,ee),Z&&se.subTo(ae,se),re.subTo(le,re)):(ne.subTo(ee,ne),Z&&ae.subTo(se,ae),le.subTo(re,le))}return 0!=ne.compareTo(t.ONE)?t.ZERO:le.compareTo(J)>=0?le.subtract(J):le.signum()<0?(le.addTo(J,le),le.signum()<0?le.add(J):le):le},t.prototype.pow=function(J){return this.exp(J,new Ye)},t.prototype.gcd=function(J){var Z=this.s<0?this.negate():this.clone(),ee=J.s<0?J.negate():J.clone();if(Z.compareTo(ee)<0){var ne=Z;Z=ee,ee=ne}var se=Z.getLowestSetBit(),re=ee.getLowestSetBit();if(re<0)return Z;for(se<re&&(re=se),re>0&&(Z.rShiftTo(re,Z),ee.rShiftTo(re,ee));Z.signum()>0;)(se=Z.getLowestSetBit())>0&&Z.rShiftTo(se,Z),(se=ee.getLowestSetBit())>0&&ee.rShiftTo(se,ee),Z.compareTo(ee)>=0?(Z.subTo(ee,Z),Z.rShiftTo(1,Z)):(ee.subTo(Z,ee),ee.rShiftTo(1,ee));return re>0&&ee.lShiftTo(re,ee),ee},t.prototype.isProbablePrime=function(J){var Z,ee=this.abs();if(1==ee.t&&ee[0]<=qe[qe.length-1]){for(Z=0;Z<qe.length;++Z)if(ee[0]==qe[Z])return!0;return!1}if(ee.isEven())return!1;for(Z=1;Z<qe.length;){for(var ne=qe[Z],se=Z+1;se<qe.length&&ne<$e;)ne*=qe[se++];for(ne=ee.modInt(ne);Z<se;)if(ne%qe[Z++]==0)return!1}return ee.millerRabin(J)},t.prototype.copyTo=function(J){for(var Z=this.t-1;Z>=0;--Z)J[Z]=this[Z];J.t=this.t,J.s=this.s},t.prototype.fromInt=function(J){this.t=1,this.s=J<0?-1:0,J>0?this[0]=J:J<-1?this[0]=J+this.DV:this.t=0},t.prototype.fromString=function(J,Z){var ee;if(16==Z)ee=4;else if(8==Z)ee=3;else if(256==Z)ee=8;else if(2==Z)ee=1;else if(32==Z)ee=5;else{if(4!=Z)return void this.fromRadix(J,Z);ee=2}this.t=0,this.s=0;for(var ne=J.length,se=!1,re=0;--ne>=0;){var ae=8==ee?255&+J[ne]:F(J,ne);ae<0?"-"==J.charAt(ne)&&(se=!0):(se=!1,0==re?this[this.t++]=ae:re+ee>this.DB?(this[this.t-1]|=(ae&(1<<this.DB-re)-1)<<re,this[this.t++]=ae>>this.DB-re):this[this.t-1]|=ae<<re,(re+=ee)>=this.DB&&(re-=this.DB))}8==ee&&!!(128&+J[0])&&(this.s=-1,re>0&&(this[this.t-1]|=(1<<this.DB-re)-1<<re)),this.clamp(),se&&t.ZERO.subTo(this,this)},t.prototype.clamp=function(){for(var J=this.s&this.DM;this.t>0&&this[this.t-1]==J;)--this.t},t.prototype.dlShiftTo=function(J,Z){var ee;for(ee=this.t-1;ee>=0;--ee)Z[ee+J]=this[ee];for(ee=J-1;ee>=0;--ee)Z[ee]=0;Z.t=this.t+J,Z.s=this.s},t.prototype.drShiftTo=function(J,Z){for(var ee=J;ee<this.t;++ee)Z[ee-J]=this[ee];Z.t=Math.max(this.t-J,0),Z.s=this.s},t.prototype.lShiftTo=function(J,Z){for(var ee=J%this.DB,ne=this.DB-ee,se=(1<<ne)-1,re=Math.floor(J/this.DB),ae=this.s<<ee&this.DM,le=this.t-1;le>=0;--le)Z[le+re+1]=this[le]>>ne|ae,ae=(this[le]&se)<<ee;for(le=re-1;le>=0;--le)Z[le]=0;Z[re]=ae,Z.t=this.t+re+1,Z.s=this.s,Z.clamp()},t.prototype.rShiftTo=function(J,Z){Z.s=this.s;var ee=Math.floor(J/this.DB);if(ee>=this.t)Z.t=0;else{var ne=J%this.DB,se=this.DB-ne,re=(1<<ne)-1;Z[0]=this[ee]>>ne;for(var ae=ee+1;ae<this.t;++ae)Z[ae-ee-1]|=(this[ae]&re)<<se,Z[ae-ee]=this[ae]>>ne;ne>0&&(Z[this.t-ee-1]|=(this.s&re)<<se),Z.t=this.t-ee,Z.clamp()}},t.prototype.subTo=function(J,Z){for(var ee=0,ne=0,se=Math.min(J.t,this.t);ee<se;)ne+=this[ee]-J[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;if(J.t<this.t){for(ne-=J.s;ee<this.t;)ne+=this[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;ne+=this.s}else{for(ne+=this.s;ee<J.t;)ne-=J[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;ne-=J.s}Z.s=ne<0?-1:0,ne<-1?Z[ee++]=this.DV+ne:ne>0&&(Z[ee++]=ne),Z.t=ee,Z.clamp()},t.prototype.multiplyTo=function(J,Z){var ee=this.abs(),ne=J.abs(),se=ee.t;for(Z.t=se+ne.t;--se>=0;)Z[se]=0;for(se=0;se<ne.t;++se)Z[se+ee.t]=ee.am(0,ne[se],Z,se,0,ee.t);Z.s=0,Z.clamp(),this.s!=J.s&&t.ZERO.subTo(Z,Z)},t.prototype.squareTo=function(J){for(var Z=this.abs(),ee=J.t=2*Z.t;--ee>=0;)J[ee]=0;for(ee=0;ee<Z.t-1;++ee){var ne=Z.am(ee,Z[ee],J,2*ee,0,1);(J[ee+Z.t]+=Z.am(ee+1,2*Z[ee],J,2*ee+1,ne,Z.t-ee-1))>=Z.DV&&(J[ee+Z.t]-=Z.DV,J[ee+Z.t+1]=1)}J.t>0&&(J[J.t-1]+=Z.am(ee,Z[ee],J,2*ee,0,1)),J.s=0,J.clamp()},t.prototype.divRemTo=function(J,Z,ee){var ne=J.abs();if(!(ne.t<=0)){var se=this.abs();if(se.t<ne.t)return null!=Z&&Z.fromInt(0),void(null!=ee&&this.copyTo(ee));null==ee&&(ee=M());var re=M(),ae=this.s,le=J.s,pe=this.DB-K(ne[ne.t-1]);pe>0?(ne.lShiftTo(pe,re),se.lShiftTo(pe,ee)):(ne.copyTo(re),se.copyTo(ee));var _e=re.t,ve=re[_e-1];if(0!=ve){var ye=ve*(1<<this.F1)+(_e>1?re[_e-2]>>this.F2:0),Fe=this.FV/ye,qe=(1<<this.F1)/ye,$e=1<<this.F2,He=ee.t,Ye=He-_e,Je=null==Z?M():Z;for(re.dlShiftTo(Ye,Je),ee.compareTo(Je)>=0&&(ee[ee.t++]=1,ee.subTo(Je,ee)),t.ONE.dlShiftTo(_e,Je),Je.subTo(re,re);re.t<_e;)re[re.t++]=0;for(;--Ye>=0;){var Xe=ee[--He]==ve?this.DM:Math.floor(ee[He]*Fe+(ee[He-1]+$e)*qe);if((ee[He]+=re.am(0,Xe,ee,Ye,0,_e))<Xe)for(re.dlShiftTo(Ye,Je),ee.subTo(Je,ee);ee[He]<--Xe;)ee.subTo(Je,ee)}null!=Z&&(ee.drShiftTo(_e,Z),ae!=le&&t.ZERO.subTo(Z,Z)),ee.t=_e,ee.clamp(),pe>0&&ee.rShiftTo(pe,ee),ae<0&&t.ZERO.subTo(ee,ee)}}},t.prototype.invDigit=function(){if(this.t<1)return 0;var J=this[0];if(!(1&J))return 0;var Z=3&J;return(Z=(Z=(Z=(Z=Z*(2-(15&J)*Z)&15)*(2-(255&J)*Z)&255)*(2-((65535&J)*Z&65535))&65535)*(2-J*Z%this.DV)%this.DV)>0?this.DV-Z:-Z},t.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},t.prototype.exp=function(J,Z){if(J>4294967295||J<1)return t.ONE;var ee=M(),ne=M(),se=Z.convert(this),re=K(J)-1;for(se.copyTo(ee);--re>=0;)if(Z.sqrTo(ee,ne),(J&1<<re)>0)Z.mulTo(ne,se,ee);else{var ae=ee;ee=ne,ne=ae}return Z.revert(ee)},t.prototype.chunkSize=function(J){return Math.floor(Math.LN2*this.DB/Math.log(J))},t.prototype.toRadix=function(J){if(null==J&&(J=10),0==this.signum()||J<2||J>36)return"0";var Z=this.chunkSize(J),ee=Math.pow(J,Z),ne=U(ee),se=M(),re=M(),ae="";for(this.divRemTo(ne,se,re);se.signum()>0;)ae=(ee+re.intValue()).toString(J).substr(1)+ae,se.divRemTo(ne,se,re);return re.intValue().toString(J)+ae},t.prototype.fromRadix=function(J,Z){this.fromInt(0),null==Z&&(Z=10);for(var ee=this.chunkSize(Z),ne=Math.pow(Z,ee),se=!1,re=0,ae=0,le=0;le<J.length;++le){var pe=F(J,le);pe<0?"-"==J.charAt(le)&&0==this.signum()&&(se=!0):(ae=Z*ae+pe,++re>=ee&&(this.dMultiply(ne),this.dAddOffset(ae,0),re=0,ae=0))}re>0&&(this.dMultiply(Math.pow(Z,re)),this.dAddOffset(ae,0)),se&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(J,Z,ee){if("number"==typeof Z)if(J<2)this.fromInt(1);else for(this.fromNumber(J,ee),this.testBit(J-1)||this.bitwiseTo(t.ONE.shiftLeft(J-1),s,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(Z);)this.dAddOffset(2,0),this.bitLength()>J&&this.subTo(t.ONE.shiftLeft(J-1),this);else{var ne=[],se=7&J;ne.length=1+(J>>3),Z.nextBytes(ne),se>0?ne[0]&=(1<<se)-1:ne[0]=0,this.fromString(ne,256)}},t.prototype.bitwiseTo=function(J,Z,ee){var ne,se,re=Math.min(J.t,this.t);for(ne=0;ne<re;++ne)ee[ne]=Z(this[ne],J[ne]);if(J.t<this.t){for(se=J.s&this.DM,ne=re;ne<this.t;++ne)ee[ne]=Z(this[ne],se);ee.t=this.t}else{for(se=this.s&this.DM,ne=re;ne<J.t;++ne)ee[ne]=Z(se,J[ne]);ee.t=J.t}ee.s=Z(this.s,J.s),ee.clamp()},t.prototype.changeBit=function(J,Z){var ee=t.ONE.shiftLeft(J);return this.bitwiseTo(ee,Z,ee),ee},t.prototype.addTo=function(J,Z){for(var ee=0,ne=0,se=Math.min(J.t,this.t);ee<se;)ne+=this[ee]+J[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;if(J.t<this.t){for(ne+=J.s;ee<this.t;)ne+=this[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;ne+=this.s}else{for(ne+=this.s;ee<J.t;)ne+=J[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;ne+=J.s}Z.s=ne<0?-1:0,ne>0?Z[ee++]=ne:ne<-1&&(Z[ee++]=this.DV+ne),Z.t=ee,Z.clamp()},t.prototype.dMultiply=function(J){this[this.t]=this.am(0,J-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(J,Z){if(0!=J){for(;this.t<=Z;)this[this.t++]=0;for(this[Z]+=J;this[Z]>=this.DV;)this[Z]-=this.DV,++Z>=this.t&&(this[this.t++]=0),++this[Z]}},t.prototype.multiplyLowerTo=function(J,Z,ee){var ne=Math.min(this.t+J.t,Z);for(ee.s=0,ee.t=ne;ne>0;)ee[--ne]=0;for(var se=ee.t-this.t;ne<se;++ne)ee[ne+this.t]=this.am(0,J[ne],ee,ne,0,this.t);for(se=Math.min(J.t,Z);ne<se;++ne)this.am(0,J[ne],ee,ne,0,Z-ne);ee.clamp()},t.prototype.multiplyUpperTo=function(J,Z,ee){--Z;var ne=ee.t=this.t+J.t-Z;for(ee.s=0;--ne>=0;)ee[ne]=0;for(ne=Math.max(Z-this.t,0);ne<J.t;++ne)ee[this.t+ne-Z]=this.am(Z-ne,J[ne],ee,0,0,this.t+ne-Z);ee.clamp(),ee.drShiftTo(1,ee)},t.prototype.modInt=function(J){if(J<=0)return 0;var Z=this.DV%J,ee=this.s<0?J-1:0;if(this.t>0)if(0==Z)ee=this[0]%J;else for(var ne=this.t-1;ne>=0;--ne)ee=(Z*ee+this[ne])%J;return ee},t.prototype.millerRabin=function(J){var Z=this.subtract(t.ONE),ee=Z.getLowestSetBit();if(ee<=0)return!1;var ne=Z.shiftRight(ee);(J=J+1>>1)>qe.length&&(J=qe.length);for(var se=M(),re=0;re<J;++re){se.fromInt(qe[Math.floor(Math.random()*qe.length)]);var ae=se.modPow(ne,this);if(0!=ae.compareTo(t.ONE)&&0!=ae.compareTo(Z)){for(var le=1;le++<ee&&0!=ae.compareTo(Z);)if(0==(ae=ae.modPowInt(2,this)).compareTo(t.ONE))return!1;if(0!=ae.compareTo(Z))return!1}}return!0},t.prototype.square=function(){var J=M();return this.squareTo(J),J},t.prototype.gcda=function(J,Z){var ee=this.s<0?this.negate():this.clone(),ne=J.s<0?J.negate():J.clone();if(ee.compareTo(ne)<0){var se=ee;ee=ne,ne=se}var re=ee.getLowestSetBit(),ae=ne.getLowestSetBit();if(ae<0)Z(ee);else{re<ae&&(ae=re),ae>0&&(ee.rShiftTo(ae,ee),ne.rShiftTo(ae,ne));var h=function(){(re=ee.getLowestSetBit())>0&&ee.rShiftTo(re,ee),(re=ne.getLowestSetBit())>0&&ne.rShiftTo(re,ne),ee.compareTo(ne)>=0?(ee.subTo(ne,ee),ee.rShiftTo(1,ee)):(ne.subTo(ee,ne),ne.rShiftTo(1,ne)),ee.signum()>0?setTimeout(h,0):(ae>0&&ne.lShiftTo(ae,ne),setTimeout((function(){Z(ne)}),0))};setTimeout(h,10)}},t.prototype.fromNumberAsync=function(J,Z,ee,ne){if("number"==typeof Z)if(J<2)this.fromInt(1);else{this.fromNumber(J,ee),this.testBit(J-1)||this.bitwiseTo(t.ONE.shiftLeft(J-1),s,this),this.isEven()&&this.dAddOffset(1,0);var se=this,h=function(){se.dAddOffset(2,0),se.bitLength()>J&&se.subTo(t.ONE.shiftLeft(J-1),se),se.isProbablePrime(Z)?setTimeout((function(){ne()}),0):setTimeout(h,0)};setTimeout(h,0)}else{var re=[],ae=7&J;re.length=1+(J>>3),Z.nextBytes(re),ae>0?re[0]&=(1<<ae)-1:re[0]=0,this.fromString(re,256)}},t}(),Ye=function(){function t(){}return t.prototype.convert=function(J){return J},t.prototype.revert=function(J){return J},t.prototype.mulTo=function(J,Z,ee){J.multiplyTo(Z,ee)},t.prototype.sqrTo=function(J,Z){J.squareTo(Z)},t}(),Je=function(){function t(J){this.m=J}return t.prototype.convert=function(J){return J.s<0||J.compareTo(this.m)>=0?J.mod(this.m):J},t.prototype.revert=function(J){return J},t.prototype.reduce=function(J){J.divRemTo(this.m,null,J)},t.prototype.mulTo=function(J,Z,ee){J.multiplyTo(Z,ee),this.reduce(ee)},t.prototype.sqrTo=function(J,Z){J.squareTo(Z),this.reduce(Z)},t}(),Xe=function(){function t(J){this.m=J,this.mp=J.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<J.DB-15)-1,this.mt2=2*J.t}return t.prototype.convert=function(J){var Z=M();return J.abs().dlShiftTo(this.m.t,Z),Z.divRemTo(this.m,null,Z),J.s<0&&Z.compareTo(He.ZERO)>0&&this.m.subTo(Z,Z),Z},t.prototype.revert=function(J){var Z=M();return J.copyTo(Z),this.reduce(Z),Z},t.prototype.reduce=function(J){for(;J.t<=this.mt2;)J[J.t++]=0;for(var Z=0;Z<this.m.t;++Z){var ee=32767&J[Z],ne=ee*this.mpl+((ee*this.mph+(J[Z]>>15)*this.mpl&this.um)<<15)&J.DM;for(J[ee=Z+this.m.t]+=this.m.am(0,ne,J,Z,0,this.m.t);J[ee]>=J.DV;)J[ee]-=J.DV,J[++ee]++}J.clamp(),J.drShiftTo(this.m.t,J),J.compareTo(this.m)>=0&&J.subTo(this.m,J)},t.prototype.mulTo=function(J,Z,ee){J.multiplyTo(Z,ee),this.reduce(ee)},t.prototype.sqrTo=function(J,Z){J.squareTo(Z),this.reduce(Z)},t}(),Qe=function(){function t(J){this.m=J,this.r2=M(),this.q3=M(),He.ONE.dlShiftTo(2*J.t,this.r2),this.mu=this.r2.divide(J)}return t.prototype.convert=function(J){if(J.s<0||J.t>2*this.m.t)return J.mod(this.m);if(J.compareTo(this.m)<0)return J;var Z=M();return J.copyTo(Z),this.reduce(Z),Z},t.prototype.revert=function(J){return J},t.prototype.reduce=function(J){for(J.drShiftTo(this.m.t-1,this.r2),J.t>this.m.t+1&&(J.t=this.m.t+1,J.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);J.compareTo(this.r2)<0;)J.dAddOffset(1,this.m.t+1);for(J.subTo(this.r2,J);J.compareTo(this.m)>=0;)J.subTo(this.m,J)},t.prototype.mulTo=function(J,Z,ee){J.multiplyTo(Z,ee),this.reduce(ee)},t.prototype.sqrTo=function(J,Z){J.squareTo(Z),this.reduce(Z)},t}();function M(){return new He(null)}function L(J,Z){return new He(J,Z)}var tt="undefined"!=typeof navigator;tt&&"Microsoft Internet Explorer"==navigator.appName?(He.prototype.am=function(J,Z,ee,ne,se,re){for(var ae=32767&Z,le=Z>>15;--re>=0;){var pe=32767&this[J],_e=this[J++]>>15,ve=le*pe+_e*ae;se=((pe=ae*pe+((32767&ve)<<15)+ee[ne]+(1073741823&se))>>>30)+(ve>>>15)+le*_e+(se>>>30),ee[ne++]=1073741823&pe}return se},_e=30):tt&&"Netscape"!=navigator.appName?(He.prototype.am=function(J,Z,ee,ne,se,re){for(;--re>=0;){var ae=Z*this[J++]+ee[ne]+se;se=Math.floor(ae/67108864),ee[ne++]=67108863&ae}return se},_e=26):(He.prototype.am=function(J,Z,ee,ne,se,re){for(var ae=16383&Z,le=Z>>14;--re>=0;){var pe=16383&this[J],_e=this[J++]>>14,ve=le*pe+_e*ae;se=((pe=ae*pe+((16383&ve)<<14)+ee[ne]+se)>>28)+(ve>>14)+le*_e,ee[ne++]=268435455&pe}return se},_e=28),He.prototype.DB=_e,He.prototype.DM=(1<<_e)-1,He.prototype.DV=1<<_e,He.prototype.FV=Math.pow(2,52),He.prototype.F1=52-_e,He.prototype.F2=2*_e-52;var nt,it,ot=[];for(nt="0".charCodeAt(0),it=0;it<=9;++it)ot[nt++]=it;for(nt="a".charCodeAt(0),it=10;it<36;++it)ot[nt++]=it;for(nt="A".charCodeAt(0),it=10;it<36;++it)ot[nt++]=it;function F(J,Z){var ee=ot[J.charCodeAt(Z)];return null==ee?-1:ee}function U(J){var Z=M();return Z.fromInt(J),Z}function K(J){var Z,ee=1;return 0!=(Z=J>>>16)&&(J=Z,ee+=16),0!=(Z=J>>8)&&(J=Z,ee+=8),0!=(Z=J>>4)&&(J=Z,ee+=4),0!=(Z=J>>2)&&(J=Z,ee+=2),0!=(Z=J>>1)&&(J=Z,ee+=1),ee}He.ZERO=U(0),He.ONE=U(1);var pt,mt,It=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(J){var Z,ee,ne;for(Z=0;Z<256;++Z)this.S[Z]=Z;for(ee=0,Z=0;Z<256;++Z)ee=ee+this.S[Z]+J[Z%J.length]&255,ne=this.S[Z],this.S[Z]=this.S[ee],this.S[ee]=ne;this.i=0,this.j=0},t.prototype.next=function(){var J;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,J=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=J,this.S[J+this.S[this.i]&255]},t}(),St=null;if(null==St){St=[],mt=0;var Mt=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var bt=new Uint32Array(256);for(window.crypto.getRandomValues(bt),Mt=0;Mt<bt.length;++Mt)St[mt++]=255&bt[Mt]}var At=0,X=function(J){if((At=At||0)>=256||mt>=256)window.removeEventListener?window.removeEventListener("mousemove",X,!1):window.detachEvent&&window.detachEvent("onmousemove",X);else try{var Z=J.x+J.y;St[mt++]=255&Z,At+=1}catch(J){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",X,!1):window.attachEvent&&window.attachEvent("onmousemove",X))}function Q(){if(null==pt){for(pt=new It;mt<256;){var J=Math.floor(65536*Math.random());St[mt++]=255&J}for(pt.init(St),mt=0;mt<St.length;++mt)St[mt]=0;mt=0}return pt.next()}var Ot=function(){function t(){}return t.prototype.nextBytes=function(J){for(var Z=0;Z<J.length;++Z)J[Z]=Q()},t}(),wt=function(){function t(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return t.prototype.doPublic=function(J){return J.modPowInt(this.e,this.n)},t.prototype.doPrivate=function(J){if(null==this.p||null==this.q)return J.modPow(this.d,this.n);for(var Z=J.mod(this.p).modPow(this.dmp1,this.p),ee=J.mod(this.q).modPow(this.dmq1,this.q);Z.compareTo(ee)<0;)Z=Z.add(this.p);return Z.subtract(ee).multiply(this.coeff).mod(this.p).multiply(this.q).add(ee)},t.prototype.setPublic=function(J,Z){null!=J&&null!=Z&&J.length>0&&Z.length>0?(this.n=L(J,16),this.e=parseInt(Z,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(J){var Z=this.n.bitLength()+7>>3,ee=function(J,Z){if(Z<J.length+11)return console.error("Message too long for RSA"),null;for(var ee=[],ne=J.length-1;ne>=0&&Z>0;){var se=J.charCodeAt(ne--);se<128?ee[--Z]=se:se>127&&se<2048?(ee[--Z]=63&se|128,ee[--Z]=se>>6|192):(ee[--Z]=63&se|128,ee[--Z]=se>>6&63|128,ee[--Z]=se>>12|224)}ee[--Z]=0;for(var re=new Ot,ae=[];Z>2;){for(ae[0]=0;0==ae[0];)re.nextBytes(ae);ee[--Z]=ae[0]}return ee[--Z]=2,ee[--Z]=0,new He(ee)}(J,Z);if(null==ee)return null;var ne=this.doPublic(ee);if(null==ne)return null;for(var se=ne.toString(16),re=se.length,ae=0;ae<2*Z-re;ae++)se="0"+se;return se},t.prototype.setPrivate=function(J,Z,ee){null!=J&&null!=Z&&J.length>0&&Z.length>0?(this.n=L(J,16),this.e=parseInt(Z,16),this.d=L(ee,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(J,Z,ee,ne,se,re,ae,le){null!=J&&null!=Z&&J.length>0&&Z.length>0?(this.n=L(J,16),this.e=parseInt(Z,16),this.d=L(ee,16),this.p=L(ne,16),this.q=L(se,16),this.dmp1=L(re,16),this.dmq1=L(ae,16),this.coeff=L(le,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(J,Z){var ee=new Ot,ne=J>>1;this.e=parseInt(Z,16);for(var se=new He(Z,16);;){for(;this.p=new He(J-ne,1,ee),0!=this.p.subtract(He.ONE).gcd(se).compareTo(He.ONE)||!this.p.isProbablePrime(10););for(;this.q=new He(ne,1,ee),0!=this.q.subtract(He.ONE).gcd(se).compareTo(He.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var re=this.p;this.p=this.q,this.q=re}var ae=this.p.subtract(He.ONE),le=this.q.subtract(He.ONE),pe=ae.multiply(le);if(0==pe.gcd(se).compareTo(He.ONE)){this.n=this.p.multiply(this.q),this.d=se.modInverse(pe),this.dmp1=this.d.mod(ae),this.dmq1=this.d.mod(le),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(J){var Z=L(J,16),ee=this.doPrivate(Z);return null==ee?null:function(J,Z){for(var ee=J.toByteArray(),ne=0;ne<ee.length&&0==ee[ne];)++ne;if(ee.length-ne!=Z-1||2!=ee[ne])return null;for(++ne;0!=ee[ne];)if(++ne>=ee.length)return null;for(var se="";++ne<ee.length;){var re=255&ee[ne];re<128?se+=String.fromCharCode(re):re>191&&re<224?(se+=String.fromCharCode((31&re)<<6|63&ee[ne+1]),++ne):(se+=String.fromCharCode((15&re)<<12|(63&ee[ne+1])<<6|63&ee[ne+2]),ne+=2)}return se}(ee,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(J,Z,ee){var ne=new Ot,se=J>>1;this.e=parseInt(Z,16);var re=new He(Z,16),ae=this,h=function(){var e=function(){if(ae.p.compareTo(ae.q)<=0){var J=ae.p;ae.p=ae.q,ae.q=J}var Z=ae.p.subtract(He.ONE),ne=ae.q.subtract(He.ONE),se=Z.multiply(ne);0==se.gcd(re).compareTo(He.ONE)?(ae.n=ae.p.multiply(ae.q),ae.d=re.modInverse(se),ae.dmp1=ae.d.mod(Z),ae.dmq1=ae.d.mod(ne),ae.coeff=ae.q.modInverse(ae.p),setTimeout((function(){ee()}),0)):setTimeout(h,0)},a=function(){ae.q=M(),ae.q.fromNumberAsync(se,1,ne,(function(){ae.q.subtract(He.ONE).gcda(re,(function(J){0==J.compareTo(He.ONE)&&ae.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(a,0)}))}))},u=function(){ae.p=M(),ae.p.fromNumberAsync(J-se,1,ne,(function(){ae.p.subtract(He.ONE).gcda(re,(function(J){0==J.compareTo(He.ONE)&&ae.p.isProbablePrime(10)?setTimeout(a,0):setTimeout(u,0)}))}))};setTimeout(u,0)};setTimeout(h,0)},t.prototype.sign=function(J,Z,ee){var ne=function(J,Z){if(Z<J.length+22)return console.error("Message too long for RSA"),null;for(var ee=Z-J.length-6,ne="",se=0;se<ee;se+=2)ne+="ff";return L("0001"+ne+"00"+J,16)}((Dt[ee]||"")+Z(J).toString(),this.n.bitLength()/4);if(null==ne)return null;var se=this.doPrivate(ne);if(null==se)return null;var re=se.toString(16);return 1&re.length?"0"+re:re},t.prototype.verify=function(J,Z,ee){var ne=L(Z,16),se=this.doPublic(ne);return null==se?null:function(J){for(var Z in Dt)if(Dt.hasOwnProperty(Z)){var ee=Dt[Z],ne=ee.length;if(J.substr(0,ne)==ee)return J.substr(ne)}return J}(se.toString(16).replace(/^1f+00/,""))==ee(J).toString()},t}(),Dt={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"},Lt={};Lt.lang={extend:function(J,Z,ee){if(!Z||!J)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var r=function(){};if(r.prototype=Z.prototype,J.prototype=new r,J.prototype.constructor=J,J.superclass=Z.prototype,Z.prototype.constructor==Object.prototype.constructor&&(Z.prototype.constructor=Z),ee){var ne;for(ne in ee)J.prototype[ne]=ee[ne];var s=function(){},se=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(s=function(J,Z){for(ne=0;ne<se.length;ne+=1){var ee=se[ne],re=Z[ee];"function"==typeof re&&re!=Object.prototype[ee]&&(J[ee]=re)}})}catch(J){}s(J.prototype,ee)}}};var kt={};void 0!==kt.asn1&&kt.asn1||(kt.asn1={}),kt.asn1.ASN1Util=new function(){this.integerToByteHex=function(J){var Z=J.toString(16);return Z.length%2==1&&(Z="0"+Z),Z},this.bigIntToMinTwosComplementsHex=function(J){var Z=J.toString(16);if("-"!=Z.substr(0,1))Z.length%2==1?Z="0"+Z:Z.match(/^[0-7]/)||(Z="00"+Z);else{var ee=Z.substr(1).length;ee%2==1?ee+=1:Z.match(/^[0-7]/)||(ee+=2);for(var ne="",se=0;se<ee;se++)ne+="f";Z=new He(ne,16).xor(J).add(He.ONE).toString(16).replace(/^-/,"")}return Z},this.getPEMStringFromHex=function(J,Z){return hextopem(J,Z)},this.newObject=function(J){var Z=kt.asn1,ee=Z.DERBoolean,ne=Z.DERInteger,se=Z.DERBitString,re=Z.DEROctetString,ae=Z.DERNull,le=Z.DERObjectIdentifier,pe=Z.DEREnumerated,_e=Z.DERUTF8String,ve=Z.DERNumericString,ye=Z.DERPrintableString,Fe=Z.DERTeletexString,qe=Z.DERIA5String,$e=Z.DERUTCTime,He=Z.DERGeneralizedTime,Ye=Z.DERSequence,Je=Z.DERSet,Xe=Z.DERTaggedObject,Qe=Z.ASN1Util.newObject,tt=Object.keys(J);if(1!=tt.length)throw"key of param shall be only one.";var nt=tt[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+nt+":"))throw"undefined key: "+nt;if("bool"==nt)return new ee(J[nt]);if("int"==nt)return new ne(J[nt]);if("bitstr"==nt)return new se(J[nt]);if("octstr"==nt)return new re(J[nt]);if("null"==nt)return new ae(J[nt]);if("oid"==nt)return new le(J[nt]);if("enum"==nt)return new pe(J[nt]);if("utf8str"==nt)return new _e(J[nt]);if("numstr"==nt)return new ve(J[nt]);if("prnstr"==nt)return new ye(J[nt]);if("telstr"==nt)return new Fe(J[nt]);if("ia5str"==nt)return new qe(J[nt]);if("utctime"==nt)return new $e(J[nt]);if("gentime"==nt)return new He(J[nt]);if("seq"==nt){for(var it=J[nt],ot=[],pt=0;pt<it.length;pt++){var mt=Qe(it[pt]);ot.push(mt)}return new Ye({array:ot})}if("set"==nt){for(it=J[nt],ot=[],pt=0;pt<it.length;pt++)mt=Qe(it[pt]),ot.push(mt);return new Je({array:ot})}if("tag"==nt){var It=J[nt];if("[object Array]"===Object.prototype.toString.call(It)&&3==It.length){var St=Qe(It[2]);return new Xe({tag:It[0],explicit:It[1],obj:St})}var Mt={};if(void 0!==It.explicit&&(Mt.explicit=It.explicit),void 0!==It.tag&&(Mt.tag=It.tag),void 0===It.obj)throw"obj shall be specified for 'tag'.";return Mt.obj=Qe(It.obj),new Xe(Mt)}},this.jsonToASN1HEX=function(J){return this.newObject(J).getEncodedHex()}},kt.asn1.ASN1Util.oidHexToInt=function(J){for(var Z="",ee=parseInt(J.substr(0,2),16),ne=(Z=Math.floor(ee/40)+"."+ee%40,""),se=2;se<J.length;se+=2){var re=("00000000"+parseInt(J.substr(se,2),16).toString(2)).slice(-8);ne+=re.substr(1,7),"0"==re.substr(0,1)&&(Z=Z+"."+new He(ne,2).toString(10),ne="")}return Z},kt.asn1.ASN1Util.oidIntToHex=function(J){var e=function(J){var Z=J.toString(16);return 1==Z.length&&(Z="0"+Z),Z},i=function(J){var Z="",ee=new He(J,10).toString(2),ne=7-ee.length%7;7==ne&&(ne=0);for(var se="",re=0;re<ne;re++)se+="0";for(ee=se+ee,re=0;re<ee.length-1;re+=7){var ae=ee.substr(re,7);re!=ee.length-7&&(ae="1"+ae),Z+=e(parseInt(ae,2))}return Z};if(!J.match(/^[0-9.]+$/))throw"malformed oid string: "+J;var Z="",ee=J.split("."),ne=40*parseInt(ee[0])+parseInt(ee[1]);Z+=e(ne),ee.splice(0,2);for(var se=0;se<ee.length;se++)Z+=i(ee[se]);return Z},kt.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n=0,v="+this.hV;var J=this.hV.length/2,Z=J.toString(16);if(Z.length%2==1&&(Z="0"+Z),J<128)return Z;var ee=Z.length/2;if(ee>15)throw"ASN.1 length too long to represent by 8x: n = "+J.toString(16);return(128+ee).toString(16)+Z},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},kt.asn1.DERAbstractString=function(J){kt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(J){this.hTLV=null,this.isModified=!0,this.s=J,this.hV=stohex(this.s)},this.setStringHex=function(J){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=J},this.getFreshValueHex=function(){return this.hV},void 0!==J&&("string"==typeof J?this.setString(J):void 0!==J.str?this.setString(J.str):void 0!==J.hex&&this.setStringHex(J.hex))},Lt.lang.extend(kt.asn1.DERAbstractString,kt.asn1.ASN1Object),kt.asn1.DERAbstractTime=function(J){kt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(J){return utc=J.getTime()+6e4*J.getTimezoneOffset(),new Date(utc)},this.formatDate=function(J,Z,ee){var ne=this.zeroPadding,se=this.localDateToUTC(J),re=String(se.getFullYear());"utc"==Z&&(re=re.substr(2,2));var ae=re+ne(String(se.getMonth()+1),2)+ne(String(se.getDate()),2)+ne(String(se.getHours()),2)+ne(String(se.getMinutes()),2)+ne(String(se.getSeconds()),2);if(!0===ee){var le=se.getMilliseconds();if(0!=le){var pe=ne(String(le),3);ae=ae+"."+(pe=pe.replace(/[0]+$/,""))}}return ae+"Z"},this.zeroPadding=function(J,Z){return J.length>=Z?J:new Array(Z-J.length+1).join("0")+J},this.getString=function(){return this.s},this.setString=function(J){this.hTLV=null,this.isModified=!0,this.s=J,this.hV=stohex(J)},this.setByDateValue=function(J,Z,ee,ne,se,re){var ae=new Date(Date.UTC(J,Z-1,ee,ne,se,re,0));this.setByDate(ae)},this.getFreshValueHex=function(){return this.hV}},Lt.lang.extend(kt.asn1.DERAbstractTime,kt.asn1.ASN1Object),kt.asn1.DERAbstractStructured=function(J){kt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(J){this.hTLV=null,this.isModified=!0,this.asn1Array=J},this.appendASN1Object=function(J){this.hTLV=null,this.isModified=!0,this.asn1Array.push(J)},this.asn1Array=new Array,void 0!==J&&void 0!==J.array&&(this.asn1Array=J.array)},Lt.lang.extend(kt.asn1.DERAbstractStructured,kt.asn1.ASN1Object),kt.asn1.DERBoolean=function(){kt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},Lt.lang.extend(kt.asn1.DERBoolean,kt.asn1.ASN1Object),kt.asn1.DERInteger=function(J){kt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(J){this.hTLV=null,this.isModified=!0,this.hV=kt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(J)},this.setByInteger=function(J){var Z=new He(String(J),10);this.setByBigInteger(Z)},this.setValueHex=function(J){this.hV=J},this.getFreshValueHex=function(){return this.hV},void 0!==J&&(void 0!==J.bigint?this.setByBigInteger(J.bigint):void 0!==J.int?this.setByInteger(J.int):"number"==typeof J?this.setByInteger(J):void 0!==J.hex&&this.setValueHex(J.hex))},Lt.lang.extend(kt.asn1.DERInteger,kt.asn1.ASN1Object),kt.asn1.DERBitString=function(J){if(void 0!==J&&void 0!==J.obj){var Z=kt.asn1.ASN1Util.newObject(J.obj);J.hex="00"+Z.getEncodedHex()}kt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(J){this.hTLV=null,this.isModified=!0,this.hV=J},this.setUnusedBitsAndHexValue=function(J,Z){if(J<0||7<J)throw"unused bits shall be from 0 to 7: u = "+J;var ee="0"+J;this.hTLV=null,this.isModified=!0,this.hV=ee+Z},this.setByBinaryString=function(J){var Z=8-(J=J.replace(/0+$/,"")).length%8;8==Z&&(Z=0);for(var ee=0;ee<=Z;ee++)J+="0";var ne="";for(ee=0;ee<J.length-1;ee+=8){var se=J.substr(ee,8),re=parseInt(se,2).toString(16);1==re.length&&(re="0"+re),ne+=re}this.hTLV=null,this.isModified=!0,this.hV="0"+Z+ne},this.setByBooleanArray=function(J){for(var Z="",ee=0;ee<J.length;ee++)1==J[ee]?Z+="1":Z+="0";this.setByBinaryString(Z)},this.newFalseArray=function(J){for(var Z=new Array(J),ee=0;ee<J;ee++)Z[ee]=!1;return Z},this.getFreshValueHex=function(){return this.hV},void 0!==J&&("string"==typeof J&&J.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(J):void 0!==J.hex?this.setHexValueIncludingUnusedBits(J.hex):void 0!==J.bin?this.setByBinaryString(J.bin):void 0!==J.array&&this.setByBooleanArray(J.array))},Lt.lang.extend(kt.asn1.DERBitString,kt.asn1.ASN1Object),kt.asn1.DEROctetString=function(J){if(void 0!==J&&void 0!==J.obj){var Z=kt.asn1.ASN1Util.newObject(J.obj);J.hex=Z.getEncodedHex()}kt.asn1.DEROctetString.superclass.constructor.call(this,J),this.hT="04"},Lt.lang.extend(kt.asn1.DEROctetString,kt.asn1.DERAbstractString),kt.asn1.DERNull=function(){kt.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Lt.lang.extend(kt.asn1.DERNull,kt.asn1.ASN1Object),kt.asn1.DERObjectIdentifier=function(J){var e=function(J){var Z=J.toString(16);return 1==Z.length&&(Z="0"+Z),Z},i=function(J){var Z="",ee=new He(J,10).toString(2),ne=7-ee.length%7;7==ne&&(ne=0);for(var se="",re=0;re<ne;re++)se+="0";for(ee=se+ee,re=0;re<ee.length-1;re+=7){var ae=ee.substr(re,7);re!=ee.length-7&&(ae="1"+ae),Z+=e(parseInt(ae,2))}return Z};kt.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(J){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=J},this.setValueOidString=function(J){if(!J.match(/^[0-9.]+$/))throw"malformed oid string: "+J;var Z="",ee=J.split("."),ne=40*parseInt(ee[0])+parseInt(ee[1]);Z+=e(ne),ee.splice(0,2);for(var se=0;se<ee.length;se++)Z+=i(ee[se]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=Z},this.setValueName=function(J){var Z=kt.asn1.x509.OID.name2oid(J);if(""===Z)throw"DERObjectIdentifier oidName undefined: "+J;this.setValueOidString(Z)},this.getFreshValueHex=function(){return this.hV},void 0!==J&&("string"==typeof J?J.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(J):this.setValueName(J):void 0!==J.oid?this.setValueOidString(J.oid):void 0!==J.hex?this.setValueHex(J.hex):void 0!==J.name&&this.setValueName(J.name))},Lt.lang.extend(kt.asn1.DERObjectIdentifier,kt.asn1.ASN1Object),kt.asn1.DEREnumerated=function(J){kt.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(J){this.hTLV=null,this.isModified=!0,this.hV=kt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(J)},this.setByInteger=function(J){var Z=new He(String(J),10);this.setByBigInteger(Z)},this.setValueHex=function(J){this.hV=J},this.getFreshValueHex=function(){return this.hV},void 0!==J&&(void 0!==J.int?this.setByInteger(J.int):"number"==typeof J?this.setByInteger(J):void 0!==J.hex&&this.setValueHex(J.hex))},Lt.lang.extend(kt.asn1.DEREnumerated,kt.asn1.ASN1Object),kt.asn1.DERUTF8String=function(J){kt.asn1.DERUTF8String.superclass.constructor.call(this,J),this.hT="0c"},Lt.lang.extend(kt.asn1.DERUTF8String,kt.asn1.DERAbstractString),kt.asn1.DERNumericString=function(J){kt.asn1.DERNumericString.superclass.constructor.call(this,J),this.hT="12"},Lt.lang.extend(kt.asn1.DERNumericString,kt.asn1.DERAbstractString),kt.asn1.DERPrintableString=function(J){kt.asn1.DERPrintableString.superclass.constructor.call(this,J),this.hT="13"},Lt.lang.extend(kt.asn1.DERPrintableString,kt.asn1.DERAbstractString),kt.asn1.DERTeletexString=function(J){kt.asn1.DERTeletexString.superclass.constructor.call(this,J),this.hT="14"},Lt.lang.extend(kt.asn1.DERTeletexString,kt.asn1.DERAbstractString),kt.asn1.DERIA5String=function(J){kt.asn1.DERIA5String.superclass.constructor.call(this,J),this.hT="16"},Lt.lang.extend(kt.asn1.DERIA5String,kt.asn1.DERAbstractString),kt.asn1.DERUTCTime=function(J){kt.asn1.DERUTCTime.superclass.constructor.call(this,J),this.hT="17",this.setByDate=function(J){this.hTLV=null,this.isModified=!0,this.date=J,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==J&&(void 0!==J.str?this.setString(J.str):"string"==typeof J&&J.match(/^[0-9]{12}Z$/)?this.setString(J):void 0!==J.hex?this.setStringHex(J.hex):void 0!==J.date&&this.setByDate(J.date))},Lt.lang.extend(kt.asn1.DERUTCTime,kt.asn1.DERAbstractTime),kt.asn1.DERGeneralizedTime=function(J){kt.asn1.DERGeneralizedTime.superclass.constructor.call(this,J),this.hT="18",this.withMillis=!1,this.setByDate=function(J){this.hTLV=null,this.isModified=!0,this.date=J,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==J&&(void 0!==J.str?this.setString(J.str):"string"==typeof J&&J.match(/^[0-9]{14}Z$/)?this.setString(J):void 0!==J.hex?this.setStringHex(J.hex):void 0!==J.date&&this.setByDate(J.date),!0===J.millis&&(this.withMillis=!0))},Lt.lang.extend(kt.asn1.DERGeneralizedTime,kt.asn1.DERAbstractTime),kt.asn1.DERSequence=function(J){kt.asn1.DERSequence.superclass.constructor.call(this,J),this.hT="30",this.getFreshValueHex=function(){for(var J="",Z=0;Z<this.asn1Array.length;Z++)J+=this.asn1Array[Z].getEncodedHex();return this.hV=J,this.hV}},Lt.lang.extend(kt.asn1.DERSequence,kt.asn1.DERAbstractStructured),kt.asn1.DERSet=function(J){kt.asn1.DERSet.superclass.constructor.call(this,J),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var J=new Array,Z=0;Z<this.asn1Array.length;Z++){var ee=this.asn1Array[Z];J.push(ee.getEncodedHex())}return 1==this.sortFlag&&J.sort(),this.hV=J.join(""),this.hV},void 0!==J&&void 0!==J.sortflag&&0==J.sortflag&&(this.sortFlag=!1)},Lt.lang.extend(kt.asn1.DERSet,kt.asn1.DERAbstractStructured),kt.asn1.DERTaggedObject=function(J){kt.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(J,Z,ee){this.hT=Z,this.isExplicit=J,this.asn1Object=ee,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=ee.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,Z),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==J&&(void 0!==J.tag&&(this.hT=J.tag),void 0!==J.explicit&&(this.isExplicit=J.explicit),void 0!==J.obj&&(this.asn1Object=J.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},Lt.lang.extend(kt.asn1.DERTaggedObject,kt.asn1.ASN1Object);var Ut,Gt,xt=(Ut=function(J,Z){return Ut=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(J,Z){J.__proto__=Z}||function(J,Z){for(var ee in Z)Object.prototype.hasOwnProperty.call(Z,ee)&&(J[ee]=Z[ee])},Ut(J,Z)},function(J,Z){if("function"!=typeof Z&&null!==Z)throw new TypeError("Class extends value "+String(Z)+" is not a constructor or null");function i(){this.constructor=J}Ut(J,Z),J.prototype=null===Z?Object.create(Z):(i.prototype=Z.prototype,new i)}),Ft=function(Z){function e(J){var ee=Z.call(this)||this;return J&&("string"==typeof J?ee.parseKey(J):(e.hasPrivateKeyProperty(J)||e.hasPublicKeyProperty(J))&&ee.parsePropertiesFrom(J)),ee}return xt(e,Z),e.prototype.parseKey=function(Z){try{var ee=0,ne=0,re=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(Z)?function(Z){var ee;if(void 0===J){var ne="0123456789ABCDEF",se=" \f\n\r\t \u2028\u2029";for(J={},ee=0;ee<16;++ee)J[ne.charAt(ee)]=ee;for(ne=ne.toLowerCase(),ee=10;ee<16;++ee)J[ne.charAt(ee)]=ee;for(ee=0;ee<8;++ee)J[se.charAt(ee)]=-1}var re=[],ae=0,le=0;for(ee=0;ee<Z.length;++ee){var pe=Z.charAt(ee);if("="==pe)break;if(-1!=(pe=J[pe])){if(void 0===pe)throw new Error("Illegal character at offset "+ee);ae|=pe,++le>=2?(re[re.length]=ae,ae=0,le=0):ae<<=4}}if(le)throw new Error("Hex encoding incomplete: 4 bits missing");return re}(Z):se.unarmor(Z),ae=ye.decode(re);if(3===ae.sub.length&&(ae=ae.sub[2].sub[0]),9===ae.sub.length){ee=ae.sub[1].getHexStringValue(),this.n=L(ee,16),ne=ae.sub[2].getHexStringValue(),this.e=parseInt(ne,16);var le=ae.sub[3].getHexStringValue();this.d=L(le,16);var pe=ae.sub[4].getHexStringValue();this.p=L(pe,16);var _e=ae.sub[5].getHexStringValue();this.q=L(_e,16);var ve=ae.sub[6].getHexStringValue();this.dmp1=L(ve,16);var Fe=ae.sub[7].getHexStringValue();this.dmq1=L(Fe,16);var qe=ae.sub[8].getHexStringValue();this.coeff=L(qe,16)}else{if(2!==ae.sub.length)return!1;if(ae.sub[0].sub){var $e=ae.sub[1].sub[0];ee=$e.sub[0].getHexStringValue(),this.n=L(ee,16),ne=$e.sub[1].getHexStringValue(),this.e=parseInt(ne,16)}else ee=ae.sub[0].getHexStringValue(),this.n=L(ee,16),ne=ae.sub[1].getHexStringValue(),this.e=parseInt(ne,16)}return!0}catch(Z){return!1}},e.prototype.getPrivateBaseKey=function(){var J={array:[new kt.asn1.DERInteger({int:0}),new kt.asn1.DERInteger({bigint:this.n}),new kt.asn1.DERInteger({int:this.e}),new kt.asn1.DERInteger({bigint:this.d}),new kt.asn1.DERInteger({bigint:this.p}),new kt.asn1.DERInteger({bigint:this.q}),new kt.asn1.DERInteger({bigint:this.dmp1}),new kt.asn1.DERInteger({bigint:this.dmq1}),new kt.asn1.DERInteger({bigint:this.coeff})]};return new kt.asn1.DERSequence(J).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return p(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var J=new kt.asn1.DERSequence({array:[new kt.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new kt.asn1.DERNull]}),Z=new kt.asn1.DERSequence({array:[new kt.asn1.DERInteger({bigint:this.n}),new kt.asn1.DERInteger({int:this.e})]}),ee=new kt.asn1.DERBitString({hex:"00"+Z.getEncodedHex()});return new kt.asn1.DERSequence({array:[J,ee]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return p(this.getPublicBaseKey())},e.wordwrap=function(J,Z){if(!J)return J;var ee="(.{1,"+(Z=Z||64)+"})( +|$\n?)|(.{1,"+Z+"})";return J.match(RegExp(ee,"g")).join("\n")},e.prototype.getPrivateKey=function(){var J="-----BEGIN RSA PRIVATE KEY-----\n";return(J+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var J="-----BEGIN PUBLIC KEY-----\n";return(J+=e.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(J){return(J=J||{}).hasOwnProperty("n")&&J.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(J){return(J=J||{}).hasOwnProperty("n")&&J.hasOwnProperty("e")&&J.hasOwnProperty("d")&&J.hasOwnProperty("p")&&J.hasOwnProperty("q")&&J.hasOwnProperty("dmp1")&&J.hasOwnProperty("dmq1")&&J.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(J){this.n=J.n,this.e=J.e,J.hasOwnProperty("d")&&(this.d=J.d,this.p=J.p,this.q=J.q,this.dmp1=J.dmp1,this.dmq1=J.dmq1,this.coeff=J.coeff)},e}(wt),$t=i(155),jt=void 0!==$t?null===(Gt=$t.env)||void 0===Gt?void 0:"3.3.2":void 0;const Wt=function(){function t(J){void 0===J&&(J={}),J=J||{},this.default_key_size=J.default_key_size?parseInt(J.default_key_size,10):1024,this.default_public_exponent=J.default_public_exponent||"010001",this.log=J.log||!1,this.key=null}return t.prototype.setKey=function(J){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Ft(J)},t.prototype.setPrivateKey=function(J){this.setKey(J)},t.prototype.setPublicKey=function(J){this.setKey(J)},t.prototype.decrypt=function(J){try{return this.getKey().decrypt(g(J))}catch(J){return!1}},t.prototype.encrypt=function(J){try{return p(this.getKey().encrypt(J))}catch(J){return!1}},t.prototype.sign=function(J,Z,ee){try{return p(this.getKey().sign(J,Z,ee))}catch(J){return!1}},t.prototype.verify=function(J,Z,ee){try{return this.getKey().verify(J,g(Z),ee)}catch(J){return!1}},t.prototype.getKey=function(J){if(!this.key){if(this.key=new Ft,J&&"[object Function]"==={}.toString.call(J))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,J);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},t.version=jt,t}()})(),ee.default})(),J.exports=Z()},90:function(J,Z){!function(J){"use strict";var t=(J,Z,ee,ne)=>{let se=65535&J,re=J>>>16&65535,ae=0;for(;0!==ee;){ae=ee>2e3?2e3:ee,ee-=ae;do{se=se+Z[ne++]|0,re=re+se|0}while(--ae);se%=65521,re%=65521}return se|re<<16};const Z=new Uint32Array((()=>{let J,Z=[];for(var ee=0;ee<256;ee++){J=ee;for(var ne=0;ne<8;ne++)J=1&J?3988292384^J>>>1:J>>>1;Z[ee]=J}return Z})());var n=(J,ee,ne,se)=>{const re=Z,ae=se+ne;J^=-1;for(let Z=se;Z<ae;Z++)J=J>>>8^re[255&(J^ee[Z])];return~J};const ee=16209;var r=function(J,Z){let ne,se,re,ae,le,pe,_e,ve,ye,Fe,qe,$e,He,Ye,Je,Xe,Qe,tt,nt,it,ot,pt,mt,It;const St=J.state;ne=J.next_in,mt=J.input,se=ne+(J.avail_in-5),re=J.next_out,It=J.output,ae=re-(Z-J.avail_out),le=re+(J.avail_out-257),pe=St.dmax,_e=St.wsize,ve=St.whave,ye=St.wnext,Fe=St.window,qe=St.hold,$e=St.bits,He=St.lencode,Ye=St.distcode,Je=(1<<St.lenbits)-1,Xe=(1<<St.distbits)-1;e:do{$e<15&&(qe+=mt[ne++]<<$e,$e+=8,qe+=mt[ne++]<<$e,$e+=8),Qe=He[qe&Je];t:for(;;){if(tt=Qe>>>24,qe>>>=tt,$e-=tt,tt=Qe>>>16&255,0===tt)It[re++]=65535&Qe;else{if(!(16&tt)){if(!(64&tt)){Qe=He[(65535&Qe)+(qe&(1<<tt)-1)];continue t}if(32&tt){St.mode=16191;break e}J.msg="invalid literal/length code",St.mode=ee;break e}nt=65535&Qe,tt&=15,tt&&($e<tt&&(qe+=mt[ne++]<<$e,$e+=8),nt+=qe&(1<<tt)-1,qe>>>=tt,$e-=tt),$e<15&&(qe+=mt[ne++]<<$e,$e+=8,qe+=mt[ne++]<<$e,$e+=8),Qe=Ye[qe&Xe];n:for(;;){if(tt=Qe>>>24,qe>>>=tt,$e-=tt,tt=Qe>>>16&255,!(16&tt)){if(!(64&tt)){Qe=Ye[(65535&Qe)+(qe&(1<<tt)-1)];continue n}J.msg="invalid distance code",St.mode=ee;break e}if(it=65535&Qe,tt&=15,$e<tt&&(qe+=mt[ne++]<<$e,$e+=8,$e<tt&&(qe+=mt[ne++]<<$e,$e+=8)),it+=qe&(1<<tt)-1,it>pe){J.msg="invalid distance too far back",St.mode=ee;break e}if(qe>>>=tt,$e-=tt,tt=re-ae,it>tt){if(tt=it-tt,tt>ve&&St.sane){J.msg="invalid distance too far back",St.mode=ee;break e}if(ot=0,pt=Fe,0===ye){if(ot+=_e-tt,tt<nt){nt-=tt;do{It[re++]=Fe[ot++]}while(--tt);ot=re-it,pt=It}}else if(ye<tt){if(ot+=_e+ye-tt,tt-=ye,tt<nt){nt-=tt;do{It[re++]=Fe[ot++]}while(--tt);if(ot=0,ye<nt){tt=ye,nt-=tt;do{It[re++]=Fe[ot++]}while(--tt);ot=re-it,pt=It}}}else if(ot+=ye-tt,tt<nt){nt-=tt;do{It[re++]=Fe[ot++]}while(--tt);ot=re-it,pt=It}for(;nt>2;)It[re++]=pt[ot++],It[re++]=pt[ot++],It[re++]=pt[ot++],nt-=3;nt&&(It[re++]=pt[ot++],nt>1&&(It[re++]=pt[ot++]))}else{ot=re-it;do{It[re++]=It[ot++],It[re++]=It[ot++],It[re++]=It[ot++],nt-=3}while(nt>2);nt&&(It[re++]=It[ot++],nt>1&&(It[re++]=It[ot++]))}break}}break}}while(ne<se&&re<le);nt=$e>>3,ne-=nt,$e-=nt<<3,qe&=(1<<$e)-1,J.next_in=ne,J.next_out=re,J.avail_in=ne<se?se-ne+5:5-(ne-se),J.avail_out=re<le?le-re+257:257-(re-le),St.hold=qe,St.bits=$e};const ne=15,se=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),re=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ae=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),le=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var c=(J,Z,ee,pe,_e,ve,ye,Fe)=>{const qe=Fe.bits;let $e,He,Ye,Je,Xe,Qe,tt=0,nt=0,it=0,ot=0,pt=0,mt=0,It=0,St=0,Mt=0,bt=0,At=null;const Ot=new Uint16Array(16),wt=new Uint16Array(16);let Dt,Lt,kt,Ut=null;for(tt=0;tt<=ne;tt++)Ot[tt]=0;for(nt=0;nt<pe;nt++)Ot[Z[ee+nt]]++;for(pt=qe,ot=ne;ot>=1&&0===Ot[ot];ot--);if(pt>ot&&(pt=ot),0===ot)return _e[ve++]=20971520,_e[ve++]=20971520,Fe.bits=1,0;for(it=1;it<ot&&0===Ot[it];it++);for(pt<it&&(pt=it),St=1,tt=1;tt<=ne;tt++)if(St<<=1,St-=Ot[tt],St<0)return-1;if(St>0&&(0===J||1!==ot))return-1;for(wt[1]=0,tt=1;tt<ne;tt++)wt[tt+1]=wt[tt]+Ot[tt];for(nt=0;nt<pe;nt++)0!==Z[ee+nt]&&(ye[wt[Z[ee+nt]]++]=nt);if(0===J?(At=Ut=ye,Qe=20):1===J?(At=se,Ut=re,Qe=257):(At=ae,Ut=le,Qe=0),bt=0,nt=0,tt=it,Xe=ve,mt=pt,It=0,Ye=-1,Mt=1<<pt,Je=Mt-1,1===J&&Mt>852||2===J&&Mt>592)return 1;for(;;){Dt=tt-It,ye[nt]+1<Qe?(Lt=0,kt=ye[nt]):ye[nt]>=Qe?(Lt=Ut[ye[nt]-Qe],kt=At[ye[nt]-Qe]):(Lt=96,kt=0),$e=1<<tt-It,He=1<<mt,it=He;do{He-=$e,_e[Xe+(bt>>It)+He]=Dt<<24|Lt<<16|kt}while(0!==He);for($e=1<<tt-1;bt&$e;)$e>>=1;if(0!==$e?(bt&=$e-1,bt+=$e):bt=0,nt++,0==--Ot[tt]){if(tt===ot)break;tt=Z[ee+ye[nt]]}if(tt>pt&&(bt&Je)!==Ye){for(0===It&&(It=pt),Xe+=it,mt=tt-It,St=1<<mt;mt+It<ot&&(St-=Ot[mt+It],!(St<=0));)mt++,St<<=1;if(Mt+=1<<mt,1===J&&Mt>852||2===J&&Mt>592)return 1;Ye=bt&Je,_e[Ye]=pt<<24|mt<<16|Xe-ve}}return 0!==bt&&(_e[Xe+bt]=tt-It<<24|64<<16),Fe.bits=pt,0},pe={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{Z_FINISH:_e,Z_BLOCK:ve,Z_TREES:ye,Z_OK:Fe,Z_STREAM_END:qe,Z_NEED_DICT:$e,Z_STREAM_ERROR:He,Z_DATA_ERROR:Ye,Z_MEM_ERROR:Je,Z_BUF_ERROR:Xe,Z_DEFLATED:Qe}=pe,tt=16180,nt=16190,it=16191,ot=16192,pt=16194,mt=16199,It=16200,St=16206,Mt=16209,I=J=>(J>>>24&255)+(J>>>8&65280)+((65280&J)<<8)+((255&J)<<24);function B(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const N=J=>{if(!J)return 1;const Z=J.state;return!Z||Z.strm!==J||Z.mode<tt||Z.mode>16211?1:0},C=J=>{if(N(J))return He;const Z=J.state;return J.total_in=J.total_out=Z.total=0,J.msg="",Z.wrap&&(J.adler=1&Z.wrap),Z.mode=tt,Z.last=0,Z.havedict=0,Z.flags=-1,Z.dmax=32768,Z.head=null,Z.hold=0,Z.bits=0,Z.lencode=Z.lendyn=new Int32Array(852),Z.distcode=Z.distdyn=new Int32Array(592),Z.sane=1,Z.back=-1,Fe},z=J=>{if(N(J))return He;const Z=J.state;return Z.wsize=0,Z.whave=0,Z.wnext=0,C(J)},F=(J,Z)=>{let ee;if(N(J))return He;const ne=J.state;return Z<0?(ee=0,Z=-Z):(ee=5+(Z>>4),Z<48&&(Z&=15)),Z&&(Z<8||Z>15)?He:(null!==ne.window&&ne.wbits!==Z&&(ne.window=null),ne.wrap=ee,ne.wbits=Z,z(J))},L=(J,Z)=>{if(!J)return He;const ee=new B;J.state=ee,ee.strm=J,ee.window=null,ee.mode=tt;const ne=F(J,Z);return ne!==Fe&&(J.state=null),ne};let bt,At,Ot=!0;const K=J=>{if(Ot){bt=new Int32Array(512),At=new Int32Array(32);let Z=0;for(;Z<144;)J.lens[Z++]=8;for(;Z<256;)J.lens[Z++]=9;for(;Z<280;)J.lens[Z++]=7;for(;Z<288;)J.lens[Z++]=8;for(c(1,J.lens,0,288,bt,0,J.work,{bits:9}),Z=0;Z<32;)J.lens[Z++]=5;c(2,J.lens,0,32,At,0,J.work,{bits:5}),Ot=!1}J.lencode=bt,J.lenbits=9,J.distcode=At,J.distbits=5},P=(J,Z,ee,ne)=>{let se;const re=J.state;return null===re.window&&(re.wsize=1<<re.wbits,re.wnext=0,re.whave=0,re.window=new Uint8Array(re.wsize)),ne>=re.wsize?(re.window.set(Z.subarray(ee-re.wsize,ee),0),re.wnext=0,re.whave=re.wsize):(se=re.wsize-re.wnext,se>ne&&(se=ne),re.window.set(Z.subarray(ee-ne,ee-ne+se),re.wnext),(ne-=se)?(re.window.set(Z.subarray(ee-ne,ee),0),re.wnext=ne,re.whave=re.wsize):(re.wnext+=se,re.wnext===re.wsize&&(re.wnext=0),re.whave<re.wsize&&(re.whave+=se))),0};var wt={inflateReset:z,inflateReset2:F,inflateResetKeep:C,inflateInit:J=>L(J,15),inflateInit2:L,inflate:(J,Z)=>{let ee,ne,se,re,ae,le,pe,bt,At,Ot,wt,Dt,Lt,kt,Ut,Gt,xt,Ft,$t,jt,Wt,Zt,Xt=0;const Bn=new Uint8Array(4);let Hn,Kn;const es=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(N(J)||!J.output||!J.input&&0!==J.avail_in)return He;ee=J.state,ee.mode===it&&(ee.mode=ot),ae=J.next_out,se=J.output,pe=J.avail_out,re=J.next_in,ne=J.input,le=J.avail_in,bt=ee.hold,At=ee.bits,Ot=le,wt=pe,Zt=Fe;e:for(;;)switch(ee.mode){case tt:if(0===ee.wrap){ee.mode=ot;break}for(;At<16;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}if(2&ee.wrap&&35615===bt){0===ee.wbits&&(ee.wbits=15),ee.check=0,Bn[0]=255&bt,Bn[1]=bt>>>8&255,ee.check=n(ee.check,Bn,2,0),bt=0,At=0,ee.mode=16181;break}if(ee.head&&(ee.head.done=!1),!(1&ee.wrap)||(((255&bt)<<8)+(bt>>8))%31){J.msg="incorrect header check",ee.mode=Mt;break}if((15&bt)!==Qe){J.msg="unknown compression method",ee.mode=Mt;break}if(bt>>>=4,At-=4,Wt=8+(15&bt),0===ee.wbits&&(ee.wbits=Wt),Wt>15||Wt>ee.wbits){J.msg="invalid window size",ee.mode=Mt;break}ee.dmax=1<<ee.wbits,ee.flags=0,J.adler=ee.check=1,ee.mode=512&bt?16189:it,bt=0,At=0;break;case 16181:for(;At<16;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}if(ee.flags=bt,(255&ee.flags)!==Qe){J.msg="unknown compression method",ee.mode=Mt;break}if(57344&ee.flags){J.msg="unknown header flags set",ee.mode=Mt;break}ee.head&&(ee.head.text=bt>>8&1),512&ee.flags&&4&ee.wrap&&(Bn[0]=255&bt,Bn[1]=bt>>>8&255,ee.check=n(ee.check,Bn,2,0)),bt=0,At=0,ee.mode=16182;case 16182:for(;At<32;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}ee.head&&(ee.head.time=bt),512&ee.flags&&4&ee.wrap&&(Bn[0]=255&bt,Bn[1]=bt>>>8&255,Bn[2]=bt>>>16&255,Bn[3]=bt>>>24&255,ee.check=n(ee.check,Bn,4,0)),bt=0,At=0,ee.mode=16183;case 16183:for(;At<16;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}ee.head&&(ee.head.xflags=255&bt,ee.head.os=bt>>8),512&ee.flags&&4&ee.wrap&&(Bn[0]=255&bt,Bn[1]=bt>>>8&255,ee.check=n(ee.check,Bn,2,0)),bt=0,At=0,ee.mode=16184;case 16184:if(1024&ee.flags){for(;At<16;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}ee.length=bt,ee.head&&(ee.head.extra_len=bt),512&ee.flags&&4&ee.wrap&&(Bn[0]=255&bt,Bn[1]=bt>>>8&255,ee.check=n(ee.check,Bn,2,0)),bt=0,At=0}else ee.head&&(ee.head.extra=null);ee.mode=16185;case 16185:if(1024&ee.flags&&(Dt=ee.length,Dt>le&&(Dt=le),Dt&&(ee.head&&(Wt=ee.head.extra_len-ee.length,ee.head.extra||(ee.head.extra=new Uint8Array(ee.head.extra_len)),ee.head.extra.set(ne.subarray(re,re+Dt),Wt)),512&ee.flags&&4&ee.wrap&&(ee.check=n(ee.check,ne,Dt,re)),le-=Dt,re+=Dt,ee.length-=Dt),ee.length))break e;ee.length=0,ee.mode=16186;case 16186:if(2048&ee.flags){if(0===le)break e;Dt=0;do{Wt=ne[re+Dt++],ee.head&&Wt&&ee.length<65536&&(ee.head.name+=String.fromCharCode(Wt))}while(Wt&&Dt<le);if(512&ee.flags&&4&ee.wrap&&(ee.check=n(ee.check,ne,Dt,re)),le-=Dt,re+=Dt,Wt)break e}else ee.head&&(ee.head.name=null);ee.length=0,ee.mode=16187;case 16187:if(4096&ee.flags){if(0===le)break e;Dt=0;do{Wt=ne[re+Dt++],ee.head&&Wt&&ee.length<65536&&(ee.head.comment+=String.fromCharCode(Wt))}while(Wt&&Dt<le);if(512&ee.flags&&4&ee.wrap&&(ee.check=n(ee.check,ne,Dt,re)),le-=Dt,re+=Dt,Wt)break e}else ee.head&&(ee.head.comment=null);ee.mode=16188;case 16188:if(512&ee.flags){for(;At<16;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}if(4&ee.wrap&&bt!==(65535&ee.check)){J.msg="header crc mismatch",ee.mode=Mt;break}bt=0,At=0}ee.head&&(ee.head.hcrc=ee.flags>>9&1,ee.head.done=!0),J.adler=ee.check=0,ee.mode=it;break;case 16189:for(;At<32;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}J.adler=ee.check=I(bt),bt=0,At=0,ee.mode=nt;case nt:if(0===ee.havedict)return J.next_out=ae,J.avail_out=pe,J.next_in=re,J.avail_in=le,ee.hold=bt,ee.bits=At,$e;J.adler=ee.check=1,ee.mode=it;case it:if(Z===ve||Z===ye)break e;case ot:if(ee.last){bt>>>=7&At,At-=7&At,ee.mode=St;break}for(;At<3;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}switch(ee.last=1&bt,bt>>>=1,At-=1,3&bt){case 0:ee.mode=16193;break;case 1:if(K(ee),ee.mode=mt,Z===ye){bt>>>=2,At-=2;break e}break;case 2:ee.mode=16196;break;case 3:J.msg="invalid block type",ee.mode=Mt}bt>>>=2,At-=2;break;case 16193:for(bt>>>=7&At,At-=7&At;At<32;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}if((65535&bt)!=(bt>>>16^65535)){J.msg="invalid stored block lengths",ee.mode=Mt;break}if(ee.length=65535&bt,bt=0,At=0,ee.mode=pt,Z===ye)break e;case pt:ee.mode=16195;case 16195:if(Dt=ee.length,Dt){if(Dt>le&&(Dt=le),Dt>pe&&(Dt=pe),0===Dt)break e;se.set(ne.subarray(re,re+Dt),ae),le-=Dt,re+=Dt,pe-=Dt,ae+=Dt,ee.length-=Dt;break}ee.mode=it;break;case 16196:for(;At<14;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}if(ee.nlen=257+(31&bt),bt>>>=5,At-=5,ee.ndist=1+(31&bt),bt>>>=5,At-=5,ee.ncode=4+(15&bt),bt>>>=4,At-=4,ee.nlen>286||ee.ndist>30){J.msg="too many length or distance symbols",ee.mode=Mt;break}ee.have=0,ee.mode=16197;case 16197:for(;ee.have<ee.ncode;){for(;At<3;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}ee.lens[es[ee.have++]]=7&bt,bt>>>=3,At-=3}for(;ee.have<19;)ee.lens[es[ee.have++]]=0;if(ee.lencode=ee.lendyn,ee.lenbits=7,Hn={bits:ee.lenbits},Zt=c(0,ee.lens,0,19,ee.lencode,0,ee.work,Hn),ee.lenbits=Hn.bits,Zt){J.msg="invalid code lengths set",ee.mode=Mt;break}ee.have=0,ee.mode=16198;case 16198:for(;ee.have<ee.nlen+ee.ndist;){for(;Xt=ee.lencode[bt&(1<<ee.lenbits)-1],Ut=Xt>>>24,Gt=Xt>>>16&255,xt=65535&Xt,!(Ut<=At);){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}if(xt<16)bt>>>=Ut,At-=Ut,ee.lens[ee.have++]=xt;else{if(16===xt){for(Kn=Ut+2;At<Kn;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}if(bt>>>=Ut,At-=Ut,0===ee.have){J.msg="invalid bit length repeat",ee.mode=Mt;break}Wt=ee.lens[ee.have-1],Dt=3+(3&bt),bt>>>=2,At-=2}else if(17===xt){for(Kn=Ut+3;At<Kn;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}bt>>>=Ut,At-=Ut,Wt=0,Dt=3+(7&bt),bt>>>=3,At-=3}else{for(Kn=Ut+7;At<Kn;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}bt>>>=Ut,At-=Ut,Wt=0,Dt=11+(127&bt),bt>>>=7,At-=7}if(ee.have+Dt>ee.nlen+ee.ndist){J.msg="invalid bit length repeat",ee.mode=Mt;break}for(;Dt--;)ee.lens[ee.have++]=Wt}}if(ee.mode===Mt)break;if(0===ee.lens[256]){J.msg="invalid code -- missing end-of-block",ee.mode=Mt;break}if(ee.lenbits=9,Hn={bits:ee.lenbits},Zt=c(1,ee.lens,0,ee.nlen,ee.lencode,0,ee.work,Hn),ee.lenbits=Hn.bits,Zt){J.msg="invalid literal/lengths set",ee.mode=Mt;break}if(ee.distbits=6,ee.distcode=ee.distdyn,Hn={bits:ee.distbits},Zt=c(2,ee.lens,ee.nlen,ee.ndist,ee.distcode,0,ee.work,Hn),ee.distbits=Hn.bits,Zt){J.msg="invalid distances set",ee.mode=Mt;break}if(ee.mode=mt,Z===ye)break e;case mt:ee.mode=It;case It:if(le>=6&&pe>=258){J.next_out=ae,J.avail_out=pe,J.next_in=re,J.avail_in=le,ee.hold=bt,ee.bits=At,r(J,wt),ae=J.next_out,se=J.output,pe=J.avail_out,re=J.next_in,ne=J.input,le=J.avail_in,bt=ee.hold,At=ee.bits,ee.mode===it&&(ee.back=-1);break}for(ee.back=0;Xt=ee.lencode[bt&(1<<ee.lenbits)-1],Ut=Xt>>>24,Gt=Xt>>>16&255,xt=65535&Xt,!(Ut<=At);){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}if(Gt&&!(240&Gt)){for(Ft=Ut,$t=Gt,jt=xt;Xt=ee.lencode[jt+((bt&(1<<Ft+$t)-1)>>Ft)],Ut=Xt>>>24,Gt=Xt>>>16&255,xt=65535&Xt,!(Ft+Ut<=At);){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}bt>>>=Ft,At-=Ft,ee.back+=Ft}if(bt>>>=Ut,At-=Ut,ee.back+=Ut,ee.length=xt,0===Gt){ee.mode=16205;break}if(32&Gt){ee.back=-1,ee.mode=it;break}if(64&Gt){J.msg="invalid literal/length code",ee.mode=Mt;break}ee.extra=15&Gt,ee.mode=16201;case 16201:if(ee.extra){for(Kn=ee.extra;At<Kn;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}ee.length+=bt&(1<<ee.extra)-1,bt>>>=ee.extra,At-=ee.extra,ee.back+=ee.extra}ee.was=ee.length,ee.mode=16202;case 16202:for(;Xt=ee.distcode[bt&(1<<ee.distbits)-1],Ut=Xt>>>24,Gt=Xt>>>16&255,xt=65535&Xt,!(Ut<=At);){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}if(!(240&Gt)){for(Ft=Ut,$t=Gt,jt=xt;Xt=ee.distcode[jt+((bt&(1<<Ft+$t)-1)>>Ft)],Ut=Xt>>>24,Gt=Xt>>>16&255,xt=65535&Xt,!(Ft+Ut<=At);){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}bt>>>=Ft,At-=Ft,ee.back+=Ft}if(bt>>>=Ut,At-=Ut,ee.back+=Ut,64&Gt){J.msg="invalid distance code",ee.mode=Mt;break}ee.offset=xt,ee.extra=15&Gt,ee.mode=16203;case 16203:if(ee.extra){for(Kn=ee.extra;At<Kn;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}ee.offset+=bt&(1<<ee.extra)-1,bt>>>=ee.extra,At-=ee.extra,ee.back+=ee.extra}if(ee.offset>ee.dmax){J.msg="invalid distance too far back",ee.mode=Mt;break}ee.mode=16204;case 16204:if(0===pe)break e;if(Dt=wt-pe,ee.offset>Dt){if(Dt=ee.offset-Dt,Dt>ee.whave&&ee.sane){J.msg="invalid distance too far back",ee.mode=Mt;break}Dt>ee.wnext?(Dt-=ee.wnext,Lt=ee.wsize-Dt):Lt=ee.wnext-Dt,Dt>ee.length&&(Dt=ee.length),kt=ee.window}else kt=se,Lt=ae-ee.offset,Dt=ee.length;Dt>pe&&(Dt=pe),pe-=Dt,ee.length-=Dt;do{se[ae++]=kt[Lt++]}while(--Dt);0===ee.length&&(ee.mode=It);break;case 16205:if(0===pe)break e;se[ae++]=ee.length,pe--,ee.mode=It;break;case St:if(ee.wrap){for(;At<32;){if(0===le)break e;le--,bt|=ne[re++]<<At,At+=8}if(wt-=pe,J.total_out+=wt,ee.total+=wt,4&ee.wrap&&wt&&(J.adler=ee.check=ee.flags?n(ee.check,se,wt,ae-wt):t(ee.check,se,wt,ae-wt)),wt=pe,4&ee.wrap&&(ee.flags?bt:I(bt))!==ee.check){J.msg="incorrect data check",ee.mode=Mt;break}bt=0,At=0}ee.mode=16207;case 16207:if(ee.wrap&&ee.flags){for(;At<32;){if(0===le)break e;le--,bt+=ne[re++]<<At,At+=8}if(4&ee.wrap&&bt!==(4294967295&ee.total)){J.msg="incorrect length check",ee.mode=Mt;break}bt=0,At=0}ee.mode=16208;case 16208:Zt=qe;break e;case Mt:Zt=Ye;break e;case 16210:return Je;default:return He}return J.next_out=ae,J.avail_out=pe,J.next_in=re,J.avail_in=le,ee.hold=bt,ee.bits=At,(ee.wsize||wt!==J.avail_out&&ee.mode<Mt&&(ee.mode<St||Z!==_e))&&P(J,J.output,J.next_out,wt-J.avail_out),Ot-=J.avail_in,wt-=J.avail_out,J.total_in+=Ot,J.total_out+=wt,ee.total+=wt,4&ee.wrap&&wt&&(J.adler=ee.check=ee.flags?n(ee.check,se,wt,J.next_out-wt):t(ee.check,se,wt,J.next_out-wt)),J.data_type=ee.bits+(ee.last?64:0)+(ee.mode===it?128:0)+(ee.mode===mt||ee.mode===pt?256:0),(0===Ot&&0===wt||Z===_e)&&Zt===Fe&&(Zt=Xe),Zt},inflateEnd:J=>{if(N(J))return He;let Z=J.state;return Z.window&&(Z.window=null),J.state=null,Fe},inflateGetHeader:(J,Z)=>{if(N(J))return He;const ee=J.state;return 2&ee.wrap?(ee.head=Z,Z.done=!1,Fe):He},inflateSetDictionary:(J,Z)=>{const ee=Z.length;let ne,se,re;return N(J)?He:(ne=J.state,0!==ne.wrap&&ne.mode!==nt?He:ne.mode===nt&&(se=1,se=t(se,Z,ee,0),se!==ne.check)?Ye:(re=P(J,Z,ee,ee),re?(ne.mode=16210,Je):(ne.havedict=1,Fe)))},inflateInfo:"pako inflate (from Nodeca project)"};const G=(J,Z)=>Object.prototype.hasOwnProperty.call(J,Z);var X=function(J){const Z=Array.prototype.slice.call(arguments,1);for(;Z.length;){const ee=Z.shift();if(ee){if("object"!=typeof ee)throw new TypeError(ee+"must be non-object");for(const Z in ee)G(ee,Z)&&(J[Z]=ee[Z])}}return J},W=J=>{let Z=0;for(let ee=0,ne=J.length;ee<ne;ee++)Z+=J[ee].length;const ee=new Uint8Array(Z);for(let Z=0,ne=0,se=J.length;Z<se;Z++){let se=J[Z];ee.set(se,ne),ne+=se.length}return ee};let Dt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(J){Dt=!1}const Lt=new Uint8Array(256);for(let J=0;J<256;J++)Lt[J]=J>=252?6:J>=248?5:J>=240?4:J>=224?3:J>=192?2:1;Lt[254]=Lt[254]=1;var Q=J=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(J);let Z,ee,ne,se,re,ae=J.length,le=0;for(se=0;se<ae;se++)ee=J.charCodeAt(se),55296==(64512&ee)&&se+1<ae&&(ne=J.charCodeAt(se+1),56320==(64512&ne)&&(ee=65536+(ee-55296<<10)+(ne-56320),se++)),le+=ee<128?1:ee<2048?2:ee<65536?3:4;for(Z=new Uint8Array(le),re=0,se=0;re<le;se++)ee=J.charCodeAt(se),55296==(64512&ee)&&se+1<ae&&(ne=J.charCodeAt(se+1),56320==(64512&ne)&&(ee=65536+(ee-55296<<10)+(ne-56320),se++)),ee<128?Z[re++]=ee:ee<2048?(Z[re++]=192|ee>>>6,Z[re++]=128|63&ee):ee<65536?(Z[re++]=224|ee>>>12,Z[re++]=128|ee>>>6&63,Z[re++]=128|63&ee):(Z[re++]=240|ee>>>18,Z[re++]=128|ee>>>12&63,Z[re++]=128|ee>>>6&63,Z[re++]=128|63&ee);return Z},V=(J,Z)=>{const ee=Z||J.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(J.subarray(0,Z));let ne,se;const re=new Array(2*ee);for(se=0,ne=0;ne<ee;){let Z=J[ne++];if(Z<128){re[se++]=Z;continue}let ae=Lt[Z];if(ae>4)re[se++]=65533,ne+=ae-1;else{for(Z&=2===ae?31:3===ae?15:7;ae>1&&ne<ee;)Z=Z<<6|63&J[ne++],ae--;ae>1?re[se++]=65533:Z<65536?re[se++]=Z:(Z-=65536,re[se++]=55296|Z>>10&1023,re[se++]=56320|1023&Z)}}return((J,Z)=>{if(Z<65534&&J.subarray&&Dt)return String.fromCharCode.apply(null,J.length===Z?J:J.subarray(0,Z));let ee="";for(let ne=0;ne<Z;ne++)ee+=String.fromCharCode(J[ne]);return ee})(re,se)},$=(J,Z)=>{(Z=Z||J.length)>J.length&&(Z=J.length);let ee=Z-1;for(;ee>=0&&128==(192&J[ee]);)ee--;return ee<0||0===ee?Z:ee+Lt[J[ee]]>Z?ee:Z},kt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},te=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},ie=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Ut=Object.prototype.toString,{Z_NO_FLUSH:Gt,Z_FINISH:xt,Z_OK:Ft,Z_STREAM_END:$t,Z_NEED_DICT:jt,Z_STREAM_ERROR:Wt,Z_DATA_ERROR:Zt,Z_MEM_ERROR:Xt}=pe;function he(J){this.options=X({chunkSize:65536,windowBits:15,to:""},J||{});const Z=this.options;Z.raw&&Z.windowBits>=0&&Z.windowBits<16&&(Z.windowBits=-Z.windowBits,0===Z.windowBits&&(Z.windowBits=-15)),!(Z.windowBits>=0&&Z.windowBits<16)||J&&J.windowBits||(Z.windowBits+=32),Z.windowBits>15&&Z.windowBits<48&&!(15&Z.windowBits)&&(Z.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new te,this.strm.avail_out=0;let ee=wt.inflateInit2(this.strm,Z.windowBits);if(ee!==Ft)throw new Error(kt[ee]);if(this.header=new ie,wt.inflateGetHeader(this.strm,this.header),Z.dictionary&&("string"==typeof Z.dictionary?Z.dictionary=Q(Z.dictionary):"[object ArrayBuffer]"===Ut.call(Z.dictionary)&&(Z.dictionary=new Uint8Array(Z.dictionary)),Z.raw&&(ee=wt.inflateSetDictionary(this.strm,Z.dictionary),ee!==Ft)))throw new Error(kt[ee])}function ue(J,Z){const ee=new he(Z);if(ee.push(J),ee.err)throw ee.msg||kt[ee.err];return ee.result}he.prototype.push=function(J,Z){const ee=this.strm,ne=this.options.chunkSize,se=this.options.dictionary;let re,ae,le;if(this.ended)return!1;for(ae=Z===~~Z?Z:!0===Z?xt:Gt,"[object ArrayBuffer]"===Ut.call(J)?ee.input=new Uint8Array(J):ee.input=J,ee.next_in=0,ee.avail_in=ee.input.length;;){for(0===ee.avail_out&&(ee.output=new Uint8Array(ne),ee.next_out=0,ee.avail_out=ne),re=wt.inflate(ee,ae),re===jt&&se&&(re=wt.inflateSetDictionary(ee,se),re===Ft?re=wt.inflate(ee,ae):re===Zt&&(re=jt));ee.avail_in>0&&re===$t&&ee.state.wrap>0&&0!==J[ee.next_in];)wt.inflateReset(ee),re=wt.inflate(ee,ae);switch(re){case Wt:case Zt:case jt:case Xt:return this.onEnd(re),this.ended=!0,!1}if(le=ee.avail_out,ee.next_out&&(0===ee.avail_out||re===$t))if("string"===this.options.to){let J=$(ee.output,ee.next_out),Z=ee.next_out-J,se=V(ee.output,J);ee.next_out=Z,ee.avail_out=ne-Z,Z&&ee.output.set(ee.output.subarray(J,J+Z),0),this.onData(se)}else this.onData(ee.output.length===ee.next_out?ee.output:ee.output.subarray(0,ee.next_out));if(re!==Ft||0!==le){if(re===$t)return re=wt.inflateEnd(this.strm),this.onEnd(re),this.ended=!0,!0;if(0===ee.avail_in)break}}return!0},he.prototype.onData=function(J){this.chunks.push(J)},he.prototype.onEnd=function(J){J===Ft&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=W(this.chunks)),this.chunks=[],this.err=J,this.msg=this.strm.msg};var Bn=he,Hn=ue,me=function(J,Z){return(Z=Z||{}).raw=!0,ue(J,Z)},Kn=ue,es=pe,ts={Inflate:Bn,inflate:Hn,inflateRaw:me,ungzip:Kn,constants:es};J.Inflate=Bn,J.constants=es,J.default=ts,J.inflate=Hn,J.inflateRaw=me,J.ungzip=Kn,Object.defineProperty(J,"__esModule",{value:!0})}(Z)},148:function(J,Z,ee){J.exports=function(){var J,Z,ne,se,re,ae,le,pe,_e,ve,ye,Fe,qe,$e,He,Ye,Je,Xe,Qe,tt,nt,it,ot,pt,mt,It,St,Mt,bt,At,Ot,wt,Dt,Lt,kt,Ut,Gt,xt,Ft,$t=$t||function(J){var Z;if("undefined"!=typeof window&&window.crypto&&(Z=window.crypto),"undefined"!=typeof self&&self.crypto&&(Z=self.crypto),!(Z=!(Z=!(Z="undefined"!=typeof globalThis&&globalThis.crypto?globalThis.crypto:Z)&&"undefined"!=typeof window&&window.msCrypto?window.msCrypto:Z)&&void 0!==ee.g&&ee.g.crypto?ee.g.crypto:Z))try{Z=ee(425)}catch(se){}var ne=Object.create||function(J){return e.prototype=J,J=new e,e.prototype=null,J};function e(){}var se={},re=se.lib={},ae=re.Base={extend:function(J){var Z=ne(this);return J&&Z.mixIn(J),Z.hasOwnProperty("init")&&this.init!==Z.init||(Z.init=function(){Z.$super.init.apply(this,arguments)}),(Z.init.prototype=Z).$super=this,Z},create:function(){var J=this.extend();return J.init.apply(J,arguments),J},init:function(){},mixIn:function(J){for(var Z in J)J.hasOwnProperty(Z)&&(this[Z]=J[Z]);J.hasOwnProperty("toString")&&(this.toString=J.toString)},clone:function(){return this.init.prototype.extend(this)}},le=re.WordArray=ae.extend({init:function(J,Z){J=this.words=J||[],this.sigBytes=null!=Z?Z:4*J.length},toString:function(J){return(J||_e).stringify(this)},concat:function(J){var Z=this.words,ee=J.words,ne=this.sigBytes,se=J.sigBytes;if(this.clamp(),ne%4)for(var re=0;re<se;re++){var ae=ee[re>>>2]>>>24-re%4*8&255;Z[ne+re>>>2]|=ae<<24-(ne+re)%4*8}else for(var le=0;le<se;le+=4)Z[ne+le>>>2]=ee[le>>>2];return this.sigBytes+=se,this},clamp:function(){var Z=this.words,ee=this.sigBytes;Z[ee>>>2]&=4294967295<<32-ee%4*8,Z.length=J.ceil(ee/4)},clone:function(){var J=ae.clone.call(this);return J.words=this.words.slice(0),J},random:function(J){for(var ee=[],ne=0;ne<J;ne+=4)ee.push(function(){if(Z){if("function"==typeof Z.getRandomValues)try{return Z.getRandomValues(new Uint32Array(1))[0]}catch(J){}if("function"==typeof Z.randomBytes)try{return Z.randomBytes(4).readInt32LE()}catch(J){}}throw new Error("Native crypto module could not be used to get secure random number.")}());return new le.init(ee,J)}}),pe=se.enc={},_e=pe.Hex={stringify:function(J){for(var Z=J.words,ee=J.sigBytes,ne=[],se=0;se<ee;se++){var re=Z[se>>>2]>>>24-se%4*8&255;ne.push((re>>>4).toString(16)),ne.push((15&re).toString(16))}return ne.join("")},parse:function(J){for(var Z=J.length,ee=[],ne=0;ne<Z;ne+=2)ee[ne>>>3]|=parseInt(J.substr(ne,2),16)<<24-ne%8*4;return new le.init(ee,Z/2)}},ve=pe.Latin1={stringify:function(J){for(var Z=J.words,ee=J.sigBytes,ne=[],se=0;se<ee;se++){var re=Z[se>>>2]>>>24-se%4*8&255;ne.push(String.fromCharCode(re))}return ne.join("")},parse:function(J){for(var Z=J.length,ee=[],ne=0;ne<Z;ne++)ee[ne>>>2]|=(255&J.charCodeAt(ne))<<24-ne%4*8;return new le.init(ee,Z)}},ye=pe.Utf8={stringify:function(J){try{return decodeURIComponent(escape(ve.stringify(J)))}catch(J){throw new Error("Malformed UTF-8 data")}},parse:function(J){return ve.parse(unescape(encodeURIComponent(J)))}},Fe=re.BufferedBlockAlgorithm=ae.extend({reset:function(){this._data=new le.init,this._nDataBytes=0},_append:function(J){"string"==typeof J&&(J=ye.parse(J)),this._data.concat(J),this._nDataBytes+=J.sigBytes},_process:function(Z){var ee,ne=this._data,se=ne.words,re=ne.sigBytes,ae=this.blockSize,pe=re/(4*ae),_e=(pe=Z?J.ceil(pe):J.max((0|pe)-this._minBufferSize,0))*ae;if(re=J.min(4*_e,re),_e){for(var ve=0;ve<_e;ve+=ae)this._doProcessBlock(se,ve);ee=se.splice(0,_e),ne.sigBytes-=re}return new le.init(ee,re)},clone:function(){var J=ae.clone.call(this);return J._data=this._data.clone(),J},_minBufferSize:0}),qe=(re.Hasher=Fe.extend({cfg:ae.extend(),init:function(J){this.cfg=this.cfg.extend(J),this.reset()},reset:function(){Fe.reset.call(this),this._doReset()},update:function(J){return this._append(J),this._process(),this},finalize:function(J){return J&&this._append(J),this._doFinalize()},blockSize:16,_createHelper:function(J){return function(Z,ee){return new J.init(ee).finalize(Z)}},_createHmacHelper:function(J){return function(Z,ee){return new qe.HMAC.init(J,ee).finalize(Z)}}}),se.algo={});return se}(Math);function K(J,Z,ee){return J&Z|~J&ee}function X(J,Z,ee){return J&ee|Z&~ee}function L(J,Z){return J<<Z|J>>>32-Z}function j(J,Z,ee,ne){var se,re=this._iv;re?(se=re.slice(0),this._iv=void 0):se=this._prevBlock,ne.encryptBlock(se,0);for(var ae=0;ae<ee;ae++)J[Z+ae]^=se[ae]}function T(J){var Z,ee,ne;return 255&~(J>>24)?J+=1<<24:(ee=J>>8&255,ne=255&J,255==(Z=J>>16&255)?(Z=0,255===ee?(ee=0,255===ne?ne=0:++ne):++ee):++Z,J=0,J+=Z<<16,J+=ee<<8,J+=ne),J}function N(){for(var J=this._X,Z=this._C,ee=0;ee<8;ee++)wt[ee]=Z[ee];for(Z[0]=Z[0]+1295307597+this._b|0,Z[1]=Z[1]+3545052371+(Z[0]>>>0<wt[0]>>>0?1:0)|0,Z[2]=Z[2]+886263092+(Z[1]>>>0<wt[1]>>>0?1:0)|0,Z[3]=Z[3]+1295307597+(Z[2]>>>0<wt[2]>>>0?1:0)|0,Z[4]=Z[4]+3545052371+(Z[3]>>>0<wt[3]>>>0?1:0)|0,Z[5]=Z[5]+886263092+(Z[4]>>>0<wt[4]>>>0?1:0)|0,Z[6]=Z[6]+1295307597+(Z[5]>>>0<wt[5]>>>0?1:0)|0,Z[7]=Z[7]+3545052371+(Z[6]>>>0<wt[6]>>>0?1:0)|0,this._b=Z[7]>>>0<wt[7]>>>0?1:0,ee=0;ee<8;ee++){var ne=J[ee]+Z[ee],se=65535&ne,re=ne>>>16;Dt[ee]=((se*se>>>17)+se*re>>>15)+re*re^((4294901760&ne)*ne|0)+((65535&ne)*ne|0)}J[0]=Dt[0]+(Dt[7]<<16|Dt[7]>>>16)+(Dt[6]<<16|Dt[6]>>>16)|0,J[1]=Dt[1]+(Dt[0]<<8|Dt[0]>>>24)+Dt[7]|0,J[2]=Dt[2]+(Dt[1]<<16|Dt[1]>>>16)+(Dt[0]<<16|Dt[0]>>>16)|0,J[3]=Dt[3]+(Dt[2]<<8|Dt[2]>>>24)+Dt[1]|0,J[4]=Dt[4]+(Dt[3]<<16|Dt[3]>>>16)+(Dt[2]<<16|Dt[2]>>>16)|0,J[5]=Dt[5]+(Dt[4]<<8|Dt[4]>>>24)+Dt[3]|0,J[6]=Dt[6]+(Dt[5]<<16|Dt[5]>>>16)+(Dt[4]<<16|Dt[4]>>>16)|0,J[7]=Dt[7]+(Dt[6]<<8|Dt[6]>>>24)+Dt[5]|0}function q(){for(var J=this._X,Z=this._C,ee=0;ee<8;ee++)xt[ee]=Z[ee];for(Z[0]=Z[0]+1295307597+this._b|0,Z[1]=Z[1]+3545052371+(Z[0]>>>0<xt[0]>>>0?1:0)|0,Z[2]=Z[2]+886263092+(Z[1]>>>0<xt[1]>>>0?1:0)|0,Z[3]=Z[3]+1295307597+(Z[2]>>>0<xt[2]>>>0?1:0)|0,Z[4]=Z[4]+3545052371+(Z[3]>>>0<xt[3]>>>0?1:0)|0,Z[5]=Z[5]+886263092+(Z[4]>>>0<xt[4]>>>0?1:0)|0,Z[6]=Z[6]+1295307597+(Z[5]>>>0<xt[5]>>>0?1:0)|0,Z[7]=Z[7]+3545052371+(Z[6]>>>0<xt[6]>>>0?1:0)|0,this._b=Z[7]>>>0<xt[7]>>>0?1:0,ee=0;ee<8;ee++){var ne=J[ee]+Z[ee],se=65535&ne,re=ne>>>16;Ft[ee]=((se*se>>>17)+se*re>>>15)+re*re^((4294901760&ne)*ne|0)+((65535&ne)*ne|0)}J[0]=Ft[0]+(Ft[7]<<16|Ft[7]>>>16)+(Ft[6]<<16|Ft[6]>>>16)|0,J[1]=Ft[1]+(Ft[0]<<8|Ft[0]>>>24)+Ft[7]|0,J[2]=Ft[2]+(Ft[1]<<16|Ft[1]>>>16)+(Ft[0]<<16|Ft[0]>>>16)|0,J[3]=Ft[3]+(Ft[2]<<8|Ft[2]>>>24)+Ft[1]|0,J[4]=Ft[4]+(Ft[3]<<16|Ft[3]>>>16)+(Ft[2]<<16|Ft[2]>>>16)|0,J[5]=Ft[5]+(Ft[4]<<8|Ft[4]>>>24)+Ft[3]|0,J[6]=Ft[6]+(Ft[5]<<16|Ft[5]>>>16)+(Ft[4]<<16|Ft[4]>>>16)|0,J[7]=Ft[7]+(Ft[6]<<8|Ft[6]>>>24)+Ft[5]|0}return kt=(Lt=$t).lib,J=kt.Base,Z=kt.WordArray,(Lt=Lt.x64={}).Word=J.extend({init:function(J,Z){this.high=J,this.low=Z}}),Lt.WordArray=J.extend({init:function(J,Z){J=this.words=J||[],this.sigBytes=null!=Z?Z:8*J.length},toX32:function(){for(var J=this.words,ee=J.length,ne=[],se=0;se<ee;se++){var re=J[se];ne.push(re.high),ne.push(re.low)}return Z.create(ne,this.sigBytes)},clone:function(){for(var Z=J.clone.call(this),ee=Z.words=this.words.slice(0),ne=ee.length,se=0;se<ne;se++)ee[se]=ee[se].clone();return Z}}),"function"==typeof ArrayBuffer&&(Ut=$t.lib.WordArray,ne=Ut.init,(Ut.init=function(J){if((J=(J=J instanceof ArrayBuffer?new Uint8Array(J):J)instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&J instanceof Uint8ClampedArray||J instanceof Int16Array||J instanceof Uint16Array||J instanceof Int32Array||J instanceof Uint32Array||J instanceof Float32Array||J instanceof Float64Array?new Uint8Array(J.buffer,J.byteOffset,J.byteLength):J)instanceof Uint8Array){for(var Z=J.byteLength,ee=[],se=0;se<Z;se++)ee[se>>>2]|=J[se]<<24-se%4*8;ne.call(this,ee,Z)}else ne.apply(this,arguments)}).prototype=Ut),function(){var J,Z=(J=$t).lib.WordArray;function s(J){return J<<8&4278255360|J>>>8&16711935}(J=J.enc).Utf16=J.Utf16BE={stringify:function(J){for(var Z=J.words,ee=J.sigBytes,ne=[],se=0;se<ee;se+=2){var re=Z[se>>>2]>>>16-se%4*8&65535;ne.push(String.fromCharCode(re))}return ne.join("")},parse:function(J){for(var ee=J.length,ne=[],se=0;se<ee;se++)ne[se>>>1]|=J.charCodeAt(se)<<16-se%2*16;return Z.create(ne,2*ee)}},J.Utf16LE={stringify:function(J){for(var Z=J.words,ee=J.sigBytes,ne=[],se=0;se<ee;se+=2){var re=s(Z[se>>>2]>>>16-se%4*8&65535);ne.push(String.fromCharCode(re))}return ne.join("")},parse:function(J){for(var ee=J.length,ne=[],se=0;se<ee;se++)ne[se>>>1]|=s(J.charCodeAt(se)<<16-se%2*16);return Z.create(ne,2*ee)}}}(),se=(St=$t).lib.WordArray,St.enc.Base64={stringify:function(J){var Z=J.words,ee=J.sigBytes,ne=this._map;J.clamp();for(var se=[],re=0;re<ee;re+=3)for(var ae=(Z[re>>>2]>>>24-re%4*8&255)<<16|(Z[re+1>>>2]>>>24-(re+1)%4*8&255)<<8|Z[re+2>>>2]>>>24-(re+2)%4*8&255,le=0;le<4&&re+.75*le<ee;le++)se.push(ne.charAt(ae>>>6*(3-le)&63));var pe=ne.charAt(64);if(pe)for(;se.length%4;)se.push(pe);return se.join("")},parse:function(J){var Z=J.length,ee=this._map;if(!(ne=this._reverseMap))for(var ne=this._reverseMap=[],re=0;re<ee.length;re++)ne[ee.charCodeAt(re)]=re;var ae=ee.charAt(64);return!ae||-1!==(ae=J.indexOf(ae))&&(Z=ae),function(J,Z,ee){for(var ne=[],re=0,ae=0;ae<Z;ae++){var le,pe;ae%4&&(le=ee[J.charCodeAt(ae-1)]<<ae%4*2,pe=ee[J.charCodeAt(ae)]>>>6-ae%4*2,pe|=le,ne[re>>>2]|=pe<<24-re%4*8,re++)}return se.create(ne,re)}(J,Z,ne)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},re=(kt=$t).lib.WordArray,kt.enc.Base64url={stringify:function(J,Z=!0){var ee=J.words,ne=J.sigBytes,se=Z?this._safe_map:this._map;J.clamp();for(var re=[],ae=0;ae<ne;ae+=3)for(var le=(ee[ae>>>2]>>>24-ae%4*8&255)<<16|(ee[ae+1>>>2]>>>24-(ae+1)%4*8&255)<<8|ee[ae+2>>>2]>>>24-(ae+2)%4*8&255,pe=0;pe<4&&ae+.75*pe<ne;pe++)re.push(se.charAt(le>>>6*(3-pe)&63));var _e=se.charAt(64);if(_e)for(;re.length%4;)re.push(_e);return re.join("")},parse:function(J,Z=!0){var ee=J.length,ne=Z?this._safe_map:this._map;if(!(se=this._reverseMap))for(var se=this._reverseMap=[],ae=0;ae<ne.length;ae++)se[ne.charCodeAt(ae)]=ae;return!(Z=ne.charAt(64))||-1!==(Z=J.indexOf(Z))&&(ee=Z),function(J,Z,ee){for(var ne=[],se=0,ae=0;ae<Z;ae++){var le,pe;ae%4&&(le=ee[J.charCodeAt(ae-1)]<<ae%4*2,pe=ee[J.charCodeAt(ae)]>>>6-ae%4*2,pe|=le,ne[se>>>2]|=pe<<24-se%4*8,se++)}return re.create(ne,se)}(J,ee,se)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},function(J){var Z=$t,ee=(se=Z.lib).WordArray,ne=se.Hasher,se=Z.algo,re=[];function H(J,Z,ee,ne,se,re,ae){return((ae=J+(Z&ee|~Z&ne)+se+ae)<<re|ae>>>32-re)+Z}function z(J,Z,ee,ne,se,re,ae){return((ae=J+(Z&ne|ee&~ne)+se+ae)<<re|ae>>>32-re)+Z}function C(J,Z,ee,ne,se,re,ae){return((ae=J+(Z^ee^ne)+se+ae)<<re|ae>>>32-re)+Z}function D(J,Z,ee,ne,se,re,ae){return((ae=J+(ee^(Z|~ne))+se+ae)<<re|ae>>>32-re)+Z}!function(){for(var Z=0;Z<64;Z++)re[Z]=4294967296*J.abs(J.sin(Z+1))|0}(),se=se.MD5=ne.extend({_doReset:function(){this._hash=new ee.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(J,Z){for(var ee=0;ee<16;ee++){var ne=Z+ee,se=J[ne];J[ne]=16711935&(se<<8|se>>>24)|4278255360&(se<<24|se>>>8)}var ae=this._hash.words,le=J[Z+0],pe=J[Z+1],_e=J[Z+2],ve=J[Z+3],ye=J[Z+4],Fe=J[Z+5],qe=J[Z+6],$e=J[Z+7],He=J[Z+8],Ye=J[Z+9],Je=J[Z+10],Xe=J[Z+11],Qe=J[Z+12],tt=J[Z+13],nt=J[Z+14],it=J[Z+15],ot=H(ot=ae[0],It=ae[1],mt=ae[2],pt=ae[3],le,7,re[0]),pt=H(pt,ot,It,mt,pe,12,re[1]),mt=H(mt,pt,ot,It,_e,17,re[2]),It=H(It,mt,pt,ot,ve,22,re[3]);ot=H(ot,It,mt,pt,ye,7,re[4]),pt=H(pt,ot,It,mt,Fe,12,re[5]),mt=H(mt,pt,ot,It,qe,17,re[6]),It=H(It,mt,pt,ot,$e,22,re[7]),ot=H(ot,It,mt,pt,He,7,re[8]),pt=H(pt,ot,It,mt,Ye,12,re[9]),mt=H(mt,pt,ot,It,Je,17,re[10]),It=H(It,mt,pt,ot,Xe,22,re[11]),ot=H(ot,It,mt,pt,Qe,7,re[12]),pt=H(pt,ot,It,mt,tt,12,re[13]),mt=H(mt,pt,ot,It,nt,17,re[14]),ot=z(ot,It=H(It,mt,pt,ot,it,22,re[15]),mt,pt,pe,5,re[16]),pt=z(pt,ot,It,mt,qe,9,re[17]),mt=z(mt,pt,ot,It,Xe,14,re[18]),It=z(It,mt,pt,ot,le,20,re[19]),ot=z(ot,It,mt,pt,Fe,5,re[20]),pt=z(pt,ot,It,mt,Je,9,re[21]),mt=z(mt,pt,ot,It,it,14,re[22]),It=z(It,mt,pt,ot,ye,20,re[23]),ot=z(ot,It,mt,pt,Ye,5,re[24]),pt=z(pt,ot,It,mt,nt,9,re[25]),mt=z(mt,pt,ot,It,ve,14,re[26]),It=z(It,mt,pt,ot,He,20,re[27]),ot=z(ot,It,mt,pt,tt,5,re[28]),pt=z(pt,ot,It,mt,_e,9,re[29]),mt=z(mt,pt,ot,It,$e,14,re[30]),ot=C(ot,It=z(It,mt,pt,ot,Qe,20,re[31]),mt,pt,Fe,4,re[32]),pt=C(pt,ot,It,mt,He,11,re[33]),mt=C(mt,pt,ot,It,Xe,16,re[34]),It=C(It,mt,pt,ot,nt,23,re[35]),ot=C(ot,It,mt,pt,pe,4,re[36]),pt=C(pt,ot,It,mt,ye,11,re[37]),mt=C(mt,pt,ot,It,$e,16,re[38]),It=C(It,mt,pt,ot,Je,23,re[39]),ot=C(ot,It,mt,pt,tt,4,re[40]),pt=C(pt,ot,It,mt,le,11,re[41]),mt=C(mt,pt,ot,It,ve,16,re[42]),It=C(It,mt,pt,ot,qe,23,re[43]),ot=C(ot,It,mt,pt,Ye,4,re[44]),pt=C(pt,ot,It,mt,Qe,11,re[45]),mt=C(mt,pt,ot,It,it,16,re[46]),ot=D(ot,It=C(It,mt,pt,ot,_e,23,re[47]),mt,pt,le,6,re[48]),pt=D(pt,ot,It,mt,$e,10,re[49]),mt=D(mt,pt,ot,It,nt,15,re[50]),It=D(It,mt,pt,ot,Fe,21,re[51]),ot=D(ot,It,mt,pt,Qe,6,re[52]),pt=D(pt,ot,It,mt,ve,10,re[53]),mt=D(mt,pt,ot,It,Je,15,re[54]),It=D(It,mt,pt,ot,pe,21,re[55]),ot=D(ot,It,mt,pt,He,6,re[56]),pt=D(pt,ot,It,mt,it,10,re[57]),mt=D(mt,pt,ot,It,qe,15,re[58]),It=D(It,mt,pt,ot,tt,21,re[59]),ot=D(ot,It,mt,pt,ye,6,re[60]),pt=D(pt,ot,It,mt,Xe,10,re[61]),mt=D(mt,pt,ot,It,_e,15,re[62]),It=D(It,mt,pt,ot,Ye,21,re[63]),ae[0]=ae[0]+ot|0,ae[1]=ae[1]+It|0,ae[2]=ae[2]+mt|0,ae[3]=ae[3]+pt|0},_doFinalize:function(){var Z=this._data,ee=Z.words,ne=8*this._nDataBytes,se=8*Z.sigBytes;ee[se>>>5]|=128<<24-se%32;var re=J.floor(ne/4294967296);ee[15+(64+se>>>9<<4)]=16711935&(re<<8|re>>>24)|4278255360&(re<<24|re>>>8),ee[14+(64+se>>>9<<4)]=16711935&(ne<<8|ne>>>24)|4278255360&(ne<<24|ne>>>8),Z.sigBytes=4*(ee.length+1),this._process();for(var ae=(ee=this._hash).words,le=0;le<4;le++){var pe=ae[le];ae[le]=16711935&(pe<<8|pe>>>24)|4278255360&(pe<<24|pe>>>8)}return ee},clone:function(){var J=ne.clone.call(this);return J._hash=this._hash.clone(),J}}),Z.MD5=ne._createHelper(se),Z.HmacMD5=ne._createHmacHelper(se)}(Math),Ut=(Lt=$t).lib,ae=Ut.WordArray,le=Ut.Hasher,Ut=Lt.algo,pe=[],Ut=Ut.SHA1=le.extend({_doReset:function(){this._hash=new ae.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(J,Z){for(var ee=this._hash.words,ne=ee[0],se=ee[1],re=ee[2],ae=ee[3],le=ee[4],_e=0;_e<80;_e++){_e<16?pe[_e]=0|J[Z+_e]:(ve=pe[_e-3]^pe[_e-8]^pe[_e-14]^pe[_e-16],pe[_e]=ve<<1|ve>>>31);var ve=(ne<<5|ne>>>27)+le+pe[_e];ve+=_e<20?1518500249+(se&re|~se&ae):_e<40?1859775393+(se^re^ae):_e<60?(se&re|se&ae|re&ae)-1894007588:(se^re^ae)-899497514,le=ae,ae=re,re=se<<30|se>>>2,se=ne,ne=ve}ee[0]=ee[0]+ne|0,ee[1]=ee[1]+se|0,ee[2]=ee[2]+re|0,ee[3]=ee[3]+ae|0,ee[4]=ee[4]+le|0},_doFinalize:function(){var J=this._data,Z=J.words,ee=8*this._nDataBytes,ne=8*J.sigBytes;return Z[ne>>>5]|=128<<24-ne%32,Z[14+(64+ne>>>9<<4)]=Math.floor(ee/4294967296),Z[15+(64+ne>>>9<<4)]=ee,J.sigBytes=4*Z.length,this._process(),this._hash},clone:function(){var J=le.clone.call(this);return J._hash=this._hash.clone(),J}}),Lt.SHA1=le._createHelper(Ut),Lt.HmacSHA1=le._createHmacHelper(Ut),function(J){var Z=$t,ee=(se=Z.lib).WordArray,ne=se.Hasher,se=Z.algo,re=[],ae=[];!function(){function t(J){return 4294967296*(J-(0|J))|0}for(var Z=2,ee=0;ee<64;)!function(Z){for(var ee=J.sqrt(Z),ne=2;ne<=ee;ne++)if(!(Z%ne))return;return 1}(Z)||(ee<8&&(re[ee]=t(J.pow(Z,.5))),ae[ee]=t(J.pow(Z,1/3)),ee++),Z++}();var le=[];se=se.SHA256=ne.extend({_doReset:function(){this._hash=new ee.init(re.slice(0))},_doProcessBlock:function(J,Z){for(var ee=this._hash.words,ne=ee[0],se=ee[1],re=ee[2],pe=ee[3],_e=ee[4],ve=ee[5],ye=ee[6],Fe=ee[7],qe=0;qe<64;qe++){qe<16?le[qe]=0|J[Z+qe]:($e=le[qe-15],He=le[qe-2],le[qe]=(($e<<25|$e>>>7)^($e<<14|$e>>>18)^$e>>>3)+le[qe-7]+((He<<15|He>>>17)^(He<<13|He>>>19)^He>>>10)+le[qe-16]);var $e=ne&se^ne&re^se&re,He=Fe+((_e<<26|_e>>>6)^(_e<<21|_e>>>11)^(_e<<7|_e>>>25))+(_e&ve^~_e&ye)+ae[qe]+le[qe];Fe=ye,ye=ve,ve=_e,_e=pe+He|0,pe=re,re=se,se=ne,ne=He+(((ne<<30|ne>>>2)^(ne<<19|ne>>>13)^(ne<<10|ne>>>22))+$e)|0}ee[0]=ee[0]+ne|0,ee[1]=ee[1]+se|0,ee[2]=ee[2]+re|0,ee[3]=ee[3]+pe|0,ee[4]=ee[4]+_e|0,ee[5]=ee[5]+ve|0,ee[6]=ee[6]+ye|0,ee[7]=ee[7]+Fe|0},_doFinalize:function(){var Z=this._data,ee=Z.words,ne=8*this._nDataBytes,se=8*Z.sigBytes;return ee[se>>>5]|=128<<24-se%32,ee[14+(64+se>>>9<<4)]=J.floor(ne/4294967296),ee[15+(64+se>>>9<<4)]=ne,Z.sigBytes=4*ee.length,this._process(),this._hash},clone:function(){var J=ne.clone.call(this);return J._hash=this._hash.clone(),J}}),Z.SHA256=ne._createHelper(se),Z.HmacSHA256=ne._createHmacHelper(se)}(Math),_e=(St=$t).lib.WordArray,kt=St.algo,ve=kt.SHA256,kt=kt.SHA224=ve.extend({_doReset:function(){this._hash=new _e.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var J=ve._doFinalize.call(this);return J.sigBytes-=4,J}}),St.SHA224=ve._createHelper(kt),St.HmacSHA224=ve._createHmacHelper(kt),function(){var J=$t,Z=J.lib.Hasher,ee=(se=J.x64).Word,ne=se.WordArray,se=J.algo;function o(){return ee.create.apply(ee,arguments)}var re=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],ae=[];!function(){for(var J=0;J<80;J++)ae[J]=o()}(),se=se.SHA512=Z.extend({_doReset:function(){this._hash=new ne.init([new ee.init(1779033703,4089235720),new ee.init(3144134277,2227873595),new ee.init(1013904242,4271175723),new ee.init(2773480762,1595750129),new ee.init(1359893119,2917565137),new ee.init(2600822924,725511199),new ee.init(528734635,4215389547),new ee.init(1541459225,327033209)])},_doProcessBlock:function(J,Z){for(var ee,ne=(ee=this._hash.words)[0],se=ee[1],le=ee[2],pe=ee[3],_e=ee[4],ve=ee[5],ye=ee[6],Fe=ee[7],qe=ne.high,$e=ne.low,He=se.high,Ye=se.low,Je=le.high,Xe=le.low,Qe=pe.high,tt=pe.low,nt=_e.high,it=_e.low,ot=ve.high,pt=ve.low,mt=ye.high,It=ye.low,St=Fe.high,Mt=qe,bt=$e,At=He,Ot=Ye,wt=Je,Dt=Xe,Lt=Qe,kt=tt,Ut=nt,Gt=it,xt=ot,Ft=pt,$t=mt,jt=It,Wt=St,Zt=ee=Fe.low,Xt=0;Xt<80;Xt++){var Bn,Hn,Kn=ae[Xt];Xt<16?(Hn=Kn.high=0|J[Z+2*Xt],Bn=Kn.low=0|J[Z+2*Xt+1]):(os=(es=ae[Xt-15]).high,as=es.low,ss=(is=ae[Xt-2]).high,ns=is.low,ts=(rs=ae[Xt-7]).high,es=rs.low,rs=(is=ae[Xt-16]).high,Hn=(Hn=((os>>>1|as<<31)^(os>>>8|as<<24)^os>>>7)+ts+((Bn=(ts=(as>>>1|os<<31)^(as>>>8|os<<24)^(as>>>7|os<<25))+es)>>>0<ts>>>0?1:0))+((ss>>>19|ns<<13)^(ss<<3|ns>>>29)^ss>>>6)+((Bn+=as=(ns>>>19|ss<<13)^(ns<<3|ss>>>29)^(ns>>>6|ss<<26))>>>0<as>>>0?1:0),Bn+=os=is.low,Kn.high=Hn=Hn+rs+(Bn>>>0<os>>>0?1:0),Kn.low=Bn);var es=Ut&xt^~Ut&$t,ts=Gt&Ft^~Gt&jt,ns=Mt&At^Mt&wt^At&wt,ss=(bt>>>28|Mt<<4)^(bt<<30|Mt>>>2)^(bt<<25|Mt>>>7),is=(as=re[Xt]).high,rs=as.low,os=Zt+((Gt>>>14|Ut<<18)^(Gt>>>18|Ut<<14)^(Gt<<23|Ut>>>9)),as=(Kn=Wt+((Ut>>>14|Gt<<18)^(Ut>>>18|Gt<<14)^(Ut<<23|Gt>>>9))+(os>>>0<Zt>>>0?1:0),ss+(bt&Ot^bt&Dt^Ot&Dt));Wt=$t,Zt=jt,$t=xt,jt=Ft,xt=Ut,Ft=Gt,Ut=Lt+(Kn=(Kn=(Kn=Kn+es+((os+=ts)>>>0<ts>>>0?1:0))+is+((os+=rs)>>>0<rs>>>0?1:0))+Hn+((os+=Bn)>>>0<Bn>>>0?1:0))+((Gt=kt+os|0)>>>0<kt>>>0?1:0)|0,Lt=wt,kt=Dt,wt=At,Dt=Ot,At=Mt,Ot=bt,Mt=Kn+(((Mt>>>28|bt<<4)^(Mt<<30|bt>>>2)^(Mt<<25|bt>>>7))+ns+(as>>>0<ss>>>0?1:0))+((bt=os+as|0)>>>0<os>>>0?1:0)|0}$e=ne.low=$e+bt,ne.high=qe+Mt+($e>>>0<bt>>>0?1:0),Ye=se.low=Ye+Ot,se.high=He+At+(Ye>>>0<Ot>>>0?1:0),Xe=le.low=Xe+Dt,le.high=Je+wt+(Xe>>>0<Dt>>>0?1:0),tt=pe.low=tt+kt,pe.high=Qe+Lt+(tt>>>0<kt>>>0?1:0),it=_e.low=it+Gt,_e.high=nt+Ut+(it>>>0<Gt>>>0?1:0),pt=ve.low=pt+Ft,ve.high=ot+xt+(pt>>>0<Ft>>>0?1:0),It=ye.low=It+jt,ye.high=mt+$t+(It>>>0<jt>>>0?1:0),ee=Fe.low=ee+Zt,Fe.high=St+Wt+(ee>>>0<Zt>>>0?1:0)},_doFinalize:function(){var J=this._data,Z=J.words,ee=8*this._nDataBytes,ne=8*J.sigBytes;return Z[ne>>>5]|=128<<24-ne%32,Z[30+(128+ne>>>10<<5)]=Math.floor(ee/4294967296),Z[31+(128+ne>>>10<<5)]=ee,J.sigBytes=4*Z.length,this._process(),this._hash.toX32()},clone:function(){var J=Z.clone.call(this);return J._hash=this._hash.clone(),J},blockSize:32}),J.SHA512=Z._createHelper(se),J.HmacSHA512=Z._createHmacHelper(se)}(),Ut=(Lt=$t).x64,ye=Ut.Word,Fe=Ut.WordArray,Ut=Lt.algo,qe=Ut.SHA512,Ut=Ut.SHA384=qe.extend({_doReset:function(){this._hash=new Fe.init([new ye.init(3418070365,3238371032),new ye.init(1654270250,914150663),new ye.init(2438529370,812702999),new ye.init(355462360,4144912697),new ye.init(1731405415,4290775857),new ye.init(2394180231,1750603025),new ye.init(3675008525,1694076839),new ye.init(1203062813,3204075428)])},_doFinalize:function(){var J=qe._doFinalize.call(this);return J.sigBytes-=16,J}}),Lt.SHA384=qe._createHelper(Ut),Lt.HmacSHA384=qe._createHmacHelper(Ut),function(J){var Z=$t,ee=(re=Z.lib).WordArray,ne=re.Hasher,se=Z.x64.Word,re=Z.algo,ae=[],le=[],pe=[];!function(){for(var J=1,Z=0,ee=0;ee<24;ee++){ae[J+5*Z]=(ee+1)*(ee+2)/2%64;var ne=(2*J+3*Z)%5;J=Z%5,Z=ne}for(J=0;J<5;J++)for(Z=0;Z<5;Z++)le[J+5*Z]=Z+(2*J+3*Z)%5*5;for(var re=1,_e=0;_e<24;_e++){for(var ve,ye=0,Fe=0,qe=0;qe<7;qe++)1&re&&((ve=(1<<qe)-1)<32?Fe^=1<<ve:ye^=1<<ve-32),128&re?re=re<<1^113:re<<=1;pe[_e]=se.create(ye,Fe)}}();var _e=[];!function(){for(var J=0;J<25;J++)_e[J]=se.create()}(),re=re.SHA3=ne.extend({cfg:ne.cfg.extend({outputLength:512}),_doReset:function(){for(var J=this._state=[],Z=0;Z<25;Z++)J[Z]=new se.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(J,Z){for(var ee=this._state,ne=this.blockSize/2,se=0;se<ne;se++){var re=J[Z+2*se],ve=J[Z+2*se+1];re=16711935&(re<<8|re>>>24)|4278255360&(re<<24|re>>>8),(It=ee[se]).high^=ve=16711935&(ve<<8|ve>>>24)|4278255360&(ve<<24|ve>>>8),It.low^=re}for(var ye=0;ye<24;ye++){for(var Fe=0;Fe<5;Fe++){for(var qe=0,$e=0,He=0;He<5;He++)qe^=(It=ee[Fe+5*He]).high,$e^=It.low;var Ye=_e[Fe];Ye.high=qe,Ye.low=$e}for(Fe=0;Fe<5;Fe++){var Je=_e[(Fe+4)%5],Xe=(Qe=_e[(Fe+1)%5]).high,Qe=Qe.low;for(qe=Je.high^(Xe<<1|Qe>>>31),$e=Je.low^(Qe<<1|Xe>>>31),He=0;He<5;He++)(It=ee[Fe+5*He]).high^=qe,It.low^=$e}for(var tt=1;tt<25;tt++){var nt=(It=ee[tt]).high,it=It.low,ot=ae[tt];$e=ot<32?(qe=nt<<ot|it>>>32-ot,it<<ot|nt>>>32-ot):(qe=it<<ot-32|nt>>>64-ot,nt<<ot-32|it>>>64-ot),(ot=_e[le[tt]]).high=qe,ot.low=$e}var pt=_e[0],mt=ee[0];for(pt.high=mt.high,pt.low=mt.low,Fe=0;Fe<5;Fe++)for(He=0;He<5;He++){var It=ee[tt=Fe+5*He],St=_e[tt],Mt=_e[(Fe+1)%5+5*He],bt=_e[(Fe+2)%5+5*He];It.high=St.high^~Mt.high&bt.high,It.low=St.low^~Mt.low&bt.low}It=ee[0],mt=pe[ye],It.high^=mt.high,It.low^=mt.low}},_doFinalize:function(){var Z=this._data,ne=Z.words,se=(this._nDataBytes,8*Z.sigBytes),re=32*this.blockSize;ne[se>>>5]|=1<<24-se%32,ne[(J.ceil((1+se)/re)*re>>>5)-1]|=128,Z.sigBytes=4*ne.length,this._process();for(var ae=this._state,le=(ne=this.cfg.outputLength/8)/8,pe=[],_e=0;_e<le;_e++){var ve=(ye=ae[_e]).high,ye=ye.low;ve=16711935&(ve<<8|ve>>>24)|4278255360&(ve<<24|ve>>>8),pe.push(ye=16711935&(ye<<8|ye>>>24)|4278255360&(ye<<24|ye>>>8)),pe.push(ve)}return new ee.init(pe,ne)},clone:function(){for(var J=ne.clone.call(this),Z=J._state=this._state.slice(0),ee=0;ee<25;ee++)Z[ee]=Z[ee].clone();return J}}),Z.SHA3=ne._createHelper(re),Z.HmacSHA3=ne._createHmacHelper(re)}(Math),Math,kt=(St=$t).lib,$e=kt.WordArray,He=kt.Hasher,kt=St.algo,Ye=$e.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),Je=$e.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),Xe=$e.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),Qe=$e.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),tt=$e.create([0,1518500249,1859775393,2400959708,2840853838]),nt=$e.create([1352829926,1548603684,1836072691,2053994217,0]),kt=kt.RIPEMD160=He.extend({_doReset:function(){this._hash=$e.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(J,Z){for(var ee=0;ee<16;ee++){var ne=Z+ee,se=J[ne];J[ne]=16711935&(se<<8|se>>>24)|4278255360&(se<<24|se>>>8)}var re,ae,le,pe,_e,ve,ye=this._hash.words,Fe=tt.words,qe=nt.words,$e=Ye.words,He=Je.words,it=Xe.words,ot=Qe.words,pt=re=ye[0],mt=ae=ye[1],It=le=ye[2],St=pe=ye[3],Mt=_e=ye[4];for(ee=0;ee<80;ee+=1)ve=re+J[Z+$e[ee]]|0,ve+=ee<16?(ae^le^pe)+Fe[0]:ee<32?K(ae,le,pe)+Fe[1]:ee<48?((ae|~le)^pe)+Fe[2]:ee<64?X(ae,le,pe)+Fe[3]:(ae^(le|~pe))+Fe[4],ve=(ve=L(ve|=0,it[ee]))+_e|0,re=_e,_e=pe,pe=L(le,10),le=ae,ae=ve,ve=pt+J[Z+He[ee]]|0,ve+=ee<16?(mt^(It|~St))+qe[0]:ee<32?X(mt,It,St)+qe[1]:ee<48?((mt|~It)^St)+qe[2]:ee<64?K(mt,It,St)+qe[3]:(mt^It^St)+qe[4],ve=(ve=L(ve|=0,ot[ee]))+Mt|0,pt=Mt,Mt=St,St=L(It,10),It=mt,mt=ve;ve=ye[1]+le+St|0,ye[1]=ye[2]+pe+Mt|0,ye[2]=ye[3]+_e+pt|0,ye[3]=ye[4]+re+mt|0,ye[4]=ye[0]+ae+It|0,ye[0]=ve},_doFinalize:function(){var J=this._data,Z=J.words,ee=8*this._nDataBytes,ne=8*J.sigBytes;Z[ne>>>5]|=128<<24-ne%32,Z[14+(64+ne>>>9<<4)]=16711935&(ee<<8|ee>>>24)|4278255360&(ee<<24|ee>>>8),J.sigBytes=4*(Z.length+1),this._process();for(var se=(Z=this._hash).words,re=0;re<5;re++){var ae=se[re];se[re]=16711935&(ae<<8|ae>>>24)|4278255360&(ae<<24|ae>>>8)}return Z},clone:function(){var J=He.clone.call(this);return J._hash=this._hash.clone(),J}}),St.RIPEMD160=He._createHelper(kt),St.HmacRIPEMD160=He._createHmacHelper(kt),Ut=(Lt=$t).lib.Base,it=Lt.enc.Utf8,Lt.algo.HMAC=Ut.extend({init:function(J,Z){J=this._hasher=new J.init,"string"==typeof Z&&(Z=it.parse(Z));var ee=J.blockSize,ne=4*ee;(Z=Z.sigBytes>ne?J.finalize(Z):Z).clamp(),J=this._oKey=Z.clone(),Z=this._iKey=Z.clone();for(var se=J.words,re=Z.words,ae=0;ae<ee;ae++)se[ae]^=1549556828,re[ae]^=909522486;J.sigBytes=Z.sigBytes=ne,this.reset()},reset:function(){var J=this._hasher;J.reset(),J.update(this._iKey)},update:function(J){return this._hasher.update(J),this},finalize:function(J){var Z=this._hasher;return J=Z.finalize(J),Z.reset(),Z.finalize(this._oKey.clone().concat(J))}}),kt=(St=$t).lib,Lt=kt.Base,ot=kt.WordArray,Ut=St.algo,kt=Ut.SHA1,pt=Ut.HMAC,mt=Ut.PBKDF2=Lt.extend({cfg:Lt.extend({keySize:4,hasher:kt,iterations:1}),init:function(J){this.cfg=this.cfg.extend(J)},compute:function(J,Z){for(var ee=this.cfg,ne=pt.create(ee.hasher,J),se=ot.create(),re=ot.create([1]),ae=se.words,le=re.words,pe=ee.keySize,_e=ee.iterations;ae.length<pe;){var ve=ne.update(Z).finalize(re);ne.reset();for(var ye=ve.words,Fe=ye.length,qe=ve,$e=1;$e<_e;$e++){qe=ne.finalize(qe),ne.reset();for(var He=qe.words,Ye=0;Ye<Fe;Ye++)ye[Ye]^=He[Ye]}se.concat(ve),le[0]++}return se.sigBytes=4*pe,se}}),St.PBKDF2=function(J,Z,ee){return mt.create(ee).compute(J,Z)},Lt=(Ut=$t).lib,kt=Lt.Base,It=Lt.WordArray,St=Ut.algo,Lt=St.MD5,Mt=St.EvpKDF=kt.extend({cfg:kt.extend({keySize:4,hasher:Lt,iterations:1}),init:function(J){this.cfg=this.cfg.extend(J)},compute:function(J,Z){for(var ee,ne=this.cfg,se=ne.hasher.create(),re=It.create(),ae=re.words,le=ne.keySize,pe=ne.iterations;ae.length<le;){ee&&se.update(ee),ee=se.update(J).finalize(Z),se.reset();for(var _e=1;_e<pe;_e++)ee=se.finalize(ee),se.reset();re.concat(ee)}return re.sigBytes=4*le,re}}),Ut.EvpKDF=function(J,Z,ee){return Mt.create(ee).compute(J,Z)},$t.lib.Cipher||function(){var J=(ye=$t).lib,Z=J.Base,ee=J.WordArray,ne=J.BufferedBlockAlgorithm,se=((pe=ye.enc).Utf8,pe.Base64),re=ye.algo.EvpKDF,ae=J.Cipher=ne.extend({cfg:Z.extend(),createEncryptor:function(J,Z){return this.create(this._ENC_XFORM_MODE,J,Z)},createDecryptor:function(J,Z){return this.create(this._DEC_XFORM_MODE,J,Z)},init:function(J,Z,ee){this.cfg=this.cfg.extend(ee),this._xformMode=J,this._key=Z,this.reset()},reset:function(){ne.reset.call(this),this._doReset()},process:function(J){return this._append(J),this._process()},finalize:function(J){return J&&this._append(J),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(J){return{encrypt:function(Z,ee,ne){return h(ee).encrypt(J,Z,ee,ne)},decrypt:function(Z,ee,ne){return h(ee).decrypt(J,Z,ee,ne)}}}});function h(J){return"string"==typeof J?Fe:ve}J.StreamCipher=ae.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var le=ye.mode={},pe=J.BlockCipherMode=Z.extend({createEncryptor:function(J,Z){return this.Encryptor.create(J,Z)},createDecryptor:function(J,Z){return this.Decryptor.create(J,Z)},init:function(J,Z){this._cipher=J,this._iv=Z}});function f(J,Z,ee){var ne,se=this._iv;se?(ne=se,this._iv=void 0):ne=this._prevBlock;for(var re=0;re<ee;re++)J[Z+re]^=ne[re]}pe=le.CBC=((le=pe.extend()).Encryptor=le.extend({processBlock:function(J,Z){var ee=this._cipher,ne=ee.blockSize;f.call(this,J,Z,ne),ee.encryptBlock(J,Z),this._prevBlock=J.slice(Z,Z+ne)}}),le.Decryptor=le.extend({processBlock:function(J,Z){var ee=this._cipher,ne=ee.blockSize,se=J.slice(Z,Z+ne);ee.decryptBlock(J,Z),f.call(this,J,Z,ne),this._prevBlock=se}}),le),le=(ye.pad={}).Pkcs7={pad:function(J,Z){for(var ne=(Z*=4)-J.sigBytes%Z,se=ne<<24|ne<<16|ne<<8|ne,re=[],ae=0;ae<ne;ae+=4)re.push(se);Z=ee.create(re,ne),J.concat(Z)},unpad:function(J){var Z=255&J.words[J.sigBytes-1>>>2];J.sigBytes-=Z}};var _e=(J.BlockCipher=ae.extend({cfg:ae.cfg.extend({mode:pe,padding:le}),reset:function(){var J;ae.reset.call(this);var Z=(ee=this.cfg).iv,ee=ee.mode;this._xformMode==this._ENC_XFORM_MODE?J=ee.createEncryptor:(J=ee.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==J?this._mode.init(this,Z&&Z.words):(this._mode=J.call(ee,this,Z&&Z.words),this._mode.__creator=J)},_doProcessBlock:function(J,Z){this._mode.processBlock(J,Z)},_doFinalize:function(){var J,Z=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(Z.pad(this._data,this.blockSize),J=this._process(!0)):(J=this._process(!0),Z.unpad(J)),J},blockSize:4}),J.CipherParams=Z.extend({init:function(J){this.mixIn(J)},toString:function(J){return(J||this.formatter).stringify(this)}})),ve=(le=(ye.format={}).OpenSSL={stringify:function(J){var Z=J.ciphertext;return(Z=(J=J.salt)?ee.create([1398893684,1701076831]).concat(J).concat(Z):Z).toString(se)},parse:function(J){var Z,ne=se.parse(J);return 1398893684==(J=ne.words)[0]&&1701076831==J[1]&&(Z=ee.create(J.slice(2,4)),J.splice(0,4),ne.sigBytes-=16),_e.create({ciphertext:ne,salt:Z})}},J.SerializableCipher=Z.extend({cfg:Z.extend({format:le}),encrypt:function(J,Z,ee,ne){ne=this.cfg.extend(ne),Z=(se=J.createEncryptor(ee,ne)).finalize(Z);var se=se.cfg;return _e.create({ciphertext:Z,key:ee,iv:se.iv,algorithm:J,mode:se.mode,padding:se.padding,blockSize:J.blockSize,formatter:ne.format})},decrypt:function(J,Z,ee,ne){return ne=this.cfg.extend(ne),Z=this._parse(Z,ne.format),J.createDecryptor(ee,ne).finalize(Z.ciphertext)},_parse:function(J,Z){return"string"==typeof J?Z.parse(J,this):J}})),ye=(ye.kdf={}).OpenSSL={execute:function(J,Z,ne,se){return se=se||ee.random(8),J=re.create({keySize:Z+ne}).compute(J,se),ne=ee.create(J.words.slice(Z),4*ne),J.sigBytes=4*Z,_e.create({key:J,iv:ne,salt:se})}},Fe=J.PasswordBasedCipher=ve.extend({cfg:ve.cfg.extend({kdf:ye}),encrypt:function(J,Z,ee,ne){return ee=(ne=this.cfg.extend(ne)).kdf.execute(ee,J.keySize,J.ivSize),ne.iv=ee.iv,(ne=ve.encrypt.call(this,J,Z,ee.key,ne)).mixIn(ee),ne},decrypt:function(J,Z,ee,ne){return ne=this.cfg.extend(ne),Z=this._parse(Z,ne.format),ee=ne.kdf.execute(ee,J.keySize,J.ivSize,Z.salt),ne.iv=ee.iv,ve.decrypt.call(this,J,Z,ee.key,ne)}})}(),$t.mode.CFB=((kt=$t.lib.BlockCipherMode.extend()).Encryptor=kt.extend({processBlock:function(J,Z){var ee=this._cipher,ne=ee.blockSize;j.call(this,J,Z,ne,ee),this._prevBlock=J.slice(Z,Z+ne)}}),kt.Decryptor=kt.extend({processBlock:function(J,Z){var ee=this._cipher,ne=ee.blockSize,se=J.slice(Z,Z+ne);j.call(this,J,Z,ne,ee),this._prevBlock=se}}),kt),$t.mode.CTR=(Lt=$t.lib.BlockCipherMode.extend(),Ut=Lt.Encryptor=Lt.extend({processBlock:function(J,Z){var ee=this._cipher,ne=ee.blockSize,se=this._iv,re=this._counter;se&&(re=this._counter=se.slice(0),this._iv=void 0);var ae=re.slice(0);ee.encryptBlock(ae,0),re[ne-1]=re[ne-1]+1|0;for(var le=0;le<ne;le++)J[Z+le]^=ae[le]}}),Lt.Decryptor=Ut,Lt),$t.mode.CTRGladman=(kt=$t.lib.BlockCipherMode.extend(),Ut=kt.Encryptor=kt.extend({processBlock:function(J,Z){var ee=this._cipher,ne=ee.blockSize,se=this._iv,re=this._counter;se&&(re=this._counter=se.slice(0),this._iv=void 0),0===((se=re)[0]=T(se[0]))&&(se[1]=T(se[1]));var ae=re.slice(0);ee.encryptBlock(ae,0);for(var le=0;le<ne;le++)J[Z+le]^=ae[le]}}),kt.Decryptor=Ut,kt),$t.mode.OFB=(Lt=$t.lib.BlockCipherMode.extend(),Ut=Lt.Encryptor=Lt.extend({processBlock:function(J,Z){var ee=this._cipher,ne=ee.blockSize,se=this._iv,re=this._keystream;se&&(re=this._keystream=se.slice(0),this._iv=void 0),ee.encryptBlock(re,0);for(var ae=0;ae<ne;ae++)J[Z+ae]^=re[ae]}}),Lt.Decryptor=Ut,Lt),$t.mode.ECB=((kt=$t.lib.BlockCipherMode.extend()).Encryptor=kt.extend({processBlock:function(J,Z){this._cipher.encryptBlock(J,Z)}}),kt.Decryptor=kt.extend({processBlock:function(J,Z){this._cipher.decryptBlock(J,Z)}}),kt),$t.pad.AnsiX923={pad:function(J,Z){var ee=(ee=J.sigBytes)+(Z=(Z*=4)-ee%Z)-1;J.clamp(),J.words[ee>>>2]|=Z<<24-ee%4*8,J.sigBytes+=Z},unpad:function(J){var Z=255&J.words[J.sigBytes-1>>>2];J.sigBytes-=Z}},$t.pad.Iso10126={pad:function(J,Z){Z*=4,Z-=J.sigBytes%Z,J.concat($t.lib.WordArray.random(Z-1)).concat($t.lib.WordArray.create([Z<<24],1))},unpad:function(J){var Z=255&J.words[J.sigBytes-1>>>2];J.sigBytes-=Z}},$t.pad.Iso97971={pad:function(J,Z){J.concat($t.lib.WordArray.create([2147483648],1)),$t.pad.ZeroPadding.pad(J,Z)},unpad:function(J){$t.pad.ZeroPadding.unpad(J),J.sigBytes--}},$t.pad.ZeroPadding={pad:function(J,Z){Z*=4,J.clamp(),J.sigBytes+=Z-(J.sigBytes%Z||Z)},unpad:function(J){var Z=J.words,ee=J.sigBytes-1;for(ee=J.sigBytes-1;0<=ee;ee--)if(Z[ee>>>2]>>>24-ee%4*8&255){J.sigBytes=ee+1;break}}},$t.pad.NoPadding={pad:function(){},unpad:function(){}},bt=(Ut=$t).lib.CipherParams,At=Ut.enc.Hex,Ut.format.Hex={stringify:function(J){return J.ciphertext.toString(At)},parse:function(J){return J=At.parse(J),bt.create({ciphertext:J})}},function(){var J=$t,Z=J.lib.BlockCipher,ee=J.algo,ne=[],se=[],re=[],ae=[],le=[],pe=[],_e=[],ve=[],ye=[],Fe=[];!function(){for(var J=[],Z=0;Z<256;Z++)J[Z]=Z<128?Z<<1:Z<<1^283;var ee=0,qe=0;for(Z=0;Z<256;Z++){var $e=qe^qe<<1^qe<<2^qe<<3^qe<<4;ne[ee]=$e=$e>>>8^255&$e^99;var He=J[se[$e]=ee],Ye=J[He],Je=J[Ye],Xe=257*J[$e]^16843008*$e;re[ee]=Xe<<24|Xe>>>8,ae[ee]=Xe<<16|Xe>>>16,le[ee]=Xe<<8|Xe>>>24,pe[ee]=Xe,_e[$e]=(Xe=16843009*Je^65537*Ye^257*He^16843008*ee)<<24|Xe>>>8,ve[$e]=Xe<<16|Xe>>>16,ye[$e]=Xe<<8|Xe>>>24,Fe[$e]=Xe,ee?(ee=He^J[J[J[Je^He]]],qe^=J[J[qe]]):ee=qe=1}}();var qe=[0,1,2,4,8,16,32,64,128,27,54];ee=ee.AES=Z.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var J=this._keyPriorReset=this._key,Z=J.words,ee=J.sigBytes/4,se=4*(1+(this._nRounds=6+ee)),re=this._keySchedule=[],ae=0;ae<se;ae++)ae<ee?re[ae]=Z[ae]:($e=re[ae-1],ae%ee?6<ee&&ae%ee==4&&($e=ne[$e>>>24]<<24|ne[$e>>>16&255]<<16|ne[$e>>>8&255]<<8|ne[255&$e]):($e=ne[($e=$e<<8|$e>>>24)>>>24]<<24|ne[$e>>>16&255]<<16|ne[$e>>>8&255]<<8|ne[255&$e],$e^=qe[ae/ee|0]<<24),re[ae]=re[ae-ee]^$e);for(var le=this._invKeySchedule=[],pe=0;pe<se;pe++){var $e;ae=se-pe,$e=pe%4?re[ae]:re[ae-4],le[pe]=pe<4||ae<=4?$e:_e[ne[$e>>>24]]^ve[ne[$e>>>16&255]]^ye[ne[$e>>>8&255]]^Fe[ne[255&$e]]}}},encryptBlock:function(J,Z){this._doCryptBlock(J,Z,this._keySchedule,re,ae,le,pe,ne)},decryptBlock:function(J,Z){var ee=J[Z+1];J[Z+1]=J[Z+3],J[Z+3]=ee,this._doCryptBlock(J,Z,this._invKeySchedule,_e,ve,ye,Fe,se),ee=J[Z+1],J[Z+1]=J[Z+3],J[Z+3]=ee},_doCryptBlock:function(J,Z,ee,ne,se,re,ae,le){for(var pe=this._nRounds,_e=J[Z]^ee[0],ve=J[Z+1]^ee[1],ye=J[Z+2]^ee[2],Fe=J[Z+3]^ee[3],qe=4,$e=1;$e<pe;$e++){var He=ne[_e>>>24]^se[ve>>>16&255]^re[ye>>>8&255]^ae[255&Fe]^ee[qe++],Ye=ne[ve>>>24]^se[ye>>>16&255]^re[Fe>>>8&255]^ae[255&_e]^ee[qe++],Je=ne[ye>>>24]^se[Fe>>>16&255]^re[_e>>>8&255]^ae[255&ve]^ee[qe++],Xe=ne[Fe>>>24]^se[_e>>>16&255]^re[ve>>>8&255]^ae[255&ye]^ee[qe++];_e=He,ve=Ye,ye=Je,Fe=Xe}He=(le[_e>>>24]<<24|le[ve>>>16&255]<<16|le[ye>>>8&255]<<8|le[255&Fe])^ee[qe++],Ye=(le[ve>>>24]<<24|le[ye>>>16&255]<<16|le[Fe>>>8&255]<<8|le[255&_e])^ee[qe++],Je=(le[ye>>>24]<<24|le[Fe>>>16&255]<<16|le[_e>>>8&255]<<8|le[255&ve])^ee[qe++],Xe=(le[Fe>>>24]<<24|le[_e>>>16&255]<<16|le[ve>>>8&255]<<8|le[255&ye])^ee[qe++],J[Z]=He,J[Z+1]=Ye,J[Z+2]=Je,J[Z+3]=Xe},keySize:8}),J.AES=Z._createHelper(ee)}(),function(){var J=$t,Z=(ne=J.lib).WordArray,ee=ne.BlockCipher,ne=J.algo,se=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],re=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],ae=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],le=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],pe=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],_e=ne.DES=ee.extend({_doReset:function(){for(var J=this._key.words,Z=[],ee=0;ee<56;ee++){var ne=se[ee]-1;Z[ee]=J[ne>>>5]>>>31-ne%32&1}for(var le=this._subKeys=[],pe=0;pe<16;pe++){var _e=le[pe]=[],ve=ae[pe];for(ee=0;ee<24;ee++)_e[ee/6|0]|=Z[(re[ee]-1+ve)%28]<<31-ee%6,_e[4+(ee/6|0)]|=Z[28+(re[ee+24]-1+ve)%28]<<31-ee%6;for(_e[0]=_e[0]<<1|_e[0]>>>31,ee=1;ee<7;ee++)_e[ee]=_e[ee]>>>4*(ee-1)+3;_e[7]=_e[7]<<5|_e[7]>>>27}var ye=this._invSubKeys=[];for(ee=0;ee<16;ee++)ye[ee]=le[15-ee]},encryptBlock:function(J,Z){this._doCryptBlock(J,Z,this._subKeys)},decryptBlock:function(J,Z){this._doCryptBlock(J,Z,this._invSubKeys)},_doCryptBlock:function(J,Z,ee){this._lBlock=J[Z],this._rBlock=J[Z+1],p.call(this,4,252645135),p.call(this,16,65535),_.call(this,2,858993459),_.call(this,8,16711935),p.call(this,1,1431655765);for(var ne=0;ne<16;ne++){for(var se=ee[ne],re=this._lBlock,ae=this._rBlock,_e=0,ve=0;ve<8;ve++)_e|=le[ve][((ae^se[ve])&pe[ve])>>>0];this._lBlock=ae,this._rBlock=re^_e}var ye=this._lBlock;this._lBlock=this._rBlock,this._rBlock=ye,p.call(this,1,1431655765),_.call(this,8,16711935),_.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),J[Z]=this._lBlock,J[Z+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(J,Z){Z=(this._lBlock>>>J^this._rBlock)&Z,this._rBlock^=Z,this._lBlock^=Z<<J}function _(J,Z){Z=(this._rBlock>>>J^this._lBlock)&Z,this._lBlock^=Z,this._rBlock^=Z<<J}J.DES=ee._createHelper(_e),ne=ne.TripleDES=ee.extend({_doReset:function(){if(2!==(ne=this._key.words).length&&4!==ne.length&&ne.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var J=ne.slice(0,2),ee=ne.length<4?ne.slice(0,2):ne.slice(2,4),ne=ne.length<6?ne.slice(0,2):ne.slice(4,6);this._des1=_e.createEncryptor(Z.create(J)),this._des2=_e.createEncryptor(Z.create(ee)),this._des3=_e.createEncryptor(Z.create(ne))},encryptBlock:function(J,Z){this._des1.encryptBlock(J,Z),this._des2.decryptBlock(J,Z),this._des3.encryptBlock(J,Z)},decryptBlock:function(J,Z){this._des3.decryptBlock(J,Z),this._des2.encryptBlock(J,Z),this._des1.decryptBlock(J,Z)},keySize:6,ivSize:2,blockSize:2}),J.TripleDES=ee._createHelper(ne)}(),function(){var J=$t,Z=J.lib.StreamCipher,ee=J.algo,ne=ee.RC4=Z.extend({_doReset:function(){for(var J=this._key,Z=J.words,ee=J.sigBytes,ne=this._S=[],se=0;se<256;se++)ne[se]=se;se=0;for(var re=0;se<256;se++){var ae=Z[(ae=se%ee)>>>2]>>>24-ae%4*8&255;re=(re+ne[se]+ae)%256,ae=ne[se],ne[se]=ne[re],ne[re]=ae}this._i=this._j=0},_doProcessBlock:function(J,Z){J[Z]^=n.call(this)},keySize:8,ivSize:0});function n(){for(var J=this._S,Z=this._i,ee=this._j,ne=0,se=0;se<4;se++){ee=(ee+J[Z=(Z+1)%256])%256;var re=J[Z];J[Z]=J[ee],J[ee]=re,ne|=J[(J[Z]+J[ee])%256]<<24-8*se}return this._i=Z,this._j=ee,ne}J.RC4=Z._createHelper(ne),ee=ee.RC4Drop=ne.extend({cfg:ne.cfg.extend({drop:192}),_doReset:function(){ne._doReset.call(this);for(var J=this.cfg.drop;0<J;J--)n.call(this)}}),J.RC4Drop=Z._createHelper(ee)}(),kt=(Lt=$t).lib.StreamCipher,Ut=Lt.algo,Ot=[],wt=[],Dt=[],Ut=Ut.Rabbit=kt.extend({_doReset:function(){for(var J=this._key.words,Z=this.cfg.iv,ee=0;ee<4;ee++)J[ee]=16711935&(J[ee]<<8|J[ee]>>>24)|4278255360&(J[ee]<<24|J[ee]>>>8);var ne=this._X=[J[0],J[3]<<16|J[2]>>>16,J[1],J[0]<<16|J[3]>>>16,J[2],J[1]<<16|J[0]>>>16,J[3],J[2]<<16|J[1]>>>16],se=this._C=[J[2]<<16|J[2]>>>16,4294901760&J[0]|65535&J[1],J[3]<<16|J[3]>>>16,4294901760&J[1]|65535&J[2],J[0]<<16|J[0]>>>16,4294901760&J[2]|65535&J[3],J[1]<<16|J[1]>>>16,4294901760&J[3]|65535&J[0]];for(ee=this._b=0;ee<4;ee++)N.call(this);for(ee=0;ee<8;ee++)se[ee]^=ne[ee+4&7];if(Z){var re,ae=(Z=16711935&((ae=(re=Z.words)[0])<<8|ae>>>24)|4278255360&(ae<<24|ae>>>8))>>>16|4294901760&(re=16711935&((le=re[1])<<8|le>>>24)|4278255360&(le<<24|le>>>8)),le=re<<16|65535&Z;for(se[0]^=Z,se[1]^=ae,se[2]^=re,se[3]^=le,se[4]^=Z,se[5]^=ae,se[6]^=re,se[7]^=le,ee=0;ee<4;ee++)N.call(this)}},_doProcessBlock:function(J,Z){var ee=this._X;N.call(this),Ot[0]=ee[0]^ee[5]>>>16^ee[3]<<16,Ot[1]=ee[2]^ee[7]>>>16^ee[5]<<16,Ot[2]=ee[4]^ee[1]>>>16^ee[7]<<16,Ot[3]=ee[6]^ee[3]>>>16^ee[1]<<16;for(var ne=0;ne<4;ne++)Ot[ne]=16711935&(Ot[ne]<<8|Ot[ne]>>>24)|4278255360&(Ot[ne]<<24|Ot[ne]>>>8),J[Z+ne]^=Ot[ne]},blockSize:4,ivSize:2}),Lt.Rabbit=kt._createHelper(Ut),kt=(Lt=$t).lib.StreamCipher,Ut=Lt.algo,Gt=[],xt=[],Ft=[],Ut=Ut.RabbitLegacy=kt.extend({_doReset:function(){for(var J=this._key.words,Z=this.cfg.iv,ee=this._X=[J[0],J[3]<<16|J[2]>>>16,J[1],J[0]<<16|J[3]>>>16,J[2],J[1]<<16|J[0]>>>16,J[3],J[2]<<16|J[1]>>>16],ne=this._C=[J[2]<<16|J[2]>>>16,4294901760&J[0]|65535&J[1],J[3]<<16|J[3]>>>16,4294901760&J[1]|65535&J[2],J[0]<<16|J[0]>>>16,4294901760&J[2]|65535&J[3],J[1]<<16|J[1]>>>16,4294901760&J[3]|65535&J[0]],se=this._b=0;se<4;se++)q.call(this);for(se=0;se<8;se++)ne[se]^=ee[se+4&7];if(Z){var re,ae=(Z=16711935&((ae=(re=Z.words)[0])<<8|ae>>>24)|4278255360&(ae<<24|ae>>>8))>>>16|4294901760&(re=16711935&((J=re[1])<<8|J>>>24)|4278255360&(J<<24|J>>>8));for(J=re<<16|65535&Z,ne[0]^=Z,ne[1]^=ae,ne[2]^=re,ne[3]^=J,ne[4]^=Z,ne[5]^=ae,ne[6]^=re,ne[7]^=J,se=0;se<4;se++)q.call(this)}},_doProcessBlock:function(J,Z){var ee=this._X;q.call(this),Gt[0]=ee[0]^ee[5]>>>16^ee[3]<<16,Gt[1]=ee[2]^ee[7]>>>16^ee[5]<<16,Gt[2]=ee[4]^ee[1]>>>16^ee[7]<<16,Gt[3]=ee[6]^ee[3]>>>16^ee[1]<<16;for(var ne=0;ne<4;ne++)Gt[ne]=16711935&(Gt[ne]<<8|Gt[ne]>>>24)|4278255360&(Gt[ne]<<24|Gt[ne]>>>8),J[Z+ne]^=Gt[ne]},blockSize:4,ivSize:2}),Lt.RabbitLegacy=kt._createHelper(Ut),$t}()},241:function(J){window,J.exports=function(J){var Z={};function r(ee){if(Z[ee])return Z[ee].exports;var ne=Z[ee]={i:ee,l:!1,exports:{}};return J[ee].call(ne.exports,ne,ne.exports,r),ne.l=!0,ne.exports}return r.m=J,r.c=Z,r.d=function(J,Z,ee){r.o(J,Z)||Object.defineProperty(J,Z,{enumerable:!0,get:ee})},r.r=function(J){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(J,"__esModule",{value:!0})},r.t=function(J,Z){if(1&Z&&(J=r(J)),8&Z)return J;if(4&Z&&"object"==typeof J&&J&&J.__esModule)return J;var ee=Object.create(null);if(r.r(ee),Object.defineProperty(ee,"default",{enumerable:!0,value:J}),2&Z&&"string"!=typeof J)for(var ne in J)r.d(ee,ne,function(Z){return J[Z]}.bind(null,ne));return ee},r.n=function(J){var Z=J&&J.__esModule?function(){return J.default}:function(){return J};return r.d(Z,"a",Z),Z},r.o=function(J,Z){return Object.prototype.hasOwnProperty.call(J,Z)},r.p="",r(r.s=18)}([function(J,Z){J.exports=function(){return function(){}}},function(J,Z,ee){function n(J){if(J)return function(J){for(var Z in n.prototype)J[Z]=n.prototype[Z];return J}(J)}J.exports=n,n.prototype.on=n.prototype.addEventListener=function(J,Z){return this._callbacks=this._callbacks||{},(this._callbacks["$"+J]=this._callbacks["$"+J]||[]).push(Z),this},n.prototype.once=function(J,Z){function r(){this.off(J,r),Z.apply(this,arguments)}return r.fn=Z,this.on(J,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(J,Z){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var ee,ne=this._callbacks["$"+J];if(!ne)return this;if(1==arguments.length)return delete this._callbacks["$"+J],this;for(var se=0;se<ne.length;se++)if((ee=ne[se])===Z||ee.fn===Z){ne.splice(se,1);break}return this},n.prototype.emit=function(J){this._callbacks=this._callbacks||{};var Z=[].slice.call(arguments,1),ee=this._callbacks["$"+J];if(ee)for(var ne=0,se=(ee=ee.slice(0)).length;ne<se;++ne)ee[ne].apply(this,Z);return this},n.prototype.listeners=function(J){return this._callbacks=this._callbacks||{},this._callbacks["$"+J]||[]},n.prototype.hasListeners=function(J){return!!this.listeners(J).length}},function(J,Z,ee){var ne,se=ee(28),re=ee(13),ae=ee(30),le=ee(31),pe=ee(32);"undefined"!=typeof ArrayBuffer&&(ne=ee(33));var _e="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),ve="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),ye=_e||ve;Z.protocol=3;var Fe=Z.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},qe=se(Fe),$e={type:"error",data:"parser error"},He=ee(34);function g(J,Z,ee){for(var ne=new Array(J.length),se=le(J.length,ee),i=function(J,ee,se){Z(ee,(function(Z,ee){ne[J]=ee,se(Z,ne)}))},re=0;re<J.length;re++)i(re,J[re],se)}Z.encodePacket=function(J,ee,ne,se){"function"==typeof ee&&(se=ee,ee=!1),"function"==typeof ne&&(se=ne,ne=null);var re=void 0===J.data?void 0:J.data.buffer||J.data;if("undefined"!=typeof ArrayBuffer&&re instanceof ArrayBuffer)return function(J,ee,ne){if(!ee)return Z.encodeBase64Packet(J,ne);var se=J.data,re=new Uint8Array(se),ae=new Uint8Array(1+se.byteLength);ae[0]=Fe[J.type];for(var le=0;le<re.length;le++)ae[le+1]=re[le];return ne(ae.buffer)}(J,ee,se);if(void 0!==He&&re instanceof He)return function(J,ee,ne){if(!ee)return Z.encodeBase64Packet(J,ne);if(ye)return function(J,ee,ne){if(!ee)return Z.encodeBase64Packet(J,ne);var se=new FileReader;return se.onload=function(){Z.encodePacket({type:J.type,data:se.result},ee,!0,ne)},se.readAsArrayBuffer(J.data)}(J,ee,ne);var se=new Uint8Array(1);return se[0]=Fe[J.type],ne(new He([se.buffer,J.data]))}(J,ee,se);if(re&&re.base64)return function(J,ee){return ee("b"+Z.packets[J.type]+J.data.data)}(J,se);var ae=Fe[J.type];return void 0!==J.data&&(ae+=ne?pe.encode(String(J.data),{strict:!1}):String(J.data)),se(""+ae)},Z.encodeBase64Packet=function(J,ee){var ne,se="b"+Z.packets[J.type];if(void 0!==He&&J.data instanceof He){var re=new FileReader;return re.onload=function(){var J=re.result.split(",")[1];ee(se+J)},re.readAsDataURL(J.data)}try{ne=String.fromCharCode.apply(null,new Uint8Array(J.data))}catch(Z){for(var ae=new Uint8Array(J.data),le=new Array(ae.length),pe=0;pe<ae.length;pe++)le[pe]=ae[pe];ne=String.fromCharCode.apply(null,le)}return se+=btoa(ne),ee(se)},Z.decodePacket=function(J,ee,ne){if(void 0===J)return $e;if("string"==typeof J){if("b"===J.charAt(0))return Z.decodeBase64Packet(J.substr(1),ee);if(ne&&!1===(J=function(J){try{J=pe.decode(J,{strict:!1})}catch(J){return!1}return J}(J)))return $e;var se=J.charAt(0);return Number(se)==se&&qe[se]?J.length>1?{type:qe[se],data:J.substring(1)}:{type:qe[se]}:$e}se=new Uint8Array(J)[0];var re=ae(J,1);return He&&"blob"===ee&&(re=new He([re])),{type:qe[se],data:re}},Z.decodeBase64Packet=function(J,Z){var ee=qe[J.charAt(0)];if(!ne)return{type:ee,data:{base64:!0,data:J.substr(1)}};var se=ne.decode(J.substr(1));return"blob"===Z&&He&&(se=new He([se])),{type:ee,data:se}},Z.encodePayload=function(J,ee,ne){"function"==typeof ee&&(ne=ee,ee=null);var se=re(J);return ee&&se?He&&!ye?Z.encodePayloadAsBlob(J,ne):Z.encodePayloadAsArrayBuffer(J,ne):J.length?void g(J,(function(J,ne){Z.encodePacket(J,!!se&&ee,!1,(function(J){ne(null,function(J){return J.length+":"+J}(J))}))}),(function(J,Z){return ne(Z.join(""))})):ne("0:")},Z.decodePayload=function(J,ee,ne){if("string"!=typeof J)return Z.decodePayloadAsBinary(J,ee,ne);var se;if("function"==typeof ee&&(ne=ee,ee=null),""===J)return ne($e,0,1);for(var re,ae,le="",pe=0,_e=J.length;pe<_e;pe++){var ve=J.charAt(pe);if(":"===ve){if(""===le||le!=(re=Number(le)))return ne($e,0,1);if(le!=(ae=J.substr(pe+1,re)).length)return ne($e,0,1);if(ae.length){if(se=Z.decodePacket(ae,ee,!1),$e.type===se.type&&$e.data===se.data)return ne($e,0,1);if(!1===ne(se,pe+re,_e))return}pe+=re,le=""}else le+=ve}return""!==le?ne($e,0,1):void 0},Z.encodePayloadAsArrayBuffer=function(J,ee){if(!J.length)return ee(new ArrayBuffer(0));g(J,(function(J,ee){Z.encodePacket(J,!0,!0,(function(J){return ee(null,J)}))}),(function(J,Z){var ne=Z.reduce((function(J,Z){var ee;return J+(ee="string"==typeof Z?Z.length:Z.byteLength).toString().length+ee+2}),0),se=new Uint8Array(ne),re=0;return Z.forEach((function(J){var Z="string"==typeof J,ee=J;if(Z){for(var ne=new Uint8Array(J.length),ae=0;ae<J.length;ae++)ne[ae]=J.charCodeAt(ae);ee=ne.buffer}se[re++]=Z?0:1;var le=ee.byteLength.toString();for(ae=0;ae<le.length;ae++)se[re++]=parseInt(le[ae]);for(se[re++]=255,ne=new Uint8Array(ee),ae=0;ae<ne.length;ae++)se[re++]=ne[ae]})),ee(se.buffer)}))},Z.encodePayloadAsBlob=function(J,ee){g(J,(function(J,ee){Z.encodePacket(J,!0,!0,(function(J){var Z=new Uint8Array(1);if(Z[0]=1,"string"==typeof J){for(var ne=new Uint8Array(J.length),se=0;se<J.length;se++)ne[se]=J.charCodeAt(se);J=ne.buffer,Z[0]=0}var re=(J instanceof ArrayBuffer?J.byteLength:J.size).toString(),ae=new Uint8Array(re.length+1);for(se=0;se<re.length;se++)ae[se]=parseInt(re[se]);if(ae[re.length]=255,He){var le=new He([Z.buffer,ae.buffer,J]);ee(null,le)}}))}),(function(J,Z){return ee(new He(Z))}))},Z.decodePayloadAsBinary=function(J,ee,ne){"function"==typeof ee&&(ne=ee,ee=null);for(var se=J,re=[];se.byteLength>0;){for(var le=new Uint8Array(se),pe=0===le[0],_e="",ve=1;255!==le[ve];ve++){if(_e.length>310)return ne($e,0,1);_e+=le[ve]}se=ae(se,2+_e.length),_e=parseInt(_e);var ye=ae(se,0,_e);if(pe)try{ye=String.fromCharCode.apply(null,new Uint8Array(ye))}catch(J){var Fe=new Uint8Array(ye);for(ye="",ve=0;ve<Fe.length;ve++)ye+=String.fromCharCode(Fe[ve])}re.push(ye),se=ae(se,_e)}var qe=re.length;re.forEach((function(J,se){ne(Z.decodePacket(J,ee,!0),se,qe)}))}},function(J,Z,ee){var ne=ee(0)("socket.io-parser"),se=ee(1),re=ee(21),ae=ee(7),le=ee(8);function c(){}Z.protocol=4,Z.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],Z.CONNECT=0,Z.DISCONNECT=1,Z.EVENT=2,Z.ACK=3,Z.ERROR=4,Z.BINARY_EVENT=5,Z.BINARY_ACK=6,Z.Encoder=c,Z.Decoder=f;var pe=Z.ERROR+'"encode error"';function u(J){var ee=""+J.type;if(Z.BINARY_EVENT!==J.type&&Z.BINARY_ACK!==J.type||(ee+=J.attachments+"-"),J.nsp&&"/"!==J.nsp&&(ee+=J.nsp+","),null!=J.id&&(ee+=J.id),null!=J.data){var se=function(J){try{return JSON.stringify(J)}catch(J){return!1}}(J.data);if(!1===se)return pe;ee+=se}return ne("encoded %j as %s",J,ee),ee}function f(){this.reconstructor=null}function p(J){this.reconPack=J,this.buffers=[]}function l(J){return{type:Z.ERROR,data:"parser error: "+J}}c.prototype.encode=function(J,ee){ne("encoding packet %j",J),Z.BINARY_EVENT===J.type||Z.BINARY_ACK===J.type?function(J,Z){re.removeBlobs(J,(function(J){var ee=re.deconstructPacket(J),ne=u(ee.packet),se=ee.buffers;se.unshift(ne),Z(se)}))}(J,ee):ee([u(J)])},se(f.prototype),f.prototype.add=function(J){var ee;if("string"==typeof J)ee=function(J){var ee=0,se={type:Number(J.charAt(0))};if(null==Z.types[se.type])return l("unknown packet type "+se.type);if(Z.BINARY_EVENT===se.type||Z.BINARY_ACK===se.type){for(var re="";"-"!==J.charAt(++ee)&&(re+=J.charAt(ee),ee!=J.length););if(re!=Number(re)||"-"!==J.charAt(ee))throw new Error("Illegal attachments");se.attachments=Number(re)}if("/"===J.charAt(ee+1))for(se.nsp="";++ee&&","!==(pe=J.charAt(ee))&&(se.nsp+=pe,ee!==J.length););else se.nsp="/";var le=J.charAt(ee+1);if(""!==le&&Number(le)==le){for(se.id="";++ee;){var pe;if(null==(pe=J.charAt(ee))||Number(pe)!=pe){--ee;break}if(se.id+=J.charAt(ee),ee===J.length)break}se.id=Number(se.id)}if(J.charAt(++ee)){var _e=function(J){try{return JSON.parse(J)}catch(J){return!1}}(J.substr(ee));if(!1===_e||se.type!==Z.ERROR&&!ae(_e))return l("invalid payload");se.data=_e}return ne("decoded %s as %j",J,se),se}(J),Z.BINARY_EVENT===ee.type||Z.BINARY_ACK===ee.type?(this.reconstructor=new p(ee),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",ee)):this.emit("decoded",ee);else{if(!le(J)&&!J.base64)throw new Error("Unknown type: "+J);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(ee=this.reconstructor.takeBinaryData(J))&&(this.reconstructor=null,this.emit("decoded",ee))}},f.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.prototype.takeBinaryData=function(J){if(this.buffers.push(J),this.buffers.length===this.reconPack.attachments){var Z=re.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),Z}return null},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(J,Z,ee){"use strict";(function(J){var ne=ee(22),se=ee(23),re=ee(24);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(J,Z){if(s()<Z)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(J=new Uint8Array(Z)).__proto__=c.prototype:(null===J&&(J=new c(Z)),J.length=Z),J}function c(J,Z,ee){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(J,Z,ee);if("number"==typeof J){if("string"==typeof Z)throw new Error("If encoding is specified then the first argument must be a string");return f(this,J)}return h(this,J,Z,ee)}function h(J,Z,ee,ne){if("number"==typeof Z)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&Z instanceof ArrayBuffer?function(J,Z,ee,ne){if(Z.byteLength,ee<0||Z.byteLength<ee)throw new RangeError("'offset' is out of bounds");if(Z.byteLength<ee+(ne||0))throw new RangeError("'length' is out of bounds");return Z=void 0===ee&&void 0===ne?new Uint8Array(Z):void 0===ne?new Uint8Array(Z,ee):new Uint8Array(Z,ee,ne),c.TYPED_ARRAY_SUPPORT?(J=Z).__proto__=c.prototype:J=p(J,Z),J}(J,Z,ee,ne):"string"==typeof Z?function(J,Z,ee){if("string"==typeof ee&&""!==ee||(ee="utf8"),!c.isEncoding(ee))throw new TypeError('"encoding" must be a valid string encoding');var ne=0|d(Z,ee),se=(J=a(J,ne)).write(Z,ee);return se!==ne&&(J=J.slice(0,se)),J}(J,Z,ee):function(J,Z){if(c.isBuffer(Z)){var ee=0|l(Z.length);return 0===(J=a(J,ee)).length||Z.copy(J,0,0,ee),J}if(Z){if("undefined"!=typeof ArrayBuffer&&Z.buffer instanceof ArrayBuffer||"length"in Z)return"number"!=typeof Z.length||(ne=Z.length)!=ne?a(J,0):p(J,Z);if("Buffer"===Z.type&&re(Z.data))return p(J,Z.data)}var ne;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(J,Z)}function u(J){if("number"!=typeof J)throw new TypeError('"size" argument must be a number');if(J<0)throw new RangeError('"size" argument must not be negative')}function f(J,Z){if(u(Z),J=a(J,Z<0?0:0|l(Z)),!c.TYPED_ARRAY_SUPPORT)for(var ee=0;ee<Z;++ee)J[ee]=0;return J}function p(J,Z){var ee=Z.length<0?0:0|l(Z.length);J=a(J,ee);for(var ne=0;ne<ee;ne+=1)J[ne]=255&Z[ne];return J}function l(J){if(J>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|J}function d(J,Z){if(c.isBuffer(J))return J.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(J)||J instanceof ArrayBuffer))return J.byteLength;"string"!=typeof J&&(J=""+J);var ee=J.length;if(0===ee)return 0;for(var ne=!1;;)switch(Z){case"ascii":case"latin1":case"binary":return ee;case"utf8":case"utf-8":case void 0:return q(J).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*ee;case"hex":return ee>>>1;case"base64":return Y(J).length;default:if(ne)return q(J).length;Z=(""+Z).toLowerCase(),ne=!0}}function y(J,Z,ee){var ne=!1;if((void 0===Z||Z<0)&&(Z=0),Z>this.length)return"";if((void 0===ee||ee>this.length)&&(ee=this.length),ee<=0)return"";if((ee>>>=0)<=(Z>>>=0))return"";for(J||(J="utf8");;)switch(J){case"hex":return C(this,Z,ee);case"utf8":case"utf-8":return S(this,Z,ee);case"ascii":return R(this,Z,ee);case"latin1":case"binary":return O(this,Z,ee);case"base64":return B(this,Z,ee);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,Z,ee);default:if(ne)throw new TypeError("Unknown encoding: "+J);J=(J+"").toLowerCase(),ne=!0}}function g(J,Z,ee){var ne=J[Z];J[Z]=J[ee],J[ee]=ne}function v(J,Z,ee,ne,se){if(0===J.length)return-1;if("string"==typeof ee?(ne=ee,ee=0):ee>2147483647?ee=2147483647:ee<-2147483648&&(ee=-2147483648),ee=+ee,isNaN(ee)&&(ee=se?0:J.length-1),ee<0&&(ee=J.length+ee),ee>=J.length){if(se)return-1;ee=J.length-1}else if(ee<0){if(!se)return-1;ee=0}if("string"==typeof Z&&(Z=c.from(Z,ne)),c.isBuffer(Z))return 0===Z.length?-1:m(J,Z,ee,ne,se);if("number"==typeof Z)return Z&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?se?Uint8Array.prototype.indexOf.call(J,Z,ee):Uint8Array.prototype.lastIndexOf.call(J,Z,ee):m(J,[Z],ee,ne,se);throw new TypeError("val must be string, number or Buffer")}function m(J,Z,ee,ne,se){var re,ae=1,le=J.length,pe=Z.length;if(void 0!==ne&&("ucs2"===(ne=String(ne).toLowerCase())||"ucs-2"===ne||"utf16le"===ne||"utf-16le"===ne)){if(J.length<2||Z.length<2)return-1;ae=2,le/=2,pe/=2,ee/=2}function h(J,Z){return 1===ae?J[Z]:J.readUInt16BE(Z*ae)}if(se){var _e=-1;for(re=ee;re<le;re++)if(h(J,re)===h(Z,-1===_e?0:re-_e)){if(-1===_e&&(_e=re),re-_e+1===pe)return _e*ae}else-1!==_e&&(re-=re-_e),_e=-1}else for(ee+pe>le&&(ee=le-pe),re=ee;re>=0;re--){for(var ve=!0,ye=0;ye<pe;ye++)if(h(J,re+ye)!==h(Z,ye)){ve=!1;break}if(ve)return re}return-1}function b(J,Z,ee,ne){ee=Number(ee)||0;var se=J.length-ee;ne?(ne=Number(ne))>se&&(ne=se):ne=se;var re=Z.length;if(re%2!=0)throw new TypeError("Invalid hex string");ne>re/2&&(ne=re/2);for(var ae=0;ae<ne;++ae){var le=parseInt(Z.substr(2*ae,2),16);if(isNaN(le))return ae;J[ee+ae]=le}return ae}function w(J,Z,ee,ne){return F(q(Z,J.length-ee),J,ee,ne)}function A(J,Z,ee,ne){return F(function(J){for(var Z=[],ee=0;ee<J.length;++ee)Z.push(255&J.charCodeAt(ee));return Z}(Z),J,ee,ne)}function k(J,Z,ee,ne){return A(J,Z,ee,ne)}function _(J,Z,ee,ne){return F(Y(Z),J,ee,ne)}function E(J,Z,ee,ne){return F(function(J,Z){for(var ee,ne,se,re=[],ae=0;ae<J.length&&!((Z-=2)<0);++ae)ne=(ee=J.charCodeAt(ae))>>8,se=ee%256,re.push(se),re.push(ne);return re}(Z,J.length-ee),J,ee,ne)}function B(J,Z,ee){return 0===Z&&ee===J.length?ne.fromByteArray(J):ne.fromByteArray(J.slice(Z,ee))}function S(J,Z,ee){ee=Math.min(J.length,ee);for(var ne=[],se=Z;se<ee;){var re,ae,le,pe,_e=J[se],ve=null,ye=_e>239?4:_e>223?3:_e>191?2:1;if(se+ye<=ee)switch(ye){case 1:_e<128&&(ve=_e);break;case 2:128==(192&(re=J[se+1]))&&(pe=(31&_e)<<6|63&re)>127&&(ve=pe);break;case 3:re=J[se+1],ae=J[se+2],128==(192&re)&&128==(192&ae)&&(pe=(15&_e)<<12|(63&re)<<6|63&ae)>2047&&(pe<55296||pe>57343)&&(ve=pe);break;case 4:re=J[se+1],ae=J[se+2],le=J[se+3],128==(192&re)&&128==(192&ae)&&128==(192&le)&&(pe=(15&_e)<<18|(63&re)<<12|(63&ae)<<6|63&le)>65535&&pe<1114112&&(ve=pe)}null===ve?(ve=65533,ye=1):ve>65535&&(ve-=65536,ne.push(ve>>>10&1023|55296),ve=56320|1023&ve),ne.push(ve),se+=ye}return function(J){var Z=J.length;if(Z<=4096)return String.fromCharCode.apply(String,J);for(var ee="",ne=0;ne<Z;)ee+=String.fromCharCode.apply(String,J.slice(ne,ne+=4096));return ee}(ne)}function R(J,Z,ee){var ne="";ee=Math.min(J.length,ee);for(var se=Z;se<ee;++se)ne+=String.fromCharCode(127&J[se]);return ne}function O(J,Z,ee){var ne="";ee=Math.min(J.length,ee);for(var se=Z;se<ee;++se)ne+=String.fromCharCode(J[se]);return ne}function C(J,Z,ee){var ne=J.length;(!Z||Z<0)&&(Z=0),(!ee||ee<0||ee>ne)&&(ee=ne);for(var se="",re=Z;re<ee;++re)se+=D(J[re]);return se}function x(J,Z,ee){for(var ne=J.slice(Z,ee),se="",re=0;re<ne.length;re+=2)se+=String.fromCharCode(ne[re]+256*ne[re+1]);return se}function P(J,Z,ee){if(J%1!=0||J<0)throw new RangeError("offset is not uint");if(J+Z>ee)throw new RangeError("Trying to access beyond buffer length")}function T(J,Z,ee,ne,se,re){if(!c.isBuffer(J))throw new TypeError('"buffer" argument must be a Buffer instance');if(Z>se||Z<re)throw new RangeError('"value" argument is out of bounds');if(ee+ne>J.length)throw new RangeError("Index out of range")}function N(J,Z,ee,ne){Z<0&&(Z=65535+Z+1);for(var se=0,re=Math.min(J.length-ee,2);se<re;++se)J[ee+se]=(Z&255<<8*(ne?se:1-se))>>>8*(ne?se:1-se)}function L(J,Z,ee,ne){Z<0&&(Z=4294967295+Z+1);for(var se=0,re=Math.min(J.length-ee,4);se<re;++se)J[ee+se]=Z>>>8*(ne?se:3-se)&255}function j(J,Z,ee,ne,se,re){if(ee+ne>J.length)throw new RangeError("Index out of range");if(ee<0)throw new RangeError("Index out of range")}function I(J,Z,ee,ne,re){return re||j(J,0,ee,4),se.write(J,Z,ee,ne,23,4),ee+4}function U(J,Z,ee,ne,re){return re||j(J,0,ee,8),se.write(J,Z,ee,ne,52,8),ee+8}Z.Buffer=c,Z.SlowBuffer=function(J){return+J!=J&&(J=0),c.alloc(+J)},Z.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==J.TYPED_ARRAY_SUPPORT?J.TYPED_ARRAY_SUPPORT:function(){try{var J=new Uint8Array(1);return J.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===J.foo()&&"function"==typeof J.subarray&&0===J.subarray(1,1).byteLength}catch(J){return!1}}(),Z.kMaxLength=s(),c.poolSize=8192,c._augment=function(J){return J.__proto__=c.prototype,J},c.from=function(J,Z,ee){return h(null,J,Z,ee)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(J,Z,ee){return function(J,Z,ee,ne){return u(Z),Z<=0?a(J,Z):void 0!==ee?"string"==typeof ne?a(J,Z).fill(ee,ne):a(J,Z).fill(ee):a(J,Z)}(null,J,Z,ee)},c.allocUnsafe=function(J){return f(null,J)},c.allocUnsafeSlow=function(J){return f(null,J)},c.isBuffer=function(J){return!(null==J||!J._isBuffer)},c.compare=function(J,Z){if(!c.isBuffer(J)||!c.isBuffer(Z))throw new TypeError("Arguments must be Buffers");if(J===Z)return 0;for(var ee=J.length,ne=Z.length,se=0,re=Math.min(ee,ne);se<re;++se)if(J[se]!==Z[se]){ee=J[se],ne=Z[se];break}return ee<ne?-1:ne<ee?1:0},c.isEncoding=function(J){switch(String(J).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(J,Z){if(!re(J))throw new TypeError('"list" argument must be an Array of Buffers');if(0===J.length)return c.alloc(0);var ee;if(void 0===Z)for(Z=0,ee=0;ee<J.length;++ee)Z+=J[ee].length;var ne=c.allocUnsafe(Z),se=0;for(ee=0;ee<J.length;++ee){var ae=J[ee];if(!c.isBuffer(ae))throw new TypeError('"list" argument must be an Array of Buffers');ae.copy(ne,se),se+=ae.length}return ne},c.byteLength=d,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var J=this.length;if(J%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var Z=0;Z<J;Z+=2)g(this,Z,Z+1);return this},c.prototype.swap32=function(){var J=this.length;if(J%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var Z=0;Z<J;Z+=4)g(this,Z,Z+3),g(this,Z+1,Z+2);return this},c.prototype.swap64=function(){var J=this.length;if(J%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var Z=0;Z<J;Z+=8)g(this,Z,Z+7),g(this,Z+1,Z+6),g(this,Z+2,Z+5),g(this,Z+3,Z+4);return this},c.prototype.toString=function(){var J=0|this.length;return 0===J?"":0===arguments.length?S(this,0,J):y.apply(this,arguments)},c.prototype.equals=function(J){if(!c.isBuffer(J))throw new TypeError("Argument must be a Buffer");return this===J||0===c.compare(this,J)},c.prototype.inspect=function(){var J="",ee=Z.INSPECT_MAX_BYTES;return this.length>0&&(J=this.toString("hex",0,ee).match(/.{2}/g).join(" "),this.length>ee&&(J+=" ... ")),"<Buffer "+J+">"},c.prototype.compare=function(J,Z,ee,ne,se){if(!c.isBuffer(J))throw new TypeError("Argument must be a Buffer");if(void 0===Z&&(Z=0),void 0===ee&&(ee=J?J.length:0),void 0===ne&&(ne=0),void 0===se&&(se=this.length),Z<0||ee>J.length||ne<0||se>this.length)throw new RangeError("out of range index");if(ne>=se&&Z>=ee)return 0;if(ne>=se)return-1;if(Z>=ee)return 1;if(this===J)return 0;for(var re=(se>>>=0)-(ne>>>=0),ae=(ee>>>=0)-(Z>>>=0),le=Math.min(re,ae),pe=this.slice(ne,se),_e=J.slice(Z,ee),ve=0;ve<le;++ve)if(pe[ve]!==_e[ve]){re=pe[ve],ae=_e[ve];break}return re<ae?-1:ae<re?1:0},c.prototype.includes=function(J,Z,ee){return-1!==this.indexOf(J,Z,ee)},c.prototype.indexOf=function(J,Z,ee){return v(this,J,Z,ee,!0)},c.prototype.lastIndexOf=function(J,Z,ee){return v(this,J,Z,ee,!1)},c.prototype.write=function(J,Z,ee,ne){if(void 0===Z)ne="utf8",ee=this.length,Z=0;else if(void 0===ee&&"string"==typeof Z)ne=Z,ee=this.length,Z=0;else{if(!isFinite(Z))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");Z|=0,isFinite(ee)?(ee|=0,void 0===ne&&(ne="utf8")):(ne=ee,ee=void 0)}var se=this.length-Z;if((void 0===ee||ee>se)&&(ee=se),J.length>0&&(ee<0||Z<0)||Z>this.length)throw new RangeError("Attempt to write outside buffer bounds");ne||(ne="utf8");for(var re=!1;;)switch(ne){case"hex":return b(this,J,Z,ee);case"utf8":case"utf-8":return w(this,J,Z,ee);case"ascii":return A(this,J,Z,ee);case"latin1":case"binary":return k(this,J,Z,ee);case"base64":return _(this,J,Z,ee);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,J,Z,ee);default:if(re)throw new TypeError("Unknown encoding: "+ne);ne=(""+ne).toLowerCase(),re=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},c.prototype.slice=function(J,Z){var ee,ne=this.length;if((J=~~J)<0?(J+=ne)<0&&(J=0):J>ne&&(J=ne),(Z=void 0===Z?ne:~~Z)<0?(Z+=ne)<0&&(Z=0):Z>ne&&(Z=ne),Z<J&&(Z=J),c.TYPED_ARRAY_SUPPORT)(ee=this.subarray(J,Z)).__proto__=c.prototype;else{var se=Z-J;ee=new c(se,void 0);for(var re=0;re<se;++re)ee[re]=this[re+J]}return ee},c.prototype.readUIntLE=function(J,Z,ee){J|=0,Z|=0,ee||P(J,Z,this.length);for(var ne=this[J],se=1,re=0;++re<Z&&(se*=256);)ne+=this[J+re]*se;return ne},c.prototype.readUIntBE=function(J,Z,ee){J|=0,Z|=0,ee||P(J,Z,this.length);for(var ne=this[J+--Z],se=1;Z>0&&(se*=256);)ne+=this[J+--Z]*se;return ne},c.prototype.readUInt8=function(J,Z){return Z||P(J,1,this.length),this[J]},c.prototype.readUInt16LE=function(J,Z){return Z||P(J,2,this.length),this[J]|this[J+1]<<8},c.prototype.readUInt16BE=function(J,Z){return Z||P(J,2,this.length),this[J]<<8|this[J+1]},c.prototype.readUInt32LE=function(J,Z){return Z||P(J,4,this.length),(this[J]|this[J+1]<<8|this[J+2]<<16)+16777216*this[J+3]},c.prototype.readUInt32BE=function(J,Z){return Z||P(J,4,this.length),16777216*this[J]+(this[J+1]<<16|this[J+2]<<8|this[J+3])},c.prototype.readIntLE=function(J,Z,ee){J|=0,Z|=0,ee||P(J,Z,this.length);for(var ne=this[J],se=1,re=0;++re<Z&&(se*=256);)ne+=this[J+re]*se;return ne>=(se*=128)&&(ne-=Math.pow(2,8*Z)),ne},c.prototype.readIntBE=function(J,Z,ee){J|=0,Z|=0,ee||P(J,Z,this.length);for(var ne=Z,se=1,re=this[J+--ne];ne>0&&(se*=256);)re+=this[J+--ne]*se;return re>=(se*=128)&&(re-=Math.pow(2,8*Z)),re},c.prototype.readInt8=function(J,Z){return Z||P(J,1,this.length),128&this[J]?-1*(255-this[J]+1):this[J]},c.prototype.readInt16LE=function(J,Z){Z||P(J,2,this.length);var ee=this[J]|this[J+1]<<8;return 32768&ee?4294901760|ee:ee},c.prototype.readInt16BE=function(J,Z){Z||P(J,2,this.length);var ee=this[J+1]|this[J]<<8;return 32768&ee?4294901760|ee:ee},c.prototype.readInt32LE=function(J,Z){return Z||P(J,4,this.length),this[J]|this[J+1]<<8|this[J+2]<<16|this[J+3]<<24},c.prototype.readInt32BE=function(J,Z){return Z||P(J,4,this.length),this[J]<<24|this[J+1]<<16|this[J+2]<<8|this[J+3]},c.prototype.readFloatLE=function(J,Z){return Z||P(J,4,this.length),se.read(this,J,!0,23,4)},c.prototype.readFloatBE=function(J,Z){return Z||P(J,4,this.length),se.read(this,J,!1,23,4)},c.prototype.readDoubleLE=function(J,Z){return Z||P(J,8,this.length),se.read(this,J,!0,52,8)},c.prototype.readDoubleBE=function(J,Z){return Z||P(J,8,this.length),se.read(this,J,!1,52,8)},c.prototype.writeUIntLE=function(J,Z,ee,ne){J=+J,Z|=0,ee|=0,ne||T(this,J,Z,ee,Math.pow(2,8*ee)-1,0);var se=1,re=0;for(this[Z]=255&J;++re<ee&&(se*=256);)this[Z+re]=J/se&255;return Z+ee},c.prototype.writeUIntBE=function(J,Z,ee,ne){J=+J,Z|=0,ee|=0,ne||T(this,J,Z,ee,Math.pow(2,8*ee)-1,0);var se=ee-1,re=1;for(this[Z+se]=255&J;--se>=0&&(re*=256);)this[Z+se]=J/re&255;return Z+ee},c.prototype.writeUInt8=function(J,Z,ee){return J=+J,Z|=0,ee||T(this,J,Z,1,255,0),c.TYPED_ARRAY_SUPPORT||(J=Math.floor(J)),this[Z]=255&J,Z+1},c.prototype.writeUInt16LE=function(J,Z,ee){return J=+J,Z|=0,ee||T(this,J,Z,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[Z]=255&J,this[Z+1]=J>>>8):N(this,J,Z,!0),Z+2},c.prototype.writeUInt16BE=function(J,Z,ee){return J=+J,Z|=0,ee||T(this,J,Z,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[Z]=J>>>8,this[Z+1]=255&J):N(this,J,Z,!1),Z+2},c.prototype.writeUInt32LE=function(J,Z,ee){return J=+J,Z|=0,ee||T(this,J,Z,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[Z+3]=J>>>24,this[Z+2]=J>>>16,this[Z+1]=J>>>8,this[Z]=255&J):L(this,J,Z,!0),Z+4},c.prototype.writeUInt32BE=function(J,Z,ee){return J=+J,Z|=0,ee||T(this,J,Z,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[Z]=J>>>24,this[Z+1]=J>>>16,this[Z+2]=J>>>8,this[Z+3]=255&J):L(this,J,Z,!1),Z+4},c.prototype.writeIntLE=function(J,Z,ee,ne){if(J=+J,Z|=0,!ne){var se=Math.pow(2,8*ee-1);T(this,J,Z,ee,se-1,-se)}var re=0,ae=1,le=0;for(this[Z]=255&J;++re<ee&&(ae*=256);)J<0&&0===le&&0!==this[Z+re-1]&&(le=1),this[Z+re]=(J/ae|0)-le&255;return Z+ee},c.prototype.writeIntBE=function(J,Z,ee,ne){if(J=+J,Z|=0,!ne){var se=Math.pow(2,8*ee-1);T(this,J,Z,ee,se-1,-se)}var re=ee-1,ae=1,le=0;for(this[Z+re]=255&J;--re>=0&&(ae*=256);)J<0&&0===le&&0!==this[Z+re+1]&&(le=1),this[Z+re]=(J/ae|0)-le&255;return Z+ee},c.prototype.writeInt8=function(J,Z,ee){return J=+J,Z|=0,ee||T(this,J,Z,1,127,-128),c.TYPED_ARRAY_SUPPORT||(J=Math.floor(J)),J<0&&(J=255+J+1),this[Z]=255&J,Z+1},c.prototype.writeInt16LE=function(J,Z,ee){return J=+J,Z|=0,ee||T(this,J,Z,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[Z]=255&J,this[Z+1]=J>>>8):N(this,J,Z,!0),Z+2},c.prototype.writeInt16BE=function(J,Z,ee){return J=+J,Z|=0,ee||T(this,J,Z,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[Z]=J>>>8,this[Z+1]=255&J):N(this,J,Z,!1),Z+2},c.prototype.writeInt32LE=function(J,Z,ee){return J=+J,Z|=0,ee||T(this,J,Z,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[Z]=255&J,this[Z+1]=J>>>8,this[Z+2]=J>>>16,this[Z+3]=J>>>24):L(this,J,Z,!0),Z+4},c.prototype.writeInt32BE=function(J,Z,ee){return J=+J,Z|=0,ee||T(this,J,Z,4,2147483647,-2147483648),J<0&&(J=4294967295+J+1),c.TYPED_ARRAY_SUPPORT?(this[Z]=J>>>24,this[Z+1]=J>>>16,this[Z+2]=J>>>8,this[Z+3]=255&J):L(this,J,Z,!1),Z+4},c.prototype.writeFloatLE=function(J,Z,ee){return I(this,J,Z,!0,ee)},c.prototype.writeFloatBE=function(J,Z,ee){return I(this,J,Z,!1,ee)},c.prototype.writeDoubleLE=function(J,Z,ee){return U(this,J,Z,!0,ee)},c.prototype.writeDoubleBE=function(J,Z,ee){return U(this,J,Z,!1,ee)},c.prototype.copy=function(J,Z,ee,ne){if(ee||(ee=0),ne||0===ne||(ne=this.length),Z>=J.length&&(Z=J.length),Z||(Z=0),ne>0&&ne<ee&&(ne=ee),ne===ee)return 0;if(0===J.length||0===this.length)return 0;if(Z<0)throw new RangeError("targetStart out of bounds");if(ee<0||ee>=this.length)throw new RangeError("sourceStart out of bounds");if(ne<0)throw new RangeError("sourceEnd out of bounds");ne>this.length&&(ne=this.length),J.length-Z<ne-ee&&(ne=J.length-Z+ee);var se,re=ne-ee;if(this===J&&ee<Z&&Z<ne)for(se=re-1;se>=0;--se)J[se+Z]=this[se+ee];else if(re<1e3||!c.TYPED_ARRAY_SUPPORT)for(se=0;se<re;++se)J[se+Z]=this[se+ee];else Uint8Array.prototype.set.call(J,this.subarray(ee,ee+re),Z);return re},c.prototype.fill=function(J,Z,ee,ne){if("string"==typeof J){if("string"==typeof Z?(ne=Z,Z=0,ee=this.length):"string"==typeof ee&&(ne=ee,ee=this.length),1===J.length){var se=J.charCodeAt(0);se<256&&(J=se)}if(void 0!==ne&&"string"!=typeof ne)throw new TypeError("encoding must be a string");if("string"==typeof ne&&!c.isEncoding(ne))throw new TypeError("Unknown encoding: "+ne)}else"number"==typeof J&&(J&=255);if(Z<0||this.length<Z||this.length<ee)throw new RangeError("Out of range index");if(ee<=Z)return this;var re;if(Z>>>=0,ee=void 0===ee?this.length:ee>>>0,J||(J=0),"number"==typeof J)for(re=Z;re<ee;++re)this[re]=J;else{var ae=c.isBuffer(J)?J:q(new c(J,ne).toString()),le=ae.length;for(re=0;re<ee-Z;++re)this[re+Z]=ae[re%le]}return this};var ae=/[^+\/0-9A-Za-z-_]/g;function D(J){return J<16?"0"+J.toString(16):J.toString(16)}function q(J,Z){var ee;Z=Z||1/0;for(var ne=J.length,se=null,re=[],ae=0;ae<ne;++ae){if((ee=J.charCodeAt(ae))>55295&&ee<57344){if(!se){if(ee>56319){(Z-=3)>-1&&re.push(239,191,189);continue}if(ae+1===ne){(Z-=3)>-1&&re.push(239,191,189);continue}se=ee;continue}if(ee<56320){(Z-=3)>-1&&re.push(239,191,189),se=ee;continue}ee=65536+(se-55296<<10|ee-56320)}else se&&(Z-=3)>-1&&re.push(239,191,189);if(se=null,ee<128){if((Z-=1)<0)break;re.push(ee)}else if(ee<2048){if((Z-=2)<0)break;re.push(ee>>6|192,63&ee|128)}else if(ee<65536){if((Z-=3)<0)break;re.push(ee>>12|224,ee>>6&63|128,63&ee|128)}else{if(!(ee<1114112))throw new Error("Invalid code point");if((Z-=4)<0)break;re.push(ee>>18|240,ee>>12&63|128,ee>>6&63|128,63&ee|128)}}return re}function Y(J){return ne.toByteArray(function(J){if((J=function(J){return J.trim?J.trim():J.replace(/^\s+|\s+$/g,"")}(J).replace(ae,"")).length<2)return"";for(;J.length%4!=0;)J+="=";return J}(J))}function F(J,Z,ee,ne){for(var se=0;se<ne&&!(se+ee>=Z.length||se>=J.length);++se)Z[se+ee]=J[se];return se}}).call(this,ee(9))},function(J,Z){Z.encode=function(J){var Z="";for(var ee in J)J.hasOwnProperty(ee)&&(Z.length&&(Z+="&"),Z+=encodeURIComponent(ee)+"="+encodeURIComponent(J[ee]));return Z},Z.decode=function(J){for(var Z={},ee=J.split("&"),ne=0,se=ee.length;ne<se;ne++){var re=ee[ne].split("=");Z[decodeURIComponent(re[0])]=decodeURIComponent(re[1])}return Z}},function(J,Z){var ee=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ne=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];J.exports=function(J){var Z=J,se=J.indexOf("["),re=J.indexOf("]");-1!=se&&-1!=re&&(J=J.substring(0,se)+J.substring(se,re).replace(/:/g,";")+J.substring(re,J.length));for(var ae=ee.exec(J||""),le={},pe=14;pe--;)le[ne[pe]]=ae[pe]||"";return-1!=se&&-1!=re&&(le.source=Z,le.host=le.host.substring(1,le.host.length-1).replace(/;/g,":"),le.authority=le.authority.replace("[","").replace("]","").replace(/;/g,":"),le.ipv6uri=!0),le}},function(J,Z){var ee={}.toString;J.exports=Array.isArray||function(J){return"[object Array]"==ee.call(J)}},function(J,Z,ee){(function(Z){J.exports=function(J){return ee&&Z.isBuffer(J)||ne&&(J instanceof ArrayBuffer||function(J){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(J):J.buffer instanceof ArrayBuffer}(J))};var ee="function"==typeof Z&&"function"==typeof Z.isBuffer,ne="function"==typeof ArrayBuffer}).call(this,ee(4).Buffer)},function(J,Z){var ee;ee=function(){return this}();try{ee=ee||new Function("return this")()}catch(J){"object"==typeof window&&(ee=window)}J.exports=ee},function(J,Z,ee){var ne=ee(25),se=ee(15),re=ee(1),ae=ee(3),le=ee(16),pe=ee(17),_e=ee(0)("socket.io-client:manager"),ve=ee(14),ye=ee(49),Fe=Object.prototype.hasOwnProperty;function l(J,Z){if(!(this instanceof l))return new l(J,Z);J&&"object"==typeof J&&(Z=J,J=void 0),(Z=Z||{}).path=Z.path||"/socket.io",this.nsps={},this.subs=[],this.opts=Z,this.reconnection(!1!==Z.reconnection),this.reconnectionAttempts(Z.reconnectionAttempts||1/0),this.reconnectionDelay(Z.reconnectionDelay||1e3),this.reconnectionDelayMax(Z.reconnectionDelayMax||5e3),this.randomizationFactor(Z.randomizationFactor||.5),this.backoff=new ye({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==Z.timeout?2e4:Z.timeout),this.readyState="closed",this.uri=J,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var ee=Z.parser||ae;this.encoder=new ee.Encoder,this.decoder=new ee.Decoder,this.autoConnect=!1!==Z.autoConnect,this.autoConnect&&this.open()}J.exports=l,l.prototype.emitAll=function(){for(var J in this.emit.apply(this,arguments),this.nsps)Fe.call(this.nsps,J)&&this.nsps[J].emit.apply(this.nsps[J],arguments)},l.prototype.updateSocketIds=function(){for(var J in this.nsps)Fe.call(this.nsps,J)&&(this.nsps[J].id=this.generateId(J))},l.prototype.generateId=function(J){return("/"===J?"":J+"#")+this.engine.id},re(l.prototype),l.prototype.reconnection=function(J){return arguments.length?(this._reconnection=!!J,this):this._reconnection},l.prototype.reconnectionAttempts=function(J){return arguments.length?(this._reconnectionAttempts=J,this):this._reconnectionAttempts},l.prototype.reconnectionDelay=function(J){return arguments.length?(this._reconnectionDelay=J,this.backoff&&this.backoff.setMin(J),this):this._reconnectionDelay},l.prototype.randomizationFactor=function(J){return arguments.length?(this._randomizationFactor=J,this.backoff&&this.backoff.setJitter(J),this):this._randomizationFactor},l.prototype.reconnectionDelayMax=function(J){return arguments.length?(this._reconnectionDelayMax=J,this.backoff&&this.backoff.setMax(J),this):this._reconnectionDelayMax},l.prototype.timeout=function(J){return arguments.length?(this._timeout=J,this):this._timeout},l.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},l.prototype.open=l.prototype.connect=function(J,Z){if(_e("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;_e("opening %s",this.uri),this.engine=ne(this.uri,this.opts);var ee=this.engine,se=this;this.readyState="opening",this.skipReconnect=!1;var re=le(ee,"open",(function(){se.onopen(),J&&J()})),ae=le(ee,"error",(function(Z){if(_e("connect_error"),se.cleanup(),se.readyState="closed",se.emitAll("connect_error",Z),J){var ee=new Error("Connection error");ee.data=Z,J(ee)}else se.maybeReconnectOnOpen()}));if(!1!==this._timeout){var pe=this._timeout;_e("connect attempt will timeout after %d",pe);var ve=setTimeout((function(){_e("connect attempt timed out after %d",pe),re.destroy(),ee.close(),ee.emit("error","timeout"),se.emitAll("connect_timeout",pe)}),pe);this.subs.push({destroy:function(){clearTimeout(ve)}})}return this.subs.push(re),this.subs.push(ae),this},l.prototype.onopen=function(){_e("open"),this.cleanup(),this.readyState="open",this.emit("open");var J=this.engine;this.subs.push(le(J,"data",pe(this,"ondata"))),this.subs.push(le(J,"ping",pe(this,"onping"))),this.subs.push(le(J,"pong",pe(this,"onpong"))),this.subs.push(le(J,"error",pe(this,"onerror"))),this.subs.push(le(J,"close",pe(this,"onclose"))),this.subs.push(le(this.decoder,"decoded",pe(this,"ondecoded")))},l.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},l.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},l.prototype.ondata=function(J){this.decoder.add(J)},l.prototype.ondecoded=function(J){this.emit("packet",J)},l.prototype.onerror=function(J){_e("error",J),this.emitAll("error",J)},l.prototype.socket=function(J,Z){var ee=this.nsps[J];if(!ee){ee=new se(this,J,Z),this.nsps[J]=ee;var ne=this;ee.on("connecting",i),ee.on("connect",(function(){ee.id=ne.generateId(J)})),this.autoConnect&&i()}function i(){~ve(ne.connecting,ee)||ne.connecting.push(ee)}return ee},l.prototype.destroy=function(J){var Z=ve(this.connecting,J);~Z&&this.connecting.splice(Z,1),this.connecting.length||this.close()},l.prototype.packet=function(J){_e("writing packet %j",J);var Z=this;J.query&&0===J.type&&(J.nsp+="?"+J.query),Z.encoding?Z.packetBuffer.push(J):(Z.encoding=!0,this.encoder.encode(J,(function(ee){for(var ne=0;ne<ee.length;ne++)Z.engine.write(ee[ne],J.options);Z.encoding=!1,Z.processPacketQueue()})))},l.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var J=this.packetBuffer.shift();this.packet(J)}},l.prototype.cleanup=function(){_e("cleanup");for(var J=this.subs.length,Z=0;Z<J;Z++)this.subs.shift().destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},l.prototype.close=l.prototype.disconnect=function(){_e("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},l.prototype.onclose=function(J){_e("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",J),this._reconnection&&!this.skipReconnect&&this.reconnect()},l.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var J=this;if(this.backoff.attempts>=this._reconnectionAttempts)_e("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var Z=this.backoff.duration();_e("will wait %dms before reconnect attempt",Z),this.reconnecting=!0;var ee=setTimeout((function(){J.skipReconnect||(_e("attempting reconnect"),J.emitAll("reconnect_attempt",J.backoff.attempts),J.emitAll("reconnecting",J.backoff.attempts),J.skipReconnect||J.open((function(Z){Z?(_e("reconnect attempt error"),J.reconnecting=!1,J.reconnect(),J.emitAll("reconnect_error",Z.data)):(_e("reconnect success"),J.onreconnect())})))}),Z);this.subs.push({destroy:function(){clearTimeout(ee)}})}},l.prototype.onreconnect=function(){var J=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",J)}},function(J,Z,ee){const ne=ee(27);Z.websocket=ne},function(J,Z,ee){var ne=ee(2),se=ee(1);function i(J){this.path=J.path,this.hostname=J.hostname,this.port=J.port,this.secure=J.secure,this.query=J.query,this.timestampParam=J.timestampParam,this.timestampRequests=J.timestampRequests,this.readyState="",this.agent=J.agent||!1,this.socket=J.socket,this.enablesXDR=J.enablesXDR,this.pfx=J.pfx,this.key=J.key,this.passphrase=J.passphrase,this.cert=J.cert,this.ca=J.ca,this.ciphers=J.ciphers,this.rejectUnauthorized=J.rejectUnauthorized,this.forceNode=J.forceNode,this.isReactNative=J.isReactNative,this.extraHeaders=J.extraHeaders,this.localAddress=J.localAddress}J.exports=i,se(i.prototype),i.prototype.onError=function(J,Z){var ee=new Error(J);return ee.type="TransportError",ee.description=Z,this.emit("error",ee),this},i.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},i.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},i.prototype.send=function(J){if("open"!==this.readyState)throw new Error("Transport not open");this.write(J)},i.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},i.prototype.onData=function(J){var Z=ne.decodePacket(J,this.socket.binaryType);this.onPacket(Z)},i.prototype.onPacket=function(J){this.emit("packet",J)},i.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(J,Z,ee){(function(Z){var ne=ee(29),se=Object.prototype.toString,re="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===se.call(Blob),ae="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===se.call(File);J.exports=function t(J){if(!J||"object"!=typeof J)return!1;if(ne(J)){for(var ee=0,se=J.length;ee<se;ee++)if(t(J[ee]))return!0;return!1}if("function"==typeof Z&&Z.isBuffer&&Z.isBuffer(J)||"function"==typeof ArrayBuffer&&J instanceof ArrayBuffer||re&&J instanceof Blob||ae&&J instanceof File)return!0;if(J.toJSON&&"function"==typeof J.toJSON&&1===arguments.length)return t(J.toJSON(),!0);for(var le in J)if(Object.prototype.hasOwnProperty.call(J,le)&&t(J[le]))return!0;return!1}}).call(this,ee(4).Buffer)},function(J,Z){var ee=[].indexOf;J.exports=function(J,Z){if(ee)return J.indexOf(Z);for(var ne=0;ne<J.length;++ne)if(J[ne]===Z)return ne;return-1}},function(J,Z,ee){var ne=ee(3),se=ee(1),re=ee(48),ae=ee(16),le=ee(17),pe=ee(0)("socket.io-client:socket"),_e=ee(5),ve=ee(13);J.exports=l;var ye={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},Fe=se.prototype.emit;function l(J,Z,ee){this.io=J,this.nsp=Z,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},ee&&ee.query&&(this.query=ee.query),this.io.autoConnect&&this.open()}se(l.prototype),l.prototype.subEvents=function(){if(!this.subs){var J=this.io;this.subs=[ae(J,"open",le(this,"onopen")),ae(J,"packet",le(this,"onpacket")),ae(J,"close",le(this,"onclose"))]}},l.prototype.open=l.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},l.prototype.send=function(){var J=re(arguments);return J.unshift("message"),this.emit.apply(this,J),this},l.prototype.emit=function(J){if(ye.hasOwnProperty(J))return Fe.apply(this,arguments),this;var Z=re(arguments),ee={type:(void 0!==this.flags.binary?this.flags.binary:ve(Z))?ne.BINARY_EVENT:ne.EVENT,data:Z,options:{}};return ee.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof Z[Z.length-1]&&(pe("emitting packet with ack id %d",this.ids),this.acks[this.ids]=Z.pop(),ee.id=this.ids++),this.connected?this.packet(ee):this.sendBuffer.push(ee),this.flags={},this},l.prototype.packet=function(J){J.nsp=this.nsp,this.io.packet(J)},l.prototype.onopen=function(){if(pe("transport is open - connecting"),"/"!==this.nsp)if(this.query){var J="object"==typeof this.query?_e.encode(this.query):this.query;pe("sending connect packet with query %s",J),this.packet({type:ne.CONNECT,query:J})}else this.packet({type:ne.CONNECT})},l.prototype.onclose=function(J){pe("close (%s)",J),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",J)},l.prototype.onpacket=function(J){var Z=J.nsp===this.nsp,ee=J.type===ne.ERROR&&"/"===J.nsp;if(Z||ee)switch(J.type){case ne.CONNECT:this.onconnect();break;case ne.EVENT:case ne.BINARY_EVENT:this.onevent(J);break;case ne.ACK:case ne.BINARY_ACK:this.onack(J);break;case ne.DISCONNECT:this.ondisconnect();break;case ne.ERROR:this.emit("error",J.data)}},l.prototype.onevent=function(J){var Z=J.data||[];pe("emitting event %j",Z),null!=J.id&&(pe("attaching ack callback to event"),Z.push(this.ack(J.id))),this.connected?Fe.apply(this,Z):this.receiveBuffer.push(Z)},l.prototype.ack=function(J){var Z=this,ee=!1;return function(){if(!ee){ee=!0;var se=re(arguments);pe("sending ack %j",se),Z.packet({type:ve(se)?ne.BINARY_ACK:ne.ACK,id:J,data:se})}}},l.prototype.onack=function(J){var Z=this.acks[J.id];"function"==typeof Z?(pe("calling ack %s with %j",J.id,J.data),Z.apply(this,J.data),delete this.acks[J.id]):pe("bad ack %s",J.id)},l.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},l.prototype.emitBuffered=function(){var J;for(J=0;J<this.receiveBuffer.length;J++)Fe.apply(this,this.receiveBuffer[J]);for(this.receiveBuffer=[],J=0;J<this.sendBuffer.length;J++)this.packet(this.sendBuffer[J]);this.sendBuffer=[]},l.prototype.ondisconnect=function(){pe("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},l.prototype.destroy=function(){if(this.subs){for(var J=0;J<this.subs.length;J++)this.subs[J].destroy();this.subs=null}this.io.destroy(this)},l.prototype.close=l.prototype.disconnect=function(){return this.connected&&(pe("performing disconnect (%s)",this.nsp),this.packet({type:ne.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},l.prototype.compress=function(J){return this.flags.compress=J,this},l.prototype.binary=function(J){return this.flags.binary=J,this}},function(J,Z){J.exports=function(J,Z,ee){return J.on(Z,ee),{destroy:function(){J.removeListener(Z,ee)}}}},function(J,Z){var ee=[].slice;J.exports=function(J,Z){if("string"==typeof Z&&(Z=J[Z]),"function"!=typeof Z)throw new Error("bind() requires a function");var ne=ee.call(arguments,2);return function(){return Z.apply(J,ne.concat(ee.call(arguments)))}}},function(J,Z,ee){J.exports=ee(19)},function(J,Z,ee){var ne=ee(20),se=ee(3),re=ee(10),ae=ee(0)("socket.io-client");J.exports=Z=c;var le=Z.managers={};function c(J,Z){"object"==typeof J&&(Z=J,J=void 0),Z=Z||{};var ee,se=ne(J),pe=se.source,_e=se.id,ve=se.path,ye=le[_e]&&ve in le[_e].nsps;return Z.forceNew||Z["force new connection"]||!1===Z.multiplex||ye?(ae("ignoring socket cache for %s",pe),ee=re(pe,Z)):(le[_e]||(ae("new io instance for %s",pe),le[_e]=re(pe,Z)),ee=le[_e]),se.query&&!Z.query&&(Z.query=se.query),ee.socket(se.path,Z)}Z.protocol=se.protocol,Z.connect=c,Z.Manager=ee(10),Z.Socket=ee(15)},function(J,Z,ee){var ne=ee(6),se=ee(0)("socket.io-client:url");J.exports=function(J,Z){var ee=J;Z=Z||"undefined"!=typeof location&&location,null==J&&(J=Z.protocol+"//"+Z.host),"string"==typeof J&&("/"===J.charAt(0)&&(J="/"===J.charAt(1)?Z.protocol+J:Z.host+J),/^(https?|wss?):\/\//.test(J)||(se("protocol-less url %s",J),J=void 0!==Z?Z.protocol+"//"+J:"https://"+J),se("parse %s",J),ee=ne(J)),ee.port||(/^(http|ws)$/.test(ee.protocol)?ee.port="80":/^(http|ws)s$/.test(ee.protocol)&&(ee.port="443")),ee.path=ee.path||"/";var re=-1!==ee.host.indexOf(":")?"["+ee.host+"]":ee.host;return ee.id=ee.protocol+"://"+re+":"+ee.port,ee.href=ee.protocol+"://"+re+(Z&&Z.port===ee.port?"":":"+ee.port),ee}},function(J,Z,ee){var ne=ee(7),se=ee(8),re=Object.prototype.toString,ae="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===re.call(Blob),le="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===re.call(File);Z.deconstructPacket=function(J){var Z=[],ee=J.data,re=J;return re.data=function t(J,Z){if(!J)return J;if(se(J)){var ee={_placeholder:!0,num:Z.length};return Z.push(J),ee}if(ne(J)){for(var re=new Array(J.length),ae=0;ae<J.length;ae++)re[ae]=t(J[ae],Z);return re}if("object"==typeof J&&!(J instanceof Date)){for(var le in re={},J)re[le]=t(J[le],Z);return re}return J}(ee,Z),re.attachments=Z.length,{packet:re,buffers:Z}},Z.reconstructPacket=function(J,Z){return J.data=function t(J,Z){if(!J)return J;if(J&&J._placeholder)return Z[J.num];if(ne(J))for(var ee=0;ee<J.length;ee++)J[ee]=t(J[ee],Z);else if("object"==typeof J)for(var se in J)J[se]=t(J[se],Z);return J}(J.data,Z),J.attachments=void 0,J},Z.removeBlobs=function(J,Z){var ee=0,re=J;!function t(J,pe,_e){if(!J)return J;if(ae&&J instanceof Blob||le&&J instanceof File){ee++;var ve=new FileReader;ve.onload=function(){_e?_e[pe]=this.result:re=this.result,--ee||Z(re)},ve.readAsArrayBuffer(J)}else if(ne(J))for(var ye=0;ye<J.length;ye++)t(J[ye],ye,J);else if("object"==typeof J&&!se(J))for(var Fe in J)t(J[Fe],Fe,J)}(re),ee||Z(re)}},function(J,Z,ee){"use strict";Z.byteLength=function(J){var Z=h(J),ee=Z[0],ne=Z[1];return 3*(ee+ne)/4-ne},Z.toByteArray=function(J){var Z,ee,ne=h(J),ae=ne[0],le=ne[1],pe=new re(function(J,Z,ee){return 3*(Z+ee)/4-ee}(0,ae,le)),_e=0,ve=le>0?ae-4:ae;for(ee=0;ee<ve;ee+=4)Z=se[J.charCodeAt(ee)]<<18|se[J.charCodeAt(ee+1)]<<12|se[J.charCodeAt(ee+2)]<<6|se[J.charCodeAt(ee+3)],pe[_e++]=Z>>16&255,pe[_e++]=Z>>8&255,pe[_e++]=255&Z;return 2===le&&(Z=se[J.charCodeAt(ee)]<<2|se[J.charCodeAt(ee+1)]>>4,pe[_e++]=255&Z),1===le&&(Z=se[J.charCodeAt(ee)]<<10|se[J.charCodeAt(ee+1)]<<4|se[J.charCodeAt(ee+2)]>>2,pe[_e++]=Z>>8&255,pe[_e++]=255&Z),pe},Z.fromByteArray=function(J){for(var Z,ee=J.length,se=ee%3,re=[],ae=0,le=ee-se;ae<le;ae+=16383)re.push(u(J,ae,ae+16383>le?le:ae+16383));return 1===se?(Z=J[ee-1],re.push(ne[Z>>2]+ne[Z<<4&63]+"==")):2===se&&(Z=(J[ee-2]<<8)+J[ee-1],re.push(ne[Z>>10]+ne[Z>>4&63]+ne[Z<<2&63]+"=")),re.join("")};for(var ne=[],se=[],re="undefined"!=typeof Uint8Array?Uint8Array:Array,ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",le=0,pe=ae.length;le<pe;++le)ne[le]=ae[le],se[ae.charCodeAt(le)]=le;function h(J){var Z=J.length;if(Z%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var ee=J.indexOf("=");return-1===ee&&(ee=Z),[ee,ee===Z?0:4-ee%4]}function u(J,Z,ee){for(var se,re,ae=[],le=Z;le<ee;le+=3)se=(J[le]<<16&16711680)+(J[le+1]<<8&65280)+(255&J[le+2]),ae.push(ne[(re=se)>>18&63]+ne[re>>12&63]+ne[re>>6&63]+ne[63&re]);return ae.join("")}se["-".charCodeAt(0)]=62,se["_".charCodeAt(0)]=63},function(J,Z){Z.read=function(J,Z,ee,ne,se){var re,ae,le=8*se-ne-1,pe=(1<<le)-1,_e=pe>>1,ve=-7,ye=ee?se-1:0,Fe=ee?-1:1,qe=J[Z+ye];for(ye+=Fe,re=qe&(1<<-ve)-1,qe>>=-ve,ve+=le;ve>0;re=256*re+J[Z+ye],ye+=Fe,ve-=8);for(ae=re&(1<<-ve)-1,re>>=-ve,ve+=ne;ve>0;ae=256*ae+J[Z+ye],ye+=Fe,ve-=8);if(0===re)re=1-_e;else{if(re===pe)return ae?NaN:1/0*(qe?-1:1);ae+=Math.pow(2,ne),re-=_e}return(qe?-1:1)*ae*Math.pow(2,re-ne)},Z.write=function(J,Z,ee,ne,se,re){var ae,le,pe,_e=8*re-se-1,ve=(1<<_e)-1,ye=ve>>1,Fe=23===se?Math.pow(2,-24)-Math.pow(2,-77):0,qe=ne?0:re-1,$e=ne?1:-1,He=Z<0||0===Z&&1/Z<0?1:0;for(Z=Math.abs(Z),isNaN(Z)||Z===1/0?(le=isNaN(Z)?1:0,ae=ve):(ae=Math.floor(Math.log(Z)/Math.LN2),Z*(pe=Math.pow(2,-ae))<1&&(ae--,pe*=2),(Z+=ae+ye>=1?Fe/pe:Fe*Math.pow(2,1-ye))*pe>=2&&(ae++,pe/=2),ae+ye>=ve?(le=0,ae=ve):ae+ye>=1?(le=(Z*pe-1)*Math.pow(2,se),ae+=ye):(le=Z*Math.pow(2,ye-1)*Math.pow(2,se),ae=0));se>=8;J[ee+qe]=255&le,qe+=$e,le/=256,se-=8);for(ae=ae<<se|le,_e+=se;_e>0;J[ee+qe]=255&ae,qe+=$e,ae/=256,_e-=8);J[ee+qe-$e]|=128*He}},function(J,Z){var ee={}.toString;J.exports=Array.isArray||function(J){return"[object Array]"==ee.call(J)}},function(J,Z,ee){J.exports=ee(26),J.exports.parser=ee(2)},function(J,Z,ee){var ne=ee(11),se=ee(1),re=ee(0)("engine.io-client:socket"),ae=ee(14),le=ee(2),pe=ee(6),_e=ee(5);function u(J,Z){if(!(this instanceof u))return new u(J,Z);Z=Z||{},J&&"object"==typeof J&&(Z=J,J=null),J?(J=pe(J),Z.hostname=J.host,Z.secure="https"===J.protocol||"wss"===J.protocol,Z.port=J.port,J.query&&(Z.query=J.query)):Z.host&&(Z.hostname=pe(Z.host).host),this.secure=null!=Z.secure?Z.secure:"undefined"!=typeof location&&"https:"===location.protocol,Z.hostname&&!Z.port&&(Z.port=this.secure?"443":"80"),this.agent=Z.agent||!1,this.hostname=Z.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=Z.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=Z.query||{},"string"==typeof this.query&&(this.query=_e.decode(this.query)),this.upgrade=!1!==Z.upgrade,this.path=(Z.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!Z.forceJSONP,this.jsonp=!1!==Z.jsonp,this.forceBase64=!!Z.forceBase64,this.enablesXDR=!!Z.enablesXDR,this.timestampParam=Z.timestampParam||"t",this.timestampRequests=Z.timestampRequests,this.transports=Z.transports||["websocket"],this.transportOptions=Z.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=Z.policyPort||843,this.rememberUpgrade=Z.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=Z.onlyBinaryUpgrades,this.perMessageDeflate=!1!==Z.perMessageDeflate&&(Z.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=Z.pfx||null,this.key=Z.key||null,this.passphrase=Z.passphrase||null,this.cert=Z.cert||null,this.ca=Z.ca||null,this.ciphers=Z.ciphers||null,this.rejectUnauthorized=void 0===Z.rejectUnauthorized||Z.rejectUnauthorized,this.forceNode=!!Z.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(Z.extraHeaders&&Object.keys(Z.extraHeaders).length>0&&(this.extraHeaders=Z.extraHeaders),Z.localAddress&&(this.localAddress=Z.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}J.exports=u,u.priorWebsocketSuccess=!1,se(u.prototype),u.protocol=le.protocol,u.Socket=u,u.Transport=ee(12),u.transports=ee(11),u.parser=ee(2),u.prototype.createTransport=function(J){re('creating transport "%s"',J);var Z=function(J){var Z={};for(var ee in J)J.hasOwnProperty(ee)&&(Z[ee]=J[ee]);return Z}(this.query);Z.EIO=le.protocol,Z.transport=J;var ee=this.transportOptions[J]||{};return this.id&&(Z.sid=this.id),new ne[J]({query:Z,socket:this,agent:ee.agent||this.agent,hostname:ee.hostname||this.hostname,port:ee.port||this.port,secure:ee.secure||this.secure,path:ee.path||this.path,forceJSONP:ee.forceJSONP||this.forceJSONP,jsonp:ee.jsonp||this.jsonp,forceBase64:ee.forceBase64||this.forceBase64,enablesXDR:ee.enablesXDR||this.enablesXDR,timestampRequests:ee.timestampRequests||this.timestampRequests,timestampParam:ee.timestampParam||this.timestampParam,policyPort:ee.policyPort||this.policyPort,pfx:ee.pfx||this.pfx,key:ee.key||this.key,passphrase:ee.passphrase||this.passphrase,cert:ee.cert||this.cert,ca:ee.ca||this.ca,ciphers:ee.ciphers||this.ciphers,rejectUnauthorized:ee.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:ee.perMessageDeflate||this.perMessageDeflate,extraHeaders:ee.extraHeaders||this.extraHeaders,forceNode:ee.forceNode||this.forceNode,localAddress:ee.localAddress||this.localAddress,requestTimeout:ee.requestTimeout||this.requestTimeout,protocols:ee.protocols||void 0,isReactNative:this.isReactNative})},u.prototype.open=function(){var J;if(this.rememberUpgrade&&u.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))J="websocket";else{if(0===this.transports.length){var Z=this;return void setTimeout((function(){Z.emit("error","No transports available")}),0)}J=this.transports[0]}this.readyState="opening";try{J=this.createTransport(J)}catch(J){return this.transports.shift(),void this.open()}J.open(),this.setTransport(J)},u.prototype.setTransport=function(J){re("setting transport %s",J.name);var Z=this;this.transport&&(re("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=J,J.on("drain",(function(){Z.onDrain()})).on("packet",(function(J){Z.onPacket(J)})).on("error",(function(J){Z.onError(J)})).on("close",(function(){Z.onClose("transport close")}))},u.prototype.probe=function(J){re('probing transport "%s"',J);var Z=this.createTransport(J,{probe:1}),ee=!1,ne=this;function o(){if(ne.onlyBinaryUpgrades){var se=!this.supportsBinary&&ne.transport.supportsBinary;ee=ee||se}ee||(re('probe transport "%s" opened',J),Z.send([{type:"ping",data:"probe"}]),Z.once("packet",(function(se){if(!ee)if("pong"===se.type&&"probe"===se.data){if(re('probe transport "%s" pong',J),ne.upgrading=!0,ne.emit("upgrading",Z),!Z)return;u.priorWebsocketSuccess="websocket"===Z.name,re('pausing current transport "%s"',ne.transport.name),ne.transport.pause((function(){ee||"closed"!==ne.readyState&&(re("changing transport and sending upgrade packet"),p(),ne.setTransport(Z),Z.send([{type:"upgrade"}]),ne.emit("upgrade",Z),Z=null,ne.upgrading=!1,ne.flush())}))}else{re('probe transport "%s" failed',J);var ae=new Error("probe error");ae.transport=Z.name,ne.emit("upgradeError",ae)}})))}function s(){ee||(ee=!0,p(),Z.close(),Z=null)}function a(ee){var se=new Error("probe error: "+ee);se.transport=Z.name,s(),re('probe transport "%s" failed because of error: %s',J,ee),ne.emit("upgradeError",se)}function c(){a("transport closed")}function h(){a("socket closed")}function f(J){Z&&J.name!==Z.name&&(re('"%s" works - aborting "%s"',J.name,Z.name),s())}function p(){Z.removeListener("open",o),Z.removeListener("error",a),Z.removeListener("close",c),ne.removeListener("close",h),ne.removeListener("upgrading",f)}u.priorWebsocketSuccess=!1,Z.once("open",o),Z.once("error",a),Z.once("close",c),this.once("close",h),this.once("upgrading",f),Z.open()},u.prototype.onOpen=function(){if(re("socket open"),this.readyState="open",u.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){re("starting upgrade probes");for(var J=0,Z=this.upgrades.length;J<Z;J++)this.probe(this.upgrades[J])}},u.prototype.onPacket=function(J){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(re('socket receive: type "%s", data "%s"',J.type,J.data),this.emit("packet",J),this.emit("heartbeat"),J.type){case"open":this.onHandshake(JSON.parse(J.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var Z=new Error("server error");Z.code=J.data,this.onError(Z);break;case"message":this.emit("data",J.data),this.emit("message",J.data)}else re('packet received with socket readyState "%s"',this.readyState)},u.prototype.onHandshake=function(J){this.emit("handshake",J),this.id=J.sid,this.transport.query.sid=J.sid,this.upgrades=this.filterUpgrades(J.upgrades),this.pingInterval=J.pingInterval,this.pingTimeout=J.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},u.prototype.onHeartbeat=function(J){clearTimeout(this.pingTimeoutTimer);var Z=this;Z.pingTimeoutTimer=setTimeout((function(){"closed"!==Z.readyState&&Z.onClose("ping timeout")}),J||Z.pingInterval+Z.pingTimeout)},u.prototype.setPing=function(){var J=this;clearTimeout(J.pingIntervalTimer),J.pingIntervalTimer=setTimeout((function(){re("writing ping packet - expecting pong within %sms",J.pingTimeout),J.ping(),J.onHeartbeat(J.pingTimeout)}),J.pingInterval)},u.prototype.ping=function(){var J=this;this.sendPacket("ping",(function(){J.emit("ping")}))},u.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},u.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(re("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},u.prototype.write=u.prototype.send=function(J,Z,ee){return this.sendPacket("message",J,Z,ee),this},u.prototype.sendPacket=function(J,Z,ee,ne){if("function"==typeof Z&&(ne=Z,Z=void 0),"function"==typeof ee&&(ne=ee,ee=null),"closing"!==this.readyState&&"closed"!==this.readyState){(ee=ee||{}).compress=!1!==ee.compress;var se={type:J,data:Z,options:ee};this.emit("packetCreate",se),this.writeBuffer.push(se),ne&&this.once("flush",ne),this.flush()}},u.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var J=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?n():e()})):this.upgrading?n():e()}function e(){J.onClose("forced close"),re("socket closing - telling transport to close"),J.transport.close()}function r(){J.removeListener("upgrade",r),J.removeListener("upgradeError",r),e()}function n(){J.once("upgrade",r),J.once("upgradeError",r)}return this},u.prototype.onError=function(J){re("socket error %j",J),u.priorWebsocketSuccess=!1,this.emit("error",J),this.onClose("transport error",J)},u.prototype.onClose=function(J,Z){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(re('socket close with reason: "%s"',J),clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",J,Z),this.writeBuffer=[],this.prevBufferLen=0)},u.prototype.filterUpgrades=function(J){for(var Z=[],ee=0,ne=J.length;ee<ne;ee++)~ae(this.transports,J[ee])&&Z.push(J[ee]);return Z}},function(J,Z,ee){(function(Z){var ne,se,re=ee(12),ae=ee(2),le=ee(5),pe=ee(35),_e=ee(36),ve=ee(0)("engine.io-client:websocket");if("undefined"!=typeof WebSocket)ne=WebSocket;else if("undefined"!=typeof self)ne=self.WebSocket||self.MozWebSocket;else try{se=ee(37)}catch(J){}var ye=ne||se;function p(J){J&&J.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=J.perMessageDeflate,this.usingBrowserWebSocket=ne&&!J.forceNode,this.protocols=J.protocols,this.usingBrowserWebSocket||(ye=se),re.call(this,J)}J.exports=p,pe(p,re),p.prototype.name="websocket",p.prototype.supportsBinary=!0,p.prototype.doOpen=function(){if(this.check()){var J=this.uri(),Z=this.protocols,ee={agent:this.agent,perMessageDeflate:this.perMessageDeflate};ee.pfx=this.pfx,ee.key=this.key,ee.passphrase=this.passphrase,ee.cert=this.cert,ee.ca=this.ca,ee.ciphers=this.ciphers,ee.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(ee.headers=this.extraHeaders),this.localAddress&&(ee.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?Z?new ye(J,Z):new ye(J):new ye(J,Z,ee)}catch(J){return this.emit("error",J)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},p.prototype.addEventListeners=function(){var J=this;this.ws.onopen=function(){J.onOpen()},this.ws.onclose=function(){J.onClose()},this.ws.onmessage=function(Z){J.onData(Z.data)},this.ws.onerror=function(Z){J.onError("websocket error",Z)}},p.prototype.write=function(J){var ee=this;this.writable=!1;for(var ne=J.length,se=0,re=ne;se<re;se++)!function(J){ae.encodePacket(J,ee.supportsBinary,(function(se){if(!ee.usingBrowserWebSocket){var re={};J.options&&(re.compress=J.options.compress),ee.perMessageDeflate&&("string"==typeof se?Z.byteLength(se):se.length)<ee.perMessageDeflate.threshold&&(re.compress=!1)}try{ee.usingBrowserWebSocket?ee.ws.send(se):ee.ws.send(se,re)}catch(J){ve("websocket closed before onclose event")}--ne||a()}))}(J[se]);function a(){ee.emit("flush"),setTimeout((function(){ee.writable=!0,ee.emit("drain")}),0)}},p.prototype.onClose=function(){re.prototype.onClose.call(this)},p.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},p.prototype.uri=function(){var J=this.query||{},Z=this.secure?"wss":"ws",ee="";return this.port&&("wss"===Z&&443!==Number(this.port)||"ws"===Z&&80!==Number(this.port))&&(ee=":"+this.port),this.timestampRequests&&(J[this.timestampParam]=_e()),this.supportsBinary||(J.b64=1),(J=le.encode(J)).length&&(J="?"+J),Z+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+ee+this.path+J},p.prototype.check=function(){return!(!ye||"__initialize"in ye&&this.name===p.prototype.name)}}).call(this,ee(4).Buffer)},function(J,Z){J.exports=Object.keys||function(J){var Z=[],ee=Object.prototype.hasOwnProperty;for(var ne in J)ee.call(J,ne)&&Z.push(ne);return Z}},function(J,Z){var ee={}.toString;J.exports=Array.isArray||function(J){return"[object Array]"==ee.call(J)}},function(J,Z){J.exports=function(J,Z,ee){var ne=J.byteLength;if(Z=Z||0,ee=ee||ne,J.slice)return J.slice(Z,ee);if(Z<0&&(Z+=ne),ee<0&&(ee+=ne),ee>ne&&(ee=ne),Z>=ne||Z>=ee||0===ne)return new ArrayBuffer(0);for(var se=new Uint8Array(J),re=new Uint8Array(ee-Z),ae=Z,le=0;ae<ee;ae++,le++)re[le]=se[ae];return re.buffer}},function(J,Z){function r(){}J.exports=function(J,Z,ee){var ne=!1;return ee=ee||r,i.count=J,0===J?Z():i;function i(J,se){if(i.count<=0)throw new Error("after called too many times");--i.count,J?(ne=!0,Z(J),Z=ee):0!==i.count||ne||Z(null,se)}}},function(J,Z){var ee,ne,se,re=String.fromCharCode;function s(J){for(var Z,ee,ne=[],se=0,re=J.length;se<re;)(Z=J.charCodeAt(se++))>=55296&&Z<=56319&&se<re?56320==(64512&(ee=J.charCodeAt(se++)))?ne.push(((1023&Z)<<10)+(1023&ee)+65536):(ne.push(Z),se--):ne.push(Z);return ne}function a(J,Z){if(J>=55296&&J<=57343){if(Z)throw Error("Lone surrogate U+"+J.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function c(J,Z){return re(J>>Z&63|128)}function h(J,Z){if(!(4294967168&J))return re(J);var ee="";return 4294965248&J?4294901760&J?!(4292870144&J)&&(ee=re(J>>18&7|240),ee+=c(J,12),ee+=c(J,6)):(a(J,Z)||(J=65533),ee=re(J>>12&15|224),ee+=c(J,6)):ee=re(J>>6&31|192),ee+re(63&J|128)}function u(){if(se>=ne)throw Error("Invalid byte index");var J=255&ee[se];if(se++,128==(192&J))return 63&J;throw Error("Invalid continuation byte")}function f(J){var Z,re;if(se>ne)throw Error("Invalid byte index");if(se==ne)return!1;if(Z=255&ee[se],se++,!(128&Z))return Z;if(192==(224&Z)){if((re=(31&Z)<<6|u())>=128)return re;throw Error("Invalid continuation byte")}if(224==(240&Z)){if((re=(15&Z)<<12|u()<<6|u())>=2048)return a(re,J)?re:65533;throw Error("Invalid continuation byte")}if(240==(248&Z)&&(re=(7&Z)<<18|u()<<12|u()<<6|u())>=65536&&re<=1114111)return re;throw Error("Invalid UTF-8 detected")}J.exports={version:"2.1.2",encode:function(J,Z){for(var ee=!1!==(Z=Z||{}).strict,ne=s(J),se=ne.length,re=-1,ae="";++re<se;)ae+=h(ne[re],ee);return ae},decode:function(J,Z){var ae=!1!==(Z=Z||{}).strict;ee=s(J),ne=ee.length,se=0;for(var le,pe=[];!1!==(le=f(ae));)pe.push(le);return function(J){for(var Z,ee=J.length,ne=-1,se="";++ne<ee;)(Z=J[ne])>65535&&(se+=re((Z-=65536)>>>10&1023|55296),Z=56320|1023&Z),se+=re(Z);return se}(pe)}}},function(J,Z){!function(){"use strict";for(var J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ee=new Uint8Array(256),ne=0;ne<J.length;ne++)ee[J.charCodeAt(ne)]=ne;Z.encode=function(Z){var ee,ne=new Uint8Array(Z),se=ne.length,re="";for(ee=0;ee<se;ee+=3)re+=J[ne[ee]>>2],re+=J[(3&ne[ee])<<4|ne[ee+1]>>4],re+=J[(15&ne[ee+1])<<2|ne[ee+2]>>6],re+=J[63&ne[ee+2]];return se%3==2?re=re.substring(0,re.length-1)+"=":se%3==1&&(re=re.substring(0,re.length-2)+"=="),re},Z.decode=function(J){var Z,ne,se,re,ae,le=.75*J.length,pe=J.length,_e=0;"="===J[J.length-1]&&(le--,"="===J[J.length-2]&&le--);var ve=new ArrayBuffer(le),ye=new Uint8Array(ve);for(Z=0;Z<pe;Z+=4)ne=ee[J.charCodeAt(Z)],se=ee[J.charCodeAt(Z+1)],re=ee[J.charCodeAt(Z+2)],ae=ee[J.charCodeAt(Z+3)],ye[_e++]=ne<<2|se>>4,ye[_e++]=(15&se)<<4|re>>2,ye[_e++]=(3&re)<<6|63&ae;return ve}}()},function(J,Z){var ee=void 0!==ee?ee:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,ne=function(){try{return 2===new Blob(["hi"]).size}catch(J){return!1}}(),se=ne&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(J){return!1}}(),re=ee&&ee.prototype.append&&ee.prototype.getBlob;function s(J){return J.map((function(J){if(J.buffer instanceof ArrayBuffer){var Z=J.buffer;if(J.byteLength!==Z.byteLength){var ee=new Uint8Array(J.byteLength);ee.set(new Uint8Array(Z,J.byteOffset,J.byteLength)),Z=ee.buffer}return Z}return J}))}function a(J,Z){Z=Z||{};var ne=new ee;return s(J).forEach((function(J){ne.append(J)})),Z.type?ne.getBlob(Z.type):ne.getBlob()}function c(J,Z){return new Blob(s(J),Z||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,c.prototype=Blob.prototype),J.exports=ne?se?Blob:c:re?a:void 0},function(J,Z){J.exports=function(J,Z){var r=function(){};r.prototype=Z.prototype,J.prototype=new r,J.prototype.constructor=J}},function(J,Z,ee){"use strict";var ne,se="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),re={},ae=0,le=0;function c(J){var Z="";do{Z=se[J%64]+Z,J=Math.floor(J/64)}while(J>0);return Z}function h(){var J=c(+new Date);return J!==ne?(ae=0,ne=J):J+"."+c(ae++)}for(;le<64;le++)re[se[le]]=le;h.encode=c,h.decode=function(J){var Z=0;for(le=0;le<J.length;le++)Z=64*Z+re[J.charAt(le)];return Z},J.exports=h},function(J,Z,ee){const ne=ee(38),{URL:se}=ee(39),{addEventListener:re,removeEventListener:ae}=ee(46),le=ee(47),pe=ee(0)("wx-ws:wx-ws"),_e=["nodebuffer","arraybuffer"],ve=["CONNECTING","OPEN","CLOSING","CLOSED"];class f extends ne{constructor(J,Z,ee){super(),pe("constructor: ",J,Z,ee),this.readyState=f.CONNECTING,this.protocol="",this._closeCode=1006,this._closeMessage="",this._binaryType=_e[0],this._socket=null,this.supports={binary:!0},null!==J&&(this._bufferedAmount=0,this._redirects=0,"object"==typeof Z&&null!==Z&&(ee=Z,Z=void 0),function(J,Z,ee,ne){const se={maxPayload:104857600,perMessageDeflate:!0,...ne};pe("initAsClient: opts: ",se),J.url=Z;const re=function(J){pe("start create conn: ",J);const Z=wx.connectSocket(J);return Z||{onClose:wx.onSocketClose,onOpen:wx.onSocketOpen,onError:wx.onSocketError,onMessage:wx.onSocketMessage,send:wx.sendSocketMessage,close:wx.closeSocket}}({url:J.url,header:se.headers,protocols:ee,perMessageDeflate:!!se.perMessageDeflate,tcpNoDelay:!!se.tcpNoDelay});J.setSocket(re)}(this,J,Z,ee))}get CONNECTING(){return f.CONNECTING}get CLOSING(){return f.CLOSING}get CLOSED(){return f.CLOSED}get OPEN(){return f.OPEN}get bufferedAmount(){return this._socket?(this._socket.bufferSize||0)+this._sender._bufferedBytes:this._bufferedAmount}get binaryType(){return this._binaryType}set binaryType(J){pe("set binaryType: ",J),_e.includes(J)&&(this._binaryType=J)}setSocket(J,Z){this._socket=J,this._sender=new le(J),pe("set socket: socket =",J,", head =",Z,", this: ",this),this._socket.onOpen((J=>{pe("socket onopen: ",J),this.readyState=f.OPEN,this.emit("open",J)})),this._socket.onClose((J=>{pe("socket onclose: ",J),this._closeCode=J.code,this._closeMessage=J.reason,this.emitClose()})),this._socket.onError((J=>{pe("socket onerror: ",J),this.emit("error",J)})),this._socket.onMessage((J=>{pe("socket onmessage: ",J,this),this.emit("message",J.data)}))}emitClose(){this.readyState=f.CLOSED,this.removeEventListener(),this.emit("close",this._closeCode,this._closeMessage)}send(J,Z,ee){if(pe("socket send msg: ",J,this.readyState,", sender: ",this._sender),this.readyState===f.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"number"==typeof J&&(J=J.toString()),this.readyState===f.OPEN?this._sender.send(J,Z,ee):ee&&ee(new Error(`WebSocket is not open: readyState ${this.readyState} (${ve[this.readyState]})`))}close(J,Z){if(pe("closing connection: ",this.readyState),this.readyState!==f.CLOSED){if(this.readyState===f.CONNECTING)throw new Error("WebSocket was closed before the connection was established");this.readyState!==f.CLOSING&&(this.readyState=f.CLOSING,this._socket.close({code:J,reason:Z,success:()=>{pe("connection closed..."),this.readyState=f.CLOSED,this._socket=null}}))}}}ve.forEach(((J,Z)=>{f[J]=Z})),["open","error","close","message"].forEach((J=>{Object.defineProperty(f.prototype,`on${J}`,{get(){const Z=this.listeners(J);for(let J=0;J<Z.length;J++)if(Z[J]._listener)return Z[J]._listener},set(Z){const ee=this.listeners(J);for(let Z=0;Z<ee.length;Z++)ee[Z]._listener&&this.removeListener(J,ee[Z]);this.addEventListener(J,Z)}})})),f.prototype.addEventListener=re,f.prototype.removeEventListener=ae,J.exports=f},function(J,Z,ee){"use strict";var ne,se="object"==typeof Reflect?Reflect:null,re=se&&"function"==typeof se.apply?se.apply:function(J,Z,ee){return Function.prototype.apply.call(J,Z,ee)};ne=se&&"function"==typeof se.ownKeys?se.ownKeys:Object.getOwnPropertySymbols?function(J){return Object.getOwnPropertyNames(J).concat(Object.getOwnPropertySymbols(J))}:function(J){return Object.getOwnPropertyNames(J)};var ae=Number.isNaN||function(J){return J!=J};function a(){a.init.call(this)}J.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var le=10;function h(J){if("function"!=typeof J)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof J)}function u(J){return void 0===J._maxListeners?a.defaultMaxListeners:J._maxListeners}function f(J,Z,ee,ne){var se,re,ae,le;if(h(ee),void 0===(re=J._events)?(re=J._events=Object.create(null),J._eventsCount=0):(void 0!==re.newListener&&(J.emit("newListener",Z,ee.listener?ee.listener:ee),re=J._events),ae=re[Z]),void 0===ae)ae=re[Z]=ee,++J._eventsCount;else if("function"==typeof ae?ae=re[Z]=ne?[ee,ae]:[ae,ee]:ne?ae.unshift(ee):ae.push(ee),(se=u(J))>0&&ae.length>se&&!ae.warned){ae.warned=!0;var pe=new Error("Possible EventEmitter memory leak detected. "+ae.length+" "+String(Z)+" listeners added. Use emitter.setMaxListeners() to increase limit");pe.name="MaxListenersExceededWarning",pe.emitter=J,pe.type=Z,pe.count=ae.length,le=pe,console&&console.warn&&console.warn(le)}return J}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(J,Z,ee){var ne={fired:!1,wrapFn:void 0,target:J,type:Z,listener:ee},se=p.bind(ne);return se.listener=ee,ne.wrapFn=se,se}function d(J,Z,ee){var ne=J._events;if(void 0===ne)return[];var se=ne[Z];return void 0===se?[]:"function"==typeof se?ee?[se.listener||se]:[se]:ee?function(J){for(var Z=new Array(J.length),ee=0;ee<Z.length;++ee)Z[ee]=J[ee].listener||J[ee];return Z}(se):g(se,se.length)}function y(J){var Z=this._events;if(void 0!==Z){var ee=Z[J];if("function"==typeof ee)return 1;if(void 0!==ee)return ee.length}return 0}function g(J,Z){for(var ee=new Array(Z),ne=0;ne<Z;++ne)ee[ne]=J[ne];return ee}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return le},set:function(J){if("number"!=typeof J||J<0||ae(J))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+J+".");le=J}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(J){if("number"!=typeof J||J<0||ae(J))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+J+".");return this._maxListeners=J,this},a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(J){for(var Z=[],ee=1;ee<arguments.length;ee++)Z.push(arguments[ee]);var ne="error"===J,se=this._events;if(void 0!==se)ne=ne&&void 0===se.error;else if(!ne)return!1;if(ne){var ae;if(Z.length>0&&(ae=Z[0]),ae instanceof Error)throw ae;var le=new Error("Unhandled error."+(ae?" ("+ae.message+")":""));throw le.context=ae,le}var pe=se[J];if(void 0===pe)return!1;if("function"==typeof pe)re(pe,this,Z);else{var _e=pe.length,ve=g(pe,_e);for(ee=0;ee<_e;++ee)re(ve[ee],this,Z)}return!0},a.prototype.addListener=function(J,Z){return f(this,J,Z,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(J,Z){return f(this,J,Z,!0)},a.prototype.once=function(J,Z){return h(Z),this.on(J,l(this,J,Z)),this},a.prototype.prependOnceListener=function(J,Z){return h(Z),this.prependListener(J,l(this,J,Z)),this},a.prototype.removeListener=function(J,Z){var ee,ne,se,re,ae;if(h(Z),void 0===(ne=this._events))return this;if(void 0===(ee=ne[J]))return this;if(ee===Z||ee.listener===Z)0==--this._eventsCount?this._events=Object.create(null):(delete ne[J],ne.removeListener&&this.emit("removeListener",J,ee.listener||Z));else if("function"!=typeof ee){for(se=-1,re=ee.length-1;re>=0;re--)if(ee[re]===Z||ee[re].listener===Z){ae=ee[re].listener,se=re;break}if(se<0)return this;0===se?ee.shift():function(J,Z){for(;Z+1<J.length;Z++)J[Z]=J[Z+1];J.pop()}(ee,se),1===ee.length&&(ne[J]=ee[0]),void 0!==ne.removeListener&&this.emit("removeListener",J,ae||Z)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(J){var Z,ee,ne;if(void 0===(ee=this._events))return this;if(void 0===ee.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==ee[J]&&(0==--this._eventsCount?this._events=Object.create(null):delete ee[J]),this;if(0===arguments.length){var se,re=Object.keys(ee);for(ne=0;ne<re.length;++ne)"removeListener"!==(se=re[ne])&&this.removeAllListeners(se);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(Z=ee[J]))this.removeListener(J,Z);else if(void 0!==Z)for(ne=Z.length-1;ne>=0;ne--)this.removeListener(J,Z[ne]);return this},a.prototype.listeners=function(J){return d(this,J,!0)},a.prototype.rawListeners=function(J){return d(this,J,!1)},a.listenerCount=function(J,Z){return"function"==typeof J.listenerCount?J.listenerCount(Z):y.call(J,Z)},a.prototype.listenerCount=y,a.prototype.eventNames=function(){return this._eventsCount>0?ne(this._events):[]}},function(J,Z,ee){"use strict";var ne=ee(40),se=ee(42);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}Z.parse=b,Z.resolve=function(J,Z){return b(J,!1,!0).resolve(Z)},Z.resolveObject=function(J,Z){return J?b(J,!1,!0).resolveObject(Z):Z},Z.format=function(J){return se.isString(J)&&(J=b(J)),J instanceof i?J.format():i.prototype.format.call(J)},Z.Url=i;var re=/^([a-z0-9.+-]+:)/i,ae=/:[0-9]*$/,le=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,pe=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),_e=["'"].concat(pe),ve=["%","/","?",";","#"].concat(_e),ye=["/","?","#"],Fe=/^[+a-z0-9A-Z_-]{0,63}$/,qe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,$e={javascript:!0,"javascript:":!0},He={javascript:!0,"javascript:":!0},Ye={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Je=ee(43);function b(J,Z,ee){if(J&&se.isObject(J)&&J instanceof i)return J;var ne=new i;return ne.parse(J,Z,ee),ne}i.prototype.parse=function(J,Z,ee){if(!se.isString(J))throw new TypeError("Parameter 'url' must be a string, not "+typeof J);var ae=J.indexOf("?"),pe=-1!==ae&&ae<J.indexOf("#")?"?":"#",Xe=J.split(pe);Xe[0]=Xe[0].replace(/\\/g,"/");var Qe=J=Xe.join(pe);if(Qe=Qe.trim(),!ee&&1===J.split("#").length){var tt=le.exec(Qe);if(tt)return this.path=Qe,this.href=Qe,this.pathname=tt[1],tt[2]?(this.search=tt[2],this.query=Z?Je.parse(this.search.substr(1)):this.search.substr(1)):Z&&(this.search="",this.query={}),this}var nt=re.exec(Qe);if(nt){var it=(nt=nt[0]).toLowerCase();this.protocol=it,Qe=Qe.substr(nt.length)}if(ee||nt||Qe.match(/^\/\/[^@\/]+@[^@\/]+/)){var ot="//"===Qe.substr(0,2);!ot||nt&&He[nt]||(Qe=Qe.substr(2),this.slashes=!0)}if(!He[nt]&&(ot||nt&&!Ye[nt])){for(var pt,mt,It=-1,St=0;St<ye.length;St++)-1!==(Mt=Qe.indexOf(ye[St]))&&(-1===It||Mt<It)&&(It=Mt);for(-1!==(mt=-1===It?Qe.lastIndexOf("@"):Qe.lastIndexOf("@",It))&&(pt=Qe.slice(0,mt),Qe=Qe.slice(mt+1),this.auth=decodeURIComponent(pt)),It=-1,St=0;St<ve.length;St++){var Mt;-1!==(Mt=Qe.indexOf(ve[St]))&&(-1===It||Mt<It)&&(It=Mt)}-1===It&&(It=Qe.length),this.host=Qe.slice(0,It),Qe=Qe.slice(It),this.parseHost(),this.hostname=this.hostname||"";var bt="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!bt)for(var At=this.hostname.split(/\./),Ot=(St=0,At.length);St<Ot;St++){var wt=At[St];if(wt&&!wt.match(Fe)){for(var Dt="",Lt=0,kt=wt.length;Lt<kt;Lt++)wt.charCodeAt(Lt)>127?Dt+="x":Dt+=wt[Lt];if(!Dt.match(Fe)){var Ut=At.slice(0,St),Gt=At.slice(St+1),xt=wt.match(qe);xt&&(Ut.push(xt[1]),Gt.unshift(xt[2])),Gt.length&&(Qe="/"+Gt.join(".")+Qe),this.hostname=Ut.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),bt||(this.hostname=ne.toASCII(this.hostname));var Ft=this.port?":"+this.port:"",$t=this.hostname||"";this.host=$t+Ft,this.href+=this.host,bt&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==Qe[0]&&(Qe="/"+Qe))}if(!$e[it])for(St=0,Ot=_e.length;St<Ot;St++){var jt=_e[St];if(-1!==Qe.indexOf(jt)){var Wt=encodeURIComponent(jt);Wt===jt&&(Wt=escape(jt)),Qe=Qe.split(jt).join(Wt)}}var Zt=Qe.indexOf("#");-1!==Zt&&(this.hash=Qe.substr(Zt),Qe=Qe.slice(0,Zt));var Xt=Qe.indexOf("?");if(-1!==Xt?(this.search=Qe.substr(Xt),this.query=Qe.substr(Xt+1),Z&&(this.query=Je.parse(this.query)),Qe=Qe.slice(0,Xt)):Z&&(this.search="",this.query={}),Qe&&(this.pathname=Qe),Ye[it]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){Ft=this.pathname||"";var Bn=this.search||"";this.path=Ft+Bn}return this.href=this.format(),this},i.prototype.format=function(){var J=this.auth||"";J&&(J=(J=encodeURIComponent(J)).replace(/%3A/i,":"),J+="@");var Z=this.protocol||"",ee=this.pathname||"",ne=this.hash||"",re=!1,ae="";this.host?re=J+this.host:this.hostname&&(re=J+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(re+=":"+this.port)),this.query&&se.isObject(this.query)&&Object.keys(this.query).length&&(ae=Je.stringify(this.query));var le=this.search||ae&&"?"+ae||"";return Z&&":"!==Z.substr(-1)&&(Z+=":"),this.slashes||(!Z||Ye[Z])&&!1!==re?(re="//"+(re||""),ee&&"/"!==ee.charAt(0)&&(ee="/"+ee)):re||(re=""),ne&&"#"!==ne.charAt(0)&&(ne="#"+ne),le&&"?"!==le.charAt(0)&&(le="?"+le),Z+re+(ee=ee.replace(/[?#]/g,(function(J){return encodeURIComponent(J)})))+(le=le.replace("#","%23"))+ne},i.prototype.resolve=function(J){return this.resolveObject(b(J,!1,!0)).format()},i.prototype.resolveObject=function(J){if(se.isString(J)){var Z=new i;Z.parse(J,!1,!0),J=Z}for(var ee=new i,ne=Object.keys(this),re=0;re<ne.length;re++){var ae=ne[re];ee[ae]=this[ae]}if(ee.hash=J.hash,""===J.href)return ee.href=ee.format(),ee;if(J.slashes&&!J.protocol){for(var le=Object.keys(J),pe=0;pe<le.length;pe++){var _e=le[pe];"protocol"!==_e&&(ee[_e]=J[_e])}return Ye[ee.protocol]&&ee.hostname&&!ee.pathname&&(ee.path=ee.pathname="/"),ee.href=ee.format(),ee}if(J.protocol&&J.protocol!==ee.protocol){if(!Ye[J.protocol]){for(var ve=Object.keys(J),ye=0;ye<ve.length;ye++){var Fe=ve[ye];ee[Fe]=J[Fe]}return ee.href=ee.format(),ee}if(ee.protocol=J.protocol,J.host||He[J.protocol])ee.pathname=J.pathname;else{for(var qe=(J.pathname||"").split("/");qe.length&&!(J.host=qe.shift()););J.host||(J.host=""),J.hostname||(J.hostname=""),""!==qe[0]&&qe.unshift(""),qe.length<2&&qe.unshift(""),ee.pathname=qe.join("/")}if(ee.search=J.search,ee.query=J.query,ee.host=J.host||"",ee.auth=J.auth,ee.hostname=J.hostname||J.host,ee.port=J.port,ee.pathname||ee.search){var $e=ee.pathname||"",Je=ee.search||"";ee.path=$e+Je}return ee.slashes=ee.slashes||J.slashes,ee.href=ee.format(),ee}var Xe=ee.pathname&&"/"===ee.pathname.charAt(0),Qe=J.host||J.pathname&&"/"===J.pathname.charAt(0),tt=Qe||Xe||ee.host&&J.pathname,nt=tt,it=ee.pathname&&ee.pathname.split("/")||[],ot=(qe=J.pathname&&J.pathname.split("/")||[],ee.protocol&&!Ye[ee.protocol]);if(ot&&(ee.hostname="",ee.port=null,ee.host&&(""===it[0]?it[0]=ee.host:it.unshift(ee.host)),ee.host="",J.protocol&&(J.hostname=null,J.port=null,J.host&&(""===qe[0]?qe[0]=J.host:qe.unshift(J.host)),J.host=null),tt=tt&&(""===qe[0]||""===it[0])),Qe)ee.host=J.host||""===J.host?J.host:ee.host,ee.hostname=J.hostname||""===J.hostname?J.hostname:ee.hostname,ee.search=J.search,ee.query=J.query,it=qe;else if(qe.length)it||(it=[]),it.pop(),it=it.concat(qe),ee.search=J.search,ee.query=J.query;else if(!se.isNullOrUndefined(J.search))return ot&&(ee.hostname=ee.host=it.shift(),(Mt=!!(ee.host&&ee.host.indexOf("@")>0)&&ee.host.split("@"))&&(ee.auth=Mt.shift(),ee.host=ee.hostname=Mt.shift())),ee.search=J.search,ee.query=J.query,se.isNull(ee.pathname)&&se.isNull(ee.search)||(ee.path=(ee.pathname?ee.pathname:"")+(ee.search?ee.search:"")),ee.href=ee.format(),ee;if(!it.length)return ee.pathname=null,ee.search?ee.path="/"+ee.search:ee.path=null,ee.href=ee.format(),ee;for(var pt=it.slice(-1)[0],mt=(ee.host||J.host||it.length>1)&&("."===pt||".."===pt)||""===pt,It=0,St=it.length;St>=0;St--)"."===(pt=it[St])?it.splice(St,1):".."===pt?(it.splice(St,1),It++):It&&(it.splice(St,1),It--);if(!tt&&!nt)for(;It--;It)it.unshift("..");!tt||""===it[0]||it[0]&&"/"===it[0].charAt(0)||it.unshift(""),mt&&"/"!==it.join("/").substr(-1)&&it.push("");var Mt,bt=""===it[0]||it[0]&&"/"===it[0].charAt(0);return ot&&(ee.hostname=ee.host=bt?"":it.length?it.shift():"",(Mt=!!(ee.host&&ee.host.indexOf("@")>0)&&ee.host.split("@"))&&(ee.auth=Mt.shift(),ee.host=ee.hostname=Mt.shift())),(tt=tt||ee.host&&it.length)&&!bt&&it.unshift(""),it.length?ee.pathname=it.join("/"):(ee.pathname=null,ee.path=null),se.isNull(ee.pathname)&&se.isNull(ee.search)||(ee.path=(ee.pathname?ee.pathname:"")+(ee.search?ee.search:"")),ee.auth=J.auth||ee.auth,ee.slashes=ee.slashes||J.slashes,ee.href=ee.format(),ee},i.prototype.parseHost=function(){var J=this.host,Z=ae.exec(J);Z&&(":"!==(Z=Z[0])&&(this.port=Z.substr(1)),J=J.substr(0,J.length-Z.length)),J&&(this.hostname=J)}},function(J,Z,ee){(function(J,ne){var se;!function(){Z&&Z.nodeType,J&&J.nodeType;var re="object"==typeof ne&&ne;re.global!==re&&re.window!==re&&re.self;var ae,le=2147483647,pe=/^xn--/,_e=/[^\x20-\x7E]/,ve=/[\x2E\u3002\uFF0E\uFF61]/g,ye={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Fe=Math.floor,qe=String.fromCharCode;function y(J){throw new RangeError(ye[J])}function g(J,Z){for(var ee=J.length,ne=[];ee--;)ne[ee]=Z(J[ee]);return ne}function v(J,Z){var ee=J.split("@"),ne="";return ee.length>1&&(ne=ee[0]+"@",J=ee[1]),ne+g((J=J.replace(ve,".")).split("."),Z).join(".")}function m(J){for(var Z,ee,ne=[],se=0,re=J.length;se<re;)(Z=J.charCodeAt(se++))>=55296&&Z<=56319&&se<re?56320==(64512&(ee=J.charCodeAt(se++)))?ne.push(((1023&Z)<<10)+(1023&ee)+65536):(ne.push(Z),se--):ne.push(Z);return ne}function b(J){return g(J,(function(J){var Z="";return J>65535&&(Z+=qe((J-=65536)>>>10&1023|55296),J=56320|1023&J),Z+qe(J)})).join("")}function w(J,Z){return J+22+75*(J<26)-((0!=Z)<<5)}function A(J,Z,ee){var ne=0;for(J=ee?Fe(J/700):J>>1,J+=Fe(J/Z);J>455;ne+=36)J=Fe(J/35);return Fe(ne+36*J/(J+38))}function k(J){var Z,ee,ne,se,re,ae,pe,_e,ve,ye,qe,$e=[],He=J.length,Ye=0,Je=128,Xe=72;for((ee=J.lastIndexOf("-"))<0&&(ee=0),ne=0;ne<ee;++ne)J.charCodeAt(ne)>=128&&y("not-basic"),$e.push(J.charCodeAt(ne));for(se=ee>0?ee+1:0;se<He;){for(re=Ye,ae=1,pe=36;se>=He&&y("invalid-input"),((_e=(qe=J.charCodeAt(se++))-48<10?qe-22:qe-65<26?qe-65:qe-97<26?qe-97:36)>=36||_e>Fe((le-Ye)/ae))&&y("overflow"),Ye+=_e*ae,!(_e<(ve=pe<=Xe?1:pe>=Xe+26?26:pe-Xe));pe+=36)ae>Fe(le/(ye=36-ve))&&y("overflow"),ae*=ye;Xe=A(Ye-re,Z=$e.length+1,0==re),Fe(Ye/Z)>le-Je&&y("overflow"),Je+=Fe(Ye/Z),Ye%=Z,$e.splice(Ye++,0,Je)}return b($e)}function _(J){var Z,ee,ne,se,re,ae,pe,_e,ve,ye,$e,He,Ye,Je,Xe,Qe=[];for(He=(J=m(J)).length,Z=128,ee=0,re=72,ae=0;ae<He;++ae)($e=J[ae])<128&&Qe.push(qe($e));for(ne=se=Qe.length,se&&Qe.push("-");ne<He;){for(pe=le,ae=0;ae<He;++ae)($e=J[ae])>=Z&&$e<pe&&(pe=$e);for(pe-Z>Fe((le-ee)/(Ye=ne+1))&&y("overflow"),ee+=(pe-Z)*Ye,Z=pe,ae=0;ae<He;++ae)if(($e=J[ae])<Z&&++ee>le&&y("overflow"),$e==Z){for(_e=ee,ve=36;!(_e<(ye=ve<=re?1:ve>=re+26?26:ve-re));ve+=36)Xe=_e-ye,Je=36-ye,Qe.push(qe(w(ye+Xe%Je,0))),_e=Fe(Xe/Je);Qe.push(qe(w(_e,0))),re=A(ee,Ye,ne==se),ee=0,++ne}++ee,++Z}return Qe.join("")}ae={version:"1.4.1",ucs2:{decode:m,encode:b},decode:k,encode:_,toASCII:function(J){return v(J,(function(J){return _e.test(J)?"xn--"+_(J):J}))},toUnicode:function(J){return v(J,(function(J){return pe.test(J)?k(J.slice(4).toLowerCase()):J}))}},void 0===(se=function(){return ae}.call(Z,ee,Z,J))||(J.exports=se)}()}).call(this,ee(41)(J),ee(9))},function(J,Z){J.exports=function(J){return J.webpackPolyfill||(J.deprecate=function(){},J.paths=[],J.children||(J.children=[]),Object.defineProperty(J,"loaded",{enumerable:!0,get:function(){return J.l}}),Object.defineProperty(J,"id",{enumerable:!0,get:function(){return J.i}}),J.webpackPolyfill=1),J}},function(J,Z,ee){"use strict";J.exports={isString:function(J){return"string"==typeof J},isObject:function(J){return"object"==typeof J&&null!==J},isNull:function(J){return null===J},isNullOrUndefined:function(J){return null==J}}},function(J,Z,ee){"use strict";Z.decode=Z.parse=ee(44),Z.encode=Z.stringify=ee(45)},function(J,Z,ee){"use strict";function n(J,Z){return Object.prototype.hasOwnProperty.call(J,Z)}J.exports=function(J,Z,ee,se){Z=Z||"&",ee=ee||"=";var re={};if("string"!=typeof J||0===J.length)return re;var ae=/\+/g;J=J.split(Z);var le=1e3;se&&"number"==typeof se.maxKeys&&(le=se.maxKeys);var pe=J.length;le>0&&pe>le&&(pe=le);for(var _e=0;_e<pe;++_e){var ve,ye,Fe,qe,$e=J[_e].replace(ae,"%20"),He=$e.indexOf(ee);He>=0?(ve=$e.substr(0,He),ye=$e.substr(He+1)):(ve=$e,ye=""),Fe=decodeURIComponent(ve),qe=decodeURIComponent(ye),n(re,Fe)?ne(re[Fe])?re[Fe].push(qe):re[Fe]=[re[Fe],qe]:re[Fe]=qe}return re};var ne=Array.isArray||function(J){return"[object Array]"===Object.prototype.toString.call(J)}},function(J,Z,ee){"use strict";var n=function(J){switch(typeof J){case"string":return J;case"boolean":return J?"true":"false";case"number":return isFinite(J)?J:"";default:return""}};J.exports=function(J,Z,ee,re){return Z=Z||"&",ee=ee||"=",null===J&&(J=void 0),"object"==typeof J?i(se(J),(function(se){var re=encodeURIComponent(n(se))+ee;return ne(J[se])?i(J[se],(function(J){return re+encodeURIComponent(n(J))})).join(Z):re+encodeURIComponent(n(J[se]))})).join(Z):re?encodeURIComponent(n(re))+ee+encodeURIComponent(n(J)):""};var ne=Array.isArray||function(J){return"[object Array]"===Object.prototype.toString.call(J)};function i(J,Z){if(J.map)return J.map(Z);for(var ee=[],ne=0;ne<J.length;ne++)ee.push(Z(J[ne],ne));return ee}var se=Object.keys||function(J){var Z=[];for(var ee in J)Object.prototype.hasOwnProperty.call(J,ee)&&Z.push(ee);return Z}},function(J,Z,ee){"use strict";class n{constructor(J,Z){this.target=Z,this.type=J}}class o extends n{constructor(J,Z){super("message",Z),this.data=J}}class i extends n{constructor(J,Z,ee){super("close",ee),this.wasClean=ee._closeFrameReceived&&ee._closeFrameSent,this.reason=Z,this.code=J}}class s extends n{constructor(J){super("open",J)}}class a extends n{constructor(J,Z){super("error",Z),this.message=J.message,this.error=J}}const ne={addEventListener(J,Z){function r(J){Z.call(this,new o(J,this))}function n(J,ee){Z.call(this,new i(J,ee,this))}function c(J){Z.call(this,new a(J,this))}function h(){Z.call(this,new s(this))}"function"==typeof Z&&("message"===J?(r._listener=Z,this.on(J,r)):"close"===J?(n._listener=Z,this.on(J,n)):"error"===J?(c._listener=Z,this.on(J,c)):"open"===J?(h._listener=Z,this.on(J,h)):this.on(J,Z))},removeEventListener(J,Z){const ee=this.listeners(J);for(let ne=0;ne<ee.length;ne++)ee[ne]!==Z&&ee[ne]._listener!==Z||this.removeListener(J,ee[ne])}};J.exports=ne},function(J,Z,ee){const ne=ee(0)("wx-ws:sender");J.exports=class{constructor(J){this._socket=J,this._queue=[],this._bufferedBytes=0,this._deflating=!1}send(J,Z,ee){ne("send msg: ",J," sender: ",this,this._deflating),this._deflating?this.enqueue([this.dispatch,J,Z,ee]):this.dispatch(J,Z,ee)}dispatch(J,Z,ee){ne("dispatch msg: ",J,", sender: ",this),this._deflating=!0,"function"==typeof Z&&(ee=Z,Z={}),this._deflating=!1,this._socket.send({data:J,success:J=>ee&&ee(null,J),fail:J=>ee&&ee(J)}),this.dequeue()}dequeue(){for(;!this._deflating&&this._queue.length;){const J=this._queue.shift();this._bufferedBytes-=J[1].length,Reflect.apply(J[0],this,J.slice(1))}}enqueue(J){this._bufferedBytes+=J[1].length,this._queue.push(J)}}},function(J,Z){J.exports=function(J,Z){for(var ee=[],ne=(Z=Z||0)||0;ne<J.length;ne++)ee[ne-Z]=J[ne];return ee}},function(J,Z){function r(J){J=J||{},this.ms=J.min||100,this.max=J.max||1e4,this.factor=J.factor||2,this.jitter=J.jitter>0&&J.jitter<=1?J.jitter:0,this.attempts=0}J.exports=r,r.prototype.duration=function(){var J=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var Z=Math.random(),ee=Math.floor(Z*this.jitter*J);J=1&Math.floor(10*Z)?J+ee:J-ee}return 0|Math.min(J,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(J){this.ms=J},r.prototype.setMax=function(J){this.max=J},r.prototype.setJitter=function(J){this.jitter=J}}])},406:function(J,Z){"use strict";const Ge=J=>J instanceof Date?J:new Date,We=J=>J<10?"0"+J:""+J;function cr(J=new Date){return[(J=Ge(J)).getHours(),J.getMinutes(),J.getSeconds()].map(We).join(":")}function hr(J=new Date){return[(J=Ge(J)).getFullYear(),J.getMonth()+1,J.getDate()].map(We).join("-")}const Pt=()=>{},ee={log:Pt,info:Pt,warn:Pt,debug:Pt,error:Pt},ne=wx;function lr(){switch(function ur(){return(J=ne.getSystemInfoSync())&&J.inFinChat?3:1;var J}()){case 1:return"WeChat";case 2:return"TikTok";case 3:return"FinClip";default:return}}const se="BonreeRUM",re="2.2.3",ae="2024041001",le="mpview",pe="custom_mpview",_e="action",ve="launch",ye="statechange",Fe="network_statechange",qe="userchange",$e="span",He="jserror",Ye="network",Je="customlog",Xe="speedtest",Qe="customevent",tt="custommetric",nt="crash",it="clear_data",ot="upload_data",pt="check_data",mt="stop",It="get_config",St="clear_data",Mt="get_sin_key",bt="get_data",At=Symbol("$hook"),Ot=["unknown","http1.1","h1s","h2","","ws","wss","tcp","","","udp","quic"],wt="$$BonreeCfg",Dt="$$BonreeUploadData",Lt="$$BonreeAttributeData",kt="$$BonreeCacheData",Ut="$$DEVICE_ID",Gt="firstVisitDayTime",xt="_bonree_encode_url_query",Ft="d",$t="i",jt="bonreeShare",Wt=256,Zt="Please pass in a string type parameter!",Xt="sm4",Bn="sessionReplay",Hn="setConfig",Kn="setUploadData",es="initDrawer",ts="setCanvasDrawer",ns="initRecord",ss="finishRecord",is="pauseRecord",rs="resumeRecord",os="checkUploadData",as="setValue",cs="getConfig",us="startRelate",ls="stopRelate",hs="setCurrentRootId",ds="generateRelate",ps="setLastRootId",gs="clearCurrentId",fs="checkRelat",_s="setRootNodeData",ms="addRelateEventData";var C=function(){};function c(J){return null!=J}function yt(J){return c(J)&&J instanceof Array}function gr(J){return c(J)&&!function(J){if(c(J)){if(Jt(J,"length"))return!J.length;if(Jt(J,"size"))return!J.size;for(var Z in J)if(Jt(J,Z))return}return 1}(J)}function Kt(J,Z){return(yt(J)?function(J,Z){if(yt(J))for(var ee=0,ne=J.length;ee<ne&&!1!==Z(J[ee],ee);ee++);}:Et)(J,Z)}function Et(J,Z){if(c(J))for(var ee in J)if(Jt(J,ee)&&!1===Z(J[ee],ee))break}function L(J,Z){return J&&Z&&Et(Z,(function(Z,ee){J[ee]=Z})),J}function R(){return Date.now()}function q(){return O(_(32),8)+"-"+O(_(16),4)+"-"+O(16384|_(12),4)+"-"+O(32768|_(14),4)+"-"+O(_(48),12)}function oe(J){return c(J.length)?Array.prototype.slice.call(J):J}function tn(J,Z){return!!(J&&Z&&J.length>=Z.length)&&J.substring(J.length-Z.length)===Z}function mr(J,Z){return J?J.length<=Z?J:J.substr(0,Z-3)+"...":""}function en(J,Z){return!(!J||!J.indexOf)&&0===J.indexOf(Z)}function zt(J){if(E(J))try{var Z=JSON.parse(J);return!("object"!=typeof Z||!Z)}catch(J){}else if("object"==typeof J)return!0;return!1}function E(J){return"[object String]"===Object.prototype.toString.call(J)}function nn(J){return""===J}function ut(J){return"number"==typeof J&&!isNaN(J)}const vs=Object.assign;function N(){return+new Date}function lt(J){return"function"==typeof J}function k(J){return"object"==typeof J}function rn(J){let Z=0;for(let ne=0,se=J.length;ne<se;ne++){var ee=J.charCodeAt(ne);Z+=ee<=127?1:ee<=2047?2:ee<=65535?3:4}return Z}function Vt(J){if(J){if("string"==typeof J)return rn(J);if(J instanceof ArrayBuffer)return J.byteLength;if(k(J)){let Z="";try{Z=JSON.stringify(J)}catch(J){}return rn(Z)}}return 0}function Te(J){if(c(J))return Array.isArray(J)||J.length?J.length:0}function an(J){var Z=[];for(const ee in J=J||{})Object.prototype.hasOwnProperty.call(J,ee)&&void 0!==J[ee]&&Z.push(ee+"="+Ir(J[ee],"msg"===ee));return Z.join("&")}function Ir(J,Z){try{J=Z?encodeURIComponent(J).replace(/\(/g,"%28").replace(/\)/g,"%29"):encodeURIComponent(J)}catch(J){}return J}function Re(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(J){var Z=16*Math.random()|0;return("x"===J?Z:3&Z|8).toString(16)}))}function dt(J){try{return ne.getStorageSync(J)}catch(Z){try{return ne.getStorageSync(J)}catch(Z){console.debug(J," GetStorage fail!\n",Z)}}}function ce(J,Z){try{ne.setStorageSync(J,Z)}catch(ee){try{ne.setStorageSync(J,Z)}catch(Z){console.debug(J," SetStorage fail!\n",Z)}}}function Jt(J,Z){return J&&Object.prototype.hasOwnProperty.call(J,Z)}function yr(J){if(J)return J.split(" ")[1]||"0"}function V(J,Z,ee,ne,se){return void 0!==J&&(null==Z||""===Z||null!==ne&&Z.length>ne||!(!se||!isNaN(Z)))}function U(J,Z){return J&&J.length>Z?J.slice(0,Z):J}function _(J){return J<0?NaN:J<=30?0|Math.random()*(1<<J):J<=53?(0|Math.random()*(1<<30))+(0|Math.random()*(1<<J-30))*(1<<30):NaN}function O(J,Z){for(var ee=J.toString(16),ne=Z-ee.length,se="0";0<ne;ne>>>=1,se+=se)1&ne&&(ee=se+ee);return ee}function sn(J){var Z=Math.floor(100*Math.random());return!(0<=J&&J<=100)||Z<J}function Er(J){return 0<=J&&J<=100&&sn(J)?"00-"+O(_(32),8)+O(_(32),8)+O(_(32),8)+O(_(32),8)+"-"+O(_(32),8)+O(_(32),8)+"-01":"00-"+O(_(32),8)+O(_(32),8)+O(_(32),8)+O(_(32),8)+"-"+O(_(32),8)+O(_(32),8)+"-00"}function on(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(J=>{var Z=16*Math.random()|0;return("x"===J?Z:3&Z|8).toString(16)}))}function cn(J){return 16==J?O(_(32),8)+O(_(32),8):32==J?O(_(32),8)+O(_(32),8)+O(_(32),8)+O(_(32),8):void 0}function Se(J){return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/i.test(J)}function De(J){var Z=/^(?:https?:\/\/)?(?:[^/@]+@)?(?:([^:/?#]+)|(?:\[(.*?)\]))/i.exec(J),ee=/\?([^#]+)/i.exec(J);return{href:J,hostname:Z&&Z[1]||"",search:ee&&ee[1]||""}}function Nt(J){return/^[:a-zA-Z0-9_\-\s.@/]+$/.test(J)&&!/^[\s]+$/.test(J)}function Tr(J,Z){var ee=(J=String(J).split(Z)).shift();return{startStr:ee,endStr:J.join(Z),all:J.concat([ee])}}function he(){try{var J=getCurrentPages();if(0<J.length)return J[J.length-1];console.warn("get current page: failed")}catch(J){}}function we(J=he()){let Z="";try{J&&(Z=J.route)}catch(J){}return Z}function hn(J=he()){let Z="";return J&&"[object Object]"===Object.prototype.toString.call(J)&&J[xt]?J[xt]:Z}function be(J=he()){var Z=we(J);J=hn(J);return Z?J?Z+"?"+J:Z:""}function un(J){let Z;try{Z=decodeURIComponent(J)}catch(ee){Z=J}return Z}function ln(J){return 0<=["number","boolean","string"].indexOf(typeof J)}function Ht(J,Z){return c(J)&&E(J)&&0<String(J).length&&String(J).length<=Z&&Nt(J)}function dn(){return ne.BonreeRUM&&ne.BonreeRUM.viewInfo?ne.BonreeRUM.viewInfo:{}}function ft(){return!ne.BonreeRUM||ne.BonreeRUM.$$Bonree||ne.BonreeRUM.$$FinClip}const ys=[pe,qe,$e,Je,Xe,Qe,tt,nt,it,pt,It,ot,Fe,mt];function T(J,Z,ee){if(ne[se]){var re=ne[se]&&ne[se].emits,ae=bs.appId;for(let ne=0;ne<re.length;ne++){const se=re[ne],le=se.appId;-1<ys.indexOf(J)&&le!==ae||se.emit(J,Z,le,ee)}}}function _t(){this.plugin={},this.registedPlugin=new Set,this.pluginCfg={}}_t.prototype.register=function(J,Z,ee){J&&Z&&(this.plugin[J]=Z,this.pluginCfg[J]=ee,this.registedPlugin.add(J))},_t.prototype.install=function(J,Z){var ee;J&&k(J)&&(ee=J.name,J=J.exec,this.registedPlugin.has(ee)||this.register(ee,J,Z))},_t.prototype.use=function(J){return this.plugin[J]},_t.prototype.has=function(J){return this.registedPlugin.has(J)},_t.prototype.getPluginCfg=function(J){return this.pluginCfg[J]};var Is=new _t;const Ss={sessionReplay:null,cfg:null,statu:!1,register:!1};function X(J,Z){var ee;!1===Ss.register&&Is&&(Ss.sessionReplay=Is.use(Bn),Ss.cfg=Is.getPluginCfg(Bn),Ss.register=!0,Ss.sessionReplay)&&k(Ss.sessionReplay)&&(Ss.statu=!0,Ss.sessionReplay[as])&&Ss.sessionReplay[as]({type:1,key:"option",value:Ss.cfg}),!0===Ss.register&&!1===Ss.statu||(ee=Ss.sessionReplay)&&ee[J]&&ee[J](Z)}const Es={smKey:"",identifier:""},Cs={encrypt:function(J){const Z=Is.use(Xt),ee=Is.getPluginCfg(Xt),ne=ee&&ee.key,se=ee&&ee.identifier||"";if(Es.identifier=se,Z&&J&&ee&&ne&&se){Es.smKey=ne;const ee=JSON.stringify(J);try{return Z(ee,ne,1)||J}catch(J){console.warn("encrypt data error!",J)}}return J},decrypt:function(J,Z){var ee,ne=Is.use(Xt),se=Es.smKey;Z=Z&&Z.split(":")[1];if(ne&&J&&se&&J instanceof ArrayBuffer&&Z===Es.identifier)try{if(ee=ne(J,se,0))return JSON.parse(ee)}catch(J){console.warn("decrypt data error",J)}},createReqHeader:function(){if(Is.has(Xt)){var J=(Z=Is.getPluginCfg(Xt))&&Z.identifier,Z=Z&&Z.key;if(J&&Z&&/^[A-Za-z0-9_-]{1,256}$/.test(J))return"sm4:"+J}},hasSm4:function(){return!!Es.smKey}};function G(){this.currentUserId=null,this.currentCorrelationId="",this.deviceInfo={},this.appInfo={ai:"",av:"1.0.0",an:"",ci:"",at:5},this.shareInfo={flag:!1,s:1001,sl:0,iso:!1},this.cacheData={firstVisitTime:0,firstVisitDayTime:0},this.appLaunchInfo={initTime:R(),isFirstLaunch:!1},this.sessionStartTime=0,this.userAgent=null,this.launchTime=null,this.pageHideTime=null,this.eventViewInfo={},this.userInfoMap={},this.userInfoFui=null,this.networkStateInfo={dip:"",ns:""},this.networkStateInfoMap={},this.eventExtInfo={},this.channel=null,this.stopAgent=!1,this.unableConfig=!1,this.getSysInfo(),this.getAppInfo()}G.prototype.getSysInfo=function(){var J,Z=ne.getSystemInfoSync(),ee=function Sr(){let J=dt(Ut);return J||(Z=q(),ce(Ut,Z),Z);var Z}();this.deviceInfo={di:ee,a:"user",bn:Z.brand,m:Z.model,omv:Z.system&&yr(Z.system),ot:Z.system&&((J=Z.system)&&"string"==typeof J?-1<J.toLowerCase().indexOf("ios")?0:-1<J.toLowerCase().indexOf("android")?1:-1<J.toLowerCase().indexOf("windows")?2:-1<J.toLowerCase().indexOf("harmony")?3:4:4),l:Z.language,ds:Z.screenWidth+"*"+Z.screenHeight,ram:-1,rom:-1,ctn:lr(),ctv:Z.version},this.cacheData.clientId=ee},G.prototype.getAppInfo=function(){var J={ai:(J=(J=ne.getAccountInfoSync())&&J.miniProgram||{})&&J.appId||"",av:J&&J.version||"1.0.0",an:__wxConfig&&__wxConfig.accountInfo&&__wxConfig.accountInfo.nickname||"unkonw",ci:"",at:5};this.appInfo.an&&(J.an=this.appInfo.an),this.appInfo=Object.assign(this.appInfo,J)},G.prototype.setChannelId=function(J){V("channelId",J,0,Wt,!1)||(c(J)&&"string"==typeof J?this.appInfo.ci=J:ee.log("Failed to set channel ID!"))},G.prototype.setAppVersion=function(J){c(J)&&"string"==typeof J&&Te(J)<=64?this.appInfo.av=J:ee.log("Failed to set app version!")},G.prototype.setDeviceId=function(J){V("deviceID",J,0,Wt,!1)||/^[a-zA-Z0-9_-]+$/.test(J)&&(this.deviceInfo.di=J)},G.prototype.setAppName=function(J){V("appName",J,0,64,!1)||(this.appInfo.an=J)},G.prototype.closeConfig=function(){this.unableConfig=!0},G.prototype.closeAgent=function(J){J=!J,ne.BonreeRUM&&(ne.BonreeRUM.$$Bonree=J)},G.prototype.getIsFirstDay=function(){var J=this.cacheData.firstVisitDayTime,Z=Date.now();return!!(J&&Z<J)},G.prototype.setPageHideTime=function(J){return c(J)?this.pageHideTime=J:this.pageHideTime=R(),this},G.prototype.setScene=function(J){this.shareInfo.s=J,this.sendSessionReplayInfo(),this.shareInfo.flag=!0},G.prototype.sendSessionReplayInfo=function(){var J={di:this.deviceInfo,ai:Object.assign({},this.appInfo,this.shareInfo),v:ae,d:this.deviceInfo.di,a:this.appInfo.ai,sdkVersion:re};X(Kn,J)};var Ms=new G,bs={confCount:5,beacon:{configAddress:"https://sdkupload.bonree.com/config"},appId:1,debug:!1,timeout:3e4,consoleError:!1,cacheSize:1038090240},Ts=bs;const As=new class{constructor(){this.currentRootId="",this.lastRootId="",this.currentRelateId="",this.relateEventDatas={},this.maxTime=3e4,this.unModu=[]}startRelate(J,Z,ee){let ne="root";this.checkConfig(Z)||(Z!==le&&Z!==ve||(this.currentRelateId=J,this.lastRootId&&Z===le&&this.getRelateEventData(this.lastRootId)&&(ne=this.lastRootId,this.currentRelateId=J)),this.currentRootId=J,Z=new Dr(J,ne,Z,ee),this.relateEventDatas[J]=Z)}checkRelat(){!this.currentRootId&&this.currentRelateId&&(this.currentRootId=this.currentRelateId)}checkConfig(J){return-1<this.unModu.indexOf(J)}getConfig(J){this.unModu=J}setRootNodeData(J,Z,ee){this.relateEventDatas[J]&&(J=this.relateEventDatas[J],Z=this.format(Z,!0),J.setRootNodeData(Z,ee))}format(J,Z){return J={k:J.type,ent:J.ent||1e3*R(),sin:J.sin,v:J.data},Z&&(J.revts=[]),J}stopRelate(J,Z){this.currentRootId="",Z!==_e&&Z!==ve||(this.lastRootId=J)}clearCurrentId(){this.currentRootId=""}packageData(J,Z){const ee=this.getRelateEventData(J),ne=this.hasChrildNode(J);if(ee&&"root"===ee.parentRootId&&!ne&&ee.rootNodeData.revts){const ne=ee.rootNodeData||{};Z&&ne.revts&&(ne.revts.push(Z),0<ee.relateData.length)&&(ne.revts=ne.revts.concat(ee.relateData)),delete this.relateEventDatas[J],clearTimeout(ee.timeoutId),this.uploadData(ne)}else if(ee&&!ne&&ee.rootNodeData.revts){ee.rootNodeData.revts=ee.rootNodeData.revts.concat(ee.relateData);const Z=ee.rootNodeData,ne=ee.parentRootId;delete this.relateEventDatas[J],Z.revts&&0===Z.revts.length&&delete Z.revts,this.packageData(ne,Z)}else!ee||"root"!==ee.parentRootId||ne||ee.rootNodeData.revts||ee.relateData.push(Z)}packageSelf(J){var Z,ee;this.relateEventDatas[J]&&(ee=(Z=this.relateEventDatas[J]).parentRootId)&&this.relateEventDatas[ee]&&(this.relateEventDatas[ee].relateData.push(Z.rootNodeData),delete this.relateEventDatas[J])}uploadData(J){T(ot,J)}getCurrentRootId(){return this.currentRootId}setCurrentRootId(J){return this.currentRootId=J,this}setLastRootId(J){return this.lastRootId=J,this}generateRelate(J,Z,ee){this.relateEventDatas[J]&&!this.checkConfig(ee)&&this.relateEventDatas[J].addRelateEventIds(Z)}addRelateEventData(J,Z,ee,ne){if(!this.checkConfig(ne)&&this.relateEventDatas[J]){const ne=this.relateEventDatas[J],se=this.format(ee);ne.addRelateEventData(Z,se)}}updateCurrentId(){}setRelateEventData(J,Z){this.relateEventDatas[J]=Z}getRelateEventData(J){return this.relateEventDatas[J]}delRelateEventData(J){delete this.relateEventDatas[J]}getNodeNumber(J){if(this.relateEventDatas[J])return this.relateEventDatas[J].currentNodeNumber}hasChrildNode(J){for(const Z in this.relateEventDatas)if(this.relateEventDatas[Z].parentRootId===J)return!0;return!1}};class Dr{constructor(J,Z,ee){this.rootId=J,this.parentRootId=Z,this.childRootId="",this.rootNodeData={},this.relateData=[],this.relateEventIds=new Set,this.rootNodeType=ee,this.timeoutId=0,this.maxNode=200,this.currentNodeNumber=0,"root"===this.parentRootId&&this.startTiming()}setRootNodeData(J,Z){if(this.rootNodeData=J,"root"===this.parentRootId&&0===this.relateEventIds.size)this.rootNodeData.revts=this.rootNodeData.revts.concat(this.relateData),this.rootNodeType===_e||Z?setTimeout((()=>{As.packageData(this.rootId)}),2e3):As.packageData(this.rootId);else if("root"!==this.parentRootId){const J=this.getRootNodeInfo();c(J.rootNodeRelateIdNumbe)&&0===J.rootNodeRelateIdNumbe?As.packageData(this.rootId):"root"!==this.parentRootId&&0===this.relateEventIds.size&&(this.rootNodeData.revts&&0===this.rootNodeData.revts.length&&delete this.rootNodeData.revts,As.packageSelf(this.rootId))}}addRelateEventData(J,Z){this.relateEventIds.has(J)&&(this.relateData.push(Z),this.delRelateEventIds(J)),Z=this.getRootNodeInfo(),this.rootNodeData.revts&&c(Z.rootNodeRelateIdNumbe)&&0===Z.rootNodeRelateIdNumbe&&(this.rootNodeData.revts=this.relateData.concat(),this.relateData=[],As.packageData(this.rootId))}addRelateEventIds(J){const Z=this.getRootNodeInfo();if(c(Z.rootNodeNumber)&&!(200<=Z.rootNodeNumber)&&(this.relateEventIds.add(J),++this.currentNodeNumber,"root"!==this.parentRootId)){const Z=As.getRelateEventData(this.parentRootId);Z&&Z.addRelateEventIds(J)}}delRelateEventIds(J){var Z;this.relateEventIds.has(J)&&this.relateEventIds.delete(J),"root"!==this.parentRootId&&(Z=As.getRelateEventData(this.parentRootId))&&Z.delRelateEventIds(J)}startTiming(){this.timeoutId=setTimeout((()=>{const J=this.rootId,Z=As.relateEventDatas;let ee=!1,ne="rootId";for(const ne in Z){var se=Z[ne];se&&se.relateEventIds&&se.parentRootId===J&&(ee=!0,se.relateEventIds.clear()),se&&se.relateEventIds&&se.rootId===J&&se.relateEventIds.clear()}ee&&(ne="parentRootId");for(const ee in Z){var re=Z[ee];if(re&&re.relateEventIds&&re[ne]===J){const J=re.rootId;As.packageData(J)}}this.relateEventIds.clear()}),3e4)}getRootNodeInfo(){var J;return"root"!==this.parentRootId?(J=As.getRelateEventData(this.parentRootId))?J.getRootNodeInfo():{}:{rootNodeNumber:this.currentNodeNumber,rootNodeRelateIdNumbe:this.relateEventIds.size}}}function M(J,Z){if(ne.BonreeRUM&&ne.BonreeRUM.relateEvents){var ee=Object.keys(ne.BonreeRUM.relateEvents);for(let ae=0;ae<ee.length;ae++){var se=ee[ae],re=ne.BonreeRUM.relateEvents[se];switch(J){case cs:if(se!==bs.appId)continue;re[cs](Z.unModu);continue;case us:re[us](Z.rootId,Z.type);continue;case ls:re[ls](Z.rootId,Z.type);continue;case hs:re[hs](Z.rootId);continue;case ds:re[ds](Z.rootId,Z.id,Z.type);continue;case ps:re[ps](Z.rootId);continue;case gs:re[gs]();continue;case fs:re[fs]();continue;case _s:if(se!==bs.appId)continue;re[_s]();continue;case ms:if(se!==bs.appId)continue;re[ms]();continue;default:continue}}}}function Ct(){if(ne.BonreeRUM&&ne.BonreeRUM.relateEvents)return(ne.BonreeRUM.relateEvents[bs.appId]||{}).currentRootId}function fn(J,Z){var ne;arguments.length<1||2<arguments.length?ee.warn("Custom log parameters are missing!"):E(J)?V("logInfo",J,0,null,!1)||(ne={},J=c(J)&&U(J,1e4)||"",Z=c(Z)&&U(Z,1e4)||"",ne.logInfo=J,ne.logParam=Z,T(Je,ne)):console.warn(Zt)}function pn(J,Z,ne){var se;arguments.length<1||3<arguments.length?ee.warn("Custom indicator parameters are missing!"):E(J)?V("metricName",J,0,Wt,!1)||V("metricValue",Z,0,null,!0)||(ne&&1e4<ne.length&&(ne=U(ne,1e4)),(se={}).metricName=c(J)?J:"",se.metricValue=c(Z)?Z:"",se.metricParam=c(ne)?ne:"",T(tt,se)):console.warn(Zt)}function gn(J,Z){var ne;arguments.length<1||2<arguments.length?ee.warn("SetCustomSpeedTest custom log parameter number error!"):V("ip",J,0,Wt,!1)||(Array.isArray(Z)&&0<Z.length&&Z.length<=1e3?((ne={}).oip=J,ne.sti=Z,T(Xe,ne)):ee.warn("The second parameter passed through the custom speed testing interface is invalid!"))}const Os=new class{constructor(){this.spansData={},this.spanIdArr=[],this.isOpen=!0}startSpan(J,Z){var ee;return J&&E(J)&&Z&&E(Z)&&Nt(Z)&&Nt(J)?(J=U(J,256),Z=U(Z,256),ee=q(),this.spanIdArr.push(ee),J=new Qt(J,Z,!0,1,ee,ee),this.setSpan(ee,J),this.checkSpanSize(),J):new Qt}getSpan(J){return this.spansData[J]}setSpan(J,Z){this.spansData[J]=Z}delSpan(J){this.spansData[J]&&(delete this.spansData[J],this.spanIdArr.pop(J))}uploadSpan(J,Z){var ee=this.getSpan(J);ee&&ee.sub&&mn(ee.sub,Z),ee&&(c(ee.du)||(ee.du=R()-ee.st),ee.st=0,T($e,{data:ee,startTime:1e3*Z,isOpen:this.isOpen}),this.delSpan(J))}checkSpanSize(){var J;20<this.spanIdArr.length&&(J=this.spanIdArr.pop(),this.delSpan(J))}isOpen(J){this.isOpen=!0===J}};class Qt{constructor(J,Z,ee,ne,se,re){this.status=!!se,this.n=J,this.t=Z,this.st=R(),this.du=null,this.sta=null,this.ic=ee,re&&(this.spanId=re,this.spanNodes=1),this.recordInfo={deep:ne,rootSpanId:se,spanState:!0}}startChild(J,Z){var ee,ne,se;return J&&E(J)&&Z&&E(Z)&&Nt(Z)&&Nt(J)?(this.status=!0,J=U(J,256),Z=U(Z,256),ee=this.recordInfo.rootSpanId,ne=++(Os.getSpan(ee)||{}).spanNodes,se=this.recordInfo.deep+1,J=new Qt(J,Z,!0,se,ee),this.recordInfo.deep<=10&&ne<=201&&(this.sub||(this.sub=[]),this.sub.push(J)),J):new Qt}setData(J,Z){var ee;this.status&&E(J)&&Ne(J)&&c(Z)&&E(Z)&&!nn(Z)&&(this.da&&64<=this.da.length||(ee={k:J,v:U(Z,7e3)},this.da?Ae(this.da,J,Z)&&this.da.push(ee):(this.da=[],this.da.push(ee))))}removeData(J){this.status&&c(J)&&E(J)&&J.length<=200&&this.da&&0<this.da.length&&(this.da=ke(this.da,J))}setTag(J,Z){var ee;this.status&&E(J)&&Ne(J)&&E(Z)&&c(Z)&&!nn(Z)&&(this.tag&&64<=this.tag.length||(ee={k:J,v:U(Z,7e3)},this.tag?Ae(this.tag,J,Z)&&this.tag.push(ee):(this.tag=[],this.tag.push(ee))))}removeTag(J){this.status&&c(J)&&E(J)&&J.length<=200&&this.tag&&0<this.tag.length&&(this.tag=ke(this.tag,J))}setMetric(J,Z,ee){var ne;this.status&&E(J)&&Ne(J)&&ut(Z)&&(this.m&&64<=this.m.length||(ne={k:J,v:Z},E(ee)&&Nt(ee)&&ee.length<=256&&(ne.u=ee),this.m?Ae(this.m,J,Z,ee)&&this.m.push(ne):(this.m=[],this.m.push(ne))))}removeMetric(J){this.status&&c(J)&&E(J)&&J.length<=200&&this.m&&0<this.m.length&&(this.m=ke(this.m,J))}setDuration(J){this.status&&c(J)&&ut(J)&&(this.du=J)}setStatus(J){this.status&&ut(J)&&(this.sta=J)}setStatusCode(J){this.status&&c(J)&&E(J)&&(J&&7e3<J.length||(this.stac=J))}finish(J){this.status&&(c(J)&&ut(J)?this.sta=J:c(this.sta)||(this.sta=1),c(this.du)||this.spanId||(this.du=R()-this.st),this.spanId&&Os.uploadSpan(this.spanId,this.st),this.status=!1)}}function ke(J,Z){for(let ne=0;ne<J.length;ne++){var ee=J[ne];if(ee&&ee.k===Z)return J.splice(ne,1),J&&0===J.length?void 0:J}return J}function Ae(J,Z,ee,ne){for(let se=0;se<J.length;se++)if(J[se]&&J[se].k===Z)return J[se].v=ee,c(ne)&&(J[se].u=ne),!c(ne)&&c(J[se].u)&&delete J[se].u,!1;return!0}function mn(J,Z){if(J&&0<J.length){50<J.length&&J.splice(50);for(let ne=0;ne<J.length;ne++){var ee=J[ne]||{};c(ee.du)||(ee.du=R()-ee.st),Z&&(ee.st=ee.st-Z),c(ee.sta)||(ee.sta=1),ee.recordInfo&&delete ee.recordInfo,c(ee.status)&&delete ee.status,ee&&ee.sub&&mn(ee.sub,Z)}}}function Ne(J){return/^[a-zA-Z][a-zA-Z\._-]{0,199}$/.test(J)}let ws=[];function vn(J,Z,ne="",se="",re){var ae;arguments.length<1||5<arguments.length?ee.warn("Custom event parameters are missing!"):E(J)?V("eventId",J,0,Wt,!1)||re&&k(re)&&7e3<JSON.stringify(re).length||(ae={},Z=U(Z,Wt),se=U(se,7e3),ae.eventId=c(J)?J:"",ae.eventName=Z,ae.eventParam=se,ae.eventLabel=U(ne,256),ae.info=re,ae.type=0,T(Qe,ae)):console.warn(Zt)}function In(J,Z,ne="",se="",re){if(arguments.length<1||5<arguments.length)ee.warn("Custom event start parameter is missing!");else if(E(J)){if(!(V("eventId",J,0,Wt,!1)||re&&k(re)&&7e3<JSON.stringify(re).length)){var ae={};Z=U(Z,Wt),se=U(se,7e3),Z=(ae.eventId=c(J)?J:"",ae.eventName=Z,ae.eventParam=se,ae.eventLabel=U(ne,256),ae.info=re,ae.type=1,q()),se={uid:ae.uid=Z,id:J,time:1e3*R()};let ee=!1;0<ws.length&&ws.map((Z=>{Z.id===J&&(ee=!0)})),ee||(ne=se,ws=ws.concat(ne),T(Qe,ae))}}else console.warn(Zt)}function yn(J,Z,ne="",se,re){var ae;arguments.length<1||5<arguments.length?ee.warn("Custom event end parameter is missing!"):E(J)?V("eventId",J,0,Wt,!1)||re&&k(re)&&7e3<JSON.stringify(re).length||(ae={},Z=U(Z,Wt),se=U(se,7e3),ae.eventId=c(J)?J:"",ae.eventName=Z,ae.eventParam=se,ae.eventLabel=U(ne,256),ae.info=re,ae.type=2,c(Z=function(J){const Z=ws.concat();let ee=null;return Z.map(((ne,se)=>{ne.id===J&&(ee=ne,Z.splice(se,1))})),ws=Z.concat(),ee}(J))&&(ae.duration=1e3*R()-Z.time,ae.uid=Z.uid,T(Qe,ae))):console.warn(Zt)}let Rs={},Ds={},Ns=null;const Ls=[];let ks=!1;const br=()=>{try{var J=dt(Lt);J&&"object"==typeof J&&L(Rs,J)}catch(J){}},ue=()=>{ne.setStorage({key:Lt,data:Rs,fail(){ne.setStorage({key:Lt,data:Rs})}})};function kr(){var J,Z,ee,ne,se=L(Ds,Rs);return 0===Object.keys(se).length?"":(J=q(),null===Ns?(Ns=J,Ls.push(Ns),Ms.eventExtInfo[J]=Object.assign({},se),J):(Z=Ms.eventExtInfo[Ns],ee=JSON.stringify(Z),ne=JSON.stringify(se),Z&&ee==ne?Ns:Z&&ne!==ee?(Ns=q(),Ms.eventExtInfo[Ns]=Object.assign({},se),Ls.push(Ns),J):""))}function Ce(J,Z=!1){let ee=!1;var ne=Z?Rs:Ds;let se=0;if(k(J)){for(const Z in J)if(Ht(Z,256)){let le=J[Z];var re=Object.keys(Rs).length||0,ae=Object.keys(Ds).length||0;se<64&&re+ae<64&&ln(le)&&0<String(le).length&&c(le)&&(512<String(le).length&&(le=String(le).slice(0,512)),ne[Z]=le,se+=1,ee=!0)}ks=!1,!Z&&ee&&ue()}}function En(J,Z,ee){c(J)&&E(J)&&c(Z)&&Ce({[J]:Z},ee)}function Tn(){Ds={},Rs={},ue(),ks=!0}function Rn(J){if(yt(J)){let Z=!1;for(const ee of J)Rs.hasOwnProperty(ee)&&(Z=!0,delete Rs[ee]),Ds.hasOwnProperty(ee)&&(Z=!0,delete Ds[ee]);Z&&ue()}}function Sn(J,Z){var ee=Ms.currentUserId;c(ee)&&""!==ee&&c(Z)&&0<String(Z).length&&Ht(J,256)&&(512<String(Z).length&&(Z=String(Z).slice(0,512)),T(qe,{userId:ee,command:2,info:{[J]:Z}}))}function Dn(J){const Z=Ms.currentUserId;if(c(Z)&&""!==Z){if("object"!=typeof J||null===J)return!1;if(0!=Object.keys(J).length){let ne=0;var ee={};for(const Z in J){let se=J[Z];if(ne<64&&c(se)&&0<String(se).length&&ln(se)&&Ht(Z,256)&&(512<String(se).length&&(se=String(se).slice(0,512)),ee[Z]=se,ne+=1),64<ne)break}T(qe,{userId:Z,command:1,info:ee})}}}function wn(J,Z){var ee=Ms.currentUserId;c(ee)&&""!==ee&&ut(Z)&&Ht(J,256)&&T(qe,{userId:ee,command:4,info:{[J]:Z}})}function bn(J){var Z=Ms.currentUserId;c(Z)&&""!==Z&&Ht(J,256)&&T(qe,{userId:Z,command:3,info:{[J]:""}})}let Ps={ui:null,ei:null},Us=null;function kn(J){if(c(J)){if(V("userId",J,0,Wt,!1)||!/^[\u4E00-\u9FFFa-zA-Z0-9:._\-@/*#!]+$/.test(J))return;Ms.currentUserId=J,Ps=Object.assign({},Ps,{ui:J})}else Ms.currentUserId=J,Ps={ui:null,ei:null};Nn()}function An(J){var Z;k(J)&&(Z=JSON.stringify(J),J&&(7e3<Z.length||"{}"==Z)||Ps.ui&&(Ps.ei=JSON.stringify(J),Nn()))}function Nn(){if(c(Ps.ui)){const J={ui:Ps.ui};c(Ps.ei)&&(J.ei=Ps.ei);let Z=!1;const ee=L({},Ms.userInfoMap);if(0<Object.keys(ee).length&&Object.entries(ee).forEach((function(ee){JSON.stringify(ee[1])===JSON.stringify(J)&&(Us=ee[0],Z=!0)})),!Z){const Z=q(),ee=(Us=Z,Ms.userInfoFui=Z,Ms.userInfoMap[Z]=L({},J),{[Z]:Ps.ui});X(as,{type:0,key:"ui",value:ee})}}else Us=null}let Gs=[];function _n(J,Z){if(arguments.length<1||2<arguments.length)ee.warn("Custom page starts with missing parameters!");else if(E(J)&&E(Z)){if(!V("name",J,0,null,!1)){var ne={},se=q(),re=(Z=c(Z)&&U(Z,Wt)||"",{uid:se,name:J,time:1e3*R()}),ae=Gs;let ee=!1;0<ae.length&&ae.map((Z=>{Z.name===J&&(ee=!0)})),ee||((ae=Ct())&&M(ds,{rootId:ae,id:se,type:le}),Gs=Gs.concat(re),ne.ci=se,ne.lt=999,ne.m=1,ne.pvid=se,ne.rt=999,ne.st=999,ne.is=!1,ne.std=[],ne.name=c(J)?J:"",ne.ic=!0,ne.param=Z||"",T(pe,{data:ne,mode:1,rootId:ae}))}}else console.warn(Zt)}function Cn(J,Z){var ne,se,re;arguments.length<1||2<arguments.length?ee.warn("Custom page end with missing parameters!"):E(J)&&E(Z)?V("name",J,0,null,!1)||(Z=c(Z)&&U(Z,Wt)||"",ne={},c(se=function(J){const Z=Gs&&Gs.concat();let ee=null;return Z.map(((ne,se)=>{ne.name===J&&(ee=ne,Z.splice(se,1))})),Gs=Z.concat(),ee}(J))&&(re=1e3*R()-se.time,ne.ci=se.uid,ne.lt=999,ne.m=3,ne.pvid=se.uid,ne.rt=999,ne.is=!1,ne.std=[],ne.name=c(J)?J:"",ne.ic=!0,ne.param=Z||"",ne.st=re,T(pe,{data:ne,mode:3}))):console.warn(Zt)}function On(J,Z,ee){var ne;E(J)&&E(Z)&&E(ee)&&(V("exceptionType",J,0,Wt,!1)||(ne={},Z=c(Z)&&U(Z,512)||"",ee=c(ee)&&U(ee,1e4)||"",ne.exceptionType=c(J)?J:"",ne.causedBy=Z,ne.errorDump=ee,T(nt,ne)))}function xn(J){var Z=Ts.mc;let ee=0;if(Z&&0<Z.length)for(let ne=0,se=Z.length-1;ne<=se;ne++)if(Z[ne].n===J){ee=Z[ne].tv;break}return 1e3*ee}const xs=new class{constructor(){this.networkType="",this.appInfo=null,this.clientID=null,this.page=null,this.sid=Re(),this.uid="",this.pvidDatas={},this.pageModel=0,this.pageTimeId=0,this.pageRoutes=[],this.pageTitle={}}popPage(J=!1){var Z=this.page;return J||(this.page=null),Z}};class Oe{constructor(J){this.ci=Re().concat("-",N()),this.networkType="",this.url=J.path,this.param=J.param,this.pvid=J.path?xs.pvidDatas[J.path]:null,this.pre="",this.loadTs=null,this.showTs=null,this.showEndTs=null,this.readyTs=null,this.hideTs=null,this.unloadTs=null,this.loadEndTs=null,this.uploadTs=null,this.statesInfo=[],M(us,{rootId:this.ci,type:le}),Ms.currentCorrelationId=this.ci}toJson(){var J={};this.loadTs&&(J.onLoad=1e3*this.loadTs),this.showTs&&(J.onShow=1e3*this.showTs),this.readyTs&&(J.onReady=1e3*this.readyTs),this.hideTs&&(J.onHide=1e3*this.hideTs),this.unloadTs&&(J.onUnload=1e3*this.unloadTs);let Z,ee=999,ne=0,se=0;this.readyTs&&this.loadTs&&(ee=J.onReady-J.onLoad),this.hideTs&&this.showTs?ne=1e3*(this.hideTs-this.showTs):this.unloadTs&&this.showTs&&(ne=1e3*(this.unloadTs-this.showTs)),this.loadTs&&this.loadEndTs?se=this.loadEndTs-J.onLoad:this.showTs&&this.showEndTs&&(se=1e3*(this.showEndTs-this.showTs)),Z=yt(this.statesInfo)?0<(Z=JSON.parse(JSON.stringify(this.statesInfo))).length?Z:"":this.statesInfo;var re=xn("mpview"),ae=Un(this.url&&this.url.split("?")[0])||"";J={ci:this.ci,pvid:this.pvid,name:this.url,wpi:J,routes:vs([],this.routes),param:"{}"==JSON.stringify(this.param)?"":JSON.stringify(this.param),rt:ee,lt:se,std:Z,is:ee>re,vt:ae,ic:!1};return 0!=ne&&(J.st=ne),J}}let Fs="";function Nr(J){var Z=Ms.eventViewInfo[Fs];Z&&(Z.vt=J,xe())}function xe(J){ne.BonreeRUM&&ne.BonreeRUM.viewInfo&&(ne.BonreeRUM.viewInfo.eventViewInfo=Ms.eventViewInfo,J)&&(ne.BonreeRUM.viewInfo.currentViewKey=Fs)}function Un(J){return J&&""!==J?xs.pageTitle[J]||function(J){try{if(__wxConfig){var Z,ee=__wxConfig,ne=__wxConfig.page||{},se=ne[J]||ne[J+".html"];let re="",ae="";return ee.global&&ee.global.window&&ee.global.window.navigationBarTitleText&&(re=ee.global.window.navigationBarTitleText),(ae=!(ae=se&&se.window&&se.window.navigationBarTitleText?se.window.navigationBarTitleText:ae)&&__wxAppCode__&&(Z=__wxAppCode__[J+".json"])&&Z.navigationBarTitleText?Z.navigationBarTitleText:ae)||re||""}}catch(J){}}(J):""}function Ln(J,Z){if(!lt(Z))return J;const ee=L({},J);return Et(J,(function(J,ne){lt(J)&&(ee[ne]=Z(J,ne))})),ee}function Mn(J,Z,ee){const ne=L({},J);return Et(Z,(function(Z,se){var re,ae;ne[se]=(ae=ee,$n(c(re=J)&&lt(re[se])?re[se]:function(){},Z,c(ae)&&lt(ae[se])?ae[se]:function(){}))})),ne}function jn(J,Z,ee,ne){const se=L({},J);return Et(Z,(function(Z,ee){se[ee]=function(J,Z,ee,ne){if((!c(J)||lt(J[Z])||ne)&&(!ne||!ne[Z]))return $n(!ne||c(J)&&lt(J[Z])?J[Z]:function(){},ee)}(J,ee,Z,ne)})),se}function Pn(J,Z,ee,ne,se){return J[At]?J:function(se){if((se=Mn(Ln(se,ne),Z,ee)).onShareAppMessage){var re=se;const J=re.onShareAppMessage;J&&(re.onShareAppMessage=function(){var Z,ee=Array.prototype.slice.call(arguments);let ne=J.apply(this,ee);if(ft)try{"object"!=typeof ne&&((ne={}).path=be(this)),"object"!=typeof ne||void 0!==ne.path&&""!==ne.path||(ne.path=be(this)),"object"==typeof ne&&"string"==typeof ne.path&&(-1===ne.path.indexOf("?")?ne.path=ne.path+"?":"&"!==ne.path.slice(-1)&&(ne.path=ne.path+"&"),ne.path=ne.path+(Z=Ms.shareInfo.sl,Z=JSON.stringify({[Ft]:Z,[$t]:Ms.deviceInfo.di}),jt+"="+un(Z)))}catch(J){}return ne})}return(J.$$origin=J).call(this,se)}}function $n(J,Z,ee){var ne;return(J=c(J)?J:function(){}).$$original?J:((ne=function(){var ne=oe(arguments);if(!c(this)||!ft())return J.apply(this,ne);if(c(Z))try{Z.apply(this,ne)}catch(J){console.error(J)}try{return J.apply(this,ne)}catch(J){throw J}finally{c(ee)&&ee.apply(this,ne)}}).$$original=J,ne)}function Ue(J="page",Z){c(this.setUpdatePerformanceListener)&&lt(this.setUpdatePerformanceListener)&&this.setUpdatePerformanceListener({withDataPaths:!0},(ne=>{var se,re,ae,le,pe,_e;c(xs.page)&&ft()?(({updateStartTimestamp:ne,updateEndTimestamp:se,pendingStartTimestamp:re,dataPaths:pe}=ne),yt(pe)&&(ae=Vt(pe.map((J=>{if(1<J.length){let ee="";var Z=this.data;let ne;for(const se of J)ee+=ut(se)?`[${se}]`:"."+se,ne=Z&&Z[se];return{[ee.substring(1)]:ne}}return{[J]:this.data[J]}}))),le=pe.reduce((function(J,Z){return J.concat(Z)}),[]),0!==pe.length)&&(pe={ust:1e3*ne,uet:1e3*se,pst:1e3*re,d:le,s:ae,p:"page"===J?this.route:this.is},_e=Z,xs.page)&&xs.page.statesInfo&&(xs.page.statesInfo[xs.page.statesInfo.length]=pe,4===xs.pageModel)&&(1===xs.page.statesInfo.length&&(xs.pageTimeId=setTimeout((()=>{_e&&_e(),c(xs.page)&&(xs.page.statesInfo=[]),clearTimeout(xs.pageTimeId)}),15e3)),10<=xs.page.statesInfo.length)&&(_e&&_e(),c(xs.page)&&(xs.page.statesInfo=[]),clearTimeout(xs.pageTimeId))):ee.log("Stop collecting setData data!")}))}const qs={target:null,count:0,lastTime:0};class Cr{constructor(J){this.id=q(),this.ti=_(16),this.mode=1,this.type=J.type,this.sourceAction=3,this.ci=void 0,this.info=J.fnName,this.name=J.name,this.viewName=J.viewName,this.ic=!1,this.ice=!1,this.param="",this.loadTime="",this.startTime=1e3*J.startTime,this.endTime="",this.vt=10,this.is=!1,this.ir=J.isRage,this.vci=Ms.currentCorrelationId,this.me=void 0,this.operationTimeoutId=0,this.createCollterInfo(J.controlInfo),this.createMethod(J.fnName,12,J.startTime)}createMethod(J,Z,ee,ne){J=new Or(J,Z,ee,ne,this.ti),this.me=J}createCollterInfo(J){let Z={};J&&k(J)&&(Z=new xr(J.fnName)).create(J.c_type,J.text,J.tag),this.ci=Z}getRootId(){return this.id}methodEnd(J){this.me&&this.me.methodFinish(J)}actionEnd(){var J=R();this.endTime=1e3*J,this.loadTime=this.endTime-this.startTime,this.me&&this.me.methodFinish(J)}}class Or{constructor(J,Z,ee,ne=!1,se){this.n=J,this.t=Z,this.to=!1,this.ice=ne,this.st=1e3*ee,this.et="",this.im=!0,this.ti=se}methodFinish(J){this.et||(this.et=1e3*J)}}class xr{constructor(J){this.f=J}create(J,Z,ee){J&&(this.td=J),ee&&(this.tag=ee)}}function qn(J,Z){return function(){var ee=arguments&&arguments[0];if(!(ee&&ee.target&&ee.currentTarget&&"tap"===ee.type&&ft()))return J.apply(this,arguments);{let ne;try{ne=function Ur(J,Z,ee){var ne=JSON.stringify(Z.target),se=R(),re=(ae=se,re=qs.target,pe=qs.count,le=qs.lastTime,ae=ae||new Date,null===re&&0===pe?(qs.target=ne,qs.count=pe+1,qs.lastTime=ae,0):re!==ne?(qs.target=ne,qs.count=1,qs.lastTime=ae,0):re==ne&&300<=ae-le?(qs.count=1,qs.lastTime=ae,0):re==ne&&pe<2&&ae-le<300?(qs.count=pe+1,qs.lastTime=ae,0):re==ne&&2<=pe&&ae-le<300?(qs.count=pe+1,qs.lastTime=ae,1):void 0),ae=(le=(ne=Z)&&ne.currentTarget.dataset||{},pe=ne.currentTarget.id,k(ae=le&&L({},le))&&pe&&(ae.id=pe),pe=ne.type+" "+JSON.stringify(ae),ne={text:le&&"{}"!==JSON.stringify(le)?JSON.stringify(le):"unknow",name:pe},Z&&"tap"===Z.type?1:Z&&"input"===Z.type?4:0),le={c_type:Z&&Z.type,text:ne.text,fnName:ee},pe={viewName:J.route||J.is,fnName:ee,type:ae,startTime:se,name:ne.name,controlInfo:le,isRage:re};return J=(Z=new Cr(pe)).getRootId(),M(us,{rootId:J,type:"action"}),{rootId:J,actionData:Z}}(this,ee,Z)}catch(J){console.error(J)}try{return J.apply(this,arguments)}catch(J){throw J}finally{if(!ne)return;ne.actionData&&ne.actionData.actionEnd(),T(_e,{data:ne.actionData,currentCorrelationId:Ms.currentCorrelationId}),M(ls,{rootId:ne.rootId,type:_e})}}}}const Vs={onLoad:function(J){var Z;xs.pageModel=1,xs.pvidDatas[this.route]=Re(),J={t:N(),path:this.route,param:J,pvid:xs.pvidDatas[this.route]},xs.page||(xs.page=new Oe(J)),c((Z=xs.page).url)||c(Z.param)||(Z.url=J.path,Z.param=J.param,Z.pvid=J.pvid),Z.didLoad=!0,Z.loadTs=J.t,zn(),Ue.call(this,"page",Me)},onShow:function(){var J,Z={t:N(),path:this.route,pvid:xs.pvidDatas[this.route]};X(ns),xs.page?M(fs):xs.page=new Oe(Z),(J=xs.page).showTs=Z.t,J.pvid=Z.pvid,xs.page&&!c(xs.page.didLoad)&&(zn(),xs.pageModel=2,Ue.call(this,"page",Me)),X(es,this),X(rs)},onReady:function(){var J=N(),Z={t:J};Ms.launchTime||(Ms.launchTime=1e3*(J-Ms.appLaunchInfo.initTime)),J=Z,xs.page&&(M(fs),xs.page.readyTs=J.t,xs.page.didLoad||Le())},onHide:function(){M(gs);var J={t:N()};Ms.setPageHideTime(R()),xs.pageModel=3,X(is),X(ts,{canvas:null,drawer:null}),Vn("hideTs",J)},onUnload:function(){var J={t:N()};xs.pageModel=3,Vn("unloadTs",J)}},$s={onShow:function(){var J;J={t:N()},xs.page&&(xs.page.showEndTs=J.t,xs.page.didLoad||Le()),2===xs.pageModel&&(J=Ct(),M(ls,{rootId:J,type:le})),xs.page&&!c(xs.page.didLoad)&&setTimeout((()=>{xs.pageModel=4}),300)},onReady:function(){const J={t:N()};setTimeout((function(){var Z=J;if(xs.page){const J=1e3*Z.t;if(c(xs.page.statesInfo)&&0<xs.page.statesInfo.length){const Z=xs.page.statesInfo.filter((Z=>Z.pst<J));0<Z.length&&(Z.sort(((J,Z)=>Z.pst-J.pst)),xs.page.loadEndTs=Z[0].uet>1e3*xs.page.readyTs?Z[0].uet:J)}else xs.page.loadEndTs=J;1===xs.pageModel&&xs.page.didLoad&&0==xs.page.statesInfo.length&&ee.log("The 'setData' data cannot be collected. Maybe the user has overridden the 'setUpdatePerformanceListener' method or the user does not use 'setData'"),xs.page.didLoad&&(Le(),xs.page.statesInfo=[])}xs.pageModel=4}),300),M(gs)}},Zs={created:function(){xs.page||(xs.page=new Oe({t:null,path:null,param:null}))},attached:function(){Ue.call(this,"component",Me)}};function zn(){var J,Z,ee,ne=he();ne&&(ne={url:J=be(ne),path:we(ne),query:hn(ne),title:Un(J)},(J=xs.pageRoutes).push(ne),2<J.length&&J.shift(),ne=q(),J=xs.pageRoutes[xs.pageRoutes.length-1],Z=xs.pageRoutes[0],ee={},J&&(ee.n=J.path,J.title)&&(ee.vt=J.title),Z&&1<xs.pageRoutes.length&&(ee.ru=Z.path),Fs=ne,Ms.eventViewInfo[ne]=ee,xe(Fs))}function Le(){var J;xs.page&&(J=xs.popPage(!0).toJson(),T(le,{data:J,mode:xs.pageModel,type:1,rootId:J.ci}))}function Me(){var J;xs.page&&(xs.page.uploadTs=N(),J=xs.popPage(!0).toJson(),T(le,{data:J,mode:xs.pageModel,rootId:J.ci}))}function Vn(J,Z){xs.page&&(xs.page[J]=Z.t,J=xs.popPage().toJson(),T(le,{data:J,mode:xs.pageModel,type:2,rootId:J.ci}))}function je(J){return{error:J,pvid:xs.page&&xs.page.pvid,url:xs.page&&xs.page.url,time:xs.page&&xs.page.showTs||N(),userAgent:Ms.userAgent}}function Mr(){var J=oe(arguments);J&&J[0]instanceof Error&&(J=je(J[0]),T(He,J))}function Jn(J){J=je(J),T(He,J)}let Xs=!1,Qs=!1,ti=null;wx.onAppShow((()=>{var J,Z,ee;J=R(),Z=ti,(ee=dt(wt)||{})&&c(J)&&c(Z)&&0!==Z&&30<(J-Z)/1e3&&((R()/1e3-ee.setTime)/3600>ee.spt?(ee.sp=100,Rt(),Ms.sessionStartTime=1e3*N()):ee.sp>100*Math.random()?(Rt(),Ms.sessionStartTime=1e3*N()):Ms.closeAgent(!0))})),wx.onAppHide((()=>{ti=R()}));const oi={onLaunch:function(J){(function(J){let Z;try{if(!J.query||!J.query[jt])return;{const ee=un(J.query[jt]);Z=JSON.parse(ee)}}catch(J){return}const ee=Z[Ft],ne=Z[$t],se=Ms.deviceInfo.di,re=Ms.shareInfo;"number"==typeof ee?ne&&ne===se?(re.sl=ee,re.iso=0<ee):ne&&ne!==se&&(re.sl=ee+1,re.iso=!0):(re.sl=0,re.iso=!1)})(J),Ms.setScene(J.scene),J=q(),M(us,{rootId:J,type:ve});const Z={time:1e3*N(),id:J};setTimeout((()=>{Xs=!1,Ms.appLaunchInfo.isFirstLaunch?Z.type=3:Z.type=1;var J=Ms.launchTime||0,ee=xn("coollaunch");Z.is=ee<J,Z.loadTime=J,T(ve,Z)}),3e3);try{ne.getRendererUserAgent&&ne.getRendererUserAgent().then&&ne.getRendererUserAgent().then((J=>{E(J)?Ms.userAgent=J:k(J)&&(Ms.userAgent=J&&J.userAgent)}))}catch(J){}},onShow:function(J){Ms.setScene(J.scene);var Z=q(),ee=R();if(function(){if(Xs){var J=ti;if(3e4<R()-J)return Qs=!0}}()){M(us,{rootId:Z,type:ve});const J=Ct();T(ve,{type:2,is:!1,loadTime:999,id:J,time:ee})}T(ye,{t:2}),X(os)},onHide:function(){Xs=!0,T(ye,{t:3},!0),X(ss,"onHide")},onError:function(J){Jn(J)},onUnhandleRejection:function({reason:J}){Jn(J)}},ci={onLaunch:function(){var J=Ct();M(ls,{rootId:J,type:ve}),M(ps,{rootId:J})},onShow:function(){var J;Qs&&(J=Ct(),M(ls,{rootId:J,type:ve}),Qs=!1)}};const ui=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];var Br=function(J){for(var Z=new Array;0<J;){var ee=J%2;J=Math.floor(J/2),Z.push(ee)}return Z.reverse(),Z},Fr=function(J){for(var Z=0,ee=0,ne=J.length-1;0<=ne;--ne)1==J[ne]&&(Z+=Math.pow(2,ee)),++ee;return Z},Yt=function(J,Z){for(var ee=8-(J+1)+6*(J-1)-Z.length;0<=--ee;)Z.unshift(0);for(var ne=[],se=J;0<=--se;)ne.push(1);ne.push(0);for(var re=0,ae=8-(J+1);re<ae;++re)ne.push(Z[re]);for(var le=0;le<J-1;++le){ne.push(1),ne.push(0);for(var pe=6;0<=--pe;)ne.push(Z[re++])}return ne};function Tt(J){for(var Z=[],ee=[],ne=0,se=J.length;ne<se;++ne){var re=J.charCodeAt(ne),ae=Br(re);if(re<128){for(var le=8-ae.length;0<=--le;)ae.unshift(0);ee=ee.concat(ae)}else 128<=re&&re<=2047?ee=ee.concat(Yt(2,ae)):2048<=re&&re<=65535?ee=ee.concat(Yt(3,ae)):65536<=re&&re<=2097151?ee=ee.concat(Yt(4,ae)):2097152<=re&&re<=67108863?ee=ee.concat(Yt(5,ae)):4e6<=re&&re<=2147483647&&(ee=ee.concat(Yt(6,ae)))}var pe=0;for(ne=0,se=ee.length;ne<se;ne+=6){var _e=ne+6-se;2==_e?pe=2:4==_e&&(pe=4);for(var ve=pe;0<=--ve;)ee.push(0);Z.push(Fr(ee.slice(ne,ne+6)))}var ye="";for(ne=0,se=Z.length;ne<se;++ne)ye+=ui[Z[ne]];for(ne=0,se=pe/2;ne<se;++ne)ye+="=";return ye}function Kr(J,Z,ee){var ne=String(Tt(on())),se=String(Tt(on())),re=String(Tt(Ms.appInfo.an)),ae=String(Tt(Ms.appInfo.av));Z=Z&&String(Tt(Z))||String(Tt("/")),J=String(Tt(J));return ee&&0<=ee&&ee<=100&&!sn(ee)?`0-${ne}-${se}-0-${re}-${ae}-${Z}-`+J:`1-${ne}-${se}-0-${re}-${ae}-${Z}-`+J}const li=new class{constructor(){this.list={},this.isOpen=!1,this.blackKey=new Set}checkIsOpen(J){c(J)&&J?this.isOpen=!0:this.isOpen=!1}getItem(J,Z){var ee=J+"+"+Z;return c(J)&&this.list[ee]?this.list[ee]:this.setItem(J,Z)}setItem(J,Z){let{utl:ee,uwl:ne,ubl:se}=this.getRuleCfg(),re={};if(c(ee)&&0<ee.length)for(let ne=0,se=(ee=200<ee.length?ee.slice(0,200):ee).length-1;ne<=se;ne++)L(re,this.totalHead(ee[ne],J,Z));if(c(ne)&&0<ne.length)for(let ee=0,se=(ne=200<ne.length?ne.slice(0,200):ne).length-1;ee<=se;ee++)this.blackWhiteCheck(J,ne[ee],!0)&&L(re,this.blackWhiteHead(ne[ee],J,Z));if(c(se)&&0<se.length){for(let ee=0,ne=(se=200<se.length?se.slice(0,200):se).length-1;ee<=ne;ee++)this.blackWhiteCheck(J,se[ee],!1)?L(re,this.blackWhiteHead(se[ee],J,Z)):this.getBlackKey(se[ee]);re=this.delBlackKey(re)}200<Object.keys(re).length&&(re=k(ae=re)?(le={},Object.keys(ae).map(((J,Z)=>{Z<200&&(le[J]=ae[J])})),le):{});var ae,le,pe=J+"+"+Z;return this.list[pe]=re}getRuleCfg(){var J={ubl:[],utl:[],uwl:[]};if(ne.BonreeRUM&&ne.BonreeRUM.configs){var Z,ee=ne.BonreeRUM.configs;for(const ne in ee)ee[ne]&&(Z=ee[ne]).irhtc&&(c(Z.irhtc.ubl)&&0<Z.irhtc.ubl.length&&(J.ubl=J.ubl.concat(Z.irhtc.ubl)),c(Z.irhtc.utl)&&0<Z.irhtc.utl.length&&(J.utl=J.utl.concat(Z.irhtc.utl)),c(Z.irhtc.uwl))&&0<Z.irhtc.uwl.length&&(J.uwl=J.uwl.concat(Z.irhtc.uwl))}return J}totalHead(J,Z,ee){var ne={};return L(ne,this.constructData(J,Z,ee)),ne}blackWhiteCheck(J,Z,ee=!0){if(Z.rhr&&0<Z.rhr.length)switch(Z.t){case 0:if(J==Z.r)return ee;break;case 1:if(en(J,Z.r))return ee;break;case 2:if(tn(J,Z.r))return ee;break;case 3:var ne=new RegExp(Z.r);if(ne instanceof RegExp&&ne.test(J))return ee;break;case 4:if(-1<J.indexOf(Z.r))return ee;break;default:return!ee}return!ee}blackWhiteHead(J,Z,ee){var ne=J.rhr,se={};if(c(ne)&&0<ne.length)for(let J=0,re=ne.length-1;J<=re;J++)L(se,this.constructData(ne[J],Z,ee));return se}getBlackKey(J){var Z=J&&J.rhr;if(c(Z)&&0<Z.length&&this.blackKey)for(let J=0,ee=Z.length-1;J<=ee;J++)Z[J]&&Z[J].rhk&&this.blackKey.add(Z[J].rhk)}delBlackKey(J={}){if(this.blackKey&&0<this.blackKey.size&&J)for(const Z of this.blackKey)J&&J[Z]&&delete J[Z];return this.blackKey.clear(),J}checkKey(J,Z,ee){return!!(ee&&1!==ee||c(J)&&!(J.length>Z)&&(256===Z?/^[0-9a-zA-Z_-]{1,256}$/.test(J):512===Z?/^[^\u4e00-\u9fa5]*$/.test(J):""!=((ee=J)?String.prototype.trim?String.prototype.trim.call(ee):ee.toString().replace(/(^\s+)|(\s+$)/g,""):"")))}constructData(J,Z,ee){var ne={};if(c(J)&&c(J.rht)&&this.checkKey(J.rhk,256)&&this.checkKey(J.rhv,512,J.rht))switch(J.rht){case 1:c(J.rhv)&&(ne[J.rhk]=J.rhv);break;case 2:ne[J.rhk]={fun:cn,len:16,sky:!1};break;case 3:ne[J.rhk]={fun:cn,len:32,sky:!1};break;case 4:ne[J.rhk]={fun:Kr,len:32,sky:!0,url:Z,pathname:ee,rhsr:J.rhsr||0};break;case 5:ne[J.rhk]={fun:Er,len:32,sky:!1,rhsr:J.rhsr||0};break;case 6:ne[J.rhk]="bnro=wechat_js/"+Ms.deviceInfo.ctv+"_request"}return ne}clear(){this.list=[]}};let di;const pi=ne.request,mi={request:function(J){const Z=J||{};if(!Z.ignore&&ft()){const J=q(),ne=Ct();if(M(ds,{rootId:ne,id:J,type:Ye}),Z&&k(Z)){const se=1e3*N();let re,ae=0;const le={id:J,reqht:{},rh:{}},pe=(Z.$metric=le,Z.success),_e=Z.fail,ve=Z.complete,ye=Z.data||"";Z.success=function(){var J;pe&&(re=re||N(),J=N(),M(hs,{rootId:ne}),pe.apply(this,arguments),ae+=N()-J,M(gs))},Z.fail=function(){var J;_e&&(re=re||N(),J=N(),M(hs,{rootId:ne}),_e.apply(this,arguments),ae+=N()-J,M(gs))},Z.complete=function(pe){const _e=pe&&pe.profile,Fe=pe&&pe.errMsg,qe=pe&&pe.header&&JSON.stringify(pe.header)||"",$e=(tt={},(He=_e)&&He.responseStart&&(Je=He.responseStart-He.requestStart,Xe=He.requestStart-He.connectEnd,Qe=1e3*(He.SSLconnectionEnd-He.SSLconnectionStart),tt.ti=He.peerIP||"",tt.tp=He.port||443,tt.dt=1e3*(He.domainLookUpEnd-He.domainLookUpStart),tt.ct=1e3*(He.connectEnd-He.connectStart)-Qe,tt.sslt=Qe,tt.rt=0<Xe?1e3*Xe:0,tt.rti=0<Je?1e3*Je:0,tt.dti=1e3*(He.responseEnd-He.responseStart),tt.ds=He.receivedBytedCount,tt.rds=He.sendBytesCount,tt.pt=He.protocol),tt);var He,Je,Xe,Qe,tt;if(ee.log("network profile:",$e,_e),re=re||N(),ve){const J=N();ve.apply(this,arguments),ae+=N()-J}if(Se(Z.url)){var nt=Object.assign({},{id:J,ai:ne||"",status:pe.statusCode||0,method:Z.method&&Z.method.toUpperCase()||"GET",cb:ae,ec:pe.statusCode,st:se,end:re,url:Z.url,rds:Vt(ye),rhe:qe,body:ye,rh:le.rh?JSON.stringify(le.rh):"",ds:Number(Vr(pe)),reqht:le.reqht||{},resht:{}},$e),it=(c(Fe)&&!c(pe.statusCode)&&(nt.em=Fe,nt.ec=pe.statusCode||600),c(di)&&(nt.tpar=di,di=void 0),400<=nt.ec&&(nt.ep="http"),Ts.reshtk||[]);for(const J in pe.header)yt(it)&&-1<it.indexOf(J)&&k(nt.resht)&&Object.keys(nt.resht).length<64&&(nt.resht[J]=pe.header[J]),"br-resp-key"===J.toLowerCase()&&(nt.tid=pe.header[J]),"x-br-response"===J.toLowerCase()&&(nt.xbr=pe.header[J]),"traceresponse"===J.toLowerCase()&&(nt.trsp=pe.header[J]);k(nt.resht)&&Object.keys(nt.resht).length<=0&&(nt.resht=""),k(nt.reqht)&&Object.keys(nt.reqht).length<=0&&(nt.reqht=""),T(Ye,{data:nt,rh:Jr()})}}}}}};function Vr(J){var Z;return J?(Z=J.header,J=J.data,Z&&Z["content-length"]?Z["content-length"]:Vt(J)):0}function Jr(){if(xs.page)return{ci:xs.page.ci,pl:xs.page.url}}function Gr(){var J=oe(arguments);try{return c(mi.request)&&mi.request.apply(this,J),Ts.brss&&function Hr(J){const Z=J[0]||{},ee=Ts.irhtc||{};if(ee&&k(ee)&&!(Object.keys(ee).length<1)){if(Z.header){if(!k(Z.header))return}else Z.header={};J=function(J){if(c(J.url)&&/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(J.url)){var Z=J.url.split("/")[2];if(Z.includes(":")&&(Z=Z.split(":")[0]),J=J.url.split("/").slice(3).join("/").split("?")[0],c(Z))return li.getItem(Z,J)}}(Z),c(J)&&k(J)&&Et(J,(function(J,ee){var ne;J&&k(J)?(ne=J.sky?J.fun&&J.fun(J.url,J.pathname,J.rhsr):!1===J.sky?J.fun&&J.fun(J.rhsr):J.fun&&J.fun(J.len),Z.header||(Z.header={}),Z.header[ee]=ne):(Z.header||(Z.header={}),Z.header[ee]=J)}))}}(J),function(J){var Z=J[0]||{};if(k(Z)&&!Z.ignore&&Z.$metric){var ee=Z.header||{},ne=(Z.$metric.rh=ee,Ts.reqhtk||[]);if(yt(ne)&&0<ne.length&&k(Z.$metric.reqht))for(const J in ee)if(-1<ne.indexOf(J)){if(Z.$metric.reqht&&64<=Object.keys(Z.$metric.reqht).length)return;Z.$metric.reqht[J]=ee[J]}}}(J),pi.apply(this,J)}catch(J){throw J}finally{Wr.apply(this,J)}}function Wr(){}let yi=null;function Gn(){return Ms.networkStateInfo}function Wn(J){return ne.getNetworkType({success(Z){ft()&&(Ms.networkStateInfo.ns=Z.networkType,X(as,{type:1,key:"netState",value:Z.networkType}),""!=Ms.networkStateInfo.ns)&&""!=Ms.networkStateInfo.dip&&Zn(J)}})}function Yn(J,Z){c(J)&&(Ms.networkStateInfo.dip=J,""==Ms.networkStateInfo.ns||""==Ms.networkStateInfo.dip||yi||Zn(Z))}function Zn(J){J=J||q(),Ms.networkStateInfoMap[J]=L({},Ms.networkStateInfo),yi=J,T(pt,J)}function Zr(){var J=ne[se]&&ne[se].emits.length;if(!(2<J)){if(1==J){if(function $r(){lt(ne.getPerformance)?ne.getPerformance().createObserver((function(J){var Z=J.getEntries();for(let J=0;J<Z.length;J++){var ne=Z[J],se=ne&&ne.entryType,re=ne&&ne.name;"navigation"===se&&"appLaunch"==re&&(ee.log("launchTime:",ne.duration),Ms.launchTime=1e3*ne.duration)}})).observe({entryTypes:["navigation","render","script"]}):ee.warn("Unable to obtain the getPerformance API!"),(App=Pn(App,oi,ci,null))[At]=!0}(),!Page[At]){(Page=Pn(Page,Vs,$s,qn))[At]=!0;const J=Component;J[At]||((Component=function(Z){var ee=c(Z)?Z.methods:{};let ne=Object.assign({},Z,{methods:Ln(ee,qn)});return ne.methods=Mn(ne.methods,Vs,$s),c(ne.lifetimes)&&(ne.lifetimes=jn(ne.lifetimes,Zs)),Z=ne.lifetimes||{},ne=jn(ne,Zs,0,Z),J.call(this,ne)})[At]=!0)}li.checkIsOpen(Ts.brss),ne.request?Object.defineProperty(ne,"request",{configurable:!0,enumerable:!0,writable:!0,value:Gr}):console.warn("sdk.request is not defined"),function Lr(){var J,Z,ee;Ts.consoleError&&console&&console.error&&(console.error=(J=console.error,Z=Mr,J.$original?J:((ee=function(){var ee=oe(arguments);if(!ft())return J.apply(this,ee);try{return c(null)&&null.apply(this,ee),J.apply(this,ee)}catch(J){throw J}finally{Z.apply(this,ee)}}).$original=J,ee)))}(),function _r(){const J=ne.setNavigationBarTitle;Object.defineProperty(ne,"setNavigationBarTitle",{get:()=>function(Z){J.call(this,Z);var ee=we(),ne=Z.title;if(ee&&ne&&(xs.pageTitle[ee]=ne,xs.pageRoutes)&&0<xs.pageRoutes.length)for(let J=0;J<xs.pageRoutes.length;J++){var se=xs.pageRoutes[J];se&&se.path==ee&&se.title!=ne&&Nr(se.title=ne)}}})}()}br(),ne.onAppHide(ue);{const J=dt(kt),Z=new Date;if(J&&J[Gt]){const Z=new Date,ee=J[Gt];Ms.cacheData.firstVisitDayTime=ee,Ms.cacheData.firstVisitTime=Z.getTime()}else{const J=Z.setHours(23,59,60);Ms.cacheData.firstVisitDayTime=J,Ms.cacheData.firstVisitTime=Z.getTime(),Ms.appLaunchInfo.isFirstLaunch=!0,ce(kt,Ms.cacheData)}}Gn(),function Yr(){try{ne.onNetworkStatusChange((function(J){if(ft()){Ms.networkStateInfo.ns=J.networkType;var Z=J=q();if(c(Ts)&&Ts.gdia){var ee=Ts.gdia;try{ne.request({url:ee,method:"GET",ignore:!0,success(J){J&&200===J.statusCode&&((J=J&&J.data&&J.data.di)&&Yn(J,Z),J=L({},Ms.networkStateInfo),T(Fe,{tn:J,t:1}))},fail(){}})}catch(J){}}Wn(J)}}))}catch(J){ee.log("HackNetworkStatus error!",J)}}(),Wn()}}function Rt(){if(!Ms.unableConfig){let pe={v:re,di:Ms.deviceInfo||{},ai:L(Ms.appInfo,{ai:Ts.appId})};var J=pe.ai,Z="ci";if(c(J)&&"object"==typeof J)if(!c(Z)||c(J[Z])&&""!==J[Z])for(const Z in J)c(J[Z])&&""!==J[Z]||delete J[Z];else delete J[Z];Z=((Z=Gn()).ns&&(pe.nsi=Z.ns),{});var se=(c((se=function Ar(){return Ps}()).ui)&&(Z.ui=se.ui||""),c(se.ei)&&(Z.ei=se.ei||""),c(Z)&&Z.ui&&(pe.ui=Z),pe.nsi={ns:"WiFi"},{v:ae,a:Ts.appId||"",d:Ms.deviceInfo.di||""}),le=(Z=Ts.beacon.configAddress||"",Z="".concat(Z,"?",an(se)),se=(T(it,{type:1}),{}),Cs.createReqHeader());let _e="";le&&(se["BR-Encryption-Method"]=le,se["Content-Type"]="application/octet-stream",_e="arraybuffer",pe=Cs.encrypt(pe)),ee.log("request config:",pe);try{ne.request({url:Z,data:pe,method:"POST",ignore:!0,header:se,timeout:bs.timeout,responseType:_e,success(J){if(J&&200===J.statusCode){let Z=J&&J.data;J=J.header&&J.header["BR-Encryption-Method"]||J.header&&J.header["br-encryption-method"],function(J){if(!c(J)||J&&1e4!=J.rc)return de();var Z,ee=L({},Ts);(ee=L(Ts,J)).newSetConfig=!0,ee.setTime=R()/1e3,J=Yn,c(Z=ee)&&(Ts.initTime=1e3*R(),Ts=L(Ts,Z),Z.di&&J&&J(Z.di),J=dt(wt)||{},Z=Object.assign({},J,Ts),Ts.appId=Ms.appInfo.ai,ce(wt,Z),Ms.cacheData.config=Z),T(It,Ts),ee&&X(Hn,{s:ee.s,mc:ee.mc,cmt:ee.st});{const J=ee&&ee.mc;if(J&&0!=J.length){const Z=[];["coollaunch","hotlaunch","mpview","network","statechange","customlog","customevent","custommetric","action"].map((ee=>{let ne=!1;J.map((J=>{J.n===ee&&(ne=!0)})),ne||((ee="coollaunch"!==ee&&"hotlaunch"!==ee?ee:"launch")===Ye&&Z.push($e),Z.push(ee))})),T(it,{type:2,data:Z}),M(cs,{unModu:Z})}}}(Z=Cs.hasSm4()&&J?Cs.decrypt(Z,J):Z),Ms.closeAgent(!1),de(!1)}else Ms.closeAgent(!0),0<bs.confCount?setTimeout((function(){--bs.confCount,Rt()}),6e4):de(!0)},fail(){ee.log("Config request failed, close SDK!"),de(!0),0<bs.confCount?setTimeout((function(){--bs.confCount,Rt()}),6e4):Ms.closeConfig(!0)}})}catch(J){ee.error("Config request error!",J)}}}function de(J){T(mt,J),Ms.closeAgent(J)}function Qn(J){switch(J){case St:!function Qr(){if(ks&&(Ms.eventExtInfo={},Ns=null),0!==Ls.length)for(let Z=0;Z<Ls.length;Z++){var J=Ls[Z];J!==Ns&&Ms.eventExtInfo[J]&&delete Ms.eventExtInfo[J]}var Z=Object.keys(Ms.eventViewInfo);for(let J=0;J<Z.length;J++){var ee=Z[J];Fs!==ee&&Ms.eventViewInfo[ee]&&(delete Ms.eventViewInfo[ee],xe())}Ms.userInfoFui=null}();break;case Mt:return{userInfoKey:Us,networkStateInfoKey:yi,eeiKey:kr(),currentViewKey:Fs};case bt:return Ms}}const Si={cur:"",last:""};class Y{constructor(J,Z){this.d_type=Z,this.data=J||{},this.$metric={},this.ent=J&&J.info&&J.info.timestamp&&J.info.timestamp||1e3*R()}info(J,Z="",ee,ne=!1){var se=this.data;if(c(se)){let re=se[J];c(re)||(re=Z),c(ee)&&(J=ee),ne&&""===re||(this.$metric[J]=re)}return this}setMetricData(J,Z){J&&Z&&(this.$metric[J]=Z)}getMetricData(J){return this.$metric[J]||""}metric(J,Z="",ee){var ne=this.data;if(c(ne)){let se=ne[J];c(se)||(se=c(Z)?Z:-1),c(ee)&&(J=ee),this.$metric[J]=se}return this}build(J,Z){var ee=Qn(Mt),ne=dn().currentViewKey;let se=ee.networkStateInfoKey;return Si.last!=se&&(""==Si.cur&&(Si.cur=se),Si.last=Si.cur),Si.cur=se,this.d_type==ye&&this.data&&1==this.data.t&&(se=Si.last),J={type:this.d_type,ent:J||this.ent,data:{},sin:[ee.userInfoKey||"","",se||"",ee.eeiKey,ne||""]},Z&&(J.revts=[]),ee=this.$metric,J.data=ee,J}}function fe(J,Z){let ee=dt(Dt);const ne=ee&&ee[0]&&ee[0].s;if(c(ee)&&ee.length&&ee[ee.length-1]&&!ne){const ne=ee[ee.length-1]&&ee[ee.length-1].countSize+Z;ne>Li.cacheSize?(ze(),ee=new Array({data:J,size:Z,countSize:Z})):ee.push({data:J,size:Z,countSize:ne})}else ne&&ze(),ee=new Array({data:J,size:Z,countSize:Z});ce(Dt,ee)}function ze(){var J=Dt;try{ne.removeStorageSync(J)}catch(Z){try{ne.removeStorageSync(J)}catch(Z){console.debug(J," RemoveStorage fail!\n",Z)}}}function Xn(J){var Z=Ve(bt),se=J.data||[];J=J.size;if(!(se.length<=0)){let _e=se;se={brkey:q()};let ve="";(le=Cs&&Cs.createReqHeader())&&Cs&&(se["BR-Encryption-Method"]=le,se["Content-Type"]="application/octet-stream",ve="arraybuffer",_e=Cs.encrypt(_e));var re,le=Li.usc,pe=Z.networkStateInfo.ns;ee.log("net-type and usc:",pe,le),0==le||1==le&&"wifi"==pe?(ee.log("serviceConfig:",Li),le={v:ae,a:Li.AppId||"",d:Z.deviceInfo.di||"",mt:1e3*R(),cmt:Li.st,s:Li.s},pe=Li.ua,pe="".concat(pe,"?",an(le)),re={url:pe,data:_e,header:se,responseType:ve,size:J},Ei.add(),ee.log("uploadData:",re),ne.request({url:re.url,data:re.data,method:"POST",header:re.header,timeout:Li.timeout,responseType:re.responseType,ignore:!0,success(J){if(J&&J.statusCode<400){let ee=J.data;var Z=J.header&&J.header["BR-Encryption-Method"]||J.header&&J.header["br-encryption-method"];if((ee=Cs.hasSm4()&&Z?Cs.decrypt(J.data,Z):ee)&&1e4===ee.rc){const J=dt(Dt),Z=J&&J[0]&&J[0].s;if(ze(),c(J)&&0<J.length&&!Z){const Z=Li.sat||0;J.forEach((J=>{var ee=J&&J.data&&J.data.mt;1e3*R()-ee<36e8*Z&&Ei.addUploadData(J.data,J.size,2)}))}}else fe(re.data,re.size)}else fe(re.data,re.size)},fail(){fe(re.data,re.size)},complete(){Ei.minus(),Ei.prepareUpload(!1)}})):fe(_e,J)}}const Ei=new class{constructor(){this.uploadDataArr=[],this.localStorageArr=[],this.uploadState=!0,this.maxPading=2,this.isPading=0,this.maxSize=1e3,this.currentSize=0}add(){this.isPading=this.isPading+1}minus(){this.isPading=this.isPading-1}addUploadData(J,Z,ee){if(J={data:J,size:Z,local:1!==ee},1===ee){if(this.currentSize>bs.cacheSize)return;this.currentSize=this.currentSize+Z,this.uploadDataArr.push(J)}else this.localStorageArr.push(J);this.isPading<this.maxPading&&this.prepareUpload(!1)}prepareUpload(J){if(0<this.uploadDataArr.length&&(this.isPading<this.maxPading||J)){const J=this.uploadDataArr.shift();this.currentSize=this.currentSize-J.size,Xn(J)}0<this.localStorageArr.length&&(this.isPading<this.maxPading||J)&&Xn(this.localStorageArr.shift())}};class B{constructor(){this.json={v:re,e:[]}}}B.prototype.setNetworkStateInfo=function(J){return this.json.nsi=J,this},B.prototype.setMonitorTime=function(J){return this.json.mt=J,this},B.prototype.setConfigTime=function(J){return this.json.cmt=J,this},B.prototype.setSessionId=function(J){return this.json.s=J,this},B.prototype.setDeviceInfo=function(J){return this.json.di=J,this},B.prototype.setAppInfo=function(J,Z){return this.json.ai=J,!1===Z.flage?(this.json.ai.s=1001,this.json.ai.sl=0,this.json.ai.iso=!1):(this.json.ai.s=Z.s,this.json.ai.sl=Z.sl,this.json.ai.iso=Z.iso),this},B.prototype.setFirstUserInfoIndex=function(J){return c(J)&&(this.json.fui=J),this},B.prototype.setUserInfo=function(J,Z){if("{}"!==Z){const ee=new Set,ne=(J.map((J=>{J.sin&&J.sin[0]&&ee.add(J.sin[0])})),{});ee.forEach((J=>{ne[J]=Z[J]})),this.json.ui=ne}return this},B.prototype.setSessionDuration=function(J){return this.json.usd=0<=J?J:0,this},B.prototype.setSessionStartTime=function(J){return this.json.sst=J,this},B.prototype.setFirstDay=function(J){return this.json.ifd=J,this},B.prototype.setEvi=function(J){return this.json.evi=J,this},B.prototype.setEei=function(J){return J&&k(J)&&0<Object.keys(J).length&&(this.json.eei=J),this},B.prototype.pushEventData=function(J){var Z=J.type&&J.data?{k:J.type,ent:J.ent,sin:J.sin,v:J.data}:{k:J.k,ent:J.ent,sin:J.sin,v:J.v};return J.revts&&0<J.revts.length&&(Z.revts=J.revts),this.json.e.push(Z),this},B.prototype.build=function(J){return this.json};var Ci=0,Mi=0;function tr(J){if(J&&0<J.length)for(let ne=0;ne<J.length;ne++){var Z=J[ne],ee=Z&&Z.ent||1e3*R();(ee<Ci||0===Ci)&&(Ci=ee),(Mi<ee||0===Mi)&&(Mi=ee),Z.revts&&tr(Z.revts)}}const bi=new class{constructor(){this.dataArr=[],this.setLen=15,this.setSize=20480,this.setTime=15e3,this.timer="",this.json={v:re,e:[]},this.close=!1,this.needCheckData=!1,this.clearDataArr=[],this.usdSt=null,this.sessionStartTime=0,this.hasUpload=!1}dataArrAddFun(J,Z=!1){""===J.sin[2]&&(this.needCheckData=!0);var ee=Te(this.dataArr),ne=Vt(this.dataArr);return(ne<2*this.setSize||ee<this.setLen&&ne<this.setSize||!this.hasUpload)&&this.dataArr.push(J),Z?(this.uploadData(ne),clearTimeout(this.timer)):this.checkData(),this}checkDataFun(J){this.needCheckData&&(this.dataArr.map((Z=>{Z.sin[2]=J})),this.needCheckData=!1)}clearCacheData(J){this.clearDataArr=J}checkData(){clearTimeout(this.timer);const J=Te(this.dataArr),Z=Vt(this.dataArr);if(J>=this.setLen||Z>=this.setSize)this.uploadData(Z);else{const J=this;this.timer=setTimeout((function(){J.uploadData(Z)}),this.setTime)}return this}uploadData(J){var Z;this.close?this.claerData():Li.newSetConfig&&0<this.dataArr.length&&(Z=this.dataArr.filter((J=>(J=J.type||J.k,!this.clearDataArr.includes(J)))),this.hasUpload=!0,Z&&0===Z.length||(Z=this.buildUploadData(Z),Ei.addUploadData(Z,J,1),this.claerData(),Ve(St)))}buildUploadData(J){var Z=Ve(bt),ee=dn().eventViewInfo||{},ne=J&&J[0]&&J[0].ent||0,se=(this.sessionStartTime=Z.sessionStartTime,0===this.sessionStartTime&&(this.sessionStartTime=ne),0!==this.sessionStartTime&&0!==ne&&this.sessionStartTime>ne&&(this.sessionStartTime=ne),new B);se.setMonitorTime(1e3*N()).setConfigTime(Li.st).setSessionId(Li.s).setDeviceInfo(Z.deviceInfo).setAppInfo(Z.appInfo,Z.shareInfo).setUserInfo(J,Z.userInfoMap).setNetworkStateInfo(Z.networkStateInfoMap).setFirstUserInfoIndex(Z.userInfoFui).setSessionStartTime(this.sessionStartTime).setFirstDay(Z.getIsFirstDay()).setEvi(ee).setEei(Z.eventExtInfo),Mi=Ci=0,J&&0<J.length&&J.forEach((function(J){var Z;J&&"object"==typeof J&&(Z=J&&J.ent||1e3*R(),((J.ent=Z)<Ci||0===Ci)&&(Ci=Z),(Mi<Z||0===Mi)&&(Mi=Z),J.revts&&tr(J.revts),se.pushEventData(J))})),ne=c(this.usdSt)&&Mi-this.usdSt||Mi-Ci;return this.changUsdTime(Mi),se.setSessionDuration(ne),se.build()}claerData(){this.dataArr=[]}stopDataCatch(J){this.close=J}updateTime(J){J&&0<J&&(this.setTime=1e3*J)}changUsdTime(J){c(J)&&(this.usdSt=J)}},Oi=new class{constructor(){this.url="",this.networkData={},this.originUrl="",this.urlObj={}}checkSensitive(J,Z){var ee;!Z||Z&&0===Z.length||Se(ee=J.url||"")&&(this.url=ee,this.networkData=J,this.originUrl=ee,this.urlObj=De(ee),this.urlObj.search||J.rh||J.rhe)&&this.startMatch(Z)}startMatch(J){for(let ee=0;ee<J.length;ee++){var Z=J[ee];Z&&Z.sa&&Z.t&&(this.url=this.networkData.url,this.urlObj=De(this.url),2===Z.t?this.andLogic(Z.sa,this.originUrl)&&this.desensitize(Z):this.orLogic(Z.sa,this.originUrl)&&this.desensitize(Z))}this.clear()}andLogic(J,Z){return J.every((J=>this.matchURL(Z,J.t,J.r,J.c)))}orLogic(J,Z){return J.some((J=>this.matchURL(Z,J.t,J.r,J.c)))}matchURL(J,Z,ee,ne){var se=this.urlObj&&this.urlObj.hostname||"",re=1===Z?se.toLowerCase():J;switch(ne=1===Z?ne.toString().toLowerCase():ne,ee){case 1:if(re==ne)return!0;break;case 2:if(-1<re.indexOf(ne))return!0;break;case 3:if(en(re,ne))return!0;break;case 4:if(tn(re,ne))return!0}return!1}desensitize(J){var Z=J.mt;J=J.mk;this.urlObj&&this.urlObj.search&&c(J.aqk)&&this.delorVagueKey(Z,J.aqk,"qka",J.qka),this.networkData.rh&&c(J.areqh)&&this.delorVagueKey(Z,J.areqh,"reqhka",J.reqhka),this.networkData.rhe&&c(J.aresh)&&this.delorVagueKey(Z,J.aresh,"reshka",J.reshka)}delorVagueKey(J,Z,ee,ne){if(ee)if("qka"!==ee&&(ne=this.toLowerCase(ne)),!0===Z)"qka"===ee?1===J?this.networkData.url=this.networkData.url.split("?")[0]:this.VagueAllKey(0,ee,ne,this.networkData.url):"reqhka"===ee?1===J?(this.networkData.rh="",this.networkData.reqht=""):this.VagueAllKey(1,ee,ne,this.networkData.rh,this.networkData.reqht):"reshka"===ee&&(1===J?(this.networkData.rhe="",this.networkData.resht="",this.networkData.tid="",this.networkData.xbr="",this.networkData.trsp=""):(this.VagueAllKey(2,ee,ne,this.networkData.rhe,this.networkData.resht),this.networkData.tid="**",this.networkData.xbr="**",this.networkData.trsp="**"));else if(!1===Z&&ne&&0<ne.length)if("qka"===ee)for(let Z=0;Z<ne.length;Z++){const ee=ne[Z],se=new RegExp(ee+"=([^&]+)");if(se instanceof RegExp&&se.test(this.networkData.url)){let Z=1===J?this.networkData.url.replace(se,""):this.networkData.url.replace(se,ee+"=**");1===J&&Z.endsWith("?")&&(Z=Z.replace("?","")),1===J&&Z.includes("?&")&&(Z=Z.replace("?&","?")),this.networkData.url=Z}}else if("reqhka"===ee){const Z=this.networkData.rh&&zt(this.networkData.rh)&&JSON.parse(this.networkData.rh),ee=this.networkData.reqht;if(Z){const ee=this.traverseObject(Z,ne,J,!1);this.networkData.rh=JSON.stringify(ee)}ee&&k(ee)&&(this.networkData.reqht=this.traverseObject(ee,ne,J,!1))}else if("reshka"===ee){const Z=this.networkData.rhe&&zt(this.networkData.rhe)&&JSON.parse(this.networkData.rhe),ee=this.networkData.resht;if(Z){const ee=this.traverseObject(Z,ne,J,!1);this.networkData.rhe=JSON.stringify(ee)}ee&&k(ee)&&(this.networkData.resht=this.traverseObject(ee,ne,J,!1)),this.networkData.tid&&ne&&-1<ne.indexOf("br-resp-key")&&(this.networkData.tid=1===J?"":"**"),this.networkData.xbr&&ne&&-1<ne.indexOf("x-br-response")&&(this.networkData.xbr=1===J?"":"**"),this.networkData.trsp&&ne&&-1<ne.indexOf("traceresponse")&&(this.networkData.trsp=1===J?"":"**")}}VagueAllKey(J,Z,ee,ne,se){if(Z&&ne)if("qka"===Z){const J=this.url.replace(/(\?|&)([^=&]+)=([^&]+)/g,"$1$2=**");this.networkData.url=J}else{if(ne&&zt(ne)){const Z=JSON.parse(ne),se=this.traverseObject(Z,ee,2,!0);1===J?this.networkData.rh=JSON.stringify(se):2===J&&(this.networkData.rhe=JSON.stringify(se))}if(se&&k(se)){const Z=this.traverseObject(se,ee,2,!0);1===J?this.networkData.reqht=Z:2===J&&(this.networkData.resht=Z)}}}traverseObject(J,Z,ee,ne){if(J&&Z&&!1===ne){const ne=Z.toString();for(const Z in J){var se;Object.hasOwnProperty.call(J,Z)&&(se=new RegExp(""+Z,"i"))instanceof RegExp&&se.test(ne)&&(1===ee?delete J[Z]:J[Z]="**")}}else if(J&&!0===ne&&2===ee)for(const Z in J)Object.hasOwnProperty.call(J,Z)&&(J[Z]="**");return J}toLowerCase(J){if(J&&0<J.length)return J.map((J=>J&&J.toString().toLowerCase()))}clear(){this.url="",this.networkData={},this.urlObj={},this.originUrl=""}},wi=new class{constructor(){this.isFullCollection=-1,this.url=void 0,this.hostName=void 0,this.pathName=void 0,this.hostRule=[],this.pathRule=[]}startFiltering(J,Z){if(this.isFullCollection&&1===this.isFullCollection)return!0;if(!Z||!Se(Z))return!1;if(this.pathName=Z.split("?")[0],this.hostName=De(Z).hostname,this.url=this.hostName,0===this.isFullCollection)return this.handleRule();{const Z=this.handleConfig(J);return!0===Z?this.handleRule():!1===Z&&1===this.isFullCollection}}handleConfig(J){let Z;if(J&&J.forEach((J=>{J&&"network"===J.n&&(Z=J.cs)})),Z&&c(Z.fc)){const J=Z&&Z.wl;return this.isFullCollection=Z.fc,!!J&&(this.hostRule=J.hr&&J.hr.slice(0,20)||[],this.pathRule=J.pr&&J.pr.slice(0,20)||[],0!==this.hostRule.length||0!==this.pathRule)}return!1}handleRule(){var J=!!(this.hostRule&&0<this.hostRule.length)&&this.match("host");return!!(this.pathRule&&0<this.pathRule.length&&!1===J)&&this.match("path")||J}match(J){let Z;"host"===J?Z=this.hostRule:(Z=this.pathRule,this.url=this.pathName);for(let J=0;J<Z.length;J++){var ee=Z[J]||"";if(ee&&-1<ee.indexOf("*")){const{startStr:J,endStr:Z,all:se}=Tr(ee,"*");if(!(se&&2<se.length))if(J&&Z){var ne=new RegExp("("+J+").+("+Z+")").test(this.url);if(ne)return ne}else if(!J&&Z){const J=this.url.endsWith(Z);if(J)return J}else{const Z=this.url.startsWith(J);if(Z)return Z}}else if(this.url===ee)return!0}return!1}resetState(){this.isFullCollection=-1,this.url=void 0}};function ei(J){if(c(Li.cbbk)&&0<Li.cbbk.length){let Z="";if(zt(J.body))try{let ee;ee="object"==typeof J.body?J.body:new Function("","return "+J.body)(),Kt(Li.cbbk,(function(J,ne){c(ee[J])&&(Z+=`${J}=${encodeURIComponent(ee[J])}&`)})),J.cbbq=Z.slice(0,-1)}catch(J){}else if(E(J.body))try{Kt(J.body.split("&"),(function(J){Kt(Li.cbbk,(function(ee,ne){ee&&-1!==J.indexOf(ee+"=")&&(Z+=J+"&")}))})),J.cbbq=Z.slice(0,-1)}catch(J){}}if(c(Li.cbqk)&&E(J.url))try{let Z="",ee=J.url.split("?")[1];Kt(ee=ee&&ee.split("&"),(function(J){Kt(Li.cbqk,(function(ee,ne){ee&&-1!==J.indexOf(ee+"=")&&(Z+=J+"&")}))})),J.cbq=Z.slice(0,-1)}catch(J){}if(c(Li.cbhk)&&c(J.rh))try{var Z=Li.cbhk;let re="";var ee=zt(J.rh)&&JSON.parse(J.rh)||[],ne=Object.keys(ee);for(let J=0,ae=ne.length-1;J<=ae;J++){var se=ne[J];Z.includes(se)&&(re+=se+"="+ee[se]+"&")}J.cbhq=re.slice(0,-1)}catch(J){}return J}function ni(J){if((ee.log("netWorkData:",J),J.data)&&(ye=JSON.parse(JSON.stringify(J.data)))){ye&&ye.url&&4096<ye.url.length&&(ye.url=ye.url.slice(0,4096));var Z,se=ye&&ye.url,re=ye.ai,ae=ye.id,le=!!ye.ai,pe=ye.st||R();Li&&Li.snr&&Oi.checkSensitive(ye,Li.snr),ei.call(this,ye);let J=0;try{-1===(J=Ot.indexOf(ye.pt))&&(J=0)}catch(J){}if(0===J&&(/^https/.test(se)?J=2:/^http/.test(se)&&(J=1)),/(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])/.test(se)){const J=(Z=se)?/(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\:([0-9]{1,5})/.test(Z)?[`${RegExp.$1}.${RegExp.$2}.${RegExp.$3}.`+RegExp.$4,Number(RegExp.$5)]:/\:([0-9]{1,5})/.test(Z)?["",Number(RegExp.$1)]:-1<Z.indexOf("https")?["",443]:["",80]:["",""];c(ye.ti)&&""!==ye.ti||(ye.ti=J[0]),c(ye.tp)&&""!==ye.tp||(ye.tp=J[1])}ye.tp||(Z=se.match(/:(\d+)(?=[/?#]|$)/))&&Z[1]||(ye.tp=/^https/.test(se)?443:80),ye.pt=J;var _e=new Y(ye,Ye),ve=(_e.info("url","","ru").info("method","","m").info("ec",200).info("dti",0,"dti").info("rt",0,"rt").info("rti",0,"rti").info("ds").info("rds","","rds").info("tid","","tid",!0).info("ti","").info("tp",443).info("dt",0).info("ct",0).info("sslt",0).info("pt",J).info("em","","em",!0).info("art",3).info("ic",!1).info("cbhq","","cbhq",!0).info("cbbq","","cbbq",!0).info("cbq","","cbq",!0).info("rei","","rei",!0).info("xbr","","xbr",!0).info("trsp","","trsp",!0).info("tpar","","tpar",!0).info("ep","","ep",!0).info("id","","id").info("ai","","ai",!0).info("reqht","","reqht",!0).info("resht","","resht",!0),Li&&0===Li.hcs?0:Li&&Li.hcs||1),ye=(1===ve?ye&&400<=ye.ec&&_e.info("rh","","rh",!0).info("rhe","","rhe",!0):2===ve&&_e.info("rhe","","rhe",!0).info("rh","","rh",!0),_e.build(pe));if(le)ne.BonreeRUM&&ne.BonreeRUM.relateEvents[Li.AppId].addRelateEventData(re,ae,ye,Ye);else if(Li&&Li.mc){const J=wi.startFiltering(Li.mc,se);le||!0!==J||bi.dataArrAddFun(ye)}else bi.dataArrAddFun(ye)}}const Ri=/([^@(\s)]+):(\d+):(\d+)/,Di=/\n/;function rr(J){return J=Number(J),isNaN(J)?0:J}function ii(J){var Z;return 0===J.length?"unknown":1===J.length?J[0]:(Z=J[0],-1<(J=J[1]).indexOf(Z)?J:Z+": "+J)}function ir(J){try{let ee,ne,se,re;const ae=J.split(Di);let le=ae.shift();for(var Z=[];gr(le);){if(le=le.trim(),"MiniProgramError"!==le&&(Z.push(le),Ri.test(le))){ee=ii(Z);const J=Ri.exec(le);ne=J[1].replace(/^\(/,""),se=rr(J[2]),re=rr(J[3]);break}le=ae.shift()}return{message:ee||"unkonw",file:ne||"<Anonymous>",line:se||0,column:re||0,duration:0,count:1,stack:mr(J,2e3)}}catch(J){ee.warn("Error parsing JS stack error!",J)}}let Li={stop:!1,AppId:""};function ar(J,Z,se,re){if(se===Li.AppId)switch(J){case Ye:ni(Z);break;case $e:!1!==(xt=Z).isOpen&&((Ft=new Y(xt.data,$e)).info("n","","n").info("t",0,"t").info("st","","st").info("du",0,"du").info("sta",0,"sta").info("stac","","stac",!0).info("ic",!1,"ic").info("da","","da",!0).info("m","","m",!0).info("tag","","tag",!0).info("sub","","sub",!0),Ft=Ft.build(xt.startTime),bi.dataArrAddFun(Ft));break;case ve:xt=Z,ee.log("launchData:",xt),Ft=xt&&xt.time||1e3*R(),Ut=xt.id,(Gt=new Y(xt,ve)).info("type",xt.type,"t").info("loadTime",xt.loadTime,"lt").info("is",xt.is),xt=2!==xt.type,Gt=Gt.build(Ft,xt),ne.BonreeRUM&&ne.BonreeRUM.relateEvents[Li.AppId].setRootNodeData(Ut,Gt,!xt);break;case le:case pe:Ut=Z,ee.log("mpvieData:",Ut),Gt=Ut.data,wt=Ut.rootId,Dt=new Y(Gt,le),Lt=Ut.mode,Ut=Ut.type,kt=Gt.ic,Dt.info("ci").info("pvid").info("name","","n").info("ic",kt).info("m",Lt).info("param","","p",!0).info("rt").info("st",0,"st").info("lt").info("std","","std",!0).info("vt","","vt",!0),1===Ut?Dt.info("is",!1):Dt.info("",!1,"is"),c(Gt.param)&&"{}"!=Gt.param&&""!=Gt.param&&Dt.info("param","","p"),Ut=Dt.build("",!0),0!=kt||1!==Lt&&2!==Lt?kt&&wt?ne.BonreeRUM&&ne.BonreeRUM.relateEvents[Li.AppId].addRelateEventData(wt,Gt.ci,Ut,le):bi.dataArrAddFun(Ut):ne.BonreeRUM&&ne.BonreeRUM.relateEvents[Li.AppId].setRootNodeData(wt,Ut);break;case He:!function ai(J){ee.log("errorData:",J);let Z=J.error;if(E(J.error)||J.error instanceof Error){var ne=E(J.error)?J.error:J.error.stack;try{Z=ir(ne)}catch(J){(se=J.stack.split(Di)).splice(1,1),Z=ir(ne=se.join("\n"))}if(c(Z)&&c(Z.stack)&&(Z.stack=Z.stack.replace(/\n+/g,"\n")),c(Z)&&c(Z.message)){var se=J.pvid,re=(ne=J.url,(re=J.time||N())&&1e3*re||1e3);const ee=function(J){try{if(c(J)&&0<J.length)return J.split(":")[0]}catch(J){}return""}(Z.message),ae=new Y(Z,He),le=J.userAgent||"";ae.info("pvid",se).info("url",ne).info("file","","n").info("message","","m").info("line",1,"l").info("column",1,"col").info("stack","","sta").info("pct",re).info("et",ee).info("pt",3).info("ua",le,"ua",!0).info("ect",3),se=ae.build(),bi.dataArrAddFun(se)}}}(Z);break;case _e:Dt=Z,ee.log("actionData:",Dt),Lt=(Dt=Dt.data).startTime,kt=Dt.id,wt=Dt.currentCorrelationId||"",(Dt=JSON.parse(JSON.stringify(Dt))).ice=!1,(Dt=new Y(Dt,_e)).info("id","","id").info("mode",1,"m").info("type",1,"t").info("sourceAction",3,"sa").info("name","","n").info("info","","i").info("viewName","","vn").info("ci","","ci").info("ic",!1,"ic").info("ice",!1,"ice").info("param","","p",!0).info("loadTime","","lt").info("is",!1,"is").info("vci",wt,"vci").info("ir",0,"ir").info("vt",10),wt=Dt.build(Lt),bi.dataArrAddFun(JSON.parse(JSON.stringify(wt))),Dt.info("me","","me"),Dt.setMetricData("m",2),wt=Dt.build(Lt,!0),ne.BonreeRUM&&ne.BonreeRUM.relateEvents[Li.AppId].setRootNodeData(kt,wt);break;case ye:case Fe:bt=Z,At=re,ee.log("stateChangeData:",bt),Ot=bt.t,(bt=new Y(bt,ye)).info("t",1),1===Ot&&bt.info("tn",{}),Ot=bt.build(),bi.dataArrAddFun(Ot,At);break;case qe:(bt=new Y(bt=Z,qe)).info("userId",1,"ui").info("command","","c").info("info","","i"),bt=bt.build(),bi.dataArrAddFun(bt);break;case Qe:{const J=(Ot=Z)&&Ot.type,ee=new Y(Ot,Qe);if(ee.info("eventId","","i").info("eventName","","n",!0).info("eventParam","","p",!0).info("t",J).info("d",0).info("eventLabel","","l",!0).info("info","","info",!0),0===J)ee.info("d",0);else if(1===J)ee.info("ci",Ot.uid);else if(2==J){const J=Ot.duration;ee.info("d",J).info("ci",Ot.uid)}Ot=ee.build(),bi.dataArrAddFun(Ot)}break;case Je:(At=new Y(At=Z,Je)).info("logInfo","","i").info("logParam","","p",!0),At=At.build(),bi.dataArrAddFun(At);break;case tt:var ae=Z;(ae=new Y(ae,tt)).info("metricName","","n").info("metricValue",0,"v").info("metricParam","","p",!0),ae=ae.build(),bi.dataArrAddFun(ae);break;case Xe:(ae=new Y(ae=Z,Xe)).info("oip").info("sti"),ae=ae.build(),bi.dataArrAddFun(ae);break;case nt:var St=Z;(St=new Y(St,nt)).info("causedBy","","cab").info("exceptionType","","t").info("errorDump","","p").info("ic",!0).info("id",q()),St=St.build(),bi.dataArrAddFun(St);break;case it:var Mt=Z;switch(Mt.type){case 1:li.clear();break;case 2:bi.clearCacheData(Mt.data)}break;case ot:bi.dataArrAddFun(Z);break;case mt:bi.stopDataCatch(Z);break;case pt:bi.checkDataFun(Z);break;case It:St=Z,ee.log("getConfig:",St),Li=L(Li,St),bi.updateTime(St.rct)}var bt,At,Ot,wt,Dt,Lt,kt,Ut,Gt,xt,Ft}function Ve(J){return ne.BonreeRUM&&ne.BonreeRUM.executes[Li.AppId]&&ne.BonreeRUM.executes[Li.AppId](J)}const Pi={version:re,setUserId:C,startSpan:C,customLog:C,customEvent:C,customMetric:C,customException:C,setExtraInfo:C,customPageStart:C,customPageEnd:C,customEventStart:C,customEventEnd:C,customSpeedTest:C,recordCustomActionEnd:C,addUserExtraInfo:C,setUserExtraInfo:C,removeUserExtraInfo:C,increaseUserExtraInfo:C,addEventAttributeWithKey:C,addEventAttributes:C,removeEventAttributeWithKeys:C,removeAllEventAttributes:C};function sr(J){var Z,re,ae;return c(J)&&function si(J){var Z=Ts;if(c(J.configAddress)&&(Z.beacon.configAddress=J.configAddress.trim()),c(J.appId)&&(Z.appId=J.appId.trim(),Ms.appInfo.ai=J.appId.trim()),c(J.channelId)&&Ms.setChannelId(J.channelId),c(J.version)&&Ms.setAppVersion(J.version),c(J.deviceId)&&Ms.setDeviceId(J.deviceId),c(J.appName)&&Ms.setAppName(J.appName),J.timeout&&ut(J.timeout)&&0<J.timeout&&(Z.timeout=J.timeout),c(J.consoleError)&&(Z.consoleError=J.consoleError),ut(J.cacheSize)&&(Number(J.cacheSize)<100&&(J.cacheSize=100),990<Number(J.cacheSize)&&(J.cacheSize=990),Z.cacheSize=1024*J.cacheSize),J.debug&&1==J.debug){for(const J in ee)ee[J]=(...Z)=>{var ee=[hr(),cr()].join(" ");console[J](ee,...Z)};Z.debug=!0}Ts=L(Ts,Z)}(J),Z=(ae=dt(wt))&&ae.newSetConfig,c(ae)&&Z?(c(ae.spt)&&c(ae.setTime)&&((R()/1e3-ae.setTime)/3600>ae.spt?(ae.sp=100,Rt()):ae.sp>100*Math.random()?Rt():Ms.closeAgent(!0)),ae.setTime=R()/1e3):Rt(),c(ne)?!1===Ts.enable?(ee.warn("Configuration does not allow SDK startup!"),Pi):(ne[se]||(ne[se]={executes:{},viewInfo:{},relateEvents:{},configs:{},emits:[],$$Bonree:!0}),ne[se]&&ne[se].executes&&(ne[se].executes[J.appId]=Qn),ne[se]&&ne[se].relateEvents&&(ne[se].relateEvents[J.appId]=As),2<(ne[se]&&ne[se].emits.length)?void 0:(ne[se]&&ne[se].configs&&(ne[se].configs[bs.appId]=Ts),(Z=J.appId)&&(Li.AppId=Z),ne[se]&&ne[se].emits?ne[se].emits.push({appId:Z,emit:ar}):ne[se].emits=[{appId:Z,emit:ar}],Zr(),re=Pi,ae={setUserId:kn,setExtraInfo:An,startSpan:Os.startSpan.bind(Os),customLog:fn,customEvent:vn,customMetric:pn,customException:On,customPageStart:_n,customPageEnd:Cn,customEventStart:In,customEventEnd:yn,customSpeedTest:gn,recordCustomActionEnd:C,addUserExtraInfo:Sn,setUserExtraInfo:Dn,removeUserExtraInfo:bn,increaseUserExtraInfo:wn,addEventAttributeWithKey:En,addEventAttributes:Ce,removeEventAttributeWithKeys:Rn,removeAllEventAttributes:Tn},re&&Et(ae,(function(J,Z){Jt(re,Z)&&(re[Z]=J)})),re)):(ee.error("SDK does not support running in this environment!"),Pi)}function or(J,Z){J&&J.exec&&J.name&&Is.install(J,Z)}const Ui={start:sr,install:or,SDK_VERSION:re,onError:function(J){J instanceof Error&&(J=je(J),T(He,J))},customLog:fn,customEvent:vn,customMetric:pn,customException:On,customPageStart:_n,customPageEnd:Cn,customEventStart:In,customEventEnd:yn,customSpeedTest:gn,recordCustomActionEnd:C,setUserId:kn,setExtraInfo:An,startSpan:Os.startSpan.bind(Os),addUserExtraInfo:Sn,setUserExtraInfo:Dn,removeUserExtraInfo:bn,increaseUserExtraInfo:wn,addEventAttributeWithKey:En,addEventAttributes:Ce,removeEventAttributeWithKeys:Rn,removeAllEventAttributes:Tn};Z.BonreeRUM=Ui,Z.install=or,Z.start=sr},425:function(){},547:function(J,Z,ee){"use strict";ee.d(Z,{_PLATFORM:function(){return se},envConfig:function(){return ne}});const ne={production:{BASE_URL:"https://open-api.vhall.com",VHALLYUN_API_BASE:"https://api.vhallyun.com",LOG_REPORT_BASE_URL:"https://dc.e.vhall.com/login",PUBLIC_KEY:"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0eUJFtW3vryA2NXx4M4f\n1w7dg3PHwOCA6Kx7JVfD/9eBGfqLhqsp+pg4AXG4PhuQx8EsV+sncQIiQO5J2//T\n3pO8LftDtCQztLnxnhq+BjhbFeswgfez2CwV2YKLTX2zyZ69T1Vu/M4H4gWSLeiV\n1FcH6xycA2+jG+EvOxSSItCKYT9EkB9BZSKf5RU7gM+qPtzdPtJP5vlsMCa0WnpY\nI6Qrmu/w9CZkL0397gUek9nBpPHkyPYg7ZijF3Gj8EqCMCVVTYpX96k4dd/Rz1em\ns4OSPF5jDsYZi58p+LmTcc3g7W9bD3QWWxzn47ie/Dh9LbnWfCqpGjUaHd3d42vR\ncQIDAQAB\n-----END PUBLIC KEY-----"},test:{BASE_URL:"https://test01-open-api.vhou.tv",VHALLYUN_API_BASE:"https://test01-api.vhallyun.com",LOG_REPORT_BASE_URL:"https://t-dc.e.vhall.com/login",PUBLIC_KEY:"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxWGCgHz2NLdVNa91CsNX\nFfCsxfgkTx738t3yMpuPYLL/5wwuWRrX7hBfNsfC+R5BW5b13ISzD001NNt+BWGK\np3V5fdWO18j9M/AhaTV2Ao/IpdP5huvVoNFVWPUQvX70FHu0sPVTev8ycAZHUpKx\n+mm83wxOpWBN5vAMJYx75pRCQfidb73XbOm6JXLJlxN91TUTrTiblxBhRwH0AQyr\ns9dUr+IJUZ1ea2uU3fkB4uYh7V/cHuNDMsJowfLtEU2+9IqEuJY4OwqX0qdfPF72\nsGMjCgghgL0z/7kv7Qe1+tOkJTBQTzODXBheGTVbF7hH2+5XuZsK2TfgBIew0I4k\n1wIDAQAB\n-----END PUBLIC KEY-----"}},se=19},672:function(J,Z,ee){J.exports=function(J){var Z={};function __nested_webpack_require_187__(ee){if(Z[ee])return Z[ee].exports;var ne=Z[ee]={i:ee,l:!1,exports:{}};return J[ee].call(ne.exports,ne,ne.exports,__nested_webpack_require_187__),ne.l=!0,ne.exports}return __nested_webpack_require_187__.m=J,__nested_webpack_require_187__.c=Z,__nested_webpack_require_187__.d=function(J,Z,ee){__nested_webpack_require_187__.o(J,Z)||Object.defineProperty(J,Z,{enumerable:!0,get:ee})},__nested_webpack_require_187__.r=function(J){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(J,"__esModule",{value:!0})},__nested_webpack_require_187__.t=function(J,Z){if(1&Z&&(J=__nested_webpack_require_187__(J)),8&Z)return J;if(4&Z&&"object"==typeof J&&J&&J.__esModule)return J;var ee=Object.create(null);if(__nested_webpack_require_187__.r(ee),Object.defineProperty(ee,"default",{enumerable:!0,value:J}),2&Z&&"string"!=typeof J)for(var ne in J)__nested_webpack_require_187__.d(ee,ne,function(Z){return J[Z]}.bind(null,ne));return ee},__nested_webpack_require_187__.n=function(J){var Z=J&&J.__esModule?function getDefault(){return J.default}:function getModuleExports(){return J};return __nested_webpack_require_187__.d(Z,"a",Z),Z},__nested_webpack_require_187__.o=function(J,Z){return Object.prototype.hasOwnProperty.call(J,Z)},__nested_webpack_require_187__.p="",__nested_webpack_require_187__(__nested_webpack_require_187__.s=2)}([function(J,Z){J.exports=ee(814)},function(J,Z,ee){"use strict";var ne=new Uint32Array(68),se=new Uint32Array(64);function rotl(J,Z){var ee=31&Z;return J<<ee|J>>>32-ee}function xor(J,Z){for(var ee=[],ne=J.length-1;ne>=0;ne--)ee[ne]=255&(J[ne]^Z[ne]);return ee}function P0(J){return J^rotl(J,9)^rotl(J,17)}function sm3(J){var Z=8*J.length,ee=Z%512;ee=ee>=448?512-ee%448-1:448-ee-1;for(var re=new Array((ee-7)/8),ae=new Array(8),le=0,pe=re.length;le<pe;le++)re[le]=0;for(var _e=0,ve=ae.length;_e<ve;_e++)ae[_e]=0;Z=Z.toString(2);for(var ye=7;ye>=0;ye--)if(Z.length>8){var Fe=Z.length-8;ae[ye]=parseInt(Z.substr(Fe),2),Z=Z.substr(0,Fe)}else Z.length>0&&(ae[ye]=parseInt(Z,2),Z="");for(var qe,$e=new Uint8Array([].concat(J,[128],re,ae)),He=new DataView($e.buffer,0),Ye=$e.length/64,Je=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]),Xe=0;Xe<Ye;Xe++){ne.fill(0),se.fill(0);for(var Qe=16*Xe,tt=0;tt<16;tt++)ne[tt]=He.getUint32(4*(Qe+tt),!1);for(var nt=16;nt<68;nt++)ne[nt]=(qe=ne[nt-16]^ne[nt-9]^rotl(ne[nt-3],15))^rotl(qe,15)^rotl(qe,23)^rotl(ne[nt-13],7)^ne[nt-6];for(var it=0;it<64;it++)se[it]=ne[it]^ne[it+4];for(var ot=Je[0],pt=Je[1],mt=Je[2],It=Je[3],St=Je[4],Mt=Je[5],bt=Je[6],At=Je[7],Ot=void 0,wt=void 0,Dt=void 0,Lt=void 0,kt=0;kt<64;kt++)Lt=kt>=0&&kt<=15?2043430169:2055708042,wt=(kt>=0&&kt<=15?ot^pt^mt:ot&pt|ot&mt|pt&mt)+It+((Ot=rotl(rotl(ot,12)+St+rotl(Lt,kt),7))^rotl(ot,12))+se[kt],Dt=(kt>=0&&kt<=15?St^Mt^bt:St&Mt|~St&bt)+At+Ot+ne[kt],It=mt,mt=rotl(pt,9),pt=ot,ot=wt,At=bt,bt=rotl(Mt,19),Mt=St,St=P0(Dt);Je[0]^=ot,Je[1]^=pt,Je[2]^=mt,Je[3]^=It,Je[4]^=St,Je[5]^=Mt,Je[6]^=bt,Je[7]^=At}for(var Ut=[],Gt=0,xt=Je.length;Gt<xt;Gt++){var Ft=Je[Gt];Ut.push((4278190080&Ft)>>>24,(16711680&Ft)>>>16,(65280&Ft)>>>8,255&Ft)}return Ut}for(var re=new Uint8Array(64),ae=new Uint8Array(64),le=0;le<64;le++)re[le]=54,ae[le]=92;J.exports={sm3,hmac:function hmac(J,Z){for(Z.length>64&&(Z=sm3(Z));Z.length<64;)Z.push(0);var ee=xor(Z,re),ne=xor(Z,ae),se=sm3([].concat(ee,J));return sm3([].concat(ne,se))}}},function(J,Z,ee){"use strict";J.exports={sm2:ee(3),sm3:ee(7),sm4:ee(8)}},function(J,Z,ee){"use strict";var ne=ee(0).BigInteger,se=ee(4),re=se.encodeDer,ae=se.decodeDer,le=ee(5),pe=ee(1).sm3,_e=le.generateEcparam(),ve=_e.G,ye=_e.curve,Fe=_e.n;function getHash(J,Z){var ee=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"1234567812345678";ee=le.utf8ToHex(ee);var ne=le.leftPad(ve.curve.a.toBigInteger().toRadix(16),64),se=le.leftPad(ve.curve.b.toBigInteger().toRadix(16),64),re=le.leftPad(ve.getX().toBigInteger().toRadix(16),64),ae=le.leftPad(ve.getY().toBigInteger().toRadix(16),64),_e=void 0,ye=void 0;if(128===Z.length)_e=Z.substr(0,64),ye=Z.substr(64,64);else{var Fe=ve.curve.decodePointHex(Z);_e=le.leftPad(Fe.getX().toBigInteger().toRadix(16),64),ye=le.leftPad(Fe.getY().toBigInteger().toRadix(16),64)}var qe=le.hexToArray(ee+ne+se+re+ae+_e+ye),$e=4*ee.length;qe.unshift(255&$e),qe.unshift($e>>8&255);var He=pe(qe);return le.arrayToHex(pe(He.concat(le.hexToArray(J))))}function getPublicKeyFromPrivateKey(J){var Z=ve.multiply(new ne(J,16));return"04"+le.leftPad(Z.getX().toBigInteger().toString(16),64)+le.leftPad(Z.getY().toBigInteger().toString(16),64)}function getPoint(){var J=le.generateKeyPairHex(),Z=ye.decodePointHex(J.publicKey);return J.k=new ne(J.privateKey,16),J.x1=Z.getX().toBigInteger(),J}J.exports={generateKeyPairHex:le.generateKeyPairHex,compressPublicKeyHex:le.compressPublicKeyHex,comparePublicKeyHex:le.comparePublicKeyHex,doEncrypt:function doEncrypt(J,Z){var ee=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;J="string"==typeof J?le.hexToArray(le.utf8ToHex(J)):Array.prototype.slice.call(J),Z=le.getGlobalCurve().decodePointHex(Z);var se=le.generateKeyPairHex(),re=new ne(se.privateKey,16),ae=se.publicKey;ae.length>128&&(ae=ae.substr(ae.length-128));var _e=Z.multiply(re),ve=le.hexToArray(le.leftPad(_e.getX().toBigInteger().toRadix(16),64)),ye=le.hexToArray(le.leftPad(_e.getY().toBigInteger().toRadix(16),64)),Fe=le.arrayToHex(pe([].concat(ve,J,ye))),qe=1,$e=0,He=[],Ye=[].concat(ve,ye),Je=function nextT(){He=pe([].concat(Ye,[qe>>24&255,qe>>16&255,qe>>8&255,255&qe])),qe++,$e=0};Je();for(var Xe=0,Qe=J.length;Xe<Qe;Xe++)$e===He.length&&Je(),J[Xe]^=255&He[$e++];var tt=le.arrayToHex(J);return 0===ee?ae+tt+Fe:ae+Fe+tt},doDecrypt:function doDecrypt(J,Z){var ee=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,se=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).output,re=void 0===se?"string":se;Z=new ne(Z,16);var ae=J.substr(128,64),_e=J.substr(192);0===ee&&(ae=J.substr(J.length-64),_e=J.substr(128,J.length-128-64));var ve=le.hexToArray(_e),ye=le.getGlobalCurve().decodePointHex("04"+J.substr(0,128)).multiply(Z),Fe=le.hexToArray(le.leftPad(ye.getX().toBigInteger().toRadix(16),64)),qe=le.hexToArray(le.leftPad(ye.getY().toBigInteger().toRadix(16),64)),$e=1,He=0,Ye=[],Je=[].concat(Fe,qe),Xe=function nextT(){Ye=pe([].concat(Je,[$e>>24&255,$e>>16&255,$e>>8&255,255&$e])),$e++,He=0};Xe();for(var Qe=0,tt=ve.length;Qe<tt;Qe++)He===Ye.length&&Xe(),ve[Qe]^=255&Ye[He++];return le.arrayToHex(pe([].concat(Fe,ve,qe)))===ae.toLowerCase()?"array"===re?ve:le.arrayToUtf8(ve):"array"===re?[]:""},doSignature:function doSignature(J,Z){var ee=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},se=ee.pointPool,ae=ee.der,pe=ee.hash,_e=ee.publicKey,ve=ee.userId,ye="string"==typeof J?le.utf8ToHex(J):le.arrayToHex(J);pe&&(ye=getHash(ye,_e=_e||getPublicKeyFromPrivateKey(Z),ve));var qe=new ne(Z,16),$e=new ne(ye,16),He=null,Ye=null,Je=null;do{do{var Xe=void 0;He=(Xe=se&&se.length?se.pop():getPoint()).k,Ye=$e.add(Xe.x1).mod(Fe)}while(Ye.equals(ne.ZERO)||Ye.add(He).equals(Fe));Je=qe.add(ne.ONE).modInverse(Fe).multiply(He.subtract(Ye.multiply(qe))).mod(Fe)}while(Je.equals(ne.ZERO));return ae?re(Ye,Je):le.leftPad(Ye.toString(16),64)+le.leftPad(Je.toString(16),64)},doVerifySignature:function doVerifySignature(J,Z,ee){var se=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},re=se.der,pe=se.hash,_e=se.userId,qe="string"==typeof J?le.utf8ToHex(J):le.arrayToHex(J);pe&&(qe=getHash(qe,ee,_e));var $e=void 0,He=void 0;if(re){var Ye=ae(Z);$e=Ye.r,He=Ye.s}else $e=new ne(Z.substring(0,64),16),He=new ne(Z.substring(64),16);var Je=ye.decodePointHex(ee),Xe=new ne(qe,16),Qe=$e.add(He).mod(Fe);if(Qe.equals(ne.ZERO))return!1;var tt=ve.multiply(He).add(Je.multiply(Qe)),nt=Xe.add(tt.getX().toBigInteger()).mod(Fe);return $e.equals(nt)},getPublicKeyFromPrivateKey,getPoint,verifyPublicKey:le.verifyPublicKey}},function(J,Z,ee){"use strict";function _possibleConstructorReturn(J,Z){if(!J)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!Z||"object"!=typeof Z&&"function"!=typeof Z?J:Z}function _inherits(J,Z){if("function"!=typeof Z&&null!==Z)throw new TypeError("Super expression must either be null or a function, not "+typeof Z);J.prototype=Object.create(Z&&Z.prototype,{constructor:{value:J,enumerable:!1,writable:!0,configurable:!0}}),Z&&(Object.setPrototypeOf?Object.setPrototypeOf(J,Z):J.__proto__=Z)}function _classCallCheck(J,Z){if(!(J instanceof Z))throw new TypeError("Cannot call a class as a function")}var ne=ee(0).BigInteger;var se=function(){function ASN1Object(){_classCallCheck(this,ASN1Object),this.tlv=null,this.t="00",this.l="00",this.v=""}return ASN1Object.prototype.getEncodedHex=function getEncodedHex(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv},ASN1Object.prototype.getLength=function getLength(){var J=this.v.length/2,Z=J.toString(16);return Z.length%2==1&&(Z="0"+Z),J<128?Z:(128+Z.length/2).toString(16)+Z},ASN1Object.prototype.getValue=function getValue(){return""},ASN1Object}(),re=function(J){function DERInteger(Z){_classCallCheck(this,DERInteger);var ee=_possibleConstructorReturn(this,J.call(this));return ee.t="02",Z&&(ee.v=function bigintToValue(J){var Z=J.toString(16);if("-"!==Z[0])Z.length%2==1?Z="0"+Z:Z.match(/^[0-7]/)||(Z="00"+Z);else{var ee=(Z=Z.substr(1)).length;ee%2==1?ee+=1:Z.match(/^[0-7]/)||(ee+=2);for(var se="",re=0;re<ee;re++)se+="f";Z=(Z=(se=new ne(se,16)).xor(J).add(ne.ONE)).toString(16).replace(/^-/,"")}return Z}(Z)),ee}return _inherits(DERInteger,J),DERInteger.prototype.getValue=function getValue(){return this.v},DERInteger}(se),ae=function(J){function DERSequence(Z){_classCallCheck(this,DERSequence);var ee=_possibleConstructorReturn(this,J.call(this));return ee.t="30",ee.asn1Array=Z,ee}return _inherits(DERSequence,J),DERSequence.prototype.getValue=function getValue(){return this.v=this.asn1Array.map((function(J){return J.getEncodedHex()})).join(""),this.v},DERSequence}(se);function getLenOfL(J,Z){return+J[Z+2]<8?1:128&+J.substr(Z+2,2)}function getL(J,Z){var ee=getLenOfL(J,Z),se=J.substr(Z+2,2*ee);return se?(+se[0]<8?new ne(se,16):new ne(se.substr(2),16)).intValue():-1}function getStartOfV(J,Z){return Z+2*(getLenOfL(J,Z)+1)}J.exports={encodeDer:function encodeDer(J,Z){var ee=new re(J),ne=new re(Z);return new ae([ee,ne]).getEncodedHex()},decodeDer:function decodeDer(J){var Z=getStartOfV(J,0),ee=getStartOfV(J,Z),se=getL(J,Z),re=J.substr(ee,2*se),ae=ee+re.length,le=getStartOfV(J,ae),pe=getL(J,ae),_e=J.substr(le,2*pe);return{r:new ne(re,16),s:new ne(_e,16)}}}},function(J,Z,ee){"use strict";var ne=ee(0),se=ne.BigInteger,re=ne.SecureRandom,ae=ee(6).ECCurveFp,le=new re,pe=generateEcparam(),_e=pe.curve,ve=pe.G,ye=pe.n;function generateEcparam(){var J=new se("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),Z=new se("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),ee=new se("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),ne=new ae(J,Z,ee),re=ne.decodePointHex("0432C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0");return{curve:ne,G:re,n:new se("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16)}}function leftPad(J,Z){return J.length>=Z?J:new Array(Z-J.length+1).join("0")+J}J.exports={getGlobalCurve:function getGlobalCurve(){return _e},generateEcparam,generateKeyPairHex:function generateKeyPairHex(J,Z,ee){var ne=(J?new se(J,Z,ee):new se(ye.bitLength(),le)).mod(ye.subtract(se.ONE)).add(se.ONE),re=leftPad(ne.toString(16),64),ae=ve.multiply(ne);return{privateKey:re,publicKey:"04"+leftPad(ae.getX().toBigInteger().toString(16),64)+leftPad(ae.getY().toBigInteger().toString(16),64)}},compressPublicKeyHex:function compressPublicKeyHex(J){if(130!==J.length)throw new Error("Invalid public key to compress");var Z=(J.length-2)/2,ee=J.substr(2,Z),ne="03";return new se(J.substr(Z+2,Z),16).mod(new se("2")).equals(se.ZERO)&&(ne="02"),ne+ee},utf8ToHex:function utf8ToHex(J){for(var Z=(J=unescape(encodeURIComponent(J))).length,ee=[],ne=0;ne<Z;ne++)ee[ne>>>2]|=(255&J.charCodeAt(ne))<<24-ne%4*8;for(var se=[],re=0;re<Z;re++){var ae=ee[re>>>2]>>>24-re%4*8&255;se.push((ae>>>4).toString(16)),se.push((15&ae).toString(16))}return se.join("")},leftPad,arrayToHex:function arrayToHex(J){return J.map((function(J){return 1===(J=J.toString(16)).length?"0"+J:J})).join("")},arrayToUtf8:function arrayToUtf8(J){for(var Z=[],ee=0,ne=0;ne<2*J.length;ne+=2)Z[ne>>>3]|=parseInt(J[ee],10)<<24-ne%8*4,ee++;try{for(var se=[],re=0;re<J.length;re++){var ae=Z[re>>>2]>>>24-re%4*8&255;se.push(String.fromCharCode(ae))}return decodeURIComponent(escape(se.join("")))}catch(J){throw new Error("Malformed UTF-8 data")}},hexToArray:function hexToArray(J){var Z=[],ee=J.length;ee%2!=0&&(J=leftPad(J,ee+1)),ee=J.length;for(var ne=0;ne<ee;ne+=2)Z.push(parseInt(J.substr(ne,2),16));return Z},verifyPublicKey:function verifyPublicKey(J){var Z=_e.decodePointHex(J);if(!Z)return!1;var ee=Z.getX();return Z.getY().square().equals(ee.multiply(ee.square()).add(ee.multiply(_e.a)).add(_e.b))},comparePublicKeyHex:function comparePublicKeyHex(J,Z){var ee=_e.decodePointHex(J);if(!ee)return!1;var ne=_e.decodePointHex(Z);return!!ne&&ee.equals(ne)}}},function(J,Z,ee){"use strict";function _classCallCheck(J,Z){if(!(J instanceof Z))throw new TypeError("Cannot call a class as a function")}var ne=ee(0).BigInteger,se=new ne("2"),re=new ne("3"),ae=function(){function ECFieldElementFp(J,Z){_classCallCheck(this,ECFieldElementFp),this.x=Z,this.q=J}return ECFieldElementFp.prototype.equals=function equals(J){return J===this||this.q.equals(J.q)&&this.x.equals(J.x)},ECFieldElementFp.prototype.toBigInteger=function toBigInteger(){return this.x},ECFieldElementFp.prototype.negate=function negate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))},ECFieldElementFp.prototype.add=function add(J){return new ECFieldElementFp(this.q,this.x.add(J.toBigInteger()).mod(this.q))},ECFieldElementFp.prototype.subtract=function subtract(J){return new ECFieldElementFp(this.q,this.x.subtract(J.toBigInteger()).mod(this.q))},ECFieldElementFp.prototype.multiply=function multiply(J){return new ECFieldElementFp(this.q,this.x.multiply(J.toBigInteger()).mod(this.q))},ECFieldElementFp.prototype.divide=function divide(J){return new ECFieldElementFp(this.q,this.x.multiply(J.toBigInteger().modInverse(this.q)).mod(this.q))},ECFieldElementFp.prototype.square=function square(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))},ECFieldElementFp}(),le=function(){function ECPointFp(J,Z,ee,se){_classCallCheck(this,ECPointFp),this.curve=J,this.x=Z,this.y=ee,this.z=null==se?ne.ONE:se,this.zinv=null}return ECPointFp.prototype.getX=function getX(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ECPointFp.prototype.getY=function getY(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ECPointFp.prototype.equals=function equals(J){return J===this||(this.isInfinity()?J.isInfinity():J.isInfinity()?this.isInfinity():!!J.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(J.z)).mod(this.curve.q).equals(ne.ZERO)&&J.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(J.z)).mod(this.curve.q).equals(ne.ZERO))},ECPointFp.prototype.isInfinity=function isInfinity(){return null===this.x&&null===this.y||this.z.equals(ne.ZERO)&&!this.y.toBigInteger().equals(ne.ZERO)},ECPointFp.prototype.negate=function negate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)},ECPointFp.prototype.add=function add(J){if(this.isInfinity())return J;if(J.isInfinity())return this;var Z=this.x.toBigInteger(),ee=this.y.toBigInteger(),se=this.z,re=J.x.toBigInteger(),ae=J.y.toBigInteger(),le=J.z,pe=this.curve.q,_e=Z.multiply(le).mod(pe),ve=re.multiply(se).mod(pe),ye=_e.subtract(ve),Fe=ee.multiply(le).mod(pe),qe=ae.multiply(se).mod(pe),$e=Fe.subtract(qe);if(ne.ZERO.equals(ye))return ne.ZERO.equals($e)?this.twice():this.curve.infinity;var He=_e.add(ve),Ye=se.multiply(le).mod(pe),Je=ye.square().mod(pe),Xe=ye.multiply(Je).mod(pe),Qe=Ye.multiply($e.square()).subtract(He.multiply(Je)).mod(pe),tt=ye.multiply(Qe).mod(pe),nt=$e.multiply(Je.multiply(_e).subtract(Qe)).subtract(Fe.multiply(Xe)).mod(pe),it=Xe.multiply(Ye).mod(pe);return new ECPointFp(this.curve,this.curve.fromBigInteger(tt),this.curve.fromBigInteger(nt),it)},ECPointFp.prototype.twice=function twice(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;var J=this.x.toBigInteger(),Z=this.y.toBigInteger(),ee=this.z,ne=this.curve.q,se=this.curve.a.toBigInteger(),ae=J.square().multiply(re).add(se.multiply(ee.square())).mod(ne),le=Z.shiftLeft(1).multiply(ee).mod(ne),pe=Z.square().mod(ne),_e=pe.multiply(J).multiply(ee).mod(ne),ve=le.square().mod(ne),ye=ae.square().subtract(_e.shiftLeft(3)).mod(ne),Fe=le.multiply(ye).mod(ne),qe=ae.multiply(_e.shiftLeft(2).subtract(ye)).subtract(ve.shiftLeft(1).multiply(pe)).mod(ne),$e=le.multiply(ve).mod(ne);return new ECPointFp(this.curve,this.curve.fromBigInteger(Fe),this.curve.fromBigInteger(qe),$e)},ECPointFp.prototype.multiply=function multiply(J){if(this.isInfinity())return this;if(!J.signum())return this.curve.infinity;for(var Z=J.multiply(re),ee=this.negate(),ne=this,se=Z.bitLength()-2;se>0;se--){ne=ne.twice();var ae=Z.testBit(se);ae!==J.testBit(se)&&(ne=ne.add(ae?this:ee))}return ne},ECPointFp}(),pe=function(){function ECCurveFp(J,Z,ee){_classCallCheck(this,ECCurveFp),this.q=J,this.a=this.fromBigInteger(Z),this.b=this.fromBigInteger(ee),this.infinity=new le(this,null,null)}return ECCurveFp.prototype.equals=function equals(J){return J===this||this.q.equals(J.q)&&this.a.equals(J.a)&&this.b.equals(J.b)},ECCurveFp.prototype.fromBigInteger=function fromBigInteger(J){return new ae(this.q,J)},ECCurveFp.prototype.decodePointHex=function decodePointHex(J){switch(parseInt(J.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var Z=this.fromBigInteger(new ne(J.substr(2),16)),ee=this.fromBigInteger(Z.multiply(Z.square()).add(Z.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new ne("4")).add(ne.ONE),this.q));return ee.toBigInteger().mod(se).equals(new ne(J.substr(0,2),16).subtract(se))||(ee=ee.negate()),new le(this,Z,ee);case 4:case 6:case 7:var re=(J.length-2)/2,ae=J.substr(2,re),pe=J.substr(re+2,re);return new le(this,this.fromBigInteger(new ne(ae,16)),this.fromBigInteger(new ne(pe,16)));default:return null}},ECCurveFp}();J.exports={ECPointFp:le,ECCurveFp:pe}},function(J,Z,ee){"use strict";var ne=ee(1),se=ne.sm3,re=ne.hmac;function ArrayToHex(J){return J.map((function(J){return 1===(J=J.toString(16)).length?"0"+J:J})).join("")}function hexToArray(J){var Z=[],ee=J.length;ee%2!=0&&(J=function leftPad(J,Z){return J.length>=Z?J:new Array(Z-J.length+1).join("0")+J}(J,ee+1)),ee=J.length;for(var ne=0;ne<ee;ne+=2)Z.push(parseInt(J.substr(ne,2),16));return Z}J.exports=function(J,Z){if(J="string"==typeof J?function utf8ToArray(J){for(var Z=[],ee=0,ne=J.length;ee<ne;ee++){var se=J.codePointAt(ee);if(se<=127)Z.push(se);else if(se<=2047)Z.push(192|se>>>6),Z.push(128|63&se);else if(se<=55295||se>=57344&&se<=65535)Z.push(224|se>>>12),Z.push(128|se>>>6&63),Z.push(128|63&se);else{if(!(se>=65536&&se<=1114111))throw Z.push(se),new Error("input is not supported");ee++,Z.push(240|se>>>18&28),Z.push(128|se>>>12&63),Z.push(128|se>>>6&63),Z.push(128|63&se)}}return Z}(J):Array.prototype.slice.call(J),Z){if("hmac"!==(Z.mode||"hmac"))throw new Error("invalid mode");var ee=Z.key;if(!ee)throw new Error("invalid key");return ee="string"==typeof ee?hexToArray(ee):Array.prototype.slice.call(ee),ArrayToHex(re(J,ee))}return ArrayToHex(se(J))}},function(J,Z,ee){"use strict";var ne=16,se=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],re=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function hexToArray(J){for(var Z=[],ee=0,ne=J.length;ee<ne;ee+=2)Z.push(parseInt(J.substr(ee,2),16));return Z}function rotl(J,Z){var ee=31&Z;return J<<ee|J>>>32-ee}function byteSub(J){return(255&se[J>>>24&255])<<24|(255&se[J>>>16&255])<<16|(255&se[J>>>8&255])<<8|255&se[255&J]}function l1(J){return J^rotl(J,2)^rotl(J,10)^rotl(J,18)^rotl(J,24)}function l2(J){return J^rotl(J,13)^rotl(J,23)}function sms4Crypt(J,Z,ee){for(var ne=new Array(4),se=new Array(4),re=0;re<4;re++)se[0]=255&J[4*re],se[1]=255&J[4*re+1],se[2]=255&J[4*re+2],se[3]=255&J[4*re+3],ne[re]=se[0]<<24|se[1]<<16|se[2]<<8|se[3];for(var ae,le=0;le<32;le+=4)ae=ne[1]^ne[2]^ne[3]^ee[le+0],ne[0]^=l1(byteSub(ae)),ae=ne[2]^ne[3]^ne[0]^ee[le+1],ne[1]^=l1(byteSub(ae)),ae=ne[3]^ne[0]^ne[1]^ee[le+2],ne[2]^=l1(byteSub(ae)),ae=ne[0]^ne[1]^ne[2]^ee[le+3],ne[3]^=l1(byteSub(ae));for(var pe=0;pe<16;pe+=4)Z[pe]=ne[3-pe/4]>>>24&255,Z[pe+1]=ne[3-pe/4]>>>16&255,Z[pe+2]=ne[3-pe/4]>>>8&255,Z[pe+3]=255&ne[3-pe/4]}function sm4(J,Z,ee){var se=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},ae=se.padding,le=void 0===ae?"pkcs#7":ae,pe=se.mode,_e=se.iv,ve=void 0===_e?[]:_e,ye=se.output,Fe=void 0===ye?"string":ye;if("cbc"===pe&&("string"==typeof ve&&(ve=hexToArray(ve)),16!==ve.length))throw new Error("iv is invalid");if("string"==typeof Z&&(Z=hexToArray(Z)),16!==Z.length)throw new Error("key is invalid");if(J="string"==typeof J?0!==ee?function utf8ToArray(J){for(var Z=[],ee=0,ne=J.length;ee<ne;ee++){var se=J.codePointAt(ee);if(se<=127)Z.push(se);else if(se<=2047)Z.push(192|se>>>6),Z.push(128|63&se);else if(se<=55295||se>=57344&&se<=65535)Z.push(224|se>>>12),Z.push(128|se>>>6&63),Z.push(128|63&se);else{if(!(se>=65536&&se<=1114111))throw Z.push(se),new Error("input is not supported");ee++,Z.push(240|se>>>18&28),Z.push(128|se>>>12&63),Z.push(128|se>>>6&63),Z.push(128|63&se)}}return Z}(J):hexToArray(J):[].concat(J),("pkcs#5"===le||"pkcs#7"===le)&&0!==ee)for(var qe=ne-J.length%ne,$e=0;$e<qe;$e++)J.push(qe);var He=new Array(32);!function sms4KeyExt(J,Z,ee){for(var ne=new Array(4),se=new Array(4),ae=0;ae<4;ae++)se[0]=255&J[0+4*ae],se[1]=255&J[1+4*ae],se[2]=255&J[2+4*ae],se[3]=255&J[3+4*ae],ne[ae]=se[0]<<24|se[1]<<16|se[2]<<8|se[3];ne[0]^=2746333894,ne[1]^=1453994832,ne[2]^=1736282519,ne[3]^=2993693404;for(var le,pe=0;pe<32;pe+=4)le=ne[1]^ne[2]^ne[3]^re[pe+0],Z[pe+0]=ne[0]^=l2(byteSub(le)),le=ne[2]^ne[3]^ne[0]^re[pe+1],Z[pe+1]=ne[1]^=l2(byteSub(le)),le=ne[3]^ne[0]^ne[1]^re[pe+2],Z[pe+2]=ne[2]^=l2(byteSub(le)),le=ne[0]^ne[1]^ne[2]^re[pe+3],Z[pe+3]=ne[3]^=l2(byteSub(le));if(0===ee)for(var _e,ve=0;ve<16;ve++)_e=Z[ve],Z[ve]=Z[31-ve],Z[31-ve]=_e}(Z,He,ee);for(var Ye=[],Je=ve,Xe=J.length,Qe=0;Xe>=ne;){var tt=J.slice(Qe,Qe+16),nt=new Array(16);if("cbc"===pe)for(var it=0;it<ne;it++)0!==ee&&(tt[it]^=Je[it]);sms4Crypt(tt,nt,He);for(var ot=0;ot<ne;ot++)"cbc"===pe&&0===ee&&(nt[ot]^=Je[ot]),Ye[Qe+ot]=nt[ot];"cbc"===pe&&(Je=0!==ee?nt:tt),Xe-=ne,Qe+=ne}if(("pkcs#5"===le||"pkcs#7"===le)&&0===ee){for(var pt=Ye.length,mt=Ye[pt-1],It=1;It<=mt;It++)if(Ye[pt-It]!==mt)throw new Error("padding is invalid");Ye.splice(pt-mt,mt)}return"array"!==Fe?0!==ee?function ArrayToHex(J){return J.map((function(J){return 1===(J=J.toString(16)).length?"0"+J:J})).join("")}(Ye):function arrayToUtf8(J){for(var Z=[],ee=0,ne=J.length;ee<ne;ee++)J[ee]>=240&&J[ee]<=247?(Z.push(String.fromCodePoint(((7&J[ee])<<18)+((63&J[ee+1])<<12)+((63&J[ee+2])<<6)+(63&J[ee+3]))),ee+=3):J[ee]>=224&&J[ee]<=239?(Z.push(String.fromCodePoint(((15&J[ee])<<12)+((63&J[ee+1])<<6)+(63&J[ee+2]))),ee+=2):J[ee]>=192&&J[ee]<=223?(Z.push(String.fromCodePoint(((31&J[ee])<<6)+(63&J[ee+1]))),ee++):Z.push(String.fromCodePoint(J[ee]));return Z.join("")}(Ye):Ye}J.exports={encrypt:function encrypt(J,Z,ee){return sm4(J,Z,1,ee)},decrypt:function decrypt(J,Z,ee){return sm4(J,Z,0,ee)}}}])},814:function(J,Z){(function(){var Z;function BigInteger(J,Z,ee){null!=J&&("number"==typeof J?this.fromNumber(J,Z,ee):null==Z&&"string"!=typeof J?this.fromString(J,256):this.fromString(J,Z))}function nbi(){return new BigInteger(null)}var ee="undefined"!=typeof navigator;ee&&"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=function am2(J,Z,ee,ne,se,re){for(var ae=32767&Z,le=Z>>15;--re>=0;){var pe=32767&this[J],_e=this[J++]>>15,ve=le*pe+_e*ae;se=((pe=ae*pe+((32767&ve)<<15)+ee[ne]+(1073741823&se))>>>30)+(ve>>>15)+le*_e+(se>>>30),ee[ne++]=1073741823&pe}return se},Z=30):ee&&"Netscape"!=navigator.appName?(BigInteger.prototype.am=function am1(J,Z,ee,ne,se,re){for(;--re>=0;){var ae=Z*this[J++]+ee[ne]+se;se=Math.floor(ae/67108864),ee[ne++]=67108863&ae}return se},Z=26):(BigInteger.prototype.am=function am3(J,Z,ee,ne,se,re){for(var ae=16383&Z,le=Z>>14;--re>=0;){var pe=16383&this[J],_e=this[J++]>>14,ve=le*pe+_e*ae;se=((pe=ae*pe+((16383&ve)<<14)+ee[ne]+se)>>28)+(ve>>14)+le*_e,ee[ne++]=268435455&pe}return se},Z=28),BigInteger.prototype.DB=Z,BigInteger.prototype.DM=(1<<Z)-1,BigInteger.prototype.DV=1<<Z;BigInteger.prototype.FV=Math.pow(2,52),BigInteger.prototype.F1=52-Z,BigInteger.prototype.F2=2*Z-52;var ne,se,re=new Array;for(ne="0".charCodeAt(0),se=0;se<=9;++se)re[ne++]=se;for(ne="a".charCodeAt(0),se=10;se<36;++se)re[ne++]=se;for(ne="A".charCodeAt(0),se=10;se<36;++se)re[ne++]=se;function int2char(J){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(J)}function intAt(J,Z){var ee=re[J.charCodeAt(Z)];return null==ee?-1:ee}function nbv(J){var Z=nbi();return Z.fromInt(J),Z}function nbits(J){var Z,ee=1;return 0!=(Z=J>>>16)&&(J=Z,ee+=16),0!=(Z=J>>8)&&(J=Z,ee+=8),0!=(Z=J>>4)&&(J=Z,ee+=4),0!=(Z=J>>2)&&(J=Z,ee+=2),0!=(Z=J>>1)&&(J=Z,ee+=1),ee}function Classic(J){this.m=J}function Montgomery(J){this.m=J,this.mp=J.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<J.DB-15)-1,this.mt2=2*J.t}function op_and(J,Z){return J&Z}function op_or(J,Z){return J|Z}function op_xor(J,Z){return J^Z}function op_andnot(J,Z){return J&~Z}function lbit(J){if(0==J)return-1;var Z=0;return 65535&J||(J>>=16,Z+=16),255&J||(J>>=8,Z+=8),15&J||(J>>=4,Z+=4),3&J||(J>>=2,Z+=2),1&J||++Z,Z}function cbit(J){for(var Z=0;0!=J;)J&=J-1,++Z;return Z}function NullExp(){}function nNop(J){return J}function Barrett(J){this.r2=nbi(),this.q3=nbi(),BigInteger.ONE.dlShiftTo(2*J.t,this.r2),this.mu=this.r2.divide(J),this.m=J}Classic.prototype.convert=function cConvert(J){return J.s<0||J.compareTo(this.m)>=0?J.mod(this.m):J},Classic.prototype.revert=function cRevert(J){return J},Classic.prototype.reduce=function cReduce(J){J.divRemTo(this.m,null,J)},Classic.prototype.mulTo=function cMulTo(J,Z,ee){J.multiplyTo(Z,ee),this.reduce(ee)},Classic.prototype.sqrTo=function cSqrTo(J,Z){J.squareTo(Z),this.reduce(Z)},Montgomery.prototype.convert=function montConvert(J){var Z=nbi();return J.abs().dlShiftTo(this.m.t,Z),Z.divRemTo(this.m,null,Z),J.s<0&&Z.compareTo(BigInteger.ZERO)>0&&this.m.subTo(Z,Z),Z},Montgomery.prototype.revert=function montRevert(J){var Z=nbi();return J.copyTo(Z),this.reduce(Z),Z},Montgomery.prototype.reduce=function montReduce(J){for(;J.t<=this.mt2;)J[J.t++]=0;for(var Z=0;Z<this.m.t;++Z){var ee=32767&J[Z],ne=ee*this.mpl+((ee*this.mph+(J[Z]>>15)*this.mpl&this.um)<<15)&J.DM;for(J[ee=Z+this.m.t]+=this.m.am(0,ne,J,Z,0,this.m.t);J[ee]>=J.DV;)J[ee]-=J.DV,J[++ee]++}J.clamp(),J.drShiftTo(this.m.t,J),J.compareTo(this.m)>=0&&J.subTo(this.m,J)},Montgomery.prototype.mulTo=function montMulTo(J,Z,ee){J.multiplyTo(Z,ee),this.reduce(ee)},Montgomery.prototype.sqrTo=function montSqrTo(J,Z){J.squareTo(Z),this.reduce(Z)},BigInteger.prototype.copyTo=function bnpCopyTo(J){for(var Z=this.t-1;Z>=0;--Z)J[Z]=this[Z];J.t=this.t,J.s=this.s},BigInteger.prototype.fromInt=function bnpFromInt(J){this.t=1,this.s=J<0?-1:0,J>0?this[0]=J:J<-1?this[0]=J+this.DV:this.t=0},BigInteger.prototype.fromString=function bnpFromString(J,Z){var ee;if(16==Z)ee=4;else if(8==Z)ee=3;else if(256==Z)ee=8;else if(2==Z)ee=1;else if(32==Z)ee=5;else{if(4!=Z)return void this.fromRadix(J,Z);ee=2}this.t=0,this.s=0;for(var ne=J.length,se=!1,re=0;--ne>=0;){var ae=8==ee?255&J[ne]:intAt(J,ne);ae<0?"-"==J.charAt(ne)&&(se=!0):(se=!1,0==re?this[this.t++]=ae:re+ee>this.DB?(this[this.t-1]|=(ae&(1<<this.DB-re)-1)<<re,this[this.t++]=ae>>this.DB-re):this[this.t-1]|=ae<<re,(re+=ee)>=this.DB&&(re-=this.DB))}8==ee&&128&J[0]&&(this.s=-1,re>0&&(this[this.t-1]|=(1<<this.DB-re)-1<<re)),this.clamp(),se&&BigInteger.ZERO.subTo(this,this)},BigInteger.prototype.clamp=function bnpClamp(){for(var J=this.s&this.DM;this.t>0&&this[this.t-1]==J;)--this.t},BigInteger.prototype.dlShiftTo=function bnpDLShiftTo(J,Z){var ee;for(ee=this.t-1;ee>=0;--ee)Z[ee+J]=this[ee];for(ee=J-1;ee>=0;--ee)Z[ee]=0;Z.t=this.t+J,Z.s=this.s},BigInteger.prototype.drShiftTo=function bnpDRShiftTo(J,Z){for(var ee=J;ee<this.t;++ee)Z[ee-J]=this[ee];Z.t=Math.max(this.t-J,0),Z.s=this.s},BigInteger.prototype.lShiftTo=function bnpLShiftTo(J,Z){var ee,ne=J%this.DB,se=this.DB-ne,re=(1<<se)-1,ae=Math.floor(J/this.DB),le=this.s<<ne&this.DM;for(ee=this.t-1;ee>=0;--ee)Z[ee+ae+1]=this[ee]>>se|le,le=(this[ee]&re)<<ne;for(ee=ae-1;ee>=0;--ee)Z[ee]=0;Z[ae]=le,Z.t=this.t+ae+1,Z.s=this.s,Z.clamp()},BigInteger.prototype.rShiftTo=function bnpRShiftTo(J,Z){Z.s=this.s;var ee=Math.floor(J/this.DB);if(ee>=this.t)Z.t=0;else{var ne=J%this.DB,se=this.DB-ne,re=(1<<ne)-1;Z[0]=this[ee]>>ne;for(var ae=ee+1;ae<this.t;++ae)Z[ae-ee-1]|=(this[ae]&re)<<se,Z[ae-ee]=this[ae]>>ne;ne>0&&(Z[this.t-ee-1]|=(this.s&re)<<se),Z.t=this.t-ee,Z.clamp()}},BigInteger.prototype.subTo=function bnpSubTo(J,Z){for(var ee=0,ne=0,se=Math.min(J.t,this.t);ee<se;)ne+=this[ee]-J[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;if(J.t<this.t){for(ne-=J.s;ee<this.t;)ne+=this[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;ne+=this.s}else{for(ne+=this.s;ee<J.t;)ne-=J[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;ne-=J.s}Z.s=ne<0?-1:0,ne<-1?Z[ee++]=this.DV+ne:ne>0&&(Z[ee++]=ne),Z.t=ee,Z.clamp()},BigInteger.prototype.multiplyTo=function bnpMultiplyTo(J,Z){var ee=this.abs(),ne=J.abs(),se=ee.t;for(Z.t=se+ne.t;--se>=0;)Z[se]=0;for(se=0;se<ne.t;++se)Z[se+ee.t]=ee.am(0,ne[se],Z,se,0,ee.t);Z.s=0,Z.clamp(),this.s!=J.s&&BigInteger.ZERO.subTo(Z,Z)},BigInteger.prototype.squareTo=function bnpSquareTo(J){for(var Z=this.abs(),ee=J.t=2*Z.t;--ee>=0;)J[ee]=0;for(ee=0;ee<Z.t-1;++ee){var ne=Z.am(ee,Z[ee],J,2*ee,0,1);(J[ee+Z.t]+=Z.am(ee+1,2*Z[ee],J,2*ee+1,ne,Z.t-ee-1))>=Z.DV&&(J[ee+Z.t]-=Z.DV,J[ee+Z.t+1]=1)}J.t>0&&(J[J.t-1]+=Z.am(ee,Z[ee],J,2*ee,0,1)),J.s=0,J.clamp()},BigInteger.prototype.divRemTo=function bnpDivRemTo(J,Z,ee){var ne=J.abs();if(!(ne.t<=0)){var se=this.abs();if(se.t<ne.t)return null!=Z&&Z.fromInt(0),void(null!=ee&&this.copyTo(ee));null==ee&&(ee=nbi());var re=nbi(),ae=this.s,le=J.s,pe=this.DB-nbits(ne[ne.t-1]);pe>0?(ne.lShiftTo(pe,re),se.lShiftTo(pe,ee)):(ne.copyTo(re),se.copyTo(ee));var _e=re.t,ve=re[_e-1];if(0!=ve){var ye=ve*(1<<this.F1)+(_e>1?re[_e-2]>>this.F2:0),Fe=this.FV/ye,qe=(1<<this.F1)/ye,$e=1<<this.F2,He=ee.t,Ye=He-_e,Je=null==Z?nbi():Z;for(re.dlShiftTo(Ye,Je),ee.compareTo(Je)>=0&&(ee[ee.t++]=1,ee.subTo(Je,ee)),BigInteger.ONE.dlShiftTo(_e,Je),Je.subTo(re,re);re.t<_e;)re[re.t++]=0;for(;--Ye>=0;){var Xe=ee[--He]==ve?this.DM:Math.floor(ee[He]*Fe+(ee[He-1]+$e)*qe);if((ee[He]+=re.am(0,Xe,ee,Ye,0,_e))<Xe)for(re.dlShiftTo(Ye,Je),ee.subTo(Je,ee);ee[He]<--Xe;)ee.subTo(Je,ee)}null!=Z&&(ee.drShiftTo(_e,Z),ae!=le&&BigInteger.ZERO.subTo(Z,Z)),ee.t=_e,ee.clamp(),pe>0&&ee.rShiftTo(pe,ee),ae<0&&BigInteger.ZERO.subTo(ee,ee)}}},BigInteger.prototype.invDigit=function bnpInvDigit(){if(this.t<1)return 0;var J=this[0];if(!(1&J))return 0;var Z=3&J;return(Z=(Z=(Z=(Z=Z*(2-(15&J)*Z)&15)*(2-(255&J)*Z)&255)*(2-((65535&J)*Z&65535))&65535)*(2-J*Z%this.DV)%this.DV)>0?this.DV-Z:-Z},BigInteger.prototype.isEven=function bnpIsEven(){return 0==(this.t>0?1&this[0]:this.s)},BigInteger.prototype.exp=function bnpExp(J,Z){if(J>4294967295||J<1)return BigInteger.ONE;var ee=nbi(),ne=nbi(),se=Z.convert(this),re=nbits(J)-1;for(se.copyTo(ee);--re>=0;)if(Z.sqrTo(ee,ne),(J&1<<re)>0)Z.mulTo(ne,se,ee);else{var ae=ee;ee=ne,ne=ae}return Z.revert(ee)},BigInteger.prototype.toString=function bnToString(J){if(this.s<0)return"-"+this.negate().toString(J);var Z;if(16==J)Z=4;else if(8==J)Z=3;else if(2==J)Z=1;else if(32==J)Z=5;else{if(4!=J)return this.toRadix(J);Z=2}var ee,ne=(1<<Z)-1,se=!1,re="",ae=this.t,le=this.DB-ae*this.DB%Z;if(ae-- >0)for(le<this.DB&&(ee=this[ae]>>le)>0&&(se=!0,re=int2char(ee));ae>=0;)le<Z?(ee=(this[ae]&(1<<le)-1)<<Z-le,ee|=this[--ae]>>(le+=this.DB-Z)):(ee=this[ae]>>(le-=Z)&ne,le<=0&&(le+=this.DB,--ae)),ee>0&&(se=!0),se&&(re+=int2char(ee));return se?re:"0"},BigInteger.prototype.negate=function bnNegate(){var J=nbi();return BigInteger.ZERO.subTo(this,J),J},BigInteger.prototype.abs=function bnAbs(){return this.s<0?this.negate():this},BigInteger.prototype.compareTo=function bnCompareTo(J){var Z=this.s-J.s;if(0!=Z)return Z;var ee=this.t;if(0!=(Z=ee-J.t))return this.s<0?-Z:Z;for(;--ee>=0;)if(0!=(Z=this[ee]-J[ee]))return Z;return 0},BigInteger.prototype.bitLength=function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)},BigInteger.prototype.mod=function bnMod(J){var Z=nbi();return this.abs().divRemTo(J,null,Z),this.s<0&&Z.compareTo(BigInteger.ZERO)>0&&J.subTo(Z,Z),Z},BigInteger.prototype.modPowInt=function bnModPowInt(J,Z){var ee;return ee=J<256||Z.isEven()?new Classic(Z):new Montgomery(Z),this.exp(J,ee)},BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1),NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=function nMulTo(J,Z,ee){J.multiplyTo(Z,ee)},NullExp.prototype.sqrTo=function nSqrTo(J,Z){J.squareTo(Z)},Barrett.prototype.convert=function barrettConvert(J){if(J.s<0||J.t>2*this.m.t)return J.mod(this.m);if(J.compareTo(this.m)<0)return J;var Z=nbi();return J.copyTo(Z),this.reduce(Z),Z},Barrett.prototype.revert=function barrettRevert(J){return J},Barrett.prototype.reduce=function barrettReduce(J){for(J.drShiftTo(this.m.t-1,this.r2),J.t>this.m.t+1&&(J.t=this.m.t+1,J.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);J.compareTo(this.r2)<0;)J.dAddOffset(1,this.m.t+1);for(J.subTo(this.r2,J);J.compareTo(this.m)>=0;)J.subTo(this.m,J)},Barrett.prototype.mulTo=function barrettMulTo(J,Z,ee){J.multiplyTo(Z,ee),this.reduce(ee)},Barrett.prototype.sqrTo=function barrettSqrTo(J,Z){J.squareTo(Z),this.reduce(Z)};var ae,le,pe,_e=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ve=(1<<26)/_e[_e.length-1];function rng_seed_time(){!function rng_seed_int(J){le[pe++]^=255&J,le[pe++]^=J>>8&255,le[pe++]^=J>>16&255,le[pe++]^=J>>24&255,pe>=$e&&(pe-=$e)}((new Date).getTime())}if(BigInteger.prototype.chunkSize=function bnpChunkSize(J){return Math.floor(Math.LN2*this.DB/Math.log(J))},BigInteger.prototype.toRadix=function bnpToRadix(J){if(null==J&&(J=10),0==this.signum()||J<2||J>36)return"0";var Z=this.chunkSize(J),ee=Math.pow(J,Z),ne=nbv(ee),se=nbi(),re=nbi(),ae="";for(this.divRemTo(ne,se,re);se.signum()>0;)ae=(ee+re.intValue()).toString(J).substr(1)+ae,se.divRemTo(ne,se,re);return re.intValue().toString(J)+ae},BigInteger.prototype.fromRadix=function bnpFromRadix(J,Z){this.fromInt(0),null==Z&&(Z=10);for(var ee=this.chunkSize(Z),ne=Math.pow(Z,ee),se=!1,re=0,ae=0,le=0;le<J.length;++le){var pe=intAt(J,le);pe<0?"-"==J.charAt(le)&&0==this.signum()&&(se=!0):(ae=Z*ae+pe,++re>=ee&&(this.dMultiply(ne),this.dAddOffset(ae,0),re=0,ae=0))}re>0&&(this.dMultiply(Math.pow(Z,re)),this.dAddOffset(ae,0)),se&&BigInteger.ZERO.subTo(this,this)},BigInteger.prototype.fromNumber=function bnpFromNumber(J,Z,ee){if("number"==typeof Z)if(J<2)this.fromInt(1);else for(this.fromNumber(J,ee),this.testBit(J-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(J-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(Z);)this.dAddOffset(2,0),this.bitLength()>J&&this.subTo(BigInteger.ONE.shiftLeft(J-1),this);else{var ne=new Array,se=7&J;ne.length=1+(J>>3),Z.nextBytes(ne),se>0?ne[0]&=(1<<se)-1:ne[0]=0,this.fromString(ne,256)}},BigInteger.prototype.bitwiseTo=function bnpBitwiseTo(J,Z,ee){var ne,se,re=Math.min(J.t,this.t);for(ne=0;ne<re;++ne)ee[ne]=Z(this[ne],J[ne]);if(J.t<this.t){for(se=J.s&this.DM,ne=re;ne<this.t;++ne)ee[ne]=Z(this[ne],se);ee.t=this.t}else{for(se=this.s&this.DM,ne=re;ne<J.t;++ne)ee[ne]=Z(se,J[ne]);ee.t=J.t}ee.s=Z(this.s,J.s),ee.clamp()},BigInteger.prototype.changeBit=function bnpChangeBit(J,Z){var ee=BigInteger.ONE.shiftLeft(J);return this.bitwiseTo(ee,Z,ee),ee},BigInteger.prototype.addTo=function bnpAddTo(J,Z){for(var ee=0,ne=0,se=Math.min(J.t,this.t);ee<se;)ne+=this[ee]+J[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;if(J.t<this.t){for(ne+=J.s;ee<this.t;)ne+=this[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;ne+=this.s}else{for(ne+=this.s;ee<J.t;)ne+=J[ee],Z[ee++]=ne&this.DM,ne>>=this.DB;ne+=J.s}Z.s=ne<0?-1:0,ne>0?Z[ee++]=ne:ne<-1&&(Z[ee++]=this.DV+ne),Z.t=ee,Z.clamp()},BigInteger.prototype.dMultiply=function bnpDMultiply(J){this[this.t]=this.am(0,J-1,this,0,0,this.t),++this.t,this.clamp()},BigInteger.prototype.dAddOffset=function bnpDAddOffset(J,Z){if(0!=J){for(;this.t<=Z;)this[this.t++]=0;for(this[Z]+=J;this[Z]>=this.DV;)this[Z]-=this.DV,++Z>=this.t&&(this[this.t++]=0),++this[Z]}},BigInteger.prototype.multiplyLowerTo=function bnpMultiplyLowerTo(J,Z,ee){var ne,se=Math.min(this.t+J.t,Z);for(ee.s=0,ee.t=se;se>0;)ee[--se]=0;for(ne=ee.t-this.t;se<ne;++se)ee[se+this.t]=this.am(0,J[se],ee,se,0,this.t);for(ne=Math.min(J.t,Z);se<ne;++se)this.am(0,J[se],ee,se,0,Z-se);ee.clamp()},BigInteger.prototype.multiplyUpperTo=function bnpMultiplyUpperTo(J,Z,ee){--Z;var ne=ee.t=this.t+J.t-Z;for(ee.s=0;--ne>=0;)ee[ne]=0;for(ne=Math.max(Z-this.t,0);ne<J.t;++ne)ee[this.t+ne-Z]=this.am(Z-ne,J[ne],ee,0,0,this.t+ne-Z);ee.clamp(),ee.drShiftTo(1,ee)},BigInteger.prototype.modInt=function bnpModInt(J){if(J<=0)return 0;var Z=this.DV%J,ee=this.s<0?J-1:0;if(this.t>0)if(0==Z)ee=this[0]%J;else for(var ne=this.t-1;ne>=0;--ne)ee=(Z*ee+this[ne])%J;return ee},BigInteger.prototype.millerRabin=function bnpMillerRabin(J){var Z=this.subtract(BigInteger.ONE),ee=Z.getLowestSetBit();if(ee<=0)return!1;var ne=Z.shiftRight(ee);(J=J+1>>1)>_e.length&&(J=_e.length);for(var se=nbi(),re=0;re<J;++re){se.fromInt(_e[Math.floor(Math.random()*_e.length)]);var ae=se.modPow(ne,this);if(0!=ae.compareTo(BigInteger.ONE)&&0!=ae.compareTo(Z)){for(var le=1;le++<ee&&0!=ae.compareTo(Z);)if(0==(ae=ae.modPowInt(2,this)).compareTo(BigInteger.ONE))return!1;if(0!=ae.compareTo(Z))return!1}}return!0},BigInteger.prototype.clone=function bnClone(){var J=nbi();return this.copyTo(J),J},BigInteger.prototype.intValue=function bnIntValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},BigInteger.prototype.byteValue=function bnByteValue(){return 0==this.t?this.s:this[0]<<24>>24},BigInteger.prototype.shortValue=function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16},BigInteger.prototype.signum=function bnSigNum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},BigInteger.prototype.toByteArray=function bnToByteArray(){var J=this.t,Z=new Array;Z[0]=this.s;var ee,ne=this.DB-J*this.DB%8,se=0;if(J-- >0)for(ne<this.DB&&(ee=this[J]>>ne)!=(this.s&this.DM)>>ne&&(Z[se++]=ee|this.s<<this.DB-ne);J>=0;)ne<8?(ee=(this[J]&(1<<ne)-1)<<8-ne,ee|=this[--J]>>(ne+=this.DB-8)):(ee=this[J]>>(ne-=8)&255,ne<=0&&(ne+=this.DB,--J)),128&ee&&(ee|=-256),0==se&&(128&this.s)!=(128&ee)&&++se,(se>0||ee!=this.s)&&(Z[se++]=ee);return Z},BigInteger.prototype.equals=function bnEquals(J){return 0==this.compareTo(J)},BigInteger.prototype.min=function bnMin(J){return this.compareTo(J)<0?this:J},BigInteger.prototype.max=function bnMax(J){return this.compareTo(J)>0?this:J},BigInteger.prototype.and=function bnAnd(J){var Z=nbi();return this.bitwiseTo(J,op_and,Z),Z},BigInteger.prototype.or=function bnOr(J){var Z=nbi();return this.bitwiseTo(J,op_or,Z),Z},BigInteger.prototype.xor=function bnXor(J){var Z=nbi();return this.bitwiseTo(J,op_xor,Z),Z},BigInteger.prototype.andNot=function bnAndNot(J){var Z=nbi();return this.bitwiseTo(J,op_andnot,Z),Z},BigInteger.prototype.not=function bnNot(){for(var J=nbi(),Z=0;Z<this.t;++Z)J[Z]=this.DM&~this[Z];return J.t=this.t,J.s=~this.s,J},BigInteger.prototype.shiftLeft=function bnShiftLeft(J){var Z=nbi();return J<0?this.rShiftTo(-J,Z):this.lShiftTo(J,Z),Z},BigInteger.prototype.shiftRight=function bnShiftRight(J){var Z=nbi();return J<0?this.lShiftTo(-J,Z):this.rShiftTo(J,Z),Z},BigInteger.prototype.getLowestSetBit=function bnGetLowestSetBit(){for(var J=0;J<this.t;++J)if(0!=this[J])return J*this.DB+lbit(this[J]);return this.s<0?this.t*this.DB:-1},BigInteger.prototype.bitCount=function bnBitCount(){for(var J=0,Z=this.s&this.DM,ee=0;ee<this.t;++ee)J+=cbit(this[ee]^Z);return J},BigInteger.prototype.testBit=function bnTestBit(J){var Z=Math.floor(J/this.DB);return Z>=this.t?0!=this.s:!!(this[Z]&1<<J%this.DB)},BigInteger.prototype.setBit=function bnSetBit(J){return this.changeBit(J,op_or)},BigInteger.prototype.clearBit=function bnClearBit(J){return this.changeBit(J,op_andnot)},BigInteger.prototype.flipBit=function bnFlipBit(J){return this.changeBit(J,op_xor)},BigInteger.prototype.add=function bnAdd(J){var Z=nbi();return this.addTo(J,Z),Z},BigInteger.prototype.subtract=function bnSubtract(J){var Z=nbi();return this.subTo(J,Z),Z},BigInteger.prototype.multiply=function bnMultiply(J){var Z=nbi();return this.multiplyTo(J,Z),Z},BigInteger.prototype.divide=function bnDivide(J){var Z=nbi();return this.divRemTo(J,Z,null),Z},BigInteger.prototype.remainder=function bnRemainder(J){var Z=nbi();return this.divRemTo(J,null,Z),Z},BigInteger.prototype.divideAndRemainder=function bnDivideAndRemainder(J){var Z=nbi(),ee=nbi();return this.divRemTo(J,Z,ee),new Array(Z,ee)},BigInteger.prototype.modPow=function bnModPow(J,Z){var ee,ne,se=J.bitLength(),re=nbv(1);if(se<=0)return re;ee=se<18?1:se<48?3:se<144?4:se<768?5:6,ne=se<8?new Classic(Z):Z.isEven()?new Barrett(Z):new Montgomery(Z);var ae=new Array,le=3,pe=ee-1,_e=(1<<ee)-1;if(ae[1]=ne.convert(this),ee>1){var ve=nbi();for(ne.sqrTo(ae[1],ve);le<=_e;)ae[le]=nbi(),ne.mulTo(ve,ae[le-2],ae[le]),le+=2}var ye,Fe,qe=J.t-1,$e=!0,He=nbi();for(se=nbits(J[qe])-1;qe>=0;){for(se>=pe?ye=J[qe]>>se-pe&_e:(ye=(J[qe]&(1<<se+1)-1)<<pe-se,qe>0&&(ye|=J[qe-1]>>this.DB+se-pe)),le=ee;!(1&ye);)ye>>=1,--le;if((se-=le)<0&&(se+=this.DB,--qe),$e)ae[ye].copyTo(re),$e=!1;else{for(;le>1;)ne.sqrTo(re,He),ne.sqrTo(He,re),le-=2;le>0?ne.sqrTo(re,He):(Fe=re,re=He,He=Fe),ne.mulTo(He,ae[ye],re)}for(;qe>=0&&!(J[qe]&1<<se);)ne.sqrTo(re,He),Fe=re,re=He,He=Fe,--se<0&&(se=this.DB-1,--qe)}return ne.revert(re)},BigInteger.prototype.modInverse=function bnModInverse(J){var Z=J.isEven();if(this.isEven()&&Z||0==J.signum())return BigInteger.ZERO;for(var ee=J.clone(),ne=this.clone(),se=nbv(1),re=nbv(0),ae=nbv(0),le=nbv(1);0!=ee.signum();){for(;ee.isEven();)ee.rShiftTo(1,ee),Z?(se.isEven()&&re.isEven()||(se.addTo(this,se),re.subTo(J,re)),se.rShiftTo(1,se)):re.isEven()||re.subTo(J,re),re.rShiftTo(1,re);for(;ne.isEven();)ne.rShiftTo(1,ne),Z?(ae.isEven()&&le.isEven()||(ae.addTo(this,ae),le.subTo(J,le)),ae.rShiftTo(1,ae)):le.isEven()||le.subTo(J,le),le.rShiftTo(1,le);ee.compareTo(ne)>=0?(ee.subTo(ne,ee),Z&&se.subTo(ae,se),re.subTo(le,re)):(ne.subTo(ee,ne),Z&&ae.subTo(se,ae),le.subTo(re,le))}return 0!=ne.compareTo(BigInteger.ONE)?BigInteger.ZERO:le.compareTo(J)>=0?le.subtract(J):le.signum()<0?(le.addTo(J,le),le.signum()<0?le.add(J):le):le},BigInteger.prototype.pow=function bnPow(J){return this.exp(J,new NullExp)},BigInteger.prototype.gcd=function bnGCD(J){var Z=this.s<0?this.negate():this.clone(),ee=J.s<0?J.negate():J.clone();if(Z.compareTo(ee)<0){var ne=Z;Z=ee,ee=ne}var se=Z.getLowestSetBit(),re=ee.getLowestSetBit();if(re<0)return Z;for(se<re&&(re=se),re>0&&(Z.rShiftTo(re,Z),ee.rShiftTo(re,ee));Z.signum()>0;)(se=Z.getLowestSetBit())>0&&Z.rShiftTo(se,Z),(se=ee.getLowestSetBit())>0&&ee.rShiftTo(se,ee),Z.compareTo(ee)>=0?(Z.subTo(ee,Z),Z.rShiftTo(1,Z)):(ee.subTo(Z,ee),ee.rShiftTo(1,ee));return re>0&&ee.lShiftTo(re,ee),ee},BigInteger.prototype.isProbablePrime=function bnIsProbablePrime(J){var Z,ee=this.abs();if(1==ee.t&&ee[0]<=_e[_e.length-1]){for(Z=0;Z<_e.length;++Z)if(ee[0]==_e[Z])return!0;return!1}if(ee.isEven())return!1;for(Z=1;Z<_e.length;){for(var ne=_e[Z],se=Z+1;se<_e.length&&ne<ve;)ne*=_e[se++];for(ne=ee.modInt(ne);Z<se;)if(ne%_e[Z++]==0)return!1}return ee.millerRabin(J)},BigInteger.prototype.square=function bnSquare(){var J=nbi();return this.squareTo(J),J},BigInteger.prototype.Barrett=Barrett,null==le){var ye;if(le=new Array,pe=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var Fe=new Uint8Array(32);for(window.crypto.getRandomValues(Fe),ye=0;ye<32;++ye)le[pe++]=Fe[ye]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var qe=window.crypto.random(32);for(ye=0;ye<qe.length;++ye)le[pe++]=255&qe.charCodeAt(ye)}for(;pe<$e;)ye=Math.floor(65536*Math.random()),le[pe++]=ye>>>8,le[pe++]=255&ye;pe=0,rng_seed_time()}function rng_get_byte(){if(null==ae){for(rng_seed_time(),(ae=function prng_newstate(){return new Arcfour}()).init(le),pe=0;pe<le.length;++pe)le[pe]=0;pe=0}return ae.next()}function SecureRandom(){}function Arcfour(){this.i=0,this.j=0,this.S=new Array}SecureRandom.prototype.nextBytes=function rng_get_bytes(J){var Z;for(Z=0;Z<J.length;++Z)J[Z]=rng_get_byte()},Arcfour.prototype.init=function ARC4init(J){var Z,ee,ne;for(Z=0;Z<256;++Z)this.S[Z]=Z;for(ee=0,Z=0;Z<256;++Z)ee=ee+this.S[Z]+J[Z%J.length]&255,ne=this.S[Z],this.S[Z]=this.S[ee],this.S[ee]=ne;this.i=0,this.j=0},Arcfour.prototype.next=function ARC4next(){var J;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,J=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=J,this.S[J+this.S[this.i]&255]};var $e=256;J.exports={default:BigInteger,BigInteger,SecureRandom}}).call(this)}},Z={};function __webpack_require__(ee){var ne=Z[ee];if(void 0!==ne)return ne.exports;var se=Z[ee]={exports:{}};return J[ee].call(se.exports,se,se.exports,__webpack_require__),se.exports}__webpack_require__.d=function(J,Z){for(var ee in Z)__webpack_require__.o(Z,ee)&&!__webpack_require__.o(J,ee)&&Object.defineProperty(J,ee,{enumerable:!0,get:Z[ee]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(J){if("object"==typeof window)return window}}(),__webpack_require__.o=function(J,Z){return Object.prototype.hasOwnProperty.call(J,Z)},__webpack_require__.r=function(J){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(J,"__esModule",{value:!0})};var ee={};!function(){"use strict";__webpack_require__.r(ee),__webpack_require__.d(ee,{default:function(){return rf}});class BaseServer{constructor(){this.handlers=Object.create(null)}on=(J,Z)=>{const ee=[];if("object"==typeof J&&null!==J)Object.entries(J).forEach((([J,Z])=>{this._validateParams(J,Z),this._addHandler(J,Z),ee.push({type:J,handler:Z})}));else{if("string"!=typeof J||"function"!=typeof Z)throw new Error("参数格式错误,支持:$on(事件名, 处理函数) 或 $on({事件名: 处理函数, ...})");this._validateParams(J,Z),this._addHandler(J,Z),ee.push({type:J,handler:Z})}return()=>{ee.forEach((({type:J,handler:Z})=>{if(!this.handlers[J])return;const ee=this.handlers[J].findIndex((J=>J===Z));-1!==ee&&(this.handlers[J].splice(ee,1),0===this.handlers[J].length&&delete this.handlers[J])}))}};emit=(J,...Z)=>{this.handlers[J]&&[...this.handlers[J]].forEach((J=>{J(...Z)}))};off=(J,Z)=>{if(!this.handlers[J])throw new Error(`不存在事件: ${J}`);if(Z){const ee=this.handlers[J].findIndex((J=>J===Z));this.handlers[J].splice(ee,1),0===this.handlers[J].length&&delete this.handlers[J]}else delete this.handlers[J]};_validateParams(J,Z){if("string"!=typeof J)throw new Error("事件名必须为字符串");if("function"!=typeof Z)throw new Error("事件处理函数必须为函数")}_addHandler(J,Z){this.handlers[J]||(this.handlers[J]=[]),this.handlers[J].includes(Z)||this.handlers[J].push(Z)}}const J={SDK_READY:"sdkStateReady",INITBEFORE_SUCCESS:"initBeforeSuccess",INITBEFORE_FAILED:"initBeforeFailed",INIT_FAILED:"init_failed",NET_STATE_CHANGE:"net_state_change",ERROR:"error",ROOM_MSG:"room_msg",JOIN_MSG:"join_msg",LEAVE_MSG:"leave_msg",CHAT_MSG:"chat_msg",CUSTOM_MSG:"custom_msg",LIVE_START:"live_start",LIVE_END:"live_end",LIKE_MSG:"like_msg",KICKOUT:"room_kickout",RECORD_WATCH_EXPIRE_SET:"record_watch_expire_set",RECORD_WATCH_EXPIRE_ALERT:"record_watch_expire_alert",GIFT_MSG:"gift_msg",MALL_REWARD_PUSH:"mall_reward_push",MALL_REWARD_END:"mall_reward_end",DELETE_MSG:"chat_delete",FOREGROUND_REFRESH:"foreground_refresh"},Z=0,ne=5e3,se=5001,re=5002,ae=5003,le=5004,pe=5005,_e=5006,ve=5020,ye={RoomServer:1,UserServer:1,LogReportServer:1,CustomMenuServer:1,InviteCardServer:1,ChatServer:1,ProductServer:1,InteractServer:1,LotteryServer:1,MallRewardServer:1};var Fe=__webpack_require__(547);function isString(J){return"string"==typeof J}function isObj(J){return"[object Object]"===Object.prototype.toString.call(J)}function deepCopy(J){if("object"!=typeof J||null===J)return J;if(Array.isArray(J))return J.map((J=>deepCopy(J)));if(J instanceof Set)return new Set(Array.from(J).map((J=>deepCopy(J))));if(J instanceof Map)return new Map(Array.from(J).map((([J,Z])=>[J,deepCopy(Z)])));if(J instanceof Date)return new Date(J.getTime());if(J instanceof RegExp)return new RegExp(J.source,J.flags);const Z={};for(const ee in J)J.hasOwnProperty(ee)&&(Z[ee]=deepCopy(J[ee]));return Z}const safeJsonParse=function(J){const Z=Object.prototype.toString.call(J);if(["[object Array]","[object Object]","[object Null]"].includes(Z))return J;try{return JSON.parse(J)}catch(J){return null}},truncateString=function(J,Z=30){return J&&"string"==typeof J?J.length>Z?J.substring(0,30):J:""};class RequestUtil{constructor(J={}){this.baseUrl=J?.baseUrl,this.headers=Object.assign({Accept:"*/*","Content-Type":"application/json","Accept-Language":"zh-CN,zh;q=0.8",platform:J?.platform},J?.headers),this._intercept={config:(J={})=>(J.url=function safeUrlJoin(J,Z){return!J||Z.startsWith("http")?Z:`${J.replace(/\/$/,"")}/${Z.replace(/^\//,"")}`}(this.baseUrl,J.url),J),success:J=>J,fail:J=>J,complete:J=>{}}}setCommonHeaders=function(J,Z){this.headers[J]=Z};request=function(J){const Z=this,ee=Z._intercept.config(J),ne=Object.assign({},Z.headers,ee.headers);return new Promise((function(J,se){wx.request({url:ee.url,data:ee.data,header:ne,method:ee.method||"GET",success:ee=>{const ne=Z._intercept.success(ee);J(ne.data)},fail:J=>{const ee=Z._intercept.fail(J);se(ee)},complete:J=>{Z._intercept.complete(J)}})}))};sendGet=function(J,Z,ee){return this.request({url:J,method:"GET",data:Z,...ee})};sendPost=function(J,Z,ee){return this.request({url:J,method:"POST",data:Z,...ee})}}const qe=wx.getAccountInfoSync(),$e=qe?.miniProgram?.envVersion||"";function _parseKey(J){return $e?`${$e}_${J}`:`${J}`}var He={setStorageSync(J,Z){try{return wx.setStorageSync(_parseKey(J),Z),!0}catch(J){return!1}},getStorageSync:J=>wx.getStorageSync(_parseKey(J)),removeStorageSync(J){try{return wx.removeStorageSync(_parseKey(J)),!0}catch(J){return!1}},setStorage:J=>(J.key=_parseKey(J.key),wx.setStorage(J)),removeStorageIfMatch(J,Z){return this.getStorageSync(J)!=Z||this.removeStorageSync(J)},checkAndRemoveToken(){const J=this.getStorageSync("token_expired"),Z=this.getStorageSync("userInfo");return!(!(J&&Z&&Z.user_id)||Date.now()>Number(J))||(this.removeStorageSync("token"),this.removeStorageSync("token_expired"),!1)}};const Ye={webinarId:"",user:{},watchInitData:{},liveInfo:{},kickMark:"",query_invite_code:"",permissions:{},permissionValue:{},webinarTag:{},screenPosterInfo:{},officicalInfo:{},interactToolStatus:{},productList:[],advDefault:{},inviteCardStatus:{},inviteCardInfo:{},invite_code:"",keywords:{},redPacket:{},pwdRedPacket:{},likeCount:0,noticeInfo:{},signinInfo:{},timerInfo:{},examInfo:{},pushCardInfo:{},customMenu:{},customMenuDetail:{},mallRewardInfo:null,memberLevel:{}};class Store{constructor(){this.state={...Ye},this.callbacks={},this._getByStr=J=>{if(!J)return this.state;const Z=J.split(".");return Z.reduce(((J,ee,ne)=>!J[ee]&&ne<Z.length-1?{}:J[ee]),this.state)},this.get=J=>{if(isString(J))return this._getByStr(J);if(isObj(J)){const Z={...J};return Object.keys(Z).forEach((J=>{const ee=Z[J];this.callbacks[J]||(this.callbacks[J]=[]),this.callbacks[J].indexOf(ee)<0&&this.callbacks[J].push(ee),ee(this._getByStr(J))})),()=>{Object.keys(Z).forEach((J=>{const ee=Z[J],ne=this.callbacks[J].indexOf(ee);this.callbacks[J].splice(ne,1)}))}}},this._setByStr=(J,Z)=>{try{const ee=J.split(".");ee.reduce(((J,ne,se)=>(se===ee.length-1&&(J[ne]=Z),J[ne]=void 0===J[ne]?{}:J[ne],J[ne])),this.state)}catch(J){console.error("error",J)}},this._setItem=(J,Z)=>{try{if(Z!==this._getByStr(J)){const ee=deepCopy(this._getByStr(J));this._setByStr(J,Z),(this.callbacks[J]||[]).forEach((Z=>{Z(this._getByStr(J),ee)}))}}catch(J){console.error("error",J)}},this.set=(J,Z)=>{if(isString(J)&&this._setItem(J,Z),isObj(J)){const Z={...J};Object.keys(Z).forEach((J=>{const ee=Z[J];this._setItem(J,ee)}))}},this.reset=()=>{this.state={}}}}class SerializableMap{constructor(J=[]){this._data={},this._size=0;for(const[Z,ee]of J)this.set(Z,ee)}set(J,Z,ee=!1){const ne=String(J);return this._data.hasOwnProperty(ne)||this._size++,this._data[ne]=Z,"function"==typeof Z&&ee&&Z(),this}get(J){const Z=String(J);return this._data[Z]}has(J){const Z=String(J);return this._data.hasOwnProperty(Z)}delete(J){const Z=String(J);return!!this._data.hasOwnProperty(Z)&&(delete this._data[Z],this._size--,!0)}clear(){this._data={},this._size=0}get size(){return this._size}toJSON(){return this._data}*[Symbol.iterator](){for(const J in this._data)this._data.hasOwnProperty(J)&&(yield[J,this._data[J]])}}var Je=class EventEmitter{constructor(){this._events={}}on(J,Z){return this._events[J]||(this._events[J]=[]),this._events[J].push(Z),this}once(J,Z){const onceListener=(...ee)=>{Z.apply(this,ee),this.off(J,onceListener)};return this.on(J,onceListener)}off(J,Z){return this._events[J]?(Z?this._events[J]=this._events[J].filter((J=>J!==Z)):delete this._events[J],this):this}emit(J,...Z){return this._events[J]&&this._events[J].forEach((J=>{J.apply(this,Z)})),this}clearEvents(){this._events={}}};const Xe="/sdk/v1/init/start",Qe="/sdk/v2/message/s-send",nt={TYPE_TEXT:"text",TYPE_DISABLE:"disable",TYPE_DISABLE_ALL:"disable_all",TYPE_PERMIT:"permit",TYPE_PERMIT_ALL:"permit_all"},it="onTimJoinGroupSuccess",ot="onTimJoinGroupFailed",pt="onTimKickedOut",mt="onTimNetStateChange",It="onTimError",St="function"==typeof Buffer,Mt="function"==typeof TextDecoder?new TextDecoder:void 0,bt="function"==typeof TextEncoder?new TextEncoder:void 0,At=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Ot=(J=>{let Z={};return J.forEach(((J,ee)=>Z[J]=ee)),Z})(At),wt=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Dt=String.fromCharCode.bind(String),Lt="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):J=>new Uint8Array(Array.prototype.slice.call(J,0)),_mkUriSafe=J=>J.replace(/=/g,"").replace(/[+\/]/g,(J=>"+"==J?"-":"_")),_tidyB64=J=>J.replace(/[^A-Za-z0-9\+\/]/g,""),btoaPolyfill=J=>{let Z,ee,ne,se,re="";const ae=J.length%3;for(let ae=0;ae<J.length;){if((ee=J.charCodeAt(ae++))>255||(ne=J.charCodeAt(ae++))>255||(se=J.charCodeAt(ae++))>255)throw new TypeError("invalid character found");Z=ee<<16|ne<<8|se,re+=At[Z>>18&63]+At[Z>>12&63]+At[Z>>6&63]+At[63&Z]}return ae?re.slice(0,ae-3)+"===".substring(ae):re},kt="function"==typeof btoa?J=>btoa(J):St?J=>Buffer.from(J,"binary").toString("base64"):btoaPolyfill,Ut=St?J=>Buffer.from(J).toString("base64"):J=>{let Z=[];for(let ee=0,ne=J.length;ee<ne;ee+=4096)Z.push(Dt.apply(null,J.subarray(ee,ee+4096)));return kt(Z.join(""))},cb_utob=J=>{if(J.length<2)return(Z=J.charCodeAt(0))<128?J:Z<2048?Dt(192|Z>>>6)+Dt(128|63&Z):Dt(224|Z>>>12&15)+Dt(128|Z>>>6&63)+Dt(128|63&Z);var Z=65536+1024*(J.charCodeAt(0)-55296)+(J.charCodeAt(1)-56320);return Dt(240|Z>>>18&7)+Dt(128|Z>>>12&63)+Dt(128|Z>>>6&63)+Dt(128|63&Z)},Gt=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=J=>J.replace(Gt,cb_utob),xt=St?J=>Buffer.from(J,"utf8").toString("base64"):bt?J=>Ut(bt.encode(J)):J=>kt(utob(J)),encode=(J,Z=!1)=>Z?_mkUriSafe(xt(J)):xt(J),Ft=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=J=>{switch(J.length){case 4:var Z=((7&J.charCodeAt(0))<<18|(63&J.charCodeAt(1))<<12|(63&J.charCodeAt(2))<<6|63&J.charCodeAt(3))-65536;return Dt(55296+(Z>>>10))+Dt(56320+(1023&Z));case 3:return Dt((15&J.charCodeAt(0))<<12|(63&J.charCodeAt(1))<<6|63&J.charCodeAt(2));default:return Dt((31&J.charCodeAt(0))<<6|63&J.charCodeAt(1))}},btou=J=>J.replace(Ft,cb_btou),atobPolyfill=J=>{if(J=J.replace(/\s+/g,""),!wt.test(J))throw new TypeError("malformed base64.");J+="==".slice(2-(3&J.length));let Z,ee,ne,se="";for(let re=0;re<J.length;)Z=Ot[J.charAt(re++)]<<18|Ot[J.charAt(re++)]<<12|(ee=Ot[J.charAt(re++)])<<6|(ne=Ot[J.charAt(re++)]),se+=64===ee?Dt(Z>>16&255):64===ne?Dt(Z>>16&255,Z>>8&255):Dt(Z>>16&255,Z>>8&255,255&Z);return se},$t="function"==typeof atob?J=>atob(_tidyB64(J)):St?J=>Buffer.from(J,"base64").toString("binary"):atobPolyfill,jt=St?J=>Lt(Buffer.from(J,"base64")):J=>Lt($t(J).split("").map((J=>J.charCodeAt(0)))),toUint8Array=J=>jt(_unURI(J)),Wt=St?J=>Buffer.from(J,"base64").toString("utf8"):Mt?J=>Mt.decode(jt(J)):J=>btou($t(J)),_unURI=J=>_tidyB64(J.replace(/[-_]/g,(J=>"-"==J?"+":"/"))),decode=J=>Wt(_unURI(J)),Zt=encode,Xt=__webpack_require__(90);const Bn=function nanoid(J=20){let Z="",ee=J;for(;ee--;)Z+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return Z}(20);const utils_safeJsonParse=function(J){const Z=Object.prototype.toString.call(J);if(["[object Array]","[object Object]","[object Null]"].includes(Z))return J;try{return JSON.parse(J)}catch(J){return null}};function utils_safeUrlJoin(J,Z){return`${J.replace(/\/$/,"")}/${Z.replace(/^\//,"")}`}const Hn=__webpack_require__(2),Kn=__webpack_require__(148),es=__webpack_require__(672).sm3;let ts="",ns=2;const e=J=>void 0===J,t=J=>"string"==typeof J,s=J=>{var Z;return null===(Z=Object.prototype.toString.call(J).match(/^\[object (.*)\]$/))||void 0===Z?void 0:Z[1].toLowerCase()},n=J=>"function"==typeof Array.isArray?Array.isArray(J):"array"===s(J),o=J=>null!==J&&"object"==typeof J,i=J=>n(J)||o(J),r=J=>{if("string"!=typeof J)return!1;const Z=J[0];return!/[^a-zA-Z0-9]/.test(Z)},a=J=>{if("object"!=typeof J||null===J)return!1;const Z=Object.getPrototypeOf(J);if(null===Z)return!0;let ee=Z;for(;null!==Object.getPrototypeOf(ee);)ee=Object.getPrototypeOf(ee);return Z===ee};function c(J=99999999){return Math.round(Math.random()*J)}const u=(J,Z,ee,ne)=>{if(!i(J)||!i(Z))return 0;let se=0;const re=Object.keys(Z);let ae;for(let le=0,pe=re.length;le<pe;le++)if(ae=re[le],!(e(Z[ae])||ee&&ee.includes(ae)))if(i(J[ae])&&i(Z[ae]))se+=u(J[ae],Z[ae],ee,ne);else{if(ne&&ne.includes(Z[ae]))continue;J[ae]!==Z[ae]&&(J[ae]=Z[ae],se+=1)}return se};function l(J){let Z,ee,ne=J;J.length%8!=0&&(ne="0".repeat(8-J.length%8)+J);let se="";for(let J=0,{length:re}=ne;J<re;J+=8)Z=parseInt(ne.slice(J,J+4),2),ee=parseInt(ne.slice(J+4,J+8),2),se+=base16Map.get(Z)+base16Map.get(ee);return se}const ss={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19,NS_NATIVE_APP:20,RN_NATIVE_APP:21},is=["heartbeat.alive","im_open_status.wslogin","im_open_status.wslogout","group_open_long_polling_http_svc.get_msg","group_open_long_polling_http_noauth_svc.get_msg"];var rs;!function(J){J[J.DEBUG=0]="DEBUG",J[J.INFO=1]="INFO",J[J.WARN=2]="WARN",J[J.ERROR=3]="ERROR",J[J.NONE=4]="NONE"}(rs||(rs={}));const os="LiteChat",as={[rs.DEBUG]:console.debug,[rs.INFO]:console.info,[rs.WARN]:console.warn,[rs.ERROR]:console.error},cs={[rs.INFO]:4,[rs.WARN]:5,[rs.ERROR]:6},us=1e3,ls=2,hs=5e3,ds=50,ps={CHINA:"CHINA",OVERSEA:"OVERSEA",SINGAPORE:"SINGAPORE",KOREA:"KOREA",GERMANY:"GERMANY",IND:"IND",JPN:"JPN",USA:"USA",INDONESIA:"INDONESIA",KSA:"KSA"},gs={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"},KSA:{DEFAULT:"wss://wssksa-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{INITIAL:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",BACKUP_WEB_ONLY:"wss://*w4c.my-cpaas.com",BACKUP_CN:"wss://wss.im.tencent.cn",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{INITIAL:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4c.my-cpaas.com",BACKUP_CN:"wss://wss.im.tencent.cn",STAT:"https://api.my-imcloud.com"},SINGAPORE:{INITIAL:"wss://*w4s.my-imcloud.com",DEFAULT:"wss://wsssgp.im.qcloud.com",IPV6:"wss://wsssgpv6.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4s.my-cpaas.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{INITIAL:"wss://*w4k.my-imcloud.com",DEFAULT:"wss://wsskr.im.qcloud.com",IPV6:"wss://wsskrv6.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4k.my-cpaas.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{INITIAL:"wss://*w4g.my-imcloud.com",DEFAULT:"wss://wssger.im.qcloud.com",IPV6:"wss://wssgerv6.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4g.my-cpaas.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{INITIAL:"wss://*w4i.my-imcloud.com",DEFAULT:"wss://wssind.my-imcloud.com",IPV6:"wss://wssindv6.im.qcloud.com",BACKUP:"wss://wssind.im.qcloud.com",BACKUP_WEB_ONLY:"wss://*w4i.my-cpaas.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.19.46"},JPN:{INITIAL:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",IPV6:"wss://wssjpnv6.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4j.my-cpaas.com",STAT:"https://apijpn.my-imcloud.com",ANYCAST:"wss://162.14.13.254"},USA:{INITIAL:"wss://*w4u.my-imcloud.com",DEFAULT:"wss://wssusa.im.qcloud.com",IPV6:"wss://wssusav6.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4u.my-cpaas.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{INITIAL:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",IPV6:"wss://wssidnv6.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4y.my-cpaas.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"},KSA:{INITIAL:"wss://*w4a.my-imcloud.com",DEFAULT:"wss://wssksa.im.qcloud.com",IPV6:"wss://wssksav6.im.qcloud.com",BACKUP:"wss://wssksa.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4a.my-cpaas.com",STAT:"https://apiksa.my-imcloud.com",ANYCAST:"wss://43.164.68.251"}}};var fs;!function(J){J[J.CONV_DELETED=1]="CONV_DELETED",J[J.CONV_PINED=2]="CONV_PINED",J[J.CONV_UNPINED=3]="CONV_UNPINED",J[J.CONV_MARK_UPDATED=4]="CONV_MARK_UPDATED",J[J.CONV_GROUP_ADDED=5]="CONV_GROUP_ADDED",J[J.CONV_GROUP_DELETED=6]="CONV_GROUP_DELETED",J[J.CONV_GROUP_UPDATED=7]="CONV_GROUP_UPDATED"}(fs||(fs={}));var _s=Object.freeze({__proto__:null,ACCESS_ENVIRONMENT:ps,CONSOLE_METHOD:as,CloudConfigReportLevelMap:cs,get ConvModifyPushType(){return fs},DEFAULT_GLOBAL_MAX_TOTAL_COUNT:ds,DEFAULT_GLOBAL_THROTTLE_TIME:hs,DEFAULT_SINGLE_MAX_TOTAL_COUNT:ls,DEFAULT_SINGLE_THROTTLE_TIME:us,ENUM_PLATFORM:ss,HOST_CONFIG:gs,IS_TOPIC_MESSAGE:2,get LogLevel(){return rs},NOT_NEED_CRC_SERVCMD:is,SDK_NAME:os});const ms="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&("mac"===wx.getSystemInfoSync().platform||"windows"===wx.getSystemInfoSync().platform)&&void 0===wx.getSystemInfoSync().uniPlatform,vs="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)||ms,ys=vs&&"function"==typeof wx.createGamePortal,Is="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),Ss="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),Es=Ss&&"function"==typeof tt.onShow,Cs="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),Ms="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),bs="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,Ts="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,As=vs&&"object"==typeof wx.miniapp,Os="undefined"!=typeof uni,ws=Ss&&"function"==typeof tt.enterChat,Rs=vs||Is||Ss||Cs||Ms||Ts||bs,Ds="undefined"==typeof window&&!Rs&&void 0!==__webpack_require__.g&&void 0!==__webpack_require__.g.NativeScriptGlobals,Ns=void 0!==__webpack_require__.g&&(void 0!==__webpack_require__.g.nativeModuleProxy||void 0!==__webpack_require__.g.ReactNative),Ls="undefined"!=typeof wx&&"function"==typeof wx.getAccountInfoSync&&Boolean(wx.getAccountInfoSync().plugin),ks="undefined"!=typeof uni?!Rs:"undefined"!=typeof window&&!Rs&&!Ns,Ps=Is?qq:Ss?tt:Cs?swan:Ms?my:vs?wx:Ts?uni:bs?jd:{},Us=ks&&window&&window.navigator&&window.navigator.userAgent||"",Gs=/(micromessenger|webbrowser)/i.test(Us),xs=function(){let J="WEB";return Gs?J="WEB":Is?J="QQ_MP":Ss?J="TT_MP":Cs?J="BAIDU_MP":Ms?J="ALI_MP":vs?J=As?"DONUT_NATIVE_APP":"WX_MP":Ts?J="UNI_NATIVE_APP":Ds?J="NS_NATIVE_APP":Ns&&(J="RN_NATIVE_APP"),ss[J]}(),Fs=/iPad/i.test(Us),qs=/iPhone/i.test(Us)&&!Fs,Vs=/iPod/i.test(Us),$s=qs||Fs||Vs,Zs=function(){const J=Us.match(/OS (\d+)_/i);return J&&J[1]?J[1]:null}(),Xs=/Android/i.test(Us),Qs=function(){const J=Us.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!J)return null;const Z=J[1]&&parseFloat(J[1]),ee=J[2]&&parseFloat(J[2]);return Z&&ee?parseFloat(`${J[1]}.${J[2]}`):Z||null}(),ti=/Firefox/i.test(Us),oi=/Edge/i.test(Us),ci=!oi&&/Chrome/i.test(Us),ui=/MSIE/.test(Us)||Us.indexOf("Trident")>-1&&Us.indexOf("rv:11.0")>-1,li=function(){const J=/MSIE\s(\d+)\.\d/.exec(Us);let Z=J&&parseFloat(J[1]);return!Z&&/Trident\/7.0/i.test(Us)&&/rv:11.0/.test(Us)&&(Z=11),Z}(),di=/Safari/i.test(Us)&&!ci&&!Xs&&!oi,pi=/Windows/i.test(Us),mi=/MAC OS X/i.test(Us),yi=ks&&"undefined"!=typeof Worker&&!ui,Si=Xs||$s,Ei=function(){if("undefined"==typeof window||void 0===window.navigator)return!1;const{standalone:J}=window.navigator;return!(!$s||J||di)}();function de(){let J="unknown";if(mi&&(J="mac"),pi&&(J="windows"),$s&&(J="ios"),Xs&&(J="android"),Rs)try{const{platform:Z}=Ps.getSystemInfoSync();void 0!==Z&&(J=Z)}catch(J){console.error(J)}return J}function he(J,Z){var ee={};for(var ne in J)Object.prototype.hasOwnProperty.call(J,ne)&&Z.indexOf(ne)<0&&(ee[ne]=J[ne]);if(null!=J&&"function"==typeof Object.getOwnPropertySymbols){var se=0;for(ne=Object.getOwnPropertySymbols(J);se<ne.length;se++)Z.indexOf(ne[se])<0&&Object.prototype.propertyIsEnumerable.call(J,ne[se])&&(ee[ne[se]]=J[ne[se]])}return ee}function ge(J,Z,ee,ne){return new(ee||(ee=Promise))((function(se,re){function r(J){try{c(ne.next(J))}catch(J){re(J)}}function a(J){try{c(ne.throw(J))}catch(J){re(J)}}function c(J){var Z;J.done?se(J.value):(Z=J.value,Z instanceof ee?Z:new ee((function(J){J(Z)}))).then(r,a)}c((ne=ne.apply(J,Z||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const Ci="application/x-www-form-urlencoded;charset=UTF-8";function fe(J){return ge(this,arguments,void 0,(function*({method:J,url:Z,data:ee,timeout:ne=3e3}){return new Promise(Rs?(se,re)=>{Ps.request({url:Z,data:ee,method:J,timeout:ne,header:{"content-type":Ci},success:J=>se(J.data),fail:()=>re(new Error('{"message":"Network error","code":2800}'))})}:(se,re)=>{const ae=new XMLHttpRequest,le=setTimeout((()=>{ae.abort(),re(new Error('{"message":"Request timeout","code":2801}'))}),ne);ae.onreadystatechange=function(){if(4===ae.readyState)if(clearTimeout(le),200===ae.status||304===ae.status)try{se(ae.responseText?JSON.parse(ae.responseText):null)}catch(J){se(ae.responseText)}else re(new Error('{"message":"Network error","code":2800}'))},ae.open(J,Z,!0),ae.setRequestHeader("Content-type",Ci),ae.send(ee||null)})}))}function Ie(J){if(null==J)return!0;if("boolean"==typeof J)return!1;if("number"==typeof J)return 0===J;if("string"==typeof J)return 0===J.length;if("function"==typeof J)return 0===J.length;if(Array.isArray(J))return 0===J.length;if(J instanceof Error)return""===J.message;if(a(J)){for(const Z in J)if(Object.prototype.hasOwnProperty.call(J,Z))return!1;return!0}return("[object Map]"===Object.prototype.toString.call(J)||"[object Set]"===Object.prototype.toString.call(J)||"[object File]"===Object.prototype.toString.call(J))&&0===J.size}function Ee(J,Z){if(null===J||"object"!=typeof J)return J;const ee=Z||new WeakMap;if(ee.has(J))return ee.get(J);if(J instanceof Date)return new Date(J.getTime());if(J instanceof RegExp)return new RegExp(J.source,J.flags);if(J instanceof Map){const Z=new Map;return ee.set(J,Z),J.forEach(((J,ne)=>{Z.set(Ee(ne,ee),Ee(J,ee))})),Z}if(J instanceof Set){const Z=new Set;return ee.set(J,Z),J.forEach((J=>{Z.add(Ee(J,ee))})),Z}if(Array.isArray(J)){const Z=[];return ee.set(J,Z),J.forEach((J=>{Z.push(Ee(J,ee))})),Z}const ne=Object.getPrototypeOf(J),se=Object.create(ne);return ee.set(J,se),[...Object.getOwnPropertyNames(J),...Object.getOwnPropertySymbols(J)].forEach((Z=>{if("__ob__"===Z||"__v_skip"===Z||"__v_isRef"===Z||"__v_isReadonly"===Z)return;const ne=Object.getOwnPropertyDescriptor(J,Z);ne&&(ne.get||ne.set?Object.defineProperty(se,Z,ne):se[Z]=Ee(J[Z],ee))})),se}function Se(J,Z,ee){const ne=new WeakSet,o=(J,ee)=>{if(Z&&(ee=Z(J,ee)),void 0===ee)return"undefined";if(null===ee)return null;if(Number.isNaN(ee))return"NaN";if(ee===1/0)return"Infinity";if(ee===-1/0)return"-Infinity";if("function"==typeof ee)return`[Function: ${ee.name||"anonymous"}]`;if("symbol"==typeof ee)return ee.toString();if("bigint"==typeof ee)return`${ee.toString()}n`;if("object"==typeof ee&&null!==ee){if(ne.has(ee))return"[Circular]";ne.add(ee)}return ee instanceof Date?ee.toISOString():ee instanceof Error?{name:ee.name,message:ee.message,stack:ee.stack}:ee instanceof Map?{dataType:"Map",value:Array.from(ee.entries())}:ee instanceof Set?{dataType:"Set",value:Array.from(ee.values())}:ee};try{return JSON.stringify(J,o,ee)}catch(J){return console.error("Failed to stringify:",J),""}}function Ce(){let J,Z;return{promise:new Promise(((ee,ne)=>{J=ee,Z=ne})),resolve:J,reject:Z}}var Mi,bi=Object.freeze({__proto__:null,ANDROID_VERSION:Qs,IE_VERSION:li,IN_ALIPAY_MINI_APP:Ms,IN_BAIDU_MINI_APP:Cs,IN_BROWSER:ks,IN_DONUT_NATIVE_APP:As,IN_FEISHU_MINI_APP:ws,IN_JD_MINI_APP:bs,IN_MINI_APP:Rs,IN_NS_NATIVE_APP:Ds,IN_QQ_MINI_APP:Is,IN_RN_APP:Ns,IN_TT_MINI_APP:Ss,IN_TT_MINI_GAME:Es,IN_UNI_APP:Os,IN_UNI_NATIVE_APP:Ts,IN_WX_MINI_APP:vs,IN_WX_MINI_APP_DESK:ms,IN_WX_MINI_GAME:ys,IN_WX_MINI_PLUGIN:Ls,IOS_VERSION:Zs,IS_ANDROID:Xs,IS_CHROME:ci,IS_EDGE:oi,IS_FIREFOX:ti,IS_IE:ui,IS_IOS:$s,IS_IPAD:Fs,IS_IPHONE:qs,IS_IPOD:Vs,IS_MAC:mi,IS_SAFARI:di,IS_WECHAT:Gs,IS_WIN:pi,IS_WORKER_AVAILABLE:yi,MINI_APP_NAMESPACE:Ps,USER_AGENT:Us,base16EncodeBinaryString:l,deepCopyWithMethods:Ee,deepMerge:u,generatePromise:Ce,getPlatformType:de,getType:s,httpRequest:fe,isArray:n,isArrayOrObject:i,isEmpty:Ie,isH5:Si,isIOSWebView:Ei,isNumber:J=>null!==J&&("number"==typeof J&&!Number.isNaN(J-0)||"object"==typeof J&&J.constructor===Number),isObject:o,isPlainObject:a,isString:t,isUndefined:e,isUniIOSApp:function(){return Ts&&"ios"===uni.getDeviceInfo().platform.toLocaleLowerCase()},isValidRequestKey:r,platform:xs,randomInt:c,randomString:function(){let J="";for(let Z=32;Z>0;--Z)J+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return J},safeStringify:Se});class Oe{constructor(){this.listeners={}}on(J,Z,ee){this.listeners[J]||(this.listeners[J]=[]),this.listeners[J].push({fn:Z,context:ee})}off(J,Z,ee){var ne;Z&&(this.listeners[J]=null===(ne=this.listeners[J])||void 0===ne?void 0:ne.filter((J=>{const ne=J.fn===Z,se=!ee||J.context===ee;return!(ne&&se)})))}emit(J,...Z){const ee=this.listeners[J];ee&&ee.forEach((ee=>{const{fn:ne,context:se}=ee;try{ne.apply(se,Z)}catch(Z){console.warn(`Error in event handler for ${J} error: ${Se(Z)}`)}}))}once(J,Z,ee){const n=(...ne)=>{Z.apply(ee,ne),this.off(J,n)};this.on(J,n)}}!function(J){J.BUSINESS_COMMAND="business_command",J.C2C_REALTIME_MESSAGE="c2c_realtime_message",J.C2C_MESSAGE_MODIFIED="c2c_message_modified",J.C2C_REVOKED_MESSAGE="c2c_message_revoked",J.GROUP_REALTIME_MESSAGE="group_realtime_message",J.GROUP_MESSAGE_MODIFIED="group_message_modified",J.GROUP_MESSAGE_REVOKED="group_message_revoked",J.C2C_MESSAGE_READ_RECEIPT="c2c_message_read_receipt",J.MESSAGE_REACTION_UPDATED="message_reaction_updated",J.MESSAGE_REACTION_UPDATED_SYNC="message_reaction_updated_sync",J.GROUP_AT_TIPS="group_at_tips",J.USER_STATUS_UPDATE="user_status_update",J.FRIEND_LIST_MODIFIED="friend_list_modified",J.PROFILE_MODIFIED="profile_modified",J.CONV_MODIFIED="conversation_modified",J.GROUP_TIPS_NOTIFICATION="group_tips_notification",J.GROUP_MESSAGE_READ_RECEIPT="group_message_read_receipt",J.GROUP_MESSAGE_READ_SYNC="group_message_read_sync",J.GROUP_SYSTEM_NOTIFICATION="group_system_notification",J.C2C_MESSAGE_PEER_READ="c2c_message_peer_read",J.C2C_MESSAGE_READ_SYNC="c2c_message_read_sync",J.C2C_REMIND_TYPE_SYNC="c2c_remind_type_sync",J.FOLLOW_LIST_UPDATED="follow_list_updated",J.MESSAGE_EXTENSIONS_UPDATED="message_extensions_updated",J.ALL_MESSAGE_READ="all_message_read",J.CONVERSATION_MARK_UPDATED="conversation_mark_updated",J.CONVERSATION_GROUP_ADD="conversation_group_add",J.CONVERSATION_GROUP_DELETED="conversation_group_deleted",J.CONVERSATION_GROUP_UPDATED="conversation_group_updated",J.ALL_RECEIVE_MESSAGE_OPTION="all_receive_message_option",J.TOPIC_AT_TIPS="topic_at_tips",J.TOPIC_TIPS_NOTIFICATION="topic_tips_notification",J.TOPIC_SYSTEM_NOTIFICATION="topic_system_notification",J.TOPIC_MESSAGE_READ_SYNC="topic_message_read_sync",J.TOPIC_LATEST_MESSAGE="topic_latest_message",J.GROUP_MESSAGE_PINNED="group_message_pinned"}(Mi||(Mi={}));const Oi=[16,17];function Te(J){var Z;const ee=[];return null===(Z=null==J?void 0:J.GroupTips)||void 0===Z||Z.forEach((J=>{var Z;2===J.GroupInfo.MillionGroupFlag?ee.push(Mi.TOPIC_TIPS_NOTIFICATION):Oi.includes(null===(Z=null==J?void 0:J.MsgBody)||void 0===Z?void 0:Z.OpType)?ee.push(Mi.GROUP_MESSAGE_PINNED):ee.push(Mi.GROUP_TIPS_NOTIFICATION)})),ee}const wi=[{conditions:[{type:"event",value:100}],subType:Mi.BUSINESS_COMMAND},{conditions:[{type:"event",value:24}],subType:Mi.ALL_RECEIVE_MESSAGE_OPTION},{conditions:[{type:"event",value:26}],subType:Mi.TOPIC_LATEST_MESSAGE},{conditions:[{type:"hasKey",value:"C2cMsgArray"}],subType:Mi.C2C_REALTIME_MESSAGE},{conditions:[{type:"hasKey",value:"C2cMsgModNotifys"}],subType:Mi.C2C_MESSAGE_MODIFIED},{conditions:[{type:"hasKey",value:"ProfileDataMod"}],subType:Mi.PROFILE_MODIFIED},{conditions:[{type:"hasKey",value:"UserStatusList"}],subType:Mi.USER_STATUS_UPDATE},{conditions:[{type:"hasKey",value:"FriendListMod"}],subType:Mi.FRIEND_LIST_MODIFIED},{conditions:[{type:"hasKey",value:"GroupMsgArray"}],subType:Mi.GROUP_REALTIME_MESSAGE},{conditions:[{type:"hasKey",value:"GroupMsgModNotifys"}],subType:Mi.GROUP_MESSAGE_MODIFIED},{conditions:[{type:"hasKey",value:"C2cNotifyMsgArray"}],subTypeParser:function(J){var Z;const ee=[];return null===(Z=null==J?void 0:J.C2cNotifyMsgArray)||void 0===Z||Z.forEach((J=>{J.WithdrawC2cMsgNotify&&ee.push(Mi.C2C_REVOKED_MESSAGE),J.C2cReadedReceipt&&ee.push(Mi.C2C_MESSAGE_PEER_READ),J.ReadC2cMsgNotify&&ee.push(Mi.C2C_MESSAGE_READ_SYNC),J.MuteNotificationsSync&&ee.push(Mi.C2C_REMIND_TYPE_SYNC)})),ee}},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:4}],subTypeParser:Te},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:5}],subTypeParser:function(J){var Z;const ee=[];return null===(Z=null==J?void 0:J.GroupTips)||void 0===Z||Z.forEach((J=>{Array.isArray(J.MsgBody.GroupWithdrawInfoArray)?ee.push(Mi.GROUP_MESSAGE_REVOKED):Array.isArray(J.MsgBody.GroupMsgReceiptList)?ee.push(Mi.GROUP_MESSAGE_READ_RECEIPT):Array.isArray(J.MsgBody.GroupReadInfoArray)?J.MsgBody.GroupReadInfoArray[0].TopicId?ee.push(Mi.TOPIC_MESSAGE_READ_SYNC):ee.push(Mi.GROUP_MESSAGE_READ_SYNC):2===J.GroupInfo.MillionGroupFlag?ee.push(Mi.TOPIC_SYSTEM_NOTIFICATION):ee.push(Mi.GROUP_SYSTEM_NOTIFICATION)})),ee}},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:6}],subTypeParser:Te},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:12}],subTypeParser:function(J){var Z;const ee=[];return null===(Z=null==J?void 0:J.GroupTips)||void 0===Z||Z.forEach((J=>{const{GroupAtTips:{TopicId:Z}}=J;Z?ee.push(Mi.TOPIC_AT_TIPS):ee.push(Mi.GROUP_AT_TIPS)})),ee}},{conditions:[{type:"hasKey",value:"RecentContactMod"}],subTypeParser:function(J){var Z;const ee=[];return null===(Z=null==J?void 0:J.RecentContactMod)||void 0===Z||Z.forEach((J=>{switch(J.PushType){case fs.CONV_MARK_UPDATED:ee.push(Mi.CONVERSATION_MARK_UPDATED);break;case fs.CONV_GROUP_ADDED:ee.push(Mi.CONVERSATION_GROUP_ADD);break;case fs.CONV_GROUP_DELETED:ee.push(Mi.CONVERSATION_GROUP_DELETED);break;case fs.CONV_GROUP_UPDATED:ee.push(Mi.CONVERSATION_GROUP_UPDATED);break;default:ee.push(Mi.CONV_MODIFIED)}})),ee}},{conditions:[{type:"hasKey",value:"MsgReactionNotifyList"}],subType:Mi.MESSAGE_REACTION_UPDATED},{conditions:[{type:"hasKey",value:"MsgReactionNotify"}],subType:Mi.MESSAGE_REACTION_UPDATED_SYNC},{conditions:[{type:"hasKey",value:"C2cMsgInfo"}],subType:Mi.C2C_MESSAGE_READ_RECEIPT},{conditions:[{type:"hasKey",value:"FollowChangeList"}],subType:Mi.FOLLOW_LIST_UPDATED},{conditions:[{type:"hasKey",value:"MsgExtensionNotify"}],subType:Mi.MESSAGE_EXTENSIONS_UPDATED},{conditions:[{type:"hasKey",value:"C2CReadAllMsg"}],subType:Mi.ALL_MESSAGE_READ}];var Ri;function be(J){var Z;const ee=Array.isArray(null===(Z=null==J?void 0:J.body)||void 0===Z?void 0:Z.EventArray)?J.body.EventArray:[],ne=[];return ee.forEach((Z=>{Z.Flag=J.body.Flag;const ee=wi.find((J=>J.conditions.every((J=>{switch(J.type){case"event":return Z.Event===J.value;case"hasKey":return Object.prototype.hasOwnProperty.call(Z,J.value);default:return!1}}))));if(!ee)return null;let se=[];"function"==typeof ee.subTypeParser?se=ee.subTypeParser(Z):ee.subType&&(se=ee.subType),Array.isArray(se)?se.forEach((J=>{ne.push({type:`${Ri.SERVER_PUSH_MESSAGE}:${J}`,data:Z})})):ne.push({type:`${Ri.SERVER_PUSH_MESSAGE}:${se}`,data:Z})})),ne}!function(J){J.SERVER_PUSH_MESSAGE="im_open_push.msg_push",J.SERVER_PUSH_MESSAGE_MULTIPLE="im_open_push.multi_msg_push_ws",J.ERROR="error"}(Ri||(Ri={}));const Di={[Ri.SERVER_PUSH_MESSAGE]:be,[Ri.SERVER_PUSH_MESSAGE_MULTIPLE]:be,[Ri.ERROR]:function(J){const{errorCode:Z}=J;return[{type:`error:${Z}`,data:J}]}},Li=new class{constructor(){this._outerEventEmitter=null,this._innerEventEmitter=null,this._filteredCallbackMap=new Map,this._outerEventEmitter=new Oe,this._innerEventEmitter=new Oe,this.InnerEventSubType=Mi}subscribeInnerEvent(J,Z,ee,ne,se){var re;let ae,le,pe,_e;["string","number"].includes(typeof Z)?(pe=`${J}:${Z}`,_e=ee,le=ne,ae=se):(pe=J,_e=Z,le=ee,ae="function"==typeof ne?ne:void 0),ae?this._subscribeWithFilter(pe,_e,le,ae):null===(re=this._innerEventEmitter)||void 0===re||re.on(pe,_e,le)}emitInnerEvent(J,Z){var ee,ne;if(null===(ee=this._innerEventEmitter)||void 0===ee||ee.emit(J,Z),Object.keys(Di).includes(J)){const ee=null===(ne=Di[J])||void 0===ne?void 0:ne.call(Di,Z);null==ee||ee.forEach((J=>{var Z;J&&(null===(Z=this._innerEventEmitter)||void 0===Z||Z.emit(J.type,J.data))}))}}subscribeOuterEvent(J,Z,ee){var ne;null===(ne=this._outerEventEmitter)||void 0===ne||ne.on(J,Z,ee)}unSubscribeOuterEvent(J,Z,ee){var ne;null===(ne=this._outerEventEmitter)||void 0===ne||ne.off(J,Z,ee)}unSubscribeInnerEvent(J,Z,ee,ne){if(["string","number"].includes(typeof Z)){const se=ee,re=`${J}:${Z}`;this._unsubscribeEvent(re,se,ne)}else{const ne=Z;this._unsubscribeEvent(J,ne,ee)}}emitOuterEvent(J,Z){var ee;null===(ee=this._outerEventEmitter)||void 0===ee||ee.emit(J,Z)}getOuterEventEmitter(){return this._outerEventEmitter}rest(){this._outerEventEmitter=null,this._innerEventEmitter=null}_subscribeWithFilter(J,Z,ee,ne){var se;const i=J=>{ne.call(ee,J)&&Z.call(ee,J)};this._filteredCallbackMap.has(J)||this._filteredCallbackMap.set(J,[]),this._filteredCallbackMap.get(J).push({originalCallback:Z,filteredCallback:i,filter:ne,context:ee}),null===(se=this._innerEventEmitter)||void 0===se||se.on(J,i,ee)}_unsubscribeEvent(J,Z,ee){var ne,se;const re=this._filteredCallbackMap.get(J);if(re){const se=re.findIndex((J=>J.originalCallback===Z&&J.context===ee));if(-1!==se){const{filteredCallback:Z}=re[se];return null===(ne=this._innerEventEmitter)||void 0===ne||ne.off(J,Z,ee),re.splice(se,1),void(0===re.length&&this._filteredCallbackMap.delete(J))}}null===(se=this._innerEventEmitter)||void 0===se||se.off(J,Z,ee)}};class Pe{constructor(){this._socket=null}connectSocket(J){return this._socket=new WebSocket(J),this._socket}send(J){var Z,ee;try{null===(Z=this._socket)||void 0===Z||Z.send(J)}catch(J){null===(ee=this._onSendFail)||void 0===ee||ee.call(this,J)}}bindSocketHandlers(J){const{onOpen:Z,onMessage:ee,onClose:ne,onError:se,onSendFail:re}=J;this._socket&&(this._socket.binaryType="arraybuffer",this._socket.onopen=Z,this._socket.onmessage=ee,this._socket.onclose=ne,this._socket.onerror=se,this._onSendFail=re)}unbindSocketHandlers(){this._socket&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null)}disconnect(){this._socket&&(this._socket.close(),this._socket=null)}}class Ge{constructor(J){this._onError=J.onError}connectSocket(J){const Z=this;return this._socket=Ps.connectSocket({url:J,header:{"content-type":"application/json"},complete:()=>{},fail:J=>Z._onError(J)}),this._socket}send(J){var Z;null===(Z=this._socket)||void 0===Z||Z.send({data:J,fail:this._onSendFail})}bindSocketHandlers(J){const{onOpen:Z,onMessage:ee,onClose:ne,onError:se,onSendFail:re}=J;this._socket&&(this._socket.onClose(ne),this._socket.onOpen(Z),this._socket.onMessage(ee),this._socket.onError(se),this._onSendFail=re)}unbindSocketHandlers(){this._socket&&(this._socket.onClose((()=>{})),this._socket.onOpen((()=>{})),this._socket.onMessage((()=>{})),this._socket.onError((()=>{})))}disconnect(){this._socket&&(this._socket.close(),this._socket=null)}}const Pi="OPEN",Ui="MESSAGE",Gi="CLOSE",Bi="ERROR",ji="SEND_FAIL";class Be{constructor(){this._worker=null,this._blobUrl=null}connectSocket(J){const Z=new Blob(["\n let _socket = null;\n\n self.onmessage = (event) => {\n const { type, url, data } = event.data;\n\n switch (type) {\n case 'CONNECT':\n connectSocket(url);\n break;\n case 'SEND':\n send(data);\n break;\n case 'DISCONNECT':\n disconnect();\n break;\n }\n };\n\n function connectSocket(url) {\n _socket = new WebSocket(url);\n _socket.binaryType = 'arraybuffer';\n bindSocketHandlers();\n return _socket;\n }\n\n function send(packet) {\n try {\n _socket?.send(packet);\n } catch (error) {\n self.postMessage({\n type: 'SEND_FAIL', \n error: {\n message: error.message,\n name: error.name,\n },\n });\n }\n }\n\n function bindSocketHandlers() {\n if (_socket) {\n _socket.onopen = (event) => {\n self.postMessage({\n type: 'OPEN',\n data: {\n type: event.type,\n timeStamp: event.timeStamp,\n },\n });\n };\n\n _socket.onmessage = (event) => {\n self.postMessage({ \n type: 'MESSAGE',\n data: event.data,\n });\n };\n\n _socket.onclose = (event) => {\n self.postMessage({ \n type: 'CLOSE', \n data: { \n code: event.code,\n reason: event.reason,\n timeStamp: event.timeStamp,\n },\n });\n };\n\n _socket.onerror = (error) => {\n self.postMessage({\n type: 'ERROR',\n data: {\n message: error.message,\n name: error.name\n },\n });\n };\n }\n }\n\n function unbindSocketHandlers() {\n if (_socket) {\n _socket.onopen = null;\n _socket.onmessage = null;\n _socket.onclose = null;\n _socket.onerror = null;\n }\n }\n\n function disconnect() {\n if (_socket) {\n _socket.close();\n _socket = null;\n }\n }\n"],{type:"application/javascript"});this._worker=new Worker(URL.createObjectURL(Z)),this._worker.postMessage({type:"CONNECT",url:J})}send(J){var Z,ee;try{null===(Z=this._worker)||void 0===Z||Z.postMessage({type:"SEND",data:J})}catch(J){null===(ee=this._onSendFail)||void 0===ee||ee.call(this,J)}}bindSocketHandlers(J){const{onOpen:Z,onMessage:ee,onClose:ne,onError:se,onSendFail:re}=J;if(this._worker){const J={[Pi]:Z,[Ui]:ee,[Gi]:ne,[Bi]:se,[ji]:re};this._onSendFail=re,this._worker.onmessage=Z=>{var ee;const{type:ne}=(null==Z?void 0:Z.data)||{};"function"==typeof J[ne]&&(null===(ee=J[ne])||void 0===ee||ee.call(J,null==Z?void 0:Z.data))}}}unbindSocketHandlers(){this._worker&&(this._worker.onmessage=null)}disconnect(){this._worker&&(this._worker.postMessage({type:"DISCONNECT"}),this._worker.terminate(),this._worker=null),this._blobUrl&&(URL.revokeObjectURL(this._blobUrl),this._blobUrl=null)}}var Hi,Ki=new class{constructor(){this._store=new Map}get(J){return this._store.get(J)}getStorage(J){return Rs?Ms?my.getStorageSync({key:J}).data:Ps.getStorageSync(J):this._canUseLocalStorage()?localStorage.getItem(J):{}}set(J,Z){const ee=this._store.get(J)||{};Z instanceof Map?this._store.set(J,Z):this._store.set(J,Object.assign(Object.assign({},ee),Z))}setStorage(J,Z){Rs?Ms?my.setStorageSync({key:J,data:JSON.stringify(Z)}):Ps.setStorageSync(J,JSON.stringify(Z)):this._canUseLocalStorage()&&localStorage.setItem(J,JSON.stringify(Z))}clear(J){"string"==typeof J?this._store.set(J,{}):this._store.clear()}clearLocalStorage(J){this._canUseLocalStorage()&&("string"==typeof J?localStorage.setItem(J,""):localStorage.clear())}reset(){this.clear()}_canUseLocalStorage(){return"undefined"!=typeof window&&navigator&&navigator.cookieEnabled&&localStorage}};class Ke{connectSocket(J){return this._socket=Ps.connectSocket({url:J,header:{"content-type":"application/json"},multiple:!0,complete:()=>{}}),this._socket}send(J){var Z;null===(Z=this._socket)||void 0===Z||Z.send({data:J,fail:this._onSendFail})}bindSocketHandlers(J){const{onOpen:Z,onMessage:ee,onClose:ne,onError:se,onSendFail:re}=J;this._socket&&(this._socket.onClose(ne),this._socket.onOpen(Z),this._socket.onMessage((J=>ee(null==J?void 0:J.data))),this._socket.onError((()=>se)),this._onSendFail=re)}unbindSocketHandlers(){this._socket&&(this._socket.onClose((()=>{})),this._socket.onOpen((()=>{})),this._socket.onMessage((()=>{})),this._socket.onError((()=>{})))}disconnect(){this._socket&&(this._socket.close(),this._socket=null)}}!function(J){J[J.CONNECTED=0]="CONNECTED",J[J.CONNECTING=1]="CONNECTING",J[J.DISCONNECTED=2]="DISCONNECTED"}(Hi||(Hi={}));class We{constructor(J){this._url="",this._readyState=Hi.DISCONNECTED,this._url=J,this._id=c(),this._emitter=new Oe,vs||Ts||Ss||Is||bs||Cs?this._socket=new Ge({onError:this._onError.bind(this)}):Ms?this._socket=new Ke:this._canUseWebWorker()?this._socket=new Be:this._socket=new Pe,this.connect()}connect(){this.doOpen(),this._bindSocketHandlers()}doOpen(){[Hi.CONNECTED,Hi.CONNECTING].includes(this._readyState)||(this._readyState=Hi.CONNECTING,this._ws=this._socket.connectSocket(this._url))}send(J){this._readyState!==Hi.CONNECTED?this.reconnect():this._socket.send(J)}reconnect(){[Hi.CONNECTED,Hi.CONNECTING].includes(this._readyState)||(this.disconnect(),this.doOpen())}getId(){return this._id}on(J,Z,ee){this._emitter.on(J,Z,ee)}off(J,Z,ee){this._emitter.off(J,Z,ee)}isConnected(){return this._readyState===Hi.CONNECTED}disconnect(){this._readyState=Hi.DISCONNECTED,this._unbindSocketHandlers(),this._socket.disconnect()}_onOpen(J){this._readyState===Hi.CONNECTING&&(this._readyState=Hi.CONNECTED,this._emitter.emit("connect",{socketId:this._id,event:J}))}_onMessage(J){this._emitter.emit("message",J)}_onClose(J){this._readyState=Hi.DISCONNECTED,this._emitter.emit("close",{socketId:this._id,event:J})}_onError(J){this._readyState=Hi.DISCONNECTED,this._emitter.emit("error",{socketId:this._id,error:J})}_onSendFail(J){this._readyState=Hi.DISCONNECTED,this._emitter.emit("sendFail",{socketId:this._id,error:J})}_bindSocketHandlers(){this._socket.bindSocketHandlers({onOpen:this._onOpen.bind(this),onMessage:this._onMessage.bind(this),onClose:this._onClose.bind(this),onError:this._onError.bind(this),onSendFail:this._onSendFail.bind(this)})}_unbindSocketHandlers(){this._socket.unbindSocketHandlers()}_canUseWebWorker(){const J=Ki.get("cloudConfig")||{};return(e(J.isWorkerEnabled)||"1"===J.isWorkerEnabled)&&yi}}const Wi={[ps.SINGAPORE]:[[2e7,3e7],[172e7,173e7]],[ps.KOREA]:[[3e7,4e7],[173e7,174e7]],[ps.GERMANY]:[[4e7,5e7],[174e7,175e7]],[ps.IND]:[[5e7,6e7],[175e7,176e7]],[ps.JPN]:[[6e7,7e7],[176e7,177e7]],[ps.USA]:[[7e7,8e7],[177e7,178e7]],[ps.INDONESIA]:[[8e7,9e7],[178e7,179e7]],[ps.KSA]:[[9e7,1e8],[179e7,18e8]]};function ze(J){var Z;if(null===(Z=Ki.get("instance"))||void 0===Z?void 0:Z.oversea)return ps.OVERSEA;for(const Z of Object.keys(Wi))for(const[ee,ne]of Wi[Z])if(J>=ee&&J<ne)return Z;return ps.CHINA}var Yi,zi="4.3.0";!function(J){J.INITIAL="INITIAL",J.DEFAULT="DEFAULT",J.BACKUP="BACKUP",J.BACKUP_WEB_ONLY="BACKUP_WEB_ONLY",J.BACKUP_CN="BACKUP_CN",J.ANYCAST="ANYCAST",J.IPV6="IPV6"}(Yi||(Yi={}));let Ji=Yi.INITIAL;function Ze(){const J=Math.random();return 0===J?Ze():J}function et(J,Z){const{isBinary:ee=!1}=Z||{},ne=Ki.get("instance"),{sdkAppId:se,instanceId:re}=ne,ae=Ze(),le=de(),pe=function(){const J=de();let Z=-1;return"ios"===J?Z=Zs||-1:"android"===J&&(Z=Qs||-1),Z}(),_e=(ve={sdkappid:se,instanceid:re,random:ae,platform:xs,host:le,version:pe,sdkversion:zi},Object.keys(ve).map((J=>`${J}=${ve[J]}`)).join("&"));var ve;return ee?`${J}/binfo?${_e}&compress=gzip`:`${J}/info?${_e}`}var Zi=new class{constructor(){this._timeOffsetWithServer=0}getServerTimeMs(){return Date.now()+this._timeOffsetWithServer}getServerTimeSeconds(){return Math.floor(this.getServerTimeMs()/1e3)}getTimeOffsetWithServer(){return this._timeOffsetWithServer}calculateTimeOffsetWithServer(J,Z){const ee=Date.now(),ne=ee-J;this._timeOffsetWithServer=Z+ne-ee}};const Xi=16;var Qi=new class{constructor(){this._tasks=[],this._timer=null,this._taskMap=new Map}_addTaskToScheduler(J){const{id:Z}=J;this.removeTask(Z),this._tasks.push(J),this._taskMap.set(Z,J),this._sort(),this._scheduleNextTask()}_createTask(J){const{id:Z,callback:ee,context:ne,isOnce:se=!1,intervalMs:re=Xi}=J,ae=Math.max(re,Xi);return{id:Z,nextExecuteTime:Date.now()+ae,intervalMs:re,callback:ee,context:ne,isOnce:se}}addTask(J){const Z=this._createTask(J);this._addTaskToScheduler(Z)}addOnceTask(J){const Z=this._createTask(Object.assign(Object.assign({},J),{isOnce:!0}));this._addTaskToScheduler(Z)}removeTask(J){const Z=this._tasks.findIndex((Z=>Z.id===J));Z>-1&&(this._tasks.splice(Z,1),this._taskMap.delete(J),this._scheduleNextTask())}updateTaskInterval(J,Z){const ee=this._taskMap.get(J);ee&&(ee.intervalMs=Z,ee.nextExecuteTime=Date.now()+Z,this._sort(),this._scheduleNextTask())}clearAllTasks(){this._tasks=[],this._taskMap.clear(),this._timer&&(clearTimeout(this._timer),this._timer=null)}dispose(){this.clearAllTasks()}_sort(){this._tasks.sort(((J,Z)=>J.nextExecuteTime-Z.nextExecuteTime))}_scheduleNextTask(){this._timer&&(clearTimeout(this._timer),this._timer=null);const J=this._tasks[0];if(J){const Z=Math.max(0,J.nextExecuteTime-Date.now());this._timer=setTimeout((()=>this._execute()),Z)}}_execute(){const J=Date.now();for(;this._tasks.length&&this._tasks[0].nextExecuteTime<=J;){const Z=this._tasks[0];try{Z.context?Z.callback.call(Z.context):Z.callback(),Z.isOnce?this.removeTask(Z.id):(Z.nextExecuteTime=J+Z.intervalMs,this._sort())}catch(J){console.warn(`Task ${Z.id} execution failed:`,J),Z.isOnce&&this.removeTask(Z.id)}}this._scheduleNextTask()}};function rt(J){const Z=[];for(let ee=0;ee<J.length;ee+=1){const ne=J.charCodeAt(ee);if(ne>=55296&&ne<=56319){const se=J.charCodeAt(++ee)-56320+(ne-55296<<10)+65536;Z.push(240|se>>18,128|se>>12&63,128|se>>6&63,128|63&se)}else ne<=127?Z.push(ne):ne<=2047?Z.push(192|ne>>6,128|63&ne):Z.push(224|ne>>12,128|ne>>6&63,128|63&ne)}return new Uint8Array(Z)}function at(J){const Z=Array.isArray(J)?[]:Object.create(null);for(const ee in J)Object.prototype.hasOwnProperty.call(J,ee)&&r(ee)&&null!=J[ee]&&(null===J[ee]||"object"!=typeof J[ee]?Z[ee]=J[ee]:Z[ee]=at(J[ee]));return Z}function ct(J,Z){if(is.includes(J))return 0;const ee=rt(JSON.stringify(Z));let ne=4294967295;const{length:se}=ee;for(let J=0;J<se;J++){ne^=ee[J];for(let J=0;J<8;J++)1&~ne?ne>>>=1:ne=ne>>>1^3988292384}return(4294967295^ne)>>>0}function ut(J){const{servcmd:Z,data:ee}=J,ne=function(J){const Z=Ki.get("login")||{},ee=Ki.get("instance")||{};return{servcmd:J,ver:"v4",platform:xs,websdkappid:537048168,websdkversion:"1.7.3",a2:Z.a2Key||void 0,tinyid:Z.tinyID||void 0,status_instid:Z.statusInstanceId||0,sdkappid:ee.sdkAppId,contenttype:"json",reqtime:Math.floor(Date.now()/1e3),identifier:Z.a2Key?void 0:Z.userId,usersig:Z.a2Key?void 0:Z.userSig,sdkability:478343027,sdkability_ext:l(""),cappid:ee.applicationID||0,tjgID:"",seq:ht(),cs:0}}(Z),se=at(ee);return ne.cs=ct(Z,se),{head:ne,body:se}}function lt(J){const{servcmd:Z,data:ee}=J,ne=function(J){const Z=Ki.get("login")||{},ee=Ki.get("instance")||{};return{servcmd:J,ver:"v4",platform:xs,websdkappid:537048168,websdkversion:"1.7.3",sdkappid:ee.sdkAppId,contenttype:"",reqtime:Math.floor(Date.now()/1e3),identifier:"",usersig:"",status_instid:Z.statusInstanceId||0,sdkability:478343027,sdkability_ext:l(""),cappid:ee.applicationID||0,seq:ht(),cs:0}}(Z),se=at(ee);return ne.cs=ct(Z,se),{head:ne,body:se}}let er=c();function ht(){return er=er<2415919103?er+1:c(),er}function gt(){var J;const Z=Ki.get("login")||{},ee=Ki.get("instance")||{};return{sdk_type:30,sdk_app_id:ee.sdkAppId,sdk_version:"4.3.0",tiny_id:Number(Z.tinyID),user_id:Z.userId||(null===(J=Ki.get("webPush"))||void 0===J?void 0:J.userId),platform:xs,instance_id:ee.instanceId,trace_id:(new Date).getTime()}}var nr,dr=Object.freeze({__proto__:null,calcBodyCRC:ct,filterProtocolDataInvalidFields:at,generateCosSpecifiedData:function(J){const{servcmd:Z,data:ee}=J,ne=function(J){const Z=Ki.get("login")||{},ee=Ki.get("instance")||{};return{servcmd:J,ver:"v4",platform:xs,websdkappid:537048168,websdkversion:"1.7.3",sdkappid:ee.sdkAppId,contenttype:"json",reqtime:Math.floor(Date.now()/1e3),identifier:Z.userId,usersig:Z.userSig,status_instid:Z.statusInstanceId||0,sdkability:478343027,sdkability_ext:l(""),cappid:ee.applicationID||0,seq:ht(),cs:0}}(Z),se=at(ee);return ne.cs=ct(Z,se),{head:ne,body:se}},generateProtocolData:ut,generateSSOLogProtocolData:lt,generateSequence:ht,getCommonHead:gt,getHostSite:ze,taskScheduler:Qi,timeManager:Zi});!function(J){J[J.info=4]="info",J[J.warning=5]="warning",J[J.error=6]="error"}(nr||(nr={}));const pr={method:"extension",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",uiPlatform:"ui_platform",timestamp:"timestamp"};class vt{constructor(J){this.level=nr.info,this._canSendLog=!0,this._logCreatedAt=Zi.getServerTimeMs(),this.timestamp=0,this.networkType=8,this.code=0,this.moreMessage="",this.method="",this.message="",this.costTime=0,this.duplicate=!1,this.eventType=0,this.uiPlatform=this._getUiPlatform(),this._sdkEdition=this._getSDKEdition();const{method:Z,eventType:ee=0,message:ne="",costTime:se=0,error:re,uiPlatform:ae,moreMessage:le="",code:pe=0}=J||{};this.eventType=ee,this.method=Z,this.message=ne,this.costTime=se,this.moreMessage=le,this.code=pe,re&&this.setError(re),Ie(ae)||(this.uiPlatform=ae)}setMoreMessage(J){this.moreMessage=`${this.moreMessage} ${J}`}updateLogCreatedAtByTimeOffset(){this._logCreatedAt+=Zi.getTimeOffsetWithServer()}end(J=!1){this._canSendLog&&(this._canSendLog=!1,this.timestamp=Zi.getServerTimeMs(),this._ssoLogModule.pushToLogQueue(this._convertSSOLogDataKeyToServe()),J&&this._ssoLogModule.uploadSSOLogData())}setError(J){var Z;return J instanceof Error?this._canSendLog?((null===(Z=Ki.get("netWorkMonitor"))||void 0===Z?void 0:Z.isNetworkOnline)&&(J.errorCode&&(this.code=J.errorCode),J.errorMessage&&this.setMoreMessage(J.errorMessage)),this.level=nr.error,this):this:(console.warn("SSOLogData.setError value not instanceof Error, please check!"),this)}setLogInfo(J){return Object.keys(J).forEach((Z=>{Object.keys(pr).includes(Z)&&(this[Z]=J[Z])})),this}setSSOLogModule(J){this._ssoLogModule=J}_convertSSOLogDataKeyToServe(){const J={};return Object.keys(this).forEach((Z=>{const ee=Z;pr[ee]&&(J[pr[ee]]=this[ee])})),J}_getUiPlatform(){var J;const Z=null===(J=Ki.get("instance"))||void 0===J?void 0:J.scene;if("string"==typeof Z){const J=Number(Z);return isNaN(J)?void 0:J}}_getSDKEdition(){var J;return null===(J=Ki.get("instance"))||void 0===J?void 0:J.sdkEdition}}var wr;!function(J){J.RECONNECTED="reconnected",J.CLOUD_CONFIG_UPDATE="cloud_config_update",J.SOCKET_DISCONNECTED="socket_disconnected"}(wr||(wr={}));var Rr=wr;const Pr=20,qr=6e4,jr=[4,5,6],zr=[],Xr=[],eo="report-logger";var to=new class{constructor(){this._sdkAppIdBlackList=[],this._tinyIdWhiteList=[],this._reportLevel=[4,5,6],this._minThreshold=Pr,this._maxThreshold=100,this._waitingTime=qr,this._lastReportAt=Date.now(),this._ssoLogMap=new Map,this._logLevel=rs.DEBUG,this._throttleConfig={global:{throttleTime:hs,maxCount:ds},single:{throttleTime:us,maxCount:ls}},this._globalThrottle={count:0,startTime:Date.now()},this._singleThrottleMap=new Map,Li.subscribeInnerEvent(Rr.CLOUD_CONFIG_UPDATE,this._handleCloudConfigUpdate,this),Qi.addTask({id:eo,intervalMs:1e3,callback:this._checkAndReportIfDue,context:this}),this._logQueue=[],this._savePlatFormInfo()}_handleCloudConfigUpdate(J){const{evt_rpt_threshold:Z=Pr,evt_rpt_waiting:ee=qr,evt_rpt_level:ne=jr,evt_rpt_sdkappid_bl:se=zr,evt_rpt_tinyid_wl:re=Xr,evt_rpt_global_throttle_time:ae=hs,evt_rpt_global_throttle_count:le=ds,evt_rpt_single_throttle_time:pe=us,evt_rpt_single_throttle_count:_e=ls}=J||{};this._sdkAppIdBlackList=se,this._waitingTime=ee,this._minThreshold=Z,this._reportLevel=ne,this._tinyIdWhiteList=re,this._throttleConfig={global:{throttleTime:ae,maxCount:le},single:{throttleTime:pe,maxCount:_e}}}createSSOLogData(J){const Z=new vt(J);return Z.setSSOLogModule(this),this._ssoLogMap.set(J.method,Z),Z}getSSOLogData(J){return this._ssoLogMap.get(J)||{}}pushToLogQueue(J){J&&(this._logQueue.push(J),this._shouldUploadImmediately()&&this.uploadSSOLogData())}setLogLevel(J){[rs.DEBUG,rs.ERROR,rs.INFO,rs.NONE,rs.WARN].includes(J)&&(this._logLevel=J)}debug(J,Z="",ee){this._log(rs.DEBUG,J,Z,ee)}info(J,Z="",ee){this._log(rs.INFO,J,Z,ee)}warn(J,Z="",ee){this._log(rs.WARN,J,Z,ee)}error(J,Z="",ee){this._log(rs.ERROR,J,Z,ee)}_shouldUploadImmediately(){return this._logQueue.length>=this._minThreshold}_isReportDue(){return Date.now()>=this._lastReportAt+this._waitingTime}_checkAndReportIfDue(){this._isReportDue()&&this._logQueue.length>0&&this.uploadSSOLogData()}uploadSSOLogData(){return ge(this,void 0,void 0,(function*(){try{if(0===this._logQueue.length)return;const J=this._logQueue.slice(),Z=this._filterLogs(J);if(this._logQueue=[],0===Z.length)return void(this._lastReportAt=Date.now());const ee={Header:gt(),Event:Z};Ie(ee.Header.user_id)||(yield function(J){const Z="imopenstat.tim_web_report_v2",ee=lt({servcmd:Z,data:J}),ne=`${ee.head.seq}${Z}`;return go.sendPacket(ee,{requestId:ne})}(ee)),this._lastReportAt=Date.now()}catch(J){this.debug("uploadSSOLogData",Se(J))}}))}_savePlatFormInfo(){var J,Z;if(vs){const ee=null===(Z=null===(J=wx.getAccountInfoSync)||void 0===J?void 0:J.call(wx))||void 0===Z?void 0:Z.miniProgram;if(ee){const{appId:J,envVersion:Z}=ee;Ki.set("instance",{appId:J,envVersion:Z})}}else ks&&Ki.set("instance",{href:window.location.href})}_filterLogs(J){const{tinyID:Z}=Ki.get("login")||{},{sdkAppId:ee}=Ki.get("instance")||{};return this._sdkAppIdBlackList.includes(ee)&&!this._tinyIdWhiteList.includes(Z)?[]:J.filter((J=>this._reportLevel.includes(J.level)))}_checkThrottle(J){return!!this._checkGlobalThrottle()||this._checkSingleThrottle(J)}_checkGlobalThrottle(){const J=Date.now();if(J-this._globalThrottle.startTime>=this._throttleConfig.global.throttleTime)this._globalThrottle.count=1,this._globalThrottle.startTime=J;else if(this._globalThrottle.count++,this._globalThrottle.count>this._throttleConfig.global.maxCount)return!0;return!1}_checkSingleThrottle(J){const Z=Date.now(),ee=this._singleThrottleMap.get(J);return ee?Z-ee.startTime>=this._throttleConfig.single.throttleTime?(ee.count=1,ee.startTime=Z,!1):ee.count>=this._throttleConfig.single.maxCount||(ee.count++,!1):(this._singleThrottleMap.set(J,{count:1,startTime:Z}),!1)}_shouldLog(J){return J>=this._logLevel&&this._logLevel!==rs.NONE}_shouldReport(J){return this._reportLevel.includes(cs[J])}_formatLog(J,Z,ee){const ne=new Date,se=`${ne.getHours()}:${ne.getMinutes()}:${ne.getSeconds()}:${ne.getMilliseconds()}`,re=`<${rs[J]}>`;return ui||Rs?[`${os} [${se}] ${re} [${Z}] ${ee}`]:["%c%s%c%s","background:#0abf5b; padding:1px; border-radius:3px; color: #fff",os,"",`[${se}] ${re} [${Z}] ${ee}`]}_log(J,Z,ee,ne){if(!this._shouldLog(J))return;const se=this._formatLog(J,Z,ee);if(as[J].apply(console,se),this._shouldReport(J)){const J=this._getThrottleKey(Z,ee,ne);this._checkThrottle(J)||this.createSSOLogData(Object.assign(Object.assign({message:ee},ne),{method:Z})).end()}}_getThrottleKey(J,Z,ee){const ne=`${J}${Z}${Se(Object.assign(Object.assign({},ee),{costTime:""}))}`,se=rt(JSON.stringify(ne));let re=4294967295;const{length:ae}=se;for(let J=0;J<ae;J++){re^=se[J];for(let J=0;J<8;J++)1&~re?re>>>=1:re=re>>>1^3988292384}return""+((4294967295^re)>>>0)}reset(){console.log("SSO_LOG_MODULE.reset"),Qi.removeTask(eo),Li.unSubscribeInnerEvent(Rr.CLOUD_CONFIG_UPDATE,this._handleCloudConfigUpdate,this),this._lastReportAt=0,this.uploadSSOLogData(),this._sdkAppIdBlackList=[],this._tinyIdWhiteList=[],this._minThreshold=Pr,this._maxThreshold=100,this._waitingTime=qr,this._logQueue=[],this._logLevel=rs.DEBUG,this._globalThrottle={count:0,startTime:Date.now()},this._singleThrottleMap.clear()}};const no=15e3,so="Channel",io="channel_schedule_task",ro="channel_reconnect_task",oo="connected",ao="disconnected",co=1e3,uo="network_status_change";function Vt(J){return Vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(J){return typeof J}:function(J){return J&&"function"==typeof Symbol&&J.constructor===Symbol&&J!==Symbol.prototype?"symbol":typeof J},Vt(J)}function Bt(J){throw new Error('Could not dynamically require "'+J+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var lo,ho={exports:{}},po=(lo||(lo=1,ho.exports=function e(J,Z,ee){function o(se,re){if(!Z[se]){if(!J[se]){if(!re&&Bt)return Bt(se);if(ne)return ne(se,!0);var ae=new Error("Cannot find module '"+se+"'");throw ae.code="MODULE_NOT_FOUND",ae}var le=Z[se]={exports:{}};J[se][0].call(le.exports,(function(Z){return o(J[se][1][Z]||Z)}),le,le.exports,e,J,Z,ee)}return Z[se].exports}for(var ne=Bt,se=0;se<ee.length;se++)o(ee[se]);return o}({1:[function(J,Z,ee){var ne="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;ee.assign=function(J){for(var Z,ee,ne=Array.prototype.slice.call(arguments,1);ne.length;){var se=ne.shift();if(se){if("object"!=Vt(se))throw new TypeError(se+"must be non-object");for(var re in se)Z=se,ee=re,Object.prototype.hasOwnProperty.call(Z,ee)&&(J[re]=se[re])}}return J},ee.shrinkBuf=function(J,Z){return J.length===Z?J:J.subarray?J.subarray(0,Z):(J.length=Z,J)};var se={arraySet:function(J,Z,ee,ne,se){if(Z.subarray&&J.subarray)J.set(Z.subarray(ee,ee+ne),se);else for(var re=0;re<ne;re++)J[se+re]=Z[ee+re]},flattenChunks:function(J){var Z,ee,ne,se,re,ae;for(Z=ne=0,ee=J.length;Z<ee;Z++)ne+=J[Z].length;for(ae=new Uint8Array(ne),Z=se=0,ee=J.length;Z<ee;Z++)re=J[Z],ae.set(re,se),se+=re.length;return ae}},re={arraySet:function(J,Z,ee,ne,se){for(var re=0;re<ne;re++)J[se+re]=Z[ee+re]},flattenChunks:function(J){return[].concat.apply([],J)}};ee.setTyped=function(J){J?(ee.Buf8=Uint8Array,ee.Buf16=Uint16Array,ee.Buf32=Int32Array,ee.assign(ee,se)):(ee.Buf8=Array,ee.Buf16=Array,ee.Buf32=Array,ee.assign(ee,re))},ee.setTyped(ne)},{}],2:[function(J,Z,ee){var ne=J("./common"),se=!0,re=!0;try{String.fromCharCode.apply(null,[0])}catch(J){se=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(J){re=!1}for(var ae=new ne.Buf8(256),le=0;le<256;le++)ae[le]=252<=le?6:248<=le?5:240<=le?4:224<=le?3:192<=le?2:1;function c(J,Z){if(Z<65534&&(J.subarray&&re||!J.subarray&&se))return String.fromCharCode.apply(null,ne.shrinkBuf(J,Z));for(var ee="",ae=0;ae<Z;ae++)ee+=String.fromCharCode(J[ae]);return ee}ae[254]=ae[254]=1,ee.string2buf=function(J){var Z,ee,se,re,ae,le=J.length,pe=0;for(re=0;re<le;re++)55296==(64512&(ee=J.charCodeAt(re)))&&re+1<le&&56320==(64512&(se=J.charCodeAt(re+1)))&&(ee=65536+(ee-55296<<10)+(se-56320),re++),pe+=ee<128?1:ee<2048?2:ee<65536?3:4;for(Z=new ne.Buf8(pe),re=ae=0;ae<pe;re++)55296==(64512&(ee=J.charCodeAt(re)))&&re+1<le&&56320==(64512&(se=J.charCodeAt(re+1)))&&(ee=65536+(ee-55296<<10)+(se-56320),re++),ee<128?Z[ae++]=ee:(ee<2048?Z[ae++]=192|ee>>>6:(ee<65536?Z[ae++]=224|ee>>>12:(Z[ae++]=240|ee>>>18,Z[ae++]=128|ee>>>12&63),Z[ae++]=128|ee>>>6&63),Z[ae++]=128|63&ee);return Z},ee.buf2binstring=function(J){return c(J,J.length)},ee.binstring2buf=function(J){for(var Z=new ne.Buf8(J.length),ee=0,se=Z.length;ee<se;ee++)Z[ee]=J.charCodeAt(ee);return Z},ee.buf2string=function(J,Z){var ee,ne,se,re,le=Z||J.length,pe=new Array(2*le);for(ee=ne=0;ee<le;)if((se=J[ee++])<128)pe[ne++]=se;else if(4<(re=ae[se]))pe[ne++]=65533,ee+=re-1;else{for(se&=2===re?31:3===re?15:7;1<re&&ee<le;)se=se<<6|63&J[ee++],re--;1<re?pe[ne++]=65533:se<65536?pe[ne++]=se:(se-=65536,pe[ne++]=55296|se>>10&1023,pe[ne++]=56320|1023&se)}return c(pe,ne)},ee.utf8border=function(J,Z){var ee;for((Z=Z||J.length)>J.length&&(Z=J.length),ee=Z-1;0<=ee&&128==(192&J[ee]);)ee--;return ee<0||0===ee?Z:ee+ae[J[ee]]>Z?ee:Z}},{"./common":1}],3:[function(J,Z,ee){Z.exports=function(J,Z,ee,ne){for(var se=65535&J,re=J>>>16&65535,ae=0;0!==ee;){for(ee-=ae=2e3<ee?2e3:ee;re=re+(se=se+Z[ne++]|0)|0,--ae;);se%=65521,re%=65521}return se|re<<16}},{}],4:[function(J,Z,ee){Z.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(J,Z,ee){var ne=function(){for(var J,Z=[],ee=0;ee<256;ee++){J=ee;for(var ne=0;ne<8;ne++)J=1&J?3988292384^J>>>1:J>>>1;Z[ee]=J}return Z}();Z.exports=function(J,Z,ee,se){var re=ne,ae=se+ee;J^=-1;for(var le=se;le<ae;le++)J=J>>>8^re[255&(J^Z[le])];return~J}},{}],6:[function(J,Z,ee){Z.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],7:[function(J,Z,ee){Z.exports=function(J,Z){var ee,ne,se,re,ae,le,pe,_e,ve,ye,Fe,qe,$e,He,Ye,Je,Xe,Qe,tt,nt,it,ot,pt,mt,It;ee=J.state,ne=J.next_in,mt=J.input,se=ne+(J.avail_in-5),re=J.next_out,It=J.output,ae=re-(Z-J.avail_out),le=re+(J.avail_out-257),pe=ee.dmax,_e=ee.wsize,ve=ee.whave,ye=ee.wnext,Fe=ee.window,qe=ee.hold,$e=ee.bits,He=ee.lencode,Ye=ee.distcode,Je=(1<<ee.lenbits)-1,Xe=(1<<ee.distbits)-1;e:do{$e<15&&(qe+=mt[ne++]<<$e,$e+=8,qe+=mt[ne++]<<$e,$e+=8),Qe=He[qe&Je];t:for(;;){if(qe>>>=tt=Qe>>>24,$e-=tt,0==(tt=Qe>>>16&255))It[re++]=65535&Qe;else{if(!(16&tt)){if(!(64&tt)){Qe=He[(65535&Qe)+(qe&(1<<tt)-1)];continue t}if(32&tt){ee.mode=12;break e}J.msg="invalid literal/length code",ee.mode=30;break e}nt=65535&Qe,(tt&=15)&&($e<tt&&(qe+=mt[ne++]<<$e,$e+=8),nt+=qe&(1<<tt)-1,qe>>>=tt,$e-=tt),$e<15&&(qe+=mt[ne++]<<$e,$e+=8,qe+=mt[ne++]<<$e,$e+=8),Qe=Ye[qe&Xe];n:for(;;){if(qe>>>=tt=Qe>>>24,$e-=tt,!(16&(tt=Qe>>>16&255))){if(!(64&tt)){Qe=Ye[(65535&Qe)+(qe&(1<<tt)-1)];continue n}J.msg="invalid distance code",ee.mode=30;break e}if(it=65535&Qe,$e<(tt&=15)&&(qe+=mt[ne++]<<$e,($e+=8)<tt&&(qe+=mt[ne++]<<$e,$e+=8)),pe<(it+=qe&(1<<tt)-1)){J.msg="invalid distance too far back",ee.mode=30;break e}if(qe>>>=tt,$e-=tt,(tt=re-ae)<it){if(ve<(tt=it-tt)&&ee.sane){J.msg="invalid distance too far back",ee.mode=30;break e}if(pt=Fe,(ot=0)===ye){if(ot+=_e-tt,tt<nt){for(nt-=tt;It[re++]=Fe[ot++],--tt;);ot=re-it,pt=It}}else if(ye<tt){if(ot+=_e+ye-tt,(tt-=ye)<nt){for(nt-=tt;It[re++]=Fe[ot++],--tt;);if(ot=0,ye<nt){for(nt-=tt=ye;It[re++]=Fe[ot++],--tt;);ot=re-it,pt=It}}}else if(ot+=ye-tt,tt<nt){for(nt-=tt;It[re++]=Fe[ot++],--tt;);ot=re-it,pt=It}for(;2<nt;)It[re++]=pt[ot++],It[re++]=pt[ot++],It[re++]=pt[ot++],nt-=3;nt&&(It[re++]=pt[ot++],1<nt&&(It[re++]=pt[ot++]))}else{for(ot=re-it;It[re++]=It[ot++],It[re++]=It[ot++],It[re++]=It[ot++],2<(nt-=3););nt&&(It[re++]=It[ot++],1<nt&&(It[re++]=It[ot++]))}break}}break}}while(ne<se&&re<le);ne-=nt=$e>>3,qe&=(1<<($e-=nt<<3))-1,J.next_in=ne,J.next_out=re,J.avail_in=ne<se?se-ne+5:5-(ne-se),J.avail_out=re<le?le-re+257:257-(re-le),ee.hold=qe,ee.bits=$e}},{}],8:[function(J,Z,ee){var ne=J("../utils/common"),se=J("./adler32"),re=J("./crc32"),ae=J("./inffast"),le=J("./inftrees"),pe=-2;function _(J){return(J>>>24&255)+(J>>>8&65280)+((65280&J)<<8)+((255&J)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new ne.Buf16(320),this.work=new ne.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(J){var Z;return J&&J.state?(Z=J.state,J.total_in=J.total_out=Z.total=0,J.msg="",Z.wrap&&(J.adler=1&Z.wrap),Z.mode=1,Z.last=0,Z.havedict=0,Z.dmax=32768,Z.head=null,Z.hold=0,Z.bits=0,Z.lencode=Z.lendyn=new ne.Buf32(852),Z.distcode=Z.distdyn=new ne.Buf32(592),Z.sane=1,Z.back=-1,0):pe}function f(J){var Z;return J&&J.state?((Z=J.state).wsize=0,Z.whave=0,Z.wnext=0,v(J)):pe}function I(J,Z){var ee,ne;return J&&J.state?(ne=J.state,Z<0?(ee=0,Z=-Z):(ee=1+(Z>>4),Z<48&&(Z&=15)),Z&&(Z<8||15<Z)?pe:(null!==ne.window&&ne.wbits!==Z&&(ne.window=null),ne.wrap=ee,ne.wbits=Z,f(J))):pe}function E(J,Z){var ee,ne;return J?(ne=new m,(J.state=ne).window=null,0!==(ee=I(J,Z))&&(J.state=null),ee):pe}var _e,ve,ye=!0;function y(J){if(ye){var Z;for(_e=new ne.Buf32(512),ve=new ne.Buf32(32),Z=0;Z<144;)J.lens[Z++]=8;for(;Z<256;)J.lens[Z++]=9;for(;Z<280;)J.lens[Z++]=7;for(;Z<288;)J.lens[Z++]=8;for(le(1,J.lens,0,288,_e,0,J.work,{bits:9}),Z=0;Z<32;)J.lens[Z++]=5;le(2,J.lens,0,32,ve,0,J.work,{bits:5}),ye=!1}J.lencode=_e,J.lenbits=9,J.distcode=ve,J.distbits=5}function O(J,Z,ee,se){var re,ae=J.state;return null===ae.window&&(ae.wsize=1<<ae.wbits,ae.wnext=0,ae.whave=0,ae.window=new ne.Buf8(ae.wsize)),se>=ae.wsize?(ne.arraySet(ae.window,Z,ee-ae.wsize,ae.wsize,0),ae.wnext=0,ae.whave=ae.wsize):(se<(re=ae.wsize-ae.wnext)&&(re=se),ne.arraySet(ae.window,Z,ee-se,re,ae.wnext),(se-=re)?(ne.arraySet(ae.window,Z,ee-se,se,0),ae.wnext=se,ae.whave=ae.wsize):(ae.wnext+=re,ae.wnext===ae.wsize&&(ae.wnext=0),ae.whave<ae.wsize&&(ae.whave+=re))),0}ee.inflateReset=f,ee.inflateReset2=I,ee.inflateResetKeep=v,ee.inflateInit=function(J){return E(J,15)},ee.inflateInit2=E,ee.inflate=function(J,Z){var ee,_e,ve,ye,Fe,qe,$e,He,Ye,Je,Xe,Qe,tt,nt,it,ot,pt,mt,It,St,Mt,bt,At,Ot,wt=0,Dt=new ne.Buf8(4),Lt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!J||!J.state||!J.output||!J.input&&0!==J.avail_in)return pe;12===(ee=J.state).mode&&(ee.mode=13),Fe=J.next_out,ve=J.output,$e=J.avail_out,ye=J.next_in,_e=J.input,qe=J.avail_in,He=ee.hold,Ye=ee.bits,Je=qe,Xe=$e,bt=0;e:for(;;)switch(ee.mode){case 1:if(0===ee.wrap){ee.mode=13;break}for(;Ye<16;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}if(2&ee.wrap&&35615===He){Dt[ee.check=0]=255&He,Dt[1]=He>>>8&255,ee.check=re(ee.check,Dt,2,0),Ye=He=0,ee.mode=2;break}if(ee.flags=0,ee.head&&(ee.head.done=!1),!(1&ee.wrap)||(((255&He)<<8)+(He>>8))%31){J.msg="incorrect header check",ee.mode=30;break}if(8!=(15&He)){J.msg="unknown compression method",ee.mode=30;break}if(Ye-=4,Mt=8+(15&(He>>>=4)),0===ee.wbits)ee.wbits=Mt;else if(Mt>ee.wbits){J.msg="invalid window size",ee.mode=30;break}ee.dmax=1<<Mt,J.adler=ee.check=1,ee.mode=512&He?10:12,Ye=He=0;break;case 2:for(;Ye<16;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}if(ee.flags=He,8!=(255&ee.flags)){J.msg="unknown compression method",ee.mode=30;break}if(57344&ee.flags){J.msg="unknown header flags set",ee.mode=30;break}ee.head&&(ee.head.text=He>>8&1),512&ee.flags&&(Dt[0]=255&He,Dt[1]=He>>>8&255,ee.check=re(ee.check,Dt,2,0)),Ye=He=0,ee.mode=3;case 3:for(;Ye<32;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}ee.head&&(ee.head.time=He),512&ee.flags&&(Dt[0]=255&He,Dt[1]=He>>>8&255,Dt[2]=He>>>16&255,Dt[3]=He>>>24&255,ee.check=re(ee.check,Dt,4,0)),Ye=He=0,ee.mode=4;case 4:for(;Ye<16;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}ee.head&&(ee.head.xflags=255&He,ee.head.os=He>>8),512&ee.flags&&(Dt[0]=255&He,Dt[1]=He>>>8&255,ee.check=re(ee.check,Dt,2,0)),Ye=He=0,ee.mode=5;case 5:if(1024&ee.flags){for(;Ye<16;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}ee.length=He,ee.head&&(ee.head.extra_len=He),512&ee.flags&&(Dt[0]=255&He,Dt[1]=He>>>8&255,ee.check=re(ee.check,Dt,2,0)),Ye=He=0}else ee.head&&(ee.head.extra=null);ee.mode=6;case 6:if(1024&ee.flags&&(qe<(Qe=ee.length)&&(Qe=qe),Qe&&(ee.head&&(Mt=ee.head.extra_len-ee.length,ee.head.extra||(ee.head.extra=new Array(ee.head.extra_len)),ne.arraySet(ee.head.extra,_e,ye,Qe,Mt)),512&ee.flags&&(ee.check=re(ee.check,_e,Qe,ye)),qe-=Qe,ye+=Qe,ee.length-=Qe),ee.length))break e;ee.length=0,ee.mode=7;case 7:if(2048&ee.flags){if(0===qe)break e;for(Qe=0;Mt=_e[ye+Qe++],ee.head&&Mt&&ee.length<65536&&(ee.head.name+=String.fromCharCode(Mt)),Mt&&Qe<qe;);if(512&ee.flags&&(ee.check=re(ee.check,_e,Qe,ye)),qe-=Qe,ye+=Qe,Mt)break e}else ee.head&&(ee.head.name=null);ee.length=0,ee.mode=8;case 8:if(4096&ee.flags){if(0===qe)break e;for(Qe=0;Mt=_e[ye+Qe++],ee.head&&Mt&&ee.length<65536&&(ee.head.comment+=String.fromCharCode(Mt)),Mt&&Qe<qe;);if(512&ee.flags&&(ee.check=re(ee.check,_e,Qe,ye)),qe-=Qe,ye+=Qe,Mt)break e}else ee.head&&(ee.head.comment=null);ee.mode=9;case 9:if(512&ee.flags){for(;Ye<16;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}if(He!==(65535&ee.check)){J.msg="header crc mismatch",ee.mode=30;break}Ye=He=0}ee.head&&(ee.head.hcrc=ee.flags>>9&1,ee.head.done=!0),J.adler=ee.check=0,ee.mode=12;break;case 10:for(;Ye<32;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}J.adler=ee.check=_(He),Ye=He=0,ee.mode=11;case 11:if(0===ee.havedict)return J.next_out=Fe,J.avail_out=$e,J.next_in=ye,J.avail_in=qe,ee.hold=He,ee.bits=Ye,2;J.adler=ee.check=1,ee.mode=12;case 12:if(5===Z||6===Z)break e;case 13:if(ee.last){He>>>=7&Ye,Ye-=7&Ye,ee.mode=27;break}for(;Ye<3;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}switch(ee.last=1&He,Ye-=1,3&(He>>>=1)){case 0:ee.mode=14;break;case 1:if(y(ee),ee.mode=20,6!==Z)break;He>>>=2,Ye-=2;break e;case 2:ee.mode=17;break;case 3:J.msg="invalid block type",ee.mode=30}He>>>=2,Ye-=2;break;case 14:for(He>>>=7&Ye,Ye-=7&Ye;Ye<32;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}if((65535&He)!=(He>>>16^65535)){J.msg="invalid stored block lengths",ee.mode=30;break}if(ee.length=65535&He,Ye=He=0,ee.mode=15,6===Z)break e;case 15:ee.mode=16;case 16:if(Qe=ee.length){if(qe<Qe&&(Qe=qe),$e<Qe&&(Qe=$e),0===Qe)break e;ne.arraySet(ve,_e,ye,Qe,Fe),qe-=Qe,ye+=Qe,$e-=Qe,Fe+=Qe,ee.length-=Qe;break}ee.mode=12;break;case 17:for(;Ye<14;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}if(ee.nlen=257+(31&He),He>>>=5,Ye-=5,ee.ndist=1+(31&He),He>>>=5,Ye-=5,ee.ncode=4+(15&He),He>>>=4,Ye-=4,286<ee.nlen||30<ee.ndist){J.msg="too many length or distance symbols",ee.mode=30;break}ee.have=0,ee.mode=18;case 18:for(;ee.have<ee.ncode;){for(;Ye<3;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}ee.lens[Lt[ee.have++]]=7&He,He>>>=3,Ye-=3}for(;ee.have<19;)ee.lens[Lt[ee.have++]]=0;if(ee.lencode=ee.lendyn,ee.lenbits=7,At={bits:ee.lenbits},bt=le(0,ee.lens,0,19,ee.lencode,0,ee.work,At),ee.lenbits=At.bits,bt){J.msg="invalid code lengths set",ee.mode=30;break}ee.have=0,ee.mode=19;case 19:for(;ee.have<ee.nlen+ee.ndist;){for(;ot=(wt=ee.lencode[He&(1<<ee.lenbits)-1])>>>16&255,pt=65535&wt,!((it=wt>>>24)<=Ye);){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}if(pt<16)He>>>=it,Ye-=it,ee.lens[ee.have++]=pt;else{if(16===pt){for(Ot=it+2;Ye<Ot;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}if(He>>>=it,Ye-=it,0===ee.have){J.msg="invalid bit length repeat",ee.mode=30;break}Mt=ee.lens[ee.have-1],Qe=3+(3&He),He>>>=2,Ye-=2}else if(17===pt){for(Ot=it+3;Ye<Ot;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}Ye-=it,Mt=0,Qe=3+(7&(He>>>=it)),He>>>=3,Ye-=3}else{for(Ot=it+7;Ye<Ot;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}Ye-=it,Mt=0,Qe=11+(127&(He>>>=it)),He>>>=7,Ye-=7}if(ee.have+Qe>ee.nlen+ee.ndist){J.msg="invalid bit length repeat",ee.mode=30;break}for(;Qe--;)ee.lens[ee.have++]=Mt}}if(30===ee.mode)break;if(0===ee.lens[256]){J.msg="invalid code -- missing end-of-block",ee.mode=30;break}if(ee.lenbits=9,At={bits:ee.lenbits},bt=le(1,ee.lens,0,ee.nlen,ee.lencode,0,ee.work,At),ee.lenbits=At.bits,bt){J.msg="invalid literal/lengths set",ee.mode=30;break}if(ee.distbits=6,ee.distcode=ee.distdyn,At={bits:ee.distbits},bt=le(2,ee.lens,ee.nlen,ee.ndist,ee.distcode,0,ee.work,At),ee.distbits=At.bits,bt){J.msg="invalid distances set",ee.mode=30;break}if(ee.mode=20,6===Z)break e;case 20:ee.mode=21;case 21:if(6<=qe&&258<=$e){J.next_out=Fe,J.avail_out=$e,J.next_in=ye,J.avail_in=qe,ee.hold=He,ee.bits=Ye,ae(J,Xe),Fe=J.next_out,ve=J.output,$e=J.avail_out,ye=J.next_in,_e=J.input,qe=J.avail_in,He=ee.hold,Ye=ee.bits,12===ee.mode&&(ee.back=-1);break}for(ee.back=0;ot=(wt=ee.lencode[He&(1<<ee.lenbits)-1])>>>16&255,pt=65535&wt,!((it=wt>>>24)<=Ye);){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}if(ot&&!(240&ot)){for(mt=it,It=ot,St=pt;ot=(wt=ee.lencode[St+((He&(1<<mt+It)-1)>>mt)])>>>16&255,pt=65535&wt,!(mt+(it=wt>>>24)<=Ye);){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}He>>>=mt,Ye-=mt,ee.back+=mt}if(He>>>=it,Ye-=it,ee.back+=it,ee.length=pt,0===ot){ee.mode=26;break}if(32&ot){ee.back=-1,ee.mode=12;break}if(64&ot){J.msg="invalid literal/length code",ee.mode=30;break}ee.extra=15&ot,ee.mode=22;case 22:if(ee.extra){for(Ot=ee.extra;Ye<Ot;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}ee.length+=He&(1<<ee.extra)-1,He>>>=ee.extra,Ye-=ee.extra,ee.back+=ee.extra}ee.was=ee.length,ee.mode=23;case 23:for(;ot=(wt=ee.distcode[He&(1<<ee.distbits)-1])>>>16&255,pt=65535&wt,!((it=wt>>>24)<=Ye);){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}if(!(240&ot)){for(mt=it,It=ot,St=pt;ot=(wt=ee.distcode[St+((He&(1<<mt+It)-1)>>mt)])>>>16&255,pt=65535&wt,!(mt+(it=wt>>>24)<=Ye);){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}He>>>=mt,Ye-=mt,ee.back+=mt}if(He>>>=it,Ye-=it,ee.back+=it,64&ot){J.msg="invalid distance code",ee.mode=30;break}ee.offset=pt,ee.extra=15&ot,ee.mode=24;case 24:if(ee.extra){for(Ot=ee.extra;Ye<Ot;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}ee.offset+=He&(1<<ee.extra)-1,He>>>=ee.extra,Ye-=ee.extra,ee.back+=ee.extra}if(ee.offset>ee.dmax){J.msg="invalid distance too far back",ee.mode=30;break}ee.mode=25;case 25:if(0===$e)break e;if(Qe=Xe-$e,ee.offset>Qe){if((Qe=ee.offset-Qe)>ee.whave&&ee.sane){J.msg="invalid distance too far back",ee.mode=30;break}Qe>ee.wnext?(Qe-=ee.wnext,tt=ee.wsize-Qe):tt=ee.wnext-Qe,Qe>ee.length&&(Qe=ee.length),nt=ee.window}else nt=ve,tt=Fe-ee.offset,Qe=ee.length;for($e<Qe&&(Qe=$e),$e-=Qe,ee.length-=Qe;ve[Fe++]=nt[tt++],--Qe;);0===ee.length&&(ee.mode=21);break;case 26:if(0===$e)break e;ve[Fe++]=ee.length,$e--,ee.mode=21;break;case 27:if(ee.wrap){for(;Ye<32;){if(0===qe)break e;qe--,He|=_e[ye++]<<Ye,Ye+=8}if(Xe-=$e,J.total_out+=Xe,ee.total+=Xe,Xe&&(J.adler=ee.check=ee.flags?re(ee.check,ve,Xe,Fe-Xe):se(ee.check,ve,Xe,Fe-Xe)),Xe=$e,(ee.flags?He:_(He))!==ee.check){J.msg="incorrect data check",ee.mode=30;break}Ye=He=0}ee.mode=28;case 28:if(ee.wrap&&ee.flags){for(;Ye<32;){if(0===qe)break e;qe--,He+=_e[ye++]<<Ye,Ye+=8}if(He!==(4294967295&ee.total)){J.msg="incorrect length check",ee.mode=30;break}Ye=He=0}ee.mode=29;case 29:bt=1;break e;case 30:bt=-3;break e;case 31:return-4;default:return pe}return J.next_out=Fe,J.avail_out=$e,J.next_in=ye,J.avail_in=qe,ee.hold=He,ee.bits=Ye,(ee.wsize||Xe!==J.avail_out&&ee.mode<30&&(ee.mode<27||4!==Z))&&O(J,J.output,J.next_out,Xe-J.avail_out)?(ee.mode=31,-4):(Je-=J.avail_in,Xe-=J.avail_out,J.total_in+=Je,J.total_out+=Xe,ee.total+=Xe,ee.wrap&&Xe&&(J.adler=ee.check=ee.flags?re(ee.check,ve,Xe,J.next_out-Xe):se(ee.check,ve,Xe,J.next_out-Xe)),J.data_type=ee.bits+(ee.last?64:0)+(12===ee.mode?128:0)+(20===ee.mode||15===ee.mode?256:0),(0===Je&&0===Xe||4===Z)&&0===bt&&(bt=-5),bt)},ee.inflateEnd=function(J){if(!J||!J.state)return pe;var Z=J.state;return Z.window&&(Z.window=null),J.state=null,0},ee.inflateGetHeader=function(J,Z){var ee;return J&&J.state&&2&(ee=J.state).wrap?((ee.head=Z).done=!1,0):pe},ee.inflateSetDictionary=function(J,Z){var ee,ne=Z.length;return J&&J.state?0!==(ee=J.state).wrap&&11!==ee.mode?pe:11===ee.mode&&se(1,Z,ne,0)!==ee.check?-3:O(J,Z,ne,ne)?(ee.mode=31,-4):(ee.havedict=1,0):pe},ee.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(J,Z,ee){var ne=J("../utils/common"),se=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],re=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],ae=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],le=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];Z.exports=function(J,Z,ee,pe,_e,ve,ye,Fe){var qe,$e,He,Ye,Je,Xe,Qe,tt,nt,it=Fe.bits,ot=0,pt=0,mt=0,It=0,St=0,Mt=0,bt=0,At=0,Ot=0,wt=0,Dt=null,Lt=0,kt=new ne.Buf16(16),Ut=new ne.Buf16(16),Gt=null,xt=0;for(ot=0;ot<=15;ot++)kt[ot]=0;for(pt=0;pt<pe;pt++)kt[Z[ee+pt]]++;for(St=it,It=15;1<=It&&0===kt[It];It--);if(It<St&&(St=It),0===It)return _e[ve++]=20971520,_e[ve++]=20971520,Fe.bits=1,0;for(mt=1;mt<It&&0===kt[mt];mt++);for(St<mt&&(St=mt),ot=At=1;ot<=15;ot++)if(At<<=1,(At-=kt[ot])<0)return-1;if(0<At&&(0===J||1!==It))return-1;for(Ut[1]=0,ot=1;ot<15;ot++)Ut[ot+1]=Ut[ot]+kt[ot];for(pt=0;pt<pe;pt++)0!==Z[ee+pt]&&(ye[Ut[Z[ee+pt]]++]=pt);if(0===J?(Dt=Gt=ye,Xe=19):1===J?(Dt=se,Lt-=257,Gt=re,xt-=257,Xe=256):(Dt=ae,Gt=le,Xe=-1),ot=mt,Je=ve,bt=pt=wt=0,He=-1,Ye=(Ot=1<<(Mt=St))-1,1===J&&852<Ot||2===J&&592<Ot)return 1;for(;;){for(Qe=ot-bt,ye[pt]<Xe?(tt=0,nt=ye[pt]):ye[pt]>Xe?(tt=Gt[xt+ye[pt]],nt=Dt[Lt+ye[pt]]):(tt=96,nt=0),qe=1<<ot-bt,mt=$e=1<<Mt;_e[Je+(wt>>bt)+($e-=qe)]=Qe<<24|tt<<16|nt,0!==$e;);for(qe=1<<ot-1;wt&qe;)qe>>=1;if(0!==qe?(wt&=qe-1,wt+=qe):wt=0,pt++,0==--kt[ot]){if(ot===It)break;ot=Z[ee+ye[pt]]}if(St<ot&&(wt&Ye)!==He){for(0===bt&&(bt=St),Je+=mt,At=1<<(Mt=ot-bt);Mt+bt<It&&!((At-=kt[Mt+bt])<=0);)Mt++,At<<=1;if(Ot+=1<<Mt,1===J&&852<Ot||2===J&&592<Ot)return 1;_e[He=wt&Ye]=St<<24|Mt<<16|Je-ve}}return 0!==wt&&(_e[Je+wt]=ot-bt<<24|64<<16),Fe.bits=St,0}},{"../utils/common":1}],10:[function(J,Z,ee){Z.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(J,Z,ee){Z.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],"/lib/inflate.js":[function(J,Z,ee){var ne=J("./zlib/inflate"),se=J("./utils/common"),re=J("./utils/strings"),ae=J("./zlib/constants"),le=J("./zlib/messages"),pe=J("./zlib/zstream"),_e=J("./zlib/gzheader"),ve=Object.prototype.toString;function d(J){if(!(this instanceof d))return new d(J);this.options=se.assign({chunkSize:16384,windowBits:0,to:""},J||{});var Z=this.options;Z.raw&&0<=Z.windowBits&&Z.windowBits<16&&(Z.windowBits=-Z.windowBits,0===Z.windowBits&&(Z.windowBits=-15)),!(0<=Z.windowBits&&Z.windowBits<16)||J&&J.windowBits||(Z.windowBits+=32),15<Z.windowBits&&Z.windowBits<48&&!(15&Z.windowBits)&&(Z.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new pe,this.strm.avail_out=0;var ee=ne.inflateInit2(this.strm,Z.windowBits);if(ee!==ae.Z_OK)throw new Error(le[ee]);if(this.header=new _e,ne.inflateGetHeader(this.strm,this.header),Z.dictionary&&("string"==typeof Z.dictionary?Z.dictionary=re.string2buf(Z.dictionary):"[object ArrayBuffer]"===ve.call(Z.dictionary)&&(Z.dictionary=new Uint8Array(Z.dictionary)),Z.raw&&(ee=ne.inflateSetDictionary(this.strm,Z.dictionary))!==ae.Z_OK))throw new Error(le[ee])}function h(J,Z){var ee=new d(Z);if(ee.push(J,!0),ee.err)throw ee.msg||le[ee.err];return ee.result}d.prototype.push=function(J,Z){var ee,le,pe,_e,ye,Fe=this.strm,qe=this.options.chunkSize,$e=this.options.dictionary,He=!1;if(this.ended)return!1;le=Z===~~Z?Z:!0===Z?ae.Z_FINISH:ae.Z_NO_FLUSH,"string"==typeof J?Fe.input=re.binstring2buf(J):"[object ArrayBuffer]"===ve.call(J)?Fe.input=new Uint8Array(J):Fe.input=J,Fe.next_in=0,Fe.avail_in=Fe.input.length;do{if(0===Fe.avail_out&&(Fe.output=new se.Buf8(qe),Fe.next_out=0,Fe.avail_out=qe),(ee=ne.inflate(Fe,ae.Z_NO_FLUSH))===ae.Z_NEED_DICT&&$e&&(ee=ne.inflateSetDictionary(this.strm,$e)),ee===ae.Z_BUF_ERROR&&!0===He&&(ee=ae.Z_OK,He=!1),ee!==ae.Z_STREAM_END&&ee!==ae.Z_OK)return this.onEnd(ee),!(this.ended=!0);Fe.next_out&&(0!==Fe.avail_out&&ee!==ae.Z_STREAM_END&&(0!==Fe.avail_in||le!==ae.Z_FINISH&&le!==ae.Z_SYNC_FLUSH)||("string"===this.options.to?(pe=re.utf8border(Fe.output,Fe.next_out),_e=Fe.next_out-pe,ye=re.buf2string(Fe.output,pe),Fe.next_out=_e,Fe.avail_out=qe-_e,_e&&se.arraySet(Fe.output,Fe.output,pe,_e,0),this.onData(ye)):this.onData(se.shrinkBuf(Fe.output,Fe.next_out)))),0===Fe.avail_in&&0===Fe.avail_out&&(He=!0)}while((0<Fe.avail_in||0===Fe.avail_out)&&ee!==ae.Z_STREAM_END);return ee===ae.Z_STREAM_END&&(le=ae.Z_FINISH),le===ae.Z_FINISH?(ee=ne.inflateEnd(this.strm),this.onEnd(ee),this.ended=!0,ee===ae.Z_OK):le!==ae.Z_SYNC_FLUSH||(this.onEnd(ae.Z_OK),!(Fe.avail_out=0))},d.prototype.onData=function(J){this.chunks.push(J)},d.prototype.onEnd=function(J){J===ae.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=se.flattenChunks(this.chunks)),this.chunks=[],this.err=J,this.msg=this.strm.msg},ee.Inflate=d,ee.inflate=h,ee.inflateRaw=function(J,Z){return(Z=Z||{}).raw=!0,h(J,Z)},ee.ungzip=h},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")),ho.exports),go=new class{constructor(){this._socketAdapter=null,this._url="",this._isReconnecting=!1,this._pendingRequests=new Map,this._nextHeartbeatAt=0,this._lastDiagnoseAt=0,this._isHeartbeatInProgress=!1,this._connectionEstablishedTime=0,this._connectionStartTime=0,this._connectionId=-1,this._isBinarySupported=!0,this._intendedDelay=co,this._currentConnectState=oo,this._beforeSendInterceptors=[]}init(){Qi.addTask({id:io,intervalMs:1e3,callback:this._executeScheduledTaskIfReady,context:this}),this._updateIsBinarySupported(),this._url=function(J){const Z=Ki.get("instance"),{sdkAppId:ee,testEnv:ne,disableIndependentDomain:se}=Z,re=ze(ee);let ae="";return ne?ae=gs.TEST[re].DEFAULT:se?(ae=gs.PRODUCTION[re].DEFAULT,Ji=Yi.DEFAULT):ae=gs.PRODUCTION[re].INITIAL.replace("*",`${ee}`),et(ae,{isBinary:J})}(this._isBinarySupported),Li.subscribeInnerEvent("networkStatusChange",this._handleNetworkStatusChange,this),Li.subscribeInnerEvent("activityStatusChange",this._handleActivityStatusChange,this),this.connect()}sendPacket(J,Z){var ee;const{requestId:ne,timeout:se=no,canResend:re=!0,shouldRejectOnError:ae=!0}=Z||{};if(Ie(J))return to.warn("sendPacket",`${so}.sendPacket: packet is empty `),null;this._executeBeforeSendInterceptors(J),this._currentConnectState===ao&&this._handleConnectStateChange({state:ao,shouldEmitEvent:!0,shouldAttemptReconnect:!0,reason:"send_fail"});const le=JSON.stringify(J);let pe=null;if(ne){const{resolve:Z,reject:ee,promise:_e}=Ce();pe=_e,this._pendingRequests.set(ne,{resolve:Z,reject:ee,timestamp:Date.now(),uplinkData:le,timeout:se,canResend:re,requestHead:null==J?void 0:J.head,shouldRejectOnError:ae})}const _e=this._isBinarySupported?rt(le).buffer:le;return null===(ee=this._socketAdapter)||void 0===ee||ee.send(_e),pe}connect(){var J;this._socketAdapter=new We(this._url),this._connectionEstablishedTime=0,this._addEventListeners(),this._connectionStartTime=Date.now();const Z=null===(J=this._socketAdapter)||void 0===J?void 0:J.getId(),ee=`${so}.connect isWorkerEnabled: false socketID:${Z} url:${this._url}`;this._connectionId=Z,this._ssoLog({method:"connect",message:ee})}disconnect(){var J,Z;const ee=null===(J=this._socketAdapter)||void 0===J?void 0:J.getId(),ne=`${so}.disconnect socketID:${ee}`;this._ssoLog({method:"disconnect",message:ne}),this._removeEventListeners(),null===(Z=this._socketAdapter)||void 0===Z||Z.disconnect()}getSocketAdapter(){return this._socketAdapter}dispose(){console.log(`${so}.dispose`),Qi.removeTask(io),Qi.removeTask(ro),Li.unSubscribeInnerEvent("networkStatusChange",this._handleNetworkStatusChange,this),Li.unSubscribeInnerEvent("activityStatusChange",this._handleActivityStatusChange,this),this.disconnect(),this._socketAdapter=null,this._isReconnecting=!1,this._isHeartbeatInProgress=!1,this._pendingRequests.clear(),this._nextHeartbeatAt=0,this._lastDiagnoseAt=0,this._intendedDelay=co,this._url=""}registerBeforeSendInterceptor(J,Z){this._beforeSendInterceptors.push(J.bind(Z))}_executeBeforeSendInterceptors(J){for(const Z of this._beforeSendInterceptors){const{servcmd:ee=""}=null==J?void 0:J.head;Z(ee.includes(".")?ee.split(".").pop():"")}}_shouldSkipReconnect(){const J="connecting"===this._currentConnectState&&this._isReconnecting;return!this._socketAdapter||J}reconnect(){return ge(this,void 0,void 0,(function*(){const J=`${so}.reconnect isReconnecting: ${this._isReconnecting} currentConnectState: ${this._currentConnectState}`;if(this._ssoLog({method:"reconnect",message:J}),!this._shouldSkipReconnect()){this._url=function st(J){const Z=Ki.get("instance"),{sdkAppId:ee,testEnv:ne}=Z,se=ze(ee);if(ne)return et(gs.TEST[se].DEFAULT,{isBinary:J});const re=gs.PRODUCTION[se],ae=ks&&re.ANYCAST,le=ks,pe=!!re.BACKUP_CN;return et({[Yi.INITIAL]:()=>(Ji=Yi.DEFAULT,re.DEFAULT),[Yi.DEFAULT]:()=>(Ji=Yi.IPV6,re.IPV6),[Yi.IPV6]:()=>(Ji=Yi.BACKUP,re.BACKUP),[Yi.BACKUP]:()=>le?(Ji=Yi.BACKUP_WEB_ONLY,function(J){const Z=Math.floor(10001*Math.random())+1e4;return J.replace("*",String(Z))}(re.BACKUP_WEB_ONLY)):pe?(Ji=Yi.BACKUP_CN,re.BACKUP_CN):ae?(Ji=Yi.ANYCAST,re.ANYCAST):re.DEFAULT,[Yi.BACKUP_WEB_ONLY]:()=>pe?(Ji=Yi.BACKUP_CN,re.BACKUP_CN):ae?(Ji=Yi.ANYCAST,re.ANYCAST):re.DEFAULT,[Yi.BACKUP_CN]:()=>(Ji=ae?Yi.ANYCAST:Yi.DEFAULT,re[Ji]),[Yi.ANYCAST]:()=>(Ji=Yi.DEFAULT,re.ANYCAST="",re.DEFAULT)}[Ji](),{isBinary:J})}(this._isBinarySupported);try{this._isReconnecting=!0,this.disconnect(),this.connect()}catch(J){this._isReconnecting=!1,this._handleConnectStateChange({state:ao,shouldEmitEvent:!0,shouldAttemptReconnect:!0,reason:"reconnect_failed"}),to.warn(`${so}.reconnect failed: ${Se(J)}`)}}}))}_addEventListeners(){var J,Z,ee,ne,se;null===(J=this._socketAdapter)||void 0===J||J.on("connect",this._onConnect,this),null===(Z=this._socketAdapter)||void 0===Z||Z.on("message",this._onMessage,this),null===(ee=this._socketAdapter)||void 0===ee||ee.on("close",this._onClose,this),null===(ne=this._socketAdapter)||void 0===ne||ne.on("error",this._onError,this),null===(se=this._socketAdapter)||void 0===se||se.on("sendFail",this._onSendFail,this)}_removeEventListeners(){var J,Z,ee,ne,se;null===(J=this._socketAdapter)||void 0===J||J.off("connect",this._onConnect,this),null===(Z=this._socketAdapter)||void 0===Z||Z.off("message",this._onMessage,this),null===(ee=this._socketAdapter)||void 0===ee||ee.off("close",this._onClose,this),null===(ne=this._socketAdapter)||void 0===ne||ne.off("error",this._onError,this),null===(se=this._socketAdapter)||void 0===se||se.off("sendFail",this._onSendFail,this)}_onClose(J){const{socketId:Z,event:ee}=J||{},ne=0!==this._connectionEstablishedTime?Date.now()-this._connectionEstablishedTime:0,se=`${so}.onClose closeSocketID: ${Z} currentSocketID: ${this._connectionId} connectionDuration: ${ne} code: ${null==ee?void 0:ee.code} reason: ${null==ee?void 0:ee.reason}`;this._ssoLog({method:"onClose",message:se}),Z===this._connectionId&&this._handleConnectStateChange({state:ao,shouldEmitEvent:!0,shouldAttemptReconnect:!0,reason:"socket_close"}),this._isReconnecting&&(this._isReconnecting=!1)}_onError(J){const{socketId:Z,error:ee}=J||{},ne=`${so}.onError sourceSocketID: ${Z} currentSocketID: ${this._connectionId} isReconnecting: ${this._isReconnecting} error: ${JSON.stringify(ee)}`;this._ssoLog({method:"onError",message:ne}),Z===this._connectionId&&this._handleConnectStateChange({state:ao,shouldEmitEvent:!0,shouldAttemptReconnect:!0,reason:"socket_error"}),this._isReconnecting&&(this._isReconnecting=!1)}_onSendFail(J){const{socketId:Z,error:ee}=J||{},ne=`${so}.onSendFail sendFailSocketId: ${Z} currentSocketID: ${this._connectionId} isReconnecting: ${this._isReconnecting} error: ${Se(ee)}`;this._ssoLog({method:"onSendFail",message:ne}),this._isReconnecting&&(this._isReconnecting=!1)}_onMessage(J){let Z,ee;this._updateHeartbeatTime();try{Z=this._isBinarySupported?this._isCompressedData(J.data)?(J=>{const Z=new Uint8Array(J).slice(4);let ee;try{ee=po.inflate(Z,{to:"string"})}catch(J){console.error("inflate error",J)}return ee})(J.data):function(J){const Z=new Uint8Array(J);let ee="",ne=0;const{length:se}=Z;for(;ne<se;){let J=Z[ne],re=0,ae=0;if(J<=127?(re=0,ae=255&J):J<=223?(re=1,ae=31&J):J<=239?(re=2,ae=15&J):J<=244&&(re=3,ae=7&J),se-ne-re>0)for(let ee=0;ee<re;ee+=1)J=Z[ne+ee+1],ae=ae<<6|63&J;else ae=65533,re=se-ne;ee+=String.fromCodePoint(ae),ne+=re+1}return ee}(J.data):J.data,ee=JSON.parse(Z)}catch(Z){const ee=`event.data: ${Se(J.data)} error: ${Se(Z)}`;return void this._ssoLog({method:"jsonParseError",message:ee})}if(!ee||!ee.head)return;const{seq:ne,servcmd:se}=ee.head,re=`${ne}${se}`;this._pendingRequests.has(re)?this._handleRequestResponse(ee):this._handlePushMessage(ee)}_handleRequestResponse(J){var Z,ee;const{seq:ne,servcmd:se}=J.head,{int32_error_code:re,str_error_message:ae}=(null==J?void 0:J.body)||{},le=(null===(Z=null==J?void 0:J.body)||void 0===Z?void 0:Z.ErrorCode)||re,pe=(null===(ee=null==J?void 0:J.body)||void 0===ee?void 0:ee.ErrorInfo)||ae,_e=`${ne}${se}`,{resolve:ve,reject:ye,timestamp:Fe,headSeq:qe,requestHead:$e,shouldRejectOnError:He=!0}=this._pendingRequests.get(_e);if(this._pendingRequests.delete(_e),le&&0!==le&&He)return Li.emitInnerEvent("error",{errorCode:le,errorInfo:pe,requestHead:$e}),void ye({errorCode:le,errorInfo:pe});ve(J.body)}_handlePushMessage(J){const{servcmd:Z}=J.head,{NeedAck:ee,SessionData:ne}=J.body;1===ee&&this._sendAck(ne),Li.emitInnerEvent(Z,J)}_checkPendingRequestsAndResend(){var J;to.debug("_checkPendingRequestsAndResend",` reConnectFlag:${this._isReconnecting} promiseMap.size:${this._pendingRequests.size}`),null===(J=this._pendingRequests)||void 0===J||J.forEach(((J,Z)=>{var ee;const{uplinkData:ne,canResend:se,resolve:re,reject:ae,timeout:le}=J;if(se){this._pendingRequests.set(Z,{resolve:re,reject:ae,timestamp:Date.now(),uplinkData:ne,timeout:le,canResend:se});const J=this._isBinarySupported?rt(ne).buffer:ne;null===(ee=this._socketAdapter)||void 0===ee||ee.send(J)}else this._pendingRequests.delete(Z)}))}_onConnect(J){const{socketId:Z,event:ee={}}=J||{};this._connectionId=Z,this._connectionEstablishedTime=Date.now();const ne=Date.now()-this._connectionStartTime,se=`${so}.onConnect cost:${ne} ms. socketID:${Z} res:${JSON.stringify(ee)}`;if(this._ssoLog({method:"onConnect",message:se}),this._checkPendingRequestsAndResend(),this._sendHeartbeatIfReady(),this._isReconnecting){const J=`${so}.reconnect success`;this._ssoLog({method:"reconnectSuccess",message:J}),Li.emitInnerEvent(Rr.RECONNECTED),this._isReconnecting=!1}this._resetReconnectDelay(),this._handleConnectStateChange({state:oo,shouldEmitEvent:!0,shouldAttemptReconnect:!1})}_sendAck(J){const Z=ut({servcmd:"openim.ws_msg_push_ack",data:{SessionData:J}});this.sendPacket(Z)}_executeScheduledTaskIfReady(){return ge(this,void 0,void 0,(function*(){this._clearTimeoutRequest(),this._sendHeartbeatIfReady()}))}_canSendHeartbeat(){var J;return(null===(J=this._socketAdapter)||void 0===J?void 0:J.isConnected())&&Date.now()>=this._nextHeartbeatAt&&!this._isHeartbeatInProgress}_sendHeartbeat(){return ge(this,void 0,void 0,(function*(){var J;const Z=ut({servcmd:"heartbeat.alive",data:{}});try{const J=`${Z.head.seq}${Z.head.servcmd}`;yield this.sendPacket(Z,{requestId:J,timeout:3e3})}catch(Z){const ee=null===(J=Ki.get("netWorkMonitor"))||void 0===J?void 0:J.isNetWorkOnline,ne=`${so}.sendHeartbeat failed. isNetWorkOnline:${ee} error: ${Z}`;this._ssoLog({method:"sendHeartbeatError",message:ne}),this._handleConnectStateChange({state:ao,shouldEmitEvent:!0,shouldAttemptReconnect:!0})}}))}_sendHeartbeatIfReady(){return ge(this,void 0,void 0,(function*(){this._canSendHeartbeat()&&(this._isHeartbeatInProgress=!0,yield this._sendHeartbeat(),this._isHeartbeatInProgress=!1)}))}_updateHeartbeatTime(){this._nextHeartbeatAt=Ts?Date.now()+5e3:Date.now()+1e4}_handleNetworkStatusChange(J){const Z=`${so}.networkStatusChange ${JSON.stringify(J)}`;this._ssoLog({method:"networkStatusChange",message:Z});const{isNetworkOnline:ee,networkType:ne}=J;ee&&"none"!==ne?this._handleConnectStateChange({state:oo,shouldEmitEvent:!1,shouldAttemptReconnect:!0,reason:uo}):this._handleConnectStateChange({state:ao,shouldEmitEvent:!1,shouldAttemptReconnect:!0,reason:uo})}isPrivateNetWork(){const J=Ki.get("instance")||{};return J.proxyServer&&!J.fileDownloadProxy}_handleConnectStateChange(J){const{state:Z,shouldAttemptReconnect:ee,shouldEmitEvent:ne,reason:se}=J,re=`${so}._handleConnectStateChange currentConnectState: ${this._currentConnectState} shouldAttemptReconnect: ${ee} shouldEmitEvent: ${ne} reason: ${se}`;this._currentConnectState!==Z&&(this._ssoLog({method:"handleConnectStateChange",message:re}),ne&&(to.info("_handleConnectStateChange",` from ${this._currentConnectState} to ${Z}`),Li.emitOuterEvent("netStateChange",{name:"netStateChange",data:{state:Z}}),this._currentConnectState=Z,Z===ao&&Li.emitInnerEvent(Rr.SOCKET_DISCONNECTED)),ee&&(this._resetReconnectDelay(),Qi.addTask({id:ro,intervalMs:this._intendedDelay,callback:this._scheduleReconnectWithBackoff,context:this})))}_handleActivityStatusChange(J){var Z,ee;const ne=null===(ee=null===(Z=this._socketAdapter)||void 0===Z?void 0:Z._ws)||void 0===ee?void 0:ee.readyState,se=`${so}.activityStatusChange ${JSON.stringify(J)} readyState: ${ne}`;to.debug("activityStatusChange",se),3===ne&&this._handleConnectStateChange({state:ao,shouldEmitEvent:!0,shouldAttemptReconnect:!0,reason:"activity_status_change"})}_resetReconnectDelay(){var J;to.debug(`${so}._resetReconnectDelay`),Qi.removeTask(ro);const Z=null===(J=Ki.get("activityMonitor"))||void 0===J?void 0:J.isActive;this._intendedDelay=Z?co:1e3}_scheduleReconnectWithBackoff(){var J;const Z=null===(J=Ki.get("activityMonitor"))||void 0===J?void 0:J.isActive;this._intendedDelay=Z?Math.min(5e3,Math.max(co,1.5*this._intendedDelay)):Math.min(3e5,Math.max(1e3,1.5*this._intendedDelay));const ee=(new Date).toTimeString().slice(0,8),ne=`${so}.scheduleReconnectWithBackoff timeStr: ${ee} intendedDelay: ${this._intendedDelay}`;to.debug(ne),this.reconnect(),Qi.updateTaskInterval(ro,this._intendedDelay)}_ssoLog(J){const{method:Z,message:ee}=J;to.info(Z,ee)}_diagnose(){this.isPrivateNetWork()||(this._lastDiagnoseAt=Date.now(),function(J){ge(this,void 0,void 0,(function*(){const Z=J.split("/")[2];if(!Z.startsWith("ws"))return;const ee=`https://${Z}/v3/netcheck/getconninfo?${J.slice(J.indexOf("info?")+5)}&reqtime=${Date.now()}`;try{yield fe({method:"GET",url:ee,data:{}})}catch(J){to.warn("diagnoseBySSO",`diagnoseBySSO failed. error:${J.message}`)}}))}(this._url),function(J){ge(this,void 0,void 0,(function*(){const Z=`https://boce-cdn.my-imcloud.com/v3/netcheck/getconninfo?${J.slice(J.indexOf("info?")+5)}&reqtime=${Date.now()}`;try{yield fe({method:"GET",url:Z,data:{}})}catch(J){to.warn(`diagnoseByCDN', 'diagnoseByCDN failed. error:${J.message}`)}}))}(this._url),this._beforeSendInterceptors=[])}_clearTimeoutRequest(){for(const[J,Z]of this._pendingRequests.entries()){const{reject:ee,timestamp:ne,timeout:se}=Z;Date.now()-ne>=se&&(this._pendingRequests.delete(J),Date.now()-this._lastDiagnoseAt>=3e4&&this._diagnose(),ee({errorCode:2801,errorInfo:"NETWORK_TIMEOUT",data:{requestId:J}}))}}_updateIsBinarySupported(){var J;if(null===(J=Ki.get("instance"))||void 0===J?void 0:J.devMode)return void(this._isBinarySupported=!1);const Z=de();if((Ms||vs&&"windows"===Z||ws)&&(this._isBinarySupported=!1),Ts){const{uniRuntimeVersion:J=""}=Ps.getSystemInfoSync();(function(J){const Z=J.split(".").map(Number),[ee=0,ne=0,se=0]=Z;return ee>2||!(ee<2)&&(ne>2||!(ne<2)&&se>=6)})(J)||(this._isBinarySupported=!1)}}_isCompressedData(J){const Z=new Uint8Array(J);return 67===Z[0]&&79===Z[1]&&77===Z[2]&&80===Z[3]}};const _o={init:function(J){Ki.set("instance",J),go.init()},destroy:function(){go.dispose(),Ki.clear(),Qi.dispose()},notificationCenter:Li,channel:go,store:Ki,ssoLog:to,utils:bi,common:dr,constants:_s},zt=J=>"function"==typeof J;function Jt(J,Z,ee){const ne=ee||[];if(!J||!Z)return!1;const se=Object.keys(J).filter((J=>!ne.includes(J))),re=Object.keys(Z).filter((J=>!ne.includes(J)));return se.length===re.length&&se.every((ne=>!!Z.hasOwnProperty(ne)&&("object"==typeof J[ne]&&null!==J[ne]?Jt(J[ne],Z[ne],ee):J[ne]===Z[ne])))}var mo;!function(J){J.SDK_READY="sdkStateReady",J.SDK_NOT_READY="sdkStateNotReady",J.SDK_DESTROY="sdkDestroy",J.MESSAGE_RECEIVED="onMessageReceived",J.ROOM_CUSTOM_DATA_RECEIVED="onRoomCustomDataReceived",J.MESSAGE_MODIFIED="onMessageModified",J.MESSAGE_REVOKED="onMessageRevoked",J.MESSAGE_READ_BY_PEER="onMessageReadByPeer",J.MESSAGE_READ_RECEIPT_RECEIVED="onMessageReadReceiptReceived",J.MESSAGE_EXTENSIONS_UPDATED="onMessageExtensionsUpdated",J.MESSAGE_EXTENSIONS_DELETED="onMessageExtensionsDeleted",J.MESSAGE_REACTIONS_UPDATED="onMessageReactionsUpdated",J.CONVERSATION_LIST_UPDATED="onConversationListUpdated",J.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED="onTotalUnreadMessageCountUpdated",J.CONVERSATION_GROUP_LIST_UPDATED="onConversationGroupListUpdated",J.CONVERSATION_IN_GROUP_UPDATED="onConversationInGroupUpdated",J.GROUP_LIST_UPDATED="onGroupListUpdated",J.GROUP_ATTRIBUTES_UPDATED="groupAttributesUpdated",J.GROUP_COUNTER_UPDATED="onGroupCounterUpdated",J.TOPIC_CREATED="onTopicCreated",J.TOPIC_DELETED="onTopicDeleted",J.TOPIC_UPDATED="onTopicUpdated",J.PROFILE_UPDATED="onProfileUpdated",J.USER_STATUS_UPDATED="onUserStatusUpdated",J.BLACKLIST_UPDATED="blacklistUpdated",J.FRIEND_LIST_UPDATED="onFriendListUpdated",J.FRIEND_GROUP_LIST_UPDATED="onFriendGroupListUpdated",J.FRIEND_APPLICATION_LIST_UPDATED="onFriendApplicationListUpdated",J.MY_FOLLOWERS_LIST_UPDATED="onMyFollowersListUpdated",J.MY_FOLLOWING_LIST_UPDATED="onMyFollowingListUpdated",J.MUTUAL_FOLLOWERS_LIST_UPDATED="onMutualFollowersListUpdated",J.KICKED_OUT="kickedOut",J.ERROR="error",J.NET_STATE_CHANGE="netStateChange",J.ALL_RECEIVE_MESSAGE_OPT_UPDATED="onAllReceiveMessageOptUpdated",J.SERVER_CONFIG_UPDATED="onServerConfigUpdated",J.PINNED_GROUP_MESSAGE_UPDATED="onPinnedGroupMessageUpdated",J.WEB_PUSH_MESSAGE_RECEIVED="onWebPushMessageReceived",J.GROUP_ONLINE_MEMBER_COUNT_CHANGED="onGroupOnlineMemberCountChanged",J.RICH_STATUS_CHANGED="onRichStatusChanged"}(mo||(mo={}));var yo,So=mo;!function(J){J.LOGOUT="logout",J.DESTROY="destroy",J.CLOUD_CONFIG_UPDATE="cloud_config_update",J.PROFILE_UPDATE="profile_updated",J.ERROR="error",J.RECONNECTED="reconnected",J.FORCE_OFFLINE="im_open_status.stat_forceoffline",J.COMMERCIAL_CONFIG_PUSH="im_sdk_config_mgr.push_imsdk_purchase_bitsv2",J.OVERLOAD_PUSH="OverLoadPush.notify2",J.NEW_MESSAGE="new_message",J.MESSAGE_PUSH="im_open_push.msg_push",J.MESSAGE_DELETED="message_deleted",J.MESSAGE_REVOKED="message_revoked",J.MESSAGE_MODIFIED="message_modified",J.SOCKET_DISCONNECTED="socket_disconnected",J.CONVERSATION_UPDATED="conversation_updated",J.TOPIC_MESSAGE_DELETED="topic_message_deleted",J.TOPIC_MESSAGE_REVOKED="topic_message_revoked",J.TOPIC_MESSAGE_MODIFIED="topic_message_modified",J.TOPIC_NEW_MESSAGE="topic_new_message",J.QUALITY_STAT="quality_stat",J.SYNC_CONVERSATION_LIST="sync_conversation_list",J.HISTORY_MESSAGE_FETCHED="history_message_fetched"}(yo||(yo={}));var Co,Mo=yo;!function(J){J.NEW_INVITATION_RECEIVED="newInvitationReceived",J.INVITEE_ACCEPTED="ts_invitee_accepted",J.INVITEE_REJECTED="ts_invitee_rejected",J.INVITATION_CANCELLED="ts_invitation_cancelled",J.INVITATION_TIMEOUT="ts_invitation_timeout",J.INVITATION_MODIFIED="ts_invitation_modified"}(Co||(Co={}));var To=Co;const Ao=Object.assign({},{KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick"}),Oo={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem",MSG_STREAM:"TIMStreamElem"};var wo;!function(J){J.UNSENT="unSend",J.SUCCESS="success",J.FAIL="fail"}(wo||(wo={}));const Ro={modify:Mo.MESSAGE_MODIFIED,delete:Mo.MESSAGE_DELETED,revoke:Mo.MESSAGE_REVOKED};var Do;!function(J){J[J.FORWARD=0]="FORWARD",J[J.BACKWARD=1]="BACKWARD"}(Do||(Do={}));const ko=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Oo),{MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest"}),{RECEIVE_WITH_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_MSG_EXCEPT_AT:"NotReceiveMsgExceptAt",MSG_AT_ALL:"__kImSDK_MesssageAtALL__"}),{MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard"}),{MessageStatus:wo,Direction:Do}),Po={[Ro.modify]:Mo.TOPIC_MESSAGE_MODIFIED,[Ro.delete]:Mo.TOPIC_MESSAGE_DELETED,[Ro.revoke]:Mo.TOPIC_MESSAGE_REVOKED},Uo={GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3,USER_NOT_FOUND:"@TLS#NOT_FOUND"},Go=Object.assign({},Uo),xo={CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM"},Fo=Object.assign(Object.assign(Object.assign(Object.assign({},xo),{CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3}),{CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8}),{READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage"}),Bo=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},{SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay"}),{ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny"}),{SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both"}),{SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both"}),{SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd"}),{SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single"}),{FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut"}),qo={GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_ROOM:"Room",GRP_LIVE:"Live"},Vo={COMMUNITY:"@TGS#_",TOPIC:"@TOPIC#_"},$o={JOINED:1,QUITTED:2,KICKED:3,ADMIN_SET:4,ADMIN_CANCELED:5,GROUP_PROFILE_UPDATED:6,GROUP_MEMBER_PROFILE_UPDATED:7,TOPIC_PROFILE_UPDATED:8},jo=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},qo),{GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom"}),{GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11}),{JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval"}),{INVITE_OPTIONS_DISABLE_INVITE:"DisableInvite",INVITE_OPTIONS_NEED_PERMISSION:"NeedPermission",INVITE_OPTIONS_FREE_ACCESS:"FreeAccess"}),{GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INVITE_OPTION:"inviteOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers"}),{GROUP_ID_PREFIX:Vo,GROUP_TIPS_OPERATION_TYPE:$o}),Ho={IOS_OFFLINE_PUSH_NO_SOUND:"push.no_sound",IOS_OFFLINE_PUSH_DEFAULT_SOUND:"default"},Ko=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ao),ko),Go),Fo),Bo),jo),Ho),{NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",NET_STATE_CONNECTED:"connected"}),Wo={NO_SDKAPPID:2e3,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,MSG_SEND_FAIL:2100,MSG_SEND_FAIL_NOT_IN_AV:2101,MSG_SEND_GRP_WITH_TOPIC_FAIL:2115,MSG_INSTANCE_REQUIRED:2105,MSG_INVALID_CONV_TYPE:2106,MSG_REVOKE_FAIL:2110,MSG_DELETE_FAIL:2111,MSG_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MSG_LIST_EMPTY:2114,CANNOT_DELETE_GRP_SYSTEM_NOTICE:2116,NOT_MY_FRIEND:2700,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,NO_USE:3122,OPTIONS_IS_EMPTY:3153,MSG_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},Yo={BASIC:"1",STANDARD:"2",PROFESSIONAL:"3"},zo={SYNC_SERVER_INFO_AFTER_RE_ONLINE:"sync-server-info-after-re-online",SYNC_SERVER_INFO_AFTER_LOGIN:"sync-server-info-after-login",RECEIVE_C2C_NEW_MESSAGE:"receive-c2c-new-message",RECEIVE_GROUP_NEW_MESSAGE:"receive-group-new-message",RECEIVE_GROUP_TIPS_NOTIFICATION:"receive-group-tips-notification"},Jo={USER_STATUS_UPDATE:"user-status-update",CONVERSATION_RECOVER:"conversation-recover",HISTORY_MESSAGE_RECOVER:"history-message-recover",BLACKLIST_RECOVER:"blacklist-recover",FRIEND_RECOVER:"friend-recover",GROUP_ATTRIBUTE_CACHE_CLEAR:"group-attribute-cache-clear",UNREAD_MESSAGE_RECOVER:"unread-message-recover",HANDLE_NEW_MESSAGE:"handle-new-message",HANDLE_CONVERSATION_PROFILE_UPDATED:"handle-conversation-profile-updated",COMMERCIAL_CONFIG_UPDATE:"commercial-config-update",UNREAD_MESSAGE_SYNC:"unread-message-sync",FRIEND_AND_BLACKLIST_SYNC:"friend-and-blacklist-sync",SIGNALING_MESSAGE_RECOVER:"signaling-message-recover",GROUP_LIST_SYNC:"group-list-sync",CONVERSATION_LIST_SYNC:"conversation-list-sync",USER_PROFILE_SYNC:"user-profile-sync",CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED:"conversation-update-after-unread-sync-finished",CONVERSATION_UPDATE_AFTER_GROUP_LIST_SYNC_FINISHED:"conversation-update-after-group-list-sync-finished",HANDLE_C2C_NEW_MESSAGE:"handle-c2c-new-message",HANDLE_GROUP_NEW_MESSAGE:"handle-group-new-message",CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE:"create-or-update-conversation-by-receive-new-message",HANDLE_GROUP_TIPS_FROM_SYNC_UNREAD:"handle-group-tips-from-sync-unread",HANDLE_C2C_REVOKED_MESSAGE_FROM_SYNC_UNREAD:"handle-c2c-revoked-message-from-sync-unread",GROUP_REVOKED_NOTICE_RECOVER:"group-revoked-notice-recover",CLOUD_CONFIG_SYNC:"cloud-config-sync",UPDATE_GROUP_NEXT_SEQUENCE:"update-group-next-sequence",EMIT_C2C_MESSAGE_EVENT:"emit-c2c-message-event",EMIT_GROUP_MESSAGE_EVENT:"emit-group-message-event",CONVERSATION_GROUP_LIST_SYNC:"conversation-group-list-sync",CONVERSATION_GROUP_UPDATE:"conversation-group-update",UPDATE_TOPIC_AFTER_UNREAD_SYNC_FINISHED:"update-topic-after-unread-sync-finished",UPDATE_TOPIC_BY_RECEIVE_NEW_MESSAGE:"update-topic-by-received-new-message",TOPIC_REQUEST_INFO_RESET:"topic-request-info-reset",QUALITY_REPORT:"quality-report",GROUP_TIPS_RECOVER:"group-tips-recover",HANDLE_GROUP_TIPS_NOTIFICATION:"handle-group-tips-notification",C2C_HISTORY_MESSAGE_RECOVER:"c2c-history-message-recover",FRIEND_APPLICATION_LIST_RECOVER:"friend-application-list-recover",EMIT_GROUP_TIPS_EVENT:"emit-group-tips-event"},Zo={[zo.SYNC_SERVER_INFO_AFTER_RE_ONLINE]:[{stepId:Jo.USER_STATUS_UPDATE},{stepId:Jo.GROUP_ATTRIBUTE_CACHE_CLEAR},{stepId:Jo.UNREAD_MESSAGE_SYNC,dependency:Jo.C2C_HISTORY_MESSAGE_RECOVER},{stepId:Jo.CONVERSATION_RECOVER},{stepId:Jo.HISTORY_MESSAGE_RECOVER,dependency:Jo.CONVERSATION_RECOVER},{stepId:Jo.BLACKLIST_RECOVER},{stepId:Jo.FRIEND_RECOVER},{stepId:Jo.FRIEND_APPLICATION_LIST_RECOVER},{stepId:Jo.GROUP_REVOKED_NOTICE_RECOVER,dependency:Jo.HISTORY_MESSAGE_RECOVER},{stepId:Jo.GROUP_TIPS_RECOVER,dependency:Jo.HISTORY_MESSAGE_RECOVER},{stepId:Jo.TOPIC_REQUEST_INFO_RESET},{stepId:Jo.HANDLE_C2C_REVOKED_MESSAGE_FROM_SYNC_UNREAD,dependency:Jo.UNREAD_MESSAGE_SYNC},{stepId:Jo.HANDLE_GROUP_TIPS_FROM_SYNC_UNREAD,dependency:Jo.UNREAD_MESSAGE_SYNC},{stepId:Jo.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,dependency:[Jo.UNREAD_MESSAGE_SYNC,Jo.CONVERSATION_RECOVER]},{stepId:Jo.EMIT_C2C_MESSAGE_EVENT,dependency:[Jo.UNREAD_MESSAGE_SYNC,Jo.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED],skipIfDependencyMissing:!1},{stepId:Jo.C2C_HISTORY_MESSAGE_RECOVER,dependency:Jo.CONVERSATION_RECOVER}],[zo.SYNC_SERVER_INFO_AFTER_LOGIN]:[{stepId:Jo.COMMERCIAL_CONFIG_UPDATE},{stepId:Jo.CLOUD_CONFIG_SYNC},{stepId:Jo.USER_PROFILE_SYNC},{stepId:Jo.UNREAD_MESSAGE_SYNC},{stepId:Jo.FRIEND_AND_BLACKLIST_SYNC},{stepId:Jo.GROUP_LIST_SYNC},{stepId:Jo.CONVERSATION_LIST_SYNC},{stepId:Jo.SIGNALING_MESSAGE_RECOVER,dependency:Jo.UNREAD_MESSAGE_SYNC},{stepId:Jo.UPDATE_TOPIC_AFTER_UNREAD_SYNC_FINISHED,dependency:[Jo.UNREAD_MESSAGE_SYNC]},{stepId:Jo.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,dependency:[Jo.UNREAD_MESSAGE_SYNC,Jo.CONVERSATION_LIST_SYNC]},{stepId:Jo.CONVERSATION_UPDATE_AFTER_GROUP_LIST_SYNC_FINISHED,dependency:[Jo.GROUP_LIST_SYNC,Jo.CONVERSATION_LIST_SYNC]},{stepId:Jo.CONVERSATION_GROUP_LIST_SYNC},{stepId:Jo.CONVERSATION_GROUP_UPDATE,dependency:[Jo.CONVERSATION_LIST_SYNC,Jo.CONVERSATION_GROUP_LIST_SYNC]},{stepId:Jo.QUALITY_REPORT}],[zo.RECEIVE_C2C_NEW_MESSAGE]:[{stepId:Jo.HANDLE_C2C_NEW_MESSAGE},{stepId:Jo.UNREAD_MESSAGE_SYNC},{stepId:Jo.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,dependency:Jo.HANDLE_C2C_NEW_MESSAGE},{stepId:Jo.EMIT_C2C_MESSAGE_EVENT,dependency:[Jo.HANDLE_C2C_NEW_MESSAGE,Jo.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE],skipIfDependencyMissing:!1},{stepId:Jo.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,dependency:[Jo.UNREAD_MESSAGE_SYNC]}],[zo.RECEIVE_GROUP_NEW_MESSAGE]:[{stepId:Jo.HANDLE_GROUP_NEW_MESSAGE},{stepId:Jo.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,dependency:Jo.HANDLE_GROUP_NEW_MESSAGE},{stepId:Jo.UPDATE_GROUP_NEXT_SEQUENCE,dependency:Jo.HANDLE_GROUP_NEW_MESSAGE},{stepId:Jo.UPDATE_TOPIC_BY_RECEIVE_NEW_MESSAGE,dependency:Jo.HANDLE_GROUP_NEW_MESSAGE},{stepId:Jo.EMIT_GROUP_MESSAGE_EVENT,dependency:[Jo.HANDLE_GROUP_NEW_MESSAGE,Jo.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE],skipIfDependencyMissing:!1}],[zo.RECEIVE_GROUP_TIPS_NOTIFICATION]:[{stepId:Jo.HANDLE_GROUP_TIPS_NOTIFICATION},{stepId:Jo.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,dependency:Jo.HANDLE_GROUP_TIPS_NOTIFICATION},{stepId:Jo.EMIT_GROUP_TIPS_EVENT,dependency:[Jo.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,Jo.HANDLE_GROUP_TIPS_NOTIFICATION],skipIfDependencyMissing:!1}]},Xo={MESSAGE_SEND_SUCCESS_RATE:"messageSendSuccessRate"},Qo={TOTAL_COUNT:"sendMessageTotalCount",SUCCESS_COUNT:"sendMessageSuccessCount",FAILED_COUNT:"sendMessageFailedCount",SEND_COST:"sendMessageCost"},aa=["login","getMyProfile","getUserProfile","updateMyProfile","setSelfStatus","getUserStatus","subscribeUserStatus","unsubscribeUserStatus","modifyMessage","deleteGroupMember","dismissGroup","getGroupMemberList","getGroupOnlineMemberCount","joinGroup","markGroupMemberList","quitGroup","searchCloudMessages","searchCloudGroups","searchCloudGroupMembers","searchCloudUsers","getMyFollowingList","getMyFollowersList","getMutualFollowersList","followUser","unfollowUser","getUserFollowInfo","checkFollowType","getFriendProfile","addFriend","deleteFriend","updateFriend","checkFriend","setFriendApplicationRead","createFriendGroup","deleteFriendGroup","addToFriendGroup","removeFromFriendGroup","renameFriendGroup","changeGroupOwner","createGroup","dismissGroup","getGroupList","getGroupOnlineMemberCount","getGroupProfile","searchGroupByID","updateGroupProfile","handleGroupApplication","deleteGroupAttributes","getGroupAttributes","initGroupAttributes","setGroupAttributes","addGroupMember","deleteGroupMember","getGroupMemberList","getGroupMemberProfile","setGroupMemberMuteTime","setGroupMemberNameCard","setGroupMemberRole","deleteMessage","revokeMessage","setMessageExtensions","getMessageExtensions","deleteMessageExtensions","getMessageList","addMessageReaction","removeMessageReaction","clearHistoryMessage","sendMessageReadReceipt","getMessageReadReceiptList","getGroupMessageReadMemberList","createMergerMessage","invite","accept","cancel","reject","modifyInvitation","deleteConversation","pinConversation","setMessageRead","setAllMessageRead","getConversationList","getTotalUnreadMessageCount","renameConversationGroup","deleteConversationGroup","markConversation","setConversationCustomData","deleteConversationsFromGroup","addConversationsToGroup","createConversationGroup"];var ca,ua,la,ha=Object.freeze({__proto__:null,ERROR_CODE:Wo,InnerEvent:Mo,NEED_LOG_API:aa,OuterConstant:Ko,OuterEvent:So,PUSH:Ho,QUALITY_METRICS:Xo,SDK_EDITION:Yo,SDK_INFO:{VERSION:"1.7.3",APPID:537048168},SEND_MESSAGE_STAT:Qo,SignalingEvent:To,WEB_PUSH_ACCOUNT_TYPE:1,WORKFLOW_DEFINITIONS:Zo,WORKFLOW_NAME:zo,WORKFLOW_STEP:Jo});!function(J){J[J.USER_INITIATED=0]="USER_INITIATED",J[J.KICKED_OUT=1]="KICKED_OUT"}(ca||(ca={})),function(J){J[J.multipleAccount=1]="multipleAccount",J[J.multipleDevice=2]="multipleDevice",J[J.restApi=3]="restApi"}(ua||(ua={})),function(J){J[J.multipleDevice=3002]="multipleDevice",J[J.multipleAccount=3003]="multipleAccount",J[J.usersigExpired=70001]="usersigExpired",J[J.restApi=20002]="restApi"}(la||(la={}));const da={[ua.multipleAccount]:"multipleAccount",[ua.multipleDevice]:"multipleDevice",[ua.restApi]:"REST_API_Kick",[la.multipleAccount]:"multipleAccount",[la.multipleDevice]:"multipleDevice",[la.restApi]:"REST_API_Kick",[la.usersigExpired]:"userSigExpired"},pa="login_online_presence_task",{ERROR:ga,DESTROY:fa,FORCE_OFFLINE:_a}=Mo,{KICKED_OUT_MULT_ACCOUNT:ma,KICKED_OUT_MULT_DEVICE:va,KICKED_OUT_REST_API:ya,ACCOUNT_A2KEY_EXPIRED:Ia,MSG_A2KEY_EXPIRED:Sa}=Wo;class Bs{init(){const{notificationCenter:J}=_o;J.subscribeInnerEvent(_a,this._handleForceOfflineFromServerPush,this),J.subscribeInnerEvent(ga,Sa,this._handleForceOfflineFromResponse,this,this._isChatLoginEvent),J.subscribeInnerEvent(ga,Ia,this._handleForceOfflineFromResponse,this,this._isChatLoginEvent),J.subscribeInnerEvent(ga,ma,this._handleForceOfflineFromResponse,this),J.subscribeInnerEvent(ga,va,this._handleForceOfflineFromResponse,this),J.subscribeInnerEvent(ga,ya,this._handleForceOfflineFromResponse,this),J.subscribeInnerEvent(fa,this._dispose,this)}_handleForceOfflineFromServerPush(J){var Z;if(!0===(null===(Z=_o.store.get("login"))||void 0===Z?void 0:Z.isLoggedIn)){const{EventArray:Z=[]}=(null==J?void 0:J.body)||{};this._extractKickedOutMessages(Z).forEach((J=>{const{KickoutMsgNotify:{KickType:Z,NewInstInfo:ee,Instid:ne}}=J;this._isCurrentInstanceKickedOut(ne)&&this._processKickedOutReasonInfo({kickedOutReasonCode:Z,newInstanceInfo:ee})}))}}_extractKickedOutMessages(J){return J.reduce(((J,Z)=>[...J,...Z.C2cNotifyMsgArray||[]]),[]).filter((J=>{var Z;return this._isKickedOut(null===(Z=null==J?void 0:J.KickoutMsgNotify)||void 0===Z?void 0:Z.KickType)}))}_handleForceOfflineFromResponse(J){const{errorCode:Z}=J;this._processKickedOutReasonInfo({kickedOutReasonCode:Z})}_processKickedOutReasonInfo(J){return ge(this,void 0,void 0,(function*(){const{kickedOutReasonCode:Z}=J,{ssoLog:ee,utils:{safeStringify:ne}}=_o;try{this._logKickedOutEvent(J),this._shouldLogoutAfterKickedOut(Z)?yield _o.login.loginAction.logout(ca.KICKED_OUT):_o.login.loginAction.handleLogoutCompleted()}catch(J){ee.debug("_processKickedOutReasonInfo",` fail ${ne(J)}`)}finally{_o.notificationCenter.emitOuterEvent(So.KICKED_OUT,{data:{type:da[Z]},name:So.KICKED_OUT})}}))}_logKickedOutEvent(J){const{kickedOutReasonCode:Z,newInstanceInfo:ee={}}=J,ne=`type:${da[Z]} newInstanceInfo: ${JSON.stringify(ee)}`;_o.ssoLog.warn("kickedOut",ne)}_isKickedOut(J){return[ua.multipleAccount,ua.multipleDevice,ua.restApi].includes(J)}_isChatLoginEvent(J){const{requestHead:Z}=J||{};return 1!==(null==Z?void 0:Z.idtype)}_shouldLogoutAfterKickedOut(J){return![la.usersigExpired,ua.restApi].includes(J)}_isCurrentInstanceKickedOut(J){const{isLoggedIn:Z,statusInstanceId:ee}=_o.store.get("login")||{};return!0===Z&&J===ee}_dispose(){const{notificationCenter:J}=_o;J.unSubscribeInnerEvent(_a,this._handleForceOfflineFromServerPush,this),J.unSubscribeInnerEvent(ga,Ia,this._handleForceOfflineFromResponse,this),J.unSubscribeInnerEvent(ga,Sa,this._handleForceOfflineFromResponse,this),J.unSubscribeInnerEvent(ga,ma,this._handleForceOfflineFromResponse,this),J.unSubscribeInnerEvent(ga,va,this._handleForceOfflineFromResponse,this),J.unSubscribeInnerEvent(ga,ya,this._handleForceOfflineFromResponse,this),J.unSubscribeInnerEvent(fa,this._dispose,this)}}function js(J){return ge(this,void 0,void 0,(function*(){const Z="im_open_status.wslogin",ee=_o.common.generateProtocolData({servcmd:Z,data:{State:"Online",is_web_uniapp:0,InstType:0,CustomInfo:J}}),ne=`${ee.head.seq}${Z}`,se=yield _o.channel.sendPacket(ee,{timeout:9e4,requestId:ne});if(se){const{HelloInterval:J,InstId:Z,TinyId:ee,TimeStamp:ne,CustomStatus:re,PurchaseBits:ae,A2Key:le,RichMsgAuthKey:pe,ErrorCode:_e,ErrorInfo:ve,ActionStatus:ye}=se;return{helloInterval:J,instanceID:Z,tinyID:ee,timeStamp:ne,customStatus:re,purchaseBits:ae,a2Key:le,authKey:pe,errorCode:_e,errorInfo:ve,actionStatus:ye}}}))}function Hs(){const{store:J}=_o;return ze(J.get("instance").sdkAppId)!==ps.CHINA}function Ks(J){var Z;try{const ee=Ki.getStorage("errorMessage");if(!J||!ee)return"";const ne=(null===(Z=JSON.parse(ee))||void 0===Z?void 0:Z.errorMessage)||{},{code:se,replacement1:re="",replacement2:ae=""}=J;if(!se)return"";const le=Hs()?`${se}_en`:`${se}_cn`;let pe=ne[ne[le]?le:se]||"";return pe&&(re&&(pe=pe.replace("$replacement1",re)),ae&&(pe=pe.replace("$replacement2",ae))),pe}catch(J){return console.warn("Error parsing stored error messages:",J),""}}class Ws extends Error{constructor(J){const{functionName:Z="Unknown",code:ee,message:ne="",data:se="",moreMessage:re=""}=J;let ae=ne;ee&&!ne&&(ae=Ks(J));let le=ee?`${Z} failed. error: {"message": ${ae}, "code": ${ee}}`:`${Z} failed. error: {"message": ${ae}}`;le=`${le} ${re}`,super(),this.code=ee,this.errorCode=ee,this.errorMessage=ae,this.message=le,this.data=se}}function Ys(J,Z){var ee;if(J&&!0!==(null===(ee=_o.store.get("login"))||void 0===ee?void 0:ee.isLoggedIn))throw new Ws({code:Wo.USER_NOT_LOGGED_IN,functionName:Z})}function zs(J,Z,ee){if(Array.isArray(J))for(let ne=0;ne<J.length;ne++)Js.call(this,Object.assign(Object.assign({},J[ne]),{value:Z[ne],name:ee}));else for(const ne in J)Js.call(this,Object.assign(Object.assign({},J[ne]),{value:Z[0][ne],name:ee,key:ne}))}function Js({required:J,rules:Z,range:ee,value:ne,allowEmpty:se,name:re,key:ae,customValidator:le}){if(void 0===ne){if(J)throw new Ws({functionName:re,message:`[${re}] Missing required params: "${ae}"`});return}let pe="";if(!Z.some((J=>{return J===(Z=ne,Object.prototype.toString.call(Z).match(/^\[object (.*)\]$/)[1].toLowerCase());var Z}))){for(let J=0;J<Z.length;J++){let ee=Z[J];ee=ee.replace(ee[0],ee[0].toUpperCase()),pe+=`${ee}/`}pe=pe.substring(0,pe.length-1);const J=`[${ae}] must be type of ${pe}, received type: ${function(J){return Reflect.apply(Object.prototype.toString,J,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}(ne)}.`;throw new Ws({functionName:re,message:J})}if(!1===se){if(Array.isArray(ne)&&(0===ne.length||"string"==typeof ne[0]&&""===ne[0].trim()))throw new Ws({functionName:re,message:`${ae} can not be empty.`});if("string"==typeof ne&&""===ne.trim())throw new Ws({functionName:re,message:`${ae} can not be empty.`})}if(le&&"function"==typeof le){const J=le(ne);if(!0!==J)throw new Ws({functionName:re,message:`[${ae}] custom validation failed: ${J||"Invalid value"}`})}}const Ea=[],Ca={},Ma={};function en(J,Z){Ys(Ca[J],J),zs(Ma[J],Z,J),function(J){Ea.forEach((Z=>{const{interceptor:ee,context:ne}=Z;ee.apply(ne,[J])}))}(J)}function tn(J,Z){Ea.push({interceptor:J,context:Z})}function sn(J){const{params:Z,auth:ee}=J;Z&&"object"==typeof Z&&Object.assign(Ma,Z),ee&&"object"==typeof ee&&Object.assign(Ca,ee)}function nn(J){return _o.store.get("commercialConfig").get(J)}class on{constructor(){this._handlers=new Map,this._activeWorkflows=new Map,this._stepStartTimes=new Map,this._logHandlers={start:(J,Z)=>{const ee=Date.now();Z?(this._stepStartTimes.set(`${J}-${Z}`,ee),_o.ssoLog.debug("_executeWorkflowStep",`[Workflow ${J}] Step ${Z} started at ${new Date(ee).toISOString()}`)):(this._workflowStartTimes.set(J,ee),_o.ssoLog.debug("_executeWorkflowStep",`[Workflow ${J}] started at ${new Date(ee).toISOString()}`))},success:(J,Z)=>{const ee=Date.now();if(Z){const ne=this._stepStartTimes.get(`${J}-${Z}`),se=ne?ee-ne:0;this._stepStartTimes.delete(`${J}-${Z}`),_o.ssoLog.debug("_executeWorkflowStep",`[Workflow ${J}] Step ${Z} completed successfully at ${new Date(ee).toISOString()} (${se}ms)`)}else{const Z=this._workflowStartTimes.get(J),ne=Z?ee-Z:0;this._workflowStartTimes.delete(J),_o.ssoLog.debug("_executeWorkflowStep",`[Workflow ${J}] completed successfully at ${new Date(ee).toISOString()} (${ne}ms)`)}},error:(J,Z,ee)=>{const{ssoLog:ne,utils:{safeStringify:se}}=_o,re=Date.now();if(Z){const ae=this._stepStartTimes.get(`${J}-${Z}`),le=ae?re-ae:0;this._stepStartTimes.delete(`${J}-${Z}`),ne.error("_executeWorkflowStep",`[Workflow ${J}] Step ${Z} failed at ${new Date(re).toISOString()} (${le}ms) ${se(ee)}`,{error:ee})}else{const Z=this._workflowStartTimes.get(J),ae=Z?re-Z:0;this._workflowStartTimes.delete(J),ne.error("_executeWorkflowStep",`[Workflow ${J}] failed at ${new Date(re).toISOString()} (${ae}ms) ${se(ee)}`,{error:ee})}}}}static getInstance(){return on._instance||(on._instance=new on),on._instance}static setInstance(J){on._instance=J}init(){this._initializeWorkflows()}registerWorkflowStep(J,Z,ee,ne){if(!this._handlers.has(J))return void _o.ssoLog.debug("registerWorkflowStep",`Workflow '${J}' not defined in core`);if(!Zo[J].find((J=>J.stepId===Z)))return void _o.ssoLog.debug("registerWorkflowStep",`Step '${Z}' not defined in workflow '${J}'`);const se=this._handlers.get(J);se.has(Z)||se.set(Z,ne?ee.bind(ne):ee)}executeWorkflow(J,Z){return ge(this,void 0,void 0,(function*(){if(!this._validateWorkflow(J))return;_o.ssoLog.debug("executeWorkflow",`[Workflow ${J}] Started execution at ${(new Date).toISOString()}`);const ee=Zo[J],ne={},se={cancelled:!1};this._activeWorkflows.set(J,{cancelToken:se});try{const re=new Map;ee.forEach((J=>{re.set(J.stepId,J)}));const ae={workflowName:J,pendingSteps:new Set(ee.map((J=>J.stepId))),completedSteps:new Set,runningSteps:new Set,stepMap:re,stepResults:ne,data:Z,cancelToken:se};yield new Promise(((Z,ee)=>{const n=()=>{se.cancelled?Z():this._getExecutableSteps({pendingSteps:ae.pendingSteps,completedSteps:ae.completedSteps,stepMap:ae.stepMap,workflowName:J}).filter((J=>!ae.runningSteps.has(J))).forEach((ne=>{ae.completedSteps.has(ne)||ae.runningSteps.has(ne)||this._executeWorkflowStep(ne,ae,{onComplete:()=>{0!==ae.pendingSteps.size?0===this._getExecutableSteps({pendingSteps:ae.pendingSteps,completedSteps:ae.completedSteps,stepMap:ae.stepMap,workflowName:J}).filter((J=>!ae.runningSteps.has(J))).length&&0===ae.runningSteps.size&&(_o.ssoLog.debug("executeWorkflow",`Workflow ${J} completed with some steps skipped due to dependency failures`),Z()):Z()},onError:ee,onStepComplete:n})}))};n()})),_o.ssoLog.debug("executeWorkflow",`[Workflow ${J}] Completed execution at ${(new Date).toISOString()}`)}catch(Z){_o.ssoLog.error("executeWorkflow",`[Workflow ${J}] Failed execution at ${(new Date).toISOString()}`,{error:Z})}finally{this._activeWorkflows.delete(J)}}))}_executeWorkflowStep(J,Z,ee){return ge(this,void 0,void 0,(function*(){const{workflowName:ne,runningSteps:se,stepMap:re,stepResults:ae,data:le}=Z;se.add(J),this._logWorkflowExecution(ne,J,"start");try{const ee=re.get(J);let se=null;(null==ee?void 0:ee.dependency)&&(t(ee.dependency)?se=ae[ee.dependency]:Array.isArray(ee.dependency)&&(se={},ee.dependency.forEach((J=>{se[J]=ae[J]}))));const pe=this._handlers.get(ne).get(J);if(pe){const Z=yield Promise.resolve(pe({data:le,result:se}));ae[J]=Z,this._logWorkflowExecution(ne,J,"success")}Z.completedSteps.add(J)}catch(Z){const se=`[Workflow].${ne}.${J}`,{errorCode:re,errorInfo:ae=`${se} failed`}=Z||{},le=new Ws({functionName:se,code:re,message:ae});_o.ssoLog.error(se,ae,{error:le}),this._logWorkflowExecution(ne,J,"error",Z),ee.onError(Z)}finally{se.delete(J),Z.pendingSteps.delete(J),ee.onStepComplete(),ee.onComplete()}}))}reset(){this._cancelAllWorkflows()}destroy(){this.reset(),this._handlers.clear()}_initializeWorkflows(){Object.keys(Zo).forEach((J=>{this._handlers.has(J)||this._handlers.set(J,new Map)}))}_cancelWorkFlow(J){const Z=this._activeWorkflows.get(J);if(!Z)return;const{cancelToken:ee}=Z;ee.cancelled=!0,this._activeWorkflows.delete(J)}_cancelAllWorkflows(){Object.keys(Zo).forEach((J=>{this._cancelWorkFlow(J)}))}_validateWorkflow(J){return!!Zo[J]&&!!this._handlers.get(J)}_getExecutableSteps(J){const{pendingSteps:Z,completedSteps:ee,stepMap:ne,workflowName:se}=J;return Array.from(Z).filter((J=>{const Z=ne.get(J)||{},{dependency:re,skipIfDependencyMissing:ae=!0}=Z;if(!re)return!0;if(t(re))return this._isStepRegistered({workflowName:se,stepId:re})?ee.has(re):!ae;if(n(re)){if(re.filter((J=>!this._isStepRegistered({workflowName:se,stepId:J}))).length>0&&ae)return!1;for(const J of re)if(!ee.has(J))return!1;return!0}return!1}))}_isStepRegistered(J){var Z;const{workflowName:ee,stepId:ne}=J;return null===(Z=this._handlers.get(ee))||void 0===Z?void 0:Z.has(ne)}_logWorkflowExecution(J,Z,ee,ne){this._logHandlers[ee](J,Z)}}const ba=new Map,an=({type:J,groupID:Z})=>J===Ko.GRP_COMMUNITY||`${Z}`.startsWith(Vo.COMMUNITY)&&!`${Z}`.includes(Vo.TOPIC),cn=(J="")=>{const Z=J.startsWith("GROUP")?J.replace("GROUP",""):J;return Z.startsWith(Vo.COMMUNITY)&&`${Z}`.includes(Vo.TOPIC)};function dn(J){return ge(this,void 0,void 0,(function*(){const{servcmd:Z,data:ee}=function(J){const{data:Z}=J;return hn(Z)||gn(Z)}(J)?function(J){let{servcmd:Z,data:ee}=J;return gn(ee)?function(J){const{servcmd:Z,data:ee}=J;let{GroupId:ne=""}=ee;const se=ne;return[ne]=se.split(Vo.TOPIC),{servcmd:pn(Z),data:Object.assign(Object.assign({},ee),{GroupId:ne,TopicId:se})}}(J):(hn(ee)&&(Z=pn(Z)),{servcmd:Z,data:ee})}(J):J,ne=_o.common.generateProtocolData({servcmd:Z,data:ee}),se=`${ne.head.seq}${Z}`;return _o.channel.sendPacket(ne,{requestId:se,timeout:J.timeout})}))}function hn(J){const{Type:Z,GroupId:ee,GroupIdList:ne=[]}=J,se=ee||ne[0]||"";return an({type:Z,groupID:se})}function gn(J){const{GroupId:Z=""}=J;return cn(Z)}function pn(J){if(J.includes("openim"))return J;return`million_group_open_http_svc.${J.split(".")[1]}`}function _n(){var J;return null===(J=_o.store.get("login"))||void 0===J?void 0:J.userId}const mn=J=>n(J)||o(J),vn=(J,Z,ee,ne)=>{if(!mn(J)||!mn(Z))return 0;let se=0;const re=Object.keys(Z);let ae;for(let le=0,pe=re.length;le<pe;le++)if(ae=re[le],!(e(Z[ae])||ee&&ee.includes(ae)))if(mn(J[ae])&&mn(Z[ae]))se+=vn(J[ae],Z[ae],ee,ne);else{if(ne&&ne.includes(Z[ae]))continue;J[ae]!==Z[ae]&&(J[ae]=Z[ae],se+=1)}return se},Ta={zh:{MSG_IMAGE:"[图片]",MSG_LOCATION:"[位置]",MSG_AUDIO:"[语音]",MSG_VIDEO:"[视频]",MSG_FILE:"[文件]",MSG_CUSTOM:"[自定义消息]",MSG_GRP_TIP:"[群提示消息]",MSG_GRP_SYS_NOTICE:"[群系统通知]",MSG_FACE:"[动画表情]",MSG_MERGER:"[聊天记录]",MSG_STREAM:"[流式消息]",CREATE_GROUP:"创建群组",CREATE_COMMUNITY:"创建社群"},en:{MSG_IMAGE:"[Image]",MSG_LOCATION:"[Location]",MSG_AUDIO:"[Voice]",MSG_VIDEO:"[Video]",MSG_FILE:"[File]",MSG_CUSTOM:"[Custom Messages]",MSG_GRP_TIP:"[Group Notification]",MSG_GRP_SYS_NOTICE:"[Group System Message]",MSG_FACE:"[Animated Sticker]",MSG_MERGER:"[Chat Record]",MSG_STREAM:"[Stream Message]",CREATE_GROUP:"Create Group",CREATE_COMMUNITY:"Create Community"}};function In(J){var Z;const ee=Hs()?"en":"zh";return(null===(Z=Ta[ee])||void 0===Z?void 0:Z[J])||J}const Aa={[Ko.MSG_IMAGE]:"MSG_IMAGE",[Ko.MSG_LOCATION]:"MSG_LOCATION",[Ko.MSG_AUDIO]:"MSG_AUDIO",[Ko.MSG_VIDEO]:"MSG_VIDEO",[Ko.MSG_FILE]:"MSG_FILE",[Ko.MSG_CUSTOM]:"MSG_CUSTOM",[Ko.MSG_GRP_TIP]:"MSG_GRP_TIP",[Ko.MSG_GRP_SYS_NOTICE]:"MSG_GRP_SYS_NOTICE",[Ko.MSG_FACE]:"MSG_FACE",[Ko.MSG_MERGER]:"MSG_MERGER",[Ko.MSG_STREAM]:"MSG_STREAM"},Sn=(J,Z)=>{if(e(Z))return"";if(J===Ko.MSG_TEXT)return Z.text||"";const ee=Aa[J];return ee?In(ee):""},Oa=[{cmd:"ws_get_user_status",interval:5,count:20},{cmd:"ws_status_subscribe",interval:5,count:20},{cmd:"ws_status_unsubscribe",interval:5,count:20},{cmd:"get_group_self_member_info",interval:5,count:20},{cmd:"modify_group_base_info",interval:1,count:8},{cmd:"get_pendency",interval:1,count:15},{cmd:"set_group_attr",interval:5,count:10},{cmd:"modify_group_attr",interval:5,count:10},{cmd:"delete_group_attr",interval:5,count:10},{cmd:"clear_group_attr",interval:5,count:10},{cmd:"get_group_attr",interval:5,count:20},{cmd:"update_group_counter",interval:5,count:20},{cmd:"get_group_counter",interval:5,count:20},{cmd:"get_topic",interval:1,count:10},{cmd:"read_all_unread_msg",interval:1,count:1},{cmd:"query",interval:5,count:20}],wa="im_sdk_config_mgr.fetch_config",Ra="im_sdk_config_mgr.push_configv2",Na="cloud-config",La=new class{init(J){this.core=J}};function Rn(J){return ge(this,void 0,void 0,(function*(){const{sdkAppId:Z}=La.core.store.get("instance")||{},ee=La.core.helper.generateProtocolData({servcmd:wa,data:{uint32_sdkappid:Z,uint64_version:J}}),ne=`${ee.head.seq}${wa}`;return La.core.channel.sendPacket(ee,{requestId:ne})}))}var ka=new class{constructor(){this._core=null,this._expirationTime=0,this._version=0,this._isFetching=!1,this._cmdFrequencyLimitMap=new Map,this._methodCallFrequencyMap=new Map}install(J){this._core=J;const{notificationCenter:Z,InnerEvent:ee,helper:ne,constants:{WORKFLOW_NAME:se,WORKFLOW_STEP:re},channel:ae}=J;Z.subscribeInnerEvent(Ra,this._handlePushedConfig,this),ne.registerWorkflowStep(se.SYNC_SERVER_INFO_AFTER_LOGIN,re.CLOUD_CONFIG_SYNC,this._handleLoginSuccess,this),Z.subscribeInnerEvent(ee.LOGOUT,this._reset,this),Z.subscribeInnerEvent(ee.DESTROY,this._dispose,this),ne.registerExperimentalAPI("getServerConfig",this),this._updateCmdFreqLimitMap(Oa),ae.registerBeforeSendInterceptor(this.checkMethodCallOverLimit,this)}getServerConfig(J){return ge(this,void 0,void 0,(function*(){var Z;const ee={code:0,data:""};return J?(ee.data=(null===(Z=this._core.store.get("cloudConfig"))||void 0===Z?void 0:Z[J])||"",ee):ee}))}checkMethodCallOverLimit(J){if(!this._cmdFrequencyLimitMap.has(J))return;if(!this._methodCallFrequencyMap.has(J))return void this._methodCallFrequencyMap.set(J,{startTime:Date.now(),methodCallCounter:1});const{count:Z,interval:ee}=this._cmdFrequencyLimitMap.get(J);let{startTime:ne,methodCallCounter:se}=this._methodCallFrequencyMap.get(J);if(Date.now()-ne>1e3*ee)this._methodCallFrequencyMap.set(J,{startTime:Date.now(),methodCallCounter:1});else if(se+=1,this._methodCallFrequencyMap.set(J,{startTime:ne,methodCallCounter:se}),se>Z)throw new this._core.helper.ChatError({code:2996,replacement1:J})}_handlePushedConfig(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z,utils:{safeStringify:ee}}=this._core;Z.info("_handlePushedConfig",ee(J)),yield this._updateCloudConfig(J)}))}_handleLoginSuccess(){return ge(this,void 0,void 0,(function*(){const{ssoLog:J,utils:{safeStringify:Z}}=this._core;try{if(this._canFetch()){const ee=yield Rn(this._version);J.info("_fetchCloudConfigIfLogin",Z(ee)),yield this._updateCloudConfig(ee)}this._core.helper.taskScheduler.addTask({id:Na,intervalMs:1e3,callback:this._fetchCloudConfigIfReady,context:this})}catch(ee){J.debug("_fetchCloudConfigIfLogin",Z(ee))}}))}_fetchCloudConfigIfReady(){return ge(this,void 0,void 0,(function*(){const{ssoLog:J,utils:{safeStringify:Z}}=this._core;if(this._canFetch())try{const ee=yield Rn(this._version);J.info("_fetchCloudConfigIfReady",Z(ee)),yield this._updateCloudConfig(ee)}catch(ee){J.error("_fetchCloudConfigIfReady",Z(ee))}}))}_updateCloudConfig(J){return ge(this,void 0,void 0,(function*(){const Z=this._parseCloudConfig(J);Z&&(this._core.store.set("cloudConfig",Z),yield this._parseCmdFreqLimit(),this._core.notificationCenter.emitInnerEvent(this._core.InnerEvent.CLOUD_CONFIG_UPDATE,Z),this._core.notificationCenter.emitOuterEvent(this._core.OuterEvent.SERVER_CONFIG_UPDATED,{name:this._core.OuterEvent.SERVER_CONFIG_UPDATED,data:{config:Z}}))}))}_canFetch(){const{isLoggedIn:J}=this._core.store.get("login")||{};return J&&!this._isFetching&&Date.now()>=this._expirationTime}_parseCloudConfig(J){const{int32_error_code:Z,str_error_message:ee,str_json_config:ne,uint32_expired_time:se,uint32_sdkappid:re,uint64_version:ae}=J;let le=null;if(0===Z){if(this._version!==ae)try{le=JSON.parse(ne),this._version=ae}catch(J){}this._expirationTime=Date.now()+1e3*se}else this._expirationTime=void 0===Z?Date.now()+36e5:Date.now()+12e4;return le}_parseCmdFreqLimit(){return ge(this,void 0,void 0,(function*(){var J;let Z=null===(J=yield this.getServerConfig("cmd_frequency_limit"))||void 0===J?void 0:J.data;const{isEmpty:ee}=this._core.utils;if(!ee(Z))try{Z=JSON.parse(Z),this._updateCmdFreqLimitMap(Z)}catch(J){console.warn(J)}}))}_updateCmdFreqLimitMap(J){J.forEach((J=>{this._cmdFrequencyLimitMap.set(J.cmd,{interval:J.interval,count:J.count})}))}_reset(){this._core.helper.taskScheduler.removeTask(Na),this._core.store.clear("cloudConfig"),this._updateCmdFreqLimitMap(Oa),this._methodCallFrequencyMap.clear(),this._expirationTime=0,this._version=0,this._isFetching=!1}_dispose(){const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Ra,this._handlePushedConfig,this),J.unSubscribeInnerEvent(Z.LOGOUT,this._reset,this),J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this),this._reset()}};class bn{constructor(J=0,Z=0){this.high=J,this.low=Z}equal(J){return null!==J&&this.low===J.low&&this.high===J.high}toString(){const J=Number(this.high).toString(16);let Z=Number(this.low).toString(16);if(Z.length<8){let J=8-Z.length;for(;J;)Z=`0${Z}`,J--}return J+Z}}const Pa={SEARCH_GRP_SNS:new bn(0,Math.pow(2,1)).toString(),AV_HISTORY_MSG:new bn(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new bn(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new bn(0,Math.pow(2,4)).toString(),AV_MBR_LIST:new bn(0,Math.pow(2,6)).toString(),USER_STATUS:new bn(0,Math.pow(2,7)).toString(),CONV_MARK:new bn(0,Math.pow(2,9)).toString(),CONV_GROUP:new bn(0,Math.pow(2,10)).toString(),AV_BAN_MBR:new bn(0,Math.pow(2,11)).toString(),MSG_EXT:new bn(0,Math.pow(2,13)).toString(),GRP_COUNTER:new bn(0,Math.pow(2,15)).toString(),PLUGIN_TRANSLATE:new bn(Math.pow(2,6)).toString(),PLUGIN_VOICE_TO_TEXT:new bn(Math.pow(2,7)).toString(),PLUGIN_CS:new bn(Math.pow(2,8)).toString(),PLUGIN_PUSH:new bn(Math.pow(2,9)).toString(),PLUGIN_BOT:new bn(Math.pow(2,10)).toString(),MSG_REACTION:new bn(Math.pow(2,16)).toString(),FOLLOW:new bn(Math.pow(2,20)).toString()},Ua="CommercialConfig",Ga="commercial-config";var xa,Fa,Ba=new class{constructor(){this._core=null,this._expirationTime=0,this._isFetching=!1,this._featureMap=new Map,this._methodKeyMap=new Map,this._purchaseBits="0"}install(J){this._core=J;const{helper:Z,notificationCenter:ee,constants:{WORKFLOW_NAME:ne,WORKFLOW_STEP:se,InnerEvent:re}}=J;ee.subscribeInnerEvent(re.COMMERCIAL_CONFIG_PUSH,this._handlePushedConfig,this),ee.subscribeInnerEvent(re.LOGOUT,this._handleLogout,this),ee.subscribeInnerEvent(re.DESTROY,this._dispose,this),Z.registerWorkflowStep(ne.SYNC_SERVER_INFO_AFTER_LOGIN,se.COMMERCIAL_CONFIG_UPDATE,this._syncCommercialConfig,this),J.helper.registerExperimentalAPI("isCommercialAbilityEnabled",this),J.helper.registerExperimentalAPI("queryCommercialAbility",this)}isCommercialAbilityEnabled(J){return ge(this,void 0,void 0,(function*(){const Z=parseInt(J,10).toString(2),{length:ee}=Z;let ne,se=!0;for(let J=ee-1,re=0;J>=0;J--,re++)if("1"===Z.charAt(J)&&(ne=re<32?new bn(0,2**re).toString():new bn(2**(re-32),0).toString(),!this._featureMap.get(ne))){se=!1;break}return this._core.ssoLog.debug("isFeatureEnabled",`${Ua}.isFeatureEnabled decimalNumber:${J} key:${ne} ret:${se}`),{code:0,data:{enabled:se}}}))}queryCommercialAbility(){return this._purchaseBits}_fetchAndParseCommercialConfig(){return ge(this,void 0,void 0,(function*(){var J;const{ssoLog:Z,utils:{safeStringify:ee},common:{buildAndSendPacket:ne}}=this._core;try{this._isFetching=!0;const Z=yield ne({servcmd:"im_sdk_config_mgr.fetch_imsdk_purchase_bitsv2",data:{uint32_sdkappid:null===(J=this._core.store.get("instance"))||void 0===J?void 0:J.sdkAppId}});Z&&(this._parseCommercialConfig(Z),this._core.store.set("commercialConfig",this._methodKeyMap))}catch(J){Z.error("_fetchAndParseCommercialConfig",ee(J))}finally{this._isFetching=!1}}))}_syncCommercialConfig(J){return ge(this,void 0,void 0,(function*(){const{purchaseBits:Z}=(null==J?void 0:J.data)||{};Z&&(this._parsePurchaseBits(Z),this._core.store.set("commercialConfig",this._methodKeyMap)),this._canFetch()&&(yield this._fetchAndParseCommercialConfig()),this._core.helper.taskScheduler.addTask({id:Ga,intervalMs:1e3,callback:this._fetchCommercialConfigIfReady,context:this})}))}_canFetch(){var J;const Z=null===(J=this._core.store.get("login"))||void 0===J?void 0:J.isLoggedIn,ee=Date.now()>=this._expirationTime;return Z&&!this._isFetching&&ee}_handlePushedConfig(J){(null==J?void 0:J.body)&&(this._parseCommercialConfig(J.body),this._core.store.set("commercialConfig",this._methodKeyMap))}_fetchCommercialConfigIfReady(){return ge(this,void 0,void 0,(function*(){this._canFetch()&&(yield this._fetchAndParseCommercialConfig())}))}_parseCommercialConfig(J){const{ssoLog:Z}=this._core;if("object"!=typeof J)return;const{int32_error_code:ee,str_error_message:ne,str_purchase_bits:se,uint32_expired_time:re}=J;0===ee?(this._parsePurchaseBits(se),this._expirationTime=Date.now()+1e3*re):void 0===ee?(Z.warn("_parseCommercialConfig",`${Ua}._parseCommercialConfig failed. Invalid message format:`,J),this._expirationTime=Date.now()+36e5):(Z.warn("_parseCommercialConfig",`${Ua}._parseCommercialConfig errorCode:${ee} errorMessage:${ne}`),this._expirationTime=Date.now()+12e4)}_isValidPurchaseBits(J){return J&&"string"==typeof J&&J.length>=1&&J.length<=64&&/[01]{1,64}/.test(J)}_parsePurchaseBits(J){const{ssoLog:Z,utils:{safeStringify:ee}}=this._core;if(this._isValidPurchaseBits(J)){this._purchaseBits=J,this._featureMap.clear(),this._methodKeyMap.clear();let Z=null;for(let ee=J.length-1,ne=0;ee>=0;ee--,ne++)if(Z=ne<32?new bn(0,2**ne).toString():new bn(2**(ne-32),0).toString(),"1"===J[ee]){this._featureMap.set(Z,!0);const J=this._getKeyByValue(Pa,Z);J&&this._methodKeyMap.set(J,!0)}else{this._featureMap.set(Z,!1);const J=this._getKeyByValue(Pa,Z);J&&this._methodKeyMap.set(J,!1)}}else Z.warn("_parsePurchaseBits",`${Ua}.parsePurchaseBits invalid purchases:${ee(J)}`)}_getKeyByValue(J,Z){const ee=Object.entries(J).find((([J,ee])=>ee===Z));return ee?ee[0]:void 0}_handleLogout(){this._reset()}_dispose(){this._reset(),this._core.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.COMMERCIAL_CONFIG_PUSH,this._handlePushedConfig,this),this._core.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.LOGOUT,this._reset,this),this._core.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.DESTROY,this._dispose,this)}_reset(){this._core.helper.taskScheduler.removeTask(Ga),this._core.store.set("commercialConfig",{}),this._expirationTime=0,this._isFetching=!1,this._featureMap.clear(),this._purchaseBits="0"}},qa=new class{constructor(){this._core=null,this._serverOverloadInfoMap=new Map}install(J){this._core=J;const{notificationCenter:Z,InnerEvent:ee,channel:ne}=this._core;Z.subscribeInnerEvent(ee.OVERLOAD_PUSH,this._handleOverLoadPush,this),Z.subscribeInnerEvent(ee.LOGOUT,this._reset,this),Z.subscribeInnerEvent(ee.DESTROY,this._dispose,this),ne.registerBeforeSendInterceptor(this.checkServerOverload,this)}checkServerOverload(J){if(!this._serverOverloadInfoMap.has(J))return;const{overloadStartTimestamp:Z,delaySeconds:ee}=this._serverOverloadInfoMap.get(J);if(Date.now()-Z<=1e3*ee)throw new this._core.helper.ChatError({functionName:J,message:"service is busy, please try again later"});this._serverOverloadInfoMap.delete(J)}_handleOverLoadPush(J){const{OverLoadServCmd:Z,DelaySecs:ee}=J;this._serverOverloadInfoMap.set(Z,{overloadStartTimestamp:Date.now(),delaySeconds:ee})}_reset(){this._serverOverloadInfoMap.clear()}_dispose(){this._reset();const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Z.OVERLOAD_PUSH,this._handleOverLoadPush,this),J.unSubscribeInnerEvent(Z.LOGOUT,this._reset,this),J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this)}},Va=new class{constructor(){this.name="ConfigCenter"}install(J){La.init(J),ka.install(J),Ba.install(J),qa.install(J)}},$a=new class{constructor(){this.name="ErrorMessage",this._core=null}install(J){return ge(this,void 0,void 0,(function*(){if(this._core=J,this._canFetch()){const J=yield this._fetchErrorMessage();if(!J)return;const Z=this._parseResponse(J);this._saveErrorMessage(Z)}}))}_canFetch(){const J=this._core.store.getStorage("errorMessage");return!J||this._isExpired(J)}_saveErrorMessage(J){this._core.store.setStorage("errorMessage",{errorMessage:J,errorMessageSavedTime:(new Date).getTime()})}_fetchErrorMessage(){return ge(this,void 0,void 0,(function*(){try{return yield this._core.helper.httpRequest({method:"GET",url:"https://web.sdk.qcloud.com/im/download/error-message/v3/0.0.6/tim-error-message.txt"})}catch(J){console.error(J)}}))}_isExpired(J){if(!J)return!0;const{errorMessageSavedTime:Z}=J;return Z&&(new Date).getTime()-Z>=6048e5}_parseResponse(J){if("string"==typeof J){const Z=J.split(";\n"),ee={},ne=new RegExp(/'/g);for(let J=0;J<Z.length;J++){const se=Z[J].indexOf(":"),re=Z[J].slice(0,se);let ae=Z[J].slice(se+1);if(!re.startsWith("//")){if(""===ae)continue;ae=ae.replace(ne,""),ee[re]=ae}}return ee}}};!function(J){J[J.START_SYNC=0]="START_SYNC",J[J.SYNCING=1]="SYNCING",J[J.SYNC_COMPLETE=2]="SYNC_COMPLETE"}(xa||(xa={})),function(J){J[J.LOGIN_SUCCESS=0]="LOGIN_SUCCESS",J[J.NEW_MESSAGE_RECEIVED=1]="NEW_MESSAGE_RECEIVED"}(Fa||(Fa={}));var ja=new class{constructor(){this.name="UnreadMessageSynchronizer",this._unreadDBMessageMap=new Map,this._cookie="",this._localConversationIDListBeforeDisconnect=[]}install(J){this._core=J;const{constants:Z}=J;J.helper.registerWorkflowStep(Z.WORKFLOW_NAME.SYNC_SERVER_INFO_AFTER_RE_ONLINE,Z.WORKFLOW_STEP.UNREAD_MESSAGE_SYNC,this._syncUnreadDBMessageAfterReOnline,this),J.helper.registerWorkflowStep(Z.WORKFLOW_NAME.RECEIVE_C2C_NEW_MESSAGE,Z.WORKFLOW_STEP.UNREAD_MESSAGE_SYNC,this._syncUnreadDBMessageAfterNewMessageReceived,this),J.helper.registerWorkflowStep(Z.WORKFLOW_NAME.SYNC_SERVER_INFO_AFTER_LOGIN,Z.WORKFLOW_STEP.UNREAD_MESSAGE_SYNC,this._syncUnreadDBMessageAfterLogin,this),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.SOCKET_DISCONNECTED,this._handleDisconnect,this),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.LOGOUT,this._reset,this),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.DESTROY,this._dispose,this)}_syncUnreadMessage(J){return ge(this,void 0,void 0,(function*(){const{isAfterReOnline:Z=!1,isAfterNewMessageReceived:ee=!1,isAfterLogin:ne=!1}=J||{};let se=xa.START_SYNC;const re=[],ae=[],le=[],pe=[];for(;this._canContinueSync({cookie:this._cookie,syncFlag:se});){const J=yield this._fetchUnreadDBMessage({cookie:this._cookie,syncFlag:se,syncTriggerEvent:ee?Fa.NEW_MESSAGE_RECEIVED:Fa.LOGIN_SUCCESS});if(!J)break;const{unreadMessageList:ne=[],revokedMessageList:_e=[],overflowUnreadCountList:ve,unreadCountList:ye,groupTipList:Fe}=J;if(this._cookie=(null==J?void 0:J.cookie)||"",se=null==J?void 0:J.syncFlag,this._parseAndSaveUnreadMessageList(ne),le.push(..._e),this._updateConversationUnreadOptions({unreadCountList:ye,overflowUnreadCountList:ve,conversationUpdateFieldList:re}),Array.isArray(Fe)&&ae.push(...Fe),Z){const{messages:J}=this._handleNewMessageList(ne);pe.push(...J)}}return Z?{conversationUpdateFieldList:re,revokedMessageList:le,unreadMessageMap:this._unreadDBMessageMap,groupTipList:ae,messages:pe}:{conversationUpdateFieldList:re,isInstantMessage:!ne,isUnreadC2CMessage:!0,revokedMessageList:le,unreadMessageMap:this._unreadDBMessageMap,groupTipList:ae}}))}_syncUnreadDBMessageAfterLogin(){return ge(this,void 0,void 0,(function*(){return this._cookie="",this._syncUnreadMessage({isAfterLogin:!0})}))}_syncUnreadDBMessageAfterNewMessageReceived(J){return ge(this,void 0,void 0,(function*(){if(1===J.data.Flag)return this._syncUnreadMessage({isAfterNewMessageReceived:!0})}))}_updateConversationUnreadOptions(J){const{unreadCountList:Z,overflowUnreadCountList:ee,conversationUpdateFieldList:ne}=J,{constants:{OuterConstant:{CONV_C2C:se,CONV_SYSTEM:re}}}=this._core;null==Z||Z.forEach((J=>{const{From_Account:Z,UnreadCount:ee}=J;if(Z!==re){const J=ne.find((({conversationID:J})=>J===`${se}${Z}`));J?J.unreadCount=ee:ne.push({conversationID:`${se}${Z}`,unreadCount:ee,type:se})}})),null==ee||ee.forEach((J=>{const{From_Account:Z,LastMsgTime:ee}=J;Z!==re&&(ne.find((({conversationID:J})=>J===`${se}${Z}`))||ne.push({conversationID:`${se}${Z}`,type:se,lastMsgTime:ee}))}))}_syncUnreadDBMessageAfterReOnline(){return ge(this,void 0,void 0,(function*(){return this._syncUnreadMessage({isAfterReOnline:!0})}))}_updateMessageProfile(J){var Z;const{messageDataHandler:ee}=this._core.message||{},ne=null===(Z=this._core.store.get("login"))||void 0===Z?void 0:Z.userId,{from:se,nick:re,avatar:ae,conversationID:le=""}=J;if(se!==ne){const Z=ee.getLatestMsgSentByPeer(le);if(Z){const{nick:ne,avatar:se}=Z;re&&ae?re===ne&&ae===se||ee.updateNickAndAvatarOfSentMessage({conversationID:le,latestNick:re,latestAvatar:ae,isSentByMe:!1}):(J.nick=ne,J.avatar=se)}}else{const J=ee.getLatestMsgSentByMe(le);!J||re===J.nick&&ae===J.avatar||ee.updateNickAndAvatarOfSentMessage({conversationID:le,latestNick:re,latestAvatar:ae,isSentByMe:!0})}}_handleNewMessageList(J){const{messageDataHandler:Z}=this._core.message||{},ee=new Map,ne=[];return J.forEach((J=>{this._updateMessageProfile(J);let se=1===J.isModified;if(Z.isMessageSentByCurrentInstance(J)?J.isModified=se:se=!1,J.isOnlineMessage())J._onlineOnlyFlag=!0,Z.isMessageSentByCurrentInstance(J)||ne.push(J);else if(this._shouldStoreUnreadMessage(J)){if(Z.storeConversationMessage(J)){const{conversationID:Z,conversationType:ne,conversationSubType:se,flow:re,_isExcludedFromUnreadCount:ae,_isExcludedFromLastMessage:le}=J,pe=le?"":J;ee.has(Z)?(ee.get(Z).lastMessage=pe,"in"===re&&(ae||ee.get(Z).unreadCount++)):ee.set(Z,{conversationID:Z,type:ne,subType:se,unreadCount:ae||"in"!==re?0:1,lastMessage:pe})}Z.isMessageSentByCurrentInstance(J)&&!se||ne.push(J)}})),{messages:ne,conversationOptions:ee}}_shouldStoreUnreadMessage(J){var Z;const{conversationID:ee}=J,{message:ne,appStore:se,utils:{isEmpty:re}}=this._core||{},ae=Array.from((null===(Z=se.conversationStore.getConversationMap())||void 0===Z?void 0:Z.keys())||[]),le=this._getLocalLastMessageTime(ee);return!ne.messageDataHandler.isInMessageList(J)&&ae.includes(ee)&&this._localConversationIDListBeforeDisconnect.includes(ee)&&!re(le)}_fetchUnreadDBMessage(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z,utils:{safeStringify:ee}}=this._core;try{const ne="unread-message-synchronizer._fetchUnreadDBMessage";Z.debug("_fetchUnreadDBMessage",`${ne} options:${ee(J)}`);const se=yield function Fn(J,Z){return ge(this,void 0,void 0,(function*(){const{cookie:ee,syncFlag:ne,syncTriggerEvent:se}=J,re="openim.getmsg",ae=Z.helper.generateProtocolData({servcmd:re,data:{Cookie:ee,SyncFlag:ne,IsOnlineSync:se,NeedAbstract:1,NeedSignaling:1,NeedCachedMsg:1}}),le=`${ae.head.seq}${re}`;try{const J=yield Z.channel.sendPacket(ae,{requestId:le});if(!J)return null;const{C2CPairUnreadCount:ee,C2CRemainingUnreadCount:ne,EventArray:se}=J,{unreadMessageList:re,revokedMessageList:pe}=function(J,Z){const ee=[],ne=[];return null==J||J.forEach((J=>{var se,re,ae;const le=function(J,Z){const{From_Account:ee,From_AccountHeadurl:ne,From_AccountNick:se,IsNeedReadReceipt:re,MsgBody:ae,MsgClientTime:le,MsgRandom:pe,MsgSeq:_e,MsgTimeStamp:ve,SendMsgControl:ye,SupportMessageExtension:Fe,To_Account:qe,TinyId:$e,MsgCheckResult:He,CloudCustomData:Ye,IsPeerRead:Je,MsgFlagBits:Xe,MsgVersion:Qe,EventArray:tt}=J;return{from:ee,avatar:ne,nick:se,needReadReceipt:1===re,readReceiptSentByPeer:Je,clientTime:le,messageFlagBits:Xe,random:pe,sequence:_e,time:ve,messageControlInfo:ye,isSupportExtension:Fe,to:qe,tinyID:$e,checkResult:He,cloudCustomData:Ye,messageVersion:Qe,eventArray:tt,elements:Z.message.messageHelper.parseServerPushMessageElement(ae)}}(J,Z);if(null===(ae=null===(re=null===(se=null==J?void 0:J.EventArray)||void 0===se?void 0:se[0])||void 0===re?void 0:re.hasOwnProperty)||void 0===ae?void 0:ae.call(re,"C2cNotifyMsgArray"))ne.push(...function(J){var Z;const ee=[];return null===(Z=J.EventArray)||void 0===Z||Z.forEach((J=>{var Z,ne;const{C2cNotifyMsgArray:se}=J,re=null===(ne=null===(Z=null==se?void 0:se[0])||void 0===Z?void 0:Z.WithdrawC2cMsgNotify)||void 0===ne?void 0:ne.C2cWithdrawInfoArray;Array.isArray(re)&&ee.push(...re)})),ee}(J));else{const J=Z.message.messageFactory.createMessage(Object.assign(Object.assign({},le),{conversationType:"C2C",flow:"in"})),{elements:ne}=le;J.setElement(ne),ee.push(J)}})),{unreadMessageList:ee,revokedMessageList:ne}}(J.MsgList,Z);return{syncFlag:null==J?void 0:J.SyncFlag,unreadMessageList:re,revokedMessageList:pe,unreadCountList:ee,overflowUnreadCountList:ne,cookie:null==J?void 0:J.Cookie,groupTipList:se}}catch(J){console.warn(J)}}))}(J,this._core);if(!se)return null;const{syncFlag:re,unreadMessageList:ae,revokedMessageList:le,cookie:pe,unreadCountList:_e,overflowUnreadCountList:ve,groupTipList:ye}=se;return this._parseAndSaveUnreadMessageList(ae),{syncFlag:re,cookie:pe,unreadMessageList:ae,revokedMessageList:le,unreadCountList:_e,overflowUnreadCountList:ve,groupTipList:ye}}catch(J){console.log(J)}}))}_canContinueSync({cookie:J,syncFlag:Z}){var ee;return Z===xa.START_SYNC||Z===xa.SYNCING&&!(null===(ee=this._core)||void 0===ee?void 0:ee.helper.isEmpty(J))}_parseAndSaveUnreadMessageList(J){J.forEach((J=>{const{ID:Z}=J;this._unreadDBMessageMap.set(Z,J)}))}_handleDisconnect(){var J;const{appStore:Z}=this._core;this._localConversationIDListBeforeDisconnect=Array.from((null===(J=Z.conversationStore.getConversationMap())||void 0===J?void 0:J.keys())||[])}_getLocalLastMessageTime(J){const{message:Z}=this._core,ee=Z.messageDataHandler.getLocalMessageList(J),ne=ee[ee.length-1];return null==ne?void 0:ne.time}_reset(){this._cookie="",this._unreadDBMessageMap.clear()}_dispose(){var J,Z;null===(J=this._core)||void 0===J||J.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.LOGOUT,this._reset,this),null===(Z=this._core)||void 0===Z||Z.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.DESTROY,this._dispose,this),this._reset()}},Ha=new class{init(J){var Z;this._core=J,this._visibilityChangeHandler=this._handleVisibilityChange.bind(this),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.DESTROY,this._dispose,this),null===document||void 0===document||document.addEventListener("visibilitychange",this._visibilityChangeHandler),null===(Z=this._core)||void 0===Z||Z.store.set("activityMonitor",{isActive:!0})}_handleVisibilityChange(){var J,Z;const ee="visible"===document.visibilityState;null===(J=this._core)||void 0===J||J.store.set("activityMonitor",{isActive:ee}),null===(Z=this._core)||void 0===Z||Z.notificationCenter.emitInnerEvent("activityStatusChange",{isActive:ee})}_reset(){var J;null===(J=this._core)||void 0===J||J.store.clear("activityMonitor")}_dispose(){document.removeEventListener("visibilitychange",this._visibilityChangeHandler);const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this),this._reset()}},Ka=new class{init(J){var Z;this._core=J,this._bindAppActivityEvent(),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.DESTROY,this._dispose,this),null===(Z=this._core)||void 0===Z||Z.store.set("activityMonitor",{isActive:!0})}_bindAppActivityEvent(){var J,Z,ee,ne,se;const{MINI_APP_NAMESPACE:re,IN_TT_MINI_GAME:ae,IN_WX_MINI_GAME:le}=(null===(J=this._core)||void 0===J?void 0:J.utils)||{};ae||le?(null===(Z=null==re?void 0:re.onShow)||void 0===Z||Z.call(re,(()=>{var J,Z;null===(J=this._core)||void 0===J||J.store.set("activityMonitor",{isActive:!0}),null===(Z=this._core)||void 0===Z||Z.notificationCenter.emitInnerEvent("activityStatusChange",{isActive:!0})})),null===(ee=null==re?void 0:re.onHide)||void 0===ee||ee.call(re,(()=>{var J,Z;null===(J=this._core)||void 0===J||J.store.set("activityMonitor",{isActive:!1}),null===(Z=this._core)||void 0===Z||Z.notificationCenter.emitInnerEvent("activityStatusChange",{isActive:!1})}))):(null===(ne=null==re?void 0:re.onAppShow)||void 0===ne||ne.call(re,(()=>{var J,Z;null===(J=this._core)||void 0===J||J.store.set("activityMonitor",{isActive:!0}),null===(Z=this._core)||void 0===Z||Z.notificationCenter.emitInnerEvent("activityStatusChange",{isActive:!0})})),null===(se=null==re?void 0:re.onAppHide)||void 0===se||se.call(re,(()=>{var J,Z;null===(J=this._core)||void 0===J||J.store.set("activityMonitor",{isActive:!1}),null===(Z=this._core)||void 0===Z||Z.notificationCenter.emitInnerEvent("activityStatusChange",{isActive:!1})})))}_reset(){var J;null===(J=this._core)||void 0===J||J.store.clear("activityMonitor")}_dispose(){const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this),this._reset()}},Wa=new class{init(J){const{IN_MINI_APP:Z,IN_WX_MINI_PLUGIN:ee}=J.helper;ee||(Z?Ka.init(J):Ha.init(J))}};var Ya=new class{init(J){this._core=J,this._activateNetworkMonitoring(),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.DESTROY,this._dispose,this)}_activateNetworkMonitoring(){return ge(this,void 0,void 0,(function*(){navigator.onLine?this._onOnline():this._onOffline(),this._onOnlineCallback=this._onOnline.bind(this),this._onOfflineCallback=this._onOffline.bind(this),window.addEventListener("online",this._onOnlineCallback),window.addEventListener("offline",this._onOfflineCallback)}))}_deactivateNetworkMonitoring(){null!==this._onOnlineCallback&&(window.removeEventListener("online",this._onOnlineCallback),this._onOnlineCallback=null),null!==this._onOfflineCallback&&(window.removeEventListener("offline",this._onOfflineCallback),this._onOfflineCallback=null)}_onNetworkStatusChange(J){var Z,ee;const{isConnected:ne,networkType:se}=J;null===(Z=this._core)||void 0===Z||Z.store.set("netWorkMonitor",{isNetworkOnline:ne,networkType:se}),null===(ee=this._core)||void 0===ee||ee.notificationCenter.emitInnerEvent("networkStatusChange",{isNetworkOnline:ne,networkType:se})}_onOnline(){this._onNetworkStatusChange({isConnected:!0,networkType:"online"})}_onOffline(){this._onNetworkStatusChange({isConnected:!1,networkType:"none"})}_reset(){var J;this._deactivateNetworkMonitoring(),null===(J=this._core)||void 0===J||J.store.clear("netWorkMonitor")}_dispose(){var J,Z;null===(J=this._core)||void 0===J||J.notificationCenter.unSubscribeInnerEvent(null===(Z=this._core)||void 0===Z?void 0:Z.InnerEvent.DESTROY,this._dispose,this),this._reset()}},za=new class{init(J){this._core=J,this._activateNetworkMonitoring(),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.DESTROY,this._dispose,this)}_activateNetworkMonitoring(){return ge(this,void 0,void 0,(function*(){try{const{utils:{MINI_APP_NAMESPACE:J}}=this._core;this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),J.onNetworkStatusChange(this._onNetworkStatusChange.bind(this))}catch(J){console.error(J)}}))}_deactivateNetworkMonitoring(){if(null!==this._mpNetworkStatusCallback){const{utils:{MINI_APP_NAMESPACE:J}}=this._core;J.offNetworkStatusChange&&J.offNetworkStatusChange(this._mpNetworkStatusCallback),this._mpNetworkStatusCallback=null}}_onNetworkStatusChange(J){var Z,ee;const{isConnected:ne,networkType:se}=J;null===(Z=this._core)||void 0===Z||Z.store.set("netWorkMonitor",{isNetworkOnline:ne,networkType:se}),null===(ee=this._core)||void 0===ee||ee.notificationCenter.emitInnerEvent("networkStatusChange",{isNetworkOnline:ne,networkType:se})}_reset(){var J;this._deactivateNetworkMonitoring(),null===(J=this._core)||void 0===J||J.store.clear("netWorkMonitor")}_dispose(){var J,Z;null===(J=this._core)||void 0===J||J.notificationCenter.unSubscribeInnerEvent(null===(Z=this._core)||void 0===Z?void 0:Z.InnerEvent.DESTROY,this._dispose,this),this._reset()}},Ja=new class{init(J){const{IN_MINI_APP:Z}=J.utils;Z?za.init(J):Ya.init(J)}},Za=new class{constructor(){this.name="SystemStateMonitor"}install(J){Wa.init(J),Ja.init(J)}};const Xa=new Set(["tui_room_svr.*","callkit_records_svr.*","room_engine_srv.*","room_engine_http_srv.*","room_engine_mic.*","live_engine_srv.*","live_engine_http_srv.*","live_engine_pk.*","trtc_ai_service.*","call_engine_srv.*"]),Qa="tui_room_svr.*";var ec=new class{constructor(){this.name="BusinessCommandTransfer",this._transferredCommands=Xa}install(J){this._core=J;const{notificationCenter:Z,InnerEvent:ee,helper:ne}=J;Z.subscribeInnerEvent(ee.CLOUD_CONFIG_UPDATE,this._onCloudConfigUpdate,this),Z.subscribeInnerEvent(ee.LOGOUT,this._reset,this),Z.subscribeInnerEvent(ee.DESTROY,this._dispose,this),Z.subscribeInnerEvent("im_open_push.msg_push",Z.InnerEventSubType.BUSINESS_COMMAND,this._onServerPushBusinessCommand,this),ne.registerExperimentalAPI("sendTRTCCustomData",this,"transferBusinessCommand"),ne.registerExperimentalAPI("sendRoomCustomData",this,"transferBusinessCommand")}transferBusinessCommand(J){return ge(this,void 0,void 0,(function*(){const Z="transferBusinessCommand";try{const{serviceCommand:ee=Qa}=J||{};if(!this._isValidTransferredCommand(ee))throw new this._core.helper.ChatError({code:2995,functionName:Z});const ne=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{helper:ee,channel:ne}=Z,{serviceCommand:se=Qa,data:re}=J||{};let ae={};try{ae="string"==typeof re?JSON.parse(re):re}catch(J){console.warn(J)}const le=ee.generateProtocolData({servcmd:se,data:ae}),pe=`${le.head.seq}${se}`;return ne.sendPacket(le,{requestId:pe,shouldRejectOnError:!1})}))}(J,this._core);return{code:0,data:ne||{}}}catch(J){throw console.warn(J),new this._core.helper.ChatError({code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo,data:{},functionName:Z})}}))}_onCloudConfigUpdate(J={}){try{if("string"!=typeof J.rtc_cmd)return;const Z=JSON.parse(J.rtc_cmd);Array.isArray(Z)&&(this._transferredCommands=new Set([...this._transferredCommands,...Z]))}catch(J){console.log(J)}}_isValidTransferredCommand(J=""){const Z=`${null==J?void 0:J.split(".")[0]}.*`;return this._transferredCommands.has(Z)}_onServerPushBusinessCommand(J){const{OuterEvent:Z,notificationCenter:ee}=this._core,{MsgContent:ne}=J||{},{ROOM_CUSTOM_DATA_RECEIVED:se}=Z;ee.emitOuterEvent(se,{name:se,data:ne})}_reset(){this._transferredCommands=Xa}_dispose(){const{notificationCenter:J,InnerEvent:Z}=this._core;this._reset(),J.unSubscribeInnerEvent(Z.CLOUD_CONFIG_UPDATE,this._onCloudConfigUpdate,this),J.unSubscribeInnerEvent(Z.LOGOUT,this._reset,this),J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this),J.unSubscribeInnerEvent("im_open_push.msg_push",J.InnerEventSubType.BUSINESS_COMMAND,this._onServerPushBusinessCommand,this)}};const tc="signaling",nc="signaling-timeout";function vo(J){return J.filter((J=>{if("TIMCustomElem"===J.type){const{cloudCustomData:Z="",payload:{data:ee=""}={}}=J,ne=Z.match(/"type":"tsignaling"/),se=ee.match(/inviteID/),re=ee.match(/actionType/);return ne||se&&re}return!1}))}function fo(J){const{data:Z}=J.payload;try{return JSON.parse(Z)}catch(J){return console.error(J),null}}function Io(J,Z){return J.toString(16).padStart(Z,"0")}function Eo(J){if(J<0||J>53)throw new Error("Number of digits must be between 0 and 53");if(J<=30)return Math.floor(Math.random()*(1<<J));const Z=J-30;return Math.floor(Math.random()*(1<<Z))*(1<<30)+Math.floor(Math.random()*(1<<30))}var sc=new class{constructor(){this._onlineSignalingMap=new Map,this._isSignalingListening=!1}init(J){this._core=J,J.notificationCenter.subscribeInnerEvent(J.InnerEvent.DESTROY,this._dispose,this),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.LOGOUT,this._reset,this)}getOnlineSignalingMap(){return this._onlineSignalingMap}hasSignaling(J){return this._onlineSignalingMap.has(J)}getSignaling(J){return this._onlineSignalingMap.get(J)}saveSignaling(J,Z){return this._onlineSignalingMap.set(J,Z)}removeSignaling(J){return this._onlineSignalingMap.delete(J)}isInvitationValid(J){const Z=`${tc}.isInvitationValid`,{inviteID:ee,groupID:ne,inviter:se}=J,re=se===this._core.common.getCurrentUserID();if(!this._onlineSignalingMap.has(ee))return!1;const{inviteeList:ae}=this._onlineSignalingMap.get(ee);if(console.log(`${Z} inviteID:${ee} inviteeList:${ae} groupID:${ne}`),ne){if(re)return ae.length>0;const J=this._core.common.getCurrentUserID();return ae.includes(J)}return!0}updateSignaling(J){const Z=`${tc}.updateSignaling`,{inviteID:ee,inviter:ne,inviteeList:se,groupID:re}=J;if(console.log(`${Z} inviteID:${ee} inviter:${ne} groupID:${re}`),re&&this.hasSignaling(ee)){const J=se[0],{inviteeList:ne}=this._onlineSignalingMap.get(ee);ne.includes(J)&&(ne.splice(ne.indexOf(J),1),console.log(`${Z} remove ${J}. localInviteeList.length:${ne.length}`)),0===ne.length&&this.removeSignaling(ee)}else this.removeSignaling(ee)}setSignalingListenStatus(J){this._isSignalingListening=J}getSignalingListenStatus(){return this._isSignalingListening}_dispose(){var J,Z;this._reset(),null===(J=this._core)||void 0===J||J.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.DESTROY,this._dispose,this),null===(Z=this._core)||void 0===Z||Z.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.LOGOUT,this._reset,this),this._isSignalingListening=!1}_reset(){this._onlineSignalingMap.clear()}},ic=new class{init(J){this._core=J}createInviteSignaling(J){const Z=this._generateInviteID(),ee=this._createInviteSignalingData(Object.assign(Object.assign({},J),{inviteID:Z})),{groupID:ne,inviteeList:se}=ee,re=ne||se[0];return{signaling:this._createSignaling(ee,re),signalingData:ee,signalingExtensionOptions:this._createSignalingExtensionOptions(J)}}createAcceptSignaling(J){const Z=this._createAcceptSignalingData(J),{groupID:ee,inviter:ne}=Z,se=ee||ne;return{signaling:this._createSignaling(Z,se),signalingData:Z,signalingExtensionOptions:this._createSignalingExtensionOptions(J)}}createCancelSignaling(J){const Z=this._createCancelSignalingData(J),{groupID:ee,inviteeList:ne}=Z,se=ee||ne[0];return{signaling:this._createSignaling(Z,se),signalingData:Z,signalingExtensionOptions:this._createSignalingExtensionOptions(J)}}createRejectSignaling(J){const Z=this._createRejectSignalingData(J),{groupID:ee,inviter:ne}=Z,se=ee||ne;return{signaling:this._createSignaling(Z,se),signalingData:Z,signalingExtensionOptions:this._createSignalingExtensionOptions(J)}}createTimeoutSignaling(J){const{isInviter:Z=!1}=J,ee=this._createTimeoutSignalingData(J),{groupID:ne,inviteeList:se,inviter:re}=ee,ae=ne||(Z?se[0]:re);return{signaling:this._createSignaling(ee,ae),signalingData:ee,signalingExtensionOptions:this._createSignalingExtensionOptions(ee)}}_createSignalingExtensionOptions(J){var Z,ee;const{data:ne="",onlineUserOnly:se,inviteID:re="",offlinePushInfo:ae,actionType:le}=J,pe=(null===(ee=null===(Z=sc.getSignaling(re))||void 0===Z?void 0:Z.signaling)||void 0===ee?void 0:ee._onlineOnlyFlag)||!1;return{onlineUserOnly:se||pe,offlinePushInfo:ae,messageControlInfo:this._createMessageControlInfo(ne,le)}}_createMessageControlInfo(J,Z){const ee=5===Z&&!!J.match(/excludeTimeoutSignalingFromHistoryMessage/),ne=!!J.match(/excludeFromHistoryMessage/)||!!J.match(/excludeOriginalSignalingFromHistoryMessage/);return{excludedFromContentModeration:!0,excludedFromUnreadCount:ee||ne,excludedFromLastMessage:ee||ne}}_createInviteSignalingData(J){const Z=`${tc}._createInviteSignalingData`,{userID:ee,timeout:ne=0,groupID:se="",inviteeList:re=[]}=J,ae=this._core.common.getCurrentUserID(),le=Object.assign(Object.assign({},this._generateBaseSignalData(J)),{actionType:1,inviter:ae,inviteeList:se?re:[ee],timeout:ne});return console.log(`${Z} signalingData:`,le),le}_createAcceptSignalingData(J){const Z=`${tc}._createAcceptSignalingData`,{inviteID:ee}=J,ne=this._core.common.getCurrentUserID(),{inviter:se,groupID:re}=sc.getSignaling(ee),ae=Object.assign(Object.assign({},this._generateBaseSignalData(J)),{actionType:3,groupID:re,inviter:se,inviteeList:[ne]});return console.log(`${Z} signalingData:`,ae),ae}_createCancelSignalingData(J){const Z=`${tc}._createCancelSignalingData`,{inviteID:ee}=J,ne=this._core.common.getCurrentUserID(),{inviteeList:se,groupID:re}=sc.getSignaling(ee),ae=Object.assign(Object.assign({},this._generateBaseSignalData(J)),{actionType:2,groupID:re,inviter:ne,inviteeList:se});return console.log(`${Z} signalingData:`,ae),ae}_createRejectSignalingData(J){const Z=`${tc}._createRejectSignalingData`,{inviteID:ee}=J,ne=this._core.common.getCurrentUserID(),{inviter:se,groupID:re}=sc.getSignaling(ee),ae=Object.assign(Object.assign({},this._generateBaseSignalData(J)),{actionType:4,groupID:re,inviter:se,inviteeList:[ne]});return console.log(`${Z} signalingData:`,ae),ae}_createTimeoutSignalingData(J){const Z=`${tc}._createTimeoutSignalingData`,{isInviter:ee=!1,inviteID:ne}=J,{inviteeList:se,inviter:re}=sc.getSignaling(ne),ae=this._core.common.getCurrentUserID(),le=Object.assign(Object.assign({},this._generateBaseSignalData(J)),{actionType:5,inviter:re,inviteeList:ee?se:[ae]});return console.log(`${Z} signalingData:`,le),le}_createSignaling(J,Z){var ee,ne,se;const{groupID:re=""}=J,ae={to:Z,conversationType:re?"GROUP":"C2C",priority:"High",payload:{data:JSON.stringify(J)}};return null===(se=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message)||void 0===ne?void 0:ne.messageFactory)||void 0===se?void 0:se.createCustomMessage(ae)}_generateInviteID(){return[Io(Eo(32),8),Io(Eo(16),4),Io(16384|Eo(12),4),Io(32768|Eo(14),4),Io(Eo(48),12)].join("-")}_generateBaseSignalData(J){const{data:Z="",inviteID:ee="",groupID:ne=""}=J;return{businessID:1,timeout:0,data:Z,inviteID:ee,groupID:ne}}},rc=new class{constructor(){this._isProcessingSignaling=!1}init(J){this._core=J,J.helper.registerApi({apiName:"invite",context:this}),J.helper.registerApi({apiName:"accept",context:this}),J.helper.registerApi({apiName:"cancel",context:this}),J.helper.registerApi({apiName:"reject",context:this}),J.helper.registerApi({apiName:"modifyInvitation",context:this}),J.helper.registerApi({apiName:"getSignalingInfo",context:this}),J.helper.registerApi({apiName:"addSignalingListener",context:this}),J.helper.registerApi({apiName:"removeSignalingListener",context:this}),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.DESTROY,this._dispose,this),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.LOGOUT,this._reset,this)}invite(J){return ge(this,void 0,void 0,(function*(){var Z;try{this._validateBeforeInvite(J);const{signaling:ee,signalingData:ne,signalingExtensionOptions:se}=ic.createInviteSignaling(J),re=yield this._sendSignaling(ee,se);if(0===(null==re?void 0:re.code)){const{inviteID:J,timeout:se}=ne;return sc.saveSignaling(J,Object.assign(Object.assign({},ne),{signaling:ee})),se>0&&(null===(Z=this._core)||void 0===Z||Z.helper.taskScheduler.addOnceTask({id:`${nc}-${J}`,intervalMs:1e3*(se+5),callback:this.handleInvitationExpiryTimer.bind(this,J)})),Object.assign(Object.assign({},re),{inviteID:J})}return re}catch(J){throw J}}))}accept(J){return ge(this,void 0,void 0,(function*(){try{const{inviteID:Z}=J;this._validateBeforeAccept(Z),this._isProcessingSignaling=!0;const{signaling:ee,signalingData:ne,signalingExtensionOptions:se}=ic.createAcceptSignaling(J),re=yield this._sendSignaling(ee,se);return 0===(null==re?void 0:re.code)?(sc.updateSignaling(ne),Object.assign(Object.assign({},re),{inviteID:Z})):re}catch(J){throw J}finally{this._isProcessingSignaling=!1}}))}cancel(J){return ge(this,void 0,void 0,(function*(){try{const{inviteID:Z}=J;this._validateBeforeCancel(Z),this._isProcessingSignaling=!0;const{signaling:ee,signalingExtensionOptions:ne}=ic.createCancelSignaling(J),se=yield this._sendSignaling(ee,ne);return 0===(null==se?void 0:se.code)?(sc.removeSignaling(Z),Object.assign(Object.assign({},se),{inviteID:Z})):se}catch(J){throw J}finally{this._isProcessingSignaling=!1}}))}reject(J){return ge(this,void 0,void 0,(function*(){try{const{inviteID:Z}=J;this._validateBeforeReject(Z),this._isProcessingSignaling=!0;const{signaling:ee,signalingExtensionOptions:ne}=ic.createRejectSignaling(J),se=yield this._sendSignaling(ee,ne);return 0===(null==se?void 0:se.code)?(sc.removeSignaling(Z),Object.assign(Object.assign({},se),{inviteID:Z})):se}catch(J){throw J}finally{this._isProcessingSignaling=!1}}))}modifyInvitation(J){return ge(this,void 0,void 0,(function*(){var Z,ee;const{inviteID:ne,data:se}=J;let re="";try{this._validateBeforeModifyInvitation(ne);const J=sc.getSignaling(ne),{signaling:ae}=J,le=he(J,["signaling"]);re=ae.payload.data,le.data=se,ae.payload.data=JSON.stringify(le);const pe=yield null===(ee=null===(Z=this._core)||void 0===Z?void 0:Z.message.messageAction)||void 0===ee?void 0:ee.modifyMessage(ae);return sc.hasSignaling(ne)&&sc.saveSignaling(ne,Object.assign(Object.assign({},le),{signaling:ae})),pe}catch(J){if(re){const{signaling:J}=sc.getSignaling(ne);J.payload.data=re}throw J}}))}getSignalingInfo(J){const{ssoLog:Z,utils:{safeStringify:ee}}=this._core;if(0===vo([J]).length)return;const ne=fo(J),se={businessID:ne.businessID||1,inviteID:ne.inviteID,groupID:ne.groupID||"",inviter:ne.inviter||"",inviteeList:ne.inviteeList||[],data:ne.data||"",actionType:ne.actionType||1,timeout:ne.timeout||0};return Z.debug(`${tc} getSignalingInfo ${ee(se)}`),se}addSignalingListener(J,Z,ee){var ne,se;J===(null===(ne=this._core)||void 0===ne?void 0:ne.SignalingEvent.NEW_INVITATION_RECEIVED)&&sc.setSignalingListenStatus(!0),null===(se=this._core)||void 0===se||se.notificationCenter.subscribeOuterEvent(J,Z,ee)}removeSignalingListener(J,Z,ee){var ne,se;J===(null===(ne=this._core)||void 0===ne?void 0:ne.SignalingEvent.NEW_INVITATION_RECEIVED)&&sc.setSignalingListenStatus(!1),null===(se=this._core)||void 0===se||se.notificationCenter.unSubscribeOuterEvent(J,Z,ee)}handleInvitationExpiryTimer(J){const Z=sc.getOnlineSignalingMap(),ee=this._core.common.getCurrentUserID();if(!Z.has(J))return;const ne=Z.get(J).inviter===ee;this._sendTimeoutNotice({inviteID:J,isInviter:ne})}_sendSignaling(J,Z){return ge(this,void 0,void 0,(function*(){var ee,ne,se;return null===(se=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message)||void 0===ne?void 0:ne.messageSender)||void 0===se?void 0:se.sendMessage(J,Z)}))}_sendTimeoutNotice(J){return ge(this,void 0,void 0,(function*(){var Z,ee,ne;this._core.ssoLog.debug("_sendTimeoutNotice",`${tc}._sendTimeoutNotice params:${JSON.stringify(J)}`);const{isInviter:se,inviteID:re}=J,{signaling:ae,signalingData:le,signalingExtensionOptions:pe}=ic.createTimeoutSignaling(J),_e=yield this._sendSignaling(ae,pe);if(0===(null==_e?void 0:_e.code)){const{data:J,groupID:pe,inviteeList:_e,inviter:ve}=le;null===(Z=this._core)||void 0===Z||Z.notificationCenter.emitOuterEvent(null===(ee=this._core)||void 0===ee?void 0:ee.SignalingEvent.INVITATION_TIMEOUT,{name:null===(ne=this._core)||void 0===ne?void 0:ne.SignalingEvent.INVITATION_TIMEOUT,data:{data:J,groupID:pe,inviteID:re,inviteeList:_e,inviter:ve,isSelfTimeout:!0,message:ae}}),se?sc.removeSignaling(re):sc.updateSignaling(le)}}))}_validateInviteId(J,Z){if(!sc.hasSignaling(Z))throw new this._core.helper.ChatError({functionName:J,code:8010})}_validateProcessStatus(J){if(this._isProcessingSignaling)throw new this._core.helper.ChatError({functionName:J,message:"processing other signaling operations"})}_validateBeforeInvite(J){const{userID:Z}=J,ee=this._core.common.getCurrentUserID();if(Z===ee)throw new this._core.helper.ChatError({functionName:"invite",message:`cannot invite yourself, currentUserId:${ee}, inviteeId:${Z}`})}_validateBeforeAccept(J){const Z="accept";this._validateInviteId(Z,J),this._validateProcessStatus(Z);const ee=this._core.common.getCurrentUserID(),{inviteeList:ne}=sc.getSignaling(J);if(!ne.includes(ee)){const ne=`userID:${ee} not in inviteeList. inviteID:${J}`;throw new this._core.helper.ChatError({functionName:Z,message:ne})}}_validateBeforeCancel(J){const Z="cancel";this._validateInviteId(Z,J),this._validateProcessStatus(Z);const ee=this._core.common.getCurrentUserID(),{inviter:ne}=sc.getSignaling(J);if(ne!==ee){const J=`unmatched inviter:${ne} and my userID:${ee}`;throw new this._core.helper.ChatError({functionName:Z,message:J})}}_validateBeforeReject(J){const Z="reject";this._validateInviteId(Z,J),this._validateProcessStatus(Z);const ee=this._core.common.getCurrentUserID(),{inviteeList:ne}=sc.getSignaling(J);if(!ne.includes(ee)){const ne=`userID:${ee} not in inviteeList. inviteID:${J}`;throw new this._core.helper.ChatError({functionName:Z,message:ne})}}_validateBeforeModifyInvitation(J){this._validateInviteId("modifyInvitation",J)}_dispose(){var J,Z;this._reset(),null===(J=this._core)||void 0===J||J.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.DESTROY,this._dispose,this),null===(Z=this._core)||void 0===Z||Z.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.LOGOUT,this._reset,this)}_reset(){this._isProcessingSignaling=!1}},oc=new class{constructor(){this._actionProcessor=new Map([[1,this._onNewInvitationReceived.bind(this)],[4,this._onInviteeRejected.bind(this)],[3,this._onInviteeAccepted.bind(this)],[2,this._onInvitationCancelled.bind(this)],[5,this._onInvitationTimeout.bind(this)]])}init(J){this._core=J,J.notificationCenter.subscribeOuterEvent(J.OuterEvent.MESSAGE_RECEIVED,this._handleMessageReceived,this),J.notificationCenter.subscribeOuterEvent(J.OuterEvent.MESSAGE_MODIFIED,this._handleMessageModified,this),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.DESTROY,this._dispose,this)}handleActionSignaling(J){J.forEach((J=>{const Z=fo(J);if(Z){const ee=this._actionProcessor.get(Z.actionType);null==ee||ee(Z,J)}}))}_handleMessageReceived(J){if(!sc.getSignalingListenStatus())return;const Z=vo(J.data);0!==Z.length&&this.handleActionSignaling(Z)}_handleMessageModified(J){if(!sc.getSignalingListenStatus())return;const Z=vo(J.data);Z.length>0&&Z.forEach((J=>{const Z=fo(J);Z&&this._onInvitationModified(Z,J)}))}_onNewInvitationReceived(J,Z){var ee,ne;const se=`${tc}._onNewInvitationReceived`,{inviteID:re,inviteeList:ae,groupID:le}=J,pe=this._core.common.getCurrentUserID();if(this._core.ssoLog.debug("_onNewInvitationReceived",`${se} signalingData:${JSON.stringify(J)}}`),le&&!ae.includes(pe))return;let{timeout:_e}=J;const ve=Date.now()/1e3-Z.time;_e>0&&ve>0&&_e>ve&&(_e-=ve);const ye=sc.getSignaling(re);ye!==J&&(ye||sc.saveSignaling(re,Object.assign(Object.assign({},J),{signaling:Z})),_e>0&&(null===(ee=this._core)||void 0===ee||ee.helper.taskScheduler.addOnceTask({id:`${nc}-${re}`,intervalMs:1e3*_e,callback:rc.handleInvitationExpiryTimer.bind(rc,re)})),this._emitEvent({name:null===(ne=this._core)||void 0===ne?void 0:ne.SignalingEvent.NEW_INVITATION_RECEIVED,data:Object.assign(Object.assign({},this._generateBaseEmitData(J)),{inviteeList:ae})}))}_onInviteeRejected(J){var Z;const ee=`${tc}._onInviteeRejected`,{inviteID:ne,inviter:se,groupID:re,inviteeList:ae}=J,le=sc.hasSignaling(ne);this._core.ssoLog.debug("_onInviteeRejected",`${ee} inviteID:${ne} hasInviteID:${le} inviter:${se} groupID:${re}`),le&&(sc.updateSignaling(J),this._emitEvent({name:null===(Z=this._core)||void 0===Z?void 0:Z.SignalingEvent.INVITEE_REJECTED,data:Object.assign(Object.assign({},this._generateBaseEmitData(J)),{invitee:ae[0]})}))}_onInviteeAccepted(J){var Z;const ee=`${tc}._onInviteeAccepted`,{inviteID:ne,inviter:se,groupID:re,inviteeList:ae}=J,le=sc.hasSignaling(ne);this._core.ssoLog.debug("_onInviteeAccepted",`${ee} inviteID:${ne} hasInviteID:${le} inviter:${se} groupID:${re}`),le&&(sc.updateSignaling(J),this._emitEvent({name:null===(Z=this._core)||void 0===Z?void 0:Z.SignalingEvent.INVITEE_ACCEPTED,data:Object.assign(Object.assign({},this._generateBaseEmitData(J)),{invitee:ae[0]})}))}_onInvitationCancelled(J){var Z;const ee=`${tc}._onInvitationCancelled`,{inviteID:ne,inviter:se,groupID:re}=J,ae=sc.hasSignaling(ne);this._core.ssoLog.debug("_onInvitationCancelled",`${ee} inviteID:${ne} hasInviteID:${ae} inviter:${se} groupID:${re}`),ae&&(sc.removeSignaling(ne),this._emitEvent({name:null===(Z=this._core)||void 0===Z?void 0:Z.SignalingEvent.INVITATION_CANCELLED,data:this._generateBaseEmitData(J)}))}_onInvitationTimeout(J){var Z;const ee=`${tc}._onInvitationTimeout`,{inviteID:ne,inviteeList:se}=J,re=sc.hasSignaling(ne);this._core.ssoLog.debug("_onInvitationTimeout",`${ee} inviteID:${ne} hasInviteID:${re} data:${J.data}`),re&&(sc.updateSignaling(J),this._emitEvent({name:null===(Z=this._core)||void 0===Z?void 0:Z.SignalingEvent.INVITATION_TIMEOUT,data:Object.assign(Object.assign({},this._generateBaseEmitData(J)),{inviteeList:se,isSelfTimeout:!1})}))}_onInvitationModified(J,Z){var ee;const ne=`${tc}._onInvitationModified`,{inviteID:se,data:re}=J,ae=sc.hasSignaling(se);this._core.ssoLog.debug("_onInvitationModified",`${ne} inviteID:${se} data:${re}`),ae&&(sc.saveSignaling(se,Object.assign(Object.assign({},J),{signaling:Z})),this._emitEvent({name:null===(ee=this._core)||void 0===ee?void 0:ee.SignalingEvent.INVITATION_MODIFIED,data:{inviteID:se,data:re}}))}_emitEvent(J){var Z;null===(Z=this._core)||void 0===Z||Z.notificationCenter.emitOuterEvent(J.name,J)}_generateBaseEmitData(J){const{inviteID:Z,inviter:ee,groupID:ne,data:se}=J;return{inviteID:Z,inviter:ee,groupID:ne,data:se||""}}_dispose(){var J,Z,ee;null===(J=this._core)||void 0===J||J.notificationCenter.unSubscribeOuterEvent(this._core.OuterEvent.MESSAGE_RECEIVED,this._handleMessageReceived,this),null===(Z=this._core)||void 0===Z||Z.notificationCenter.unSubscribeOuterEvent(this._core.OuterEvent.MESSAGE_MODIFIED,this._handleMessageModified,this),null===(ee=this._core)||void 0===ee||ee.notificationCenter.unSubscribeOuterEvent(this._core.InnerEvent.DESTROY,this._dispose,this)}},ac=new class{constructor(){this._offlineSignalingMap=new Map}init(J){this._core=J;const{notificationCenter:Z,helper:ee,constants:{InnerEvent:ne,WORKFLOW_STEP:se,WORKFLOW_NAME:re}}=J;Z.subscribeInnerEvent(ne.DESTROY,this._dispose,this),Z.subscribeInnerEvent(ne.LOGOUT,this._reset,this),ee.registerWorkflowStep(re.SYNC_SERVER_INFO_AFTER_LOGIN,se.SIGNALING_MESSAGE_RECOVER,this._handleC2COfflineMessage,this)}_handleC2COfflineMessage(J){const{result:{unreadMessageMap:Z}={}}=J||{};if(0===(null==Z?void 0:Z.size)||!sc.getSignalingListenStatus())return;const ee=vo([...Z.values()]);if(0!==ee.length&&(ee.forEach((J=>{this._handleC2CActionType(J)})),this._offlineSignalingMap.size>0)){const J=this._sortOfflineSignalingByTime();oc.handleActionSignaling(J)}}_handleC2CActionType(J){const Z=fo(J);if(!Z)return;const{actionType:ee}=Z;1===ee?this._saveValidOfflineInvite(Z,J):this._removeOfflineInvite(Z)}_saveValidOfflineInvite(J,Z){const{inviteID:ee,inviteeList:ne=[],timeout:se=0}=J,re=this._core.common.getCurrentUserID();if(!ne.includes(re))return;const ae=Date.now()/1e3-Z.time;se>0&&ae>se&&0!==se||this._offlineSignalingMap.set(ee,Object.assign(Object.assign({},J),{signalingList:[Z]}))}_removeOfflineInvite(J){const{inviteID:Z=""}=J;this._offlineSignalingMap.has(Z)&&this._offlineSignalingMap.delete(Z)}_sortOfflineSignalingByTime(){let J=[];return this._offlineSignalingMap.forEach((Z=>{J=[...J,...Z.signalingList]})),J.sort(((J,Z)=>J.time-Z.time))}_dispose(){var J,Z;this._reset(),null===(J=this._core)||void 0===J||J.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.LOGOUT,this._reset,this),null===(Z=this._core)||void 0===Z||Z.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.DESTROY,this._dispose,this)}_reset(){this._offlineSignalingMap.clear()}};const cc={invite:{userID:{required:!0,rules:["string"],allowEmpty:!1},data:{required:!1,rules:["string"],allowEmpty:!0},timeout:{required:!1,rules:["number"],allowEmpty:!1},onlineUserOnly:{required:!1,rules:["boolean"],allowEmpty:!1},offlinePushInfo:{required:!1,rules:["object"],allowEmpty:!1}},cancel:{inviteID:{required:!0,rules:["string"],allowEmpty:!1},data:{required:!1,rules:["string"],allowEmpty:!0}},accept:{inviteID:{required:!0,rules:["string"],allowEmpty:!1},data:{required:!1,rules:["string"],allowEmpty:!0}},reject:{inviteID:{required:!0,rules:["string"],allowEmpty:!1},data:{required:!1,rules:["string"],allowEmpty:!0}},modifyInvitation:{inviteID:{required:!0,rules:["string"],allowEmpty:!1},data:{required:!1,rules:["string"],allowEmpty:!0}}},uc={invite:!0,cancel:!0,accept:!0,reject:!0,modifyInvitation:!0};var lc=new class{constructor(){this.name="Signaling"}install(J){rc.init(J),oc.init(J),ic.init(J),sc.init(J),ac.init(J),J.helper.registerValidateConfig({auth:uc,params:cc})}};const hc=new class{init(J){this.core=J}};function bo(J){let Z;const{message:ee}=hc.core,{conversationID:ne,messageID:se}=J;return Z=ee.messageDataHandler.getLocalMessageList(ne).find((J=>J.ID===se)),Z||(Z=ee.messageDataHandler.getSparseMessageList(ne).find((J=>J.ID===se))),Z}function No(J){return J.map((J=>{const{from:Z,to:ee,cloudCustomData:ne,avatar:se,nick:re,ID:ae,clientSequence:le,clientTime:pe,messageRandom:_e,messageSequence:ve,time:ye}=J;return{ClientSeq:le,CloudCustomData:ne,From_Account:Z,From_AccountHeadurl:se,From_AccountNick:re,Id:ae,MsgBody:JSON.parse(JSON.stringify(J.transformElementsToServerFormat())),MsgClientTime:pe,MsgRandom:_e,Random:_e,MsgSeq:ve,MsgTimeStamp:ye,ReceiverId:ee,SenderId:Z,To_Account:ee}}))}function Lo(J){var Z;const{From_Account:ee,From_AccountHeadurl:ne,From_AccountNick:se,GroupId:re,MsgClientTime:ae,ClientSeq:le,To_Account:pe,MsgTimeStamp:_e,TinyId:ve,MsgRandom:ye,MsgSeq:Fe}=J;return{from:ee,avatar:ne,nick:se,clientTime:ae,time:_e,tinyID:ve,random:ye,sequence:Fe,to:pe,groupID:re,clientSequence:le,_elements:null===(Z=J.MsgBody)||void 0===Z?void 0:Z.map((J=>{const{MsgType:Z}=J;return hc.core.message.messageFactory.getElementClass(Z).parseServerPushElement(J)}))}}var dc,pc;!function(J){J.MSG_TEXT="TIMTextElem",J.MSG_CUSTOM="TIMCustomElem",J.MSG_LOCATION="TIMLocationElem",J.MSG_FACE="TIMFaceElem",J.MSG_STREAM="TIMStreamElem"}(dc||(dc={})),function(J){J[J.FORWARD=0]="FORWARD",J[J.BACKWARD=1]="BACKWARD"}(pc||(pc={}));const gc={ZH_CN:"zh (cmn-Hans-CN)",EN_US:"en-US",YUE_HK:"yue-Hant-HK",JA_JP:"ja-JP",ZH_PY:"zh-PY"},fc="16k_zh-PY",_c={[gc.ZH_CN]:"16k_zh",[gc.EN_US]:"16k_en",[gc.YUE_HK]:"16k_yue",[gc.JA_JP]:"16k_ja",[gc.ZH_PY]:fc},mc=/\.(wav|pcm|ogg-opus|speex|silk|mp3|m4a|aac|amr)/,vc={READ:0,UNREAD:1};var yc;!function(J){J.IN="in",J.OUT="out"}(yc||(yc={}));var Ic,Sc;!function(J){J[J.DATA=0]="DATA",J[J.REVOKED=1]="REVOKED"}(Ic||(Ic={})),function(J){J[J.NORMAL=0]="NORMAL",J[J.TIMEOUT=1]="TIMEOUT"}(Sc||(Sc={}));const Ec="StreamMsg.PushStreamHttp";var Cc=new class{constructor(){this._reactionsMap=new Map}init(J){this._core=J;const{helper:Z,notificationCenter:ee,InnerEvent:{MESSAGE_PUSH:ne},InnerEventSubType:{MESSAGE_REACTION_UPDATED:se,MESSAGE_REACTION_UPDATED_SYNC:re}}=J;Z.registerApi({apiName:"addMessageReaction",context:this}),Z.registerApi({apiName:"removeMessageReaction",context:this}),Z.registerApi({apiName:"getMessageReactions",context:this}),Z.registerApi({apiName:"getAllUserListOfMessageReaction",context:this}),ee.subscribeInnerEvent(ne,se,this._handleReactionUpdated,this),ee.subscribeInnerEvent(ne,re,this._handleReactionSync,this)}addMessageReaction(J,Z){return ge(this,void 0,void 0,(function*(){const{OuterConstant:ee,ssoLog:ne,helper:se}=this._core;this._validateMessageReactionBusinessCapability();const{conversationID:re,ID:ae,conversationType:le,from:pe,to:_e,clientSequence:ve,random:ye,time:Fe,sequence:qe}=J,$e=`conversationID:${re} messageID:${ae} reactionID:${Z}`;try{return this._recordMessageReactedByMe(ae,Z),le===ee.CONV_C2C?yield function(J,Z){return ge(this,void 0,void 0,(function*(){var ee;const{from:ne,to:se,clientSequence:re,random:ae,time:le,reactionID:pe}=J,_e={From_Account:ne,To_Account:se,MsgKey:`${re}_${ae}_${le}`,Reaction:pe,Add_Account:[null===(ee=Z.store.get("login"))||void 0===ee?void 0:ee.userId]};return hc.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.reaction_add",data:_e})}))}({from:pe,to:_e,clientSequence:ve,random:ye,time:Fe,reactionID:Z},this._core):le===ee.CONV_GROUP&&(yield function(J,Z){return ge(this,void 0,void 0,(function*(){var ee;const{to:ne,reactionID:se,sequence:re}=J,ae={GroupId:ne,MsgSeq:re,Reaction:se,Add_Account:[null===(ee=Z.store.get("login"))||void 0===ee?void 0:ee.userId]};return hc.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.group_reaction_add",data:ae})}))}({to:_e,reactionID:Z,sequence:qe},this._core)),{code:0,successLog:{message:$e}}}catch(J){this._removeMyReactionRecord(ae,Z);const{errorCode:ee}=J||{};throw new se.ChatError({functionName:"addMessageReaction",code:ee,moreMessage:$e})}}))}removeMessageReaction(J,Z){return ge(this,void 0,void 0,(function*(){const{OuterConstant:ee,helper:ne}=this._core;this._validateMessageReactionBusinessCapability();const{conversationID:se,ID:re,conversationType:ae,from:le,to:pe,clientSequence:_e,random:ve,time:ye,sequence:Fe}=J,qe=`conversationID:${se} messageID:${re} reactionID:${Z}`;try{return this._removeMyReactionRecord(re,Z),ae===ee.CONV_C2C?yield function(J,Z){return ge(this,void 0,void 0,(function*(){var ee;const{from:ne,to:se,clientSequence:re,random:ae,time:le,reactionID:pe}=J,_e={From_Account:ne,To_Account:se,MsgKey:`${re}_${ae}_${le}`,Reaction:pe,Del_Account:[null===(ee=Z.store.get("login"))||void 0===ee?void 0:ee.userId]};return hc.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.reaction_del",data:_e})}))}({from:le,to:pe,clientSequence:_e,random:ve,time:ye,reactionID:Z},this._core):ae===ee.CONV_GROUP&&(yield function(J,Z){return ge(this,void 0,void 0,(function*(){var ee;const{to:ne,reactionID:se,sequence:re}=J,ae={GroupId:ne,MsgSeq:re,Reaction:se,Del_Account:[null===(ee=Z.store.get("login"))||void 0===ee?void 0:ee.userId]};return hc.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.group_reaction_del",data:ae},Z)}))}({to:pe,reactionID:Z,sequence:Fe},this._core)),{code:0,successLog:{message:qe}}}catch(J){const{errorCode:Z}=J||{};throw new ne.ChatError({functionName:"removeMessageReaction",code:Z,moreMessage:qe})}}))}getAllUserListOfMessageReaction(J){return ge(this,void 0,void 0,(function*(){this._validateMessageReactionBusinessCapability();const{message:Z,reactionID:ee,nextSeq:ne=0}=J,se=J.count>100?100:J.count,{conversationID:re}=Z,{ssoLog:ae,helper:le,constants:pe}=this._core;try{let J=null;if(J=re.startsWith(pe.OuterConstant.CONV_C2C)?yield function(J){return ge(this,void 0,void 0,(function*(){const{message:Z,nextSeq:ee,reactionID:ne,count:se}=J,{from:re,to:ae,clientSequence:le,random:pe,time:_e}=Z,ve={Reaction:ne,NextSeq:ee,Count:se,From_Account:re,To_Account:ae,MsgKey:`${le}_${pe}_${_e}`};return hc.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.reaction_iterate",data:ve})}))}({message:Z,reactionID:ee,nextSeq:ne,count:se}):yield function(J){return ge(this,void 0,void 0,(function*(){const{message:Z,nextSeq:ee,reactionID:ne,count:se}=J,{sequence:re,to:ae}=Z,le={Reaction:ne,NextSeq:ee,GroupId:ae,Count:se,MsgSeq:re};return hc.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.group_reaction_iterate",data:le})}))}({message:Z,reactionID:ee,nextSeq:ne,count:se}),J){const{Reaction_Account:Z,NextSeq:ee}=J;return{code:0,data:{nextSeq:ee,isCompleted:0===ne,userList:yield this._getUserProfileList(Z)}}}}catch(J){const{errorCode:Z}=J||{};throw new le.ChatError({functionName:"getAllUserListOfMessageReaction",code:Z})}}))}getMessageReactions(J){return ge(this,void 0,void 0,(function*(){const{constants:Z}=this._core;this._validateMessageReactionBusinessCapability();const{messageList:ee,maxUserCountPerReaction:ne=10}=J,se=ee[0];let re=null;const ae=new Map,{from:le,to:pe,conversationType:_e}=se,ve=this._generateMessageKeyList(ee,ae);_e===Z.OuterConstant.CONV_C2C?re=yield function(J){return ge(this,void 0,void 0,(function*(){const{from:Z,to:ee,messageKeyList:ne,maxUserCountPerReaction:se}=J,re={From_Account:Z,To_Account:ee,MsgKeyList:ne,Count:se};return hc.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.reaction_multi_stat",data:re})}))}({from:le,to:pe,messageKeyList:ve,maxUserCountPerReaction:ne}):_e===Z.OuterConstant.CONV_GROUP&&(re=yield function(J){return ge(this,void 0,void 0,(function*(){const{groupId:Z,messageSequenceList:ee,maxUserCountPerReaction:ne}=J,se={GroupId:Z,MsgSeqList:ee,Count:ne};return hc.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.group_reaction_multi_stat",data:se})}))}({groupId:pe,messageSequenceList:ve,maxUserCountPerReaction:ne}));const{Results:ye=[]}=re||{},Fe=this._extractUserIDsFromReactionResults(ye),qe=yield this._getUserProfileMap(Fe);return{code:0,data:{resultList:ye.map((J=>{const{ReactionList:Z,MsgSeq:ee,MsgKey:ne}=J;return{messageID:this._generateMessageID({messageSequence:ee,messageKey:ne,messageIDMap:ae}),reactionList:Z.map((J=>{const{Reaction:Z,Count:ee,Reaction_Account:ne,ReactedByMe:se}=J;return{reactionID:Z,totalUserCount:ee,partialUserList:this._generatePartialUserInfo({userIDList:ne,userProfileMap:qe}),reactedByMyself:1===se}}))}}))}}}))}dispose(){this._reactionsMap.clear()}_extractUserIDsFromReactionResults(J){const Z=[];return null==J||J.forEach((J=>{const{ReactionList:ee=[]}=J;ee.forEach((J=>{J.Reaction_Account&&Z.push(...J.Reaction_Account)}))})),Z}_getUserProfileList(J){return ge(this,void 0,void 0,(function*(){var Z;try{const ee=yield null===(Z=this._core.user.userProfile)||void 0===Z?void 0:Z.getUserProfile({userIDList:J});return ee?ee.data:[]}catch(J){return[]}}))}_getUserProfileMap(J){return ge(this,void 0,void 0,(function*(){const Z=new Map;return(yield this._getUserProfileList(J)).forEach((J=>{const{nick:ee,avatar:ne,userID:se}=J;Z.set(se,{nick:ee,avatar:ne,userID:se})})),Z}))}_recordMessageReactedByMe(J,Z){const ee=`${J}-${Z}`;this._reactionsMap.has(ee)?this._reactionsMap.get(ee).reactedByMe=!0:this._reactionsMap.set(ee,{reactedByMe:!0})}_removeMyReactionRecord(J,Z){const ee=`${J}-${Z}`;this._reactionsMap.has(ee)&&(this._reactionsMap.get(ee).reactedByMe=!1)}_recordMessageReactionInfo(J){const{messageID:Z,reactionID:ee,reactionInfo:ne}=J,se=`${Z}-${ee}`,re=this._reactionsMap.get(se)||{};this._reactionsMap.set(se,Object.assign(Object.assign({},re),ne))}_validateMessageReactionBusinessCapability(){const{helper:J,constants:Z}=this._core;if(!J.checkBusinessCapabilityBits("MSG_REACTION"))throw new J.ChatError({functionName:"addMessageReaction",code:Z.ERROR_CODE.NO_USE,replacement1:"addMessageReaction"})}_handleReactionUpdated(J){const{MsgReactionNotifyList:Z}=J,{notificationCenter:ee,constants:ne}=this._core;Z.forEach((J=>ge(this,void 0,void 0,(function*(){const{C2CMsgInfo:Z,GroupMsgInfo:se,MsgReactionSummary:re}=J,{TinyId:ae,MsgClientTime:le,MsgRandom:pe}=Object.assign(Object.assign({},Z),se),_e=`${ae}-${le}-${pe}`,ve=this._extractUserIDsFromReactionResults([{ReactionList:re}]),ye=yield this._getUserProfileMap(ve),Fe=re.map((J=>{var Z;const{Reaction:ee,Reaction_Account:ne}=J,se=this._generatePartialUserInfo({userIDList:ne,userProfileMap:ye}),re=ne?J.Count:0,ae=(null===(Z=this._reactionsMap.get(`${_e}-${ee}`))||void 0===Z?void 0:Z.reactedByMe)||!1;return this._recordMessageReactionInfo({messageID:_e,reactionID:ee,reactionInfo:{reactionID:ee,totalUserCount:re,partialUserList:se}}),{reactionID:ee,totalUserCount:re,partialUserList:se,reactedByMyself:ae}}));ee.emitOuterEvent(ne.OuterEvent.MESSAGE_REACTIONS_UPDATED,{name:ne.OuterEvent.MESSAGE_REACTIONS_UPDATED,data:{messageID:_e,reactionList:Fe}})}))))}_handleReactionSync(J){var Z;const{notificationCenter:ee,constants:ne}=this._core,{C2CMsgInfo:se={},GroupMsgInfo:re={},Reaction:ae,OperateType:le}=J.MsgReactionNotify,{TinyId:pe="",MsgClientTime:_e=0,MsgRandom:ve=0}=Object.assign(Object.assign({},se),re),ye=`${pe}-${_e}-${ve}`,Fe=`${ye}-${ae}`;if(1===le?this._recordMessageReactedByMe(ye,ae):this._removeMyReactionRecord(ye,ae),null===(Z=this._reactionsMap.get(Fe))||void 0===Z?void 0:Z.reactionID){const J=this._reactionsMap.get(Fe);J.reactedByMyself=1===le,ee.emitOuterEvent(ne.OuterEvent.MESSAGE_REACTIONS_UPDATED,{name:ne.OuterEvent.MESSAGE_REACTIONS_UPDATED,data:{messageID:ye,reactionList:[J]}})}}_generatePartialUserInfo({userIDList:J,userProfileMap:Z}){const ee=[];return null==J||J.forEach((J=>{Z.has(J)&&ee.push(Z.get(J))})),ee}_generateMessageID(J){const{messageSequence:Z,messageKey:ee,messageIDMap:ne}=J;return ee?ne.get(ee):ne.get(Z)}_generateMessageKeyList(J,Z){const{constants:ee}=this._core,ne=J[0],{conversationType:se}=ne;let re=[];return se===ee.OuterConstant.CONV_C2C?re=J.map((J=>{const{clientSequence:ee,random:ne,time:se,ID:re}=J,ae=`${ee}_${ne}_${se}`;return Z.set(ae,re),ae})):se===ee.OuterConstant.CONV_GROUP&&(re=J.map((J=>{const{ID:ee,sequence:ne}=J;return Z.set(ne,ee),ne}))),re}},Mc=new class{init(J){this._core=J;const{helper:Z,InnerEvent:{MESSAGE_PUSH:ee},InnerEventSubType:{C2C_MESSAGE_READ_RECEIPT:ne,GROUP_MESSAGE_READ_RECEIPT:se},notificationCenter:re}=J;Z.registerApi({apiName:"sendMessageReadReceipt",context:this}),Z.registerApi({apiName:"getMessageReadReceiptList",context:this}),Z.registerApi({apiName:"getGroupMessageReadMemberList",context:this}),re.subscribeInnerEvent(ee,ne,this._handleC2CMessageReadReceipt,this),re.subscribeInnerEvent(ee,se,this._handleGroupMessageReadReceipt,this)}sendMessageReadReceipt(J){return ge(this,void 0,void 0,(function*(){const{common:Z,constants:ee}=this._core,ne=this._filterValidMessageSendByOther(J);if(0===ne.length)throw new Z.ChatError({code:ee.ERROR_CODE.READ_RECEIPT_MSG_LIST_EMPTY});try{const{conversationType:J}=ne[0];return J===ee.OuterConstant.CONV_C2C?yield function(J){return ge(this,void 0,void 0,(function*(){const{common:Z,constants:ee}=hc.core,ne=J[0].conversationID.replace(ee.OuterConstant.CONV_C2C,""),se=J.map((J=>{const{from:Z,to:ee,sequence:ne,random:se,time:re,clientTime:ae}=J;return{From_Account:Z,To_Account:ee,MsgSeq:ne,MsgRandom:se,MsgTime:re,MsgClientTime:ae}})),re={Peer_Account:ne,C2CMsgInfo:se};return Z.buildAndSendPacket({servcmd:"openim.c2c_msg_read_receipt",data:re})}))}(ne):yield function(J){return ge(this,void 0,void 0,(function*(){const{common:Z,constants:ee}=hc.core,ne={GroupId:J[0].conversationID.replace(ee.OuterConstant.CONV_GROUP,""),MsgSeqList:J.map((J=>({MsgSeq:J.sequence})))};return Z.buildAndSendPacket({servcmd:"group_open_http_svc.group_msg_receipt",data:ne})}))}(ne),{code:0,data:{}}}catch(J){const{errorCode:ee,errorInfo:ne}=J;throw new Z.ChatError({code:ee,message:ne})}}))}getMessageReadReceiptList(J){return ge(this,void 0,void 0,(function*(){const{common:Z,constants:ee}=this._core;try{const{conversationType:Z}=J[0];if(Z===ee.OuterConstant.CONV_GROUP){const Z=this._filterValidMessageSendByMe(J);if((null==Z?void 0:Z.length)>0){const ee=yield function(J){return ge(this,void 0,void 0,(function*(){const{common:Z,constants:ee}=hc.core,ne={GroupId:J[0].conversationID.replace(ee.OuterConstant.CONV_GROUP,""),MsgSeqList:J.map((J=>({MsgSeq:J.sequence})))};return Z.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_msg_receipt",data:ne})}))}(Z),{GroupMsgReceiptList:ne}=ee||{};this._updateGroupMessagesReadReceiptInfo({messageList:J,readReceiptList:ne})}}return{code:0,data:{messageList:J}}}catch(J){const{errorCode:ee,errorInfo:ne}=J;throw new Z.ChatError({code:ee,message:ne})}}))}getGroupMessageReadMemberList(J){return ge(this,void 0,void 0,(function*(){const{constants:Z,common:ee}=this._core,{message:ne,filter:se=vc.READ,cursor:re=""}=J,{conversationID:ae,sequence:le,ID:pe}=ne,_e=ae.replace(Z.OuterConstant.CONV_GROUP,""),ve=J.count>=100?100:J.count;try{const J=yield function(J){return ge(this,void 0,void 0,(function*(){const{sequence:Z,groupID:ee,filter:ne,cursor:se,count:re}=J,ae={MsgSeq:Z,GroupId:ee,Filter:ne,Cursor:se,Num:re};return hc.core.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_msg_receipt_detail",data:ae})}))}({groupID:_e,sequence:le,filter:se,cursor:re,count:ve});if(J){const{Cursor:Z,IsFinish:ee,UnreadList:ne,ReadList:re}=J,ae={cursor:Z,isCompleted:1===ee,messageID:pe,unreadUserIDList:[],readUserIDList:[]};return se===vc.READ?ae.readUserIDList=re.map((J=>J.Read_Account)):se===vc.UNREAD&&(ae.unreadUserIDList=ne.map((J=>J.Unread_Account))),{code:0,data:ae}}}catch(J){const{errorCode:Z,errorInfo:ne}=J;throw new ee.ChatError({code:Z,message:ne})}}))}_handleC2CMessageReadReceipt(J){const Z=[],{constants:ee,helper:ne}=this._core,{C2cMsgInfo:se,PeerReadTime:re,Peer_Account:ae}=J;if(ne.isEmpty(se))return;const le=`${ee.OuterConstant.CONV_C2C}${ae}`;null==se||se.forEach((J=>{const{TinyId:ee,MsgClientTime:ne,MsgRandom:se}=J,pe=`${ee}-${ne}-${se}`,_e=bo({conversationID:le,messageID:pe});_e&&!_e.readReceiptInfo.isPeerRead&&(_e.readReceiptInfo.isPeerRead=!0,_e.readReceiptInfo.timestamp=re,Z.push({userID:ae,messageID:pe,isPeerRead:!0,timestamp:re}))})),this._emitReadReceiptEventIfNeed(Z)}_updateGroupMessagesReadReceiptInfo(J){const{messageList:Z,readReceiptList:ee}=J,ne=new Map;Z.forEach((J=>{ne.set(J.sequence,J)})),null==ee||ee.forEach((J=>{if(0===J.Code){const{MsgSeq:Z,ReadNum:ee,UnreadNum:se}=J,re=ne.get(Z);re&&(re.readReceiptInfo.readCount=ee,re.readReceiptInfo.unreadCount=se)}}))}_handleGroupMessageReadReceipt(J){const Z=[],{constants:ee}=this._core,{GroupTips:ne}=J;ne.forEach((J=>{const{MsgBody:{GroupMsgReceiptList:ne},GroupInfo:{GroupId:se}}=J,re=`${ee.OuterConstant.CONV_GROUP}${se}`;null==ne||ne.forEach((J=>{const{TinyId:ee,MsgClientTime:ne,MsgRandom:ae,ReadNum:le,UnreadNum:pe}=J,_e=`${ee}-${ne}-${ae}`,ve=bo({conversationID:re,messageID:_e}),ye={groupID:se,messageID:_e,readCount:0,unreadCount:0};ve&&("number"==typeof le&&(ve.readReceiptInfo.readCount=le,ye.readCount=le),"number"==typeof pe&&(ve.readReceiptInfo.unreadCount=pe,ye.unreadCount=pe),Z.push(ye))}))})),this._emitReadReceiptEventIfNeed(Z)}_emitReadReceiptEventIfNeed(J){const{notificationCenter:Z,OuterEvent:ee}=this._core;J.length>0&&Z.emitOuterEvent(ee.MESSAGE_READ_RECEIPT_RECEIVED,{name:ee.MESSAGE_READ_RECEIPT_RECEIVED,data:J})}_filterValidMessageSendByOther(J){return this._filterNeedReadReceiptMessages(J).filter((J=>{const{from:Z}=J;return Z!==this._core.common.getCurrentUserID()}))}_filterValidMessageSendByMe(J){const{OuterConstant:Z}=this._core.constants;return this._filterNeedReadReceiptMessages(J).filter((J=>{const{from:ee,status:ne}=J;return ee===this._core.common.getCurrentUserID()&&ne===Z.MessageStatus.SUCCESS}))}_filterNeedReadReceiptMessages(J){return J.filter((J=>!0===J.needReadReceipt))}dispose(){const{InnerEvent:{MESSAGE_PUSH:J},InnerEventSubType:{C2C_MESSAGE_READ_RECEIPT:Z,GROUP_MESSAGE_READ_RECEIPT:ee},notificationCenter:ne}=this._core;ne.unSubscribeInnerEvent(J,Z,this._handleC2CMessageReadReceipt,this),ne.unSubscribeInnerEvent(J,ee,this._handleGroupMessageReadReceipt,this)}};function ii(J,Z,ee){return ge(this,void 0,void 0,(function*(){const{common:{buildAndSendPacket:ne}}=hc.core,{from:se,to:re,clientSequence:ae,random:le,time:pe}=J;return ne({servcmd:"openim_msg_ext_http_svc.set_key_values",data:{From_Account:se,To_Account:re,MsgKey:`${ae}_${le}_${pe}`,OperateType:ee,ExtensionList:Z}})}))}function ri(J,Z,ee){return ge(this,void 0,void 0,(function*(){const{common:{buildAndSendPacket:ne}}=hc.core,{to:se,sequence:re}=J;return ne({servcmd:"openim_msg_ext_http_svc.group_set_key_values",data:{GroupId:se,MsgSeq:re,OperateType:ee,ExtensionList:Z}})}))}var bc=new class{constructor(){this._messageExtensionsMap=new Map,this._extensionsLatestSequenceMap=new Map,this._completedFetchExtensions=new Set}init(J){this._core=J;const{notificationCenter:Z,helper:{registerApi:ee},InnerEvent:{MESSAGE_PUSH:ne,LOGOUT:se},InnerEventSubType:{MESSAGE_EXTENSIONS_UPDATED:re}}=J;ee({apiName:"setMessageExtensions",context:this}),ee({apiName:"getMessageExtensions",context:this}),ee({apiName:"deleteMessageExtensions",context:this}),Z.subscribeInnerEvent(ne,re,this._handleMessageExtensionsNotify,this),Z.subscribeInnerEvent(se,this.reset,this)}setMessageExtensions(J,Z){return ge(this,void 0,void 0,(function*(){this._validateMessageExtensionBusinessCapability("setMessageExtensions");const{constants:{OuterConstant:ee},ssoLog:ne}=this._core,{ID:se,conversationID:re,sequence:ae,time:le,conversationType:pe}=J;let _e=Z;Z.length>20&&(_e=Z.slice(0,20),ne.warn("setMessageExtensions","the length of extensions cannot exceed 20"));const ve=this._generateServerExtensions(J,_e),ye=`convID:${re} messageID:${se} sequence:${ae} time:${le} count:${_e.length}`;try{let Z;if(pe===ee.CONV_C2C?Z=yield ii(J,ve,1):pe===ee.CONV_GROUP&&(Z=yield ri(J,ve,1)),Z){const{resultList:ee,successCount:ne,failureCount:se}=this._handleModifyMessageExtensions(J,Z);return{code:0,data:{extensions:ee},successLog:{message:`${ye} successCount:${ne} failCount:${se}`}}}return{code:0,data:{extensions:[]}}}catch(J){const{errorCode:Z}=J;throw new this._core.helper.ChatError({functionName:"setMessageExtensions",code:Z,moreMessage:ye})}}))}getMessageExtensions(J){return ge(this,void 0,void 0,(function*(){const{utils:{isUndefined:Z}}=this._core;this._validateMessageExtensionBusinessCapability("getMessageExtensions");const{conversationID:ee,ID:ne,sequence:se,time:re}=J,ae=`convID:${ee} messageID:${ne} sequence:${se} time:${re}`;try{let ee;this._completedFetchExtensions.has(ne)&&(ee=this._extensionsLatestSequenceMap.get(ne));const se=yield this._fetchMessageExtensions(J,ee);return Z(ee)&&se.length>1&&this._completedFetchExtensions.add(ne),{code:0,data:{extensions:se},successLog:{message:ae}}}catch(J){const{errorCode:Z,errorInfo:ee=""}=J||{};throw new this._core.common.ChatError({code:Z,message:ee,moreMessage:ae})}}))}deleteMessageExtensions(J,Z){return ge(this,void 0,void 0,(function*(){this._validateMessageExtensionBusinessCapability("deleteMessageExtensions");const{utils:{isEmpty:ee},constants:{OuterConstant:ne}}=this._core,{conversationType:se,conversationID:re,sequence:ae,ID:le,time:pe}=J;let _e=3;const ve=[];ee(Z)||(_e=2,null==Z||Z.forEach((J=>{ve.push({key:J,value:"",seq:0})})));const ye=`convID:${re} messageID:${le} sequence:${ae} time:${pe} operateType:${_e}`,Fe=this._generateServerExtensions(J,ve);try{let Z;if(se===ne.CONV_C2C?Z=yield ii(J,Fe,_e):se===ne.CONV_GROUP&&(Z=yield ri(J,Fe,_e)),Z){const{resultList:ee,successCount:ne,failureCount:se}=this._handleModifyMessageExtensions(J,Z);return{code:0,data:{extensions:ee},successLog:{message:`${ye}successCount:${ne} failCount:${se}`}}}return{code:0,data:{extensions:[]}}}catch(J){const{errorCode:Z}=J;throw new this._core.helper.ChatError({functionName:"deleteMessageExtensions",code:Z,moreMessage:ye})}}))}reset(){this._messageExtensionsMap.clear(),this._extensionsLatestSequenceMap.clear(),this._completedFetchExtensions.clear()}dispose(){this.reset();const{notificationCenter:J,InnerEvent:{MESSAGE_PUSH:Z,LOGOUT:ee},InnerEventSubType:{MESSAGE_EXTENSIONS_UPDATED:ne}}=this._core;J.unSubscribeInnerEvent(Z,ne,this._handleMessageExtensionsNotify,this),J.subscribeInnerEvent(ee,this.reset,this)}_handleModifyMessageExtensions(J,Z){const{ID:ee}=J,{Seq:ne}=Z,se=Z.ExtensionList||[],re=[];let ae=0,le=0,pe=[];return se.forEach((J=>{const{ErrorCode:Z,Extension:ee}=J,{Key:ne,Value:se,Seq:_e}=ee;re.push({code:Z,key:ne,value:se}),0===Z?ae++:le++,pe.push({key:ne,value:se,seq:_e})})),this._extensionsLatestSequenceMap.set(ee,ne),pe.length>0&&this._updateLocalExtensions(J.ID,pe),{resultList:re,successCount:ae,failureCount:le}}_updateLocalExtensions(J,Z){this._messageExtensionsMap.has(J)||this._messageExtensionsMap.set(J,new Map);const ee=this._messageExtensionsMap.get(J);null==Z||Z.forEach((J=>{const{key:Z,seq:ne,value:se=""}=J;null==ee||ee.set(Z,{value:se,seq:ne})}))}_fetchMessageExtensions(J,Z){return ge(this,void 0,void 0,(function*(){const{constants:{OuterConstant:ee},utils:{isEmpty:ne}}=this._core;try{let se;const{conversationType:re,ID:ae}=J;if(re===ee.CONV_C2C?se=yield function(J,Z){const{common:{buildAndSendPacket:ee}}=hc.core,{from:ne,to:se,clientSequence:re,random:ae,time:le}=J;return ee({servcmd:"openim_msg_ext_http_svc.get_key_values",data:{From_Account:ne,To_Account:se,MsgKey:`${re}_${ae}_${le}`,StartSeq:Z}})}(J,Z):re===ee.CONV_GROUP&&(se=yield function(J,Z){const{common:{buildAndSendPacket:ee}}=hc.core,{to:ne,sequence:se}=J;return ee({servcmd:"openim_msg_ext_http_svc.group_get_key_values",data:{GroupId:ne,MsgSeq:se,StartSeq:Z}})}(J,Z)),se){const{LatestSeq:Z,ClearSeq:ee,CompleteFlag:re}=se,le=(se.ExtensionList||[]).map((J=>({key:J.Key,value:J.Value,seq:J.Seq})));if(this._updateLocalExtensions(ae,le),this._clearLocationExtensions(ae,ee),this._extensionsLatestSequenceMap.set(ae,Z),1!==re){const Z=le[le.length-1].seq+1;return this._fetchMessageExtensions(J,Z)}const pe=[];if(this._messageExtensionsMap.has(ae)){const J=this._messageExtensionsMap.get(ae);null==J||J.forEach(((J,Z)=>{const{value:ee}=J;ne(ee)||pe.push({key:Z,value:ee})}))}return pe}}catch(J){throw J}}))}_clearLocationExtensions(J,Z){if(!(Z<=0)&&this._messageExtensionsMap.has(J)){const ee=this._messageExtensionsMap.get(J);null==ee||ee.forEach(((J,ne)=>{J.seq<=Z&&ee.delete(ne)}))}}_generateServerExtensions(J,Z){const{ID:ee}=J;if(this._messageExtensionsMap.has(ee)){const J=this._messageExtensionsMap.get(ee);return Z.map((Z=>{var ee;const{key:ne,value:se}=Z;let re=0;return(null==J?void 0:J.has(ne))&&(re=null===(ee=J.get(ne))||void 0===ee?void 0:ee.seq),{Key:ne,Value:se,Seq:re}}))}return Z.map((J=>({Key:J.key,Value:J.value,Seq:0})))}_validateMessageExtensionBusinessCapability(J){const{helper:Z,constants:ee}=this._core;if(!Z.checkBusinessCapabilityBits("MSG_EXT"))throw new Z.ChatError({functionName:J,code:ee.ERROR_CODE.NO_USE,replacement1:J})}_handleMessageExtensionsNotify(J){const{SetKVInfo:Z,DeleteKVInfo:ee,ClearKVInfo:ne,MsgOptType:se,TinyId:re,MsgLastSeq:ae,ExtensionC2cMsgInfo:le,ExtensionGroupMsgInfo:pe}=(null==J?void 0:J.MsgExtensionNotify)||{},_e=le||pe||{},{MsgClientTime:ve,MsgRandom:ye}=_e,Fe=`${re}-${ve}-${ye}`;this._extensionsLatestSequenceMap.set(Fe,ae),1===se?this._handleMessageExtensionsUpdated({messageID:Fe,updateMessageExtensionsInfo:Z}):2===se?this._handleMessageExtensionsDeleted({messageID:Fe,deleteMessageExtensionsInfo:ee}):3===se&&this._handleMessageExtensionsCleared({messageID:Fe,clearMessageExtensionsInfo:ne})}_handleMessageExtensionsUpdated(J){const{notificationCenter:Z,OuterEvent:ee}=this._core,{messageID:ne,updateMessageExtensionsInfo:se=[]}=J,re=[];se.forEach((J=>{const{MsgKeyValue:Z=[]}=J,ee=Z.map((J=>(re.push({key:J.Key,value:J.Value}),{key:J.Key,value:J.Value,seq:J.Seq})));this._updateLocalExtensions(ne,ee)})),Z.emitOuterEvent(ee.MESSAGE_EXTENSIONS_UPDATED,{name:ee.MESSAGE_EXTENSIONS_UPDATED,data:{messageID:ne,extensions:re}})}_handleMessageExtensionsDeleted(J){const{notificationCenter:Z,OuterEvent:ee}=this._core,{messageID:ne,deleteMessageExtensionsInfo:se=[]}=J,re=[];se.forEach((J=>{const{MsgKeyValue:Z=[]}=J,ee=Z.map((J=>(re.push(J.Key),{key:J.Key,seq:J.Seq})));this._updateLocalExtensions(ne,ee)})),Z.emitOuterEvent(ee.MESSAGE_EXTENSIONS_DELETED,{name:ee.MESSAGE_EXTENSIONS_DELETED,data:{messageID:ne,keyList:re}})}_handleMessageExtensionsCleared(J){const{notificationCenter:Z,OuterEvent:{MESSAGE_EXTENSIONS_DELETED:ee},utils:{isEmpty:ne}}=this._core,{messageID:se,clearMessageExtensionsInfo:re=[]}=J,ae=[];re.forEach((J=>{const{ClearMsgSeq:Z}=J;this._messageExtensionsMap.has(se)&&(this._messageExtensionsMap.get(se)||[]).forEach(((J,ee)=>{J.seq<=Z&&!ne(J.value)&&ae.push(ee)})),this._clearLocationExtensions(se,Z)})),Z.emitOuterEvent(ee,{name:ee,data:{messageID:se,keyList:ae}})}};const Tc={key:"message",required:!0,rules:["object"],allowEmpty:!1,customValidator:J=>{const{constants:{OuterConstant:Z}}=hc.core;return J.status!==Z.MessageStatus.SUCCESS?"message is not success":!0===J.isSupportExtension||"message is not support extension"}},Ac={setMessageExtensions:[Tc,{key:"extensions",required:!0,rules:["array"],allowEmpty:!1}],getMessageExtensions:[Tc],deleteMessageExtensions:[Tc]},Oc=Object.assign(Object.assign(Object.assign(Object.assign({deleteMessage:[{required:!0,rules:["array"],allowEmpty:!1}],revokeMessage:[{required:!0,rules:["object"],allowEmpty:!1}],resendMessage:[{key:"message",required:!0,rules:["object"],allowEmpty:!1},{key:"options",required:!1,rules:["object"],allowEmpty:!1}],getMessageList:{conversationID:{required:!0,rules:["string"],allowEmpty:!1},nextReqMessageID:{required:!1,rules:["string"],allowEmpty:!0},count:{required:!1,rules:["number"],allowEmpty:!0}},getMessageListHopping:{conversationID:{required:!0,rules:["string"],allowEmpty:!1},sequence:{required:!1,rules:["number"],allowEmpty:!0},direction:{required:!1,rules:["number"],allowEmpty:!0},count:{required:!1,rules:["number"],allowEmpty:!0}},createTextAtMessage:{to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1},payload:{required:!0,rules:["object"],allowEmpty:!1,customValidator:J=>{const Z=function(J){var Z;return"string"==typeof(null==J?void 0:J.text)&&("string"!=typeof J.text||0!==(null===(Z=null==J?void 0:J.text)||void 0===Z?void 0:Z.length))||"payload.text is invalid."}(J);return!0!==Z?Z:!((null==J?void 0:J.atUserList)&&!Array.isArray(J.atUserList))||"atUserList should be an array or undefind."}}},findMessage:[{required:!0,rules:["string"],allowEmpty:!1}],translateText:{sourceTextList:{required:!0,rules:["array"],allowEmpty:!1},sourceLanguage:{required:!0,rules:["string"],allowEmpty:!1},targetLanguage:{required:!0,rules:["string"],allowEmpty:!1}},createForwardMessage:{to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1,customValidator:J=>!(!J.startsWith("C2C")&&!J.startsWith("GROUP"))||"conversationType is invalid."},payload:{required:!0,rules:["object"],allowEmpty:!1}},createLocationMessage:{to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1},payload:{required:!0,rules:["object"],allowEmpty:!1,customValidator:J=>{const{utils:{isString:Z,isNumber:ee}}=hc.core;return Z(null==J?void 0:J.description)?ee(null==J?void 0:J.longitude)?!!ee(null==J?void 0:J.latitude)||"payload.latitude must be a number.":"payload.longitude must be a number.":"payload.description must be a string."}}}},{addMessageReaction:[{key:"message",required:!0,rules:["object"],allowEmpty:!1},{key:"reactionID",required:!0,rules:["string"],allowEmpty:!1}],removeMessageReaction:[{key:"message",required:!0,rules:["object"],allowEmpty:!1},{key:"reactionID",required:!0,rules:["string"],allowEmpty:!1}],getMessageReactions:{messageList:{required:!0,rules:["array"],allowEmpty:!1},maxUserCountPerReaction:{required:!1,rules:["number"],allowEmpty:!0,customValidator:J=>"number"!=typeof J?"maxUserCountPerReaction is invalid.":!(J<0||J>10)||"maxUserCountPerReaction should between [0, 10]."}},getAllUserListOfMessageReaction:{message:{required:!0,rules:["object"],allowEmpty:!1,customValidator:J=>"success"===J.status||"message is invalid."},reactionID:{required:!0,rules:["string"],allowEmpty:!1},nextSeq:{required:!1,rules:["number"],allowEmpty:!0},count:{required:!1,rules:["number"],allowEmpty:!0}}}),{sendMessageReadReceipt:[{required:!0,rules:["array"],allowEmpty:!1}],getMessageReadReceiptList:[{required:!0,rules:["array"],allowEmpty:!1}],getGroupMessageReadMemberList:{message:{required:!0,rules:["object"],allowEmpty:!1},filter:{required:!1,rules:["number"],allowEmpty:!0},count:{required:!1,rules:["number"],allowEmpty:!0},cursor:{required:!1,rules:["string"],allowEmpty:!0}}}),Ac),{pinGroupMessage:{groupID:{required:!0,rules:["string"],allowEmpty:!1},message:{required:!0,rules:["object"],allowEmpty:!1},isPinned:{required:!0,rules:["boolean"],allowEmpty:!1}},getPinnedGroupMessageList:[{key:"groupID",required:!0,rules:["string"],allowEmpty:!1}]}),wc=Object.assign(Object.assign(Object.assign(Object.assign({deleteMessage:!0,revokeMessage:!0,resendMessage:!0,getMessageList:!0,getMessageListHopping:!0,createTextAtMessage:!0,findMessage:!0,translateText:!0,createForwardMessage:!0,createLocationMessage:!0},{addMessageReaction:!0,removeMessageReaction:!0,getMessageReactions:!0,getAllUserListOfMessageReaction:!0}),{sendMessageReadReceipt:!0,getMessageReadReceiptList:!0,getGroupMessageReadMemberList:!0}),{setMessageExtensions:!0,getMessageExtensions:!0,deleteMessageExtensions:!0}),{pinGroupMessage:!0,getPinnedGroupMessageList:!0});class hi{constructor(J){this._core=J}deleteMessage(J){return ge(this,void 0,void 0,(function*(){const{to:Z,messageIdentifiers:ee}=J,ne={From_Account:this._core.common.getCurrentUserID(),To_Account:Z,MsgKeyList:ee};return this._core.common.buildAndSendPacket({servcmd:"openim.delete_c2c_msg_ramble",data:ne})}))}revokeMessage(J){return ge(this,void 0,void 0,(function*(){const{to:Z,from:ee,sequence:ne,time:se,random:re}=J,ae={MsgInfo:{From_Account:ee,To_Account:Z,MsgSeq:ne,MsgRandom:re,MsgTimeStamp:se}};return this._core.common.buildAndSendPacket({servcmd:"openim.msgwithdraw",data:ae})}))}}class gi{constructor(J){this._core=J}deleteMessage(J){return ge(this,void 0,void 0,(function*(){const{to:Z,messageIdentifiers:ee}=J,ne={GroupId:Z,Deleter_Account:this._core.common.getCurrentUserID(),Seqs:ee};return this._core.common.buildAndSendPacket({servcmd:"group_open_http_svc.delete_group_ramble_msg_by_seq",data:ne})}))}revokeMessage(J){return ge(this,void 0,void 0,(function*(){const{to:Z,sequence:ee}=J,ne={GroupId:Z,MsgSeqList:[{MsgSeq:ee}]};return this._core.common.buildAndSendPacket({servcmd:"group_open_http_svc.group_msg_recall",data:ne})}))}}class _i{constructor(J){this._core=J}generateRevokeMessage(J){const{conversationID:Z,sequence:ee,random:ne,tinyID:se,clientTime:re,revokeReason:ae,revoker:le}=J;let pe={};const{messageDataHandler:_e}=this._core.message;return pe=_e.revokeMessage({conversationID:Z,sequence:ee,random:ne,revoker:le}),pe||(pe={conversationID:Z,sequence:ee},se&&re&&ne&&(pe.ID=`${se}-${re}-${ne}`)),pe.revoker=le,pe.revokeReason=ae,pe.revokerInfo={userID:le,nick:"",avatar:""},pe}updateRevokerInfo(J){return ge(this,void 0,void 0,(function*(){const Z=J.map((J=>J.revoker));try{const ee=yield this._fetchUserInfos(Z);ee&&J.forEach((J=>{const{revoker:Z}=J;ee[Z]&&(J.revokerInfo.nick=ee[Z].nick||"",J.revokerInfo.avatar=ee[Z].avatar||"",J.revokerInfo.userID=Z)}))}catch(J){console.debug(J)}}))}_fetchUserInfos(J){return ge(this,void 0,void 0,(function*(){var Z,ee;const ne=yield null===(Z=this._core.user.userProfile)||void 0===Z?void 0:Z.getUserProfile({userIDList:J});return(null==ne?void 0:ne.data)?null===(ee=ne.data)||void 0===ee?void 0:ee.reduce(((J,{userID:Z,nick:ee,avatar:ne})=>(J[Z]={nick:ee||"",avatar:ne||""},J)),{}):null}))}}var Rc=new class{constructor(){this._core=null,this._c2cMessageAction=null,this._groupMessageAction=null}init(J){this._core=J,this._groupMessageAction=new gi(J),this._c2cMessageAction=new hi(J),this._messageHelper=new _i(J);const{helper:Z}=J;Z.registerApi({apiName:"deleteMessage",context:this}),Z.registerApi({apiName:"revokeMessage",context:this}),Z.registerApi({apiName:"resendMessage",context:this}),Z.registerApi({apiName:"findMessage",context:this})}deleteMessage(J){return ge(this,void 0,void 0,(function*(){let Z=[],ee=[];const{conversationID:ne,conversationType:se}=J[0],re=ne.replace(se,"");if("@TIM#SYSTEM"===se)throw new this._core.helper.ChatError({code:2116});if(J.forEach((J=>{const{conversationID:re,conversationType:ae,status:le,_onlineOnlyFlag:pe,sequence:_e,random:ve,time:ye}=J||{};if("success"===le&&re===ne&&ae===se){if(!pe){const J="C2C"===ae?`${_e}_${ve}_${ye}`:String(_e);Z.push(J)}ee.push(J)}})),0===Z.length)return this._handleDeleteMessageSuccess(ee),{code:0,data:{messageList:ee}};Z.length>30&&(Z=Z.slice(0,30),ee=ee.slice(0,30));try{return"C2C"===se?yield this._c2cMessageAction.deleteMessage({to:re,messageIdentifiers:Z}):yield this._groupMessageAction.deleteMessage({to:re,messageIdentifiers:Z}),this._handleDeleteMessageSuccess(ee),{code:0,data:{messageList:ee}}}catch(J){const{errorCode:Z}=J;throw new this._core.helper.ChatError({functionName:"deleteMessage",code:Z})}}))}revokeMessage(J){return ge(this,void 0,void 0,(function*(){var Z;const{conversationType:ee,isRevoked:ne,ID:se,type:re,from:ae,to:le}=J;let pe=null;const _e=`type:${re} from:${ae} to:${le} ID:${se}`;if("@TIM#SYSTEM"===ee)throw new this._core.helper.ChatError({message:"system message cannot be revoked"});if(ne)throw new this._core.helper.ChatError({message:"message has been revoked",moreMessage:_e});try{if(pe="C2C"===ee?yield this._c2cMessageAction.revokeMessage(J):yield this._groupMessageAction.revokeMessage(J),pe){const{RecallRetList:ee}=pe,ne=(null===(Z=null==ee?void 0:ee[0])||void 0===Z?void 0:Z.RetCode)||0;if(0!==ne)throw new this._core.helper.ChatError({code:ne,moreMessage:_e});return J.isRevoked=!0,yield this._handleRevokeMessageSuccess(J),{code:0,data:{message:J},successLog:{message:_e}}}}catch(J){const{errorCode:Z}=J;throw new this._core.helper.ChatError({functionName:"revokeMessage",code:Z,moreMessage:_e})}}))}resendMessage(J,Z){return ge(this,void 0,void 0,(function*(){var ee,ne;return J.isResend=!0,J.status="unSend",null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.apiMap)||void 0===ne?void 0:ne.sendMessage(J,Z)}))}findMessage(J){return this._core.message.messageDataHandler.findMessage(J)}_handleDeleteMessageSuccess(J){if(0===J.length)return;const{message:{messageDataHandler:Z},common:{isTopic:ee},notificationCenter:ne,InnerEvent:se}=this._core;J.forEach((J=>{J.isDeleted=!0;const ee=Z.getLocalMessageList(J.conversationID);null==ee||ee.forEach((Z=>{Z.ID===J.ID&&(Z.isDeleted=!0)}))}));const{conversationID:re=""}=J[0];ee(re)?ne.emitInnerEvent(se.TOPIC_MESSAGE_DELETED,re):ne.emitInnerEvent(se.MESSAGE_DELETED,re)}_handleRevokeMessageSuccess(J){return ge(this,void 0,void 0,(function*(){var Z;const ee=null===(Z=this._core.store.get("login"))||void 0===Z?void 0:Z.userId,{conversationID:ne,sequence:se,random:re}=J;this._core.message.messageDataHandler.revokeMessage({conversationID:ne,sequence:se,random:re,revoker:ee}),yield this._messageHelper.updateRevokerInfo([J])}))}};class vi{static parseServerPushElement(J){const{MsgContent:Z={}}=J,{Index:ee,Data:ne}=Z;return new vi({index:ee,data:ne})}constructor(J){this.type=dc.MSG_FACE;const{index:Z,data:ee}=J;this.content={index:Z,data:ee}}validateBeforeSend(){var J,Z;return"number"==typeof(null===(J=this.content)||void 0===J?void 0:J.index)&&"string"==typeof(null===(Z=this.content)||void 0===Z?void 0:Z.data)?{isValid:!0}:{isValid:!1,error:{message:"content is invalid"}}}transformToServerFormat(J){const{isMergerMessage:Z=!1}=J||{},ee=Z?this.payload:this.content,{index:ne,data:se}=ee;return{MsgType:this.type,MsgContent:{Index:ne,Data:se}}}}class fi{static parseServerPushElement(J){const{MsgContent:Z={}}=J,{Desc:ee,Longitude:ne,Latitude:se}=Z;return new fi({description:ee,longitude:ne,latitude:se})}constructor(J){this.type=dc.MSG_LOCATION;const{description:Z,longitude:ee,latitude:ne}=J;this.content={description:Z,longitude:ee,latitude:ne}}validateBeforeSend(){return{isValid:!0}}transformToServerFormat(J){const{isMergerMessage:Z=!1}=J||{},ee=Z?this.payload:this.content,{description:ne,longitude:se,latitude:re}=ee;return{MsgType:this.type,MsgContent:{Desc:ne,Longitude:se,Latitude:re}}}}class Ii{static parseServerPushElement(J){const{MsgContent:Z={}}=J,{StreamMsgID:ee,CompatibleText:ne,Markdown:se,BinaryData:re,ErrorCode:ae,ErrorMsg:le}=Z;return new Ii({streamMessageID:ee,compatibleText:ne,markdown:se,binaryData:re,errorCode:ae,errorMessage:le})}constructor(J){this.type=dc.MSG_STREAM,this.content={streamMessageID:"",compatibleText:"",errorCode:0,errorMessage:"",isStreamEnded:!1},this._chunks=[],this._latestIndex=0;const{streamMessageID:Z,compatibleText:ee,markdown:ne,binaryData:se,errorCode:re=0,errorMessage:ae="",isStreamEnded:le=!1}=J;this.content.streamMessageID=Z,this.content.compatibleText=ee,this.content.markdown=ne,this.content.binaryData=se,this.content.errorCode=re,this.content.errorMessage=ae,this.content.isStreamEnded=le}updateChunks(J){if(!J||0===J.length)return;const Z=J.sort(((J,Z)=>J.index-Z.index)),ee=this._getMaxRevokedChunkIndex(Z);ee>=0&&(this._chunks=[],this._latestIndex=ee,this._updateContent());const ne=this._getValidChunks(Z);if(0!==ne.length&&(this._mergeAndSortChunks(ne),this._chunks.length>0)){const J=this._chunks[this._chunks.length-1];this._latestIndex=J.index,this._updateContent(),this.content.isStreamEnded=J.isLast}}getLatestIndex(){return this._latestIndex}_filterContinuousChunks(J,Z){if(0===J.length)return[];const ee=[];let ne=Z;for(const Z of J){if(Z.index>ne)break;Z.index===ne&&(ee.push(Z),ne++)}return ee}_mergeAndSortChunks(J){const Z=new Map;this._chunks.forEach((J=>{Z.set(J.index,J)})),J.forEach((J=>{Z.set(J.index,J)})),this._chunks=Array.from(Z.values()).sort(((J,Z)=>J.index-Z.index))}_updateContent(){this.content.markdown=this._chunks.map((J=>J.markdown)).join("");const J=this._chunks.map((J=>J.binaryData)).filter((J=>(null==J?void 0:J.length)>0));if(0===J.length)this.content.binaryData=new Uint8Array(0);else if(1===J.length)this.content.binaryData=J[0];else{const Z=J.reduce(((J,Z)=>J+Z.length),0),ee=new Uint8Array(Z);let ne=0;for(const Z of J)ee.set(Z,ne),ne+=Z.length;this.content.binaryData=ee}}_getMaxRevokedChunkIndex(J){let Z=-1;for(let ee=0;ee<J.length;ee++){const ne=J[ee];ne.eventType===Ic.REVOKED&&ne.index>Z&&(Z=ne.index)}return Z}_getValidChunks(J){const Z=J.filter((J=>J.eventType===Ic.DATA&&J.index>this._latestIndex));return this._filterContinuousChunks(Z,this._latestIndex+1)}}var Dc=new class{init(J){this._core=J,J.message.messageFactory.registerElementClass(dc.MSG_FACE,vi),J.message.messageFactory.registerElementClass(dc.MSG_LOCATION,fi),J.message.messageFactory.registerElementClass(dc.MSG_STREAM,Ii),J.helper.registerApi({apiName:"createFaceMessage",context:this}),J.helper.registerApi({apiName:"createTextAtMessage",context:this}),J.helper.registerApi({apiName:"createForwardMessage",context:this}),J.helper.registerApi({apiName:"createLocationMessage",context:this})}createFaceMessage(J){if(!J)return null;const{index:Z,data:ee}=(null==J?void 0:J.payload)||{},ne=new vi({index:Z,data:ee}),se=this._core.common.getCurrentUserID(),re=this._core.message.messageFactory.createMessage(Object.assign(Object.assign({},J),{from:se}));return re.setElement(ne),re}createTextAtMessage(J){const{atUserList:Z}=(null==J?void 0:J.payload)||{},ee=this._core.apiMap.createTextMessage(J),{OuterConstant:ne}=this._core;if(!ee)return null;if(Array.isArray(Z)){const J=[],se=[];Z.forEach((Z=>{Z!==ne.MSG_AT_ALL?(J.push({GroupAtAllFlag:0,GroupAt_Account:Z}),se.push(Z)):(J.push({GroupAtAllFlag:1}),se.push(ne.MSG_AT_ALL))})),ee._groupAtInfoList=J,ee.atUserList=se}return ee}createForwardMessage(J){const{helper:Z,OuterConstant:ee}=this._core,{to:ne,conversationType:se,priority:re,payload:ae,needReadReceipt:le,receiverList:pe,cloudCustomData:_e="",isSupportExtension:ve=!1}=J;if(!Array.isArray(ae._elements))throw new Z.ChatError({functionName:"createForwardMessage",code:2454});if(ae.type===ee.MSG_GRP_TIP)throw new Z.ChatError({functionName:"createForwardMessage",code:2453});const ye=this._core.common.getCurrentUserID(),Fe=this._core.message.messageFactory.createMessage({to:ne,from:ye,conversationType:se,isPlaceMessage:0,priority:re,payload:ae,needReadReceipt:le,isSupportExtension:ve,cloudCustomData:_e,receiverList:pe});return Fe.setRelayFlag(!0),Fe.setElement(ae._elements[0]),Fe}createLocationMessage(J){if(!J)return null;const{description:Z,longitude:ee,latitude:ne}=(null==J?void 0:J.payload)||{},se=new fi({description:Z,longitude:ee,latitude:ne}),re=this._core.common.getCurrentUserID(),ae=this._core.message.messageFactory.createMessage(Object.assign(Object.assign({},J),{from:re}));return ae.setElement(se),ae}};let Nc=class{init(J){this._messageHelper=new _i(J),this._core=J;const{notificationCenter:Z,InnerEvent:{MESSAGE_PUSH:ee},InnerEventSubType:{C2C_REVOKED_MESSAGE:ne},helper:{registerWorkflowStep:se},constants:{WORKFLOW_NAME:re,WORKFLOW_STEP:ae}}=J;Z.subscribeInnerEvent(ee,ne,this._handleC2CNotifyMessage,this),se(re.SYNC_SERVER_INFO_AFTER_RE_ONLINE,ae.HANDLE_C2C_REVOKED_MESSAGE_FROM_SYNC_UNREAD,this._handleC2CRevokeMessagesFromUnreadMessageSync,this)}_handleC2CNotifyMessage(J){const{C2cNotifyMsgArray:Z}=J;null==Z||Z.forEach((J=>{Object.keys(J).includes("WithdrawC2cMsgNotify")&&this._handleC2CRevokeMessage(J)}))}_handleC2CRevokeMessage(J){return ge(this,void 0,void 0,(function*(){try{const{WithdrawC2cMsgNotify:{C2cWithdrawInfoArray:Z}}=J;yield this._parseAndEmitC2CRevokedMessages(Z)}catch(J){console.debug(J)}}))}_parseAndEmitC2CRevokedMessages(J){return ge(this,void 0,void 0,(function*(){const Z=[],{notificationCenter:ee,OuterEvent:ne,common:{getCurrentUserID:se}}=this._core;J.forEach((J=>{var ee;const{MsgRand:ne,MsgSeq:re,To_Account:ae,From_Account:le,RevokerInfo:{Revoker_Account:pe,Revoke_Reason:_e}}=J,ve=se()===le?`C2C${ae}`:`C2C${le}`,ye=(null===(ee=null==J?void 0:J.RevokerInfo)||void 0===ee?void 0:ee.Reason)||_e,Fe=this._messageHelper.generateRevokeMessage({conversationID:ve,sequence:re,random:ne,revoker:pe,revokeReason:ye});Z.push(Fe)})),Z.length>0&&(yield this._messageHelper.updateRevokerInfo(Z),ee.emitOuterEvent(ne.MESSAGE_REVOKED,{name:ne.MESSAGE_REVOKED,data:Z}))}))}_handleC2CRevokeMessagesFromUnreadMessageSync(J){return ge(this,void 0,void 0,(function*(){const{revokedMessageList:Z}=J.result;yield this._parseAndEmitC2CRevokedMessages(Z)}))}dispose(){const{notificationCenter:J,InnerEvent:{MESSAGE_PUSH:Z},InnerEventSubType:{C2C_REVOKED_MESSAGE:ee}}=this._core;J.unSubscribeInnerEvent(Z,ee,this._handleC2CNotifyMessage,this)}},Lc=class{init(J){this._messageHelper=new _i(J),this._core=J;const{notificationCenter:Z,InnerEvent:{MESSAGE_PUSH:ee},InnerEventSubType:{GROUP_MESSAGE_REVOKED:ne}}=J;Z.subscribeInnerEvent(ee,ne,this._handleGroupNotifyMessage,this)}_handleGroupNotifyMessage(J){const{GroupTips:Z}=J;null==Z||Z.forEach((J=>{var Z;Array.isArray(null===(Z=null==J?void 0:J.MsgBody)||void 0===Z?void 0:Z.GroupWithdrawInfoArray)&&this._handleGroupRevokeMessage(J)}))}_handleGroupRevokeMessage(J){return ge(this,void 0,void 0,(function*(){try{const{RevokerInfo:Z,MsgBody:{GroupWithdrawInfoArray:ee},GroupInfo:ne}=J,se=[],re=[],{notificationCenter:ae,OuterEvent:le,utils:{isEmpty:pe},common:{isCommunity:_e}}=this._core;let ve=!1;ne&&(ve=_e({groupID:ne.GroupId})||!pe(ne.TopicId)),ee.forEach((J=>{const{Random:ee,MsgSeq:ae,GroupId:le,MsgClientTime:pe,TinyId:_e,TopicId:ye,RevokerInfo:{Revoker_Account:Fe=(null==Z?void 0:Z.Revoker_Account)||"",Reason:qe=(null==Z?void 0:Z.Reason)||""}}=J,$e=ye?`GROUP${ye}`:`GROUP${le}`,He=this._messageHelper.generateRevokeMessage({conversationID:$e,sequence:ae,random:ee,tinyID:_e,clientTime:pe,revoker:Fe,revokeReason:qe});ve?(He.revokerInfo.nick=ne.From_AccountNick,He.revokerInfo.avatar=ne.From_AccountHeadurl,se.push(He)):re.push(He)})),re.length>0&&(yield this._messageHelper.updateRevokerInfo(re),se.push(...re)),0!==se.length&&ae.emitOuterEvent(le.MESSAGE_REVOKED,{name:le.MESSAGE_REVOKED,data:se})}catch(J){console.debug(J)}}))}dispose(){const{notificationCenter:J,InnerEvent:{MESSAGE_PUSH:Z},InnerEventSubType:{GROUP_MESSAGE_REVOKED:ee}}=this._core;J.unSubscribeInnerEvent(Z,ee,this._handleGroupNotifyMessage,this)}};var kc=new class{constructor(){this._c2cMessageReceiver=new Nc,this._groupMessageReceiver=new Lc}init(J){this._c2cMessageReceiver.init(J),this._groupMessageReceiver.init(J)}dispose(){this._c2cMessageReceiver.dispose(),this._groupMessageReceiver.dispose()}},Pc=new class{constructor(){this._core=null}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"translateText",context:this})}translateText(J){return ge(this,void 0,void 0,(function*(){try{const{sourceLanguage:Z,sourceTextList:ee,targetLanguage:ne}=J,se=yield function(J,Z){return ge(this,void 0,void 0,(function*(){var ee,ne;const{sourceTextList:se,sourceLanguage:re,targetLanguage:ae}=J,{store:le,common:pe}=Z,_e={SourceText:se,Source:re,Target:ae,FromAccount:null===(ee=le.get("login"))||void 0===ee?void 0:ee.tinyID,SDKAppID:null===(ne=le.get("instance"))||void 0===ne?void 0:ne.sdkAppId},ve=yield pe.buildAndSendPacket({servcmd:"im_open_translate.ws_batch_trans_text",data:_e});if(ve){const{CmdErrorCode:J,TargetText:Z}=ve;return{cmdErrorCode:J,translatedTextList:Z}}}))}({sourceLanguage:Z,sourceTextList:ee,targetLanguage:ne},this._core);if(se){const{cmdErrorCode:{ErrorCode:J,ErrorInfo:Z},translatedTextList:ee}=se;if(0===J)return{code:0,data:{translatedTextList:ee}};throw{errorCode:J,errorInfo:Z,message:Z}}}catch(J){const{errorCode:Z,errorInfo:ee}=J||{};throw new this._core.helper.ChatError({functionName:"translateText",code:Z,message:ee})}}))}},Uc=new class{init(J){this._core=J,J.helper.registerApi({apiName:"convertVoiceToText",context:this})}convertVoiceToText(J){return ge(this,void 0,void 0,(function*(){var Z;const{message:ee,language:ne=gc.ZH_PY}=J;let{url:se}=ee.payload||{};const re=this._core.common.getCurrentUserID();ee.from===re&&"out"===ee.flow&&(se=ee.payload.remoteAudioUrl),this._validateVoiceFormat(se);const ae=(null===(Z=mc.exec(se))||void 0===Z?void 0:Z[1])||"mp3",le=_c[ne]||fc;try{const J=yield function(J){var Z;const{store:ee,common:ne}=hc.core,{url:se,format:re,serverLanguageType:ae}=J,le={BytesUrl:se,BytesEngServiceType:ae,BytesVoiceFormat:re,Uint32Sdkappid:null===(Z=ee.get("instance"))||void 0===Z?void 0:Z.sdkAppId,Uint64SourceType:0};return ne.buildAndSendPacket({servcmd:"im_open_speech.ws_sentence_recognition",data:le})}({url:se,format:ae,serverLanguageType:le});if(J){const{CmdErrorCode:Z,BytesResult:ee}=J;if(0===Z.ErrorCode)return{code:0,data:{result:ee}};throw{code:Z.ErrorCode,message:Z.ErrorInfo}}}catch(J){const{code:Z,message:ee}=J||{};throw new this._core.common.ChatError({functionName:"convertVoiceToText",code:Z,message:ee})}}))}_validateVoiceFormat(J){if(!mc.test(J))throw new this._core.common.ChatError({code:2119})}};class Ai{constructor(J){const{constants:Z,common:ee,utils:ne}=hc.core,{CONV_C2C:se,CONV_GROUP:re}=Z.OuterConstant,{ID:ae,tinyID:le,from:pe,to:_e,clientTime:ve=ee.timeManager.getServerTimeSeconds()||0,random:ye,sequence:Fe,cloudCustomData:qe="",nick:$e="",avatar:He="",clientSequence:Ye,conversationType:Je,groupID:Xe,_elements:Qe,time:tt}=J;this.ID=ae||`${le}-${ve}-${ye}`,this.messageRandom=ye,this.from=pe,this.messageSender=pe,this.time=tt,this.messageSequence=Fe,this.clientSequence=Ye||Fe,this.clientTime=ve,this.cloudCustomData=qe,this.messageReceiver=_e,this.avatar=He,this.nick=$e;const nt=ne.deepCopyWithMethods(Qe);nt.forEach((J=>{J.payload=J.content,delete J.content})),this.messageBody=nt,ae?Je.startsWith(se)?this.receiverUserID=_e:Je.startsWith(re)&&(this.receiverGroupID=_e):Xe?(this.receiverGroupID=Xe,this.messageReceiver=Xe):_e&&(this.receiverUserID=_e,this.messageReceiver=_e)}transformElementsToServerFormat(){return this.messageBody?Array.isArray(this.messageBody)?this.messageBody.map((J=>J.transformToServerFormat({isMergerMessage:!0}))):this.messageBody.transformToServerFormat({isMergerMessage:!0}):null}}class Ti{static parseServerPushElement(J){const{MsgContent:Z}=J,{MsgList:ee=[],CompatibleText:ne,AbstractList:se,Title:re,PbMsgKey:ae,JsonMsgKey:le}=Z||{},pe=ee.map((J=>Lo(J)));return new Ti({messageList:pe,title:re,abstractList:se,compatibleText:ne,pbDownloadKey:ae,downloadKey:le})}constructor(J){this.type=hc.core.constants.OuterConstant.MSG_MERGER;const{messageList:Z,title:ee,abstractList:ne,compatibleText:se,pbDownloadKey:re="",downloadKey:ae="",version:le=0,layersOverLimit:pe=!1}=J,_e=[];Z.forEach((J=>{if(J){const Z=new Ai(J);_e.push(Z)}})),this.content={messageList:_e,title:ee,abstractList:ne,compatibleText:se,version:le,downloadKey:ae,pbDownloadKey:re,layersOverLimit:pe}}validateBeforeSend(){const{isEmpty:J}=hc.core.helper;return J(this.content.messageList)?{isValid:!1,error:{message:"content is invalid"}}:{isValid:!0}}transformToServerFormat(J){const{isMergerMessage:Z=!1}=J||{},ee=Z?this.payload:this.content,{abstractList:ne,compatibleText:se,downloadKey:re,layersOverLimit:ae,pbDownloadKey:le,title:pe,version:_e,messageList:ve}=ee;return{MsgType:this.type,MsgContent:{AbstractList:ne,CompatibleText:se,JsonMsgKey:re,LayersOverLimit:ae,PbMsgKey:le,Title:pe,Version:_e,MsgList:No(ve)}}}}var Gc=new class{init(J){this._core=J;const{message:Z,helper:ee,constants:{OuterConstant:ne}}=J;Z.messageFactory.registerElementClass(ne.MSG_MERGER,Ti),ee.registerApi({apiName:"createMergerMessage",context:this}),ee.registerApi({apiName:"sendMessage",context:this,matcher:J=>J[0].type===ne.MSG_MERGER}),ee.registerApi({apiName:"downloadMergerMessage",context:this})}createMergerMessage(J){const{common:Z}=this._core;if(!J)return null;const ee=new Ti(J.payload),ne=Z.getCurrentUserID(),se=this._core.message.messageFactory.createMessage(Object.assign(Object.assign({},J),{from:ne}));return se.setRelayFlag(!0),se.setElement(ee),se}sendMessage(J,Z){return ge(this,void 0,void 0,(function*(){var ee,ne,se;try{const re=function(J){let Z="utf-8";hc.core.helper.IN_BROWSER&&document&&(Z=document.charset.toLowerCase());let ee,ne=0,se=0;if(se=J.length,"utf-8"===Z||"utf8"===Z)for(let Z=0;Z<se;Z++)ee=J.codePointAt(Z),ee<=127?ne+=1:ee<=2047?ne+=2:ee<=65535?ne+=3:(ne+=4,Z++);else if("utf-16"===Z||"utf16"===Z)for(let Z=0;Z<se;Z++)ee=J.codePointAt(Z),ee<=65535?ne+=2:(ne+=4,Z++);else ne=J.replace(/[^\x00-\xff]/g,"aa").length;return ne}(JSON.stringify(J));let ae=J,le=null;if(re>11264){ae=this._core.utils.deepCopyWithMethods(J);try{const{JsonMsgKey:J,PbMsgKey:Z}=yield function(J){return ge(this,void 0,void 0,(function*(){const{payload:{messageList:Z}}=J,ee={MsgList:No(Z)};return hc.core.common.buildAndSendPacket({servcmd:"im_long_msg.save_relay_json_msg",data:ee})}))}(ae),{payload:ee}=ae;le=new Ti(Object.assign(Object.assign({},ee),{messageList:[],downloadKey:J,pbDownloadKey:Z})),ae.setElement(le)}catch(J){console.error(J)}}const{data:{message:pe}}=yield null===(se=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message)||void 0===ne?void 0:ne.messageSender)||void 0===se?void 0:se.sendMessage(ae,Z);return le&&pe.setElement(J._elements),{code:0,data:{message:pe}}}catch(J){const{errorCode:Z}=J;throw new this._core.helper.ChatError({code:Z})}}))}downloadMergerMessage(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z}=this._core,ee=J.payload,{downloadKey:ne,pbDownload:se,type:re,messageList:ae}=ee,le=he(ee,["downloadKey","pbDownload","type","messageList"]);try{const ee=yield function(J){return ge(this,void 0,void 0,(function*(){return hc.core.common.buildAndSendPacket({servcmd:"im_long_msg.get_relay_json_msg",data:{JsonMsgKey:J}})}))}(ne),{MsgList:se}=ee||{},re=null==se?void 0:se.map((J=>{const Z=Lo(J);return new Ai(Z)}));return"function"==typeof J.isOnlineMessage?J.setElement({type:J.type,content:Object.assign({messageList:re},le)}):(J.payload.messageList=re,J.payload.downloadKey="",J.payload.pbDownloadKey=""),Z.info("downloadMergerMessage",` success downloadKey:${ne}`),J}catch(J){const{errorCode:Z}=J;throw new this._core.helper.ChatError({functionName:"downloadMergerMessage",code:Z,moreMessage:ne})}}))}},xc=new class{init(J){this._core=J,this._core.helper.registerExperimentalAPI("sendComboMessage",this)}sendComboMessage(J){return ge(this,void 0,void 0,(function*(){const{appStore:Z,message:ee,common:{getCurrentUserID:ne},utils:{isArray:se}}=this._core,{GroupId:re,To_Account:ae}=J;J.From_Account=J.From_Account||ne();let le=null;if(re){le=this._generateGroupMessage(Object.assign(Object.assign({},J),{ToGroupId:re}));const ee=Z.userStore.getUserProfile(ne());le.level=(null==ee?void 0:ee.level)||0,se(ae)&&ae.length>0&&(le._receiverList=ae)}else ae&&(le=this._generateC2CMessage(J));return ee.messageSender.sendMessage(le,J)}))}_generateC2CMessage(J){const{message:Z,OuterConstant:{CONV_C2C:ee}}=this._core,ne=ee,se=Z.messageHelper.parseServerPushMessage(J),re=Z.messageFactory.createMessage(Object.assign(Object.assign({},se),{conversationType:ne,flow:yc.OUT})),{elements:ae}=se;return re.setElement(ae),re}_generateGroupMessage(J){const{message:Z,OuterConstant:{CONV_GROUP:ee}}=this._core,ne=ee,se=Z.messageHelper.parseServerGroupMessage(J),re=Z.messageFactory.createMessage(Object.assign(Object.assign({},se),{conversationType:ne,flow:yc.OUT})),{elements:ae}=se;return re.setElement(ae),re}},Fc=new class{init(J){this._core=J;const{helper:Z,notificationCenter:ee,InnerEvent:{MESSAGE_PUSH:ne},InnerEventSubType:{GROUP_MESSAGE_PINNED:se}}=J;ee.subscribeInnerEvent(ne,se,this._handleGroupMessagePinned,this),Z.registerApi({apiName:"pinGroupMessage",context:this}),Z.registerApi({apiName:"getPinnedGroupMessageList",context:this})}pinGroupMessage(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z,common:{isTopic:ee},OuterConstant:{GROUP_ID_PREFIX:ne},helper:{ChatError:se}}=this._core;let{groupID:re,message:ae,isPinned:le}=J;const{sequence:pe}=ae;try{return yield function(J){return ge(this,void 0,void 0,(function*(){const{common:{buildAndSendPacket:Z,getCurrentUserID:ee}}=hc.core,{groupID:ne,sequence:se,isPinned:re}=J,ae=ee(),le=re?"group_open_http_svc.pin_message":"group_open_http_svc.unpin_message",pe={GroupId:ne,MsgSeq:se};return re?pe.Pinner_Account=ae:pe.UnPinner_Account=ae,Z({servcmd:le,data:pe})}))}({groupID:re,sequence:pe,isPinned:le}),{code:0,data:{}}}catch(J){const{errorCode:Z,errorInfo:ee}=J||{};throw new se({code:Z,message:ee})}}))}getPinnedGroupMessageList(J){return ge(this,void 0,void 0,(function*(){let Z=[];try{const ee=yield function(J){return ge(this,void 0,void 0,(function*(){const{groupID:Z}=J,{common:{buildAndSendPacket:ee}}=hc.core;return ee({servcmd:"group_open_http_svc.get_pinned_messages",data:{GroupId:Z}})}))}({groupID:J});if(ee){const{PinnedMsgList:ne=[]}=ee;Z=yield this._updatePinnedMessageInfo({serverPinnedMessageList:ne,groupID:J})}return{code:0,data:{messageList:Z}}}catch(J){throw J}}))}_handleGroupMessagePinned(J){const{message:{messageHelper:Z,messageFactory:ee},notificationCenter:ne,OuterEvent:se,OuterConstant:re}=this._core;J.GroupTips.forEach((J=>{const{ToGroupId:ae,MsgBody:{PinnedMsg:le,OpType:pe,MsgOperatorMemberExtraInfo:_e,SdkGroupMessageId:ve}}=J,{UserId:ye,NickName:Fe="",ImageUrl:qe=""}=_e;let $e=null,He=!1;if(16===pe){He=!0;const J=Z.parseServerGroupMessage(le);$e=ee.createMessage(Object.assign(Object.assign({},J),{conversationType:re.CONV_GROUP,flow:"in"})),$e.setElement(J.elements),$e.pinnerInfo={userID:ye,nick:Fe,avatar:qe}}else if(17===pe){const{ClientTime:J,Random:Z,SenderTinyId:ee,ServerTime:ne,MsgSeq:se}=ve;$e={ID:`${ee}-${J}-${Z}`,sequence:se,random:Z,time:ne,clientTime:J}}$e&&ne.emitOuterEvent(se.PINNED_GROUP_MESSAGE_UPDATED,{name:se.PINNED_GROUP_MESSAGE_UPDATED,data:{groupID:ae,message:$e,isPinned:He,operatorInfo:{userID:ye,nick:Fe,avatar:qe}}})}))}_findMessageBySequence(J,Z){const{message:{messageDataHandler:ee}}=this._core;return[...ee.getLocalMessageList(J),...ee.getSparseMessageList(J)].find((J=>J.sequence===Z))}_updatePinnedMessageInfo(J){return ge(this,arguments,void 0,(function*({serverPinnedMessageList:J,groupID:Z}){const{OuterConstant:{CONV_GROUP:ee},utils:{isEmpty:ne}}=this._core,se=[],re=[],ae=[],le=new Map,pe=`${ee}${Z}`;for(let Z=0;Z<J.length;Z++){const ee=J[Z],{Pinner_Account:ne,MsgSeq:_e}=ee,ve=this._findMessageBySequence(pe,_e);re.push(ne),le.set(_e,ne),ve?se.push(ve):ae.push(_e)}const _e=yield this._fetchPinnedMessageInfo({conversationID:pe,messageSequenceList:ae,pinnerIDList:re});if(_e){const{pinnerInfoMap:J,messageList:Z}=_e;return se.push(...Z),se.forEach((Z=>{const{sequence:ee}=Z,ne=le.get(ee),se=J[ne]||{userID:ne,nick:"",avatar:""};Z.pinnerInfo=se})),se.sort(((J,Z)=>J.sequence-Z.sequence)),se}return[]}))}_fetchPinnedMessageInfo(J){return ge(this,void 0,void 0,(function*(){var Z,ee;const{message:{messageHistory:ne},user:{userProfile:se},utils:{isArray:re}}=this._core,{conversationID:ae,messageSequenceList:le,pinnerIDList:pe}=J,_e=yield Promise.all([this._fetchMessageBySequence({conversationID:ae,messageSequenceList:le}),null==se?void 0:se.getUserProfile({userIDList:pe})]);if(re(_e)){const J={};return((null===(Z=_e[1])||void 0===Z?void 0:Z.data)||[]).forEach((Z=>{const{userID:ee,nick:ne="",avatar:se=""}=Z;J[ee]={userID:ee,nick:ne,avatar:se}})),{messageList:(null===(ee=_e[0])||void 0===ee?void 0:ee.messageList)||[],pinnerInfoMap:J}}}))}_fetchMessageBySequence(J){return ge(this,void 0,void 0,(function*(){const{utils:{isEmpty:Z},message:{messageHistory:ee}}=this._core,{conversationID:ne,messageSequenceList:se}=J;return Z(se)?[]:ee.getGroupRoamingMessagesByAnchor({conversationID:ne,messageSequenceList:se,getType:3})}))}};class Ni{constructor(J){this.eventType=Ic.DATA,this.index=0,this.markdown="",this.isLast=!1,this.binaryData=null;const{EventType:Z,Index:ee,Markdown:ne,IsLast:se,BinaryData:re}=J;this.eventType=Z,this.index=ee,this.markdown=ne,this.isLast=se,this.binaryData=re}}var qc=new class{constructor(){this._messageMap=new Map,this._retryCountMap=new Map}init(J){this._core=J;const{notificationCenter:Z,OuterEvent:{MESSAGE_RECEIVED:ee},InnerEvent:{HISTORY_MESSAGE_FETCHED:ne}}=J;Z.subscribeInnerEvent(Ec,this._handleStreamMessageChunkPush,this),Z.subscribeOuterEvent(ee,this._handleMessageReceived,this),Z.subscribeInnerEvent(ne,this.processHistoryMessage,this)}processHistoryMessage(J){const{utils:{isEmpty:Z,safeStringify:ee},ssoLog:ne}=this._core;try{null==J||J.forEach((J=>{var ee;if(this._isValidStreamMessage(J)){const ne=null===(ee=null==J?void 0:J._elements)||void 0===ee?void 0:ee[0],{streamMessageID:se,markdown:re,binaryData:ae}=(null==ne?void 0:ne.content)||{};Z(re)&&Z(ae)?(this._messageMap.set(se,J),this._fetchStreamMessageChunks(J)):ne.content.isStreamEnded=!0}}))}catch(J){ne.error("processHistoryMessage.error",ee(J))}}_handleMessageReceived(J){const Z=J.data;null==Z||Z.forEach((J=>{var Z,ee;if(this._isValidStreamMessage(J)){const{streamMessageID:ne}=(null===(ee=null===(Z=null==J?void 0:J._elements)||void 0===Z?void 0:Z[0])||void 0===ee?void 0:ee.content)||{};ne&&(this._messageMap.set(ne,J),this._fetchStreamMessageChunks(J))}}))}_isValidStreamMessage(J){var Z,ee;const{utils:{isEmpty:ne}}=this._core,{streamMessageID:se}=(null===(ee=null===(Z=null==J?void 0:J._elements)||void 0===Z?void 0:Z[0])||void 0===ee?void 0:ee.content)||{};return J.type===dc.MSG_STREAM&&!ne(se)}_fetchStreamMessageChunks(J){return ge(this,void 0,void 0,(function*(){var Z,ee;const{constants:{ERROR_CODE:ne},ssoLog:se,utils:{safeStringify:re}}=this._core,ae=null===(Z=J._elements)||void 0===Z?void 0:Z[0],le=null===(ee=null==ae?void 0:ae.content)||void 0===ee?void 0:ee.streamMessageID;try{const{from:Z,to:ee}=J,ne=ae.getLatestIndex();if(ae.content.isStreamEnded)return;const se=yield function(J){return ge(this,void 0,void 0,(function*(){const{from:Z,to:ee,streamMessageID:ne,index:se}=J,re={From_Account:Z,To_Account:ee,StreamMsgID:ne,AckIndex:se};return hc.core.common.buildAndSendPacket({servcmd:"StreamMsg.GetStreamHttp",data:re,timeout:5e3})}))}({from:Z,to:ee,streamMessageID:le,index:ne});if(se){const{ErrorCode:J,ErrorInfo:Z}=se;if(0!==J)throw ae.content.errorCode=J,ae.content.errorMessage=Z,{errorCode:J,errorMessage:Z}}}catch(Z){if(Z.errorCode===ne.NETWORK_TIMEOUT&&this._shouldRetryFetch(le)){const ee=this._retryCountMap.get(le)||0;se.debug("_fetchStreamMessageChunks.timeout",`error: ${re(Z)} retried: ${ee}`),this._retryCountMap.set(le,ee+1),this._fetchStreamMessageChunks(J)}else se.error("_fetchStreamMessageChunks.error",re(Z))}}))}_shouldRetryFetch(J){const{utils:{isNumber:Z}}=this._core;if(!this._retryCountMap.has(J))return this._retryCountMap.set(J,1),!0;const ee=this._retryCountMap.get(J);return!!(Z(ee)&&ee<=3)}_onStreamEnded(J,Z,ee){const{ssoLog:ne}=this._core;ee.content.isStreamEnded=!0,ee.stopReason=Z,this._messageMap.delete(J),ne.debug("_onStreamEnded",`streamMessage end, StopReason: ${Z}`)}_handleStreamMessageChunkPush(J){var Z;const{ssoLog:ee}=this._core,{StopReason:ne,Chunks:se,StreamID:re}=(null==J?void 0:J.body)||{},ae=this._messageMap.get(re);if(!ae)return void ee.warn(`_handleStreamMessageChunkPush, unfounded message: ${re}`);const le=null===(Z=ae._elements)||void 0===Z?void 0:Z[0];if(le&&this._validateExpectedChunk(le,se)){if(se.length>0){const J=se.map((J=>new Ni(J)));le.updateChunks(J)}this._emitMessageModify(ae),function(J,Z){ge(this,void 0,void 0,(function*(){const{common:{generateProtocolData:ee},utils:{safeStringify:ne},ssoLog:se,channel:re}=hc.core,ae={StreamMsgID:J,AckIndex:Z};try{const J=ee({servcmd:"StreamMsg.AckHttp",data:ae});re.sendPacket(J)}catch(J){se.debug("sendStreamChunkAck",ne(J))}}))}(re,le.getLatestIndex()),le.content.isStreamEnded&&this._onStreamEnded(re,ne,le)}}_emitMessageModify(J){const{notificationCenter:Z,OuterEvent:{MESSAGE_MODIFIED:ee}}=this._core;Z.emitOuterEvent(ee,{name:ee,data:[J]})}_validateExpectedChunk(J,Z){const ee=J.getLatestIndex()+1;let ne=!1;for(let J=0;J<Z.length;J++)if(Z[J].Index===ee){ne=!0;break}if(!ne){const{ssoLog:J}=this._core;return J.debug("_handleStreamMessageChunkPush",`Ignore push, expected index: ${ee}, received: [${Z.map((J=>J.Index)).join(", ")}]`),!1}return!0}reset(){this._messageMap.clear(),this._retryCountMap.clear()}dispose(){const{notificationCenter:J,OuterEvent:{MESSAGE_RECEIVED:Z}}=this._core;this.reset(),J.unSubscribeInnerEvent(Ec,this._handleStreamMessageChunkPush,this),J.unSubscribeInnerEvent(Z,this._handleMessageReceived,this)}},Vc=new class{constructor(){this.name="MessageEnhancer"}install(J){this._core=J,hc.init(J),Rc.init(J),Dc.init(J),kc.init(J),Cc.init(J),Pc.init(J),Uc.init(J),Mc.init(J),Gc.init(J),bc.init(J),xc.init(J),Fc.init(J),qc.init(J),J.helper.registerValidateConfig({auth:wc,params:Oc}),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.LOGOUT,this._reset,this),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.DESTROY,this.dispose,this)}dispose(){const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Z.LOGOUT,this._reset,this),J.unSubscribeInnerEvent(Z.DESTROY,this.dispose,this),kc.dispose(),Mc.dispose(),bc.dispose(),qc.dispose()}_reset(){qc.reset()}},$c=new class{constructor(){this._name="WebRequest"}init(J){this._core=J}request(J,Z){return ge(this,void 0,void 0,(function*(){var ee;const{isEmpty:ne}=null===(ee=this._core)||void 0===ee?void 0:ee.utils,{downloadUrl:se="",method:re="PUT",url:ae,qs:le,headers:pe={},resources:_e,dataType:ve="text",uploadByIP:ye,uploadIP:Fe}=J;let qe=ae;if(le){const J=this._queryString(le);J&&(qe+=`${qe.includes("?")?"&":"?"}${J}`)}const $e=new XMLHttpRequest;$e.open(re.toUpperCase(),qe,!0),$e.responseType=ve;const He=Object.assign({},pe);if(ye&&Fe&&(He.host=Fe),!ne(He))for(const J in He)He.hasOwnProperty(J)&&!["content-length","user-agent","origin","host"].includes(J.toLowerCase())&&$e.setRequestHeader(J,He[J]);return $e.onload=()=>{const ee=this._getResponseBody($e,se,ye&&Fe),ne=this._buildResponse($e,ee);if(200===$e.status)Z(null,ne);else{if(Fe&&!qe.includes(Fe))return J.url=this._domainName2IP(qe,Fe),J.uploadByIP=!0,this.request(J,Z);Z({code:$e.status,message:JSON.stringify($e.responseText)},ne)}},$e.onerror=()=>{const J=this._getResponseBody($e,se,ye&&Fe),ee=this._buildResponse($e,J),ne={code:$e.status,message:0===$e.status?"CORS blocked or network error":JSON.stringify($e.responseText)};Z(ne,ee)},J.onProgress&&$e.upload&&($e.upload.onprogress=Z=>{const{total:ee,loaded:ne}=Z,se=Math.min(Math.floor(100*ne/ee),100);J.onProgress({total:ee,loaded:ne,percent:se/100})}),$e.send(_e),$e}))}_buildResponse(J,Z){const ee={};return J.getAllResponseHeaders().trim().split("\n").forEach((J=>{if(J){const[Z,ne]=J.split(":").map((J=>J.trim()));ee[Z.toLowerCase()]=ne}})),{statusCode:J.status,statusMessage:J.statusText,headers:ee,data:Z}}_getResponseBody(J,Z,ee){return 200===J.status&&Z?{location:Z,uploadIP:ee}:{response:J.responseText,uploadIP:ee}}_queryString(J,Z="&",ee="="){var ne;const{isEmpty:se,isPlainObject:re}=null===(ne=this._core)||void 0===ne?void 0:ne.utils;return se(J)?"":re(J)?Object.keys(J).map((ne=>{const se=encodeURIComponent(ne)+ee;return Array.isArray(J[ne])?J[ne].map((J=>se+encodeURIComponent(J))).join(Z):se+encodeURIComponent(J[ne])})).filter(Boolean).join(Z):void 0}_domainName2IP(J,Z){return J.replace(/^http(s)?:\/\/(.*?)\//,`https://${Z}/`)}};const Jc=["unknown","image","video","audio","log"];var Xc=new class{init(J){this._core=J}request(J,Z){var ee;const{MINI_APP_NAMESPACE:ne,IN_ALIPAY_MINI_APP:se,isUniIOSApp:re}=null===(ee=this._core)||void 0===ee?void 0:ee.utils,{resources:ae="",headers:le={},url:pe,downloadUrl:_e=""}=J;let ve=pe,ye=null;const Fe=_e?_e.match(/^(https?:\/\/[^/]+\/)([^/]*\/?)(.*)$/):null;if(!Fe)return void console.warn("message Invalid download URL format");const qe=decodeURIComponent(Fe[3]),$e=qe.includes("?")?qe.split("?")[0]:qe||"",He={key:J.fileKey||$e,success_action_status:200,"Content-Type":""},Ye={};if(re()){const[J,Z]=pe.split("?sign=");Z&&(ve=`${J}?sign=${encodeURIComponent(Z)}`,Ye.sign=decodeURIComponent(Z),Ye.signature=decodeURIComponent(Z))}let Je={url:ve,header:le,name:"file",filePath:ae,formData:Object.assign(Object.assign({},He),Ye),timeout:J.timeout||3e5};if(se){const{name:Z}=Je,ee=he(Je,["name"]);Je=Object.assign(Object.assign({},ee),{fileName:"file",fileType:J.fileType?Jc[J.fileType]:"image"})}return ye=ne.uploadFile(Object.assign(Object.assign({},Je),{success:J=>{this._handleResponse({response:J,downloadUrl:_e,callback:Z})},fail:J=>{this._handleResponse({response:J,downloadUrl:_e,callback:Z})}})),ye.onProgressUpdate&&ye.onProgressUpdate((Z=>{J.onProgress&&J.onProgress({total:Z.totalBytesExpectedToSend||0,loaded:Z.totalBytesSent||0,percent:Z.progress?Math.floor(Z.progress)/100:0})})),ye}_handleResponse(J){const{downloadUrl:Z,response:ee,callback:ne}=J,se={};if(ee.header)for(const J in ee.header)ee.header.hasOwnProperty(J)&&(se[J.toLowerCase()]=ee.header[J]);const re=+ee.statusCode;200===re?ne(null,{statusCode:re,headers:se,data:Object.assign(Object.assign({},ee.data),{location:Z})}):ne({code:re,message:JSON.stringify(ee.data)},{statusCode:re,headers:se,data:void 0})}};function ki(J){return"file"===function(J){return Object.prototype.toString.call(J).match(/^\[object (.*)\]$/)[1].toLowerCase()}(J)}function Fi(J){const Z=J||99999999;return Math.round(Math.random()*Z)}function $i(J,Z=!0,ee=!0){const ne=Date.now();return Z?ee?ne-J+" ms":`${Math.round((ne-J)/1e3)} s`:ee?ne-J:Math.round((ne-J)/1e3)}function xi(J){return`${Array.from({length:8},(()=>Math.floor(65536*(1+Math.random())).toString(16).substring(1))).join("")}-${J}`}function qi(J,Z){return Math.round(Number(J)*10**Z)/10**Z}function Vi(J){return J<=1048576?`${qi(J/1024,1)}KB/s`:`${qi(J/1048576,1)}MB/s`}const tu="TIMImageElem",nu="TIMSoundElem",su="TIMFileElem",iu="TIMVideoFileElem",ru="RichMediaMessagePlugin",ou=["rich.my-imcloud.com","imrich.qcloud.com"],au=1,cu=2,uu=3,lu=255;var hu;!function(J){J.UNSENT="unSend",J.SUCCESS="success",J.FAIL="fail"}(hu||(hu={}));const du={wechat:/^(wxfile:\/\/tmp_|http:\/\/temp\/|cloud:\/\/temp-)/,alipay:/^(https:\/\/resource\/|alipayfile:\/\/tmp\/)/,baidu:/^(http:\/\/tmp\/|swanfile:\/\/tmp_)/,bytedance:/^(ttfile:\/\/tmp_|\/(var|tmp)\/|tttemp:\/\/)/,qq:/^(qqfile:\/\/tmp_|http:\/\/qtemp\/)/},pu=Symbol("isCustomUpload");var gu,_u=new class{init(J){this._core=J}addAuthToUrl(J=""){if(this._isMiniProgramTempFile(J))return J;const Z=function(J){return J?J.startsWith("https://")?J:J.startsWith("http://")?J.replace("http://","https://"):J:""}(J);return this.processResourceUrl(Z)}removeAuthToUrl(J){return function(J){const[Z,ee]=J.split("?");if(!ee)return Z;const ne=ee.split("&").reduce(((J,Z)=>{const[ee,ne]=Z.split("=");return ee&&"authKey"!==ee&&(J[ee]=ne||""),J}),{}),se=Object.keys(ne).map((J=>`${J}${ne[J]?`=${ne[J]}`:""}`)).join("&");return se?`${Z}?${se}`:Z}(J)}_isMiniProgramTempFile(J){return!!this.getPlatformFlags().IN_MINI_APP&&Object.values(du).some((Z=>Z.test(J)))}extractFileFromInput(J){const{utils:{isArray:Z}}=this._core;return ki(J)?J:function(J){if("object"!=typeof J||null===J)return!1;const Z=Object.getPrototypeOf(J);if(null===Z)return!0;let ee=Z;for(;null!==Object.getPrototypeOf(ee);)ee=Object.getPrototypeOf(ee);return Z===ee}(J)&&"undefined"!=typeof uni?Z(J.tempFiles)&&J.tempFiles.length>0?J.tempFiles[0]:Z(J.files)?J.files[0]:J.tempFile?J.tempFile:null:J instanceof HTMLInputElement&&J.files&&J.files.length>0?J.files[0]:null}probeImageWidthHeight(J){return ge(this,void 0,void 0,(function*(){var Z;const{IN_MINI_APP:ee,IN_BROWSER:ne}=(null===(Z=this._core)||void 0===Z?void 0:Z.utils)||{};return this._shouldSkipProbing()?{width:0,height:0}:ne?this._probeImageDimensionsWeb(J):ee?this._probeImageDimensionsMiniApp(J):void 0}))}isSimpleCos(){var J;const Z=(null===(J=this._core)||void 0===J?void 0:J.store.get("cloudConfig"))||{},{simple_cos:ee}=Z;return"0"!==ee}getFileDNList(){var J;let Z=ou;const ee=(null===(J=this._core)||void 0===J?void 0:J.store.get("cloudConfig"))||{},{file_dn_list:ne}=ee;if(void 0===ne)return Z;try{JSON.parse(ne).forEach((J=>{Z.includes(J)||Z.push(J)}))}catch(J){console.warn(J),Z=ou}return Z}getPlatform(){var J;return null===(J=this._core)||void 0===J?void 0:J.utils.platform}generateUUID(J,Z){var ee;let ne=`${this.getSDKAppID()}-${this.getCurrentUserID()}-${null===(ee=this._core)||void 0===ee?void 0:ee.utils.randomString()}`;if(Z)return`${ne}.${Z}`;const se=J.name||J.value||J.url||J.tempFilePath,re=se&&se.slice(se.lastIndexOf(".")+1);return re&&(ne=`${ne}.${re}`),ne}processResourceUrl(J){if(!J)return"";let Z=J;const ee=this.getFileDownloadProxy(),ne=this.getAuthKey(),se=this.getFileDNList();ee&&(J.startsWith("http://")?Z=J.replace(/^http:\/\/[^/]+/,ee):J.startsWith("https://")&&(Z=J.replace(/^https:\/\/[^/]+/,ee)));const re=ne&&-1===Z.indexOf("authKey=")&&function(J,Z){let ee=!1;if(J){const ne=J.match(/:\/\/([0-9]?\.)?(.[^/:]+)/),se=ne&&ne[2]||"";if(se.includes("rich-dev"))return!0;for(let J=0;J<Z.length;J++)if(se.endsWith(Z[J])){ee=!0;break}}return ee}(Z,se);return re&&(Z=Z.indexOf("?")>-1?`${Z}&authKey=${ne}`:`${Z}?authKey=${ne}`),Z}getCurrentUserID(){var J,Z;return null===(Z=null===(J=this._core)||void 0===J?void 0:J.store.get("login"))||void 0===Z?void 0:Z.userId}getSDKAppID(){var J,Z;return null===(Z=null===(J=this._core)||void 0===J?void 0:J.store.get("instance"))||void 0===Z?void 0:Z.sdkAppId}getFileDownloadProxy(){var J,Z;return(null===(Z=null===(J=this._core)||void 0===J?void 0:J.store.get("instance"))||void 0===Z?void 0:Z.fileDownloadProxy)||""}getFileUploadProxy(){var J,Z;return(null===(Z=null===(J=this._core)||void 0===J?void 0:J.store.get("instance"))||void 0===Z?void 0:Z.fileUploadProxy)||""}getAuthKey(){var J,Z;return(null===(Z=null===(J=this._core)||void 0===J?void 0:J.store.get("login"))||void 0===Z?void 0:Z.authKey)||""}isPrivateNetWork(){var J,Z;return null===(Z=null===(J=this._core)||void 0===J?void 0:J.store.get("instance"))||void 0===Z?void 0:Z.proxyServer}getPlatformFlags(){var J;const{IN_BROWSER:Z,IN_MINI_APP:ee,IN_RN_APP:ne,IN_UNI_NATIVE_APP:se}=null===(J=this._core)||void 0===J?void 0:J.utils;return{IN_BROWSER:Z,IN_MINI_APP:ee,IN_RN_APP:ne,IN_UNI_NATIVE_APP:se}}isEmpty(J){var Z;const{isEmpty:ee}=null===(Z=this._core)||void 0===Z?void 0:Z.utils;return ee(J)}generateURL(J,Z){const{needAddAuthToUrl:ee=!0}=Z||{};return ee?this.addAuthToUrl(J):J}_probeImageDimensionsMiniApp(J){var Z;const{MINI_APP_NAMESPACE:ee}=(null===(Z=this._core)||void 0===Z?void 0:Z.utils)||{};return new Promise((Z=>{ee.getImageInfo({src:J,success:J=>Z({width:J.width,height:J.height}),fail:()=>Z({width:0,height:0})})}))}_shouldSkipProbing(){var J;const{IN_RN_APP:Z,IS_IE:ee,IE_VERSION:ne,IN_WX_MINI_GAME:se}=(null===(J=this._core)||void 0===J?void 0:J.utils)||{};return Z||ee&&9===ne||se}_probeImageDimensionsWeb(J){return new Promise((Z=>{const ee=new Image,n=()=>{ee.onload=null,ee.onerror=null,ee.src=""};ee.onload=()=>{Z({width:ee.width,height:ee.height}),n()},ee.onerror=()=>{Z({width:0,height:0}),n()},ee.src=J}))}},mu={exports:{}},vu=(gu||(gu=1,mu.exports=function(){var J=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function s(J,Z){var ee=J[0],ne=J[1],se=J[2],re=J[3];ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne&se|~ne&re)+Z[0]-680876936|0)<<7|ee>>>25)+ne|0)&ne|~ee&se)+Z[1]-389564586|0)<<12|re>>>20)+ee|0)&ee|~re&ne)+Z[2]+606105819|0)<<17|se>>>15)+re|0)&re|~se&ee)+Z[3]-1044525330|0)<<22|ne>>>10)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne&se|~ne&re)+Z[4]-176418897|0)<<7|ee>>>25)+ne|0)&ne|~ee&se)+Z[5]+1200080426|0)<<12|re>>>20)+ee|0)&ee|~re&ne)+Z[6]-1473231341|0)<<17|se>>>15)+re|0)&re|~se&ee)+Z[7]-45705983|0)<<22|ne>>>10)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne&se|~ne&re)+Z[8]+1770035416|0)<<7|ee>>>25)+ne|0)&ne|~ee&se)+Z[9]-1958414417|0)<<12|re>>>20)+ee|0)&ee|~re&ne)+Z[10]-42063|0)<<17|se>>>15)+re|0)&re|~se&ee)+Z[11]-1990404162|0)<<22|ne>>>10)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne&se|~ne&re)+Z[12]+1804603682|0)<<7|ee>>>25)+ne|0)&ne|~ee&se)+Z[13]-40341101|0)<<12|re>>>20)+ee|0)&ee|~re&ne)+Z[14]-1502002290|0)<<17|se>>>15)+re|0)&re|~se&ee)+Z[15]+1236535329|0)<<22|ne>>>10)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne&re|se&~re)+Z[1]-165796510|0)<<5|ee>>>27)+ne|0)&se|ne&~se)+Z[6]-1069501632|0)<<9|re>>>23)+ee|0)&ne|ee&~ne)+Z[11]+643717713|0)<<14|se>>>18)+re|0)&ee|re&~ee)+Z[0]-373897302|0)<<20|ne>>>12)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne&re|se&~re)+Z[5]-701558691|0)<<5|ee>>>27)+ne|0)&se|ne&~se)+Z[10]+38016083|0)<<9|re>>>23)+ee|0)&ne|ee&~ne)+Z[15]-660478335|0)<<14|se>>>18)+re|0)&ee|re&~ee)+Z[4]-405537848|0)<<20|ne>>>12)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne&re|se&~re)+Z[9]+568446438|0)<<5|ee>>>27)+ne|0)&se|ne&~se)+Z[14]-1019803690|0)<<9|re>>>23)+ee|0)&ne|ee&~ne)+Z[3]-187363961|0)<<14|se>>>18)+re|0)&ee|re&~ee)+Z[8]+1163531501|0)<<20|ne>>>12)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne&re|se&~re)+Z[13]-1444681467|0)<<5|ee>>>27)+ne|0)&se|ne&~se)+Z[2]-51403784|0)<<9|re>>>23)+ee|0)&ne|ee&~ne)+Z[7]+1735328473|0)<<14|se>>>18)+re|0)&ee|re&~ee)+Z[12]-1926607734|0)<<20|ne>>>12)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne^se^re)+Z[5]-378558|0)<<4|ee>>>28)+ne|0)^ne^se)+Z[8]-2022574463|0)<<11|re>>>21)+ee|0)^ee^ne)+Z[11]+1839030562|0)<<16|se>>>16)+re|0)^re^ee)+Z[14]-35309556|0)<<23|ne>>>9)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne^se^re)+Z[1]-1530992060|0)<<4|ee>>>28)+ne|0)^ne^se)+Z[4]+1272893353|0)<<11|re>>>21)+ee|0)^ee^ne)+Z[7]-155497632|0)<<16|se>>>16)+re|0)^re^ee)+Z[10]-1094730640|0)<<23|ne>>>9)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne^se^re)+Z[13]+681279174|0)<<4|ee>>>28)+ne|0)^ne^se)+Z[0]-358537222|0)<<11|re>>>21)+ee|0)^ee^ne)+Z[3]-722521979|0)<<16|se>>>16)+re|0)^re^ee)+Z[6]+76029189|0)<<23|ne>>>9)+se|0,ne=((ne+=((se=((se+=((re=((re+=((ee=((ee+=(ne^se^re)+Z[9]-640364487|0)<<4|ee>>>28)+ne|0)^ne^se)+Z[12]-421815835|0)<<11|re>>>21)+ee|0)^ee^ne)+Z[15]+530742520|0)<<16|se>>>16)+re|0)^re^ee)+Z[2]-995338651|0)<<23|ne>>>9)+se|0,ne=((ne+=((re=((re+=(ne^((ee=((ee+=(se^(ne|~re))+Z[0]-198630844|0)<<6|ee>>>26)+ne|0)|~se))+Z[7]+1126891415|0)<<10|re>>>22)+ee|0)^((se=((se+=(ee^(re|~ne))+Z[14]-1416354905|0)<<15|se>>>17)+re|0)|~ee))+Z[5]-57434055|0)<<21|ne>>>11)+se|0,ne=((ne+=((re=((re+=(ne^((ee=((ee+=(se^(ne|~re))+Z[12]+1700485571|0)<<6|ee>>>26)+ne|0)|~se))+Z[3]-1894986606|0)<<10|re>>>22)+ee|0)^((se=((se+=(ee^(re|~ne))+Z[10]-1051523|0)<<15|se>>>17)+re|0)|~ee))+Z[1]-2054922799|0)<<21|ne>>>11)+se|0,ne=((ne+=((re=((re+=(ne^((ee=((ee+=(se^(ne|~re))+Z[8]+1873313359|0)<<6|ee>>>26)+ne|0)|~se))+Z[15]-30611744|0)<<10|re>>>22)+ee|0)^((se=((se+=(ee^(re|~ne))+Z[6]-1560198380|0)<<15|se>>>17)+re|0)|~ee))+Z[13]+1309151649|0)<<21|ne>>>11)+se|0,ne=((ne+=((re=((re+=(ne^((ee=((ee+=(se^(ne|~re))+Z[4]-145523070|0)<<6|ee>>>26)+ne|0)|~se))+Z[11]-1120210379|0)<<10|re>>>22)+ee|0)^((se=((se+=(ee^(re|~ne))+Z[2]+718787259|0)<<15|se>>>17)+re|0)|~ee))+Z[9]-343485551|0)<<21|ne>>>11)+se|0,J[0]=ee+J[0]|0,J[1]=ne+J[1]|0,J[2]=se+J[2]|0,J[3]=re+J[3]|0}function n(J){var Z,ee=[];for(Z=0;Z<64;Z+=4)ee[Z>>2]=J.charCodeAt(Z)+(J.charCodeAt(Z+1)<<8)+(J.charCodeAt(Z+2)<<16)+(J.charCodeAt(Z+3)<<24);return ee}function o(J){var Z,ee=[];for(Z=0;Z<64;Z+=4)ee[Z>>2]=J[Z]+(J[Z+1]<<8)+(J[Z+2]<<16)+(J[Z+3]<<24);return ee}function i(J){var Z,ee,ne,se,re,ae,le=J.length,pe=[1732584193,-271733879,-1732584194,271733878];for(Z=64;Z<=le;Z+=64)s(pe,n(J.substring(Z-64,Z)));for(ee=(J=J.substring(Z-64)).length,ne=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Z=0;Z<ee;Z+=1)ne[Z>>2]|=J.charCodeAt(Z)<<(Z%4<<3);if(ne[Z>>2]|=128<<(Z%4<<3),Z>55)for(s(pe,ne),Z=0;Z<16;Z+=1)ne[Z]=0;return se=(se=8*le).toString(16).match(/(.*?)(.{0,8})$/),re=parseInt(se[2],16),ae=parseInt(se[1],16)||0,ne[14]=re,ne[15]=ae,s(pe,ne),pe}function r(J){var Z,ee,ne,se,re,ae,le=J.length,pe=[1732584193,-271733879,-1732584194,271733878];for(Z=64;Z<=le;Z+=64)s(pe,o(J.subarray(Z-64,Z)));for(ee=(J=Z-64<le?J.subarray(Z-64):new Uint8Array(0)).length,ne=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Z=0;Z<ee;Z+=1)ne[Z>>2]|=J[Z]<<(Z%4<<3);if(ne[Z>>2]|=128<<(Z%4<<3),Z>55)for(s(pe,ne),Z=0;Z<16;Z+=1)ne[Z]=0;return se=(se=8*le).toString(16).match(/(.*?)(.{0,8})$/),re=parseInt(se[2],16),ae=parseInt(se[1],16)||0,ne[14]=re,ne[15]=ae,s(pe,ne),pe}function a(Z){var ee,ne="";for(ee=0;ee<4;ee+=1)ne+=J[Z>>8*ee+4&15]+J[Z>>8*ee&15];return ne}function c(J){var Z;for(Z=0;Z<J.length;Z+=1)J[Z]=a(J[Z]);return J.join("")}function u(J){return/[\u0080-\uFFFF]/.test(J)&&(J=unescape(encodeURIComponent(J))),J}function g(J){var Z,ee=[],ne=J.length;for(Z=0;Z<ne-1;Z+=2)ee.push(parseInt(J.substr(Z,2),16));return String.fromCharCode.apply(String,ee)}function p(){this.reset()}return c(i("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(J,Z){return(J=0|J||0)<0?Math.max(J+Z,0):Math.min(J,Z)}ArrayBuffer.prototype.slice=function(J,Z){var ee,ne,se,re,ae=this.byteLength,le=t(J,ae),pe=ae;return undefined!==Z&&(pe=t(Z,ae)),le>pe?new ArrayBuffer(0):(ee=pe-le,ne=new ArrayBuffer(ee),se=new Uint8Array(ne),re=new Uint8Array(this,le,ee),se.set(re),ne)}}(),p.prototype.append=function(J){return this.appendBinary(u(J)),this},p.prototype.appendBinary=function(J){this._buff+=J,this._length+=J.length;var Z,ee=this._buff.length;for(Z=64;Z<=ee;Z+=64)s(this._hash,n(this._buff.substring(Z-64,Z)));return this._buff=this._buff.substring(Z-64),this},p.prototype.end=function(J){var Z,ee,ne=this._buff,se=ne.length,re=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(Z=0;Z<se;Z+=1)re[Z>>2]|=ne.charCodeAt(Z)<<(Z%4<<3);return this._finish(re,se),ee=c(this._hash),J&&(ee=g(ee)),this.reset(),ee},p.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},p.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},p.prototype.setState=function(J){return this._buff=J.buff,this._length=J.length,this._hash=J.hash,this},p.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},p.prototype._finish=function(J,Z){var ee,ne,se,re=Z;if(J[re>>2]|=128<<(re%4<<3),re>55)for(s(this._hash,J),re=0;re<16;re+=1)J[re]=0;ee=(ee=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),ne=parseInt(ee[2],16),se=parseInt(ee[1],16)||0,J[14]=ne,J[15]=se,s(this._hash,J)},p.hash=function(J,Z){return p.hashBinary(u(J),Z)},p.hashBinary=function(J,Z){var ee=c(i(J));return Z?g(ee):ee},p.ArrayBuffer=function(){this.reset()},p.ArrayBuffer.prototype.append=function(J){var Z,ee=function h(J,Z,ee){var ne=new Uint8Array(J.byteLength+Z.byteLength);return ne.set(new Uint8Array(J)),ne.set(new Uint8Array(Z),J.byteLength),ne}(this._buff.buffer,J),ne=ee.length;for(this._length+=J.byteLength,Z=64;Z<=ne;Z+=64)s(this._hash,o(ee.subarray(Z-64,Z)));return this._buff=Z-64<ne?new Uint8Array(ee.buffer.slice(Z-64)):new Uint8Array(0),this},p.ArrayBuffer.prototype.end=function(J){var Z,ee,ne=this._buff,se=ne.length,re=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(Z=0;Z<se;Z+=1)re[Z>>2]|=ne[Z]<<(Z%4<<3);return this._finish(re,se),ee=c(this._hash),J&&(ee=g(ee)),this.reset(),ee},p.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},p.ArrayBuffer.prototype.getState=function(){var J=p.prototype.getState.call(this);return J.buff=function d(J){return String.fromCharCode.apply(null,new Uint8Array(J))}(J.buff),J},p.ArrayBuffer.prototype.setState=function(J){return J.buff=function l(J,Z){var ee,ne=J.length,se=new ArrayBuffer(ne),re=new Uint8Array(se);for(ee=0;ee<ne;ee+=1)re[ee]=J.charCodeAt(ee);return Z?re:se}(J.buff,!0),p.prototype.setState.call(this,J)},p.ArrayBuffer.prototype.destroy=p.prototype.destroy,p.ArrayBuffer.prototype._finish=p.prototype._finish,p.ArrayBuffer.hash=function(J,Z){var ee=c(r(new Uint8Array(J)));return Z?g(ee):ee},p}()),mu.exports),yu=function qt(J){return J&&J.__esModule&&Object.prototype.hasOwnProperty.call(J,"default")?J.default:J}(vu),Iu=new class{constructor(){this.uploadFileTryCount=0,this.maxRetries=1,this.systemClockOffset=0,this.httpRequest=null,this.uploadFileType="",this.duration=900,this.fetchCosTryCount=0}init(J){var Z;this._core=J;const{IN_MINI_APP:ee}=J.utils;this.httpRequest=ee?Xc:$c,null===(Z=this.httpRequest)||void 0===Z||Z.init(J)}uploadToCOS(J){return ge(this,void 0,void 0,(function*(){const Z=`${ru} uploadToCOS`,{ssoLog:ee,utils:{safeStringify:ne}}=this._core,{file:se}=J;this.uploadFileType=J.uploadFileType,ee.debug("uploadToCOS",`${Z} options:${ne(J)}`);try{const ne=Date.now(),re=yield this._createCosOptions(J),ae=re.fileExistsInCOS?{data:{location:re.downloadUrl}}:yield this._uploadFile(re);this._handleUploadError(ae,J);const le=this._createUploadResult(se,ae),pe=Date.now()-ne,_e=function(J){const Z=1048576;return J<1024?`${J}B`:J<Z?`${Math.floor(J/1024)}KB`:`${Math.floor(J/Z)}MB`}(se.size),ve=`size:${_e} time:${pe}ms speed:${Vi(1e3*se.size/pe)}`;return ee.debug("uploadToCOS",`${Z} ok. name:${se.name} ${ve}`),{uploadOptions:re,response:le}}catch(J){throw ee.warn("uploadToCOS",`${Z} failed, error:${ne(J)}`),J}}))}_handleUploadError(J,Z){var ee,ne;const{ChatError:se}=null===(ee=this._core)||void 0===ee?void 0:ee.helper;if(403===J.statusCode)throw Z.url,(null===(ne=null==J?void 0:J.data)||void 0===ne?void 0:ne.uploadIP)&&J.data.uploadIP,new se({message:"Upload failed with status 403"})}_createUploadResult(J,Z){return{fileName:J.name,fileSize:J.size,fileType:J.type.slice(J.type.indexOf("/")+1).toLowerCase(),location:Z.data.location||"",uploadTime:$i(Date.now(),!1),uploadSpeed:Vi(1e3*J.size/$i(Date.now(),!1))}}_createCosOptions(J){return ge(this,void 0,void 0,(function*(){const{fileName:Z,resources:ee,uploadMethod:ne}=yield this._prepareUploadParams(J),se=this._isC2CConversation(J.message.conversationID)?1:2;try{const re=yield this._fetchCosSignatureUrl({fileType:this.uploadFileType,fileName:Z,uploadMethod:ne,duration:this.duration,userID:J.message.from,conversationType:se}),{uploadUrl:ae,downloadUrl:le,requestSnapshotUrl:pe,thumbUrl:_e,largeUrl:ve,fileKey:ye,existFlag:Fe}=re,qe=!_u.isPrivateNetWork()&&re.uploadIP;return{url:this._getRawOrUploadProxyUrl(ae),fileType:this.uploadFileType,fileName:Z,resources:ee,downloadUrl:le,requestSnapshotUrl:pe,thumbUrl:_e,largeUrl:ve,fileKey:ye,uploadIP:qe||"",fileExistsInCOS:1===Fe,onProgress:Z=>this._handleUploadProgress(Z,J)}}catch(J){throw console.error("Failed to create COS pre-signed URL options:",J),J}}))}_prepareUploadParams(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z,utils:{safeStringify:ee,isEmpty:ne}}=this._core;Z.debug("_prepareUploadParams",` prepareUploadParams:${ee(J)}`);const{file:se}=J,{IN_MINI_APP:re,IN_RN_APP:ae}=_u.getPlatformFlags(),le=re||ae,pe=le&&J.message.type!==su,{name:_e}=se,ve=_e.slice(_e.lastIndexOf(".")),ye=`${Fi(999999)}${ve}`,Fe=pe?se.name:ye,qe=yield this._generateHashFileName(se);return{fileName:ne(qe)?xi(Fe):`${qe}${ve}`,resources:le?se.url:se,uploadMethod:le?1:0}}))}_generateHashFileName(J){return ge(this,void 0,void 0,(function*(){const{utils:{IN_MINI_APP:Z,IN_BROWSER:ee,IN_UNI_NATIVE_APP:ne,isArray:se},ssoLog:re}=this._core,ae=Date.now();let le="";return ee&&(le=yield this._generateHashFileNameInWeb(J)),Z&&(se(J.tempFiles)&&(J=J.tempFiles[0]),ne||(le=yield this._generateFileNameInMiniProgram(J)),ne&&(le=yield this._generateFileNameInUNINativeApp(J))),re.info("_generateHashFileName",`hashFileName:${le} costTime:${Date.now()-ae}`),le}))}_generateHashFileNameInWeb(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z,utils:{safeStringify:ee}}=this._core;let ne="";try{ne=yield new Promise(((ee,ne)=>{const se=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice;se||(Z.warn("_generateHashFileNameInWeb","Browser does not support file slicing"),ee(""));const re=10485760,ae=Math.ceil(J.size/re);let le=0;const pe=new yu.ArrayBuffer,_e=new FileReader,ve=setTimeout((()=>{_e.abort(),Z.warn("_generateHashFileNameInWeb","File hash generation timeout"),ee("")}),2e3);function d(){const Z=le*re,ee=Z+re>=J.size?J.size:Z+re;_e.readAsArrayBuffer(se.call(J,Z,ee))}_e.onload=J=>{Z.debug("_generateHashFileNameInWeb",`read chunk nr ${le+1} of ${ae}`),pe.append(J.target.result),le++,le<ae?d():(Z.debug("_generateHashFileNameInWeb","finished loading"),clearTimeout(ve),ee(pe.end()))},_e.onerror=J=>{clearTimeout(ve),ne(J)},d()}))}catch(J){Z.warn("_generateHashFileNameInWeb",ee(J))}return ne}))}_generateFileNameInMiniProgram(J){return ge(this,void 0,void 0,(function*(){const{utils:{MINI_APP_NAMESPACE:Z,safeStringify:ee,isEmpty:ne},ssoLog:se}=this._core;let re="";if(ne(J.url))return se.warn("_generateFileNameInMiniProgram","file.url is empty"),re;if("function"!=typeof(null==Z?void 0:Z.getFileSystemManager))return se.warn("_generateFileNameInUNINativeApp","getFileSystemManager is not a function"),re;try{re=yield new Promise(((ee,ne)=>{Z.getFileSystemManager().getFileInfo({filePath:J.url,success:J=>{ee(J.digest)},fail:J=>{ne(J)}})}))}catch(J){se.warn("_generateFileNameInMiniProgram",ee(J))}return re}))}_generateFileNameInUNINativeApp(J){return ge(this,void 0,void 0,(function*(){var Z;const{utils:{safeStringify:ee,isEmpty:ne},ssoLog:se}=this._core;let re="";if(ne(J.url))return se.warn("_generateFileNameInUNINativeApp","file.url is empty"),re;if("function"!=typeof(null===(Z=null===plus||void 0===plus?void 0:plus.io)||void 0===Z?void 0:Z.getFileInfo))return se.warn("_generateFileNameInUNINativeApp","plus.io.getFileInfo is not a function"),re;try{re=yield new Promise(((Z,ee)=>{plus.io.getFileInfo({filePath:J.url,success:J=>{Z(J.digest)},fail:J=>{ee(J)}})}))}catch(J){se.warn("_generateFileNameInMiniProgram",ee(J))}return re}))}_handleUploadProgress(J,Z){if("function"==typeof Z.onProgress)try{Z.onProgress(J.percent)}catch(J){throw console.warn("Upload progress callback error:",J),J}}_fetchCosSignatureUrl(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z,utils:{safeStringify:ee}}=this._core,ne=_u.isSimpleCos(),se=this._prepareCosRequestData(J),re=ne?"im_cos_msg.simple_sig":"im_cos_msg.pre_sig";try{const J=yield function(J,Z,ee){return ge(this,void 0,void 0,(function*(){try{const{helper:ne,channel:se}=ee,re=ne.generateCosSpecifiedData({servcmd:J,data:Z}),ae=`${re.head.seq}${J}`;return yield se.sendPacket(re,{requestId:ae})}catch(J){throw console.warn("getCosSig error:",J),J}}))}(re,se,this._core);this.fetchCosTryCount=0;const ae=this._processResponse(J);return Z.debug("_fetchCosSignatureUrl",` ok. isSimpleCos:${ne} data:${ee(ae)}`),ae||{}}catch(Z){if(this.fetchCosTryCount<1)return this.fetchCosTryCount++,this._fetchCosSignatureUrl(J);throw this.fetchCosTryCount=0,Z}}))}_processResponse(J){var Z;const ee=_u.isSimpleCos(),ne=ee?null===(Z=null==J?void 0:J.rpt_pre_sig)||void 0===Z?void 0:Z[0]:J;if(!ne)return{};if(ee){const{str_final_ip:J,rpt_pre_sig:Z,uint32_file_id:ee,uint32_exist_flag:se,str_download_url:re,str_upload_url:ae,str_snapshot_url:le,str_file_key:pe}=ne;return{uploadIP:J,preSig:Z,fileID:ee,existFlag:se,downloadUrl:re,uploadUrl:ae,requestSnapshotUrl:le,fileKey:pe}}const{upload_url:se,download_url:re,snapshot_url:ae,thumb_url:le,large_url:pe,file_key:_e}=ne;return{uploadUrl:se,downloadUrl:re,requestSnapshotUrl:ae,thumbUrl:le,largeUrl:pe,fileKey:_e}}_prepareCosRequestData(J){return _u.isSimpleCos()?{uint32_upload_method:J.uploadMethod,uint32_platform:_u.getPlatform(),uint32_sdkappid:_u.getSDKAppID(),str_user_id:J.userID,uint32_scene:J.conversationType,rpt_upload_object:[{uint32_file_id:1,uint32_file_type:J.fileType,str_file_name:J.fileName}]}:{file_type:J.fileType,file_name:J.fileName,upload_method:J.uploadMethod,Duration:J.duration}}_uploadFile(J){return ge(this,void 0,void 0,(function*(){return new Promise(((Z,ee)=>{this.httpRequest.request(J,((ne,se)=>{ne&&this.uploadFileTryCount<this.maxRetries&&this.shouldRetry(ne)?(this.uploadFileTryCount++,this._uploadFile(J).then(Z).catch(ee)):(this.uploadFileTryCount=0,ne?ee(ne):Z(se))}))}))}))}shouldRetry(J){return!!J&&(5===Math.floor(J.statusCode/100)||!(!this.isTimeRelatedError(J)||!this._isClockOutOfSync(J)||(this._syncSystemClock(J),0)))}isTimeRelatedError(J){var Z,ee;try{const ne=null===(Z=J.error)||void 0===Z?void 0:Z.Code,se=null===(ee=J.error)||void 0===ee?void 0:ee.Message;return"RequestTimeTooSkewed"===ne||"AccessDenied"===ne&&"Request has expired"===se}catch(J){return!1}}_isClockOutOfSync(J){var Z,ee,ne;const se=(null===(Z=J.headers)||void 0===Z?void 0:Z.date)||(null===(ee=J.headers)||void 0===ee?void 0:ee.Date)||(null===(ne=J.error)||void 0===ne?void 0:ne.ServerTime);if(!se)return!1;const re=Date.now(),ae=Date.parse(se);return Math.abs(re+this.systemClockOffset-ae)>=3e4}_syncSystemClock(J){var Z,ee,ne;const se=(null===(Z=J.headers)||void 0===Z?void 0:Z.date)||(null===(ee=J.headers)||void 0===ee?void 0:ee.Date)||(null===(ne=J.error)||void 0===ne?void 0:ne.ServerTime);if(se){const J=Date.now(),Z=Date.parse(se);this.systemClockOffset=Z-J}}_getRawOrUploadProxyUrl(J){const Z=_u.getFileUploadProxy();let ee=J;return Z&&(ee=J.replace(/^https:\/\/[^/]+/,Z)),ee}_isC2CConversation(J){return"C2C"===J.slice(0,3)}};const Su=["jpg","jpeg","gif","png","bmp","image","webp"],Eu={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255};class mr{constructor(J,Z){this.instanceID=Fi(9999999),this.sizeType=J.type||0,this.type=0,this.size=J.size||0,this.width=J.width||0,this.height=J.height||0,this.imageUrl=_u.addAuthToUrl(J.imageUrl||J.url||""),this.url=_u.addAuthToUrl(J.url||Z)}setSizeType(J){this.sizeType=J}setType(J){this.type=J}setImageUrl(J){J&&(this.imageUrl=_u.addAuthToUrl(J))}getImageUrl(){return this.imageUrl}}function vr(J){const{originUrl:Z,originWidth:ee,originHeight:ne,min:se=198}=J,re=parseInt(ee)||0,ae=parseInt(ne)||0,le={url:void 0,width:0,height:0};if((re<=ae?re:ae)<=se)le.url=Z,le.width=re,le.height=ae;else{ae<=re?(le.width=Math.ceil(re*se/ae),le.height=se):(le.width=se,le.height=Math.ceil(ae*se/re));const J=Z&&Z.indexOf("?")>-1?`${Z}&`:`${Z}?`;le.url=198===se?`${J}imageView2/3/w/198/h/198`:`${J}imageView2/3/w/720/h/720`}if(void 0===Z){const{url:J}=le;return he(le,["url"])}return le}class fr{constructor(J){this._imageMemoryURL="",this._percent=0,this.type=tu;const{uuid:Z,file:ee,imageFormat:ne,imageInfoArray:se=[],isCustomUpload:re=!1}=J;this._imageMemoryURL=this.createImageDataAsURL(ee),this.content={imageFormat:ne,uuid:Z,imageInfoArray:[]},this[pu]=re,this.initImageInfoArray(se),this.autoFixUrl()}static parseServerPushElement(J){const{MsgContent:Z}=J,{ImageFormat:ee,ImageInfoArray:ne,UUID:se}=Z,re=function(J){return J.map((J=>({size:J.Size,type:J.Type,width:J.Width,height:J.Height,url:J.URL})))}(ne);return new fr({imageFormat:ee,imageInfoArray:re,uuid:se})}createImageDataAsURL(J){let Z="";const{IN_MINI_APP:ee,IN_RN_APP:ne,IN_BROWSER:se}=_u.getPlatformFlags();return J?((ee||ne)&&(Z=J.url),se&&(Z=window.URL.createObjectURL(J)),Z):Z}initImageInfoArray(J=[]){const Z={type:0,size:0,width:0,height:0,url:""};for(let ee=0;ee<3;ee++){const ne=J[ee]||Object.assign({},Z),se=new mr(ne,this._imageMemoryURL);se.setSizeType(ee+1),se.setType(ee),this.addImageInfo(se)}this.updateAccessSideImageInfoArray()}autoFixUrl(){const J=["http","https"];this.content.imageInfoArray.forEach((Z=>{if(!Z.url||""===Z.imageUrl)return;const[ee,...ne]=Z.imageUrl.split("://"),se=ne.join("://");J.includes(ee)||Z.setImageUrl(`https://${se}`)}))}updatePercent(J){this._percent=Math.min(J,1)}updateImageFormat(J){this.content.imageFormat=Eu[J.toUpperCase()]||Eu.UNKNOWN}addImageInfo(J){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(J)}updateImageInfoArray(J){const Z=this.content.imageInfoArray.length;let ee;for(let ne=0;ne<Z;ne++)ee=this.content.imageInfoArray[ne],J[ne].size&&(ee.size=J[ne].size),J[ne].url&&ee.setImageUrl(J[ne].url),J[ne].width&&(ee.width=J[ne].width),J[ne].height&&(ee.height=J[ne].height)}updateAccessSideImageInfoArray(){const[J]=this.content.imageInfoArray;J&&0!==J.width&&0!==J.height&&(function(J){const Z=J[2];J[2]=J[1],J[1]=Z;for(let Z=0;Z<J.length;Z++)J[Z].setType(Z)}(this.content.imageInfoArray),Object.assign(this.content.imageInfoArray[2],vr({originWidth:J.width,originHeight:J.height,min:720})))}validateBeforeSend(){if(this[pu])return delete this[pu],{isValid:!0};const[J]=this.content.imageInfoArray,Z=!!J&&""!==J.imageUrl&&0!==J.size;return{isValid:Z,error:Z?null:{message:"content can not be empty"}}}transformToServerFormat(J){const{isMergerMessage:Z=!1}=J||{},ee=Z?this.payload:this.content,{uuid:ne,imageFormat:se,imageInfoArray:re}=ee;return{MsgType:this.type,MsgContent:{ImageFormat:se,ImageInfoArray:this.parseImageInfoArray(re),UUID:ne}}}parseImageInfoArray(J){return J.map((J=>({InstanceId:J.instanceID,Type:J.sizeType,MsgType:J.type,Size:J.size,Width:J.width,Height:J.height,URL:_u.removeAuthToUrl(J.imageUrl)})))}}const Cu=new class{init(J){this.core=J}},Mu={[au]:"i",[uu]:"a",[cu]:"v",[lu]:"f"};let bu=null,Tu=null;function Mr(J){var Z;const{store:ee,utils:{isNumber:ne,safeStringify:se},ssoLog:re}=Cu.core;try{const se=(null===(Z=ee.get("cloudConfig"))||void 0===Z?void 0:Z.upload_size_limit)||"";se!==Tu&&(Tu=se,bu=JSON.parse(se)||{});const re=null==bu?void 0:bu[Mu[J]];if(ne(re))return 1024*re*1024}catch(J){re.debug("getCloudControlUploadSizeLimit",se(J))}return null}var Au=new class{constructor(){this._messageOptionsMap=new Map}init(J){var Z;this._core=J;const{notificationCenter:ee,helper:ne,InnerEvent:se,message:re}=J;ne.registerApi({apiName:"createImageMessage",context:this}),ne.registerExperimentalAPI("createImageMessage",this,"createCustomUploadImageMessage"),null===(Z=null==re?void 0:re.messageFactory)||void 0===Z||Z.registerElementClass(tu,fr),ee.subscribeInnerEvent(se.DESTROY,this._dispose,this)}createImageMessage(J){var Z,ee,ne;try{const se=null===(Z=this._core.store.get("login"))||void 0===Z?void 0:Z.userId,re=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message.messageFactory)||void 0===ne?void 0:ne.createMessage(Object.assign(Object.assign({},J),{from:se})),ae=this._processImage(J);J.payload.file=ae;const le={imageFormat:Eu.UNKNOWN,uuid:_u.generateUUID(ae),file:ae,imageInfoArray:[]},pe=new fr(le);return re.setElement(pe),this._messageOptionsMap.set(re.clientSequence,J),re}catch(J){throw J}}createCustomUploadImageMessage(J){var Z,ee,ne,se;const{store:re,utils:{isEmpty:ae}}=this._core,le=null===(Z=re.get("login"))||void 0===Z?void 0:Z.userId,pe=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message.messageFactory)||void 0===ne?void 0:ne.createMessage(Object.assign(Object.assign({},J),{from:le})),{largeImageUuid:_e,largeFileSize:ve,largeImageWidth:ye,largeImageHeight:Fe,largeImageUrl:qe,originImageUuid:$e,originFileSize:He,originImageWidth:Ye,originImageHeight:Je,originImageUrl:Xe,thumbImageUuid:Qe,thumbFileSize:tt,thumbImageWidth:nt,thumbImageHeight:it,thumbImageUrl:ot}=(null===(se=null==J?void 0:J.payload)||void 0===se?void 0:se.file)||{};if(ae(Xe)||ae($e))throw new Error("createImageMessageExperimental originImageUrl or originImageUuid is empty");const pt=new fr({imageFormat:Eu.UNKNOWN,uuid:$e,imageInfoArray:[{instanceID:$e,size:He,width:Ye,height:Je,imageUrl:Xe,url:Xe},{instanceID:_e,size:ve,width:ye,height:Fe,imageUrl:qe,url:qe},{instanceID:Qe,size:tt,width:nt,height:it,imageUrl:ot,url:ot}],isCustomUpload:!0});return pe.setElement(pt),this._messageOptionsMap.set(pe.clientSequence,J),pe._skipUpload=!0,pe}upload(J){return ge(this,void 0,void 0,(function*(){const Z=J.getElements()[0],{file:ee}=this._messageOptionsMap.get(J.clientSequence).payload;this._validateBeforeUploadImage(ee);const ne=yield this._performImageUpload(Z,J,ee),se=this._generateImageInfo(ne);return Z.updateImageFormat(null==ne?void 0:ne.fileType),Z.updateImageInfoArray(se),this._updateImageType(Z.content.imageInfoArray),J}))}_performImageUpload(J,Z,ee){return ge(this,void 0,void 0,(function*(){const{to:ne}=Z,se={uploadFileType:1,file:ee,to:ne,message:Z,onProgress:ee=>{var ne,se;J.updatePercent(ee),null===(se=null===(ne=this._messageOptionsMap.get(Z.clientSequence))||void 0===ne?void 0:ne.onProgress)||void 0===se||se.call(ne,ee)}},{uploadOptions:re,response:ae}=yield Iu.uploadToCOS(se);return this._parseResponse(re,ae)}))}_generateImageInfo(J){const{location:Z,fileSize:ee,width:ne,height:se,smallImageUrl:re,smallImageWidth:ae,smallImageHeight:le,largeImageUrl:pe,largeImageWidth:_e,largeImageHeight:ve,imageInfoArray:ye}=J,Fe=_u.addAuthToUrl(Z),qe={size:ee,url:Fe,width:ne,height:se};return(null==ye?void 0:ye.length)>0?this._processImageInfoArray(ye,ee):re&&pe?[Object.assign({},qe),{largeImageUrl:pe,largeImageWidth:_e,largeImageHeight:ve},{smallImageUrl:re,smallImageWidth:ae,smallImageHeight:le}]:[Object.assign({},qe),this._generateThumbInfo(Fe,ne,se,720),this._generateThumbInfo(Fe,ne,se,198)]}_generateThumbInfo(J,Z,ee,ne){return vr({originUrl:J,originWidth:Z,originHeight:ee,min:ne})}_processImageInfoArray(J,Z){let ee,ne,se;for(const re of J)1===re.type?(ne=re,ne.size=Z):2===re.type?(se=re,se.size=Z):(ee=re,ee.size=Z);return[Object.assign({},ee),Object.assign({},se),Object.assign({},ne)]}_parseResponse(J,Z){return ge(this,void 0,void 0,(function*(){try{const{thumbUrl:ee,largeUrl:ne,downloadUrl:se}=J;if(ee&&ne&&(yield this._getImageInfoByUrl(ee,Z,"thumb"),yield this._getImageInfoByUrl(ne,Z,"large")),_u.isSimpleCos()&&!_u.isPrivateNetWork()&&(yield this._getImageInfoArray(se,Z),null==Z?void 0:Z.uploadIP)){const J=this._extractDomainFromUrl(se);J&&(yield this._getDownloadIP(J,Z))}return Z}catch(J){throw J}}))}_extractDomainFromUrl(J){var Z;try{const Z=J.match(/:\/\/([^\/]+)/);return Z?Z[1]:null}catch(J){return null===(Z=this._core)||void 0===Z||Z.ssoLog.warn("_extractDomainFromUrl",`Failed to extract domain from URL:${J.message}`),null}}_getImageInfoByUrl(J,Z,ee){return ge(this,void 0,void 0,(function*(){var ne;try{const ne=_u.addAuthToUrl(J),{width:se=0,height:re=0}=yield _u.probeImageWidthHeight(ne);Z.width=se,Z.height=re,"thumb"===ee?(Z.smallImageUrl=J,Z.smallImageWidth=se,Z.smallImageHeight=re):(Z.largeImageUrl=J,Z.largeImageWidth=se,Z.largeImageHeight=re)}catch(J){null===(ne=this._core)||void 0===ne||ne.ssoLog.warn("_getImageInfoByUrl",`Failed to get ${ee} image info:${J.message}`)}}))}_validateBeforeUploadImage(J){var Z;const{ChatError:ee}=null===(Z=this._core)||void 0===Z?void 0:Z.helper;if(!J)throw new ee({code:2251});this._checkImageType(J),this._checkImageSize(J)}_processImage(J){var Z;try{const{IN_MINI_APP:ee}=null===(Z=this._core)||void 0===Z?void 0:Z.utils;let{file:ne}=J.payload;return ne=ee?this._processMiniAppImageFile(ne):this._processWebImageFile(ne),ne}catch(J){throw J}}_processMiniAppImageFile(J){ki(J)&&console.warn("FileUnsupportedInMiniApp","createImageMessage");const Z=J.tempFiles[0].path||J.tempFiles[0].tempFilePath;return{url:Z,name:Z.slice(Z.lastIndexOf("/")+1),size:J.tempFiles&&J.tempFiles[0].size||1,type:Z.slice(Z.lastIndexOf(".")+1).toLowerCase()}}_processWebImageFile(J){var Z;const{ChatError:ee}=null===(Z=this._core)||void 0===Z?void 0:Z.helper,ne=_u.extractFileFromInput(J);if(!ne)throw new ee({message:"Invalid file. Pass either `e.target` (from file input) or a File object"});return ne}_getDownloadIP(J,Z){return ge(this,void 0,void 0,(function*(){const ee=`${ru} getDownloadIP domainName: ${J}`;try{const ne=yield function(J,Z){return ge(this,void 0,void 0,(function*(){try{const{helper:ee,channel:ne}=Z,se="im_cos_msg.get_final_ip",re={str_domain:J},ae=ee.generateProtocolData({servcmd:se,data:re}),le=`${ae.head.seq}${se}`;return yield ne.sendPacket(ae,{requestId:le})}catch(J){throw console.warn("getFinalIP error:",J),J}}))}(J,this._core);if(!ne||!ne.str_final_ip)return;console.log(`${ee} ok. downloadIP:${ne}`);const se=Z.location.split("/");se[0]=ne.str_final_ip,Z.location=se.join("/")}catch(J){console.warn(J)}}))}_getImageInfoArray(J,Z){return ge(this,void 0,void 0,(function*(){try{const ee=yield function(J,Z){return ge(this,void 0,void 0,(function*(){try{const{helper:ee,channel:ne}=Z,se="im_cos_msg.get_imageinfo",re={str_image_url:J},ae=ee.generateProtocolData({servcmd:se,data:re}),le=`${ae.head.seq}${se}`;return yield ne.sendPacket(ae,{requestId:le})}catch(J){throw console.warn("getImageInfo error:",J),J}}))}(J,this._core);return Z.imageInfoArray=this._processImageInfoResponse(ee),Z}catch(J){throw Z.imageInfoArray=void 0,J}}))}_processImageInfoResponse(J){if(!J)return[];const{rpt_msg_image_info:Z}=J;return Z.map((J=>({type:J.uint32_image_type,url:J.str_url,width:J.uint32_width,height:J.uint32_height,imageFormat:J.str_image_format})))}_checkImageType(J){const{utils:Z,helper:ee}=this._core;let ne="";if(Z.IN_MINI_APP&&(ne=J.url.slice(J.url.lastIndexOf(".")+1)),Z.IN_BROWSER&&(ne=J.name.slice(J.name.lastIndexOf(".")+1)),Su.indexOf(ne.toLowerCase())<0)throw new ee.ChatError({code:2252})}_checkImageSize(J){const{utils:Z,helper:ee,store:ne}=this._core;let se=0;if(Z.IN_MINI_APP,se=J.size,0===se)throw new ee.ChatError({code:2108});if(se>=(Mr(1)||20971520))throw new ee.ChatError({code:2253})}_updateImageType(J){J[1].type=2,J[2].type=1}_reset(){this._messageOptionsMap.clear()}_dispose(){this._reset();const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this)}};const Ou="2.5.0",wu="1.18.0";function br(J,Z){const ee=J.split("."),ne=Z.split("."),se=Math.max(ee.length,ne.length);for(;ee.length<se;)ee.push("0");for(;ne.length<se;)ne.push("0");for(let J=0;J<se;J++){const Z=parseInt(ee[J]),se=parseInt(ne[J]);if(Z>se)return 1;if(Z<se)return-1}return 0}var Ru;class Lr{constructor(J){this.type=su,this.uploadProgress=0,this[Ru]=!1;const Z=this._getFileInfo(J);this[pu]=J.isCustomUpload||!1,this.content={downloadFlag:2,fileUrl:_u.generateURL(J.url||J.fileUrl,{needAddAuthToUrl:!this[pu]})||"",uuid:J.uuid,fileName:Z.name||"",fileSize:Z.size||0}}static parseServerPushElement(J){const{MsgContent:Z}=J,{Download_Flag:ee,Url:ne,FileName:se,FileSize:re,UUID:ae}=Z;return new Lr({downloadFlag:ee,url:ne,fileName:se,fileSize:re,uuid:ae})}updatePercent(J){this.uploadProgress=Math.min(J,1)}updateFileUrl(J){this.content.fileUrl=J}validateBeforeSend(){if(this[pu])return{isValid:!0};const J=""!==this.content.fileUrl&&""!==this.content.fileName&&this.content.fileSize>0;return{isValid:J,error:J?null:{message:"content can not be empty"}}}transformToServerFormat(J){const{isMergerMessage:Z=!1}=J||{},ee=Z?this.payload:this.content,{uuid:ne,downloadFlag:se,fileUrl:re,fileName:ae,fileSize:le}=ee;return{MsgType:this.type,MsgContent:{Download_Flag:se,Url:_u.removeAuthToUrl(re),FileName:ae,FileSize:le,UUID:ne}}}_getFileInfo(J){const{utils:{IN_UNI_NATIVE_APP:Z}}=Cu.core;if(J.fileName&&J.fileSize)return{size:J.fileSize,name:J.fileName};const{file:ee}=J;return ee?(Z&&this._processNativeAppFile(ee),{size:ee.size,name:ee.name}):{size:0,name:""}}_processNativeAppFile(J){if(J.path&&J.path.includes(".")){const Z=J.path.slice(J.path.lastIndexOf(".")+1).toLowerCase();J.type=Z,J.name||(J.name=`${Fi(999999)}.${Z}`)}J.name||(J.type="",J.name=J.path.slice(J.path.lastIndexOf("/")+1).toLowerCase()),J.suffix&&(J.type=J.suffix),J.url||(J.url=J.path)}}Ru=pu;var Du=new class{constructor(){this._messageOptionsMap=new Map}init(J){var Z;this._core=J;const{notificationCenter:ee,helper:ne,InnerEvent:se,message:re}=J;ne.registerApi({apiName:"createFileMessage",context:this}),ne.registerExperimentalAPI("createFileMessage",this,"createCustomUploadFileMessage"),null===(Z=null==re?void 0:re.messageFactory)||void 0===Z||Z.registerElementClass(su,Lr),ee.subscribeInnerEvent(se.DESTROY,this._dispose,this)}createFileMessage(J){var Z,ee,ne;try{this._checkVersion();const se=this._processFile(J.payload.file);J.payload.file=se;const re=null===(Z=this._core.store.get("login"))||void 0===Z?void 0:Z.userId,ae=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message.messageFactory)||void 0===ne?void 0:ne.createMessage(Object.assign(Object.assign({},J),{from:re})),le={uuid:_u.generateUUID(se),file:se},pe=new Lr(le);return ae.setElement(pe),this._messageOptionsMap.set(ae.clientSequence,J),ae}catch(J){throw J}}createCustomUploadFileMessage(J){var Z,ee,ne;try{const{store:se,message:re,utils:{isEmpty:ae}}=this._core,le=null===(Z=se.get("login"))||void 0===Z?void 0:Z.userId,{url:pe,uuid:_e,fileSize:ve,fileName:ye=""}=(null===(ee=null==J?void 0:J.payload)||void 0===ee?void 0:ee.file)||{};if(ae(pe))throw new Error("url is required");const Fe=null===(ne=re.messageFactory)||void 0===ne?void 0:ne.createMessage(Object.assign(Object.assign({},J),{from:le})),qe=new Lr({url:pe,uuid:_e,file:{size:ve,name:ye},isCustomUpload:!0});return Fe.setElement(qe),Fe}catch(J){throw J}}upload(J){return ge(this,void 0,void 0,(function*(){const{file:Z}=this._messageOptionsMap.get(J.clientSequence).payload;this._validateBeforeUploadFile(Z);const ee=J.getElements()[0],ne=yield this._performFileUpload(ee,J,Z),se=_u.addAuthToUrl(null==ne?void 0:ne.location);return ee.updateFileUrl(se),J}))}_validateBeforeUploadFile(J){const{helper:{ChatError:Z}}=this._core;if(!J)throw new Z({code:2401});const ee=Mr(255)||104857600;if(J.size>ee)throw new Z({code:2402});if(0===J.size)throw new Z({code:2108})}_performFileUpload(J,Z,ee){return ge(this,void 0,void 0,(function*(){const{to:ne}=Z,se={uploadFileType:255,file:ee,to:ne,message:Z,onProgress:ee=>{var ne,se;J.updatePercent(ee),null===(se=null===(ne=this._messageOptionsMap.get(Z.clientSequence))||void 0===ne?void 0:ne.onProgress)||void 0===se||se.call(ne,ee)}},{response:re}=yield Iu.uploadToCOS(se);return re}))}_processFile(J){var Z,ee;const{IN_BROWSER:ne,IN_RN_APP:se,IN_WX_MINI_APP:re,IN_QQ_MINI_APP:ae,IN_UNI_NATIVE_APP:le}=null===(Z=this._core)||void 0===Z?void 0:Z.utils,{ChatError:pe}=null===(ee=this._core)||void 0===ee?void 0:ee.helper;if(ne||le){const Z=_u.extractFileFromInput(J);if(!Z)throw new pe({message:"Invalid file. Pass either `e.target` (from file input) or a File object"});return Z}if(re||ae){const{tempFiles:Z}=J;return Object.assign(Object.assign({},Z[0]),{url:Z[0].path})}return se?Object.assign(Object.assign({},J),{url:J.uri}):J}_checkVersion(){var J,Z;const{MINI_APP_NAMESPACE:ee,IN_MINI_APP:ne,IN_WX_MINI_APP:se,IN_QQ_MINI_APP:re,IN_UNI_NATIVE_APP:ae}=null===(J=this._core)||void 0===J?void 0:J.utils,{ChatError:le}=null===(Z=this._core)||void 0===Z?void 0:Z.helper;if(ne){if(!(se||re||ae))throw new le({message:"Unsupported mini app environment"});const J=ee.getSystemInfoSync().SDKVersion;if(se&&br(J,Ou)<0)throw new le({message:`WXChooseMessageFile requires SDK version ${Ou} or higher`});if(re&&br(J,wu)<0)throw new le({message:`QQChooseMessageFile requires SDK version ${wu} or higher`})}}_reset(){this._messageOptionsMap.clear()}_dispose(){this._reset();const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this)}};const Nu=["mp4","quicktime","mov","video"];var Lu;class $r{constructor(J){this.type=iu,this.uploadProgress=0,this[Lu]=!1;const Z="number"==typeof(null==J?void 0:J.videoSecond)?null==J?void 0:J.videoSecond:0;this[pu]=J.isCustomUpload||!1,this.content={remoteVideoUrl:_u.addAuthToUrl(J.remoteVideoUrl||J.videoUrl||""),videoFormat:J.videoFormat,videoSecond:parseInt(null==Z?void 0:Z.toString(),10),videoSize:J.videoSize,videoUrl:_u.addAuthToUrl(J.videoUrl),videoDownloadFlag:2,videoUUID:J.videoUUID,thumbUUID:J.thumbUUID,thumbFormat:J.thumbFormat,thumbWidth:J.thumbWidth,snapshotWidth:J.thumbWidth,thumbHeight:J.thumbHeight,snapshotHeight:J.thumbHeight,thumbSize:J.thumbSize,snapshotSize:J.thumbSize,thumbDownloadFlag:2,thumbUrl:_u.addAuthToUrl(J.thumbUrl),snapshotUrl:_u.addAuthToUrl(J.thumbUrl)}}static parseServerPushElement(J){const{MsgContent:Z}=J,{VideoUrl:ee,VideoFormat:ne,VideoSecond:se,VideoSize:re,VideoDownloadFlag:ae,VideoUUID:le,ThumbUUID:pe,ThumbFormat:_e,ThumbWidth:ve,SnapshotWidth:ye,ThumbHeight:Fe,SnapshotHeight:qe,ThumbSize:$e,SnapshotSize:He,ThumbDownloadFlag:Ye,ThumbUrl:Je,SnapshotUrl:Xe}=Z;return new $r({videoUrl:ee,videoFormat:ne,videoSecond:se,videoSize:re,videoDownloadFlag:ae,videoUUID:le,thumbUUID:pe,thumbFormat:_e,thumbWidth:ve,snapshotWidth:ye,thumbHeight:Fe,snapshotHeight:qe,thumbSize:$e,snapshotSize:He,thumbDownloadFlag:Ye,thumbUrl:Je,snapshotUrl:Xe})}updatePercent(J){this.uploadProgress=Math.min(J,1)}updateVideoUrl(J){J&&(this.content.remoteVideoUrl=J)}updateSnapshotInfo(J){const{snapshotUrl:Z,snapshotWidth:ee,snapshotHeight:ne}=J;_u.isEmpty(Z)||(this.content.thumbUrl=this.content.snapshotUrl=Z),_u.isEmpty(ee)||(this.content.thumbWidth=this.content.snapshotWidth=Number(ee)),_u.isEmpty(ne)||(this.content.thumbHeight=this.content.snapshotHeight=Number(ne))}validateBeforeSend(){if(this[pu])return{isValid:!0};const J=""!==this.content.remoteVideoUrl;return{isValid:J,error:J?null:{message:"content can not be empty"}}}transformToServerFormat(J){const{isMergerMessage:Z=!1}=J||{},ee=Z?this.payload:this.content,{remoteVideoUrl:ne,videoFormat:se,videoSecond:re,videoSize:ae,videoDownloadFlag:le,videoUUID:pe,thumbUUID:_e,thumbFormat:ve,thumbWidth:ye,snapshotWidth:Fe,thumbHeight:qe,snapshotHeight:$e,thumbSize:He,snapshotSize:Ye,thumbDownloadFlag:Je,thumbUrl:Xe,snapshotUrl:Qe}=ee;return{MsgType:this.type,MsgContent:{VideoUrl:_u.removeAuthToUrl(ne),VideoFormat:se,VideoSecond:re,VideoSize:ae,VideoDownloadFlag:le,VideoUUID:pe,ThumbUUID:_e,ThumbFormat:ve,ThumbWidth:ye,SnapshotWidth:Fe,ThumbHeight:qe,SnapshotHeight:$e,ThumbSize:He,SnapshotSize:Ye,ThumbDownloadFlag:Je,ThumbUrl:_u.removeAuthToUrl(Xe),SnapshotUrl:_u.removeAuthToUrl(Qe)}}}}Lu=pu;var Pu,Gu=new class{constructor(){this._messageOptionsMap=new Map}init(J){var Z;this._core=J;const{notificationCenter:ee,helper:ne,InnerEvent:se,message:re}=J;ne.registerApi({apiName:"createVideoMessage",context:this}),ne.registerExperimentalAPI("createVideoMessage",this,"createCustomUploadVideoMessage"),null===(Z=null==re?void 0:re.messageFactory)||void 0===Z||Z.registerElementClass(iu,$r),ee.subscribeInnerEvent(se.DESTROY,this._dispose,this)}createVideoMessage(J){var Z,ee,ne;try{const se=this._processVideo(J);J.payload.file=se;const re=null===(Z=this._core.store.get("login"))||void 0===Z?void 0:Z.userId,ae=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message.messageFactory)||void 0===ne?void 0:ne.createMessage(Object.assign(Object.assign({},J),{from:re})),le={videoFormat:se.videoFile.type,videoSecond:qi(se.videoFile.second,0),videoSize:se.videoFile.size,remoteVideoUrl:"",videoUrl:se.videoFile.url,videoUUID:_u.generateUUID(se.videoFile),thumbUUID:_u.generateUUID(se.videoFile,"jpg"),thumbWidth:se.width||200,thumbHeight:se.height||200,thumbUrl:se.thumbUrl,thumbSize:se.thumbSize,thumbFormat:"jpg"},pe=new $r(le);return ae.setElement(pe),this._messageOptionsMap.set(ae.clientSequence,J),ae}catch(J){throw J}}createCustomUploadVideoMessage(J){var Z,ee,ne;try{const{store:se,message:re}=this._core;this._validateCustomUploadVideoMessage(J);const ae=null===(Z=se.get("login"))||void 0===Z?void 0:Z.userId,{videoUrl:le,videoUuid:pe,duration:_e,snapshotUrl:ve,snapshotUuid:ye,videoFileSize:Fe,videoType:qe,snapshotWidth:$e,snapshotHeight:He,snapshotFileSize:Ye,snapshotType:Je="jpg"}=(null===(ee=null==J?void 0:J.payload)||void 0===ee?void 0:ee.file)||{},Xe=null===(ne=re.messageFactory)||void 0===ne?void 0:ne.createMessage(Object.assign(Object.assign({},J),{from:ae})),Qe=new $r({videoFormat:qe,videoSecond:_e||0,videoSize:Fe,remoteVideoUrl:le,videoUrl:le,videoUUID:pe,thumbUUID:ye,thumbWidth:$e||200,thumbHeight:He||200,thumbUrl:ve,thumbSize:Ye,thumbFormat:Je,isCustomUpload:!0});return Xe.setElement(Qe),this._messageOptionsMap.set(Xe.clientSequence,J),Xe}catch(J){throw J}}upload(J){return ge(this,void 0,void 0,(function*(){const Z=J.getElements()[0],{file:ee}=this._messageOptionsMap.get(J.clientSequence).payload;this._validateBeforeUploadVideo(ee);const ne=yield this._performVideoUpload(Z,J,ee),{location:se,snapshotInfo:re}=ne,ae=_u.addAuthToUrl(se);return Z.updateVideoUrl(ae),_u.isEmpty(re)||Z.updateSnapshotInfo(re),J}))}_validateBeforeUploadVideo(J){const{helper:{ChatError:Z}}=this._core,ee=Mr(2)||104857600;if(J.videoFile.size>ee)throw new Z({code:2351});if(0===J.videoFile.size)throw new Z({code:2108});if(-1===Nu.indexOf(J.videoFile.type))throw new Z({code:2352})}_validateCustomUploadVideoMessage(J){var Z;const{utils:{isEmpty:ee,isNumber:ne}}=this._core,{videoUrl:se,videoUuid:re,duration:ae,snapshotUrl:le,snapshotUuid:pe}=(null===(Z=null==J?void 0:J.payload)||void 0===Z?void 0:Z.file)||{};if(ee(se)||ee(re)||!ne(ae)||ee(le)||ee(pe))throw new Error("Invalid video message options: missing required fields (videoUrl, videoUuid, duration, snapshotUrl, snapshotUuid)")}_performVideoUpload(J,Z,ee){return ge(this,void 0,void 0,(function*(){const{to:ne}=Z,se={uploadFileType:2,file:ee,to:ne,message:Z,onProgress:ee=>{var ne,se;J.updatePercent(ee),null===(se=null===(ne=this._messageOptionsMap.get(Z.clientSequence))||void 0===ne?void 0:ne.onProgress)||void 0===se||se.call(ne,ee)}},{response:re,uploadOptions:ae}=yield Iu.uploadToCOS(se);return{snapshotInfo:yield this._getSnapshotInfoByUrl(ae.requestSnapshotUrl),location:re.location}}))}_processVideo(J){var Z,ee;try{const{ChatError:ne}=null===(Z=this._core)||void 0===Z?void 0:Z.helper,{IN_MINI_APP:se,IN_BROWSER:re}=null===(ee=this._core)||void 0===ee?void 0:ee.utils;let{file:ae}=J.payload,le={};if(se&&(le=this._processMiniVideoFile(ae),ae.name=le.name,ae.url=le.url,ae.type=le.type),re){const J=_u.extractFileFromInput(ae);if(!J)throw new ne({message:"Invalid file. Pass either `e.target` (from file input) or a File object"});ae=J,le=this._processWebVideoFile(ae)}return ae.videoFile=le,ae.thumbUrl="",ae.thumbSize=0,ae}catch(J){throw console.warn(`${ru} _processFile error:`,J),J}}_processMiniVideoFile(J){const{utils:{IN_UNI_NATIVE_APP:Z},helper:{ChatError:ee}}=this._core;if(ki(J))throw new ee({message:"FileUnsupportedInMiniApp"});Array.isArray(J.tempFiles)&&(J=J.tempFiles[0]);let ne=J.tempFilePath.slice(J.tempFilePath.lastIndexOf(".")+1).toLowerCase();return Z&&(ne=J.fileType||ne),{url:J.tempFilePath,name:J.tempFilePath.slice(J.tempFilePath.lastIndexOf("/")+1),size:J.size||1,second:J.duration||0,type:ne}}_processWebVideoFile(J){const{name:Z,size:ee=1,duration:ne=0,type:se}=J,re=se.split("/")[1];return{url:window.URL.createObjectURL(J),name:Z,size:ee,second:ne,type:re}}_getSnapshotInfoByUrl(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z}=this._core;try{Z.debug("_getSnapshotInfoByUrl",`${ru} _getSnapshotInfoByUrl url:${J}`);const ee={version:1,platform:_u.getPlatform(),cover_name:xi(Fi(99999)),snapshot_url:J},ne=yield function(J,Z){return ge(this,void 0,void 0,(function*(){try{const ee="im_cos_msg.video_cover",{helper:ne,channel:se}=Z,re=ne.generateCosSpecifiedData({servcmd:ee,data:J}),ae=`${re.head.seq}${ee}`;return yield se.sendPacket(re,{requestId:ae})}catch(J){throw console.warn("getSnapshotInfo error:",J),J}}))}(ee,this._core),{download_url:se}=ne||{};if(Z.debug("_getSnapshotInfoByUrl",`${ru} _getSnapshotInfoByUrl OK snapshotUrl:${se}`),_u.isEmpty(se))return{};const re=_u.addAuthToUrl(se),{width:ae=0,height:le=0}=yield _u.probeImageWidthHeight(re);return{snapshotUrl:re,snapshotWidth:ae,snapshotHeight:le}}catch(J){throw J}}))}_reset(){this._messageOptionsMap.clear()}_dispose(){this._reset();const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this)}};class Vr{constructor(J){this.uploadProgress=0,this.type=nu,this[Pu]=!1,this[pu]=J.isCustomUpload||!1,this.content={downloadFlag:2,second:J.second,size:J.size,url:_u.generateURL(J.url,{needAddAuthToUrl:!this[pu]}),remoteAudioUrl:_u.addAuthToUrl(J.url||""),uuid:J.uuid}}static parseServerPushElement(J){const{MsgContent:Z}=J,{Url:ee,Download_Flag:ne,Second:se,Size:re,UUID:ae}=Z;return new Vr({url:ee,downloadFlag:ne,second:se,size:re,uuid:ae})}updatePercent(J){this.uploadProgress=Math.min(J,1)}updateAudioUrl(J){this.content.remoteAudioUrl=J}validateBeforeSend(){if(this[pu])return{isValid:!0};const J=""!==this.content.remoteAudioUrl;return{isValid:J,error:J?null:{message:"content can not be empty"}}}transformToServerFormat(J){const{isMergerMessage:Z=!1}=J||{},ee=Z?this.payload:this.content,{uuid:ne,downloadFlag:se,remoteAudioUrl:re,size:ae,second:le}=ee;return{MsgType:this.type,MsgContent:{Url:_u.removeAuthToUrl(re),Download_Flag:se,Second:le,Size:ae,UUID:ne}}}}Pu=pu;var Bu=new class{constructor(){this._messageOptionsMap=new Map}init(J){var Z;this._core=J;const{notificationCenter:ee,helper:ne,InnerEvent:se,message:re}=J;ne.registerApi({apiName:"createAudioMessage",context:this}),ne.registerExperimentalAPI("createAudioMessage",this,"createCustomUploadAudioMessage"),null===(Z=null==re?void 0:re.messageFactory)||void 0===Z||Z.registerElementClass(nu,Vr),ee.subscribeInnerEvent(se.DESTROY,this._dispose,this)}createAudioMessage(J){var Z,ee,ne;try{let{file:se}=J.payload;se=this._processAudioFile(J.payload.file),J.payload.file=se;const re=null===(Z=this._core.store.get("login"))||void 0===Z?void 0:Z.userId,ae=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message.messageFactory)||void 0===ne?void 0:ne.createMessage(Object.assign(Object.assign({},J),{from:re})),le={second:Math.max(1,Math.round((se.duration||se.second)/1e3)),size:se.fileSize||se.size||1,url:se.tempFilePath||se.uri||se.url,uuid:_u.generateUUID(se)},pe=new Vr(le);return ae.setElement(pe),this._messageOptionsMap.set(ae.clientSequence,J),ae}catch(J){throw J}}createCustomUploadAudioMessage(J){var Z,ee,ne;try{this._validateCustomUploadOptions(J);const{store:se,message:re}=this._core,ae=null===(Z=se.get("login"))||void 0===Z?void 0:Z.userId,{url:le,uuid:pe,duration:_e,fileSize:ve}=(null===(ee=null==J?void 0:J.payload)||void 0===ee?void 0:ee.file)||{},ye=null===(ne=re.messageFactory)||void 0===ne?void 0:ne.createMessage(Object.assign(Object.assign({},J),{from:ae})),Fe=new Vr({second:_e,size:ve||1,url:le,uuid:pe,isCustomUpload:!0});return ye.setElement(Fe),this._messageOptionsMap.set(ye.clientSequence,J),ye}catch(J){throw J}}upload(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z,utils:{safeStringify:ee}}=this._core;Z.debug("upload",`${ru} uploadAudio message:${ee(J)}`);const{file:ne}=this._messageOptionsMap.get(J.clientSequence).payload;this._validateBeforeUploadAudio(ne);const se=J.getElements()[0],re=yield this._performAudioUpload(se,J,ne),ae=_u.addAuthToUrl(null==re?void 0:re.location);return se.updateAudioUrl(ae),J}))}_validateBeforeUploadAudio(J){const{helper:{ChatError:Z},store:ee}=this._core;if(!J)throw new Z({code:2300});const ne=Mr(3)||20971520;if(J.size>ne)throw new Z({code:2301});if(0===J.size)throw new Z({code:2108})}_performAudioUpload(J,Z,ee){return ge(this,void 0,void 0,(function*(){const{to:ne}=Z,se={uploadFileType:3,file:ee,to:ne,message:Z,onProgress:ee=>{var ne,se;J.updatePercent(ee),null===(se=null===(ne=this._messageOptionsMap.get(Z.clientSequence))||void 0===ne?void 0:ne.onProgress)||void 0===se||se.call(ne,ee)}},{response:re}=yield Iu.uploadToCOS(se);return re}))}_processAudioFile(J){var Z;const{IN_MINI_APP:ee,IN_BROWSER:ne}=null===(Z=this._core)||void 0===Z?void 0:Z.utils;return ee?this._processMiniFile(J):ne?this._processWebFile(J):void 0}_processMiniFile(J){return{url:J.tempFilePath,name:J.tempFilePath.slice(J.tempFilePath.lastIndexOf("/")+1),size:J.fileSize,second:J.duration,type:J.tempFilePath.slice(J.tempFilePath.lastIndexOf(".")+1).toLowerCase()}}_processWebFile(J){if(J.tempFilePath||J.uri)return J;const Z=URL.createObjectURL(J);return J.tempFilePath=Z,J}_validateCustomUploadOptions(J){var Z;const{utils:{isEmpty:ee}}=this._core,{url:ne,uuid:se,duration:re}=(null===(Z=null==J?void 0:J.payload)||void 0===Z?void 0:Z.file)||{};if(ee(ne)||ee(se)||ee(re))throw new Error("Invalid audio message options")}_reset(){this._messageOptionsMap.clear()}_dispose(){this._reset();const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this)}};const qu={to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1},payload:{required:!0,rules:["object"],allowEmpty:!1},cloudCustomData:{required:!1,rules:["string"],allowEmpty:!1},priority:{required:!1,rules:["string"],allowEmpty:!1},customModerationConfigurationID:{required:!1,rules:["string"],allowEmpty:!1},onProgress:{required:!1,rules:["function"],allowEmpty:!1}},ju={createImageMessage:qu,createAudioMessage:qu,createVideoMessage:qu,createFileMessage:qu},Hu={createImageMessage:!0,createAudioMessage:!0,createVideoMessage:!0,createFileMessage:!0},Ku={[tu]:Au,[su]:Du,[iu]:Gu,[nu]:Bu};var Wu=new class{constructor(){this.name="RichMediaMessage"}install(J){this._core=J;const{constants:{OuterConstant:{MSG_AUDIO:Z,MSG_FILE:ee,MSG_IMAGE:ne,MSG_VIDEO:se}}}=J;Cu.init(J),Au.init(J),Du.init(J),Gu.init(J),Bu.init(J),Iu.init(J),_u.init(J),J.helper.registerApi({apiName:"sendMessage",context:this,matcher:J=>[Z,ee,ne,se].includes(J[0].type)}),J.helper.registerValidateConfig({auth:Hu,params:ju})}sendMessage(J,Z){return ge(this,void 0,void 0,(function*(){var ee,ne,se;try{return this._isCustomUpload(J)||(yield this._upload(J)),yield null===(se=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message)||void 0===ne?void 0:ne.messageSender)||void 0===se?void 0:se.sendMessage(J,Z)}catch(J){throw J}}))}_upload(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z,utils:{safeStringify:ee}}=this._core;if(Z.debug("_upload",` uploadFile message:${ee(J)}`),!0!==J._relayFlag)try{const ee=Ku[J.type];ee&&(yield ee.upload(J),Z.info("_upload",` type:${J.type}`))}catch(Z){throw J.status=hu.FAIL,Z instanceof Error&&(Z.data={message:J}),this._core.message.messageDataHandler.storeConversationMessage(J),Z}}))}_isCustomUpload(J){var Z,ee;return!0===(null===(ee=null===(Z=J._elements)||void 0===Z?void 0:Z[0])||void 0===ee?void 0:ee[pu])}};const Yu=new class{init(J){this.core=J}},Zr=J=>{const{core:{OuterConstant:Z,utils:{isString:ee}}}=Yu;return ee(J)&&J.slice(0,3)===Z.CONV_C2C},ea=J=>{const{core:{OuterConstant:Z,utils:{isString:ee}}}=Yu;return ee(J)&&J.slice(0,5)===Z.CONV_GROUP},ta=J=>{const{core:{OuterConstant:Z,utils:{isString:ee}}}=Yu;return ee(J)&&J===Z.CONV_SYSTEM},sa=J=>({lastTime:(null==J?void 0:J.time)||(null==J?void 0:J.lastTime)||0,lastSequence:(null==J?void 0:J.sequence)||(null==J?void 0:J.lastSequence)||0,fromAccount:(null==J?void 0:J.from)||(null==J?void 0:J.fromAccount)||"",messageForShow:Yu.core.common.getMessagePreviewText(null==J?void 0:J.type,null==J?void 0:J.payload),payload:(null==J?void 0:J.payload)||null,type:(null==J?void 0:J.type)||"",isRevoked:(null==J?void 0:J.isRevoked)||!1,cloudCustomData:(null==J?void 0:J.cloudCustomData)||"",onlineOnlyFlag:(null==J?void 0:J._onlineOnlyFlag)||!1,nick:(null==J?void 0:J.nick)||"",nameCard:(null==J?void 0:J.nameCard)||"",version:(null==J?void 0:J.version)||0,isPeerRead:(null==J?void 0:J.isPeerRead)||!1,revoker:(null==J?void 0:J.revoker)||null});function na(J){const{OuterConstant:Z}=Yu.core;let ee="";return 0===J?ee=Z.MSG_REMIND_ACPT_AND_NOTE:1===J?ee=Z.MSG_REMIND_DISCARD:2===J?ee=Z.MSG_REMIND_ACPT_NOT_NOTE:3===J&&(ee=Z.NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT),ee}function oa(J){const{OuterConstant:Z}=Yu.core;let ee;return J.startsWith(Z.CONV_C2C)&&(ee=J.replace(Z.CONV_C2C,"")),"@TLS#ERROR"===ee||"@TLS#NOT_FOUND"===ee}function ia(J,Z){const{helper:ee}=Yu.core,ne=new ee.ChatError({functionName:J,code:(null==Z?void 0:Z.errorCode)||(null==Z?void 0:Z.code),message:(null==Z?void 0:Z.errorInfo)||(null==Z?void 0:Z.message)});throw console.error(`${J} fail:`,ne),ne}class ra{constructor(J){this.conversationID=J.conversationID||"",this.unreadCount=J.unreadCount||0,this.type=J.type||"",this.lastMessage=sa(J.lastMessage),this.peerReadTime=J.peerReadTime||0,this.groupAtInfoList=[],this.remark=J.remark||"",this.isPinned=J.isPinned||!1,this.messageRemindType=J.messageRemindType,this.markList=J.markList||[],this.customData=J.customData||"",this.conversationGroupList=J.conversationGroupList||[],this.draftText=J.draftText||"",this.userProfile=J.userProfile,this.groupProfile=J.groupProfile,this.subType=J.subType||"",this._isInfoCompleted=!1,this._init()}_init(){var J;const{core:{OuterConstant:Z,utils:{isUndefined:ee}}}=Yu;ee(this.userProfile)&&this.type===Z.CONV_C2C?this.userProfile={userID:this.conversationID.replace(Z.CONV_C2C,"")}:this.type===Z.CONV_GROUP&&(!this.subType&&(null===(J=this.groupProfile)||void 0===J?void 0:J.type)&&(this.subType=this.groupProfile.type),ee(this.groupProfile)&&(this.groupProfile={groupID:this.conversationID.replace(Z.CONV_GROUP,""),selfInfo:{},lastMessage:{},type:this.subType}))}updateUnreadCount(J){var Z;const{core:{OuterConstant:ee,utils:{isUndefined:ne},store:se}}=Yu,{nextUnreadCount:re,isFromGetConversations:ae,isUnreadC2CMessage:le}=J;if(ne(re))return;if(this.subType===ee.GRP_AVCHATROOM)return void(this.unreadCount=0);if(ae&&this.type===ee.CONV_GROUP)return void(this.unreadCount=re);if(le&&this.type===ee.CONV_C2C)return void(this.unreadCount=re);const pe="1"===(null===(Z=se.get("cloudConfig"))||void 0===Z?void 0:Z.support_unread_count_for_meeting);this.subType!==ee.GRP_MEETING||pe?this.unreadCount+=re:this.unreadCount=0}updateLastMessage(J){this.lastMessage=sa(J)}reduceUnreadCount(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}isLastMessageRevoked(J){const{core:{OuterConstant:Z}}=Yu,{sequence:ee,time:ne}=J;return this.type===Z.CONV_C2C&&ee===this.lastMessage.lastSequence&&ne===this.lastMessage.lastTime||this.type===Z.CONV_GROUP&&ee===this.lastMessage.lastSequence}setLastMessageRevoked(J){this.lastMessage.isRevoked=J}setLastMessageRevoker(J){this.lastMessage.revoker=J}setDraftText(J){this.draftText=J}updateGroupAtInfoList(J){const{core:{common:{updateGroupAtInfo:Z}}}=Yu;Z(J,this.groupAtInfoList)}clearGroupAtInfoList(){this.groupAtInfoList.length=0}getProfileCompleted(){return this._isInfoCompleted}setProfileCompleted(){this._isInfoCompleted=!0}}var zu,Ju,Zu;!function(J){J[J.OFF=0]="OFF",J[J.ON=1]="ON"}(zu||(zu={})),function(J){J[J.ONLY_CONVERSATIONID=1]="ONLY_CONVERSATIONID"}(Ju||(Ju={})),function(J){J[J.CONV_NOT_FOUND=2500]="CONV_NOT_FOUND",J[J.USER_OR_GRP_NOT_FOUND=2501]="USER_OR_GRP_NOT_FOUND",J[J.CONV_UN_RECORDED_TYPE=2502]="CONV_UN_RECORDED_TYPE"}(Zu||(Zu={}));var Xu=new class{constructor(){this._name="ConversationDataHandler",this._totalUnreadCount=0,this._groupAtTipsList=[]}init(J){this._core=J;const{helper:Z,notificationCenter:ee,appStore:{conversationStore:ne},constants:{WORKFLOW_NAME:se,WORKFLOW_STEP:re},InnerEvent:{SYNC_CONVERSATION_LIST:ae,MESSAGE_PUSH:le,NEW_MESSAGE:pe,MESSAGE_DELETED:_e,MESSAGE_REVOKED:ve,MESSAGE_MODIFIED:ye,CONVERSATION_UPDATED:Fe,LOGOUT:qe,DESTROY:$e},InnerEventSubType:{C2C_MESSAGE_PEER_READ:He}}=J;this._conversationStore=ne,Z.registerWorkflowStep(se.SYNC_SERVER_INFO_AFTER_LOGIN,re.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,this._handleUnreadSyncFinished,this),Z.registerWorkflowStep(se.SYNC_SERVER_INFO_AFTER_LOGIN,re.CONVERSATION_UPDATE_AFTER_GROUP_LIST_SYNC_FINISHED,this._handleGroupListSyncFinished,this),Z.registerWorkflowStep(se.RECEIVE_C2C_NEW_MESSAGE,re.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,this._handleNewMessage,this),Z.registerWorkflowStep(se.RECEIVE_C2C_NEW_MESSAGE,re.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,this._handleUnreadSyncFinished,this),Z.registerWorkflowStep(se.RECEIVE_GROUP_NEW_MESSAGE,re.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,this._handleNewMessage,this),Z.registerWorkflowStep(se.SYNC_SERVER_INFO_AFTER_RE_ONLINE,re.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,this._handleUnreadSyncFinished,this),Z.registerWorkflowStep(se.RECEIVE_GROUP_TIPS_NOTIFICATION,re.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,this._handleNewMessage,this);const{InnerEventSubType:{GROUP_AT_TIPS:Ye}}=ee;ee.subscribeInnerEvent(ae,this._handleConversationSynced,this),ee.subscribeInnerEvent(pe,this._handleNewMessage,this),ee.subscribeInnerEvent(le,Ye,this._handleNewGroupAtTips,this),ee.subscribeInnerEvent(_e,this._handleMessageDeleted,this),ee.subscribeInnerEvent(ve,this._handleMessageRevoked,this),ee.subscribeInnerEvent(ye,this._handleMessageModified,this),ee.subscribeInnerEvent(Fe,this._handleConversationUpdated,this),ee.subscribeInnerEvent(le,He,this._handleMessageRead,this),ee.subscribeInnerEvent(qe,this._reset,this),ee.subscribeInnerEvent($e,this._dispose,this),J.ssoLog.debug(`${this._name}.init`)}_handleConversationSynced(J){this.updateLocalConversationList({conversationUpdateFieldList:J.conversationUpdateFieldList||[],isFromGetConversations:!0,updateUnreadCount:!0}),this.emitConversationListUpdate()}_handleUnreadSyncFinished(J){const{constants:{WORKFLOW_STEP:Z}}=this._core,{conversationUpdateFieldList:ee=[],groupTipList:ne=[],isUnreadC2CMessage:se}=J.result[Z.UNREAD_MESSAGE_SYNC]||{};let re=!1;ee.forEach((J=>{const{conversationID:Z,unreadCount:ee}=J,ne=this.getLocalConversation(Z);ne&&ne.unreadCount!==ee&&(ne.updateUnreadCount({nextUnreadCount:ee,isUnreadC2CMessage:se}),re=!0)})),re&&this.emitConversationListUpdate(),this._handleGroupAtTipsSynced(ne)}_handleGroupAtTipsSynced(J){var Z;for(let ee=0;ee<J.length;ee++)if(12===J[ee].Event){if(null===(Z=J[ee].GroupTips[0].MsgBody)||void 0===Z?void 0:Z.TopicId)continue;this._handleNewGroupAtTips(J[ee])}}_handleGroupListSyncFinished(J){var Z;const{constants:{WORKFLOW_STEP:ee}}=this._core,ne=J.result[ee.GROUP_LIST_SYNC]||[],{OuterConstant:{CONV_GROUP:se}}=this._core;let re=!1;for(let J=0;J<ne.length;J++){const ee=ne[J],ae=`${se}${ee.groupID}`;if(!this.hasLocalConversation(ae))continue;const le=this.getLocalConversation(ae);le.groupProfile=JSON.parse(JSON.stringify(ee)),le.lastMessage.lastSequence<ee.nextMessageSeq&&(le.lastMessage.lastSequence=ee.nextMessageSeq-1),le.subType||(le.subType=ee.type),(null===(Z=ee._groupAtInfoList)||void 0===Z?void 0:Z.length)>0&&this._handleNewGroupAtTips({GroupTips:ee._groupAtInfoList}),re=!0}re&&this.emitConversationListUpdate()}_handleNewMessage(J){const{conversationUpdateFieldList:Z=[],isInstantMessage:ee=!0,isUnreadC2CMessage:ne=!1,updateUnreadCount:se=!0}=J.result||{};if(0===Z.length)return;const{common:{isTopic:re}}=this._core;re(Z[0].conversationID)||(this.updateLocalConversationList({conversationUpdateFieldList:Z,isInstantMessage:ee,isUnreadC2CMessage:ne,isFromGetConversations:!1,updateUnreadCount:se}),Z.filter((J=>this._isConversationNeedShow(J.conversationID))).length>0&&this.emitConversationListUpdate())}_handleNewGroupAtTips(J){const{GroupTips:Z=[]}=J;Z.forEach((J=>{const{GroupAtTips:Z,MsgBody:ee,MsgRandom:ne,ClientSeq:se}=J;let re={};Z?re=this._convertGroupAtTipsKey(Z):ee?re=Object.assign({},this._convertGroupAtTipsKey(ee)):J.groupAtType&&(re=Object.assign({},J)),re.__random=ne,re.__sequence=se,this._groupAtTipsList.push(re)})),console.log(`${this._name}._handleNewGroupAtTips groupAtTipsList: ${JSON.stringify(this._groupAtTipsList)}`),this._updateGroupAtInfoList()}_convertGroupAtTipsKey(J){const{From_Account:Z,GroupId:ee,MsgSeq:ne,GroupAtType:se}=J;return{from:Z,groupID:ee,sequence:ne,groupAtType:se}}_updateGroupAtInfoList(){if(0===this._groupAtTipsList.length)return;const{common:J,OuterConstant:Z}=this._core,ee=J.getCurrentUserID();let ne=!1;this._groupAtTipsList.forEach((J=>{const{groupID:se,from:re}=J;if(re!==ee){const ee=this.getLocalConversation(`${Z.CONV_GROUP}${se}`);ee&&(ee.updateGroupAtInfoList(J),ne=!0)}})),ne&&this.emitConversationListUpdate(),this._groupAtTipsList.length=0}_handleMessageDeleted(J){var Z,ee;console.log(`${this._name}._handleMessageDeleted, conversationID:`,J);const{message:{messageDataHandler:ne},OuterConstant:se}=this._core,re=(null==ne?void 0:ne.getLocalMessageList(J))||[];let ae={};for(let J=(re.length||0)-1;J>=0;J--)if(!re[J].isDeleted){ae=re[J];break}const le=this.getLocalConversation(J);if(!le)return;let pe=!1;le.lastMessage.lastSequence===ae.sequence&&le.lastMessage.lastTime===ae.time||((null===(ee=null===(Z=this._core)||void 0===Z?void 0:Z.helper)||void 0===ee?void 0:ee.isEmpty(ae))&&(ae=void 0),le.updateLastMessage(ae),pe=!0),J.startsWith(se.CONV_C2C)&&this.updateUnreadCount(J),pe&&(this.emitConversationListUpdate(),console.log(`${this._name}._handleMessageDeleted. update conversationID:${J} with lastMessage:`,le.lastMessage))}_handleMessageRevoked(J){const{messageList:Z=[],updateUnreadCount:ee=!0}=J;if(console.log(`${this._name}._handleMessageRevoked messageList:${Z.length}`),0===Z.length)return;let ne=null,se=!1;Z.forEach((J=>{ne=this.getLocalConversation(J.conversationID),ne&&(ee&&ne.reduceUnreadCount()&&(se=!0),ne.isLastMessageRevoked({sequence:J.sequence,time:J.time})&&(ne.setLastMessageRevoked(!0),ne.setLastMessageRevoker(J.revoker),se=!0))})),se&&this.emitConversationListUpdate()}_handleMessageModified(J){console.log(`${this._name}._handleMessageModified`,JSON.stringify(J));const{conversationID:Z,messageList:ee}=J,ne=this.getLocalConversation(Z),{utils:{isEmpty:se},common:{getMessagePreviewText:re}}=this._core;if(se(ne))return;const{lastMessage:ae}=ne;if(ae){const J=(null==ee?void 0:ee[0])||{};ae.lastTime===J.time&&ae.lastSequence===J.sequence&&ae.version!==J.version&&(ae.type=J.type,ae.payload=J.payload,ae.messageForShow=re(J.type,J.payload),ae.cloudCustomData=J.cloudCustomData,ae.version=J.version,this.emitConversationListUpdate(),console.log(`${this._name} conversationID:${Z} lastMessage updated`))}}_handleConversationUpdated(J){this.emitConversationListUpdate(null==J?void 0:J.needSort)}updateLocalConversationList(J){const{isFromGetConversations:Z}=J,{newConversationList:ee}=this._getTmpConversationListMapping(J);this._sortConversationList(),Z||this._updateNewConversationProfile(ee),this._core.ssoLog.debug("updateLocalConversationList",` newConversationList: ${ee.length}`)}_getTmpConversationListMapping(J){const{OuterConstant:Z}=this._core,{conversationUpdateFieldList:ee,isFromGetConversations:ne,isInstantMessage:se,isUnreadC2CMessage:re=!1,updateUnreadCount:ae}=J,le=[],pe=null==ee?void 0:ee.length;for(let J=0;J<pe;J++){const pe=new ra(ee[J]),{conversationID:_e,type:ve}=pe;if(!oa(_e))if(this.hasLocalConversation(_e)){const le=this.getLocalConversation(_e);if(ne){this.setLocalConversation(_e,pe),ve===Z.CONV_C2C?pe.unreadCount=(null==le?void 0:le.unreadCount)||0:ve===Z.CONV_GROUP&&(pe.groupProfile=JSON.parse(JSON.stringify(null==le?void 0:le.groupProfile)));continue}this._mergeConversationInfo({conversationID:_e,tmpConversation:pe,lastMessage:ee[J].lastMessage,isFromGetConversations:ne,isInstantMessage:se}),this._patchLastMessage({conversationID:_e,lastMessage:ee[J].lastMessage,isInstantMessage:se}),!0===ae&&(null==le||le.updateUnreadCount({nextUnreadCount:pe.unreadCount,isFromGetConversations:ne,isUnreadC2CMessage:re}))}else le.push(pe),this.setLocalConversation(_e,pe)}return{newConversationList:le}}_mergeConversationInfo(J){const{conversationID:Z,tmpConversation:ee,lastMessage:ne,isFromGetConversations:se,isInstantMessage:re}=J,ae=this.getLocalConversation(Z),le=["unreadCount","allowType","adminForbidType","payload"];!1===re&&le.push("lastMessage"),se||le.push("isPinned");const{utils:{isUndefined:pe,isEmpty:_e},common:{deepMerge:ve}}=this._core;pe(re)&&ne&&null===(null==ae?void 0:ae.lastMessage.payload)&&(ae.lastMessage.payload=ne.payload),_e(null==ae?void 0:ae.lastMessage.revoker)||(ae.lastMessage.revoker=null),ve(ae,ee,le,[null,void 0,"",0,NaN])}_patchLastMessage(J){const{OuterConstant:Z}=this._core,{conversationID:ee,lastMessage:ne,isInstantMessage:se}=J,re=this.getLocalConversation(ee);if(re&&ne){const{payload:J,nameCard:ee,nick:ae,cloudCustomData:le=""}=ne;se&&(J&&(re.lastMessage.payload=J),re.type===Z.CONV_GROUP&&(re.lastMessage.nameCard=ee,re.lastMessage.nick=ae)),re.lastMessage.cloudCustomData!==le&&(re.lastMessage.cloudCustomData=le)}}_sortConversationList(){const{utils:{isEmpty:J}}=this._core,Z=[...this._conversationStore.getConversationMap()],ee=[],ne=[],se=[],re=[];Z.forEach((Z=>{!0===Z[1].isPinned?J(Z[1].lastMessage.lastTime)?ne.push(Z):ee.push(Z):J(Z[1].lastMessage.lastTime)?re.push(Z):se.push(Z)}));const ae=ee.sort(((J,Z)=>Z[1].lastMessage.lastTime-J[1].lastMessage.lastTime)).concat(ne).concat(se.sort(((J,Z)=>Z[1].lastMessage.lastTime-J[1].lastMessage.lastTime))).concat(re);this._updateConversationMapFromList(ae)}_updateNewConversationProfile(J){if(0===J.length)return;const Z=[],ee=[],{OuterConstant:{CONV_GROUP:ne,CONV_C2C:se}}=this._core;J.forEach((J=>{const{conversationID:re,type:ae}=J;if(ae===se){const J=re.replace(se,"");Z.push(J)}else if(ae===ne){const J=re.replace(ne,"");ee.push(J)}})),Z.length>0&&this._updateC2CConversation(Z),ee.length>0&&this._updateGroupConversation(ee)}_updateC2CConversation(J){var Z;const{OuterConstant:{CONV_C2C:ee},appStore:{userStore:ne},user:se}=this._core;let re=!1;null===(Z=se.userProfile)||void 0===Z||Z.getUserProfile({userIDList:J}).then((J=>{((null==J?void 0:J.data)||[]).forEach((J=>{var Z;const{userID:se}=J,ae=this.getLocalConversation(`${ee}${se}`);if(ae){const ee=(null===(Z=ne.getFriend(se))||void 0===Z?void 0:Z.remark)||"";ae.remark=ee,ae.userProfile=J,re=!0}})),re&&this.emitConversationListUpdate()})).catch((J=>{}))}_updateGroupConversation(J){return ge(this,void 0,void 0,(function*(){const{OuterConstant:{CONV_GROUP:Z},appStore:{groupStore:ee},utils:{safeStringify:ne},ssoLog:se,apiMap:{getGroupProfile:re}}=this._core;let ae=!1;try{yield Promise.all(J.map((J=>ge(this,void 0,void 0,(function*(){const ne=ee.getGroup(J),se=this.getLocalConversation(`${Z}${J}`);ne&&se&&(se.groupProfile=ne,ae=!0),se&&!se.getProfileCompleted()&&"function"==typeof re&&(yield re({groupID:J}))}))))),ae&&this.emitConversationListUpdate()}catch(J){se.debug("_updateGroupConversation",ne(J))}}))}_handleMessageRead(J){const{OuterConstant:{CONV_C2C:Z}}=this._core,{C2cNotifyMsgArray:ee=[]}=J||{};ee.forEach((J=>{const{To_Account:ee,UinPairReadArray:ne=[]}=(null==J?void 0:J.C2cReadedReceipt)||{};null==ne||ne.forEach((J=>{const{LastReadTime:ne}=J,se=`${Z}${ee}`;this._updateConversationReadInfo({conversationID:se,peerReadTime:ne}),this._updateMessageListPeerRead({conversationID:se,peerReadTime:ne})}))}))}_updateConversationReadInfo(J){const{appStore:Z,utils:{isEmpty:ee},common:{getCurrentUserID:ne}}=this._core,{conversationID:se,peerReadTime:re}=J,ae=Z.conversationStore.getConversationMap();if(ae.has(se)){const J=ae.get(se);J.peerReadTime=re;const le=null==J?void 0:J.lastMessage;ee(le)||le.fromAccount===ne()&&le.lastTime<=re&&!le.isPeerRead&&(le.isPeerRead=!0,Z.conversationStore.updateConversation(se,{lastMessage:le}))}}_updateMessageListPeerRead(J){const{notificationCenter:Z,OuterEvent:ee,message:ne}=this._core,{conversationID:se,peerReadTime:re}=J,ae=ne.messageDataHandler.getLocalMessageList(se),le=ne.messageDataHandler.getSparseMessageList(se),pe=[];ae.forEach((J=>{J.time<=re&&!J.isPeerRead&&"out"===J.flow&&(J.isPeerRead=!0,pe.push(J))})),le.forEach((J=>{J.time<=re&&!J.isPeerRead&&"out"===J.flow&&(J.isPeerRead=!0,pe.push(J))})),Z.emitOuterEvent(ee.MESSAGE_READ_BY_PEER,{name:ee.MESSAGE_READ_BY_PEER,data:pe})}_isConversationNeedShow(J){var Z,ee;const{OuterConstant:{CONV_GROUP:ne,GRP_ROOM:se,GRP_LIVE:re},utils:{isUndefined:ae}}=this._core,le=this.getLocalConversation(J);if(ae(le))return!0;const pe=le.type===ne&&(null===(Z=le.groupProfile)||void 0===Z?void 0:Z.type)===se,_e=le.type===ne&&(null===(ee=le.groupProfile)||void 0===ee?void 0:ee.type)===re;return!(pe||_e)}updateUnreadCount(J,Z=!0){var ee,ne;let se=!1;const re=this.getLocalConversation(J),ae=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message.messageDataHandler)||void 0===ne?void 0:ne.getLocalMessageList(J);if(!re)return se;const le=re.unreadCount,pe=null==ae?void 0:ae.filter((J=>!J.isRead&&!J._onlineOnlyFlag&&!J.isDeleted)).length;return console.log(`${this._name}._updateUnreadCount conversationID:${J} currentUnreadCount:${le} newUnreadCount:${pe}`),le!==pe&&(re.unreadCount=pe,se=!0,!0===Z&&this.emitConversationListUpdate()),se}emitConversationListUpdate(J=!1){var Z,ee;J&&this._sortConversationList();const{OuterEvent:{CONVERSATION_LIST_UPDATED:ne},conversation:se}=this._core,re=this.getLocalConversationList();this._emitEvent({name:ne,data:re,isSyncCompleted:null===(ee=null===(Z=null==se?void 0:se.syncConversationHandler)||void 0===Z?void 0:Z.isSyncCompleted)||void 0===ee?void 0:ee.call(Z)}),this._emitTotalUnreadCountUpdate()}_emitTotalUnreadCountUpdate(){var J;const Z=this.getTotalUnreadMessageCount();this._totalUnreadCount!==Z&&(this._core.ssoLog.debug("_emitTotalUnreadCountUpdate",` from ${this._totalUnreadCount} to ${Z}`),this._totalUnreadCount=Z,this._emitEvent({name:null===(J=this._core)||void 0===J?void 0:J.OuterEvent.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,data:Z}))}_emitEvent(J){var Z;null===(Z=this._core)||void 0===Z||Z.notificationCenter.emitOuterEvent(J.name,J)}getTotalUnreadMessageCount(){const{OuterConstant:J,utils:{isEmpty:Z}}=this._core,ee=this.getLocalConversationList();let ne=0;return ee.forEach((ee=>{ee.type!==J.CONV_SYSTEM&&(Z(ee.messageRemindType)||ee.messageRemindType===J.MSG_REMIND_ACPT_AND_NOTE)&&(ne+=ee.unreadCount)})),ne}getLocalConversationList(){return[...this._conversationStore.getConversationMap().values()].filter((J=>this._isConversationNeedShow(J.conversationID)))}hasLocalConversation(J){return this._conversationStore.getConversationMap().has(J)}getLocalConversation(J){return this._conversationStore.getConversationMap().get(J)}setLocalConversation(J,Z){return this._conversationStore.getConversationMap().set(J,Z)}deleteLocalConversation(J){this._conversationStore.getConversationMap().delete(J)}_updateConversationMapFromList(J){this._clearConversationMap();for(const[Z,ee]of J)this.setLocalConversation(Z,ee)}_clearConversationMap(){this._conversationStore.getConversationMap().clear()}patchMessageRemindType(J,Z){let ee=!1;J.forEach((J=>{const ne=this.getLocalConversation(J);(null==ne?void 0:ne.messageRemindType)!==Z&&(ne.messageRemindType=Z,ee=!0)})),console.log(`${this._name}.patchMessageRemindType conversationIDList:${J} messageRemindType:${Z} hasUpdated:${ee}`),ee&&this.emitConversationListUpdate()}markMessageAsRead(J){const{message:{messageDataHandler:Z}}=this._core,{conversationID:ee,lastReadTime:ne=0,lastReadSequence:se=0}=J,re=null==Z?void 0:Z.getLocalMessageList(ee);if(0===re.length)return;const{length:ae}=re;for(let J=ae-1;J>=0;J--){const Z=re[J],ee=ne&&Z.time>ne,ae=se&&Z.sequence>se;if(!ee&&!ae){if("in"===Z.flow&&Z.isRead)break;Z.setIsRead(!0)}}}appendToPinnedConversation(J){const Z=[...this._conversationStore.getConversationMap().entries()],ee=Z.findIndex((J=>!1===J[1].isPinned));Z.splice(ee,0,[J.conversationID,J]),this._updateConversationMapFromList(Z),this.emitConversationListUpdate()}_reset(){this._clearConversationMap(),this._totalUnreadCount=0,this._groupAtTipsList=[]}_dispose(){const{notificationCenter:J,InnerEvent:{NEW_MESSAGE:Z,MESSAGE_DELETED:ee,MESSAGE_REVOKED:ne,MESSAGE_MODIFIED:se,CONVERSATION_UPDATED:re,LOGOUT:ae,DESTROY:le,SYNC_CONVERSATION_LIST:pe}}=this._core,{InnerEventSubType:{GROUP_AT_TIPS:_e}}=J;J.unSubscribeInnerEvent(Z,this._handleNewMessage,this),J.unSubscribeInnerEvent(Z,_e,this._handleNewGroupAtTips,this),J.unSubscribeInnerEvent(ee,this._handleMessageDeleted,this),J.unSubscribeInnerEvent(ne,this._handleMessageRevoked,this),J.unSubscribeInnerEvent(se,this._handleMessageModified,this),J.unSubscribeInnerEvent(re,this._handleConversationUpdated,this),J.unSubscribeInnerEvent(pe,this._handleConversationSynced,this),J.unSubscribeInnerEvent(ae,this._reset,this),J.unSubscribeInnerEvent(le,this._dispose,this)}},Qu=new class{constructor(){this._name="GetConversationList"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"getConversationList",context:this})}getConversationList(J){return ge(this,void 0,void 0,(function*(){return{code:0,data:{conversationList:this._getConversationList(J),isSyncCompleted:this._core.conversation.syncConversationHandler.isSyncCompleted()}}}))}_getConversationList(J){const{utils:{isUndefined:Z,isArray:ee,isPlainObject:ne}}=this._core;if(Z(J))return Xu.getLocalConversationList();if(ee(J))return 0===J.length?[]:Xu.getLocalConversationList().filter((Z=>J.includes(Z.conversationID)));if(ne(J)){const{type:Z,markType:ee,groupName:ne,hasUnreadCount:se,hasGroupAtInfo:re}=J;return Xu.getLocalConversationList().filter((J=>this._filterType(J,Z)&&this._filterMarkType(J,ee)&&this._filterGroupName(J,ne)&&this._filterUnreadCount(J,se)&&this._filterGroupAtInfo(J,re)))}return[]}_filterType(J,Z){const{OuterConstant:ee}=this._core;return Z!==ee.CONV_C2C&&Z!==ee.CONV_GROUP||J.type===Z}_filterGroupName(J,Z){const{utils:{isString:ee}}=this._core;return!ee(Z)||(""===Z?0===J.conversationGroupList.length:J.conversationGroupList.includes(Z))}_filterMarkType(J,Z){const{utils:{isNumber:ee}}=this._core;return!ee(Z)||(0===Z?0===J.markList.length:J.markList.includes(Z))}_filterUnreadCount(J,Z){let ee=!0;return!0===Z?ee=J.unreadCount>=1:!1===Z&&(ee=0===J.unreadCount),ee}_filterGroupAtInfo(J,Z){let ee=!0;return!0===Z?ee=J.groupAtInfoList.length>=1:!1===Z&&(ee=0===J.groupAtInfoList.length),ee}},el=new class{constructor(){this._name="GetC2CMessageRemindType"}init(J){this._core=J}get(J){return ge(this,void 0,void 0,(function*(){try{const{common:Z}=this._core,ee=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{toAccount:ee,userIDList:ne}=J,se={To_Account:ee,Peer_Account:ne};return Z.common.buildAndSendPacket({servcmd:"openim.get_c2c_peer_mute_notifications",data:se})}))}({toAccount:Z.getCurrentUserID(),userIDList:J},this._core),{MuteNotificationsList:ne=[]}=ee||{};ne.forEach((J=>{const{Peer_Account:Z,MuteNotifications:ee}=J,ne=`${this._core.OuterConstant.CONV_C2C}${Z}`,se=na(ee);Xu.patchMessageRemindType([ne],se)}))}catch(J){console.error(`${this._name}.get fail:`,J)}}))}},tl=new class{constructor(){this._name="GetGroupMessageRemindType"}init(J){this._core=J}get(J){return ge(this,void 0,void 0,(function*(){if(0!==J.length)try{const Z=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupIDList:ee,responseFilter:ne}=J,se={GroupIdList:ee,ResponseFilter:ne};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_self_member_info",data:se})}))}({groupIDList:J,responseFilter:{MemberInfoFilter:["MsgFlag"]}},this._core),{GroupInfo:ee=[]}=Z||{};ee.forEach((J=>{var Z;const{GroupId:ee,MemberList:ne}=J,se=(null===(Z=ne[0])||void 0===Z?void 0:Z.MsgFlag)||"",re=`${this._core.OuterConstant.CONV_GROUP}${ee}`;Xu.patchMessageRemindType([re],se)}))}catch(J){console.error(`${this._name}.get fail:`,J)}}))}},nl=new class{constructor(){this._name="GetConversationProfile"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"getConversationProfile",context:this})}getConversationProfile(J){return ge(this,void 0,void 0,(function*(){const{OuterConstant:{CONV_C2C:Z,CONV_GROUP:ee,GRP_AVCHATROOM:ne},appStore:{groupStore:se},utils:{isEmpty:re}}=this._core,ae={code:0,data:{}};let le=Xu.getLocalConversation(J);if(ta(J))return ae.data.conversation=le,ae;let pe=!1;const _e=Zr(J)?Z:ee;if(re(le)&&(pe=!0,le=new ra({conversationID:J,type:_e})),console.log(`${this._name}.getConversationProfile conversationID:${J} isNewConversation:${pe}`),ae.data.conversation=le,null==le?void 0:le.getProfileCompleted())return ae;if(_e===Z){const ee=J.replace(Z,"");yield this._handleC2CConversation(le,ee),pe&&(yield el.get([ee]))}if(_e===ee){const Z=J.replace(ee,"");if(!se.getGroup(Z))return ae;yield this._handleGroupConversation(le,Z),pe&&le.groupProfile.type!==ne&&(yield tl.get([Z]))}return ae}))}_handleC2CConversation(J,Z){return ge(this,void 0,void 0,(function*(){var ee,ne;const{user:se,helper:re,utils:{isEmpty:ae},appStore:{conversationStore:le,userStore:pe}}=this._core,{conversationID:_e}=J,ve=yield null===(ee=se.userProfile)||void 0===ee?void 0:ee.getUserProfile({userIDList:[Z]});if(0===(null==ve?void 0:ve.data.length))throw new re.ChatError({code:Zu.USER_OR_GRP_NOT_FOUND});J.userProfile=null==ve?void 0:ve.data[0];const ye=null===(ne=pe.getFriend(Z))||void 0===ne?void 0:ne.remark;ae(ye)||J.remark===ye||(J.remark=ye),J.setProfileCompleted();const Fe=Xu.hasLocalConversation(_e);console.log(`${this._name}._handleC2CConversation conversationID:${_e} hasLocalConversation: ${Fe}`),Fe?le.updateConversation(_e,J):Xu.appendToPinnedConversation(J)}))}_handleGroupConversation(J,Z){return ge(this,void 0,void 0,(function*(){const{apiMap:{getGroupProfile:ee},appStore:{conversationStore:ne}}=this._core,{conversationID:se}=J,re=yield ee({groupID:Z});J.groupProfile=null==re?void 0:re.data.group,J.setProfileCompleted();const ae=Xu.hasLocalConversation(se);console.log(`${this._name}._handleGroupConversation conversationID:${se} hasLocalConversation: ${ae}`),ae?ne.updateConversation(se,J):Xu.appendToPinnedConversation(J)}))}},sl=new class{init(J){const{helper:Z}=J;Z.registerApi({apiName:"getTotalUnreadMessageCount",context:this})}getTotalUnreadMessageCount(){return Xu.getTotalUnreadMessageCount()}},il=new class{constructor(){this._serverGroupConversationLastReadSeqMap=new Map,this._name="SetMessageRead"}init(J){this._core=J;const{helper:Z,common:{isTopic:ee},notificationCenter:ne,InnerEvent:{MESSAGE_PUSH:se},InnerEventSubType:{ALL_MESSAGE_READ:re}}=J;Z.registerApi({apiName:"setMessageRead",context:this,matcher:J=>!ee(J[0].conversationID)}),Z.registerApi({apiName:"setAllMessageRead",context:this}),ne.subscribeInnerEvent(se,re,this._handleAllMessageRead,this)}handleC2CMessageReadSync(J){const{helper:{isEmpty:Z},OuterConstant:ee}=this._core;J.forEach((J=>{const{ReadC2cMsgNotify:ne}=J;if(!Z(ne)){const{UinPairReadArray:J=[]}=ne;J.forEach((J=>{const{From_Account:Z,LastReadTime:ne}=J,se=`${ee.CONV_C2C}${Z}`;console.log(`${this._name}.handleC2CMessageReadSync conversationID:${se} lastReadTime:${ne}`),Xu.markMessageAsRead({conversationID:se,lastReadTime:ne}),Xu.updateUnreadCount(se)}))}}))}handleGroupMessageReadSync(J){const{OuterConstant:Z,utils:{isUndefined:ee}}=this._core;J.forEach((J=>{const{GroupReadInfoArray:ne}=J.MsgBody;ee(ne)||ne.forEach((J=>{const{GroupId:ee,LastReadMsgSeq:ne}=J,se=`${Z.CONV_GROUP}${ee}`;console.log(`${this._name}.handleGroupMessageReadSync conversationID:${se} lastReadSequence:${ne}`),Xu.markMessageAsRead({conversationID:se,lastReadSequence:ne}),Xu.updateUnreadCount(se),this._clearGroupAtInfoList(se)}))}))}setMessageRead(J){return ge(this,void 0,void 0,(function*(){var Z,ee;const{OuterConstant:ne}=this._core,{conversationID:se}=J,re={code:0,data:{}},ae=Xu.getLocalConversation(se);let le=`${this._name}.setMessageRead conversationID:${se} unreadCount:${(null==ae?void 0:ae.unreadCount)||0}`;if(re.successLog={message:le},!ae)return re;const pe=!(null===(ee=null===(Z=this._core)||void 0===Z?void 0:Z.helper)||void 0===ee?void 0:ee.isEmpty(ae.groupAtInfoList));if(ae.type===ne.CONV_GROUP&&pe&&this._deleteGroupAtTips(se),0===ae.unreadCount)return re;const{helper:{ChatError:_e}}=this._core;try{if(ae.type===ne.CONV_C2C){const J=this._getLocalMessageMaxTime(ae);yield this._setC2CMessageRead(se,J),le+=`lastMessageTime:${J}`}if(ae.type===ne.CONV_GROUP){const J=this._getLocalMessageMaxSequence(ae);yield this._setGroupMessageRead(se,J),le+=`lastMessageSequence:${J}`}}catch(J){const{errorCode:Z,errorInfo:ee}=J;throw new _e({functionName:"setMessageRead",code:Z,message:ee,moreMessage:le})}return ae.type===ne.CONV_SYSTEM&&(ae.unreadCount=0),Xu.emitConversationListUpdate(),Object.assign(Object.assign({},re),{successLog:{message:le}})}))}setAllMessageRead(){return ge(this,arguments,void 0,(function*(J={}){const{OuterConstant:{READ_ALL_MSG:Z},utils:{safeStringify:ee}}=this._core;let ne=`scope:${J.scope}`;J.scope||(J.scope=Z);const{scope:se}=J,re=this._generateSetAllMessageReadRequestData(se);if(0===re.allC2CMessageReadStatus&&0===re.groupMessageReadInfoList.length)return{code:0};try{const J=yield function(J){return ge(this,void 0,void 0,(function*(){const{allC2CMessageReadStatus:Z,groupMessageReadInfoList:ee}=J,ne={C2CReadAllMsg:Z,GroupReadInfo:ee};return Yu.core.common.buildAndSendPacket({servcmd:"openim.read_all_unread_msg",data:ne})}))}(re);if(J){const{GroupReadInfoArray:Z,C2CReadAllMsg:se}=J,re=this._parseGroupReadInfo(Z);this._updateAllConversationReadStatus({allC2CMessageReadStatus:se})>0&&Xu.emitConversationListUpdate(),ne+=`failureGroupInfoList:${ee(re)}`}return{code:0,successLog:{message:ne}}}catch(J){const{errorCode:Z}=J;throw new this._core.helper.ChatError({functionName:"setAllMessageRead",code:Z,moreMessage:ne})}}))}_handleAllMessageRead(J){const{GroupReadInfoArray:Z,C2CReadAllMsg:ee}=J;this._parseGroupReadInfo(Z),this._updateAllConversationReadStatus({allC2CMessageReadStatus:ee})>0&&Xu.emitConversationListUpdate()}_updateAllConversationReadStatus(J){const{OuterConstant:{CONV_C2C:Z,CONV_GROUP:ee},appStore:ne}=this._core,se=ne.conversationStore.getConversationMap(),{allC2CMessageReadStatus:re}=J;let ae=0;for(const[J,ne]of se)if(ne.unreadCount>=1){if(1===re&&ne.type===Z){const Z=this._getLocalMessageMaxTime(ne);Xu.markMessageAsRead({conversationID:J,lastReadTime:Z})}else if(ne.type===ee){const Z=J.replace(ee,"");if(this._serverGroupConversationLastReadSeqMap.has(Z)){const ee=this._serverGroupConversationLastReadSeqMap.get(Z);Xu.markMessageAsRead({conversationID:J,lastReadSequence:ee})}}Xu.updateUnreadCount(J,!1)&&(ae+=1)}return ae}_generateSetAllMessageReadRequestData(J){const{OuterConstant:{CONV_C2C:Z,CONV_GROUP:ee,READ_ALL_C2C_MSG:ne},appStore:se}=this._core,re={allC2CMessageReadStatus:0,groupMessageReadInfoList:[]},ae=se.conversationStore.getConversationMap();for(const[,se]of ae){const{type:ae,unreadCount:le}=se;if(this._shouldSetAllMessageRead({scope:J,type:ae,unreadCount:le}))if(ae===Z&&0===re.allC2CMessageReadStatus){if(re.allC2CMessageReadStatus=1,J===ne)break}else if(ae===ee){const J=this._getLocalMessageMaxSequence(se),{groupID:Z}=se.groupProfile;re.groupMessageReadInfoList.push({GroupId:Z,MsgSeq:J})}}return re}_parseGroupReadInfo(J){const{utils:{isUndefined:Z}}=this._core,ee=[];return null==J||J.forEach((J=>{const{GroupId:ne,MsgSeq:se,RetCode:re,LastReadMsgSeq:ae}=J;Z(re)?this._serverGroupConversationLastReadSeqMap.set(ne,ae):(this._serverGroupConversationLastReadSeqMap.set(ne,se),0!==re&&ee.push(`${ne}-${se}-${re}`))})),ee}_deleteGroupAtTips(J){return ge(this,void 0,void 0,(function*(){console.log(`${this._name}._deleteGroupAtTips conversationID:${J}`);const Z=Xu.getLocalConversation(J);if(!Z)return;const ee=(null==Z?void 0:Z.groupAtInfoList)||[];if(0!==ee.length)try{const{common:{getCurrentUserID:Z,isCommunity:ne},OuterConstant:{CONV_GROUP:se,CONV_AT_ALL:re}}=this._core;let ae=[...ee];if(ne({groupID:J.replace(se,"")})&&(ae=ee.filter((J=>!J.atTypeArray.includes(re))),0===ae.length))return void this._clearGroupAtInfoList(J,!1);const le=ae.map((J=>({From_Account:J.from,To_Account:Z(),MsgSeq:J.__sequence,MsgRandom:J.__random,GroupId:J.groupID})));yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{messageListToDelete:ee}=J,ne={DelMsgList:ee};return Z.common.buildAndSendPacket({servcmd:"openim.deletemsg",data:ne})}))}({messageListToDelete:le},this._core),console.log(`${this._name}._deleteGroupAtTips ok. count:${ee.length}`),this._clearGroupAtInfoList(J)}catch(J){console.error(`${this._name}._deleteGroupAtTips fail:`,J)}}))}_clearGroupAtInfoList(J,Z=!0){const ee=Xu.getLocalConversation(J);ee&&(ee.groupAtInfoList.length>0&&(ee.clearGroupAtInfoList(),console.log(`${this._name}._clearGroupAtInfoList conversationID:${J} needEmitConversationUpdate:${Z}`)),Z&&Xu.emitConversationListUpdate())}_getLocalMessageMaxTime(J){var Z;const{conversationID:ee}=J,ne=this._core.message.messageDataHandler.getLocalMessageList(ee),se=Math.max(...ne.map((J=>J.time)));let re=(null===(Z=null==J?void 0:J.lastMessage)||void 0===Z?void 0:Z.lastTime)||0;return se>re&&(console.log(`${this._name}._getLocalMessageMaxTime update lastMessageTime from ${re} to ${se}`),re=se),re}_getLocalMessageMaxSequence(J){var Z;const{conversationID:ee}=J,ne=this._core.message.messageDataHandler.getLocalMessageList(ee),se=Math.max(...ne.map((J=>J.sequence)));let re=(null===(Z=null==J?void 0:J.lastMessage)||void 0===Z?void 0:Z.lastSequence)||0;return se>re&&(console.log(`${this._name}._getLocalMessageMaxSequence update lastMessageSequence from ${re} to ${se}`),re=se),re}_setC2CMessageRead(J,Z){return ge(this,void 0,void 0,(function*(){try{yield function(J,Z){return ge(this,void 0,void 0,(function*(){return Z.common.buildAndSendPacket({servcmd:"openim.msgreaded",data:J})}))}({C2CMsgReaded:{Cookie:"",C2CMsgReadedItem:[{To_Account:J.replace("C2C",""),LastedMsgTime:Z,Receipt:1}]}},this._core),console.log(`${this._name}._setC2CMessageRead ok, lastReadTime:${Z}`),Xu.markMessageAsRead({conversationID:J,lastReadTime:Z}),Xu.updateUnreadCount(J)}catch(J){throw console.warn(`${this._name}._setC2CMessageRead fail:`,J),J}}))}_setGroupMessageRead(J,Z){return ge(this,void 0,void 0,(function*(){try{yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,lastMessageSequence:ne}=J,se={GroupId:ee,MsgReadedSeq:ne};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.msg_read_report",data:se})}))}({groupID:J.replace("GROUP",""),lastMessageSequence:Z},this._core),console.log(`${this._name}._setGroupMessageRead ok, lastReadSequence:${Z}`),Xu.markMessageAsRead({conversationID:J,lastReadSequence:Z}),Xu.updateUnreadCount(J)}catch(J){throw console.warn(`${this._name}._setGroupMessageRead fail:`,J),J}}))}_shouldSetAllMessageRead(J){const{OuterConstant:{CONV_C2C:Z,CONV_GROUP:ee,READ_ALL_MSG:ne,READ_ALL_C2C_MSG:se,READ_ALL_GROUP_MSG:re}}=this._core,{type:ae,scope:le,unreadCount:pe}=J;return!(pe<=0||(ae!==Z||![ne,se].includes(le))&&(ae!==ee||![ne,re].includes(le)))}},rl=new class{constructor(){this._name="PinConversation"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"pinConversation",context:this})}handleConversationPinned(J,Z){const{utils:{isArray:ee}}=this._core;if(!ee(J))return;const{OuterConstant:ne}=this._core;let se=!1;J.forEach((J=>{const{Type:ee,Peer_Account:re,GroupId:ae}=J;let le;1===ee?le=Xu.getLocalConversation(`${ne.CONV_C2C}${re}`):2===ee&&(le=Xu.getLocalConversation(`${ne.CONV_GROUP}${ae}`)),le&&(console.log(`${this._name}.handleConversationPinned conversationID:${le.conversationID} localPinned:${le.isPinned} remotePinned:${Z}`),Z&&!le.isPinned&&(le.isPinned=!0,se=!0),!Z&&le.isPinned&&(le.isPinned=!1,se=!0))})),se&&Xu.emitConversationListUpdate(!0)}pinConversation(J){return ge(this,void 0,void 0,(function*(){const{OuterConstant:Z,common:ee,helper:{ChatError:ne}}=this._core,{conversationID:se,isPinned:re}=J,ae={code:0,data:{conversationID:se}},le=Xu.getLocalConversation(se);if(le&&le.isPinned===re)return ae;if(ta(se))return le&&(le.isPinned=re),Xu.emitConversationListUpdate(!0),ae;const pe=`conversationID:${se} isPinned:${re}`;try{let J=null;Zr(se)?J={Type:1,To_Account:se.replace(Z.CONV_C2C,"")}:ea(se)&&(J={Type:2,GroupId:se.replace(Z.CONV_GROUP,"")});const ne=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{fromAccount:ee,operationType:ne,itemList:se}=J,re={From_Account:ee,OperationType:ne,RecentContactItem:se};return Z.common.buildAndSendPacket({servcmd:"recentcontact.top",data:re})}))}({fromAccount:ee.getCurrentUserID(),operationType:!0===re?1:2,itemList:[J]},this._core);if(ne){if(le)le.isPinned!==re&&(le.isPinned=re);else{const J=new ra({conversationID:se,type:Zr(se)?Z.CONV_C2C:Z.CONV_GROUP,isPinned:re});Xu.setLocalConversation(se,J)}Xu.emitConversationListUpdate(!0)}return Object.assign(Object.assign({},ae),{successLog:{message:pe}})}catch(J){const{errorCode:Z,errorInfo:ee}=J;throw new ne({functionName:"pinConversation",code:Z,message:ee,moreMessage:pe})}}))}},ol=new class{constructor(){this._name="DeleteConversation"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"deleteConversation",context:this})}handleConversationDeleted(J){const{utils:{isArray:Z}}=this._core;if(!Z(J))return;const{OuterConstant:ee}=this._core,ne=[];J.forEach((J=>{const{Type:Z,Peer_Account:se,GroupId:re}=J;1===Z&&ne.push(`${ee.CONV_C2C}${se}`),2===Z&&ne.push(`${ee.CONV_GROUP}${re}`)})),console.log(`${this._name}.handleConversationDeleted conversationIDList:${ne}`),this._deleteLocalConversationList(ne)}deleteConversation(J){return ge(this,void 0,void 0,(function*(){const{utils:{isString:Z}}=this._core;if(Z(J))return void(yield this._deleteConversation({conversationIDList:[J],flag:Ju.ONLY_CONVERSATIONID}));const ee=Object.assign({},J);ee.conversationIDList.length>100&&(ee.conversationIDList=ee.conversationIDList.slice(0,100)),yield this._deleteConversation(ee)}))}_deleteConversation(J){return ge(this,void 0,void 0,(function*(){const{conversationIDList:Z,clearHistoryMessage:ee=!0,flag:ne=0}=J,{helper:{ChatError:se}}=this._core,re=`conversationIDList:${Z} clearHistoryMessage:${ee}`;try{const J=yield Promise.all([this._deleteConversationFromLocal(Z),this._deleteConversationFromServer(Z,ee)]),se=[...J[0],...J[1]];if(0===se.length)throw new this._core.helper.ChatError({code:Zu.CONV_NOT_FOUND});return{code:0,data:ne===Ju.ONLY_CONVERSATIONID?{conversationID:se[0]}:{conversationIDList:se},successLog:{message:re}}}catch(J){const{errorCode:Z,errorInfo:ee}=J;throw new se({code:Z,message:ee,moreMessage:re})}}))}_deleteConversationFromLocal(J){const{OuterConstant:Z}=this._core;return J.filter((J=>{var ee;if(!Xu.hasLocalConversation(J))return!1;const ne=null===(ee=Xu.getLocalConversation(J))||void 0===ee?void 0:ee.type;return ne!==Z.CONV_GROUP||this._hasLocalGroup(J)?ne===Z.CONV_SYSTEM&&(this._deleteLocalConversation(J),!0):(this._deleteLocalConversation(J),!0)}))}_deleteConversationFromServer(J,Z){return ge(this,void 0,void 0,(function*(){const{OuterConstant:ee,common:ne}=this._core,se={fromAccount:ne.getCurrentUserID(),conversationList:[],clearHistoryMessage:Z?1:0};if(J.forEach((J=>{var Z;if(Xu.hasLocalConversation(J)){const ne=(null===(Z=Xu.getLocalConversation(J))||void 0===Z?void 0:Z.type)||"",re=J.replace(ne,"");ne===ee.CONV_C2C?se.conversationList.push({To_Account:re,Type:1}):ne===ee.CONV_GROUP&&this._hasLocalGroup(J)&&se.conversationList.push({ToGroupid:re,Type:2})}})),0===se.conversationList.length)return[];const re=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{fromAccount:ee,conversationList:ne,clearHistoryMessage:se}=J,re={From_Account:ee,ContactItem:ne,ClearRamble:se};return Z.common.buildAndSendPacket({servcmd:"recentcontact.batch_delete",data:re})}))}(se,this._core);if(re){const{ResultItem:J=[]}=re,Z=[];return J.length>0&&J.forEach((J=>{if(0===J.ResultCode){const ne=1===J.Type?`${ee.CONV_C2C}${J.To_Account}`:`${ee.CONV_GROUP}${J.ToGroupid}`;Z.push(ne)}})),this._deleteLocalConversationList(Z),Z}return[]}))}_deleteLocalConversationList(J){let Z=!1;J.forEach((J=>{Xu.hasLocalConversation(J)&&(this._deleteLocalConversation(J,!1),Z=!0)})),console.log(`${this._name}._deleteLocalConversationList isUpdate:${Z}`),Z&&Xu.emitConversationListUpdate()}_deleteLocalConversation(J,Z=!0){const ee=Xu.hasLocalConversation(J);console.log(`${this._name}._deleteLocalConversation conversationID:${J} has:${ee}`),ee&&(Xu.deleteLocalConversation(J),this._deleteConversationLocalMessage(J),Z&&Xu.emitConversationListUpdate())}_hasLocalGroup(J){const{OuterConstant:{CONV_GROUP:Z},appStore:{groupStore:ee}}=this._core,ne=J.replace(Z,"");return!!ee.getGroup(ne)}_deleteConversationLocalMessage(J){console.log(`${this._name}._deleteConversationLocalMessage conversationID:${J}`),this._core.message.messageDataHandler.deleteConversationMessageList(J),this._core.message.messageHistory.completedHistoryConversations.delete(J)}},al=new class{constructor(){this._name="SetConversationDraft"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"setConversationDraft",context:this})}setConversationDraft(J){return ge(this,void 0,void 0,(function*(){const{conversationID:Z,draftText:ee}=J;if(console.log(`${this._name} conversationID:${Z} draftText:${ee}`),!Xu.hasLocalConversation(Z))throw new this._core.helper.ChatError({code:Zu.CONV_NOT_FOUND});const ne=Xu.getLocalConversation(Z);return null==ne||ne.setDraftText(ee),Xu.emitConversationListUpdate(),{code:0,data:{conversation:ne}}}))}},_l=new class{constructor(){this._name="SetC2CMessageRemindType"}init(J){this._core=J}set(J,Z){return ge(this,void 0,void 0,(function*(){J.length>30&&(console.warn(`${this._name}.set userIDList length:${J.length} exceeds limit 30`),J.splice(30));const ee=function(){const{MSG_REMIND_ACPT_AND_NOTE:J,MSG_REMIND_DISCARD:Z,MSG_REMIND_ACPT_NOT_NOTE:ee}=Yu.core.OuterConstant;return{[J]:0,[Z]:1,[ee]:2}}()[Z],ne=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{userIDList:ee,receiveMessageOption:ne}=J,se={Peer_Account:ee,Mute_Notifications:ne};return Z.common.buildAndSendPacket({servcmd:"openim.set_c2c_peer_mute_notifications",data:se})}))}({userIDList:J,receiveMessageOption:ee},this._core),{ErrorList:se=[]}=ne||{},re=[];se.forEach((Z=>{const{Peer_Account:ee,ErrorCode:ne}=Z;re.push({userID:ee,code:ne});const se=J.indexOf(ee);se>-1&&J.splice(se,1)}));const ae=[],le=[],{OuterConstant:pe}=this._core;return J.forEach((J=>{le.push(`${pe.CONV_C2C}${J}`),ae.push({userID:J})})),Xu.patchMessageRemindType(le,Z),{code:0,data:{successUserIDList:ae,failureUserIDList:re}}}))}},yl=new class{constructor(){this._name="SetGroupMessageRemindType"}init(J){this._core=J}set(J,Z){return ge(this,void 0,void 0,(function*(){const{common:{getCurrentUserID:ee,isTopic:ne},OuterConstant:se}=this._core;if(yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,userID:ne,receiveMessageOption:se}=J,re={GroupId:ee,Member_Account:ne,MsgFlag:se};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.modify_group_member_info",data:re})}))}({groupID:J,userID:ee(),receiveMessageOption:Z},this._core),!ne(J)){const ee=`${se.CONV_GROUP}${J}`;Xu.patchMessageRemindType([ee],Z)}return{code:0,data:{groupID:J,messageRemindType:Z}}}))}},Sl=new class{constructor(){this._name="SetMessageRemindType"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"setMessageRemindType",context:this})}handleC2CMessageRemindTypeSync(J){const{helper:{isEmpty:Z},OuterConstant:ee,ssoLog:ne}=this._core;J.forEach((J=>{const{MuteNotificationsSync:se}=J;if(!Z(se)){const{To_Account:J,MuteNotifications:Z}=se,re=J.map((J=>`${ee.CONV_C2C}${J}`)),ae=na(Z);ne.debug(`${this._name}.handleC2CMessageRemindTypeSync conversationIDList:${re} messageRemindType:${ae}`),Xu.patchMessageRemindType(re,ae)}}))}setMessageRemindType(J){return ge(this,void 0,void 0,(function*(){const Z="setMessageRemindType",{groupID:ee,userIDList:ne,messageRemindType:se}=J,{helper:re,utils:{isUndefined:ae},ssoLog:le}=this._core;try{if(!ae(ee))return le.debug(`${this._name}.${Z} groupID:${ee} messageRemindType:${se}`),yield yl.set(ee,se);if(!ae(ne))return le.debug(`${this._name}.${Z} userIDList:${ne} messageRemindType:${se}`),yield _l.set(ne,se);throw new re.ChatError({functionName:Z,message:"userIDList or groupID is required"})}catch(J){const ee=new re.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo});throw console.error(`${this._name}.${Z} fail:`,ee),ee}}))}},El=new class{init(J){J.ssoLog.debug("ConversationAction.init"),this._core=J,Qu.init(J),nl.init(J),sl.init(J),il.init(J),rl.init(J),ol.init(J),al.init(J),Sl.init(J);const{notificationCenter:Z,InnerEvent:{MESSAGE_PUSH:ee,DESTROY:ne}}=this._core,{InnerEventSubType:{CONV_MODIFIED:se,C2C_MESSAGE_READ_SYNC:re,GROUP_MESSAGE_READ_SYNC:ae,C2C_REMIND_TYPE_SYNC:le}}=Z;Z.subscribeInnerEvent(ee,se,this._onConversationModified,this),Z.subscribeInnerEvent(ee,re,this._onC2CMessageReadSync,this),Z.subscribeInnerEvent(ee,le,this._onC2CMessageRemindTypeSync,this),Z.subscribeInnerEvent(ee,ae,this._onGroupMessageReadSync,this),Z.subscribeInnerEvent(ne,this._dispose,this)}_onConversationModified(J){const{constants:{ConvModifyPushType:Z}}=this._core,{RecentContactMod:ee=[]}=J;ee.forEach((J=>{const{PushType:ee}=J;if(ee===Z.CONV_DELETED){const{RecentContactList:Z}=J.RecentContactDeleteItem;ol.handleConversationDeleted(Z)}if(ee===Z.CONV_PINED){const{RecentContactList:Z}=J.RecentContactTopItem;rl.handleConversationPinned(Z,!0)}if(ee===Z.CONV_UNPINED){const{RecentContactList:Z}=J.RecentContactTopItem;rl.handleConversationPinned(Z,!1)}}))}_onC2CMessageReadSync(J){const{C2cNotifyMsgArray:Z=[]}=J;il.handleC2CMessageReadSync(Z)}_onC2CMessageRemindTypeSync(J){const{C2cNotifyMsgArray:Z=[]}=J;Sl.handleC2CMessageRemindTypeSync(Z)}_onGroupMessageReadSync(J){const{GroupTips:Z=[]}=J;il.handleGroupMessageReadSync(Z)}_dispose(){const{notificationCenter:J,InnerEvent:{MESSAGE_PUSH:Z,DESTROY:ee}}=this._core,{InnerEventSubType:{CONV_MODIFIED:ne,C2C_MESSAGE_READ_SYNC:se,GROUP_MESSAGE_READ_SYNC:re,C2C_REMIND_TYPE_SYNC:ae}}=J;J.unSubscribeInnerEvent(Z,ne,this._onConversationModified,this),J.unSubscribeInnerEvent(Z,se,this._onC2CMessageReadSync,this),J.unSubscribeInnerEvent(Z,ae,this._onC2CMessageRemindTypeSync,this),J.unSubscribeInnerEvent(Z,re,this._onGroupMessageReadSync,this),J.unSubscribeInnerEvent(ee,this._dispose,this)}},Cl=new class{init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"setAllReceiveMessageOpt",context:this})}setAllReceiveMessageOpt(J){return ge(this,void 0,void 0,(function*(){try{const{OuterConstant:{MSG_REMIND_ACPT_NOT_NOTE:Z}}=this._core,{messageRemindType:ee=Z,isRepeated:ne=!0}=J,{startTime:se=0,endTime:re=0}=this._calcStartAndEndTime(J),ae=yield function(J){return ge(this,void 0,void 0,(function*(){const{common:Z}=Yu.core,{startTime:ee,endTime:ne,isRepeated:se,messageRemindType:re}=J,ae={StartTime:ee,EndTime:ne,IsRepeated:se,Level:re};return Z.buildAndSendPacket({servcmd:"im_msg_db_logic.ws_set_do_not_disturb",data:ae})}))}({messageRemindType:this._getType(ee),startTime:se,endTime:re,isRepeated:ne?zu.ON:zu.OFF});return{code:0,data:{errorCode:ae.ErrorCode,errorInfo:ae.ErrorInfo}}}catch(J){ia("setAllReceiveMessageOpt",J)}}))}_calcStartAndEndTime(J){const{startHour:Z=0,startMinute:ee=0,startSecond:ne=0,duration:se=0,isRepeated:re=!0}=J,ae=new Date,le=new Date(ae.getFullYear(),ae.getMonth(),ae.getDate(),Z,ee,ne),pe=Math.round(le.getTime()/1e3);let _e=pe+se;return re&&se>=86400&&(_e=pe+86400),{startTime:pe,endTime:_e}}_getType(J){const{OuterConstant:Z}=this._core;return{[Z.MSG_REMIND_ACPT_AND_NOTE]:0,[Z.MSG_REMIND_DISCARD]:1,[Z.MSG_REMIND_ACPT_NOT_NOTE]:2}[J]}},Ml=new class{init(J){this._core=J;const{helper:Z,notificationCenter:ee,InnerEvent:ne}=J;Z.registerApi({apiName:"getAllReceiveMessageOpt",context:this}),ee.subscribeInnerEvent(ne.MESSAGE_PUSH,ee.InnerEventSubType.ALL_RECEIVE_MESSAGE_OPTION,this.onAllReceiveMsgOptionNotify,this)}onAllReceiveMsgOptionNotify(J){const Z=this._handleResult(J),{notificationCenter:ee,OuterEvent:{ALL_RECEIVE_MESSAGE_OPT_UPDATED:ne}}=this._core;ee.emitOuterEvent(ne,{name:ne,data:Z})}getAllReceiveMessageOpt(){return ge(this,void 0,void 0,(function*(){try{const J=yield function(){return ge(this,void 0,void 0,(function*(){const{common:J}=Yu.core,Z={To_Account:J.getCurrentUserID()};return J.buildAndSendPacket({servcmd:"im_msg_db_logic.ws_get_do_not_disturb",data:Z})}))}();return{code:0,data:this._handleResult(J)}}catch(J){ia("getAllReceiveMessageOpt",J)}}))}_handleResult(J){const{OuterConstant:Z}=this._core,{MSG_REMIND_ACPT_AND_NOTE:ee,MSG_REMIND_DISCARD:ne,MSG_REMIND_ACPT_NOT_NOTE:se}=Z,re={0:ee,1:ne,2:se},{Level:ae,StartTime:le,EndTime:pe,IsRepeated:_e}=J;return{messageRemindType:re[ae]||ee,startTime:le,endTime:pe,isRepeated:_e===zu.ON}}},bl=new class{init(J){J.ssoLog.debug("ReceiveMessageOptions.init"),this._core=J,_l.init(J),yl.init(J),el.init(J),tl.init(J),Cl.init(J),Ml.init(J)}};const Da=J=>!Zr(J)&&!ea(J)&&!ta(J),Tl={getConversationProfile:[{key:"conversationID",required:!0,rules:["string"],allowEmpty:!1,customValidator:J=>!Da(J)||"conversationID is invalid."}],setMessageRead:{conversationID:{required:!0,rules:["string"],allowEmpty:!1,customValidator:J=>!Da(J)||"conversationID is invalid."}},pinConversation:{conversationID:{required:!0,rules:["string"],allowEmpty:!1,customValidator:J=>!Da(J)||"conversationID is invalid."},isPinned:{required:!0,rules:["boolean"],allowEmpty:!1}},deleteConversation:[{key:"options",required:!0,rules:["string","object"],allowEmpty:!1,customValidator:J=>{const{core:{utils:{isArray:Z,isObject:ee,isString:ne}}}=Yu;if(!ne(J)&&!ee(J))return"options is String or Object.";if(ne(J)&&Da(J))return"conversationID is invalid.";if(ee(J)){if(!Z(J.conversationIDList))return"conversationIDList is not Array.";if(0===J.conversationIDList.length)return"conversationIDList is empty.";if(J.conversationIDList.some((J=>{if(Da(J))return!0})))return"conversationIDList includes invalid conversationID.";if(J.clearHistoryMessage&&"boolean"!=typeof J.clearHistoryMessage)return"clearHistoryMessage is not Boolean."}return!0}}],setConversationDraft:{conversationID:{required:!0,rules:["string"],allowEmpty:!1,customValidator:J=>!(!Zr(J)&&!ea(J))||"conversationID is invalid."},draftText:{required:!0,rules:["string"],allowEmpty:!0}},setAllReceiveMessageOpt:{messageRemindType:{required:!1,rules:["string"],allowEmpty:!0},startHour:{required:!1,rules:["number"],allowEmpty:!0},startMinute:{required:!1,rules:["number"],allowEmpty:!0},startSecond:{required:!1,rules:["number"],allowEmpty:!0},duration:{required:!1,rules:["number"],allowEmpty:!0},isRepeated:{required:!1,rules:["boolean"],allowEmpty:!0}}},Al={getConversationList:!0,getConversationProfile:!0,getTotalUnreadCount:!0,setMessageRead:!0,pinConversation:!0,deleteConversation:!0,setConversationDraft:!0,setMessageRemindType:!0,getAllReceiveMessageOpt:!0,setAllReceiveMessageOpt:!0};var Ol=new class{constructor(){this.name="Conversation"}install(J){Yu.init(J),El.init(J),bl.init(J),Xu.init(J),J.helper.registerValidateConfig({auth:Al,params:Tl})}};const wl=new class{init(J){this.core=J}},Rl="AVChatRoom",Dl="GRP_COUNTER",Nl=["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption","LastRecallTime"],Ll=["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"],kl=["Role","JoinTime","MsgFlag","MsgSeq"],Pl=["Role","JoinTime","MsgSeq","MsgFlag","NameCard"],Ul="notStart",Gl="resolved",xl="rejected",Fl=["Owner","Admin","Member"],Bl=["Role","JoinTime","NameCard","ShutUpUntil","OnlineStatus"],ql={from:!0,groupID:!0,groupName:!0,to:!0},Vl={from:!0,groupID:!0,groupName:!0,to:!0,type:!0},$l=2687,Bc=J=>J===wl.core.OuterConstant.GRP_PUBLIC,jc=J=>J===wl.core.OuterConstant.GRP_AVCHATROOM,Hc=(J,Z)=>{const{isArray:ee}=wl.core.utils;if(!ee(J)||!ee(Z))return!1;let ne=!1;return Z.forEach((({key:Z,value:ee})=>{const se=J.find((J=>J.key===Z));se?se.value!==ee&&(se.value=ee,ne=!0):(J.push({key:Z,value:ee}),ne=!0)})),ne},Kc=J=>{const Z=[];if(!J)return Z;for(let ee=0,ne=J.length;ee<ne;ee++){const{Key:ne,Value:se}=J[ee];Z.push({key:ne,value:se})}return Z},Wc=J=>{const Z=[];for(let ee=0,ne=J.length;ee<ne;ee++){const{key:ne,value:se}=J[ee];Z.push({Key:ne,Value:se})}return Z};function Yc(J,Z){const{helper:ee}=wl.core;if(!ee.checkBusinessCapabilityBits(Z))throw new ee.ChatError({functionName:J,code:3122,replacement1:J})}function zc(J,Z){const{helper:ee}=wl.core,ne=new ee.ChatError({functionName:J,code:(null==Z?void 0:Z.errorCode)||(null==Z?void 0:Z.code),message:(null==Z?void 0:Z.errorInfo)||(null==Z?void 0:Z.message)});throw console.error(`${J} fail:`,ne),ne}const jl=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberCount","maxMemberCount","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime","_groupAtInfoList"];class Qc{constructor(J){this.groupID="",this.name="",this.avatar="",this.type="",this.introduction="",this.notification="",this.ownerID="",this.createTime=0,this.selfInfo={messageRemindType:"",joinTime:"",nameCard:"",role:"",userID:"",memberCustomField:void 0,readedSequence:0,excludedUnreadSequenceList:void 0},this.lastMessage={lastTime:0,lastSequence:0,fromAccount:"",messageForShow:""},this.nextMessageSeq=0,this.memberCount=0,this.maxMemberCount=0,this.joinOption="",this.inviteOption="",this.groupCustomField=[],this.muteAllMembers=!1,this.isSupportTopic=!1,this._lastRevokedTime=0,this._groupAtInfoList=[],this._initGroup(J)}_initGroup(J){const{utils:{isString:Z}}=wl.core;for(const ee in J)jl.indexOf(ee)<0||("selfInfo"!==ee?"isSupportTopic"!==ee?"muteAllMembers"===ee&&Z(J[ee])?this.muteAllMembers="On"===J[ee]:this[ee]=J[ee]:this.isSupportTopic=1===J[ee]:this.updateSelfInfo(J[ee]))}updateGroup(J){const{utils:{isArray:Z,isUndefined:ee,isNumber:ne,isString:se},common:{deepMerge:re}}=wl.core;J.appid=void 0,J.grossTopicNextMsgSeq=void 0,J.selfInfo&&(J.selfInfo.grossTopicReadSeq=void 0);const ae=JSON.parse(JSON.stringify(J));ae.lastMsgTime&&(this.lastMessage.lastTime=ae.lastMsgTime),se(ae.muteAllMembers)&&(ae.muteAllMembers="On"===ae.muteAllMembers),ae.groupCustomField&&Hc(this.groupCustomField,ae.groupCustomField),ee(ae.isSupportTopic)||(this.isSupportTopic=ne(ae.isSupportTopic)?1===ae.isSupportTopic:ae.isSupportTopic),re(this,ae,["members","errorCode","lastMsgTime","groupCustomField","isSupportTopic"]),Z(ae.members)&&ae.members.length>0&&ae.members.forEach((J=>{J.userID===this.selfInfo.userID&&re(this.selfInfo,J,["sequence"])}))}updateSelfInfo(J){const{nameCard:Z,joinTime:ee,role:ne,messageRemindType:se,readedSequence:re,excludedUnreadSequenceList:ae}=J,{common:{deepMerge:le}}=wl.core;le(this.selfInfo,{nameCard:Z,joinTime:ee,role:ne,messageRemindType:se,readedSequence:re,excludedUnreadSequenceList:ae},[],["",null,void 0,0,NaN])}setSelfNameCard(J){this.selfInfo.nameCard=J}}var Kl=new class{constructor(){this._name="GroupDataHandler"}init(J){this._core=J;const{appStore:{groupStore:Z}}=J;this._groupMap=Z.getGroupMap()}hasLocalGroup(J){return this._groupMap.has(J)}getLocalGroup(J){return this._groupMap.get(J)}updateLocalGroup(J){const{common:{getCurrentUserID:Z}}=this._core;let ee;J.forEach((J=>{var Z;ee=J.groupID,this.hasLocalGroup(ee)?null===(Z=this.getLocalGroup(ee))||void 0===Z||Z.updateGroup(J):this._groupMap.set(ee,new Qc(J))}));const ne=Z();for(const[,J]of this._groupMap)J.selfInfo.userID=ne,"Owner"===J.selfInfo.role&&(J.ownerID=ne)}deleteLocalGroup(J){this._groupMap.delete(J)}getLocalGroupList(){const{OuterConstant:{GRP_ROOM:J,GRP_LIVE:Z}}=this._core;return[...this._groupMap.values()].filter((ee=>{const{type:ne}=ee;return ne!==J&&ne!==Z}))}clearLocalGroup(){this._groupMap.clear()}emitGroupListUpdate(){const J=this.getLocalGroupList(),{OuterEvent:{GROUP_LIST_UPDATED:Z},notificationCenter:ee}=this._core;ee.emitOuterEvent(Z,{name:Z,data:J})}updateConversationGroupProfile(J){const{appStore:{conversationStore:Z},OuterConstant:{CONV_GROUP:ee}}=this._core,ne=`${ee}${J}`,se=Z.getConversation(ne);if(se){const ee=this.getLocalGroup(J);se.setProfileCompleted(),Z.updateConversation(ne,{groupProfile:ee})}}reset(){this.clearLocalGroup()}};function Zc(J,Z){return ge(this,void 0,void 0,(function*(){const{type:ee,limit:ne,offset:se,supportTopic:re=0,memberAccount:ae,responseFilter:le}=J,pe={Type:ee,Limit:ne,Offset:se,Member_Account:ae,ResponseFilter:le,SupportTopic:re,NeedAppDefineData:1};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_joined_group_list",data:pe})}))}const eu=function(J,Z){return{code:0,data:J||{},successLog:Z}};var Wl=new class{constructor(){this._name="GetGroupList",this._pagingStatus=Ul,this.PAGING_GRP_COUNT_LIMIT=200}init(J){this._core=J;const{helper:Z,constants:{WORKFLOW_NAME:ee,WORKFLOW_STEP:ne}}=J;Z.registerApi({apiName:"getGroupList",context:this}),Z.registerWorkflowStep(ee.SYNC_SERVER_INFO_AFTER_LOGIN,ne.GROUP_LIST_SYNC,this._syncGroupList,this)}getGroupList(){return ge(this,arguments,void 0,(function*(J=!1){if(J){const J=[];return yield this._pagingGetJoinedCommunityList({limit:this.PAGING_GRP_COUNT_LIMIT,offset:0,groupList:J}),Kl.updateLocalGroup(J),Kl.getLocalGroupList()}if(this._core.ssoLog.debug("getGroupList",`${this._name}.getGroupList pagingStatus:${this._pagingStatus}`),this._pagingStatus===xl||this._pagingStatus===Ul)return this._syncGroupList().then((()=>{const J=Kl.getLocalGroupList();return eu({groupList:J,isSyncCompleted:this._isSyncCompleted()})})).catch((J=>{throw J}));const Z=Kl.getLocalGroupList();return eu({groupList:Z,isSyncCompleted:this._isSyncCompleted()},{message:`return group count:${Z.length}`})}))}_syncGroupList(){return ge(this,void 0,void 0,(function*(){this._pagingStatus===Ul&&Kl.clearLocalGroup();const J=this.PAGING_GRP_COUNT_LIMIT,Z=[];try{yield this._pagingGetGroupList({limit:J,offset:0,groupList:Z}),this._pagingStatus=Gl,this._groupListTreeShaking(Z),Kl.updateLocalGroup(Z);const ee=Kl.getLocalGroupList();return this._core.ssoLog.debug("_syncGroupList",`${this._name}._syncGroupList ok, count:${ee.length}`),Kl.emitGroupListUpdate(),ee}catch(J){throw this._pagingStatus=xl,J}}))}_pagingGetGroupList(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z}=this._core,{isCommunityRelay:ee=!1,groupList:ne}=J;let se,{limit:re,offset:ae}=J;const le=[...Nl];ee&&(se=this._core.OuterConstant.GRP_COMMUNITY,le.push("AtInfoList"));try{const J=yield Zc({type:se,limit:re,offset:ae,memberAccount:this._core.store.get("login").userId,responseFilter:{GroupBaseInfoFilter:le,SelfInfoFilter:[...kl]}},this._core),{GroupIdList:pe=[],TotalCount:_e=0}=J||{},ve=this._convertGroupKey(pe);ne.push(...ve);const ye=ae+re,Fe=!(_e>ye),qe=`offset:${ae} limit:${re} total:${_e} isCompleted:${Fe} current:${ne.length} isCommunityRelay:${ee}`;return Z.debug("_pagingGetGroupList",`${this._name}._pagingGetGroupList ok. ${qe}`),ee?Fe?ne:(ae=ye,this._pagingGetGroupList({isCommunityRelay:!0,limit:re,offset:ae,groupList:ne})):Fe?(Z.debug("_pagingGetGroupList",`${this._name}._pagingGetGroupList start to get community list`),ae=0,this._pagingGetGroupList({isCommunityRelay:!0,limit:re,offset:ae,groupList:ne})):(ae=ye,this._pagingGetGroupList({limit:re,offset:ae,groupList:ne}))}catch(J){if(10018===J.ErrorCode)return Z.warn("_pagingGetGroupList",`${this._name}._pagingGetGroupList response size exceeds the limit, request count:${re}`),re=50,this._pagingGetGroupList({isCommunityRelay:ee,limit:re,offset:ae,groupList:ne});if(ee)return 11e3===J.code&&Z.debug("_pagingGetGroupList",`${this._name}._pagingGetGroupList ok. community unavailable`),ne;throw J}}))}_pagingGetJoinedCommunityList(J){return ge(this,void 0,void 0,(function*(){const{common:{getCurrentUserID:Z},OuterConstant:ee,ssoLog:ne}=this._core,{groupList:se}=J;let{limit:re,offset:ae}=J;try{const J=yield Zc({limit:re,offset:ae,type:ee.GRP_COMMUNITY,memberAccount:Z(),supportTopic:1,responseFilter:{GroupBaseInfoFilter:[...Nl],SelfInfoFilter:[...kl]}},this._core),{GroupIdList:le=[],TotalCount:pe=0}=J||{},_e=this._convertGroupKey(le);se.push(..._e);const ve=ae+re,ye=!(pe>ve),Fe=`offset:${ae} limit:${re} total:${pe} isCompleted:${ye} current:${se.length}`;return ne.debug("_pagingGetJoinedCommunityList",`${this._name}._pagingGetJoinedCommunityList ok. ${Fe}`),ye?se:(ae=ve,this._pagingGetJoinedCommunityList({limit:re,offset:ae,groupList:se}))}catch(J){if(10018===J.code)return ne.warn("_pagingGetJoinedCommunityList",`${this._name}._pagingGetJoinedCommunityList response size exceeds the limit, request count:${re}`),re=50,this._pagingGetJoinedCommunityList({limit:re,offset:ae,groupList:se});throw J}}))}_groupListTreeShaking(J){const Z=new Map([...Kl.getLocalGroupList()]);for(let ee=0,ne=J.length;ee<ne;ee++)Z.delete(J[ee].groupID);const ee=[...Z.keys()];for(let J=0,Z=ee.length;J<Z;J++)Kl.deleteLocalGroup(ee[J])}_isSyncCompleted(){return this._pagingStatus===Gl}_convertGroupKey(J){const Z=[];for(let ee=0,ne=J.length;ee<ne;ee++){const{AppDefinedData:ne,ApplyJoinOption:se,CreateTime:re,FaceUrl:ae,GroupId:le,Introduction:pe,InviteJoinOption:_e,LastInfoTime:ve,LastMsgTime:ye,MemberNum:Fe,MaxMemberNum:qe,MuteAllMember:$e,Name:He,NextMsgSeq:Ye,Notification:Je,Owner_Account:Xe,Type:Qe,LastRecallTime:tt,SelfInfo:nt,AtInfoList:it=[],SupportTopic:ot}=J[ee],pt=Kc(ne),mt=this._convertSelfInfo(nt),It=this._convertAtInfoList(le,it);Z.push({groupCustomField:pt,joinOption:se,createTime:re,avatar:ae,groupID:le,introduction:pe,inviteOption:_e,lastInfoTime:ve,lastMsgTime:ye,memberCount:Fe,maxMemberCount:qe,muteAllMembers:$e,name:He,nextMessageSeq:Ye,notification:Je,ownerID:Xe,type:Qe,selfInfo:mt,_lastRevokedTime:tt,_groupAtInfoList:It,isSupportTopic:ot})}return Z}_convertSelfInfo(J){const{JoinTime:Z,MsgFlag:ee,MsgSeq:ne,NoUnreadSeqList:se,Role:re}=J;return{joinTime:Z,messageRemindType:ee,readedSequence:ne,excludedUnreadSequenceList:se,role:re}}_convertAtInfoList(J,Z){if(0===Z.length)return[];const ee=[];return Z.forEach((Z=>{const{AtFlagList:ne,AtMsgSeq:se,From_Account:re}=Z;ee.push({groupID:J,groupAtType:ne,sequence:se,from:re})})),ee}},Yl=new class{constructor(){this._name="CreateGroup"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"createGroup",context:this})}createGroup(J){return ge(this,void 0,void 0,(function*(){var Z;this._preCheckParams(J);const{helper:{ChatError:ee}}=this._core;try{const{utils:{isEmpty:ee},common:{getCurrentUserID:ne}}=this._core,se=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{name:ee,type:ne,groupID:se,introduction:re,notification:ae,avatar:le,maxMemberNum:pe,joinOption:_e,inviteOption:ve,memberList:ye,groupCustomField:Fe,isSupportTopic:qe}=J;let $e;ye&&($e=ye.map((J=>{const{userID:Z,memberCustomField:ee}=J;return{Member_Account:Z,AppMemberDefinedData:ee?Wc(ee):void 0}})));const He={Name:ee,Type:ne,GroupId:se,Introduction:re,Notification:ae,FaceUrl:le,MaxMemberCount:pe,ApplyJoinOption:_e,InviteJoinOption:ve,MemberList:$e,AppDefinedData:Fe,SupportTopic:qe,webPushFlag:1};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.create_group",data:He})}))}(Object.assign(Object.assign({},J),{ownerID:ne()}),this._core),{GroupId:re,OverJoinedGroupLimit_Account:ae=[]}=se||{},le=`${this._name}.createGroup ok, type:${J.type} groupID:${re} overLimitUserIDList:${ae}`;ee(J.memberList)||ee(ae)||(J.memberList=null===(Z=J.memberList)||void 0===Z?void 0:Z.filter((J=>ae.includes(J.userID)))),Kl.updateLocalGroup([Object.assign(Object.assign({},J),{groupID:re})]);const pe=Kl.getLocalGroup(re);return this._notNeedSendCustomMessage(J)||(this._sendCustomMessage(re,J.type),Kl.emitGroupListUpdate()),eu({group:pe},{message:le})}catch(Z){const{errorCode:ne,errorInfo:se}=Z;throw new ee({functionName:"createGroup",code:ne,message:se,moreMessage:` groupID:${J.groupID}`})}}))}_preCheckParams(J){const{type:Z,groupID:ee}=J,{utils:{isEmpty:ne,isUndefined:se},common:{isCommunity:re}}=this._core,ae=!ne(ee);if(!(()=>{const{GRP_PUBLIC:J,GRP_WORK:Z,GRP_MEETING:ee,GRP_AVCHATROOM:ne,GRP_COMMUNITY:se}=wl.core.OuterConstant;return[J,Z,ee,ne,se]})().includes(Z))throw new this._core.helper.ChatError({code:2600});if(!re({type:Z})){if(ae&&re({groupID:ee}))throw new this._core.helper.ChatError({code:2602});se(J.isSupportTopic)||(J.isSupportTopic=void 0)}if(this._canIUseMemberList(Z)||se(J.memberList)||(J.memberList=void 0),this._canIUseJoinOption(Z)||se(J.joinOption)||(J.joinOption=void 0),re({type:Z})){if(ae&&!re({groupID:ee}))throw new this._core.helper.ChatError({code:2602});J.isSupportTopic=this._canIUseTopic(J)?1:0}}_canIUseMemberList(J){return!jc(J)}_canIUseJoinOption(J){return Bc(J)||this._core.common.isCommunity({type:J})}_canIUseTopic(J){const{isSupportTopic:Z}=J;return!0===Z}_notNeedSendCustomMessage(J){const{type:Z,isSupportTopic:ee}=J,{OuterConstant:{GRP_AVCHATROOM:ne,GRP_COMMUNITY:se}}=this._core;return Z===ne||Z===se&&1===ee}_sendCustomMessage(J,Z){var ee,ne,se,re,ae,le;const{OuterConstant:pe,common:{t:_e}}=this._core;let ve=_e("CREATE_GROUP"),ye=0;Z===pe.GRP_COMMUNITY&&(ve=_e("CREATE_COMMUNITY"),ye=1);const Fe={to:J,conversationType:"GROUP",payload:{data:JSON.stringify({businessID:"group_create",content:ve,cmd:ye,opUser:this._core.store.get("login").userId,version:4})}},qe=null===(se=null===(ne=null===(ee=this._core)||void 0===ee?void 0:ee.message)||void 0===ne?void 0:ne.messageFactory)||void 0===se?void 0:se.createCustomMessage(Fe);null===(le=null===(ae=null===(re=this._core)||void 0===re?void 0:re.message)||void 0===ae?void 0:ae.messageSender)||void 0===le||le.sendMessage(qe,{})}},zl=new class{constructor(){this._name="AttributesDataHandler",this._groupAttributesCache=new Map,this._groupAttributesCacheValuesCopy={}}init(J){this._core=J;const{helper:Z,constants:ee}=J;Z.registerWorkflowStep(ee.WORKFLOW_NAME.SYNC_SERVER_INFO_AFTER_RE_ONLINE,ee.WORKFLOW_STEP.GROUP_ATTRIBUTE_CACHE_CLEAR,this.clearLocalMainSequence,this)}clearLocalMainSequence(){this._groupAttributesCache.forEach((J=>{J.localMainSequence=0}))}isGroupAttributesUpdated(J){const{elements:{newGroupProfile:Z}}=J,{utils:{isEmpty:ee,isUndefined:ne}}=this._core;return!ne(Z)&&!ee(Z.groupAttributeOption)}handleGroupAttributesUpdated(J){const{groupID:Z,groupAttributeOption:ee}=J,{serverMainSequence:ne,groupAttributeList:se=[],operation:re}=ee;this._core.ssoLog.debug("handleGroupAttributesUpdated",`${this._name}.handleGroupAttributesUpdated groupID:${Z} operation:${re}`);const{utils:{isUndefined:ae}}=this._core;ae(re)||(this.refreshGroupAttributesCache({groupID:Z,serverMainSequence:ne,groupAttributeList:se,operation:re}),this.emitGroupAttributesUpdated(Z))}initGroupAttributesCache(J){const{groupID:Z,avChatRoomKey:ee}=J;this._groupAttributesCache.set(Z,{lastUpdateTime:0,localMainSequence:0,serverMainSequence:0,avChatRoomKey:ee,values:new Map}),this._core.ssoLog.debug("initGroupAttributesCache",`${this._name}.initGroupAttributesCache. groupID:${Z} avChatRoomKey:${ee}`)}hasGroupAttributesCache(J){return this._groupAttributesCache.has(J)}getGroupAttributesCache(J){return this.hasGroupAttributesCache(J)||this.initGroupAttributesCache({groupID:J}),this._groupAttributesCache.get(J)}deleteGroupAttributesCache(J){this.hasGroupAttributesCache(J)&&this._groupAttributesCache.delete(J)}refreshGroupAttributesCache(J){const{groupID:Z,serverMainSequence:ee,groupAttributeList:ne,operation:se}=J;if(this.hasGroupAttributesCache(Z)){const J=this.getGroupAttributesCache(Z),{localMainSequence:re}=J;5!==se&&ee-re!=1||(J.serverMainSequence=ee,J.localMainSequence=ee,J.lastUpdateTime=Date.now(),this._updateGroupAttributesCacheValues({groupAttributes:J,groupAttributeList:ne,operation:se})),ee-re>1&&(J.serverMainSequence=ee),this._groupAttributesCache.set(Z,J),this._core.ssoLog.debug("refreshGroupAttributesCache",`${this._name}.refreshGroupAttributesCache. operation:${se} localMainSequence:${re} serverMainSequence:${ee}`)}}_updateGroupAttributesCacheValues(J){const{groupAttributes:Z,groupAttributeList:ee=[],operation:ne}=J;3!==ne?4!==ne?(1===ne&&Z.values.clear(),ee.forEach((J=>{const{key:ee,value:ne,sequence:se}=J;Z.values.set(ee,{value:ne,sequence:se})}))):ee.forEach((J=>{Z.values.delete(J.key)})):Z.values.clear()}getGroupAttributesCacheValues(J){var Z;const{groupID:ee,keyList:ne=[]}=J,se={};if(this.hasGroupAttributesCache(ee)){const{values:J}=this.getGroupAttributesCache(ee);if(0===ne.length){for(const ee of J.keys())se[ee]=(null===(Z=J.get(ee))||void 0===Z?void 0:Z.value)||"";return se}return ne.forEach((Z=>{var ee;J.has(Z)&&(se[Z]=(null===(ee=J.get(Z))||void 0===ee?void 0:ee.value)||"")})),se}return se}saveGroupAttributesCacheValuesCopy(J){this._groupAttributesCacheValuesCopy=this.getGroupAttributesCacheValues({groupID:J})}emitGroupAttributesUpdated(J){var Z,ee;const{OuterConstant:{GRP_ROOM:ne,GRP_LIVE:se}}=this._core,re=this.getGroupAttributesCacheValues({groupID:J}),ae=this._core.appStore.groupStore.getGroup(J),{updatedKeyList:le,deletedKeyList:pe}=this._computeValuesChangedData(re);0===le.length&&0===pe.length||([ne,se].includes(ae.type)?(this._core.ssoLog.debug("RICH_STATUS_CHANGED",`${this._name}.emitRichStatusChanged update count:${le.length}, delete count:${pe.length}`),this._emitEvent({name:null===(Z=this._core)||void 0===Z?void 0:Z.OuterEvent.RICH_STATUS_CHANGED,data:{groupID:J,richStatus:re,updatedKeyList:le,deletedKeyList:pe}})):(this._core.ssoLog.debug("emitGroupAttributesUpdated",`${this._name}.emitGroupAttributesUpdated update count:${le.length}, delete count:${pe.length}`),this._emitEvent({name:null===(ee=this._core)||void 0===ee?void 0:ee.OuterEvent.GROUP_ATTRIBUTES_UPDATED,data:{groupID:J,groupAttributes:re,updatedKeyList:le,deletedKeyList:pe}})))}_computeValuesChangedData(J){const{utils:{isUndefined:Z}}=this._core,ee=[],ne=[];return Object.keys(J).forEach((Z=>{J[Z]!==this._groupAttributesCacheValuesCopy[Z]&&ee.push(Z)})),Object.keys(this._groupAttributesCacheValuesCopy).forEach((ee=>{Z(J[ee])&&ne.push(ee)})),this._groupAttributesCacheValuesCopy={},{updatedKeyList:ee,deletedKeyList:ne}}_emitEvent(J){var Z;null===(Z=this._core)||void 0===Z||Z.notificationCenter.emitOuterEvent(J.name,J)}convertKeyValueMapToList(J){const Z=[];return Object.keys(J).forEach((ee=>{Z.push({key:ee,value:J[ee]})})),Z}reset(){this._groupAttributesCache.clear(),this._groupAttributesCacheValuesCopy={}}},Zl=new class{constructor(){this._name="DismissGroup"}init(J,Z){this._core=J;const{helper:ee}=J;ee.registerApi({apiName:"dismissGroup",context:this,matcher:()=>!Z.getInstalledSubPlugins().includes(Rl)})}dismissGroup(J){return ge(this,void 0,void 0,(function*(){const{helper:{ChatError:Z}}=this._core;try{yield function(J,Z){return ge(this,void 0,void 0,(function*(){const ee={GroupId:J};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.destroy_group",data:ee})}))}(J,this._core);const{type:Z}=Kl.getLocalGroup(J);return Kl.deleteLocalGroup(J),Kl.emitGroupListUpdate(),zl.deleteGroupAttributesCache(J),eu({groupID:J,type:Z},{message:J})}catch(J){const{errorCode:ee,errorInfo:ne}=J;throw new Z({functionName:"dismissGroup",code:ee,message:ne})}}))}},Xl=new class{constructor(){this._name="GetGroupProfile"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"getGroupProfile",context:this})}getGroupProfile(J){return ge(this,void 0,void 0,(function*(){const{groupID:Z,groupCustomFieldFilter:ee}=J,ne={groupIDList:[Z],responseFilter:{GroupBaseInfoFilter:[...Nl],AppDefinedDataFilter_Group:ee,MemberInfoFilter:[...Pl]}},{helper:{ChatError:se}}=this._core;try{const J=yield this.getGroupProfileAdvance(ne),{successGroupList:ee,failureGroupList:se}=J;if(se.length>0)throw se[0];let re;return!Kl.hasLocalGroup(Z)&&jc(ee[0].type)?re=new Qc(ee[0]):(Kl.updateLocalGroup(ee),re=Kl.getLocalGroup(Z)),re.isSupportTopic||Kl.updateConversationGroupProfile(Z),eu({group:re},{message:`groupID:${Z}`})}catch(J){const{code:Z,message:ee}=J;throw new se({functionName:"getGroupProfile",code:Z,message:ee})}}))}getGroupProfileAdvance(J){return ge(this,void 0,void 0,(function*(){const{groupIDList:Z}=J,{common:{isCommunity:ee}}=this._core,ne=Z.filter((J=>!ee({groupID:J}))),se=Z.filter((J=>ee({groupID:J})));ne.length>50&&(ne.length=50),se.length>50&&(se.length=50);const re=yield Promise.all([this._getGroupProfileAdvance(Object.assign(Object.assign({},J),{groupIDList:ne})),this._getGroupProfileAdvance(Object.assign(Object.assign({},J),{groupIDList:se,isCommunityProfile:!0}))]),ae=[],le=[];return re.forEach((J=>{ae.push(...J.successGroupList),le.push(...J.failureGroupList)})),{successGroupList:ae,failureGroupList:le}}))}_getGroupProfileAdvance(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z,utils:{isUndefined:ee}}=this._core,{isCommunityProfile:ne=!1}=J,se=he(J,["isCommunityProfile"]);if(0===se.groupIDList.length)return{successGroupList:[],failureGroupList:[]};try{const J=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupIDList:ee,responseFilter:ne}=J,se={GroupIdList:ee,ResponseFilter:ne};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_self_member_info",data:se})}))}(se,this._core),{GroupInfo:ne=[]}=J||{},re=this._convertGroupProfileKey(ne),ae=re.filter((J=>ee(J.errorCode)||0===J.errorCode)),le=re.filter((J=>J.errorCode&&0!==J.errorCode)).map((J=>({code:J.errorCode,message:J.errorInfo,data:{groupID:J.groupID}})));return Z.debug("_getGroupProfileAdvance",`${this._name}._getGroupProfileAdvance ok, groupID:${se.groupIDList.join(",")}`),{successGroupList:ae,failureGroupList:le}}catch(J){if(ne)return{successGroupList:[],failureGroupList:[]};throw J}}))}_convertGroupProfileKey(J){const Z=[];for(let ee=0,ne=J.length;ee<ne;ee++){const{AppDefinedData:ne,ApplyJoinOption:se,CreateTime:re,FaceUrl:ae,GroupId:le,InfoSeq:pe,Introduction:_e,InviteJoinOption:ve,LastInfoTime:ye,LastMsgTime:Fe,MaxMemberNum:qe,MemberNum:$e,MuteAllMember:He,Name:Ye,NextMsgSeq:Je,Notification:Xe,Owner_Account:Qe,ShutUpAllMember:tt,ShutUpUntil:nt,Type:it,MemberList:ot,ErrorCode:pt,ErrorInfo:mt}=J[ee],It=Kc(ne),St=this._convertMembers(ot);Z.push({groupCustomField:It,joinOption:se,createTime:re,avatar:ae,groupID:le,infoSequence:pe,introduction:_e,inviteOption:ve,lastInfoTime:ye,lastMsgTime:Fe,maxMemberCount:qe,memberCount:$e,muteAllMembers:He,name:Ye,nextMessageSeq:Je,notification:Xe,ownerID:Qe,shutUpAllMember:tt,muteUntil:nt,type:it,members:St,errorCode:pt,errorInfo:mt})}return Z}_convertMembers(J){if(!J)return[];const Z=[];for(let ee=0,ne=J.length;ee<ne;ee++){const{AppMemberDefinedData:ne,JoinTime:se,Member_Account:re,MsgFlag:ae,MsgSeq:le,NameCard:pe,Role:_e}=J[ee],ve=Kc(ne);Z.push({memberCustomField:ve,joinTime:se,userID:re,messageRemindType:ae,sequence:le,nameCard:pe,role:_e})}return Z}},Ql=new class{constructor(){this._groupCountersMap=new Map}init(J){this._core=J}getLocalGroupCounters(J){return this._hasLocalGroupCounters(J)||this.initGroupCountersCache({groupID:J}),this._groupCountersMap.get(J)}updateLocalGroupCounters(J){const{groupID:Z,counterList:ee=[],groupCounterSeq:ne}=J;if(this._hasLocalGroupCounters(Z)){const{counters:J,avChatRoomKey:se,groupCounterSeq:re}=this.getLocalGroupCounters(Z);if(ne>0&&ne<re)return;ee.forEach((Z=>{const{Key:ee,Value:ne=0}=Z;J.set(ee,ne)})),this._groupCountersMap.set(Z,{lastUpdateTime:Date.now(),groupCounterSeq:ne,counters:J,avChatRoomKey:se})}}initGroupCountersCache(J){const{groupID:Z,avChatRoomKey:ee}=J;this._groupCountersMap.set(Z,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:ee})}getLocalCounters(J,Z){const ee={};if(!this._hasLocalGroupCounters(J))return ee;const{counters:ne}=this.getLocalGroupCounters(J);if(Z.length>0)Z.forEach((J=>{ne.has(J)&&(ee[J]=ne.get(J))}));else for(const J of ne.keys())ee[J]=ne.get(J);return ee}deleteLocalGroupCounters(J){const{groupID:Z,counterList:ee=[],groupCounterSeq:ne}=J;if(this._hasLocalGroupCounters(Z)){const{counters:J,avChatRoomKey:se}=this.getLocalGroupCounters(Z);ee.forEach((Z=>{J.delete(Z.key)})),this._groupCountersMap.set(Z,{lastUpdateTime:Date.now(),groupCounterSeq:ne,counters:J,avChatRoomKey:se})}}setGroupCounters(J,Z){if(!this._hasLocalGroupCounters(J))return;const ee=this.getLocalGroupCounters(J),{counters:ne}=ee;let se=!1;Object.entries(Z).forEach((([J,Z])=>{ne.has(J)&&ne.get(J)!==Z&&(ne.set(J,Z),se=!0)})),se&&this._groupCountersMap.set(J,Object.assign(Object.assign({},ee),{lastUpdateTime:Date.now(),counters:ne}))}_hasLocalGroupCounters(J){return this._groupCountersMap.has(J)}reset(){this._groupCountersMap.clear()}},eh=new class{constructor(){this._name="JoinGroup"}init(J,Z){this._core=J;const{helper:ee}=J;ee.registerApi({apiName:"joinGroup",context:this,matcher:()=>!Z.getInstalledSubPlugins().includes(Rl)})}joinGroup(J){return ge(this,void 0,void 0,(function*(){const{groupID:Z}=J,{helper:{ChatError:ee},OuterConstant:ne,ssoLog:se}=this._core;try{if(Kl.hasLocalGroup(Z))try{return yield Xl.getGroupProfile({groupID:Z}),eu({status:ne.JOIN_STATUS_ALREADY_IN_GROUP,group:Kl.getLocalGroup(Z)},{message:`groupID:${Z} joinedStatus:${ne.JOIN_STATUS_ALREADY_IN_GROUP}`})}catch(ee){return se.warn("joinGroup",`${this._name}.joinGroup ${Z} was unjoined, start to join!`),Kl.deleteLocalGroup(Z),yield this._applyJoinGroup(J)}return yield this._applyJoinGroup(J)}catch(J){const{errorCode:ne,errorInfo:se}=J;throw new ee({functionName:"joinGroup",code:ne,message:se,moreMessage:`groupID:${Z}`})}}))}_applyJoinGroup(J){return ge(this,void 0,void 0,(function*(){const{OuterConstant:Z,helper:ee,ssoLog:ne}=this._core,{groupID:se}=J,re=Object.assign({},J),ae=ee.checkBusinessCapabilityBits("AV_HISTORY_MSG");ae&&(re.historyMessageFlag=1);const le=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,applyMessage:ne,historyMessageFlag:se}=J,re={GroupId:ee,ApplyMsg:ne,HugeGroupHistoryMsgFlag:se};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.apply_join_group",data:re})}))}(re,this._core),{Type:pe,JoinedStatus:_e,LongPollingKey:ve,StartSeq:ye,HugeGroupFlag:Fe,AVChatRoomKey:qe,RspMsgList:$e=[]}=le||{},He=`groupID:${se} joinedStatus:${_e} longPollingKey:${ve} startSeq:${ye} avChatRoomFlag:${Fe} canGetAVChatRoomHistoryMsg:${ae}, historyMessageCount:${$e.length}`;ne.debug("_applyJoinGroup",`${this._name}._applyJoinGroup ok, ${He}`);let Ye=new Qc({groupID:se,type:pe});if(_e===Z.JOIN_STATUS_WAIT_APPROVAL)return eu({status:Z.JOIN_STATUS_WAIT_APPROVAL,group:Ye});if(_e===Z.JOIN_STATUS_SUCCESS){try{Ye=(yield Xl.getGroupProfile({groupID:se})).data.group}catch(J){ne.warn("_applyJoinGroup",`${this._name}._applyJoinGroup getGroupProfile failed, groupID: ${se}, errorCode:${null==J?void 0:J.code}`)}return this._handleJoinResult({group:Ye,avChatRoomFlag:Fe,longPollingKey:ve,startSequence:ye,avChatRoomKey:qe,historyMessageList:$e})}throw new this._core.helper.ChatError({code:2660})}))}_handleJoinResult(J){const{group:Z,avChatRoomFlag:ee,avChatRoomKey:ne}=J;return 1===ee?(zl.initGroupAttributesCache({groupID:Z.groupID,avChatRoomKey:ne}),Ql.initGroupCountersCache({groupID:Z.groupID,avChatRoomKey:ne}),eu(J)):(Kl.updateLocalGroup([Z]),Kl.emitGroupListUpdate(),eu({status:this._core.OuterConstant.JOIN_STATUS_SUCCESS,group:Z},{message:`groupID:${Z.groupID}`}))}},th=new class{constructor(){this._name="QuitGroup"}init(J,Z){this._core=J;const{helper:ee}=J;ee.registerApi({apiName:"quitGroup",context:this,matcher:()=>!Z.getInstalledSubPlugins().includes(Rl)})}quitGroup(J){return ge(this,void 0,void 0,(function*(){if(!Kl.hasLocalGroup(J))throw new this._core.helper.ChatError({code:2623});const{helper:{ChatError:Z}}=this._core;try{yield function(J,Z){return ge(this,void 0,void 0,(function*(){const ee={GroupId:J};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.quit_group",data:ee})}))}(J,this._core);const{type:Z}=Kl.getLocalGroup(J);return Kl.deleteLocalGroup(J),Kl.emitGroupListUpdate(),zl.deleteGroupAttributesCache(J),eu({groupID:J,type:Z},{message:`groupID:${J}`})}catch(ee){const{errorCode:ne,errorInfo:se}=ee;throw new Z({functionName:"quitGroup",code:ne,message:se,moreMessage:`groupID:${J}`})}}))}},nh=new class{constructor(){this._name="SearchGroup"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"searchGroupByID",context:this})}searchGroupByID(J){return ge(this,void 0,void 0,(function*(){try{const Z=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const ee={GroupIdList:[J],GroupBasePublicInfoFilter:[...Ll]};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_public_info",data:ee})}))}(J,this._core),{GroupInfo:ee=[]}=Z||{},{AppDefinedData:ne=[],ApplyJoinOption:se,CreateTime:re,FaceUrl:ae,Introduction:le,InviteJoinOption:pe,MaxMemberNum:_e,MemberNum:ve,Name:ye,Owner_Account:Fe,Type:qe,ErrorCode:$e,ErrorInfo:He}=ee[0];if(0!==$e)throw new this._core.helper.ChatError({code:$e,message:He});const Ye=Kc(ne),Je=new Qc({groupID:J,name:ye,avatar:ae,introduction:le,joinOption:se,inviteOption:pe,maxMemberCount:_e,memberCount:ve,type:qe,ownerID:Fe,createTime:re,groupCustomField:Ye});return eu({group:Je})}catch(J){const{errorCode:Z,errorInfo:ee}=J;throw new this._core.helper.ChatError({functionName:"searchGroupByID",code:Z,message:ee})}}))}},sh=new class{constructor(){this._name="UpdateGroupProfile"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"updateGroupProfile",context:this})}updateGroupProfile(J){return ge(this,void 0,void 0,(function*(){const{groupID:Z}=J,{utils:{isUndefined:ee},ssoLog:ne,helper:se}=this._core;let re=Kl.getLocalGroup(Z);if(re){const{type:se}=re;this._canIUseJoinOption(se)||ee(J.joinOption)||(ne.warn("updateGroupProfile",`${this._name}.updateGroupProfile groupID:${Z} joinOption is unavailable for Work/Meeting/AVChatRoom`),J.joinOption=void 0)}ee(J.muteAllMembers)||(J.muteAllMembers=!0===J.muteAllMembers?"On":"Off");try{return yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,name:ne,avatar:se,introduction:re,notification:ae,muteAllMembers:le,joinOption:pe,inviteOption:_e,groupCustomField:ve}=J,ye={GroupId:ee,Name:ne,FaceUrl:se,Introduction:re,Notification:ae,ShutUpAllMember:le,ApplyJoinOption:pe,InviteJoinOption:_e,AppDefinedData:ve?Wc(ve):void 0};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.modify_group_base_info",data:ye})}))}(J,this._core),re?(re.updateGroup(J),Kl.emitGroupListUpdate()):re=new Qc(J),eu({group:re},{message:`groupID:${Z}`})}catch(J){const{errorCode:ee,errorInfo:ne}=J;throw new se.ChatError({code:ee,message:ne,moreMessage:`groupID:${Z}`})}}))}_canIUseJoinOption(J){return Bc(J)||this._core.common.isCommunity({type:J})}},ih=new class{constructor(){this._name="ChangeGroupOwner"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"changeGroupOwner",context:this})}changeGroupOwner(J){return ge(this,void 0,void 0,(function*(){const Z="changeGroupOwner",{groupID:ee,newOwnerID:ne}=J,se=Kl.getLocalGroup(ee),{helper:re,OuterConstant:ae,common:{getCurrentUserID:le}}=this._core;if((null==se?void 0:se.type)===ae.GRP_AVCHATROOM)throw new re.ChatError({functionName:Z,code:2620});if(ne===le())throw new re.ChatError({functionName:Z,code:2621});try{return yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,newOwnerID:ne}=J,se={GroupId:ee,NewOwner_Account:ne};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.change_group_owner",data:se})}))}(J,this._core),se.ownerID=ne,Kl.emitGroupListUpdate(),eu({group:se})}catch(J){throw new re.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}},rh=new class{constructor(){this._name="GetGroupOnlineMemberCount",this._onlineMemberCountMap=new Map}init(J,Z){this._core=J;const{helper:ee}=J;ee.registerApi({apiName:"getGroupOnlineMemberCount",context:this,matcher:()=>!Z.getInstalledSubPlugins().includes(Rl)})}getGroupOnlineMemberCount(J){return ge(this,void 0,void 0,(function*(){const Z="getGroupOnlineMemberCount";if(!Kl.hasLocalGroup(J))return eu({memberCount:0});const ee=Date.now();if(this._onlineMemberCountMap.has(J)){const Z=this._onlineMemberCountMap.get(J),{lastReqTime:ne=0,memberCount:se=0}=Z||{};if(ee-ne<=6e4)return eu({memberCount:se})}try{const ee=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const ee={GroupId:J};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_online_member_num",data:ee})}))}(J,this._core),{OnlineMemberNum:ne=0}=ee||{};this._onlineMemberCountMap.set(J,{lastReqTime:Date.now(),memberCount:ne});const se=`${this._name}.${Z} ok. groupID:${J} memberCount:${ne}`;return eu({memberCount:ne},{message:se})}catch(J){throw new this._core.helper.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}},oh=new class{init(J,Z){J.ssoLog.debug("GroupAction.init"),Wl.init(J),Yl.init(J),Zl.init(J,Z),eh.init(J,Z),th.init(J,Z),nh.init(J),Xl.init(J),sh.init(J),ih.init(J),rh.init(J,Z)}dismissGroup(J){return Zl.dismissGroup(J)}joinGroup(J){return eh.joinGroup(J)}quitGroup(J){return th.quitGroup(J)}getGroupOnlineMemberCount(J){return rh.getGroupOnlineMemberCount(J)}},ah=new class{constructor(){this._name="GetGroupApplicationList"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"getGroupApplicationList",context:this})}getGroupApplicationList(){return ge(this,void 0,void 0,(function*(){const J="getGroupApplicationList";try{const Z=yield Promise.all([this._getGroupApplicationList(),this._getGroupApplicationList({type:this._core.OuterConstant.GRP_COMMUNITY})]);this._core.ssoLog.debug("getGroupApplicationList",`${this._name}.${J} ok.`);const ee=this._handleGroupApplicationResult([...Z[0],...Z[1]]);return eu({applicationList:ee})}catch(Z){throw new this._core.helper.ChatError({functionName:J,code:null==Z?void 0:Z.errorCode,message:null==Z?void 0:Z.errorInfo})}}))}_getGroupApplicationList(J){return ge(this,void 0,void 0,(function*(){const{type:Z,startTime:ee=0,limit:ne=20}=J||{},{common:se}=this._core;let re;try{re=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{type:ee,startTime:ne,limit:se,handleAccount:re}=J,ae={Type:ee,StartTime:ne,Limit:se,Handle_Account:re};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_pendency",data:ae})}))}({type:Z,startTime:ee,limit:ne,handleAccount:se.getCurrentUserID()},this._core)}catch(J){if(11e3!==(null==J?void 0:J.errorCode))throw J;re={}}const{NextStartTime:ae=0,PendencyList:le=[]}=re||{};if(0===ae)return le;const pe=yield this._getGroupApplicationList(Object.assign(Object.assign({},J),{startTime:ae}));return[...le,...pe]}))}_handleGroupApplicationResult(J){const Z=[];return J.forEach((J=>{const ee=this._convertApplicationData(J),{handled:ne}=ee,se=he(ee,["handled"]);0===ne&&Z.push(se)})),Z}_convertApplicationData(J){const{Handled:Z,AddTime:ee,ApplyInviteMsg:ne,Authentication:se,FromUserNickName:re,From_Account:ae,GroupId:le,GroupName:pe,PendencyType:_e,To_Account:ve}=J;return{handled:Z,messageKey:ee,applicant:ae,applicantNick:re,groupID:le,groupName:pe,authentication:se,applicationType:_e,userID:ve,note:ne}}},hh=new class{constructor(){this._name="HandleGroupApplication"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"handleGroupApplication",context:this})}handleGroupApplication(J){return ge(this,void 0,void 0,(function*(){const{application:Z}=J,ee=this._handleParams(J);try{2===(null==Z?void 0:Z.applicationType)?yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,handleAction:ne,handleMessage:se,applicant:re,authentication:ae,invitee:le}=J,pe={GroupId:ee,HandleMsg:ne,ApprovalMsg:se,Applicant_Account:re,Authentication:ae,Invited_Account:le};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.handle_invite_join_permission_group",data:pe})}))}(ee,this._core):yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,handleAction:ne,handleMessage:se,applicant:re,authentication:ae,messageKey:le}=J,pe={GroupId:ee,HandleMsg:ne,ApprovalMsg:se,Applicant_Account:re,Authentication:ae,MsgKey:le};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.handle_apply_join_group",data:pe})}))}(ee,this._core);const J=Kl.getLocalGroup(ee.groupID);return eu({group:J})}catch(J){throw new this._core.helper.ChatError({functionName:"handleGroupApplication",code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}_handleParams(J){var Z;const{handleAction:ee,handleMessage:ne,message:se,application:re}=J;let ae,le,pe,_e,ve;if(se){const{payload:J}=se||{};ae=J.operatorID,le=null===(Z=J.groupProfile)||void 0===Z?void 0:Z.groupID,pe=J.authentication,_e=J.messageKey}else ae=(null==re?void 0:re.applicant)||"",le=(null==re?void 0:re.groupID)||"",pe=(null==re?void 0:re.authentication)||"",_e=(null==re?void 0:re.messageKey)||0;return 2===(null==re?void 0:re.applicationType)&&(ve=re.userID),{handleAction:ee,handleMessage:ne,applicant:ae,invitee:ve,groupID:le,authentication:pe,messageKey:_e}}},ph=new class{init(J){J.ssoLog.debug("GroupApplication.init"),ah.init(J),hh.init(J)}};let gh=class{constructor(J){this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this.isOnline=!1,this.updateMember(J)}updateMember(J){const{core:{utils:{isUndefined:Z},common:{deepMerge:ee}}}=wl;Z(J.muteTime)||(this.muteUntil=Math.floor((Date.now()+1e3*J.muteTime)/1e3)),Z(J.onlineStatus)||(this.isOnline="Online"===J.onlineStatus);const ne=[null,void 0,"",0,NaN];J.memberCustomField&&Hc(this.memberCustomField,J.memberCustomField),ee(this,J,["memberCustomField","marks","onlineStatus","muteTime"],ne)}};function fu(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,userID:ne,muteTime:se,role:re,nameCard:ae,memberCustomField:le}=J;let pe;le&&(pe=Wc(le));const _e={GroupId:ee,Member_Account:ne,ShutUpTime:se,Role:re,NameCard:ae,AppMemberDefinedData:pe};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.modify_group_member_info",data:_e})}))}var _h=new class{constructor(){this._name="GetGroupMemberList"}init(J,Z){this._core=J;const{helper:ee}=J;ee.registerApi({apiName:"getGroupMemberList",context:this,matcher:()=>!Z.getInstalledSubPlugins().includes(Rl)})}getGroupMemberList(J){return ge(this,void 0,void 0,(function*(){const Z="getGroupMemberList",{groupID:ee,offset:ne=0,count:se=100,role:re="",filter:ae=""}=J,le=Kl.getLocalGroup(ee),pe=se>100?100:se,_e={groupID:ee,offset:ne,limit:pe,memberRoleFilter:Fl.includes(re)?[re]:void 0,memberInfoFilter:Bl};try{const J=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{isCommunity:ee}=Z.common,{groupID:ne,offset:se,limit:re,memberRoleFilter:ae,memberInfoFilter:le}=J,pe={GroupId:ne,Limit:re,MemberRoleFilter:ae,MemberInfoFilter:le};return ee({groupID:ne})?pe.Next=String(se):pe.Offset=se,Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_member_info",data:pe})}))}(_e,this._core),{MemberList:se,MemberNum:re,Next:ae}=J||{},ve=`${this._name}.${Z} ok, totalMemberCount:${re} next:${ae}`,{utils:{isArray:ye,isEmpty:Fe},common:{isCommunity:qe}}=this._core;if(le&&(le.memberCount=re),!ye(se)||0===se.length)return eu({memberList:[],offset:0},{message:ve});let $e=ne+pe;qe({groupID:ee})&&($e=Fe(ae)?0:ae),se.length<pe&&($e=0);let He=this._convertMemberInfo(se);He=yield this._patchAvatarAndNick(He);const Ye=this._generateGroupMember(He);return eu({memberList:Ye,offset:$e},{message:ve})}catch(J){throw new this._core.helper.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}_convertMemberInfo(J){const Z=[];for(let ee=0,ne=J.length;ee<ne;ee++){const{AppMemberDefinedData:ne,JoinTime:se,Member_Account:re,OnlineStatus:ae,Role:le,ShutUpUntil:pe,NameCard:_e}=J[ee],ve=Kc(ne);Z.push({userID:re,joinTime:se,onlineStatus:ae,role:le,muteUntil:pe,memberCustomField:ve,nameCard:_e})}return Z}_patchAvatarAndNick(J){return ge(this,void 0,void 0,(function*(){var Z;const ee=J.map((J=>J.userID)),ne=yield null===(Z=this._core.user.userProfile)||void 0===Z?void 0:Z.getUserProfile({userIDList:ee}),se=(null==ne?void 0:ne.data)||[],re=new Map(se.map((J=>[J.userID,J])));return J.forEach((J=>{if(re.has(J.userID)){const{nick:Z="",avatar:ee=""}=re.get(J.userID);J.nick=Z,J.avatar=ee}})),J}))}_generateGroupMember(J){const Z=[];for(let ee=0,ne=J.length;ee<ne;ee++){const ne=new gh(J[ee]);Z.push(ne)}return Z}},bh=new class{constructor(){this._name="GetGroupMemberProfile"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"getGroupMemberProfile",context:this})}getGroupMemberProfile(J){return ge(this,void 0,void 0,(function*(){const Z="getGroupMemberProfile",{groupID:ee,userIDList:ne,memberCustomFieldFilter:se}=J,re=Kl.getLocalGroup(ee),{helper:ae,utils:{isArray:le},ssoLog:pe}=this._core;if(re&&jc(re.type))throw new ae.ChatError({functionName:Z,replacement1:Z,code:$l});ne.length>50&&(pe.warn("getGroupMemberProfile",`${this._name}.${Z} userIDList length:${ne.length} exceeds limit 50`),ne.splice(50));const _e=`userIDList length:${ne.length} groupID:${ee}`;try{const J=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,userIDList:ne,memberInfoFilter:se,memberCustomFieldFilter:re}=J,ae={GroupId:ee,Member_List_Account:ne,MemberInfoFilter:se,AppDefinedDataFilter_GroupMember:re};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_specified_group_member_info",data:ae})}))}({groupID:ee,userIDList:ne,memberCustomFieldFilter:se,memberInfoFilter:[...Bl]},this._core),{MemberList:Z}=J||{};if(!le(Z)||0===Z.length)return eu({memberList:[]});let re=this._convertMemberInfo(Z);re=yield this._getMemberAvatarAndNick(re);const ae=this._generateGroupMember(re);return eu({memberList:ae},{message:_e})}catch(J){throw new ae.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo,moreMessage:_e})}}))}_convertMemberInfo(J){const Z=[];for(let ee=0,ne=J.length;ee<ne;ee++){const{AppMemberDefinedData:ne,JoinTime:se,Member_Account:re,OnlineStatus:ae,Role:le,ShutUpUntil:pe,NameCard:_e}=J[ee],ve=Kc(ne);Z.push({userID:re,joinTime:se,onlineStatus:ae,role:le,muteUntil:pe,memberCustomField:ve,nameCard:_e})}return Z}_getMemberAvatarAndNick(J){return ge(this,void 0,void 0,(function*(){var Z;const ee=J.map((J=>J.userID)),ne=yield null===(Z=this._core.user.userProfile)||void 0===Z?void 0:Z.getUserProfile({userIDList:ee}),se=(null==ne?void 0:ne.data)||[],re=new Map(se.map((J=>[J.userID,J])));return J.forEach((J=>{if(re.has(J.userID)){const{nick:Z="",avatar:ee=""}=re.get(J.userID);J.nick=Z,J.avatar=ee}})),J}))}_generateGroupMember(J){const Z=[];for(let ee=0,ne=J.length;ee<ne;ee++){const ne=new gh(J[ee]);Z.push(ne)}return Z}},wh=new class{constructor(){this._name="AddGroupMember"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"addGroupMember",context:this})}addGroupMember(J){return ge(this,void 0,void 0,(function*(){const Z="addGroupMember",{groupID:ee,userIDList:ne}=J,se=Kl.getLocalGroup(ee),{helper:re}=this._core;if(se&&jc(se.type))throw new re.ChatError({functionName:Z,code:2661});const ae=ne.map((J=>({Member_Account:J})));try{const J=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,userIDList:ne}=J,se={GroupId:ee,MemberList:ne};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.add_group_member",data:se})}))}({groupID:ee,userIDList:ae},this._core),{MemberList:Z=[]}=J||{},{failureUserIDList:ne,successUserIDList:re,existedUserIDList:le,overLimitUserIDList:pe}=this._handleResult(Z);return eu({failureUserIDList:ne,successUserIDList:re,existedUserIDList:le,overLimitUserIDList:pe,group:se},{message:` groupID:${ee} successUserIDList:${re} failureUserIDList:${ne} existedUserIDList:${le} overLimitUserIDList:${pe}`})}catch(J){throw new re.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}_handleResult(J){const Z=[],ee=[],ne=[],se=[];return J.forEach((J=>{const{Result:re,Member_Account:ae}=J;0===re?Z.push(ae):1===re?ee.push(ae):2===re?ne.push(ae):4===re&&se.push(ae)})),{failureUserIDList:Z,successUserIDList:ee,existedUserIDList:ne,overLimitUserIDList:se}}},Nh=new class{constructor(){this._name="DeleteGroupMember"}init(J,Z){this._core=J;const{helper:ee}=J;ee.registerApi({apiName:"deleteGroupMember",context:this,matcher:()=>!Z.getInstalledSubPlugins().includes(Rl)})}deleteGroupMember(J){return ge(this,void 0,void 0,(function*(){const Z="deleteGroupMember",{groupID:ee,userIDList:ne}=J,se=Kl.getLocalGroup(ee),{helper:re,utils:{isUndefined:ae},ssoLog:le}=this._core;if(ae(se))throw new re.ChatError({functionName:Z,code:2603});ne.length>20&&(le.warn("deleteGroupMember",`${this._name}.${Z} userIDList length:${ne.length} exceeds limit 20`),ne.splice(20));try{return yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,userIDList:ne,reason:se}=J,re={GroupId:ee,MemberToDel_Account:ne,Reason:se};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.delete_group_member",data:re})}))}({groupID:ee,userIDList:ne},this._core),eu({group:se,userIDList:ne},{message:`groupID:${ee} userIDList length:${ne.length}`})}catch(J){throw new re.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}},kh=new class{constructor(){this._name="SetGroupMemberMuteTime"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"setGroupMemberMuteTime",context:this})}setGroupMemberMuteTime(J){return ge(this,void 0,void 0,(function*(){const{helper:Z}=this._core,{groupID:ee,userID:ne,muteTime:se}=J,re=` groupID:${ee} userID:${ne} muteTime:${se}`;this._preCheckSettingMuteParams(J);try{yield fu(J,this._core);const Z=Kl.getLocalGroup(ee),ae=new gh({userID:ne,muteTime:se});return eu({group:Z,member:ae},{message:re})}catch(J){throw new Z.ChatError({functionName:"setGroupMemberMuteTime",code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo,moreMessage:re})}}))}_preCheckSettingMuteParams(J){const{userID:Z}=J,{store:ee,helper:ne}=this._core;if(Z===ee.get("login").userId)throw new ne.ChatError({functionName:"setGroupMemberMuteTime",code:2685})}},Uh=new class{constructor(){this._name="SetGroupMemberRole"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"setGroupMemberRole",context:this})}setGroupMemberRole(J){return ge(this,void 0,void 0,(function*(){const Z="setGroupMemberRole",{helper:ee}=this._core,{groupID:ne,userID:se,role:re}=J,ae=`${this._name}.${Z} ok, groupID:${ne} userID:${se} role:${re}`;this._preCheckSettingRoleParams(J);try{yield fu(J,this._core);const Z=Kl.getLocalGroup(ne),ee=new gh({userID:se,role:re});return eu({group:Z,member:ee},{message:ae})}catch(J){throw new ee.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo,moreMessage:ae})}}))}_preCheckSettingRoleParams(J){var Z;const{groupID:ee,userID:ne,role:se}=J,{store:re,helper:ae,OuterConstant:le,common:{isCommunity:pe}}=this._core,_e=Kl.getLocalGroup(ee);if((null===(Z=null==_e?void 0:_e.selfInfo)||void 0===Z?void 0:Z.role)!==le.GRP_MBR_ROLE_OWNER)throw new ae.ChatError({functionName:"setGroupMemberRole",code:2681});if(ne===re.get("login").userId)throw new ae.ChatError({functionName:"setGroupMemberRole",code:2684});const ve=[...Fl];if(pe({groupID:ee})&&ve.push(le.GRP_MBR_ROLE_CUSTOM),!ve.includes(se))throw new ae.ChatError({functionName:"setGroupMemberRole",code:2683})}},xh=new class{constructor(){this._name="SetGroupMemberNameCard"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"setGroupMemberNameCard",context:this})}setGroupMemberNameCard(J){return ge(this,void 0,void 0,(function*(){var Z;const ee="setGroupMemberNameCard",{helper:ne,common:{getCurrentUserID:se}}=this._core,{groupID:re,userID:ae=se(),nameCard:le}=J,pe=`${this._name}.${ee} ok, groupID:${re} userID:${ae} nameCard:${le}`;this._preCheckSettingNameCardParams(J);try{const J={groupID:re,userID:ae,nameCard:le};yield fu(J,this._core);const ee=Kl.getLocalGroup(re);ae===(null===(Z=null==ee?void 0:ee.selfInfo)||void 0===Z?void 0:Z.userID)&&(ee.updateSelfInfo({nameCard:le}),Kl.emitGroupListUpdate(),Kl.updateConversationGroupProfile(re));const ne=new gh({userID:ae,nameCard:le});return eu({group:ee,member:ne},{message:pe})}catch(J){throw new ne.ChatError({functionName:ee,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo,moreMessage:pe})}}))}_preCheckSettingNameCardParams(J){const{groupID:Z}=J,{helper:ee}=this._core,ne=Kl.getLocalGroup(Z);if(jc(null==ne?void 0:ne.type))throw new ee.ChatError({functionName:"setGroupMemberNameCard",code:$l})}},Fh=new class{constructor(){this._name="SetGroupMemberCustomField"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"setGroupMemberCustomField",context:this})}setGroupMemberCustomField(J){return ge(this,void 0,void 0,(function*(){const Z="setGroupMemberCustomField",{helper:ee,common:{getCurrentUserID:ne}}=this._core;this._preCheckSettingCustomFiledParams(J);const{groupID:se,userID:re=ne(),memberCustomField:ae}=J,le=`${this._name}.${Z} ok, groupID:${se}userID:${re} memberCustomField:${JSON.stringify(ae)}`;try{const J={groupID:se,userID:re,memberCustomField:ae};yield fu(J,this._core);const Z=Kl.getLocalGroup(se),ee=new gh({userID:re,memberCustomField:ae});return eu({group:Z,member:ee},{message:le})}catch(J){throw new ee.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo,moreMessage:le})}}))}_preCheckSettingCustomFiledParams(J){const{groupID:Z}=J,{helper:ee}=this._core,ne=Kl.getLocalGroup(Z);if(jc(null==ne?void 0:ne.type))throw new ee.ChatError({functionName:"setGroupMemberCustomField",code:$l})}},Vh=new class{init(J,Z){J.ssoLog.debug("GroupMember.init"),_h.init(J,Z),bh.init(J),wh.init(J),Nh.init(J,Z),kh.init(J),Uh.init(J),xh.init(J),Fh.init(J)}getGroupMemberList(J){return _h.getGroupMemberList(J)}deleteGroupMember(J){return Nh.deleteGroupMember(J)}},$h=new class{init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"getGroupCounters",context:this})}getGroupCounters(J){return ge(this,void 0,void 0,(function*(){const Z="getGroupCounters";try{Yc(Z,Dl);const{groupID:ee,keyList:ne=[]}=J,{avChatRoomKey:se,lastUpdateTime:re}=Ql.getLocalGroupCounters(ee);if(!(Date.now()-re>=this._getExpireTime()))return{code:0,data:{counters:Ql.getLocalCounters(ee,ne)}};const ae=yield function(J){return ge(this,void 0,void 0,(function*(){const{groupID:Z,GroupCounterKeys:ee,avChatRoomKey:ne}=J,{common:se}=wl.core,re={GroupId:Z,keyList:ee,BytesKey:ne};return se.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_counter",data:re})}))}({groupID:ee,keyList:ne,avChatRoomKey:se}),{GroupCounter:le=[],GroupCounterSeq:pe}=ae;return Ql.updateLocalGroupCounters({groupID:ee,counterList:le,groupCounterSeq:pe}),{code:0,data:{counters:Ql.getLocalCounters(ee,ne)}}}catch(J){zc(Z,J)}}))}_getExpireTime(){const{store:J,utils:{isUndefined:Z}}=this._core,ee=J.get("cloudConfig")||{},{grp_counter_expire_time:ne}=ee;return Z(ne)?3e4:Number(ne)}},Wh=new class{init(J){const{helper:Z}=J;Z.registerApi({apiName:"setGroupCounters",context:this}),Z.registerApi({apiName:"increaseGroupCounter",context:this}),Z.registerApi({apiName:"decreaseGroupCounter",context:this})}setGroupCounters(J){return ge(this,void 0,void 0,(function*(){return this._handleCounterOperation("Set",J)}))}increaseGroupCounter(J){return ge(this,void 0,void 0,(function*(){return this._handleCounterOperation("Increase",J)}))}decreaseGroupCounter(J){return ge(this,void 0,void 0,(function*(){return this._handleCounterOperation("Decrease",J)}))}_handleCounterOperation(J,Z){return ge(this,void 0,void 0,(function*(){const ee=`${J}GroupCounter`;try{Yc(ee,Dl);const{groupID:ne,key:se,value:re=0}=Z,{avChatRoomKey:ae}=Ql.getLocalGroupCounters(ne),le="Set"===J?this._convertObjectToList(Z.counters):[{Key:se,Value:re}],pe=yield this._updateGroupCounters({groupID:ne,counterList:le,avChatRoomKey:ae,mode:J});return Ql.setGroupCounters(ne,pe),{code:0,data:{counters:pe}}}catch(J){zc(ee,J)}}))}_updateGroupCounters(J){return ge(this,void 0,void 0,(function*(){const Z=yield function(J){const{groupID:Z,counterList:ee,mode:ne,avChatRoomKey:se}=J,{common:re}=wl.core,ae={GroupId:Z,GroupCounter:ee,Mode:ne,BytesKey:se};return re.buildAndSendPacket({servcmd:"group_open_http_svc.update_group_counter",data:ae})}(J),{GroupCounter:ee=[]}=Z,ne={};return ee.forEach((J=>{const{Key:Z,Value:ee=0}=J;ne[Z]=ee})),ne}))}_convertObjectToList(J){return Object.entries(J).map((([J,Z])=>({Key:J,Value:Z||0})))}},Yh=new class{init(J){this._core=J,$h.init(J),Wh.init(J)}isGroupCounterUpdated(J){const{elements:{groupCounterInfo:Z}}=J,{utils:{isEmpty:ee}}=this._core;return!ee(Z)}handleGroupCounterUpdated(J){const{to:Z,elements:{groupCounterInfo:ee}}=J;ee.forEach((J=>{const{type:ee,groupCounterSeq:ne,counterList:se=[]}=J;0!==ee&&2!==ee||this._processAndNotifyCounterUpdate(Z,ne,se),1===ee&&Ql.deleteLocalGroupCounters({groupID:Z,groupCounterSeq:ne,counterList:se})}))}_processAndNotifyCounterUpdate(J,Z,ee){const{OuterEvent:ne,notificationCenter:se}=this._core;Ql.updateLocalGroupCounters({groupID:J,groupCounterSeq:Z,counterList:ee}),ee.forEach((({Key:Z,Value:ee=0})=>{se.emitOuterEvent(ne.GROUP_COUNTER_UPDATED,{name:ne.GROUP_COUNTER_UPDATED,data:{groupID:J,key:Z,value:ee}})}))}reset(){Ql.reset()}},zh=new class{constructor(){this._name="InitGroupAttributes"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"initGroupAttributes",context:this})}initGroupAttributes(J){return ge(this,void 0,void 0,(function*(){const{groupID:Z,groupAttributes:ee}=J,{serverMainSequence:ne,avChatRoomKey:se}=zl.getGroupAttributesCache(Z),re=zl.convertKeyValueMapToList(ee);try{const J=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,mainSequence:ne,groupAttributeList:se,avChatRoomKey:re}=J,ae={GroupId:ee,AttrMainSeq:ne,GroupAttr:se,BytesKey:re,AttrControl:["RaceConflict"]};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.set_group_attr",data:ae})}))}({groupID:Z,avChatRoomKey:se,groupAttributeList:re,mainSequence:ne},this._core),{AttrMainSeq:ae,GroupAttr:le}=J||{},pe=le.map((J=>{const{Key:Z,seq:ne}=J;return{key:Z,value:ee[Z],sequence:ne}}));return zl.saveGroupAttributesCacheValuesCopy(Z),zl.refreshGroupAttributesCache({groupID:Z,serverMainSequence:ae,groupAttributeList:pe,operation:1}),zl.emitGroupAttributesUpdated(Z),eu({groupAttributes:ee},{message:` groupID:${Z} serverMainSequence:${ae}`})}catch(J){throw new this._core.helper.ChatError({functionName:"initGroupAttributes",code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}},Jh=new class{constructor(){this._name="SetGroupAttributes"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"setGroupAttributes",context:this}),Z.registerExperimentalAPI("setRichStatus",this)}setGroupAttributes(J){return ge(this,void 0,void 0,(function*(){const{groupID:Z,groupAttributes:ee,richStatusMode:ne}=J,{serverMainSequence:se,avChatRoomKey:re,values:ae}=zl.getGroupAttributesCache(Z),le=zl.convertKeyValueMapToList(ee).map((J=>{var Z;const{key:ee,value:ne}=J;return{key:ee,value:ne,seq:(null===(Z=ae.get(J.key))||void 0===Z?void 0:Z.sequence)||0}}));try{const J=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,mainSequence:ne,groupAttributeList:se,avChatRoomKey:re,richStatusMode:ae}=J,le={GroupId:ee,AttrMainSeq:ne,GroupAttr:se,BytesKey:re,AttrControl:["RaceConflict"],AllowRoomEngineOpt:ae};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.modify_group_attr",data:le})}))}({groupID:Z,avChatRoomKey:re,groupAttributeList:le,mainSequence:se,richStatusMode:ne},this._core),{AttrMainSeq:ae,GroupAttr:pe}=J||{},_e=pe.map((J=>{const{Key:Z,seq:ne}=J;return{key:Z,value:ee[Z],sequence:ne}}));return zl.saveGroupAttributesCacheValuesCopy(Z),zl.refreshGroupAttributesCache({groupID:Z,serverMainSequence:ae,groupAttributeList:_e,operation:2}),zl.emitGroupAttributesUpdated(Z),eu({groupAttributes:ee},{message:` groupID:${Z} serverMainSequence:${ae}`})}catch(J){throw new this._core.helper.ChatError({functionName:"setGroupAttributes",code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}setRichStatus(J){return ge(this,void 0,void 0,(function*(){const{groupID:Z,richStatus:ee}=J;return this.setGroupAttributes({groupID:Z,groupAttributes:ee,richStatusMode:!0})}))}},Zh=new class{constructor(){this._name="DeleteGroupAttributes"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"deleteGroupAttributes",context:this}),Z.registerExperimentalAPI("deleteRichStatus",this)}deleteGroupAttributes(J){return ge(this,void 0,void 0,(function*(){const Z="deleteGroupAttributes",{groupID:ee,keyList:ne=[],richStatusMode:se}=J;try{let J;J=0===ne.length?yield this._clearGroupAttributes(ee,{richStatusMode:se}):yield this._deleteGroupAttributes(ee,{keyList:ne,richStatusMode:se});const{resultList:re,serverMainSequence:ae,operation:le,groupAttributeList:pe}=J||{},_e=`${this._name}.${Z} ok. groupID:${ee} operation: ${le}`;return zl.saveGroupAttributesCacheValuesCopy(ee),zl.refreshGroupAttributesCache({groupID:ee,serverMainSequence:ae,groupAttributeList:pe,operation:le}),zl.emitGroupAttributesUpdated(ee),eu({keyList:re},{message:_e})}catch(J){throw new this._core.helper.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}deleteRichStatus(J){return ge(this,void 0,void 0,(function*(){return this.deleteGroupAttributes(Object.assign(Object.assign({},J),{richStatusMode:!0}))}))}_deleteGroupAttributes(J,Z){return ge(this,void 0,void 0,(function*(){const{serverMainSequence:ee,avChatRoomKey:ne,values:se}=zl.getGroupAttributesCache(J),{keyList:re,richStatusMode:ae}=Z,le=[],pe=[];re.forEach((J=>{if(se.has(J)){const{sequence:Z=0}=se.get(J)||{};pe.push({key:J,seq:Z}),le.push(J)}}));const _e=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,mainSequence:ne,groupAttributeList:se,avChatRoomKey:re,richStatusMode:ae}=J,le={GroupId:ee,AttrMainSeq:ne,GroupAttr:se,BytesKey:re,AttrControl:["RaceConflict"],AllowRoomEngineOpt:ae};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.delete_group_attr",data:le})}))}({groupID:J,avChatRoomKey:ne,groupAttributeList:pe,mainSequence:ee,richStatusMode:ae},this._core),{AttrMainSeq:ve}=_e||{};return{resultList:le,serverMainSequence:ve,groupAttributeList:pe,operation:4}}))}_clearGroupAttributes(J,Z){return ge(this,void 0,void 0,(function*(){const{serverMainSequence:ee,avChatRoomKey:ne,values:se}=zl.getGroupAttributesCache(J),{richStatusMode:re}=Z||{},ae=[...se.keys()],le=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,mainSequence:ne,avChatRoomKey:se,richStatusMode:re}=J,ae={GroupId:ee,AttrMainSeq:ne,BytesKey:se,AttrControl:["RaceConflict"],AllowRoomEngineOpt:re};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.clear_group_attr",data:ae})}))}({groupID:J,avChatRoomKey:ne,mainSequence:ee,richStatusMode:re},this._core),{AttrMainSeq:pe}=le||{};return{resultList:ae,serverMainSequence:pe,operation:3}}))}},Xh=new class{constructor(){this._name="GetGroupAttributes"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"getGroupAttributes",context:this}),Z.registerExperimentalAPI("getRichStatus",this,"getGroupAttributes")}getGroupAttributes(J){return ge(this,void 0,void 0,(function*(){const{groupID:Z}=J,{avChatRoomKey:ee,lastUpdateTime:ne,localMainSequence:se,serverMainSequence:re}=zl.getGroupAttributesCache(Z),{helper:{ChatError:ae}}=this._core,le=`groupID:${Z} localMainSequence:${se} serverMainSequence:${re} keyList:${J.keyList}`;if(Date.now()-ne>=3e4||se<re)try{const ne=yield this.getGroupAttributesFromServer({groupID:Z,avChatRoomKey:ee}),se=zl.getGroupAttributesCacheValues(J),{serverGroupAttributeList:re=[]}=ne||{};return eu({groupAttributes:se},{message:le,moreMessage:`from server, count:${re.length}`})}catch(J){throw new ae({functionName:"getGroupAttributes",code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}const pe=zl.getGroupAttributesCacheValues(J);return eu({groupAttributes:pe},{message:le,moreMessage:"from cache"})}))}getGroupAttributesFromServer(J){return ge(this,void 0,void 0,(function*(){const{utils:{isUndefined:Z},ssoLog:ee}=this._core,{groupID:ne,avChatRoomKey:se}=J,re=Z(se)?0:1,ae=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,groupType:ne,avChatRoomKey:se}=J,re={GroupId:ee,GroupType:ne,Key:se};return Z.common.buildAndSendPacket({servcmd:"group_open_attr_http_svc.get_group_attr",data:re})}))}({groupID:ne,avChatRoomKey:se,groupType:re},this._core),{AttrMainSeq:le=0,GroupAttrAry:pe}=ae||{};ee.debug("getGroupAttributesFromServer",`${this._name}._getGroupAttributesFromServer ok. groupID:${ne} serverMainSequence:${le}`);const _e=pe.map((J=>{const{key:Z,value:ee,seq:ne}=J;return{key:Z,value:ee,sequence:ne}}));return zl.refreshGroupAttributesCache({groupID:ne,serverMainSequence:le,groupAttributeList:_e,operation:5}),{serverGroupAttributeList:pe}}))}},ed=new class{init(J){J.ssoLog.debug("GroupAttribute.init"),zh.init(J),Jh.init(J),Zh.init(J),Xh.init(J),zl.init(J)}isGroupAttributesUpdated(J){return zl.isGroupAttributesUpdated(J)}handleGroupAttributesUpdated(J){const{to:Z,elements:{newGroupProfile:ee}}=J,{groupAttributeOption:ne}=ee,{serverMainSequence:se,withChangedAttributeInfo:re}=ne,{localMainSequence:ae}=zl.getGroupAttributesCache(Z),le=se-ae;if(console.log(`GroupAttribute.handleGroupAttributesUpdated groupID:${Z} withChangedAttributeInfo:${re} diffSequence:${le}`),0!==le)if(zl.saveGroupAttributesCacheValuesCopy(Z),1!==re||1!==le){if(zl.hasGroupAttributesCache(Z)){const{avChatRoomKey:J}=zl.getGroupAttributesCache(Z);Xh.getGroupAttributesFromServer({groupID:Z,avChatRoomKey:J}).then((()=>{zl.emitGroupAttributesUpdated(Z)})).catch((()=>{}))}}else zl.handleGroupAttributesUpdated({groupID:Z,groupAttributeOption:ne})}reset(){zl.reset()}};function Uu(J,Z="tips"){const{ClientSeq:ee,From_Account:ne,MsgClientTime:se,MsgPriority:re,MsgRandom:ae,MsgSeq:le,MsgTimeStamp:pe,TinyId:_e,ToGroupId:ve,GroupInfo:ye,MsgBody:Fe}=J,qe=function(J){const{GroupCode:Z,GroupId:ee,GroupName:ne,GroupType:se,MsgFrom_AccountExtraInfo:re,From_Account:ae,To_Account:le}=J;return{groupCode:Z,groupID:ee,groupName:ne,type:se,messageFromAccountExtraInformation:re,from:ae,to:le}}(ye);return{clientSequence:ee,from:ne,clientTime:se,priority:re,random:ae,sequence:le,time:pe,tinyID:_e,to:ve,groupProfile:qe,elements:"tips"===Z?ku(Fe):$u(Fe)}}function ku(J){const Z={};return Object.keys(J).forEach((ee=>{var ne,se;switch(ee){case"MemberNum":Z.memberCount=J[ee];break;case"OpType":Z.operationType=J[ee];break;case"Operator_Account":Z.operatorID=J[ee];break;case"List_Account":Z.userIDList=J[ee];break;case"MsgMemberExtraInfo":Z.memberInfoList=null===(ne=J[ee])||void 0===ne?void 0:ne.map((J=>Fu(J)));break;case"MsgOperatorMemberExtraInfo":Z.operatorInfo=Fu(J[ee]);break;case"MsgGroupNewInfo":Z.newGroupProfile=function(J){const Z={};return Object.keys(J).forEach((ee=>{switch(ee){case"GroupIntroduction":Z.introduction=J[ee];break;case"GroupName":Z.groupName=J[ee];break;case"GroupFaceUrl":Z.avatar=J[ee];break;case"GroupNotification":Z.notification=J[ee];break;case"ApplyJoinOption":Z.joinOption=J[ee];break;case"InviteJoinOption":Z.inviteOption=J[ee];break;case"ShutupAll":Z.muteAllMembers=J[ee];break;case"Owner_Account":Z.ownerID=J[ee];break;case"GroupAttrOption":Z.groupAttributeOption=function(J){const{BytesChangedKeys:Z,GroupAttrSeq:ee,OpType:ne,PushChangedAttrValFlag:se,GroupAttrInfo:re}=J,ae=re.map((J=>{const{Key:Z,Val:ee,SubKeySeq:ne}=J;return{key:Z,value:ee,sequence:ne}}));return{changedKeyList:Z,groupAttributeList:ae,serverMainSequence:ee,operation:ne,withChangedAttributeInfo:se}}(J[ee]);break;case"MsgAppDefinedData":Z.groupCustomField=null==(ne=J[ee])?void 0:ne.map((J=>({key:J.Key,value:J.Value})))}var ne})),Z}(J[ee]);break;case"MsgMemberInfo":Z.msgMemberInfo=null===(se=J[ee])||void 0===se?void 0:se.map((J=>function(J){const{ShutupTime:Z,User_Account:ee}=J;return{muteTime:Z,userID:ee}}(J)));break;case"OnlineMemberInfo":Z.onlineMemberInfo=function(J){const{ExpireTime:Z,OnlineMemberNum:ee}=J;return{expireTime:Z,onlineMemberNum:ee}}(J[ee]);break;case"GroupCounterInfo":Z.groupCounterInfo=function(J){return J.map((J=>{const{GroupCounterSeq:Z,GroupCounter:ee,Type:ne}=J;return{type:ne,groupCounterSeq:Z,counterList:ee}}))}(J[ee])}})),Z}function Fu(J){const{ImageUrl:Z,NickName:ee,Role:ne,UserId:se}=J;return{avatar:Z,nick:ee,role:ne,userID:se}}function $u(J){const Z={};return Object.keys(J).forEach((ee=>{switch(ee){case"MsgKey":Z.messageKey=J[ee];break;case"Operator_Account":Z.operatorID=J[ee];break;case"ReportType":Z.operationType=J[ee];break;case"Authentication":Z.authentication=J[ee];break;case"MsgFlag":Z.messageRemindType=J[ee];break;case"UserDefinedField":Z.userDefinedField=J[ee];break;case"RemarkInfo":Z.remarkInfo=J[ee];break;case"BanDuration":Z.duration=J[ee];break;case"MuteTime":Z.muteTime=J[ee];break;case"MsgMemberExtraInfoList":Z.inviteeInfoList=null==(ne=J[ee]||[])?void 0:ne.map((J=>{const{UserId:Z,ImageUrl:ee,NickName:ne}=J;return{userID:Z,avatar:ee,nick:ne}}));break;case"MemberList_Account":Z.inviteeList=J[ee]}var ne})),Z}class xu{constructor(J){this.type=wl.core.OuterConstant.MSG_GRP_TIP,this.content={},this._initContent(J)}static parseServerPushElement(J){const Z=ku(J);return new xu(Z)}_initContent(J){Object.keys(J).forEach((Z=>{switch(Z){case"groupProfile":this._initGroupProfile(J[Z]);break;case"operatorInfo":this._initOperatorInfo(J[Z]);break;case"memberInfoList":case"msgMemberInfo":this._updateMemberList(J[Z]);break;case"newGroupProfile":this._initNewGroupProfile(J[Z]);break;case"memberExtraInfo":case"remarkInfo":case"onlineMemberInfo":break;default:this.content[Z]=J[Z]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}_initGroupProfile(J){this.content.groupProfile={};const Z=Object.keys(J);for(let ee=0;ee<Z.length;ee++){const ne=Z[ee];ql[ne]&&(this.content.groupProfile[ne]=J[ne])}}_initOperatorInfo(J){this.content.operatorInfo={};const Z=Object.keys(J);for(let ee=0;ee<Z.length;ee++){const ne=Z[ee];this.content.operatorInfo[ne]=J[ne]}}_updateMemberList(J){this.content.memberList?this.content.memberList.forEach((Z=>{J.forEach((J=>{Z.userID===J.userID&&Object.assign(Z,J)}))})):this.content.memberList=J}_initNewGroupProfile(J){this.content.newGroupProfile={};const Z=Object.keys(J);for(let ee=0;ee<Z.length;ee++){const ne=Z[ee];"muteAllMembers"!==ne?this.content.newGroupProfile[ne]=J[ne]:this.content.newGroupProfile.muteAllMembers=1===J.muteAllMembers}}}var td=new class{constructor(){this._name="GroupTipsNotification"}init(J){this._core=J;const{common:{workflowManager:Z},constants:{WORKFLOW_NAME:ee,WORKFLOW_STEP:ne}}=J,{message:{messageFactory:se},OuterConstant:re}=J;null==se||se.registerElementClass(re.MSG_GRP_TIP,xu),Z.registerWorkflowStep(ee.SYNC_SERVER_INFO_AFTER_RE_ONLINE,ne.GROUP_TIPS_RECOVER,this._handleGroupTipsRecover,this),Z.registerWorkflowStep(ee.RECEIVE_GROUP_TIPS_NOTIFICATION,ne.HANDLE_GROUP_TIPS_NOTIFICATION,this.onNewGroupTips,this),Z.registerWorkflowStep(ee.RECEIVE_GROUP_TIPS_NOTIFICATION,ne.EMIT_GROUP_TIPS_EVENT,this._emitGroupTipsEvent,this)}onNewGroupTips(J){const{data:Z}=J||{},{messageList:ee,conversationUpdateFieldList:ne}=this._handleGroupTips(Z);return ee.length>0&&this._handleGroupTipMessage(ee),{conversationUpdateFieldList:ne,messageList:ee}}_emitGroupTipsEvent(J){var Z;const{constants:{WORKFLOW_STEP:ee}}=this._core,{messageList:ne=[]}=(null===(Z=null==J?void 0:J.result)||void 0===Z?void 0:Z[ee.HANDLE_GROUP_TIPS_NOTIFICATION])||{};if(ne.length>0){const{notificationCenter:J,OuterEvent:Z}=this._core;J.emitOuterEvent(Z.MESSAGE_RECEIVED,{name:Z.MESSAGE_RECEIVED,data:ne})}}_handleGroupTips(J,Z=!0){const{Event:ee,GroupTips:ne}=J,se=new Map,re=[],ae=[];for(let J=0,re=ne.length;J<re;J++){const re=Uu(ne[J],"tips");if(6===ee){if(ed.isGroupAttributesUpdated(re)){ed.handleGroupAttributesUpdated(re);continue}if(Yh.isGroupCounterUpdated(re)){Yh.handleGroupCounterUpdated(re);continue}}const{groupProfile:{groupID:le}}=re;if(!Kl.hasLocalGroup(le))continue;const pe=this._assembleMessage(re);if(6===ee&&(pe._onlineOnlyFlag=!0,ae.push(pe)),4===ee){if(!this._core.message.messageDataHandler.storeConversationMessage(pe)&&Z)continue;ae.push(pe)}this._handleConversationOptions(se,pe)}return re.push(...se.values()),{conversationUpdateFieldList:re,messageList:ae}}_assembleMessage(J){const{OuterConstant:Z,message:{messageFactory:ee},common:{setGroupTipsUserInfo:ne}}=this._core;J.flow="in",J.conversationType=Z.CONV_GROUP;const se=ee.createMessage(J);ne(J.elements,se);const re=new xu(Object.assign(Object.assign({},J.elements),{groupProfile:Object.assign({},J.groupProfile)}));return se.setElement(re),se.isSystemMessage=!1,se}_handleConversationOptions(J,Z){const{common:{getMessagePreviewText:ee},utils:{isObject:ne},appStore:{conversationStore:se}}=this._core,{conversationID:re,conversationType:ae}=Z;let le;if(!se.getConversation(re)||!Z._onlineOnlyFlag){if(J.has(re))le=J.get(re),"in"===Z.flow&&(Z._isExcludedFromUnreadCount||Z._onlineOnlyFlag||le.unreadCount++),le.type=ae,le.lastMessage=Z._isExcludedFromLastMessage?"":Object.assign({},Z);else{let J=0;"in"===Z.flow&&(Z._isExcludedFromUnreadCount||Z._onlineOnlyFlag||(J=1)),le={conversationID:re,unreadCount:J,type:ae,lastMessage:Z._isExcludedFromLastMessage?"":Object.assign({},Z)}}ne(le.lastMessage)&&(le.lastMessage.messageForShow=ee(le.lastMessage.type,le.lastMessage.payload)),J.set(re,le)}}_handleGroupTipMessage(J){const{OuterConstant:{GROUP_TIPS_OPERATION_TYPE:Z}}=this._core;J.forEach((J=>{const{operationType:ee}=J.payload;switch(ee){case Z.JOINED:this._handleNewMemberJoined(J);break;case Z.QUITTED:this._handleMemberQuitted(J);break;case Z.KICKED:this._handleMemberKicked(J);break;case Z.GROUP_PROFILE_UPDATED:this._handleGroupProfileUpdated(J);break;case Z.ADMIN_SET:this._handleMemberGrantAdmin(J);break;case Z.ADMIN_CANCELED:this._handleMemberRevokeAdmin(J)}}))}_handleNewMemberJoined(J){this._handleGroupMemberCountUpdated(J)}_handleMemberQuitted(J){this._handleGroupMemberCountUpdated(J)}_handleMemberKicked(J){this._handleGroupMemberCountUpdated(J)}_handleGroupProfileUpdated(J){var Z;const{newGroupProfile:ee,groupProfile:ne,operatorInfo:se}=J.payload,{groupID:re}=ne,ae=Kl.getLocalGroup(re);Object.keys(ee).forEach((J=>{switch(J){case"ownerID":this._handleGroupOwnerChanged(re,ee);break;case"groupName":ae.name=ee[J];break;case"groupCustomField":Array.isArray(ae[J])&&Array.isArray(ee[J])?Hc(ae[J],ee[J]):ae[J]=ee[J];break;default:ae[J]=ee[J]}}));const{utils:{isUndefined:le}}=this._core;le(se)||(null===(Z=null==ae?void 0:ae.selfInfo)||void 0===Z?void 0:Z.userID)!==se.userID||Object.keys(se).forEach((J=>{"nameCard"===J&&ae.updateSelfInfo({nameCard:se[J]}),"role"===J&&this._updateSelfRole(ae,se[J])})),Kl.emitGroupListUpdate(),Kl.updateConversationGroupProfile(re)}_handleGroupOwnerChanged(J,Z){const{common:ee,OuterConstant:ne}=this._core,se=Kl.getLocalGroup(J),re=ee.getCurrentUserID(),{ownerID:ae}=Z;re===ae&&se.updateGroup({ownerID:ae,selfInfo:{role:ne.GRP_MBR_ROLE_OWNER}})}_updateSelfRole(J,Z){const{OuterConstant:ee}=this._core;let ne=ee.GRP_MBR_ROLE_MEMBER;400===Z?ne=ee.GRP_MBR_ROLE_OWNER:300===Z&&(ne=ee.GRP_MBR_ROLE_ADMIN),J.updateSelfInfo({role:ne})}_handleGroupMemberCountUpdated(J){const{memberCount:Z,groupProfile:{groupID:ee}}=J.payload,ne=Kl.getLocalGroup(ee),{utils:{isNumber:se}}=this._core;ne&&se(Z)&&ne.memberCount!==Z&&(ne.memberCount=Z,Kl.emitGroupListUpdate(),Kl.updateConversationGroupProfile(ee))}_handleGroupTipsRecover(J){const{utils:{isArray:Z}}=this._core,{groupTipList:ee}=(null==J?void 0:J.result)||{};Z(ee)&&ee.forEach((J=>{const{messageList:Z}=this._handleGroupTips({Event:J.Event,GroupTips:[J]},!1);this._handleGroupTipMessage(Z)}))}_handleMemberGrantAdmin(J){const{OuterConstant:Z}=this._core,{groupProfile:ee,userIDList:ne}=J.payload,se=this._core.common.getCurrentUserID(),{groupID:re}=ee,ae=Kl.getLocalGroup(re);ae&&ne.includes(se)&&(ae.updateSelfInfo({role:Z.GRP_MBR_ROLE_ADMIN}),Kl.emitGroupListUpdate(),Kl.updateConversationGroupProfile(re))}_handleMemberRevokeAdmin(J){const{OuterConstant:Z}=this._core,{groupProfile:ee,userIDList:ne}=J.payload,se=this._core.common.getCurrentUserID(),{groupID:re}=ee,ae=Kl.getLocalGroup(re);ae&&ne.includes(se)&&(ae.updateSelfInfo({role:Z.GRP_MBR_ROLE_MEMBER}),Kl.emitGroupListUpdate(),Kl.updateConversationGroupProfile(re))}};class Vu{constructor(J){this.type=wl.core.OuterConstant.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(J)}static parseServerPushElement(J){const Z=$u(J);return new Vu(Z)}_initContent(J){Object.keys(J).forEach((Z=>{switch(Z){case"remarkInfo":this.content.handleMessage=J[Z];break;case"groupProfile":this._initGroupProfile(J[Z]);break;case"memberInfoList":break;default:this.content[Z]=J[Z]}}))}_initGroupProfile(J){this.content.groupProfile={};const Z=Object.keys(J);for(let ee=0;ee<Z.length;ee++){const ne=Z[ee];Vl[ne]&&(this.content.groupProfile[ne]=J[ne])}}}var nd=new class{constructor(){this._name="GroupSystemNotification"}init(J){this._core=J;const{message:{messageFactory:Z},OuterConstant:{MSG_GRP_SYS_NOTICE:ee}}=J;null==Z||Z.registerElementClass(ee,Vu)}onNewGroupSystemNotification(J){const{GroupTips:Z=[],isInstantMessage:ee=!0}=J;this._core.ssoLog.debug("onNewGroupSystemNotification",` count:${Z.length} isInstantMessage:${ee}`);const{conversationUpdateFieldList:ne,messageList:se}=this._handleGroupSystemNotification(Z,ee),{notificationCenter:re,OuterEvent:ae}=this._core;ne.length>0&&this._handleGroupSysTemMessage(ee,se),!0===ee&&se.length>0&&re.emitOuterEvent(ae.MESSAGE_RECEIVED,{name:ae.MESSAGE_RECEIVED,data:se})}_handleGroupSystemNotification(J,Z){const ee=[];let ne={};for(let se=0;se<J.length;se++){const re=Uu(J[se],"system"),{elements:{operationType:ae}}=re;if(15===ae)continue;const le=this._assembleMessage(re);this._core.message.messageDataHandler.storeConversationMessage(le)&&(ee.push(le),ne=this._handleConversationOptions(le,Z))}return ne.lastMessage=ee[ee.length-1],{conversationUpdateFieldList:ee.length>0?[ne]:[],messageList:ee}}_assembleMessage(J){const{message:{messageFactory:Z},OuterConstant:ee,utils:{randomInt:ne}}=this._core;J.flow="in",J.conversationType=ee.CONV_SYSTEM,J.conversationSubType=J.groupProfile.type,J.conversationID=ee.CONV_SYSTEM;const se=Z.createMessage(J),re=new Vu(Object.assign(Object.assign({},J.elements),{groupProfile:Object.assign({},J.groupProfile)}));se.setElement(re),se.isSystemMessage=!0;const ae=1===se.sequence&&1===se.random,le=2===se.sequence&&2===se.random;return(ae||le)&&(se.sequence=ne(),se.random=ne(),se.generateMessageID()),se}_handleConversationOptions(J,Z){const{OuterConstant:ee}=this._core,ne={conversationID:ee.CONV_SYSTEM,unreadCount:0,type:ee.CONV_SYSTEM,subType:J.conversationSubType,lastMessage:null};return Z&&ne.unreadCount++,ne}_handleGroupSysTemMessage(J,Z){J&&Z.forEach((J=>{const{operationType:Z}=J.payload;switch(Z){case 2:this._handleGroupJoinResult(J);break;case 4:this._handleMemberKicked(J);break;case 5:this._handleGroupDismissed(J);break;case 7:this._handleGroupInvitedResult(J);break;case 8:this._handleGroupQuitResult(J);break;case 20:this._handleMessageRemindTypeSynced(J);break;case 21:this._handleAVChatRoomMemberBanned(J)}}))}_handleGroupJoinResult(J){const{groupProfile:Z}=J.payload,{groupID:ee,type:ne}=Z,se=Kl.hasLocalGroup(ee);this._core.ssoLog.debug("_handleGroupJoinResult",` groupID:${ee} type:${ne} hasLocalGroup:${se}`),se||jc(ne)||(Kl.updateLocalGroup([Object.assign({},Z)]),Kl.emitGroupListUpdate())}_handleMemberKicked(J){const{groupProfile:{groupID:Z,type:ee}}=J.payload;Kl.hasLocalGroup(Z)&&this._deleteLocalGroup(Z,ee),this._updateConversationProfile(Z,{unreadCount:0})}_handleGroupDismissed(J){const{groupProfile:{groupID:Z,type:ee}}=J.payload;Kl.hasLocalGroup(Z)&&this._deleteLocalGroup(Z,ee),this._updateConversationProfile(Z,{unreadCount:0})}_handleGroupInvitedResult(J){const{groupProfile:Z}=J.payload,{groupID:ee}=Z,ne=Kl.hasLocalGroup(ee);this._core.ssoLog.debug("_handleGroupInvitedResult",` groupID:${ee} hasLocalGroup:${ne}`),ne||Xl.getGroupProfile({groupID:ee}).then((J=>{const{data:{group:Z}}=J;Kl.updateLocalGroup([Object.assign({},Z)]),Kl.emitGroupListUpdate()}))}_handleGroupQuitResult(J){const{groupProfile:{groupID:Z,type:ee}}=J.payload,ne=Kl.hasLocalGroup(Z);this._core.ssoLog.debug("_handleGroupQuitResult",` groupID:${Z} type:${ee} hasLocalGroup:${ne}`),ne&&this._deleteLocalGroup(Z,ee),this._updateConversationProfile(Z,{unreadCount:0})}_handleMessageRemindTypeSynced(J){const{groupProfile:{groupID:Z},messageRemindType:ee}=J.payload;this._updateConversationProfile(Z,{messageRemindType:ee})}_handleAVChatRoomMemberBanned(J){const{groupProfile:{groupID:Z,type:ee}}=J.payload;this._deleteLocalGroup(Z,ee)}_deleteLocalGroup(J,Z){if(jc(Z)){const{appStore:{conversationStore:Z},OuterConstant:{CONV_GROUP:ee}}=this._core;Z.deleteConversation(`${ee}${J}`)}Kl.deleteLocalGroup(J),Kl.emitGroupListUpdate()}_updateConversationProfile(J,Z){const{appStore:{conversationStore:ee},OuterConstant:{CONV_GROUP:ne}}=this._core,se=`${ne}${J}`;ee.getConversation(se)&&ee.updateConversation(se,Z)}},sd=new class{init(J){this._core=J,J.ssoLog.debug("GroupNotificationHandler.init"),td.init(J),nd.init(J);const{notificationCenter:Z,InnerEvent:ee}=J,{InnerEventSubType:ne}=Z;Z.subscribeInnerEvent(ee.MESSAGE_PUSH,ne.GROUP_TIPS_NOTIFICATION,this._onNewGroupTipsNotification,this),Z.subscribeInnerEvent(ee.MESSAGE_PUSH,ne.GROUP_SYSTEM_NOTIFICATION,this._onNewGroupSystemNotification,this),Z.subscribeInnerEvent(ee.DESTROY,this._dispose,this)}_onNewGroupTipsNotification(J){const{common:{workflowManager:Z},constants:{WORKFLOW_NAME:ee}}=this._core;Z.executeWorkflow(ee.RECEIVE_GROUP_TIPS_NOTIFICATION,J)}_onNewGroupSystemNotification(J){nd.onNewGroupSystemNotification(J)}_dispose(){const{notificationCenter:J,InnerEvent:Z}=this._core,{InnerEventSubType:ee}=J;J.unSubscribeInnerEvent(Z.MESSAGE_PUSH,ee.GROUP_TIPS_NOTIFICATION,this._onNewGroupTipsNotification,this),J.unSubscribeInnerEvent(Z.MESSAGE_PUSH,ee.GROUP_SYSTEM_NOTIFICATION,this._onNewGroupSystemNotification,this)}};const id={required:!0,rules:["string"],allowEmpty:!1},rd={required:!0,rules:["number"],allowEmpty:!1},od={required:!0,rules:["array"],allowEmpty:!1},ad={required:!0,rules:["object"],allowEmpty:!1},cd={createGroup:{name:id,type:id},dismissGroup:[Object.assign({key:"groupID"},id)],joinGroup:{groupID:id,applyMessage:{required:!1,rules:["string"],allowEmpty:!0}},quitGroup:[Object.assign({key:"groupID"},id)],searchGroupByID:[Object.assign({key:"groupID"},id)],getGroupProfile:{groupID:id,groupCustomFieldFilter:{required:!1,rules:["array"],allowEmpty:!0}},updateGroupProfile:{groupID:id,muteAllMembers:{required:!1,rules:["boolean"],allowEmpty:!1}},changeGroupOwner:{groupID:id,newOwnerID:id},getGroupOnlineMemberCount:[Object.assign({key:"groupID"},id)],handleGroupApplication:{handleAction:id},getGroupMemberList:{groupID:id},getGroupMemberProfile:{groupID:id,userIDList:od,memberCustomFieldFilter:{required:!1,rules:["array"],allowEmpty:!0}},addGroupMember:{groupID:id,userIDList:od},deleteGroupMember:{groupID:id,userIDList:od},setGroupMemberMuteTime:{groupID:id,userID:id,muteTime:Object.assign(Object.assign({},rd),{customValidator:J=>!(J<0)||"muteTime must be a non-negative number."})},setGroupMemberRole:{groupID:id,userID:id,role:id},setGroupMemberNameCard:{groupID:id,userID:{required:!1,rules:["string"],allowEmpty:!1},nameCard:id},setGroupMemberCustomField:{groupID:id,userID:{required:!1,rules:["string"],allowEmpty:!1},memberCustomField:od},markGroupMemberList:{groupID:id,markType:Object.assign(Object.assign({},rd),{customValidator:J=>!(J<1e3)||"markType must be greater than or equal to 1000."}),enableMark:{required:!0,rules:["boolean"],allowEmpty:!1},userIDList:od},initGroupAttributes:{groupID:id,groupAttributes:ad},setGroupAttributes:{groupID:id,groupAttributes:ad},deleteGroupAttributes:{groupID:id,keyList:Object.assign(Object.assign({},od),{allowEmpty:!0})},getGroupAttributes:{groupID:id,keyList:Object.assign(Object.assign({},od),{allowEmpty:!0})},getGroupCounters:{groupID:id,keyList:{required:!1,rules:["array"],allowEmpty:!0}},setGroupCounters:{groupID:id,counters:ad},increaseGroupCounter:{groupID:id,key:id,value:rd},decreaseGroupCounter:{groupID:id,key:id,value:rd}},ud={getGroupList:!0,createGroup:!0,dismissGroup:!0,joinGroup:!0,quitGroup:!0,searchGroupByID:!0,getGroupProfile:!0,updateGroupProfile:!0,changeGroupOwner:!0,getGroupOnlineMemberCount:!0,getGroupApplicationList:!0,handleGroupApplication:!0,getGroupMemberList:!0,getGroupMemberProfile:!0,addGroupMember:!0,deleteGroupMember:!0,setGroupMemberMuteTime:!0,setGroupMemberRole:!0,setGroupMemberNameCard:!0,setGroupMemberCustomField:!0,markGroupMemberList:!0,initGroupAttributes:!0,setGroupAttributes:!0,getGroupAttributes:!0,deleteGroupAttributes:!0,getGroupCounters:!0,setGroupCounters:!0,increaseGroupCounter:!0,decreaseGroupCounter:!0};var ld=new class{constructor(){this._installedSubPlugins=[],this.groupDataHandler=Kl,this.groupAction=oh,this.groupAttribute=ed,this.groupMember=Vh,this.groupCounter=Yh,this.name="Group"}install(J,Z=[]){this._core=J,wl.init(J),Kl.init(J),oh.init(J,this),Vh.init(J,this),ph.init(J),Yh.init(J),ed.init(J),sd.init(J),J.helper.registerValidateConfig({auth:ud,params:cd}),this._installSubPlugins(Z);const{notificationCenter:ee,InnerEvent:ne}=J;ee.subscribeInnerEvent(ne.LOGOUT,this._reset,this),ee.subscribeInnerEvent(ne.DESTROY,this._dispose,this)}getInstalledSubPlugins(){return this._installedSubPlugins}_installSubPlugins(J){const{utils:{isArray:Z}}=this._core;J&&Z(J)&&J.forEach((J=>{var Z;this._installedSubPlugins.includes(J.name)||(null===(Z=J.install)||void 0===Z||Z.call(J,this._core,this),this._installedSubPlugins.push(J.name))}))}_reset(){Kl.reset(),ed.reset(),Yh.reset()}_dispose(){this._reset();const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Z.LOGOUT,this._reset,this),J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this)}};const hd=new class{init(J){this.core=J}},dd={NORMAL_MESSAGE:3,GROUP_TIPS_HAS_ROAMING:4,GROUP_SYSTEM_MESSAGE:5,GROUP_TIPS_HAS_NO_ROAMING:6,BROADCAST_MESSAGE:17,MESSAGE_REVOKED:20,MESSAGE_REACTION:21,LIVE_CUSTOM_DATA:100},pd={GROUP_DISMISSED:5,QUIT_GROUP:8,AVCHATROOM_MEMBER_BANNED:21},gd=60;class cl{constructor(J){const{core:Z,manager:ee,groupID:ne,getRequestParams:se,onSuccess:re,onFail:ae}=J;this._name="Polling",this._core=Z,this._manager=ee,this._timeoutID=-1,this._isRunning=!1,this._groupID=ne,this._getRequestParams=se,this._onSuccess=re,this._onFail=ae}start(){this._isRunning=!0,this._request(),console.log(`${this._name}.start pollingInterval:${this._manager.getCurrentPollingInterval(this._groupID)}`)}isRunning(){return this._isRunning}_request(){return ge(this,void 0,void 0,(function*(){try{const J=this._getRequestParams(this._groupID),Z=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{longPollingKey:ee,startSequence:ne,startBroadcastSeq:se,simplifiedMessage:re}=J,ae={Key:ee,StartSeq:ne,StartBroadcastSeq:se,DownsizeFlag:re,USP:1,HoldTime:90};return Z.common.buildAndSendPacket({servcmd:"group_open_long_polling_http_svc.get_msg",data:ae})}))}(J,this._core);this._onSuccess(this._groupID,Z);const ee=this._manager.getCurrentPollingInterval(this._groupID);this._runNextPolling(ee)}catch(J){this._onFail(this._groupID,J),this._runNextPolling(2e3)}}))}_runNextPolling(J){this.isRunning()&&(this._timeoutID>-1&&clearTimeout(this._timeoutID),this._timeoutID=setTimeout(this._request.bind(this),J))}stop(){console.log(`${this._name}.stop timerID:${this._timeoutID}`),this._timeoutID>-1&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}}class ul{constructor(J){this._maxLength=J,this._map=new Map}set(J){var Z;if(this._map.size>=this._maxLength){const J=(null===(Z=this._map.entries().next().value)||void 0===Z?void 0:Z[0])||"";this._map.delete(J)}this._map.set(J,1)}has(J){return this._map.has(J)}delete(J){this.has(J)&&this._map.delete(J)}clear(){this._map.clear()}}const ll=J=>J===dd.GROUP_TIPS_HAS_NO_ROAMING||J===dd.GROUP_TIPS_HAS_ROAMING,dl=J=>J===dd.GROUP_SYSTEM_MESSAGE;function hl(J){const Z=function(J){const{E:Z,MCT:ee,MR:ne,MP:se,MTS:re,GId:ae,MS:le,CCD:pe,F_Account:_e,IsSys:ve,GInf:ye,MsgBody:Fe}=J,qe=he(J,["E","MCT","MR","MP","MTS","GId","MS","CCD","F_Account","IsSys","GInf","MsgBody"]);return Object.assign({Event:Z,MsgClientTime:ee,MsgRandom:ne,MsgPriority:se,MsgTimeStamp:re,ToGroupId:ae,MsgSeq:le,CloudCustomData:pe,From_Account:_e,IsSystemMsg:ve,GroupInfo:gl(ye),MsgBody:pl(Fe)},qe)}(J);return function(J){const{Event:Z}=J;(ll(Z)||dl(Z))&&(J.From_Account=J.From_Account||"@TIM#SYSTEM"),(Z===dd.BROADCAST_MESSAGE||(J=>J===dd.NORMAL_MESSAGE)(Z))&&function(J){const{core:{OuterConstant:Z}}=hd;J.CloudCustomData=J.CloudCustomData||"",J.MsgBody=J.MsgBody.map((J=>{if(J.MsgType===Z.MSG_CUSTOM){const{content:Z={}}=J;J.content=Object.assign({Data:"",Desc:"",Ext:""},Z)}return J}))}(J),ll(Z)&&function(J){const{GroupJoinType:Z,MsgOperatorMemberExtraInfo:ee={},MsgMemberExtraInfo:ne,Operator_Account:se,List_Account:re,OpType:ae}=J.MsgBody||{};"number"==typeof Z||1!==ae&&2!==ae||(J.MsgBody.GroupJoinType=2===ae?0:1),ne||(J.MsgBody.MsgMemberExtraInfo=null==re?void 0:re.map((J=>({UserId:J})))),1!==ae||ne||(J.MsgBody.MsgMemberExtraInfo=[{UserId:ee.UserId}]),J.MsgBody.MsgOperatorMemberExtraInfo=Object.assign({Operator_Account:se,ImageUrl:"",NickName:""},ee)}(J),dl(Z)&&function(J){const{MsgOperatorMemberExtraInfo:Z={},Operator_Account:ee}=J.MsgBody||{};J.MsgBody.MsgMemberExtraInfo=Object.assign({UserId:ee,ImageUrl:"",NickName:""},Z),J.MsgBody=Object.assign({Authentication:"",RemarkInfo:"",MsgKey:1e3*J.MsgTimeStamp},J.MsgBody),J.MsgBody=Object.keys(J.MsgBody).filter((J=>"MsgOperatorMemberExtraInfo"!==J)).reduce(((Z,ee)=>Object.assign(Object.assign({},Z),{[ee]:J.MsgBody[ee]})),{})}(J)}(Z),Z}function gl(J){const Z=J||{},{GN:ee,GT:ne,F_Hd:se,F_NN:re,F_Ll:ae}=Z,le=he(Z,["GN","GT","F_Hd","F_NN","F_Ll"]),pe=Object.assign({GroupName:ee,GroupType:ne},le);return se&&(pe.From_AccountHeadurl=se),re&&(pe.From_AccountNick=re),ae&&(pe.From_AccountLevel=ae),pe}function pl(J){let Z=J;Array.isArray(J)||(Z=[J]);const ee=Z.map((J=>{const{O_Account:Z,Opt:ee,L_Account:ne,RT:se,UDF:re,OpInf:ae,OnlineInf:le,MsgMemberExtraInfo:pe}=J,_e=he(J,["O_Account","Opt","L_Account","RT","UDF","OpInf","OnlineInf","MsgMemberExtraInfo"]),ve=Object.assign({Operator_Account:Z,OpType:ee,List_Account:ne,ReportType:se,UserDefinedField:re},_e);return ae&&(ve.MsgOperatorMemberExtraInfo=function(J){const{Img:Z,NN:ee}=J,ne=he(J,["Img","NN"]);return Object.assign({ImageUrl:Z,NickName:ee},ne)}(ae)),pe&&(ve.MsgMemberExtraInfo=function(J){return null==J?void 0:J.map((J=>{const{Img:Z,NN:ee}=J,ne=he(J,["Img","NN"]);return Object.assign({ImageUrl:Z,NickName:ee},ne)}))}(pe)),le&&(ve.OnlineMemberInfo=function(J){const{ET:Z,Num:ee}=J;return{ExpireTime:Z,OnlineMemberNum:ee}}(le)),ve}));return Array.isArray(J)?ee:ee[0]}var fd=new class{constructor(){this._name="MessageParser",this._sequenceList=new ul(200),this._messageIDList=new ul(100),this._broadcastMessageIDMap=new Map,this._reportMessageStackedCount=0}init(J,Z){this._core=J,this._avChatRoomHandler=Z}onMessageReceived(J,Z,ee=!1){this._sortServerMessageList({groupID:J,serverMessageList:Z,isHistoryMessage:ee});const ne=this._handleMessageList(J,Z);if(0===ne.length)return;if(!ee){const{appStore:{conversationStore:Z},OuterConstant:{CONV_GROUP:ee}}=this._core,se=(J=>{const{core:{common:{getMessagePreviewText:Z}}}=hd;return{lastTime:(null==J?void 0:J.time)||(null==J?void 0:J.lastTime)||0,lastSequence:(null==J?void 0:J.sequence)||(null==J?void 0:J.lastSequence)||0,fromAccount:(null==J?void 0:J.from)||(null==J?void 0:J.fromAccount)||"",messageForShow:Z(null==J?void 0:J.type,null==J?void 0:J.payload),payload:(null==J?void 0:J.payload)||null,type:(null==J?void 0:J.type)||"",isRevoked:(null==J?void 0:J.isRevoked)||!1,cloudCustomData:(null==J?void 0:J.cloudCustomData)||"",onlineOnlyFlag:(null==J?void 0:J._onlineOnlyFlag)||!1,nick:(null==J?void 0:J.nick)||"",nameCard:(null==J?void 0:J.nameCard)||"",version:(null==J?void 0:J.version)||0,isPeerRead:(null==J?void 0:J.isPeerRead)||!1,revoker:(null==J?void 0:J.revoker)||null}})(ne[ne.length-1]);Z.updateConversation(`${ee}${J}`,{lastMessage:se})}this._checkMessageStacked(ne);const se=ne.filter((J=>!0===J.isModified)),re=ne.filter((J=>!1===J.isModified)),{OuterEvent:{MESSAGE_RECEIVED:ae,MESSAGE_MODIFIED:le}}=this._core;se.length>0&&this._emitEvent({name:le,data:se}),re.length>0&&this._emitEvent({name:ae,data:re})}_sortServerMessageList(J){const{groupID:Z,serverMessageList:ee,isHistoryMessage:ne}=J;let se=[];this._avChatRoomHandler.isPollingSimplifiedMessage()&&!ne?(ee.sort(((J,Z)=>J.MS-Z.MS)),se=ee.map((J=>J.MS))):(ee.sort(((J,Z)=>J.MsgSeq-Z.MsgSeq)),se=ee.map((J=>J.MsgSeq))),console.log(`${this._name}._sortServerMessageList groupID:${Z} count:${se.length} sequenceList:${se}`),se.length=0}_handleMessageList(J,Z){var ee;const{message:{messageDataHandler:ne,messageHelper:se}}=this._core,re=this._avChatRoomHandler.isPollingSimplifiedMessage(),ae=[],le=Z.length;for(let pe=0;pe<le;pe++){let le=Z[pe];if(re&&(le=hl(le)),dl(le.Event)&&Object.values(pd).includes(le.MsgBody.ReportType)){this._onGroupDismissed(J);break}if(null===this._filterMessageItem(le))continue;this._patchMessageType(le);const _e=se.parseServerGroupMessage(le),ve=this._createMessage(_e);if(ve.level=le.GroupInfo.From_AccountLevel,ll(le.Event)){const J=Object.assign(Object.assign({},_e),{elements:Object.assign({},(null===(ee=null==_e?void 0:_e.elements)||void 0===ee?void 0:ee.content)||{})});if(this._avChatRoomHandler.isGroupAttributesUpdated(J)){this._avChatRoomHandler.handleGroupAttributesUpdated(J);continue}if(this._avChatRoomHandler.isGroupCounterUpdated(J)){this._avChatRoomHandler.handleGroupCounterUpdated(J);continue}}null!==this._filterDuplicateMessage(ve)&&(ne.isMessageSentByCurrentInstance(ve)||(1===_e.isModified&&(ve.isModified=!0),ll(le.Event)&&this._updateLocalOnlineMemberCountFromTips(le),ae.push(ve)))}return ae}_patchMessageType(J){const{OuterConstant:Z}=this._core;ll(J.Event)&&(J.MsgBody.MsgType=Z.MSG_GRP_TIP),dl(J.Event)&&(J.MsgBody.MsgType=Z.MSG_GRP_SYS_NOTICE)}_filterMessageItem(J){const{Event:Z}=J;return Object.values(dd).includes(Z)?(J=>J===dd.MESSAGE_REVOKED)(Z)?(this._handleMessageRevoked(J),null):(J=>J===dd.LIVE_CUSTOM_DATA)(Z)?(this._onLiveCustomData(J),null):(J=>J===dd.MESSAGE_REACTION)(Z)?null:J:(console.warn(`${this._name}.onMessageReceived unknown event:${Z}`),null)}_createMessage(J){const{message:{messageFactory:Z},OuterConstant:ee}=this._core;let ne=ee.CONV_GROUP;J.elements.type===ee.MSG_GRP_SYS_NOTICE&&(ne=ee.CONV_SYSTEM);const se=!!J.isSystemMessage,re=Z.createMessage(Object.assign(Object.assign({},J),{conversationType:ne,isSystemMessage:se,flow:"in"}));return re.setElement(J.elements),re}_filterDuplicateMessage(J){const{common:Z}=this._core;if(!Z.isUnlimitedAVChatRoom()){if(this._sequenceList.has(J.sequence))return null;this._sequenceList.set(J.sequence)}const ee=this._messageIDList.has(J.ID);return ee?(console.warn(`${this._name}_filterDuplicateMessageItem ID:${J.ID} has:${ee}`),null):(this._messageIDList.set(J.ID),J)}_handleMessageRevoked(J){const{OuterConstant:Z,OuterEvent:{MESSAGE_REVOKED:ee}}=this._core,{ToGroupId:ne,MsgBody:{RevokeMsgList:se},RevokerInfo:{Revoker_Account:re,Reason:ae=""}}=J,le=[];se.forEach((J=>{const{TinyId:ee,MsgClientTime:se,Random:pe,MsgSeq:_e}=J,ve={conversationID:`${Z.CONV_GROUP}${ne}`,ID:`${ee}-${se}-${pe}`,revoker:re,revokeReason:ae,revokerInfo:{userID:re,nick:"",avatar:""},sequence:_e};le.push(ve)})),0!==le.length&&this._emitEvent({name:ee,data:le})}_onLiveCustomData(J){const{OuterEvent:{ROOM_CUSTOM_DATA_RECEIVED:Z}}=this._core,{ToGroupId:ee,MsgSeq:ne,MsgTimeStamp:se,MsgBody:re}=J,ae=(null==re?void 0:re.Content)||(null==re?void 0:re.MsgContent)||"";this._emitEvent({name:Z,data:ae}),console.log(`${this._name}._onLiveCustomData groupID:${ee} sequence:${ne} time:${se} data:${ae}`)}_onGroupDismissed(J){this._avChatRoomHandler.reset(J)}_checkMessageStacked(J){const{length:Z}=J;if(Z>=100&&this._reportMessageStackedCount<5){const J=this._avChatRoomHandler.getJoinedGroups();this._core.ssoLog.info("MessageStacked",`count:${Z} groupID:${J.join(",")}`),this._reportMessageStackedCount+=1}}_emitEvent(J){this._core.notificationCenter.emitOuterEvent(J.name,J)}onBroadcastMessageReceived(J){const{message:{messageHelper:Z},OuterEvent:{MESSAGE_RECEIVED:ee}}=this._core,ne=this._avChatRoomHandler.isPollingSimplifiedMessage(),se=[],re=J.length;for(let ee=0;ee<re;ee++){let re=J[ee];ne&&(re=hl(re));const ae=Z.parseServerGroupMessage(re);if(!Object.values(dd).includes(re.Event)){console.warn(`${this._name}.onBroadcastMessageReceived unknown event:${re.Event}`);continue}const le=this._createMessage(ae);le.isBroadcastMessage=!0,this._broadcastMessageIDMap.has(le.ID)||(se.push(le),this._broadcastMessageIDMap.set(le.ID,1))}se.length>0&&this._emitEvent({name:ee,data:se})}_updateLocalOnlineMemberCountFromTips(J){const{utils:{isEmpty:Z}}=this._core,{ToGroupId:ee,MsgBody:{OnlineMemberInfo:ne}}=J;if(Z(ne))return;const{OnlineMemberNum:se=0,ExpireTime:re=gd}=ne,ae=Date.now();let le=this._avChatRoomHandler.getLocalOnlineMemberCount(ee);Z(le)?le={lastReqTime:0,lastSyncTime:0,latestUpdateTime:ae,memberCount:se,expireTime:re}:(le.latestUpdateTime=ae,le.memberCount=se),this._avChatRoomHandler.updateLocalOnlineMemberCount(ee,le)}reset(){this._reportMessageStackedCount=0,this._sequenceList.clear(),this._messageIDList.clear(),this._broadcastMessageIDMap.clear()}};const ml=J=>{const{core:{store:Z}}=hd;return(Z.get("cloudConfig")||{})[J]},vl=J=>{const{core:{utils:{isUndefined:Z}}}=hd;return!Z(J)},fl=()=>{const J=ml("polling_interval");return vl(J)?parseInt(J,10):300},Il=()=>{const J=ml("polling_simplified_msg");return vl(J)?parseInt(J,10):0};var _d=new class{constructor(){this._name="GetAVChatRoomOnlineMemberCount"}init(J,Z){this._core=J,this._parentPlugin=Z;const{helper:ee}=J;ee.registerApi({apiName:"getGroupOnlineMemberCount",context:this,matcher:()=>Z.getInstalledSubPlugins().length>0})}getGroupOnlineMemberCount(J){return ge(this,void 0,void 0,(function*(){const{appStore:{groupStore:Z},OuterConstant:ee}=this._core,ne=Z.getGroup(J);return ne?ne.type===ee.GRP_AVCHATROOM?this._getOnlineMemberCount(J):this._parentPlugin.groupAction.getGroupOnlineMemberCount(J):{code:0,data:{memberCount:0}}}))}_getOnlineMemberCount(J){return ge(this,void 0,void 0,(function*(){const Z="_getOnlineMemberCount",{utils:{isEmpty:ee}}=this._core,ne=md.getLocalOnlineMemberCount(J);if(ee(ne)||this._isExpired(J)){const{memberCount:ee=0}=yield this._getOnlineMemberCountFromServer(J);return console.log(`${this._name}.${Z} ok, groupID:${J} memberCount:${ee} from server.`),{code:0,data:{memberCount:ee}}}return console.log(`${this._name}.${Z} ok, groupID:${J} memberCount:${ne.memberCount} from local.`),{code:0,data:{memberCount:ne.memberCount}}}))}_isExpired(J){const Z=md.getLocalOnlineMemberCount(J),ee=Date.now(),ne=ee-Z.lastSyncTime>1e3*Z.expireTime,se=ee-Z.latestUpdateTime>1e4,re=ee-Z.lastReqTime>3e3;return ne&&se&&re}_getOnlineMemberCountFromServer(J){return ge(this,void 0,void 0,(function*(){const Z="_getOnlineMemberCountFromServer";try{const Z=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const ee={GroupId:J};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_online_member_num",data:ee})}))}(J,this._core),{OnlineMemberNum:ee=0,ExpireTime:ne=gd}=Z||{},se=Date.now(),re={lastSyncTime:se,latestUpdateTime:se,lastReqTime:se,memberCount:ee,expireTime:ne};return md.updateLocalOnlineMemberCount(J,re),{memberCount:ee}}catch(J){const ee=new this._core.helper.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo});throw console.error(`${this._name}.${Z} fail:`,ee),ee}}))}},md=new class{constructor(){this._name="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this._onlineMemberCountMap=new Map,this._pollingIntervalMap=new Map,this._pollingNoMessageCountMap=new Map,this._membersReqInfoMap=new Map,this._startBroadcastSequence=1}init(J,Z){this._core=J,this._parentPlugin=Z,fd.init(J,this),J.ssoLog.debug("AVChatRoomHandler.init")}onAVChatRoomSystemNotification(J){const{OuterConstant:{GRP_AVCHATROOM:Z}}=this._core,{GroupTips:ee=[]}=J;for(let J=0;J<ee.length;J++){const{MsgBody:ne,GroupInfo:{GroupId:se,GroupType:re}}=ee[J],ae=Object.values(pd).includes(ne.ReportType);re===Z&&ae&&this.reset(se)}}getCurrentPollingInterval(J){return this._pollingIntervalMap.get(J)||fl()}isPollingSimplifiedMessage(){return 0!==Il()}isGroupAttributesUpdated(J){return this._parentPlugin.groupAttribute.isGroupAttributesUpdated(J)}handleGroupAttributesUpdated(J){this._parentPlugin.groupAttribute.handleGroupAttributesUpdated(J)}updateLocalOnlineMemberCount(J,Z){const{notificationCenter:ee,OuterEvent:{GROUP_ONLINE_MEMBER_COUNT_CHANGED:ne}}=this._core;this._onlineMemberCountMap.set(J,Z),ee.emitOuterEvent(ne,{name:ne,data:{groupID:J,count:Z.memberCount}})}getLocalOnlineMemberCount(J){return this._onlineMemberCountMap.get(J)||{}}hasPollingInstance(J){return this._pollingInstanceMap.has(J)}getJoinedLiveList(){const{OuterConstant:{GRP_LIVE:J}}=this._core;let Z=[];return this._joinedGroupMap.size>0&&(Z=[...this._joinedGroupMap.values()].filter((Z=>Z.type===J))),Z}handleJoinGroupResult(J){return ge(this,void 0,void 0,(function*(){const{utils:{isUndefined:Z},OuterConstant:{CONV_GROUP:ee},apiMap:{getConversationProfile:ne},OuterConstant:se}=this._core,{longPollingKey:re,group:ae,historyMessageList:le=[]}=J,{groupID:pe}=ae;return yield this._preCheck(ae),this._joinedGroupMap.set(pe,ae),this._parentPlugin.groupDataHandler.updateLocalGroup([ae]),this._parentPlugin.groupDataHandler.emitGroupListUpdate(),ne(`${ee}${pe}`),_d.getGroupOnlineMemberCount(pe),le.length>0&&fd.onMessageReceived(pe,le,!0),Z(re)?{code:0,data:{status:se.JOIN_STATUS_SUCCESS,group:ae}}:{code:0,data:this.startMessageLongPolling(J)}}))}isGroupCounterUpdated(J){return this._parentPlugin.groupCounter.isGroupCounterUpdated(J)}handleGroupCounterUpdated(J){this._parentPlugin.groupCounter.handleGroupCounterUpdated(J)}_preCheck(J){return ge(this,void 0,void 0,(function*(){const{common:Z,OuterConstant:ee,helper:ne,apiMap:{quitGroup:se},ssoLog:re}=this._core;if(Z.isUnlimitedAVChatRoom()){if(this._pollingInstanceMap.size>(()=>{const J=ml("polling_count_limit");return vl(J)&&J>0?parseInt(J,10):20})())throw new ne.ChatError({code:2688,message:"the count of longPolling exceeds the max limit"});return}if(0===this._joinedAVChatRoomCount())return;if(J.type===ee.GRP_LIVE)return;const[ae,le]=this._joinedGroupMap.entries().next().value;if(le.selfInfo.role===ee.GRP_MBR_ROLE_OWNER)this._parentPlugin.groupDataHandler.deleteLocalGroup(ae);else try{yield se(ae)}catch(J){re.debug("quitGroup",`${this._name}._preCheck quitGroup failed, groupID:${ae} info:`,J)}this.reset(ae)}))}startMessageLongPolling(J){const{OuterConstant:Z}=this._core,{longPollingKey:ee,startSequence:ne=1,group:se}=J,{groupID:re}=se;return this._pollingRequestInfoMap.set(re,{longPollingKey:ee,startSequence:ne}),this._pollingIntervalMap.set(re,fl()),this._startPolling(re),this._reportLongPollingCount(),{status:Z.JOIN_STATUS_SUCCESS,group:se}}_startPolling(J){if(this._core.ssoLog.debug("_startPolling",`${this._name}._startPolling groupID:${J}`),this._pollingInstanceMap.has(J)){const Z=this._pollingInstanceMap.get(J);return void((null==Z?void 0:Z.isRunning())||null==Z||Z.start())}const Z=new cl({core:this._core,manager:this,groupID:J,getRequestParams:this._handleRequestParams.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});Z.start(),this._pollingInstanceMap.set(J,Z)}_handleRequestParams(J){const{longPollingKey:Z,startSequence:ee}=this._pollingRequestInfoMap.get(J)||{};return J===[...this._pollingInstanceMap.keys()][0]?{longPollingKey:Z,startSequence:ee,startBroadcastSeq:this._startBroadcastSequence,simplifiedMessage:Il()}:{longPollingKey:Z,startSequence:ee,simplifiedMessage:Il()}}_handleSuccess(J,Z){const{ErrorCode:ee}=Z;if(0===ee)this._hasJoinedAVChatRoom(J)&&this._handleResponseData(J,Z);else{const{longPollingKey:Z,startSequence:ne}=this._pollingRequestInfoMap.get(J)||{};console.warn(`${this._name}._handleSuccess groupID:${J} key:${Z} startSeq:${ne} errorCode:${ee}`)}}_handleResponseData(J,Z){const{Key:ee,NextSeq:ne,NextBroadcastSeq:se,RspMsgList:re=[],RspBroadcastMsgList:ae=[]}=Z;if(ee&&ne&&this._pollingRequestInfoMap.set(J,{longPollingKey:ee,startSequence:ne}),se&&se>this._startBroadcastSequence&&(this._startBroadcastSequence=se),re.length>0)0!==this._getPollingNoMessageCount(J)&&(this._updatePollingNoMessageCount(J,0),this._pollingIntervalMap.set(J,fl())),fd.onMessageReceived(J,re);else{let Z=this._getPollingNoMessageCount(J);if(Z+=1,this._updatePollingNoMessageCount(J,Z),Z===(()=>{const J=ml("polling_no_msg_count");return vl(J)?parseInt(J,10):20})()){const Z=fl()+(()=>{const J=ml("polling_interval_plus");return vl(J)?parseInt(J,10):2e3})();this._pollingIntervalMap.set(J,Z)}}ae.length>0&&fd.onBroadcastMessageReceived(ae)}_handleFailure(J,Z){const{ssoLog:ee,utils:{safeStringify:ne}}=this._core;ee.warn("polling",`${this._name}._handleFailure groupID:${J} error: ${ne(Z)}`)}_joinedAVChatRoomCount(){const{OuterConstant:J}=this._core;let Z=[];return this._joinedGroupMap.size>0&&(Z=this.getJoinedGroups().filter((Z=>Z.type===J.GRP_AVCHATROOM))),Z.length}_hasJoinedAVChatRoom(J){return this._joinedGroupMap.has(J)}getJoinedGroups(){return[...this._joinedGroupMap.values()]}updateLocalLiveGroup(J,Z){this._joinedGroupMap.set(J,Z),this._parentPlugin.groupDataHandler.updateLocalGroup([Z])}handleLiveHistoryMessages(J,Z){fd.onMessageReceived(J,Z,!0)}isOverFrequencyLimit(J){if(!this._membersReqInfoMap.has(J))return this._membersReqInfoMap.set(J,{startTime:Date.now(),requestCount:1}),!1;let{startTime:Z,requestCount:ee}=this._membersReqInfoMap.get(J);const{interval:ne,count:se}=(()=>{const J=ml("av_members_freq_limit");if(vl(J)){const{interval:Z,count:ee}=JSON.parse(J);if(ee>0&&Z>0)return{interval:Z,count:ee}}return{interval:30,count:4}})();return Date.now()-Z>1e3*ne?(this._membersReqInfoMap.set(J,{startTime:Date.now(),requestCount:1}),!1):(ee+=1,this._membersReqInfoMap.set(J,{startTime:Z,requestCount:ee}),ee>se)}_stopPolling(J){if(this._core.ssoLog.debug("_stopPolling",`${this._name}._stopPolling groupID:${J}`),J){const{appStore:{conversationStore:Z},OuterConstant:{CONV_GROUP:ee}}=this._core;Z.deleteConversation(`${ee}${J}`);const ne=this._pollingInstanceMap.get(J);return null==ne||ne.stop(),this._parentPlugin.groupDataHandler.deleteLocalGroup(J),this._pollingInstanceMap.delete(J),this._pollingRequestInfoMap.delete(J),this._joinedGroupMap.delete(J),this._onlineMemberCountMap.delete(J),this._pollingIntervalMap.delete(J),this._pollingNoMessageCountMap.delete(J),void this._membersReqInfoMap.delete(J)}for(const J of this._pollingInstanceMap.values())null==J||J.stop();this._pollingInstanceMap.clear(),this._pollingRequestInfoMap.clear(),this._joinedGroupMap.clear(),this._onlineMemberCountMap.clear(),this._pollingIntervalMap.clear(),this._pollingNoMessageCountMap.clear(),this._membersReqInfoMap.clear()}_updatePollingNoMessageCount(J,Z){this._pollingNoMessageCountMap.set(J,Z)}_getPollingNoMessageCount(J){return this._pollingNoMessageCountMap.get(J)||0}_reportLongPollingCount(){const J=this._joinedGroupMap.size;if(J>1){const{common:Z,OuterConstant:ee,ssoLog:ne}=this._core,se=Z.isUnlimitedAVChatRoom()?1:0,re=[],ae=[];Array.from(this._joinedGroupMap.values()).forEach((({groupID:J,type:Z})=>{Z===ee.GRP_LIVE?ae.push(J):re.push(J)})),ne.info("longPollingCount",String(J),{moreMessage:`av:${re.join(",")} live:${ae.join(",")} code: ${se}`,eventType:29})}}reset(J){this._stopPolling(J),this._startBroadcastSequence=1,fd.reset()}},vd=new class{init(J,Z){this._core=J,this._parentPlugin=Z;const{helper:ee}=J;ee.registerApi({apiName:"joinGroup",context:this,matcher:()=>Z.getInstalledSubPlugins().length>0})}joinGroup(J){return ge(this,void 0,void 0,(function*(){const{OuterConstant:Z}=this._core,ee=yield this._parentPlugin.groupAction.joinGroup(J),{data:{status:ne,group:{type:se}}}=ee;return se===Z.GRP_AVCHATROOM?ne===Z.JOIN_STATUS_ALREADY_IN_GROUP?ee:md.handleJoinGroupResult(ee.data):ee}))}},yd=new class{init(J,Z){this._core=J,this._parentPlugin=Z;const{helper:ee}=J;ee.registerApi({apiName:"quitGroup",context:this,matcher:()=>Z.getInstalledSubPlugins().length>0})}quitGroup(J){return ge(this,void 0,void 0,(function*(){const{OuterConstant:Z}=this._core,ee=yield this._parentPlugin.groupAction.quitGroup(J),{data:{type:ne}}=ee;return ne===Z.GRP_AVCHATROOM&&md.reset(J),ee}))}},Id=new class{init(J,Z){this._core=J,this._parentPlugin=Z;const{helper:ee}=J;ee.registerApi({apiName:"dismissGroup",context:this,matcher:()=>Z.getInstalledSubPlugins().length>0})}dismissGroup(J){return ge(this,void 0,void 0,(function*(){const{OuterConstant:Z}=this._core,ee=yield this._parentPlugin.groupAction.dismissGroup(J),{data:{type:ne}}=ee;return ne===Z.GRP_AVCHATROOM&&md.reset(J),ee}))}},Sd=new class{constructor(){this._name="GetAVChatRoomMemberList"}init(J,Z){this._core=J,this._parentPlugin=Z;const{helper:ee}=J;ee.registerApi({apiName:"getGroupMemberList",context:this,matcher:()=>Z.getInstalledSubPlugins().length>0})}getGroupMemberList(J){return ge(this,void 0,void 0,(function*(){const{appStore:{groupStore:Z},helper:ee,OuterConstant:ne}=this._core,{groupID:se}=J,re=Z.getGroup(se);if((null==re?void 0:re.type)===ne.GRP_AVCHATROOM&&ee.checkBusinessCapabilityBits("AV_MBR_LIST")){if(md.isOverFrequencyLimit(se))throw{code:2996,message:`Over frequency limit: get_members-${se}`};return this._getGroupMemberList(J)}return this._parentPlugin.groupMember.getGroupMemberList(J)}))}_getGroupMemberList(J){return ge(this,void 0,void 0,(function*(){const Z="_getGroupMemberList",{helper:ee}=this._core;try{const ee=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,offset:ne=0}=J,se={GroupId:ee,Timestamp:ne};return Z.common.buildAndSendPacket({servcmd:"group_open_avchatroom_http_svc.get_members",data:se})}))}(J,this._core),{MemberList:ne=[],NextTimestamp:se=0}=ee||{},re=this._handleMemberList(ne);return console.log(`${this._name}.${Z} ok, groupID:${J.groupID} count:${re.length} nextOffset:${se}`),{code:0,data:{memberList:re,offset:se}}}catch(J){const ne=new ee.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo});throw console.error(`${this._name}.${Z} fail:`,ne),ne}}))}_handleMemberList(J){return J.map((J=>{const{Member_Account:Z,NickName:ee="",Avatar:ne="",Remark:se="",JoinTime:re=0,Marks:ae=[]}=J;return{userID:Z,nick:ee,avatar:ne,remark:se,joinTime:re,marks:ae,isOnline:!0}}))}},Ed=new class{constructor(){this._name="DeleteAVChatRoomMember"}init(J,Z){this._core=J,this._parentPlugin=Z;const{helper:ee}=J;ee.registerApi({apiName:"deleteGroupMember",context:this,matcher:()=>Z.getInstalledSubPlugins().length>0})}deleteGroupMember(J){return ge(this,void 0,void 0,(function*(){const Z="deleteGroupMember",{appStore:{groupStore:ee},utils:{isUndefined:ne},helper:se,OuterConstant:re}=this._core,{groupID:ae}=J,le=ee.getGroup(ae);if(ne(le))throw new se.ChatError({functionName:Z,code:2603});if(le.type===re.GRP_AVCHATROOM){if(se.checkBusinessCapabilityBits("AV_BAN_MBR"))return this._deleteGroupMember(J);throw new se.ChatError({functionName:Z,code:3122})}return this._parentPlugin.groupMember.deleteGroupMember(J)}))}_deleteGroupMember(J){return ge(this,void 0,void 0,(function*(){const Z="_deleteGroupMember",{appStore:{groupStore:ee},helper:ne,ssoLog:se}=this._core,{groupID:re,duration:ae=0,userIDList:le}=J;if(0===ae)throw new ne.ChatError({functionName:Z,code:2686});try{return yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,userIDList:ne,duration:se,reason:re}=J,ae={GroupId:ee,Members_Account:ne,Duration:se,Description:re};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.ban_group_member",data:ae})}))}(J,this._core),se.debug(Z,`${this._name}.${Z} ok, groupID:${re}`),{code:0,data:{group:ee.getGroup(re),userIDList:le}}}catch(J){throw new ne.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}},Td=new class{constructor(){this._name="MarkAVChatRoomMember"}init(J){this._core=J;const{helper:Z}=J;Z.registerApi({apiName:"markGroupMemberList",context:this})}markGroupMemberList(J){return ge(this,void 0,void 0,(function*(){const Z="markGroupMemberList",{groupID:ee,markType:ne,enableMark:se,userIDList:re=[]}=J,ae=this._generateRequestData(J);try{const J=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,operationType:ne,memberList:se}=J,re={GroupId:ee,CommandType:ne,MemberList:se};return Z.common.buildAndSendPacket({servcmd:"group_open_avchatroom_http_svc.modify_user_info",data:re})}))}(ae,this._core),{MemberList:le=[]}=J||{},{successUserIDList:pe,failureUserIDList:_e}=this._handleResult(le,re);return{code:0,data:{successUserIDList:pe,failureUserIDList:_e},successLog:{message:`${this._name}.${Z} ok, groupID:${ee} markType:${ne} enableMark:${se} success:${pe.length} fail:${_e.length}`}}}catch(J){throw new this._core.helper.ChatError({functionName:Z,code:null==J?void 0:J.errorCode,message:null==J?void 0:J.errorInfo})}}))}_generateRequestData(J){const{groupID:Z,markType:ee,enableMark:ne,userIDList:se=[]}=J,re=!0===ne?1:2,ae=[...se];return ae.length>500&&console.warn(`${this._name}._generateRequestData, the length of userIDList cannot exceed 500`),{groupID:Z,operationType:re,memberList:ae.map((J=>({Member_Account:J,Marks:[ee]})))}}_handleResult(J,Z){const ee=[],ne=[];return J.length===Z.length?(ee.push(...Z),{successUserIDList:ee,failureUserIDList:ne}):(Z.forEach((Z=>{J.find((J=>J.Member_Account===Z))?ee.push(Z):ne.push(Z)})),{successUserIDList:ee,failureUserIDList:ne})}},Ad=new class{init(J,Z){J.ssoLog.debug("AVChatRoomAction.init"),vd.init(J,Z),yd.init(J,Z),Id.init(J,Z),Sd.init(J,Z),_d.init(J,Z),Ed.init(J,Z),Td.init(J)}},Od=new class{constructor(){this._name="LiveHandler"}init(J){this._core=J;const{helper:Z,ssoLog:ee}=J;Z.registerExperimentalAPI("startMessageLongPolling",this),Z.registerExperimentalAPI("stopMessageLongPolling",this),ee.debug("LiveHandler.init")}startMessageLongPolling(J){const{common:Z,utils:{isEmpty:ee},OuterConstant:ne,ssoLog:se}=this._core,{groupID:re,longPollingKey:ae,longPollingSequence:le=1}=J;if(ee(ae))return se.warn("startMessageLongPolling",`${this._name}.startMessageLongPolling longPollingKey is empty.`),Promise.resolve({});md.hasPollingInstance(re)&&this.stopMessageLongPolling({groupID:re});const pe=md.getJoinedLiveList(),_e=Z.isUnlimitedAVChatRoom();!_e&&pe.length>0&&this.stopMessageLongPolling({groupID:pe[0].groupID}),se.debug("startMessageLongPolling",`${this._name}.startMessageLongPolling isUnlimited:${_e} groupID:${re} longPollingKey:${ae} longPollingSequence:${le}`);const ve={groupID:re,type:ne.GRP_LIVE};return md.updateLocalLiveGroup(re,ve),this._getLiveHistoryMessages({groupID:re,longPollingKey:ae,startSequence:le}),md.startMessageLongPolling({group:ve,longPollingKey:ae,startSequence:le})}stopMessageLongPolling(J){const{groupID:Z}=J;return md.reset(Z),this._core.ssoLog.debug("stopMessageLongPolling",`${this._name}.stopMessageLongPolling ok, groupID:${Z}`),Promise.resolve({groupID:Z})}_getLiveHistoryMessages(J){return ge(this,void 0,void 0,(function*(){const{ssoLog:Z}=this._core,{groupID:ee}=J;try{const ne=yield function(J,Z){return ge(this,void 0,void 0,(function*(){const{groupID:ee,longPollingKey:ne,startSequence:se}=J,re={GroupId:ee,LongPollingKey:ne,PullPreSeq:se};return Z.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_huge_group_msg",data:re})}))}(J,this._core),{RspMsgList:se=[]}=ne||{};Z.debug("_getLiveHistoryMessages",`${this._name}._getLiveHistoryMessages ok, groupID:${ee} count:${se.length}`),se.length>0&&md.handleLiveHistoryMessages(ee,se)}catch(J){Z.debug("_getLiveHistoryMessages",`${this._name}._getLiveHistoryMessages failed, groupID:${ee} info:${J.message}`)}}))}},wd=new class{constructor(){this.name="AVChatRoom"}install(J,Z){this._core=J,hd.init(J),md.init(J,Z),Ad.init(J,Z),Od.init(J);const{notificationCenter:ee,InnerEvent:ne}=J,{InnerEventSubType:se}=ee;ee.subscribeInnerEvent(ne.MESSAGE_PUSH,se.GROUP_SYSTEM_NOTIFICATION,this._onAVChatRoomSystemNotification,this),ee.subscribeInnerEvent(ne.LOGOUT,this._reset,this),ee.subscribeInnerEvent(ne.DESTROY,this._dispose,this)}_onAVChatRoomSystemNotification(J){md.onAVChatRoomSystemNotification(J)}_reset(){md.reset()}_dispose(){this._reset();const{notificationCenter:J,InnerEvent:Z}=this._core,{InnerEventSubType:ee}=J;J.unSubscribeInnerEvent(Z.MESSAGE_PUSH,ee.GROUP_SYSTEM_NOTIFICATION,this._onAVChatRoomSystemNotification,this),J.unSubscribeInnerEvent(Z.LOGOUT,this._reset,this),J.unSubscribeInnerEvent(Z.DESTROY,this._dispose,this)}};const Rd=new class{init(J){this.core=J}},Dd="message",Nd="user",Ld={OR:"or",AND:"and"},kd=20,Pd=20,Ud=20,Gd={required:!1,rules:["array"],allowEmpty:!0,customValidator:J=>!J||!!(Array.isArray(J)&&J.length<=5)||"keywordList should be an array and length <= 5"},xd={required:!1,rules:["string"],allowEmpty:!0,customValidator:J=>!J||!![Ld.OR,Ld.AND].includes(J)||"keywordListMatchType should be OR or AND"},Fd={required:!1,rules:["number"],allowEmpty:!0,customValidator:J=>"number"==typeof J&&J>=1&&J<=100||"count must be a number between 1 and 100"},Bd={required:!1,rules:["string"],allowEmpty:!0},Vd={required:!1,rules:["array"],allowEmpty:!0,customValidator:J=>{const{OuterConstant:Z}=Rd.core;if(!Array.isArray(J))return"groupTypeList should be an array";const ee=[Z.GRP_PUBLIC,Z.GRP_COMMUNITY,Z.GRP_WORK,Z.GRP_MEETING];let ne=!1;for(let Z=0;Z<J.length;Z++)if(-1===ee.indexOf(J[Z])){ne=!0;break}return!ne||"groupTypeList should be supported group type"}},Hd={required:!1,rules:["array"],allowEmpty:!0,customValidator:J=>{const{OuterConstant:Z}=Rd.core,ee=[Z.MSG_TEXT,Z.MSG_IMAGE,Z.MSG_AUDIO,Z.MSG_FILE,Z.MSG_VIDEO,Z.MSG_LOCATION,Z.MSG_CUSTOM,Z.MSG_MERGER];let ne=!1;for(let Z=0;Z<J.length;Z++)if(-1===ee.indexOf(J[Z])){ne=!0;break}return!ne||"messageTypeList should be supported message type"}},Kd={required:!1,rules:["string"],allowEmpty:!0,customValidator:J=>{const{OuterConstant:Z}=Rd.core;return!(!(null==J?void 0:J.startsWith(Z.CONV_C2C))&&!(null==J?void 0:J.startsWith(Z.CONV_GROUP))&&J!==Z.CONV_SYSTEM)||"conversationID is invalid"}},Hl=J=>({required:!1,rules:["number"],allowEmpty:!0,customValidator:Z=>"number"==typeof Z&&Z>=0||`${J} should be a number >= 0';`}),Wd={required:!1,rules:["string"],allowEmpty:!0,customValidator:J=>{const{OuterConstant:Z}=Rd.core;return!![Z.GENDER_FEMALE,Z.GENDER_MALE].includes(J)||"gender is invalid"}},Jd={searchCloudMessages:{keywordList:Gd,keywordListMatchType:xd,cursor:Bd,senderUserIDList:{required:!1,rules:["array"],allowEmpty:!0,customValidator:J=>!!(Array.isArray(J)&&J.length<=5)||"senderUserIDList should be an array and length <= 5"},messageTypeList:Hd,conversationID:Kd,timePosition:Hl("timePosition"),timePeriod:Hl("timePeriod")},searchCloudUsers:{keywordList:Gd,keywordListMatchType:xd,cursor:Bd,count:Fd,miniBirthday:Hl("miniBirthday"),maxBirthday:Hl("maxBirthday"),gender:Wd},searchCloudGroupMembers:{keywordList:Gd,keywordListMatchType:xd,cursor:Bd,count:Fd,groupTypeList:Vd,groupIDList:{required:!1,rules:["array"],allowEmpty:!0}},searchCloudGroups:{keywordList:Gd,keywordListMatchType:xd,cursor:Bd,count:Fd,groupTypeList:Vd}},Zd={searchCloudMessages:!0,searchCloudUsers:!0,searchCloudGroupMembers:!0,searchCloudGroups:!0};var Qd=new class{constructor(){this.name="CloudSearch"}install(J){this._core=J,Rd.init(J),J.helper.registerApi({apiName:"searchCloudMessages",context:this}),J.helper.registerApi({apiName:"searchCloudUsers",context:this}),J.helper.registerApi({apiName:"searchCloudGroupMembers",context:this}),J.helper.registerApi({apiName:"searchCloudGroups",context:this}),J.helper.registerValidateConfig({auth:Zd,params:Jd})}searchCloudMessages(J){return ge(this,void 0,void 0,(function*(){try{const{OuterConstant:Z,helper:ee}=this._core,{conversationID:ne,timePeriod:se,timePosition:re}=J,ae=he(J,["conversationID","timePeriod","timePosition"]),le=Object.assign({count:100},ae);ne&&(ne.startsWith(Z.CONV_C2C)?le.account=ne.replace(Z.CONV_C2C,""):ne.startsWith(Z.CONV_GROUP)&&(le.groupID=ne.replace(Z.CONV_GROUP,""))),this._setTimeRangeParams(le,{timePeriod:se,timePosition:re});const pe=yield function(J){return ge(this,void 0,void 0,(function*(){const{count:Z,keywordList:ee,keywordListMatchType:ne,senderUserIDList:se,messageTypeList:re,endTime:ae,startTime:le,cursor:pe,account:_e,groupID:ve}=J,ye={Count:Z,KeywordList:ee,MatchType:ne,SendUserIDList:se,MsgTypeList:re,EndTime:ae,StartTime:le,Cursor:pe,PeerAccount:_e,GroupID:ve};return Rd.core.common.buildAndSendPacket({servcmd:"message_search.query",data:ye})}))}(le);if(!pe)return{code:0,data:{}};const{ErrorCode:_e,ErrorInfo:ve,TotalCount:ye,Cursor:Fe="",ConversationMsgs:qe=[]}=pe;if(0!==_e)throw{errorCode:_e,errorInfo:ve};const $e=`keywordList:${J.keywordList} keywordListMatchType:${J.keywordListMatchType} cursor:${J.cursor} res: totalCount:${ye}`,He=qe.map((ne=>{const{MsgList:se,Count:re,GroupID:ae,UserID:le}=ne,pe=ae?`${Z.CONV_GROUP}${ae}`:`${Z.CONV_C2C}${le}`;if(this._isSearchingAllConversations(J)&&re>1)return{conversationID:pe,messageCount:re,messageList:[]};const _e=se.map((J=>ee.isEmpty(ae)?function(J,Z){const ee=Z.OuterConstant.CONV_C2C,ne=Z.message.messageHelper.parseServerPushMessage(J),se=Z.message.messageFactory.createMessage(Object.assign(Object.assign({},ne),{conversationType:ee,flow:"in"}));return se.setElement(ne.elements),se}(J,this._core):function(J,Z){const ee=Z.OuterConstant.CONV_GROUP,ne=Z.message.messageHelper.parseServerGroupMessage(J),se=Z.message.messageFactory.createMessage(Object.assign(Object.assign({},ne),{conversationType:ee,flow:"in"}));return se.setElement(ne.elements),se}(J,this._core)));return{conversationID:pe,messageCount:re,messageList:_e}}));return{code:0,data:{searchResultList:He,cursor:Fe,totalCount:ye},successLog:{message:$e}}}catch(J){const{errorCode:Z,errorInfo:ee}=J||{};this._handleError({errorCode:Z,errorInfo:ee,searchType:Dd,functionName:"searchCloudMessages"})}}))}searchCloudUsers(J){return ge(this,void 0,void 0,(function*(){var Z;try{const{keywordListMatchType:ee,count:ne=Pd}=J,se=he(J,["keywordListMatchType","count"]),re=Object.assign({count:ne,keywordListMatchType:ee===Ld.AND?1:0},se);this._setBirthdayRangeParams(re,J);const ae=yield function(J){return ge(this,void 0,void 0,(function*(){const{count:Z,keywordList:ee,keywordListMatchType:ne,miniBirthday:se,maxBirthday:re,cursor:ae,gender:le}=J,pe={Count:Z,Keywords:ee,KeywordMatchType:ne,Cursor:ae,UserBirthStart:se,UserBirthEnd:re,Gender:le};return Rd.core.common.buildAndSendPacket({servcmd:"user_search.query",data:pe})}))}(re);if(!ae)return{error:0,data:{}};const{ErrorCode:le,ErrorInfo:pe,TotalCount:_e,Cursor:ve="",Users:ye=[]}=ae;if(0!==le)throw{errorCode:le,errorInfo:pe};const Fe=`keywordList:${J.keywordList} keywordListMatchType:${J.keywordListMatchType} cursor:${J.cursor} count:${J.count} res: totalCount:${_e}`,qe=[];for(let J=0,ee=ye.length;J<ee;J++){const{UserID:ee,ProfileItems:ne}=ye[J];if(ee===this._core.OuterConstant.USER_NOT_FOUND||""===ee)continue;const se=ne.map((J=>({tag:J.Tag,value:J.StrValue}))),re=null===(Z=this._core.user.userProfile)||void 0===Z?void 0:Z.createProfile(ee,se);qe.push(re)}return{code:0,data:{searchResultList:qe,cursor:ve,totalCount:_e},successLog:{message:Fe}}}catch(J){const{errorCode:Z,errorInfo:ee}=J||{};this._handleError({errorCode:Z,errorInfo:ee,searchType:Nd,functionName:"searchCloudUsers"})}}))}searchCloudGroupMembers(J){return ge(this,void 0,void 0,(function*(){try{const{count:Z=Ud,keywordListMatchType:ee}=J,ne=he(J,["count","keywordListMatchType"]),se=Object.assign({count:Z,keywordListMatchType:ee===Ld.AND?1:0},ne),re=yield function(J){return ge(this,void 0,void 0,(function*(){const{count:Z,keywordList:ee,keywordListMatchType:ne,groupTypeList:se,cursor:re,groupIDList:ae}=J,le={Count:Z,Keywords:ee,KeywordMatchType:ne,Cursor:re,GroupType:se,GroupIdList:ae};return Rd.core.common.buildAndSendPacket({servcmd:"group_member_search.query",data:le})}))}(se);if(!re)return{code:0,data:{}};const{ErrorCode:ae,ErrorInfo:le,GroupMembers:pe=[],Cursor:_e,TotalCount:ve}=re;if(0!==ae)throw{errorCode:ae,errorInfo:le};const ye=`keywordList:${J.keywordList} keywordListMatchType:${J.keywordListMatchType} cursor:${J.cursor} count:${J.count} res: totalCount:${ve}`,Fe=new Map;return pe.forEach((J=>{const{GroupID:Z,GroupName:ee,GroupType:ne,GroupFaceUrl:se,GroupMemberUserName:re,GroupMemberUserID:ae,GroupMemberNameCard:le,GroupMemberAvatar:pe=""}=J,_e={groupID:Z,name:ee,type:ne,avatar:se},ve={userID:ae,nick:re,nameCard:le,avatar:pe};if(Fe.has(Z)){const J=Fe.get(Z);J.memberList.push(ve),Fe.set(Z,J)}else Fe.set(Z,{groupInfo:_e,memberList:[ve]})})),{code:0,data:{searchResultList:[...Fe.values()],cursor:_e,totalCount:ve},successLog:{message:ye}}}catch(J){const{errorCode:Z,errorInfo:ee}=J||{};this._handleError({errorCode:Z,errorInfo:ee,searchType:Nd,functionName:"searchCloudGroupMembers"})}}))}searchCloudGroups(J){return ge(this,void 0,void 0,(function*(){try{const{count:Z=kd,keywordListMatchType:ee}=J,ne=he(J,["count","keywordListMatchType"]),se=Object.assign({count:Z,keywordListMatchType:ee===Ld.AND?1:0},ne),re=yield function(J){return ge(this,void 0,void 0,(function*(){const{count:Z,keywordList:ee,keywordListMatchType:ne,groupTypeList:se,cursor:re}=J,ae={Count:Z,Keywords:ee,KeywordMatchType:ne,Cursor:re,GroupType:se};return Rd.core.common.buildAndSendPacket({servcmd:"group_search.query",data:ae})}))}(se);if(!re)return{code:0,data:{}};const{ErrorCode:ae,ErrorInfo:le,Groups:pe,Cursor:_e,TotalCount:ve}=re;if(0!==ae)throw{errorCode:ae,errorInfo:le};const ye=`keywordList:${J.keywordList} keywordListMatchType:${J.keywordListMatchType} cursor:${J.cursor} count:${J.count} res: totalCount:${ve}`;return{code:0,data:{searchResultList:(null==pe?void 0:pe.map((J=>function(J){const{GroupFaceUrl:Z,GroupID:ee,GroupIntroduction:ne,GroupMemberNum:se,GroupName:re,GroupOwnerTinyID:ae,GroupOwnerUserID:le,GroupOwnerUserName:pe,GroupType:_e,GroupAddOption:ve,GroupInviteOption:ye}=J;return{avatar:Z,groupID:ee,introduction:ne,memberCount:se,name:re,ownerTinyID:ae,ownerID:le,ownerNick:pe,type:_e,joinOption:ve,inviteOption:ye}}(J))))||[],cursor:_e,totalCount:ve},successLog:{message:ye}}}catch(J){const{errorCode:Z,errorInfo:ee}=J||{};this._handleError({errorCode:Z,errorInfo:ee,searchType:Nd,functionName:"searchCloudGroups"})}}))}_setTimeRangeParams(J,{timePeriod:Z,timePosition:ee}){Z&&Z>0&&(J.startTime=ee&&ee>0?ee-Z:this._core.helper.timeManager.getServerTimeSeconds()-Z),J.startTime&&J.startTime<0&&(J.startTime=void 0),ee&&ee>0&&(J.endTime=ee)}_handleError({errorCode:J,errorMessage:Z,searchType:ee}){const{helper:ne}=this._core;let se=J;throw 60020===J?se="SearchUnable":ee!==Dd&&27003===J?se="SearchParamsError":ee!==Dd&&60018===J&&(se="SearchOverLimit"),new ne.ChatError({code:se,message:Z})}_isSearchingAllConversations(J){return this._core.helper.isEmpty(J.conversationID)}_setBirthdayRangeParams(J,Z){const{miniBirthday:ee,maxBirthday:ne}=Z;void 0!==ee&&(J.miniBirthday=ee,void 0===ne&&(J.maxBirthday=4294967295)),void 0!==ne&&(J.maxBirthday=ne)}};function Jl(J,Z){return Math.round(Number(J)*Math.pow(10,Z))/Math.pow(10,Z)}const ep="qualityStat",tp="im-ssolog-quality-stat";var np;!function(J){J[J.ONLINE=8]="ONLINE"}(np||(np={}));const sp="networkRTT",ip="messageE2EDelay",rp="sendMessageC2C",op="sendMessageGroup",ap="sendMessageGroupAV",cp="sendMessageRichMedia",up="cosUpload",lp="messageReceivedGroup",hp="messageReceivedGroupAVPush",dp="messageReceivedGroupAVPull",pp={[sp]:2,[ip]:3,[rp]:4,[op]:5,[ap]:6,[cp]:7,[lp]:8,[hp]:9,[dp]:10,[up]:11},gp=[rp,op,ap,cp,up],fp=[lp,hp,dp],_p=[sp,ip,rp,op,ap,cp,up,lp,hp,dp],mp={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MSG_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},vp="quality_stat";var yp=new class{constructor(){this._messageStatsMap=new Map,this._userSideErrorCodes=new Set(Object.values(mp))}init(J){this._core=J,Object.values(gp).forEach((J=>{this._messageStatsMap.set(J,{totalCount:0,successCount:0,failedCountOfUserSide:0,costSum:0,costCount:0,fileSizeSum:0})}))}dispatchSendStats(J){const{name:Z,message:ee,error:ne,startTs:se}=J,{SEND_MESSAGE_STAT:re}=this._core.constants;switch(Z){case re.TOTAL_COUNT:this._handleTotalCount(ee);break;case re.SUCCESS_COUNT:this._handleSuccessCount(ee);break;case re.FAILED_COUNT:this._handleFailedCount(ee,ne);break;case re.SEND_COST:this._handleSendCost(ee,se)}}getStatResult(J){const Z=this._messageStatsMap.get(J);if(!Z||0===Z.totalCount)return null;const{totalCount:ee,successCount:ne,failedCountOfUserSide:se}=Z,re=Jl(ne/ee*100,2),ae=ne+se,le=Jl(ae/ee*100,2),pe=this._calcAverageValue(Z,J);return this._resetStat(J),{total_count:ee,success_count_business:ne,percent_business:re,success_count_platform:ae,percent_platform:le,average_value:pe}}_handleTotalCount(J){const Z=this._getSendMessageSpecifiedKey(J),ee=Z&&this._messageStatsMap.get(Z);ee&&ee.totalCount++}_handleSuccessCount(J){const Z=this._getSendMessageSpecifiedKey(J),ee=Z&&this._messageStatsMap.get(Z);ee&&ee.successCount++}_handleFailedCount(J,Z){var ee;const ne=null!==(ee=null==Z?void 0:Z.code)&&void 0!==ee?ee:null==Z?void 0:Z.errorCode;if(this._isUserSideError(ne)){const Z=this._getSendMessageSpecifiedKey(J),ee=Z&&this._messageStatsMap.get(Z);ee&&ee.failedCountOfUserSide++}}_handleSendCost(J,Z){const ee=this._getSendMessageSpecifiedKey(J),ne=ee&&this._messageStatsMap.get(ee);ne&&(ne.costSum+=Date.now()-Z,ne.costCount++)}_isUserSideError(J){return this._userSideErrorCodes.has(J)||J>=120001&&J<=13e4||J>=10100&&J<=10200}_getSendMessageSpecifiedKey(J){const{MSG_IMAGE:Z,MSG_AUDIO:ee,MSG_VIDEO:ne,MSG_FILE:se,CONV_C2C:re,CONV_GROUP:ae,GRP_AVCHATROOM:le}=this._core.OuterConstant;if([Z,ee,ne,se].includes(J.type))return cp;if(J.conversationType===re)return rp;if(J.conversationType===ae){const{groupStore:Z}=this._core.appStore,ee=Z.getGroup(J.to);if(!ee)return;const{type:ne}=ee;return ne===le?ap:op}}_calcAverageValue(J,Z){return 0===J.costCount?0:Z===up?Math.round(1e3*J.fileSizeSum/J.costSum):Math.round(J.costSum/J.costCount)}_resetStat(J){const Z=this._messageStatsMap.get(J);Z&&(Z.totalCount=0,Z.successCount=0,Z.failedCountOfUserSide=0,Z.costSum=0,Z.costCount=0,Z.fileSizeSum=0)}},Ip=new class{constructor(){this._lastCycleStats=new Map,this._currentCycleStats=new Map}init(J){this._core=J;const{OuterEvent:Z,notificationCenter:ee}=J;this._initStatsMap(),ee.subscribeOuterEvent(Z.MESSAGE_RECEIVED,this._onMessageReceived,this)}addMessageSequence(J){const Z=this._getReceivedMessageSpecifiedKey(J),{utils:{isUndefined:ee},OuterConstant:{CONV_GROUP:ne},ssoLog:se}=this._core;if(ee(Z)||!this._currentCycleStats.has(Z))return void se.warn("addMessageSequence",`${ep}.addMessageSequence invalid key:${Z}`);const{conversationID:re,sequence:ae}=J,le=re.replace(ne,""),pe=this._lastCycleStats.get(Z);if(0===pe.size||!pe.has(le))return void this._addToCurrentCycle(Z,le,ae);const _e=pe.get(le);ae>_e.minSeq&&ae<_e.maxSeq?this._insertToLastCycle(ae,_e):this._addToCurrentCycle(Z,le,ae)}getStatResult(J){const Z=this._lastCycleStats.get(J);if(!Z||0===Z.size)return this._transferCycleDataOptimized(J),null;let ee=0,ne=0;return Z.forEach((J=>{const{sortedSequences:Z,minSeq:se,maxSeq:re}=J;Z.length>0&&(ne+=Z.length,ee+=re-se+1)})),0===ee?null:(this._transferCycleDataOptimized(J),{total_count:ee,success_count_business:ne,percent_business:Jl(ne/ee*100,2)})}reset(){this._lastCycleStats.clear(),this._currentCycleStats.clear()}dispose(){const{notificationCenter:J,OuterEvent:{MESSAGE_RECEIVED:Z}}=this._core;J.unSubscribeOuterEvent(Z,this._onMessageReceived,this),this.reset()}_initStatsMap(){Object.values(fp).forEach((J=>{this._lastCycleStats.set(J,new Map),this._currentCycleStats.set(J,new Map)}))}_onMessageReceived(J){const{data:Z=[]}=J;Z.forEach((J=>{this.addMessageSequence(J)}))}_transferCycleDataOptimized(J){const Z=this._currentCycleStats.get(J);if(!Z)return;const ee=new Map;Z.forEach(((J,Z)=>{const ne=J.dirty?[...J.sortedSequences].sort(((J,Z)=>J-Z)):J.sortedSequences;ee.set(Z,{sortedSequences:ne,minSeq:J.minSeq,maxSeq:J.maxSeq,dirty:!1})})),this._lastCycleStats.set(J,ee),this._currentCycleStats.set(J,new Map)}_getReceivedMessageSpecifiedKey(J){const{OuterConstant:{CONV_GROUP:Z,GRP_AVCHATROOM:ee}}=this._core;if(J.conversationType===Z&&!0!==(null==J?void 0:J._onlineOnlyFlag)){const{groupStore:Z}=this._core.appStore,ne=Z.getGroup(J.to);if(!ne)return null;const{type:se}=ne;return se===ee?dp:lp}}_insertToLastCycle(J,Z){Z.dirty&&(Z.sortedSequences.sort(((J,Z)=>J-Z)),Z.dirty=!1);const ee=this._findInsertPos(Z.sortedSequences,J);Z.sortedSequences.splice(ee,0,J),Z.minSeq=Math.min(Z.minSeq,J),Z.maxSeq=Math.max(Z.maxSeq,J)}_findInsertPos(J,Z){let ee=0,ne=J.length-1;for(;ee<=ne;){const se=Math.floor((ee+ne)/2);if(J[se]===Z)return se;J[se]<Z?ee=se+1:ne=se-1}return ee}_addToCurrentCycle(J,Z,ee){let ne=this._currentCycleStats.get(J).get(Z);ne?(ne.sortedSequences.push(ee),ne.minSeq=Math.min(ne.minSeq,ee),ne.maxSeq=Math.max(ne.maxSeq,ee),ne.dirty=!0):(ne={sortedSequences:[ee],minSeq:ee,maxSeq:ee,dirty:!1},this._currentCycleStats.get(J).set(Z,ne))}},Sp=new class{constructor(){this._totalDelay=0,this._totalCount=0,this._countLessThan1s=0,this._countLessThan3s=0}init(J){this._core=J;const{OuterEvent:{MESSAGE_RECEIVED:Z},notificationCenter:ee}=J;ee.subscribeOuterEvent(Z,this._onMessageReceived,this)}addMessageDelay(J){const{timeManager:Z}=this._core.common,ee=Z.getServerTimeSeconds()-J;ee>0&&(this._totalDelay+=ee,this._totalCount++,ee<=1?this._countLessThan1s++:ee<=3&&this._countLessThan3s++)}getStatResult(){if(0===this._totalCount)return null;const J={total_count:this._totalCount,success_count_business:this._countLessThan1s,success_count_platform:this._countLessThan3s,percent_business:this._calculatePercentage(this._countLessThan1s,this._totalCount),percent_platform:this._calculatePercentage(this._countLessThan3s,this._totalCount),average_value:this._calculateAverageDelay(this._totalCount)};return this.reset(),J}reset(){this._totalDelay=0,this._totalCount=0,this._countLessThan1s=0,this._countLessThan3s=0}dispose(){const{notificationCenter:J,OuterEvent:{MESSAGE_RECEIVED:Z}}=this._core;J.unSubscribeOuterEvent(Z,this._onMessageReceived,this),this.reset()}_onMessageReceived(J){const{data:Z=[]}=J,{OuterConstant:{MSG_GRP_TIP:ee,MSG_GRP_SYS_NOTICE:ne}}=this._core,se=[ee,ne];Z.forEach((J=>{!se.includes(J.type)&&J.clientTime>0&&this.addMessageDelay(J.clientTime)}))}_calculateAverageDelay(J){return 0===J?0:Jl(this._totalDelay/J,1)}_calculatePercentage(J,Z){return Jl(J/Z*100,2)}},Ep=new class{init(J){this.core=J}},Cp=new class{constructor(){this.name="MessageQualityStat",this._reportIndex=0,this._wholePeriod=!1,this._pendingReports=[],this._failedLogsCache=new Map}install(J){this._core=J;const{helper:Z,notificationCenter:ee,InnerEvent:{QUALITY_STAT:ne,LOGOUT:se,DESTROY:re},constants:{WORKFLOW_NAME:ae,WORKFLOW_STEP:le}}=J;Ep.init(J),yp.init(J),Ip.init(J),Sp.init(J),Z.registerWorkflowStep(ae.SYNC_SERVER_INFO_AFTER_LOGIN,le.QUALITY_REPORT,this.handleLoginSuccess,this),ee.subscribeInnerEvent(ne,this._handleQualityStat,this),ee.subscribeInnerEvent(se,this._reset,this),ee.subscribeInnerEvent(re,this._dispose,this)}handleLoginSuccess(){const{store:J,helper:Z,utils:{isUndefined:ee}}=this._core,ne=J.get("cloudConfig")||{},{q_rpt_interval:se}=ne,re=ee(se)?12e4:Number(se);Z.taskScheduler.addTask({id:vp,intervalMs:re,callback:this.report,context:this})}report(){this._wholePeriod=!0;const J=[..._p.map((J=>{const Z=this._buildQualityReportItem(J);return Z?Object.assign(Object.assign({},Z),{report_index:this._reportIndex,whole_period:this._wholePeriod}):null})).filter(Boolean),...this._pendingReports];this._pendingReports=[],this._needSkipReport()||this._uploadQualityReports(J)}_handleQualityStat(J){const{constants:{QUALITY_METRICS:Z}}=this._core,{label:ee,data:ne}=J;ee===Z.MESSAGE_SEND_SUCCESS_RATE&&yp.dispatchSendStats(ne)}_needSkipReport(){return this._isSDKAppIDInBlacklist()&&!this._isTinyIDInWhitelist()}_isSDKAppIDInBlacklist(){const{store:J,utils:Z}=this._core,ee=J.get("cloudConfig")||{},ne=J.get("instance")||{},{sdkAppId:se}=ne,{q_rpt_sdkappid_bl:re=[]}=ee;if(!Z.isEmpty(re))return re.split(",").map((J=>Number(J))).includes(se)}_isTinyIDInWhitelist(){const{store:J,utils:Z}=this._core,ee=J.get("cloudConfig")||{},ne=J.get("login")||{},se=Number(ne.tinyID),{q_rpt_tinyid_wl:re=[]}=ee;if(!Z.isEmpty(re))return re.split(",").includes(se)}_buildQualityReportItem(J){const Z=this._getStatResultByKey(J);if(null===Z)return null;const ee={quality_type:pp[J],timestamp:Date.now(),network_type:np.ONLINE,extension:""};return Object.assign(Object.assign({},ee),Z)}_getStatResultByKey(J){switch(J){case ip:return Sp.getStatResult();case rp:case op:case ap:case cp:case up:return yp.getStatResult(J);case lp:case hp:case dp:return Ip.getStatResult(J);default:return null}}_uploadQualityReports(J){return ge(this,void 0,void 0,(function*(){try{const Z={header:this._core.common.getCommonHead(),quality:J};yield function(J){const{common:Z,channel:ee}=Ep.core,ne="imopenstat.tim_web_report_v2",se=Z.generateSSOLogProtocolData({servcmd:ne,data:J}),re=`${se.head.seq}${ne}`;ee.sendPacket(se,{requestId:re})}(Z),this._reportIndex++,this._wholePeriod=!1}catch(Z){console.warn("doReport failed. error:",Z),this._pendingReports=this._pendingReports.concat(J),this._cacheFailedLogs()}}))}_cacheFailedLogs(){const J=this._pendingReports,Z=`${ep}._cacheFailedLogs`;let ee=[...this._failedLogsCache.get(tp)||[],...J];ee.length>10&&(ee=ee.slice(ee.length-10),console.log(`${Z} logs overflow, keeping last 10 items`)),this._failedLogsCache.set(tp,ee),console.log(`${Z} count: ${ee.length}`),this._pendingReports=[]}_reset(){const{helper:J}=this._core;J.taskScheduler.removeTask(vp)}_dispose(){const{notificationCenter:J,InnerEvent:{QUALITY_STAT:Z,LOGOUT:ee,DESTROY:ne}}=this._core;J.unSubscribeInnerEvent(Z,this._handleQualityStat,this),J.unSubscribeInnerEvent(ee,this._reset,this),J.unSubscribeInnerEvent(ne,this._dispose,this),this._reset(),Sp.dispose(),Ip.dispose()}};const Mp=new class{init(J){this.core=J}};function Cd(J){return ge(this,void 0,void 0,(function*(){var Z;const{message:ee,user:ne,appStore:se,constants:{OuterConstant:re}}=Mp.core,ae=se.conversationStore.getConversationMap();if(ae.has(J)){const ee=null===(Z=ae.get(J))||void 0===Z?void 0:Z.userProfile;if(ee&&J.startsWith(re.CONV_C2C)){const{avatar:Z,nick:ne}=ee;Mp.core.message.messageDataHandler.updateNickAndAvatarOfSentMessage({conversationID:J,latestAvatar:Z,latestNick:ne,isSentByMe:!1})}}const{data:le}=(yield ne.userProfile.getMyProfile())||{};if(le){const{avatar:Z,nick:ne}=le;ee.messageDataHandler.updateNickAndAvatarOfSentMessage({conversationID:J,latestAvatar:Z,latestNick:ne,isSentByMe:!0})}}))}const bp=20;function bd(J){return ge(this,void 0,void 0,(function*(){var Z,ee;const{appStore:ne,utils:{isEmpty:se},common:{getCurrentUserID:re},notificationCenter:ae,OuterEvent:le,OuterConstant:{CONV_C2C:pe}}=Mp.core,{messageList:_e,conversationID:ve}=J,ye=ne.conversationStore.getConversationMap();let Fe=null===(Z=ye.get(ve))||void 0===Z?void 0:Z.peerReadTime;if(!Fe){const J=ve.replace(pe,""),Z=yield function(J){return ge(this,void 0,void 0,(function*(){const Z={To_Account:J};return Mp.core.common.buildAndSendPacket({servcmd:"openim.get_peer_read_time",data:Z})}))}([J]);if(Z){const{ReadTime:J}=Z;Fe=null==J?void 0:J[0],ye.has(ve)&&(ye.get(ve).peerReadTime=Fe)}}if(ye.has(ve)){const J=null===(ee=ye.get(ve))||void 0===ee?void 0:ee.lastMessage;se(J)||J.fromAccount===re()&&J.lastTime<=Fe&&!J.isPeerRead&&(J.isPeerRead=!0,ne.conversationStore.updateConversation(ve,{lastMessage:J}))}const qe=[];_e.forEach((J=>{J.time<=Fe&&!J.isPeerRead&&"out"===J.flow&&(J.isPeerRead=!0,qe.push(J))})),qe.length>0&&ae.emitOuterEvent(le.MESSAGE_READ_BY_PEER,{name:le.MESSAGE_READ_BY_PEER,data:qe})}))}var Tp=new class{init(J){this._core=J,J.helper.registerApi({apiName:"getMessageList",context:this}),J.helper.registerApi({apiName:"getMessageListHopping",context:this}),J.helper.registerApi({apiName:"clearHistoryMessage",context:this})}getMessageList(J){return ge(this,void 0,void 0,(function*(){try{const{message:Z,OuterConstant:{Direction:ee,CONV_C2C:ne,CONV_GROUP:se},InnerEvent:{HISTORY_MESSAGE_FETCHED:re},notificationCenter:ae}=this._core,{conversationID:le,nextReqMessageID:pe}=J,_e=bp;if("@TIM#SYSTEM"===le)return{code:0,data:{messageList:[],isCompleted:!1,nextMessageSeq:""}};const ve=this._getAvailableLocalMessagesCount({conversationID:le,nextReqMessageID:pe});if(this._needFetchHistoryMessageList({conversationID:le,availableLocalMessagesCount:ve,targetCount:_e})){let J=null;if(le.startsWith(se)?J=yield Z.messageHistory.getGroupRoamingMessagesByAnchor({conversationID:le,sequence:Number(pe),count:_e,direction:ee.FORWARD,shouldMarkCompleted:!0}):le.startsWith(ne)&&(J=yield Z.messageHistory.getC2CRoamingMessagesByAnchor({conversationID:le,messageID:pe,count:_e,direction:ee.FORWARD,shouldMarkCompleted:!0})),J){const{nextReqMessageIDFromServer:ee,hasNoMoreHistoryMessage:se,messageList:_e}=J,ye=Z.messageDataHandler.prependLocalMessageList({messageList:_e,conversationID:le});!function(J){const{appStore:Z,message:ee,OuterConstant:ne}=Mp.core,se=Z.conversationStore.getConversation(J),re=ee.messageDataHandler.getLocalMessageList(J);if(!se||0===re.length||J===ne.CONV_SYSTEM)return;const ae=[];for(let J=0;J<re.length;J++)"in"!==re[J].flow?"out"!==re[J].flow||re[J].isRead||re[J].setIsRead(!0):ae.push(re[J]);let le=0;if(se.type===ne.CONV_C2C){const J=ae.slice(-se.unreadCount).filter((J=>J.isRevoked)).length;le=ae.length-se.unreadCount-J}else le=ae.length-se.unreadCount;for(let J=0;J<le&&!ae[J].isRead;J++)ae[J].setIsRead(!0)}(le),yield Cd(le),le.startsWith(ne)&&(yield bd({messageList:_e,conversationID:le}));const Fe=this._core.message.messageDataHandler.getLocalMessageList(le).slice(0,ye.length+ve),qe=Fe.filter((J=>J.isRevoked));yield function Md(J){return ge(this,void 0,void 0,(function*(){const Z=J.map((J=>J.revoker));try{const ee=yield function(J){return ge(this,void 0,void 0,(function*(){var Z,ee;const ne=yield null===(Z=Mp.core.user.userProfile)||void 0===Z?void 0:Z.getUserProfile({userIDList:J});return(null==ne?void 0:ne.data)?null===(ee=ne.data)||void 0===ee?void 0:ee.reduce(((J,{userID:Z,nick:ee,avatar:ne})=>(J[Z]={nick:ee||"",avatar:ne||""},J)),{}):null}))}(Z);ee&&J.forEach((J=>{const{revoker:Z}=J;ee[Z]&&(J.revokerInfo.nick=ee[Z].nick||"",J.revokerInfo.avatar=ee[Z].avatar||"",J.revokerInfo.userID=Z)}))}catch(J){console.debug(J)}}))}(qe),ae.emitInnerEvent(re,ye);const $e={nextReqMessageID:se?"":String(ee),messageList:Fe,isCompleted:se},He=Fe.map((J=>J.sequence));return{code:0,data:$e,successLog:{message:`conversationID: ${le} nextReqMessageID: ${pe} availableLocalMessagesCount: ${ve} sequenceList: ${JSON.stringify(He)}`}}}return{code:0,data:{messageList:[],isCompleted:!1,nextReqMessageID:""}}}return{code:0,data:yield this._getMessageListFromMemory({conversationID:le,nextReqMessageID:pe,count:_e}),successLog:{message:`conversationID: ${le} nextReqMessageID: ${pe} availableLocalMessagesCount: ${ve}}`}}}catch(J){throw new this._core.helper.ChatError({code:null==J?void 0:J.code})}}))}getMessageListHopping(J){return ge(this,void 0,void 0,(function*(){var Z,ee;const{OuterConstant:{Direction:ne,CONV_C2C:se,CONV_GROUP:re}}=this._core,{conversationID:ae,sequence:le,time:pe,direction:_e=ne.FORWARD}=J,{utils:{isEmpty:ve},message:ye,notificationCenter:Fe,InnerEvent:{HISTORY_MESSAGE_FETCHED:qe}}=this._core;if(![ne.BACKWARD,ne.FORWARD].includes(_e))throw new this._core.helper.ChatError({message:"direction must be 0 or 1"});let{count:$e=bp}=J;$e=$e>bp?bp:$e;let He=null;if(ae.startsWith(re)){if(He=yield ye.messageHistory.getGroupRoamingMessagesByAnchor({conversationID:ae,sequence:le,count:$e,direction:_e}),He){const{nextReqMessageIDFromServer:J,hasNoMoreHistoryMessage:se,messageList:re,invisibleSequenceList:ae}=He;if(this._core.message.messageDataHandler.storeSparseMessageList(re),Fe.emitInnerEvent(qe,re),_e===ne.FORWARD){const Z=se&&J<1;return{code:0,data:{messageList:re,isCompleted:Z,nextMessageSeq:Z?"":J}}}if(_e===ne.BACKWARD){if(ve(re)&&ve(ae))return{code:0,data:{messageList:[],isCompleted:!0,nextMessageSeq:""}};const J=(null===(Z=null==re?void 0:re[re.length-1])||void 0===Z?void 0:Z.sequence)||0,ne=(null===(ee=null==ae?void 0:ae[ae.length-1])||void 0===ee?void 0:ee.sequence)||0;return{code:0,data:{messageList:re.filter((J=>J.sequence>=le)),isCompleted:!se,nextMessageSeq:se?Math.max(J,ne)+1:""}}}return{code:0,data:He}}}else if(ae.startsWith(se)&&(He=yield ye.messageHistory.getC2CRoamingMessagesByAnchor({conversationID:ae,count:$e+1,time:pe,direction:_e}),He)){const{messageList:J,lastMessageTime:Z,hasNoMoreHistoryMessage:ee}=He;return Fe.emitInnerEvent(qe,J),ee||(_e===ne.FORWARD?J.shift():J.pop()),ye.messageDataHandler.storeSparseMessageList(J),yield bd({messageList:J,conversationID:ae}),{code:0,data:{messageList:J,isCompleted:ee,nextMessageTime:ee?"":Z}}}}))}clearHistoryMessage(J){return ge(this,void 0,void 0,(function*(){var Z;const{appStore:ee,common:{ChatError:ne,getCurrentUserID:se},OuterConstant:{CONV_C2C:re,CONV_GROUP:ae},apiMap:le,message:pe}=this._core,_e=ee.conversationStore.getConversation(J);if(!_e)throw new ne({code:2500});const ve={fromAccount:se()},{type:ye}=_e;ye===re?(ve.type=1,ve.toAccount=J.replace(re,"")):ye===ae&&(ve.type=2,ve.toGroupID=J.replace(ae,""));try{yield null===(Z=null==le?void 0:le.setMessageRead)||void 0===Z?void 0:Z.call(le,{conversationID:J});const ee=yield function(J){return ge(this,void 0,void 0,(function*(){const{fromAccount:Z,type:ee,toAccount:ne,toGroupID:se}=J,re={From_Account:Z,Type:ee,To_Account:ne,ToGroupid:se};return Mp.core.common.buildAndSendPacket({servcmd:"recentcontact.clear_msg",data:re})}))}(ve);return ee&&(pe.messageDataHandler.deleteConversationMessageList(J),pe.messageHistory.completedHistoryConversations.delete(J),pe.messageHistory.clearHistoryMessageListFetchAnchors(J),this._updateConversationLastMessage(J)),{code:0,data:{conversationID:J},successLog:{message:`convID:${J}`}}}catch(Z){const{errorCode:ee}=Z;throw new this._core.helper.ChatError({functionName:"clearHistoryMessage",code:ee,moreMessage:`convID:${J}`})}}))}_updateConversationLastMessage(J){const{appStore:Z}=this._core;Z.conversationStore.updateConversation(J,{lastMessage:this._generateLastMessage()},{needSort:!0})}_getAvailableLocalMessagesCount({conversationID:J,nextReqMessageID:Z}){const{OuterConstant:{CONV_C2C:ee,CONV_GROUP:ne}}=this._core,se=this._core.message.messageDataHandler.getLocalMessageList(J),{length:re}=se;if(!Z)return re;let ae=-1;return(null==J?void 0:J.startsWith(ee))?ae=se.findIndex((J=>J.ID===Z)):(null==J?void 0:J.startsWith(ne))&&(ae=se.findIndex((J=>Z.includes("-")?J.ID===Z:String(J.sequence)===Z))),-1===ae?0:ae}_needFetchHistoryMessageList({conversationID:J,availableLocalMessagesCount:Z,targetCount:ee}){const{message:ne}=this._core;return Z<ee&&!ne.messageHistory.completedHistoryConversations.has(J)}_getMessageListFromMemory(J){return ge(this,arguments,void 0,(function*({conversationID:J,nextReqMessageID:Z,count:ee}){const{OuterConstant:{CONV_C2C:ne},message:se}=this._core,re=this._core.message.messageDataHandler.getLocalMessageList(J),ae=re.length;let le=ae,pe={isCompleted:!1,nextReqMessageID:"",messageList:[]},_e=0,ve=ae;return Z?Z&&(ve=re.findIndex((ee=>J.startsWith(ne)?ee.ID===Z:String(ee.sequence)===Z)),_e=ve>ee?ve-ee:0,le=ve):_e=ae>ee?ae-ee:0,pe.messageList=re.slice(_e,ve),pe.isCompleted=le<=ee&&se.messageHistory.completedHistoryConversations.has(J),pe.isCompleted?pe.nextReqMessageID="":pe.nextReqMessageID=this._generateNextReqMessageID({conversationID:J,targetIndex:_e}),J.startsWith(ne)&&(yield Cd(J),yield bd({messageList:pe.messageList,conversationID:J})),pe}))}_generateNextReqMessageID({conversationID:J,targetIndex:Z}){const ee=this._core.message.messageDataHandler.getLocalMessageList(J);return J.startsWith("C2C")?ee[Z].ID:String(ee[Z].sequence)}_generateLastMessage(){return{lastTime:0,lastSequence:0,fromAccount:"",messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}}},Ap=new class{constructor(){this._lastMessageSequenceMapOnDisconnect=new Map,this._lastMessageTimeMapOnDisconnect=new Map}init(J){this._core=J;const{common:{workflowManager:Z},constants:{WORKFLOW_NAME:ee,WORKFLOW_STEP:ne,InnerEvent:se}}=J;Z.registerWorkflowStep(ee.SYNC_SERVER_INFO_AFTER_RE_ONLINE,ne.HISTORY_MESSAGE_RECOVER,this._syncGroupOfflineMessage,this),Z.registerWorkflowStep(ee.SYNC_SERVER_INFO_AFTER_RE_ONLINE,ne.C2C_HISTORY_MESSAGE_RECOVER,this._syncC2COfflineMessage,this),J.notificationCenter.subscribeInnerEvent(se.SOCKET_DISCONNECTED,this._updateLastMessageSequenceMapOnDisconnect,this)}_syncGroupOfflineMessage(J){const{conversationList:Z}=(null==J?void 0:J.result)||{},{OuterConstant:ee,utils:{isArray:ne}}=this._core;if(ne(Z)){const J=Z.filter((J=>J.type===ee.CONV_GROUP&&J.groupProfile.type!==ee.GRP_AVCHATROOM));return this._recoverGroupHistoryMessage(J)}}_recoverGroupHistoryMessage(J){return ge(this,void 0,void 0,(function*(){const{OuterConstant:Z}=this._core,ee=[],ne=[];return yield Promise.all(null==J?void 0:J.map((J=>ge(this,void 0,void 0,(function*(){const{groupProfile:{groupID:se}={},lastMessage:{lastSequence:re}={}}=J,ae=`${Z.CONV_GROUP}${se}`;let le=this._getLocalLastMessageSequence(ae);this._shouldRecoverHistory({localLastMessageSequence:le,serverLastMessageSequence:re})&&(yield this._recoverGroupHistoryForConversation({conversationID:ae,localLastMessageSequence:le,serverLastMessageSequence:re,groupTipList:ne})),ee.push(ae.replace(Z.CONV_GROUP,""))}))))),{recoverRevokeNoticeGroupIDList:ee,groupTipList:ne}}))}_recoverGroupHistoryForConversation(J){return ge(this,arguments,void 0,(function*({conversationID:J,localLastMessageSequence:Z,serverLastMessageSequence:ee,groupTipList:ne}){try{const{utils:{isArray:se,isObject:re,isEmpty:ae},OuterEvent:le,OuterConstant:pe,notificationCenter:_e,message:ve,appStore:ye,common:{getMessagePreviewText:Fe}}=this._core,qe=ee-Z,$e=Math.min(20,qe),He={},Ye=yield ve.messageHistory.getGroupRoamingMessagesByAnchor({conversationID:J,sequence:Z+$e,direction:pe.Direction.FORWARD,count:$e}),{nextReqMessageIDFromServer:Je,hasNoMoreHistoryMessage:Xe,messageList:Qe,serverGroupTipList:tt}=Ye;se(tt)&&ne.push(...tt);const nt=Xe&&Je<0,it=[];if(se(Qe)&&(Qe.forEach((J=>{ve.messageReceiver.groupMessageReceiver.updateMessageProfile(J),J.from===pe.CONV_SYSTEM&&(J.isSystemMessage=!1),ve.messageDataHandler.storeConversationMessage(J)&&!ae(J.payload)&&(it.push(J),J._isExcludedFromLastMessage||(He.lastMessage=Object.assign({},J)))})),it.length>0&&_e.emitOuterEvent(le.MESSAGE_RECEIVED,{name:le.MESSAGE_RECEIVED,data:it})),!nt&&Qe.length>0){const Z=Qe[Qe.length-1].sequence;yield this._recoverGroupHistoryForConversation({conversationID:J,localLastMessageSequence:Z,serverLastMessageSequence:ee,groupTipList:ne})}re(He.lastMessage)&&(He.lastMessage.messageForShow=Fe(He.lastMessage.type,He.lastMessage.payload),ye.conversationStore.updateConversation(J,He))}catch(Z){this._core.ssoLog.error("_recoverGroupHistoryForConversation",`Recovery failed for conversation:${J}`,{error:Z})}}))}_updateLastMessageSequenceMapOnDisconnect(){const{message:J}=this._core,Z=J.messageDataHandler.getContinuousMessagesByConversation();for(const[J,ee]of Z){const Z=Array.from(ee.values());if((null==Z?void 0:Z.length)>0){const ee=Z[Z.length-1];J.startsWith("C2C")?this._lastMessageTimeMapOnDisconnect.set(J,ee.time):J.startsWith("GROUP")&&this._lastMessageSequenceMapOnDisconnect.set(J,ee.sequence)}}}_getLocalLastMessageSequence(J){const{message:Z}=this._core;if(this._lastMessageSequenceMapOnDisconnect.has(J))return this._lastMessageSequenceMapOnDisconnect.get(J);const ee=Z.messageDataHandler.getLocalMessageList(J),ne=ee[ee.length-1];return null==ne?void 0:ne.sequence}_shouldRecoverHistory(J){const{localLastMessageSequence:Z,serverLastMessageSequence:ee}=J;if("number"!=typeof Z||"number"!=typeof ee)return!1;const ne=ee-Z;return 0!==ee&&Z>0&&ne>=1&&ne<300}_syncC2COfflineMessage(J){const{conversationList:Z}=(null==J?void 0:J.result)||{},{OuterConstant:ee,utils:{isArray:ne}}=this._core;if(ne(Z)){const J=[];return Z.forEach((Z=>{Z.type===ee.CONV_C2C&&J.push(Z)})),this._recoverC2CHistoryMessage(J)}}_recoverC2CHistoryMessage(J){return ge(this,void 0,void 0,(function*(){yield Promise.all(null==J?void 0:J.map((J=>ge(this,void 0,void 0,(function*(){const{conversationID:Z,lastMessage:{lastTime:ee}={}}=J,ne=this._getLocalLastMessageTime(Z);this._shouldRecoverC2CHistory({localLastMessageTime:ne,serverLastMessageTime:ee})&&(yield this._recoverHistoryForC2CConversation({conversationID:Z,localLastMessageTime:ne,serverLastMessageTime:ee}))})))))}))}_shouldRecoverC2CHistory(J){const{localLastMessageTime:Z,serverLastMessageTime:ee}=J,ne=ee-Z;return Z>0&&ne>=1&&ne<=600}_recoverHistoryForC2CConversation(J){return ge(this,void 0,void 0,(function*(){var Z;const{conversationID:ee,localLastMessageTime:ne,serverLastMessageTime:se}=J,{utils:{isArray:re,isObject:ae,isEmpty:le,safeStringify:pe},OuterEvent:_e,OuterConstant:ve,notificationCenter:ye,message:Fe,appStore:qe,common:{getMessagePreviewText:$e}}=this._core;try{const J={},pe=yield Fe.messageHistory.getC2CRoamingMessagesByAnchor({conversationID:ee,direction:ve.Direction.BACKWARD,time:ne,count:20});if(le(pe))return;const{hasNoMoreHistoryMessage:He,messageList:Ye}=pe,Je=[];re(Ye)&&(Ye.forEach((Z=>{Fe.messageDataHandler.storeConversationMessage(Z)&&!le(Z.payload)&&(Je.push(Z),Z._isExcludedFromLastMessage||(J.lastMessage=Object.assign({},Z)))})),Je.length>0&&ye.emitOuterEvent(_e.MESSAGE_RECEIVED,{name:_e.MESSAGE_RECEIVED,data:Je}));const Xe=null===(Z=Ye[Ye.length-1])||void 0===Z?void 0:Z.time;!He&&Xe>se&&(yield this._recoverHistoryForC2CConversation({conversationID:ee,localLastMessageTime:Xe,serverLastMessageTime:se})),ae(J.lastMessage)&&(J.lastMessage.messageForShow=$e(J.lastMessage.type,J.lastMessage.payload),qe.conversationStore.updateConversation(ee,J))}catch(J){this._core.ssoLog.error("_recoverHistoryForC2CConversation",`Recovery failed for conversation:${ee} error: ${pe(J)}`)}}))}_getLocalLastMessageTime(J){const{message:Z}=this._core;if(this._lastMessageTimeMapOnDisconnect.has(J))return this._lastMessageTimeMapOnDisconnect.get(J);const ee=Z.messageDataHandler.getLocalMessageList(J),ne=ee[ee.length-1];return null==ne?void 0:ne.time}reset(){this._lastMessageSequenceMapOnDisconnect.clear(),this._lastMessageTimeMapOnDisconnect.clear()}dispose(){this.reset()}},Op=new class{constructor(){this.name="HistoryMessage"}install(J){this._core=J,Mp.init(J),Tp.init(J),Ap.init(J),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.LOGOUT,this._reset,this),J.notificationCenter.subscribeInnerEvent(J.InnerEvent.DESTROY,this.dispose,this)}dispose(){const{notificationCenter:J,InnerEvent:Z}=this._core;J.unSubscribeInnerEvent(Z.LOGOUT,this._reset,this),J.unSubscribeInnerEvent(Z.DESTROY,this.dispose,this),Ap.dispose()}_reset(){Ap.reset()}},wp=new class{init(J){this.core=J}},Rp=new class{constructor(){this._reportedAtomicStoreIDs=new Set}init(J){const{helper:{registerExperimentalAPI:Z}}=J;this._core=J,Z("reportModalView",this),Z("reportTUIFeatureUsage",this),Z("reportRoomEngineEvent",this)}reportModalView(J){const{ssoLog:Z,utils:{safeStringify:ee,isString:ne}}=this._core;try{if(!ne(J))throw new Error("reportModalView data is not a string");Z.createSSOLogData({method:"reportModalView",message:J,eventType:30}).end(!0)}catch(J){Z.debug(`reportModalView Report failed: ${ee(J)}`)}}reportTUIFeatureUsage(J){const{ssoLog:Z,utils:{safeStringify:ee,isEmpty:ne}}=this._core,{atomicStoreID:se}=J;try{ne(se)||this._reportedAtomicStoreIDs.has(se)||(this._core.ssoLog.info("reportTUIFeatureUsage",`atomicStoreID: ${J.atomicStoreID}`,{method:"reportTUIFeatureUsage",eventType:31,code:se}),this._reportedAtomicStoreIDs.add(se))}catch(J){Z.debug(`reportTUIFeatureUsage Report failed: ${ee(J)}`)}}reportRoomEngineEvent(J){const{utils:{safeStringify:Z},ssoLog:ee}=this._core;try{ee.debug(`reportRoomEngineEvent Report: ${Z(J)}`);const{eventId:ne,eventCode:se,eventResult:re,eventMessage:ae,moreMessage:le,extensionMessage:pe}=J;ee.createSSOLogData({method:pe,code:ne,message:ae,eventType:30,costTime:se,uiPlatform:re,moreMessage:le}).end(!0)}catch(J){ee.debug(`reportRoomEngineEvent Report failed: ${Z(J)}`)}}reset(){this._reportedAtomicStoreIDs.clear()}dispose(){this.reset()}},Dp=new class{constructor(){this.name="DataReport"}install(J){this._core=J;const{notificationCenter:Z,InnerEvent:{LOGOUT:ee,DESTROY:ne}}=J;wp.init(J),Rp.init(J),Z.subscribeInnerEvent(ee,this._reset,this),Z.subscribeInnerEvent(ne,this._dispose,this)}_reset(){Rp.reset()}_dispose(){const{notificationCenter:J,InnerEvent:{LOGOUT:Z,DESTROY:ee}}=this._core;J.unSubscribeInnerEvent(Z,this._reset,this),J.unSubscribeInnerEvent(ee,this._dispose,this),Rp.dispose()}};let Np=Yo.STANDARD,Lp=[];function $d(J,Z){const{operationType:ee,memberInfoList:ne,operatorInfo:se}=J||{};let re={};if(Ie(ne)?Ie(se)||(re=se):ee!==$o.JOINED&&ee!==$o.KICKED&&ee!==$o.ADMIN_SET&&ee!==$o.ADMIN_CANCELED||(re=Object.assign({},ne[0])),!Ie(re)){const{nick:J="",avatar:ee=""}=re;Z.nick=J,Z.avatar=ee}}Np=Yo.STANDARD,Lp=[$a,Va,ja,Za,ec,Cp,Op,Dp,Vc,Wu,Ol,ld,wd,Qd,lc];var kp=Object.freeze({__proto__:null,ChatError:Ws,WorkflowManager:on,buildAndSendPacket:dn,get builtInPlugins(){return Lp},checkBusinessCapabilityBits:nn,deepMerge:vn,getCurrentUserID:_n,getErrorMessage:Ks,getMessagePreviewText:Sn,isC2CConv:J=>t(J)&&J.slice(0,3)===xo.CONV_C2C,isCommunity:an,isGroupConv:J=>t(J)&&J.slice(0,5)===xo.CONV_GROUP,isInternational:Hs,isTopic:cn,isUnlimitedAVChatRoom:function(){var J;return!!(null===(J=_o.store.get("instance"))||void 0===J?void 0:J.unlimitedAVChatRoom)},liteChatInstanceMap:ba,registerInterceptor:tn,registerValidateConfig:sn,requireAuth:Ys,get sdkEdition(){return Np},setGroupTipsUserInfo:$d,t:In,updateGroupAtInfo:(J,Z)=>{const{CONV_AT_ME:ee,CONV_AT_ALL:ne,CONV_AT_ALL_AT_ME:se}=Ko;if(function(J,Z){const{CONV_AT_ME:ee,CONV_AT_ALL:ne,CONV_AT_ALL_AT_ME:se}=Ko,{groupID:re,sequence:ae}=J;let le=!1;return an({groupID:re})?(Z.forEach((Z=>{Z.messageSequence===ae&&(Z.atTypeArray.includes(ee)&&J.groupAtType.includes(ne)&&(Z.atTypeArray=[se]),Z.atTypeArray.includes(ne)&&J.groupAtType.includes(ee)&&(Z.atTypeArray=[se],Z.__random=J.__random,Z.__sequence=J.__sequence),le=!0)})),le):le}(J,Z))return;let re=[...J.groupAtType];re.includes(ee)&&re.includes(ne)&&(re=[se]);const ae={from:J.from,groupID:J.groupID,topicID:J.topicID,messageSequence:J.sequence,atTypeArray:re,__random:J.__random,__sequence:J.__sequence};Z.push(ae)},validateAndExecute:en,validateParameters:zs});class qd{constructor(){this._builtInPlugins=new Set,this._externalPlugins=new Set}static getInstance(){return qd._instance||(qd._instance=new qd),qd._instance}static setInstance(J){qd._instance=J}installBuiltInPlugin(J){J&&this._installPlugin(J,this._builtInPlugins)}installExternalPlugin(J){J&&this._installPlugin(J,this._externalPlugins)}clear(){this._builtInPlugins=new Set,this._externalPlugins=new Set}_installPlugin(J,Z){let ee=[];ee=n(J)?J:[J];const ne=ee.findIndex((J=>"AVChatRoom"===(null==J?void 0:J.name))),se=ne>-1?ee.splice(ne,1):[];ee.forEach((J=>{this._isPluginInstalled(J.name)||(J&&zt(J.install)?(Z.add(J.name),zt(J.getInstalledSubPlugins)?J.install(Yd.getInstance().exposeApiForPlugin(),se):J.install(Yd.getInstance().exposeApiForPlugin()),zt(J.handleLoginSuccess)&&this._isLoggedIn()&&J.handleLoginSuccess()):zt(J)?(Z.add(J.name),J(Yd.getInstance().exposeApiForPlugin()),zt(J.handleLoginSuccess)&&this._isLoggedIn()&&J.handleLoginSuccess()):console.warn('A plugin must either be a function or an object with an "install" function.'))}))}_isPluginInstalled(J){return this._builtInPlugins.has(J)||this._externalPlugins.has(J)}_isLoggedIn(){var J;return!0===(null===(J=_o.store.get("login"))||void 0===J?void 0:J.isLoggedIn)}}var Pp=new class{constructor(){this._conversationMap=new Map}getConversationMap(){return this._conversationMap}getConversation(J){return this._conversationMap.get(J)}updateConversation(J,Z,ee){const{emit:ne=!0,needSort:se=!1}=ee||{},re=this._conversationMap.get(J);re&&!Ie(Z)&&(Object.keys(Z).forEach((J=>{re[J]=Z[J]})),ne&&_o.notificationCenter.emitInnerEvent(Mo.CONVERSATION_UPDATED,{needSort:se}))}deleteConversation(J){this._conversationMap.has(J)&&(this._conversationMap.delete(J),_o.notificationCenter.emitInnerEvent(Mo.CONVERSATION_UPDATED))}},Up=new class{constructor(){this._groupMap=new Map}getGroupMap(){return this._groupMap}getGroup(J){return this._groupMap.get(J)}updateGroup(J,Z){const ee=this._groupMap.get(J);ee&&!Ie(Z)&&Object.keys(Z).forEach((J=>{ee[J]=Z[J]}))}},Gp=new class{constructor(){this._messagesByConversation=new Map}updateMessage(J,Z,ee){var ne;const{operation:se,updateUnreadCount:re=!0}=ee,ae=he(ee,["operation","updateUnreadCount"]),le=[];for(const ee of Z){const Z=null===(ne=this._messagesByConversation.get(J))||void 0===ne?void 0:ne.get(ee);if(!Z)return!1;Object.keys(ae).forEach((J=>{Z[J]=ae[J]})),le.push(Z)}return this._emitMessageStoreOperationEvent(se,{conversationID:J,messageList:le,updateUnreadCount:re}),le}getMessagesByConversation(J){var Z;return[...(null===(Z=this._messagesByConversation.get(J))||void 0===Z?void 0:Z.values())||[]]}getMessages(){return this._messagesByConversation}_emitMessageStoreOperationEvent(J,Z){const{conversationID:ee}=Z;cn(ee)?_o.notificationCenter.emitInnerEvent(Po[J],Z):_o.notificationCenter.emitInnerEvent(J,Z)}},xp=new class{constructor(){this.userProfileMap=new Map,this.friendMap=new Map}getUserProfileMap(){return this.userProfileMap}getFriendMap(){return this.friendMap}getUserProfile(J){return this.userProfileMap.get(J)}getFriend(J){return this.friendMap.get(J)}},Fp=Object.freeze({__proto__:null,conversationStore:Pp,groupStore:Up,messageStore:Gp,userStore:xp});class Yd{static getInstance(){return Yd._instance||(Yd._instance=new Yd),Yd._instance}static setInstance(J){Yd._instance=J}constructor(){this._experimentalApiMap={statTUIKeyFeatures:this.statKeyFeatureUsage.bind(this),setApplicationID:this.setApplicationID.bind(this)},this._apiHandlersMap={},this._apiMap={on:_o.notificationCenter.subscribeOuterEvent.bind(_o.notificationCenter),off:_o.notificationCenter.unSubscribeOuterEvent.bind(_o.notificationCenter),destroy:this.destroy.bind(this),callExperimentalAPI:this.callExperimentalAPI.bind(this),use:qd.getInstance().installExternalPlugin.bind(qd.getInstance()),registerPlugin:this.registerPlugin.bind(this),setLogLevel:this.setLogLevel.bind(this)}}registerPlugin(J){_o.ssoLog.debug("registerPlugin",J)}statKeyFeatureUsage(J){_o.ssoLog.debug("statTUIKeyFeatures",J)}setLogLevel(J){_o.ssoLog.debug("setLogLevel",J),_o.ssoLog.setLogLevel(J)}setApplicationID(J){_o.store.set("instance",{applicationID:J})}getApiMap(){return this._apiMap}setApiMap(J){this._apiMap=J}registerApi(J){const{common:{timeManager:Z},utils:{safeStringify:ee}}=_o,{apiName:ne,context:se,methodName:re=ne,matcher:ae}=J;this._apiHandlersMap[ne]||(this._apiHandlersMap[ne]=[]),this._apiHandlersMap[ne].push({context:se,methodName:re,matcher:ae}),this._apiMap[ne]&&1!==this._apiHandlersMap[ne].length||(this._apiMap[ne]=(...J)=>{const se=Z.getServerTimeMs();let ae=0;"login"===ne&&(ae=4),aa.includes(ne)&&_o.ssoLog.debug(ne,`${ne} start params: ${ee(J)}`),en(re,J);const le=this._apiHandlersMap[ne];for(const ee of le)if(!ee.matcher||ee.matcher(J))try{const Z=ee.context[ee.methodName].bind(ee.context)(...J);return this._isPromiseLike(Z)?this._handleAsyncResult(Z,ne,ae,se):(this._reportApiSuccessLog({result:Z,apiName:ne,eventType:ae,startTime:se}),Z)}catch(J){throw _o.ssoLog.error(ne,`${ne} fail ${(null==J?void 0:J.errorMessage)||(null==J?void 0:J.message)})`,{error:J,costTime:Z.getServerTimeMs()-se,eventType:ae,method:ne}),J}})}registerExperimentalAPI(J,Z,ee){const ne=ee||J;this._experimentalApiMap[J]=Z[ne].bind(Z)}destroy(){return ge(this,void 0,void 0,(function*(){var J,Z;try{(null===(J=_o.store.get("login"))||void 0===J?void 0:J.isLogin)&&(yield this._apiMap.logout()),_o.notificationCenter.emitInnerEvent(Mo.DESTROY)}catch(J){console.debug("destroy error: ",J)}finally{_o.notificationCenter.emitOuterEvent(So.SDK_DESTROY,{SDKAppID:null===(Z=_o.store.get("instance"))||void 0===Z?void 0:Z.sdkAppId}),ba.clear(),qd.getInstance().clear(),on.getInstance().destroy(),_o.destroy()}}))}exposeApiForClient(){return this._apiMap}exposeApiForPlugin(){return Object.assign(Object.assign({InnerEvent:Mo,InnerEventSubType:_o.notificationCenter.InnerEventSubType,OuterEvent:So,OuterConstant:Ko,SignalingEvent:To,helper:Object.assign(Object.assign(Object.assign({},_o.utils),_o.common),{registerApi:this.registerApi.bind(this),registerExperimentalAPI:this.registerExperimentalAPI.bind(this),registerInterceptor:tn,registerValidateConfig:sn,checkBusinessCapabilityBits:nn,registerWorkflowStep:on.getInstance().registerWorkflowStep.bind(on.getInstance()),ChatError:Ws}),apiMap:this._apiMap},_o),{constants:Object.assign(Object.assign({},ha),_o.constants),common:Object.assign(Object.assign(Object.assign({},kp),_o.common),{workflowManager:on.getInstance()}),utils:_o.utils,appStore:Fp})}callExperimentalAPI(J,Z){return _o.ssoLog.debug(`callExperimentalAPI.${J} start params: ${_o.utils.safeStringify(Z)}`),this._experimentalApiMap[J]?this._experimentalApiMap[J](Z):(_o.ssoLog.error("callExperimentalAPI",`callExperimentalAPI.${J} not found, params: ${_o.utils.safeStringify(Z)}`),Promise.reject(new Ws({code:Wo.INVALID_OPERATION})))}_isPromiseLike(J){return null!==J&&"object"==typeof J&&"function"==typeof J.then}_handleAsyncResult(J,Z,ee,ne){return J.then((J=>(this._reportApiSuccessLog({result:J,apiName:Z,eventType:ee,startTime:ne}),J))).catch((J=>{throw _o.ssoLog.error(Z,`${Z} fail ${(null==J?void 0:J.errorMessage)||(null==J?void 0:J.message)})`,{error:J,costTime:_o.common.timeManager.getServerTimeMs()-ne,eventType:ee,method:Z}),J}))}_reportApiSuccessLog(J){let{result:Z,apiName:ee,startTime:ne,eventType:se}=J;const{timeManager:re}=_o.common,{successLog:{message:ae,moreMessage:le}={message:"",moreMessage:""}}=Z||{},pe=re.getServerTimeMs();"login"===ee&&(ne+=re.getTimeOffsetWithServer()),aa.includes(ee)&&_o.ssoLog.info(ee,`${ee} success ${ae} ${le}`,{costTime:pe-ne,eventType:se,message:ae,moreMessage:le}),(null==Z?void 0:Z.successLog)&&delete Z.successLog}}class zd{constructor(){this._latestLoginAt=0,this._latestSendOnlinePresenceRequestTime=0,this._helloInterval=120,this._customLoginInfo=""}init(){const{notificationCenter:J,store:Z}=_o;Z.set("login",{isReady:!1}),Yd.getInstance().registerApi({apiName:"login",context:this}),Yd.getInstance().registerApi({apiName:"logout",context:this}),Yd.getInstance().registerApi({apiName:"getLoginUser",context:this}),Yd.getInstance().registerApi({apiName:"isReady",context:this}),Yd.getInstance().registerApi({apiName:"getServerTime",context:this}),Yd.getInstance().registerExperimentalAPI("setCustomLoginInfo",this),J.subscribeInnerEvent(Mo.RECONNECTED,this._reLogin,this),_o.notificationCenter.subscribeInnerEvent(Mo.DESTROY,this._dispose,this)}login(J){return ge(this,void 0,void 0,(function*(){var Z;const{sdkEdition:ee}=_o.store.get("instance")||{};try{if(this._isLoginIn())return this._createRepeatLoginResponse();if(this._isLoginFrequencyExceeded())throw new Ws({functionName:"login",code:Wo.REPEAT_LOGIN});const ne=yield this._performLogin(J);this._validateAfterLogin(ne),this._handleLoginSuccess(ne),yield this._ensureAsyncComplete(),this._updateAndEmitSDKReady(),this._latestLoginAt=0;const se=null===(Z=_o.channel.getSocketAdapter())||void 0===Z?void 0:Z.getId(),{appId:re,href:ae}=_o.store.get("instance")||{},{instanceID:le,customStatus:pe}=ne||{};return{code:0,data:ne,successLog:{message:ee,moreMessage:`socketID:${se} instanceID:${le} customStatus:${pe} href: ${ae} appId: ${re}`}}}catch(J){const{errorCode:Z}=J;Z!==Wo.REPEAT_LOGIN&&(this._latestLoginAt=0);const ee=new Ws({functionName:"login",code:Z});throw console.error(ee),ee}}))}_reLogin(){return ge(this,void 0,void 0,(function*(){var J;try{if(!this._isLoginIn())return;const Z=yield js(this._customLoginInfo);if(Z){const{instanceID:ee,customStatus:ne}=Z;_o.store.set("login",{statusInstanceId:ee}),on.getInstance().executeWorkflow(zo.SYNC_SERVER_INFO_AFTER_RE_ONLINE,{customStatus:ne,statusType:Uo.USER_STATUS_ONLINE});const se=null===(J=_o.channel.getSocketAdapter())||void 0===J?void 0:J.getId();_o.ssoLog.info("reLogin",`socketId:${se} instanceId:${ee}`)}}catch(J){console.warn(J)}}))}logout(){return ge(this,arguments,void 0,(function*(J=ca.USER_INITIATED){const{ssoLog:Z}=_o;Z.debug("logout",`logout start logoutReason: ${J}`);try{yield this._performLogout(J),Z.info("logout","logout success"),_o.ssoLog.uploadSSOLogData()}catch(J){const{errorCode:Z}=J;throw new Ws({functionName:"logout",code:Z})}finally{this.handleLogoutCompleted()}return{code:0,data:{}}}))}getLoginUser(){return this._isLoginIn()?_n():""}isReady(){var J;return null===(J=_o.store.get("login"))||void 0===J?void 0:J.isReady}setCustomLoginInfo(J=""){this._customLoginInfo=J}handleLogoutCompleted(){this._updateAndEmitSDKNotReady(),this._reset(),on.getInstance().reset(),_o.notificationCenter.emitInnerEvent("logout")}getServerTime(){const{timeManager:J}=_o.common;return J.getServerTimeMs()}_updateAndEmitSDKReady(){_o.store.set("login",{isReady:!0}),setTimeout((()=>{_o.notificationCenter.emitOuterEvent(So.SDK_READY,{name:So.SDK_READY})}),1)}_updateAndEmitSDKNotReady(){_o.store.set("login",{isReady:!1}),_o.notificationCenter.emitOuterEvent(So.SDK_NOT_READY,{name:So.SDK_NOT_READY})}_validateAfterLogin(J){const Z="login";if(!J)throw new Ws({functionName:Z,message:"login response is empty"});const{tinyID:ee,a2Key:ne}=J||{};if(!ee)throw new Ws({functionName:Z,code:Wo.NO_TINYID});if(!ne)throw new Ws({functionName:Z,code:Wo.NO_A2KEY})}_createRepeatLoginResponse(){var J;return{code:0,data:{actionStatus:"OK",errorCode:0,errorInfo:Ks({code:"RepeatLogin",replacement1:null===(J=_o.store.get("login"))||void 0===J?void 0:J.userId}),repeatLogin:!0}}}_performLogin(J){return ge(this,void 0,void 0,(function*(){const{userID:Z,userSig:ee}=J;return _o.store.set("login",{userId:Z,userSig:ee}),this._latestLoginAt=Date.now(),js(this._customLoginInfo)}))}_ensureAsyncComplete(){return ge(this,void 0,void 0,(function*(){yield new Promise((J=>{setTimeout((()=>J(null)),1)}))}))}_handleLoginSuccess(J){const{timeManager:Z}=_o.common,{helloInterval:ee,timeStamp:ne,customStatus:se,purchaseBits:re}=J,ae=1e3*ne;Z.calculateTimeOffsetWithServer(this._latestLoginAt,ae),this._helloInterval=ee||120,this._updateLoginStore(J),_o.user.userStatus.setCustomStatus(se),on.getInstance().executeWorkflow(zo.SYNC_SERVER_INFO_AFTER_LOGIN,{purchaseBits:re}),_o.common.taskScheduler.addTask({id:pa,intervalMs:1e3*this._helloInterval,callback:this._sendOnlinePresenceRequest,context:this})}_performLogout(J){return function(J){return ge(this,void 0,void 0,(function*(){const{logoutReason:Z}=J,ee="im_open_status.wslogout",ne=_o.common.generateProtocolData({servcmd:ee,data:{wslogout_type:Z,isWebUniapp:0}}),se=`${ne.head.seq}${ee}`;return yield _o.channel.sendPacket(ne,{requestId:se})}))}({logoutReason:J})}_updateLoginStore(J){const{a2Key:Z,tinyID:ee,instanceID:ne,authKey:se}=J;_o.store.set("login",{a2Key:Z,tinyID:ee,statusInstanceId:ne,authKey:se,isLoggedIn:!0})}_sendOnlinePresenceRequest(){return ge(this,void 0,void 0,(function*(){this._latestSendOnlinePresenceRequestTime=Date.now();try{yield function(){const J="im_open_status.wshello",Z=_o.common.generateProtocolData({servcmd:J,data:{isWebUniapp:0}}),ee=`${Z.head.seq}${J}`;return _o.channel.sendPacket(Z,{requestId:ee})}()}catch(J){_o.ssoLog.warn("_sendOnlinePresenceRequest",` error:${J.message}`)}}))}_isLoginIn(){var J;return!0===(null===(J=_o.store.get("login"))||void 0===J?void 0:J.isLoggedIn)}_isLoginFrequencyExceeded(){return Date.now()-this._latestLoginAt<=15e3}_reset(){_o.common.taskScheduler.removeTask(pa),this._helloInterval=120,this._latestSendOnlinePresenceRequestTime=0,this._latestLoginAt=0,this._customLoginInfo="",_o.store.clear("login"),_o.store.set("login",{isReady:!1}),_o.store.set("instance",{applicationID:0})}_dispose(){this._reset();const{notificationCenter:J}=_o;J.unSubscribeInnerEvent(Mo.RECONNECTED,this._reLogin,this),J.unSubscribeInnerEvent(Mo.DESTROY,this._dispose,this)}}const Bp={login:{userID:{required:!0,rules:["string"],allowEmpty:!1},userSig:{required:!0,rules:["string"],allowEmpty:!1}}},qp={logout:!0};class Xd{constructor(){this.loginAction=new zd,this.kickedOutHandler=new Bs,this.loginAction.init(),this.kickedOutHandler.init(),sn({auth:qp,params:Bp})}}var Vp,$p,jp;!function(J){J.CONV_C2C="C2C",J.CONV_GROUP="GROUP",J.CONV_TOPIC="TOPIC",J.CONV_SYSTEM="@TIM#SYSTEM"}(Vp||(Vp={})),function(J){J.MSG_PRIORITY_HIGH="High",J.MSG_PRIORITY_NORMAL="Normal",J.MSG_PRIORITY_LOW="Low",J.MSG_PRIORITY_LOWEST="Lowest"}($p||($p={})),function(J){J.MSG_TEXT="TIMTextElem",J.MSG_CUSTOM="TIMCustomElem",J.MSG_LOCATION="TIMLocationElem",J.MSG_FACE="TIMFaceElem",J.MSG_IMAGE="TIMImageElem",J.MSG_AUDIO="TIMSoundElem",J.MSG_FILE="TIMFileElem",J.MSG_VIDEO="TIMVideoFileElem",J.MSG_GRP_TIP="TIMGroupTipElem",J.MSG_GRP_SYS_NOTICE="TIMGroupSystemNoticeElem",J.MSG_MERGER="TIMRelayElem"}(jp||(jp={}));const Hp={1:$p.MSG_PRIORITY_HIGH,2:$p.MSG_PRIORITY_NORMAL,3:$p.MSG_PRIORITY_LOW,4:$p.MSG_PRIORITY_LOWEST};var Kp;!function(J){J.IN="in",J.OUT="out"}(Kp||(Kp={}));const Wp={};function ch(J){if(!J)return 0;if(void 0===Wp[J]){const Z=new Date,ee=`3${Z.getHours()}`.slice(-2),ne=`0${Z.getMinutes()}`.slice(-2),se=`0${Z.getSeconds()}`.slice(-2);Wp[J]=parseInt([ee,ne,se,"0001"].join(""),10),console.log(`autoIncrementIndex start index:${Wp[J]}`)}else Wp[J]+=1;return Wp[J]}class uh{constructor(J){this.ID="",this.random=0,this.sequence=0,this.nameCard="",this.isRead=!1,this.isPeerRead=!1,this.isDeleted=!1,this.isResend=!1,this.hasRiskContent=!1,this._onlineOnlyFlag=!1,this.atUserList=[],this._groupAtInfoList=[],this.isBroadcastMessage=!1,this.priority=$p.MSG_PRIORITY_NORMAL,this._relayFlag=!1;const{clientTime:Z=_o.common.timeManager.getServerTimeSeconds()||0,senderTinyID:ee,currentUser:ne,needReadReceipt:se,isSupportExtension:re,customModerationConfigurationId:ae,to:le,from:pe,nick:_e="",avatar:ve="",time:ye,messageControlInfo:Fe,tinyID:qe,cloudCustomData:$e="",messageLifeTime:He,messageVersion:Ye=0,conversationType:Je,sequence:Xe,checkResult:Qe=0,isPlaceMessage:tt=0,messageFlagBits:nt,receiverList:it,isSystemMessage:ot=!1,status:pt=wo.SUCCESS,revokeReason:mt="",conversationSubType:It,clientSequence:St,protocol:Mt="JSON",revokerInfo:bt={userID:"",nick:"",avatar:""},readReceiptInfo:At={readCount:void 0,unreadCount:void 0,isPeerRead:void 0,timestamp:0},random:Ot,groupProfile:wt,atUserList:Dt,flow:Lt,isRead:kt=!1,priority:Ut=$p.MSG_PRIORITY_NORMAL,onlineOnlyFlag:Gt=!1,nameCard:xt=""}=J;var Ft;this.clientTime=Z,this.senderTinyID=ee||qe,this.needReadReceipt=!0===se||1===se,this.isSupportExtension=!0===re||1===re,this._cmConfigID=ae,this.to=le,this.nick=_e,this.avatar=ve,this.protocol=Mt,this.random=void 0===Ot?(Ft=Ft||99999999,Math.round(Math.random()*Ft)):Ot,this.time=ye||Math.ceil(Date.now()/1e3),this._isExcludedFromLastMessage=!!(null==Fe?void 0:Fe.excludedFromLastMessage),this._isExcludedFromUnreadCount=!!(null==Fe?void 0:Fe.excludedFromUnreadCount),this.isModified=!!Ye,this.cloudCustomData=$e,this.messageLifeTime=He,this.from=pe||null,this.sequence=Xe||0,this.conversationType=Je||Vp.CONV_C2C,this.hasRiskContent=Qe>1,this.version=Ye,this.isPlaceMessage=tt,this.isRevoked=2===tt||8===nt,this.isSystemMessage=ot,this.readReceiptInfo=At,this.revokeReason=mt,this.revokerInfo=bt,this._receiverList=it,this.conversationSubType=It,this.revoker=(null==bt?void 0:bt.revoker)||"",this.clientSequence=St||Xe||0,this.status=pt,this.atUserList=Dt||[],this.flow=Lt,this.isRead=kt,this.priority=Ut,this._onlineOnlyFlag=Gt,this.nameCard=xt,this.reInitialize(ne),this._initC2CReadReceiptInfo(J),this._extractGroupInfo(wt)}getElements(){return this._elements}isOnlineMessage(){return 0===this.messageLifeTime}setElement(J){Array.isArray(J)?this._elements=J:this._elements=[J],this._updatePayloadAndType()}transformElementsToServerFormat(){return this._elements?Array.isArray(this._elements)?this._elements.map((J=>J.transformToServerFormat())):this._elements.transformToServerFormat():null}setRelayFlag(J){this._relayFlag=J}validateBeforeSend(){var J,Z,ee;return this._relayFlag?{isValid:!0}:(null===(J=this._elements)||void 0===J?void 0:J.length)>0?null===(ee=null===(Z=this._elements[0])||void 0===Z?void 0:Z.validateBeforeSend)||void 0===ee?void 0:ee.call(Z):{isValid:!1}}_updatePayloadAndType(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}_initC2CReadReceiptInfo(J){const{readReceiptSentByPeer:Z,timestamp:ee=0}=J;this.conversationType===Vp.CONV_C2C&&!0===this.needReadReceipt&&(this.readReceiptInfo.isPeerRead=1===Z,this.readReceiptInfo.timestamp=ee)}_extractGroupInfo(J){if(!J)return;const{From_AccountNick:Z,From_AccountHeadurl:ee,MsgFrom_AccountExtraInfo:ne,GroupType:se}=J,{NameCard:re}=ne||{};"string"==typeof Z&&(this.nick=Z),"string"==typeof ee&&(this.avatar=ee),"string"==typeof re&&(this.nameCard=re),this.conversationSubType=se}reInitialize(J){J===this.from&&(this.isRead=!0),this._initSequence(J),this._concatConversationID(J),this.generateMessageID()}_concatConversationID(J){let Z="";const ee=this.conversationType;ee!==Vp.CONV_SYSTEM?(Z=ee===Vp.CONV_C2C?J===this.from?this.to:this.from:this.to,this.conversationID=Z?`${ee}${Z}`:null):this.conversationID=Vp.CONV_SYSTEM}_initSequence(J){0===this.clientSequence&&J&&(this.clientSequence=ch(J)),0===this.sequence&&this.conversationType===Vp.CONV_C2C&&(this.sequence=this.clientSequence)}generateMessageID(){this.from===Vp.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID=`${this.senderTinyID}-${this.clientTime}-${this.random}`}setIsRead(J){this.isRead=J}}class lh{static parseServerPushElement(J){const{MsgContent:Z={}}=J,{Data:ee,Ext:ne,Desc:se}=Z;return new lh({data:ee,description:se,extension:ne})}constructor(J){this.type=jp.MSG_CUSTOM;const{data:Z="",description:ee="",extension:ne=""}=J;this.content={data:Z,description:ee,extension:ne}}transformToServerFormat(J){const{isMergerMessage:Z=!1}=J||{},ee=Z?this.payload:this.content,{data:ne,description:se,extension:re}=ee;return{MsgType:this.type,MsgContent:{Data:ne,Ext:re,Desc:se}}}validateBeforeSend(){const{isEmpty:J}=_o.utils,Z=[this.content.data,this.content.description,this.content.extension].some((Z=>!J(Z)));return{isValid:Z,error:Z?null:{message:"content can not be empty"}}}}class dh{static parseServerPushElement(J){const{MsgContent:Z={Text:""}}=J,{Text:ee}=Z;return new dh({text:ee})}constructor(J){this.type=Oo.MSG_TEXT,this.content={text:J.text||""}}validateBeforeSend(){var J,Z;return(null===(Z=null===(J=this.content)||void 0===J?void 0:J.text)||void 0===Z?void 0:Z.length)>0?{isValid:!0}:{isValid:!1,error:{message:"content can not be empty"}}}transformToServerFormat(J){const{isMergerMessage:Z=!1}=J||{},ee=Z?this.payload:this.content,{text:ne}=ee;return{MsgType:this.type,MsgContent:{Text:ne}}}}var Yp=new class{constructor(){this._elementClassMap={[jp.MSG_CUSTOM]:lh,[jp.MSG_TEXT]:dh}}init(){Yd.getInstance().registerApi({apiName:"createCustomMessage",context:this}),Yd.getInstance().registerApi({apiName:"createTextMessage",context:this})}registerElementClass(J,Z){var ee;void 0!==(ee=Z).prototype&&"constructor"in ee.prototype&&(this._elementClassMap[J]=Z)}getElementClass(J){return this._elementClassMap[J]}createMessage(J){const{from:Z,flow:ee=Kp.OUT}=J,{userId:ne}=_o.store.get("login")||{};this._isSendByCurrentInstance({from:Z,flow:ee,currentUser:ne})?this._updateWithSenderInfo(J):this._isMultiEndpointSyncMessage({from:Z,flow:ee,currentUser:ne})&&(J.flow=Kp.OUT);const se=Object.assign(Object.assign({},J),{currentUser:ne});return new uh(se)}createCustomMessage(J){const Z=_n(),ee=this.createMessage(Object.assign(Object.assign({},J),{from:Z})),ne=this._elementClassMap[jp.MSG_CUSTOM];if(!ee)return null;if(ne){const Z=new ne(J.payload);ee.setElement(Z)}return ee}createTextMessage(J){var Z;if(!J)return null;const ee="string"==typeof J.payload?J.payload:(null===(Z=null==J?void 0:J.payload)||void 0===Z?void 0:Z.text)||"",ne=new dh({text:ee}),se=_n(),re=_o.message.messageFactory.createMessage(Object.assign(Object.assign({},J),{from:se}));return re.setElement(ne),re}_updateWithSenderInfo(J){var Z,ee;const{nick:ne,avatar:se,conversationType:re,to:ae}=J,{userId:le,tinyID:pe}=_o.store.get("login")||{},_e=xp.getUserProfile(le);return J.nick=ne||(null==_e?void 0:_e.nick)||"",J.avatar=se||(null==_e?void 0:_e.avatar)||"",J.tinyID=J.tinyID||pe||"",J.from=le,J.status=wo.UNSENT,J.flow=Kp.OUT,re===xo.CONV_GROUP&&(J.nameCard=null===(ee=null===(Z=Up.getGroup(ae))||void 0===Z?void 0:Z.selfInfo)||void 0===ee?void 0:ee.nameCard),J}_isMultiEndpointSyncMessage(J){const{from:Z,flow:ee,currentUser:ne}=J;return Z===ne&&ee===Kp.IN}_isSendByCurrentInstance(J){const{from:Z,flow:ee,currentUser:ne}=J;return Z===ne&&ee===Kp.OUT}};const zp={PushFlag:0,Title:"",Desc:"",Ext:"",ApnsInfo:{Sound:"",BadgeMode:0,IsVoipPush:void 0,Image:"",InterruptionLevel:"active",ContentAvailable:0},AndroidInfo:{Sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",OPPOCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:"",HonorImportance:"",MeizuNotifyType:void 0}},Jp={HonorImportance:{range:["LOW","NORMAL"],defaultValue:void 0},MeizuNotifyType:{range:[0,1],defaultValue:void 0}},Zp={enableIOSBackgroundNotification:{range:[!0,!1],defaultValue:!1},interruptionLevel:{range:["passive","active","time-sensitive","critical"],defaultValue:"active"}};function mh(J,Z){return Object.keys(Z).forEach((ee=>{const{range:ne,defaultValue:se}=Z[ee];J[ee]=ne.includes(J[ee])?J[ee]:se})),J}function vh(J){const Z=J.lastIndexOf(".");return-1===Z?J:J.slice(0,Z)}function fh(J){const{androidInfo:Z={},androidOPPOChannelID:ee=""}=J,ne=Z.OPPOChannelID||ee,se=mh(Z,Jp),{sound:re="",FCMChannelID:ae=""}=se,le=he(se,["sound","FCMChannelID"]);return Object.assign(Object.assign({},le),{Sound:vh(re),OPPOChannelID:ne,GoogleChannelID:ae})}function Ih(J){const{apnsInfo:Z={},ignoreIOSBadge:ee=!1,disableVoipPush:ne}=J,se=mh(Z,Zp),{ignoreIOSBadge:re,disableVoipPush:ae,enableIOSBackgroundNotification:le}=se,pe=he(se,["ignoreIOSBadge","disableVoipPush","enableIOSBackgroundNotification"]),_e=!0===re||!0===ee?1:0;let ve;return e(ne)||(ve=!1===ne?1:0),e(ae)||(ve=!1===ae?1:0),Object.assign(Object.assign({},pe),{BadgeMode:_e,IsVoipPush:ve,ContentAvailable:le?1:0})}function Eh(J){return _o.utils.isPlainObject(J)?{PushFlag:!0===J.disablePush?1:0,Title:J.title||"",Desc:J.description||"",Ext:J.extension||"",ApnsInfo:Ih(J),AndroidInfo:fh(J)}:zp}function Sh(J){const{From_AccountHeadurl:Z,From_AccountNick:ee,IsNeedReadReceipt:ne,IsPeerRead:se,IsSyncMsg:re,MsgBody:ae,MsgClientTime:le,MsgLifeTime:pe,MsgRandom:_e,MsgSeq:ve,MsgTimeStamp:ye,SendMsgControl:Fe,SupportMessageExtension:qe,TinyId:$e,MsgCheckResult:He,CloudCustomData:Ye,MsgVersion:Je,MsgFlagBits:Xe,RevokerInfo:Qe}=J;let tt,{From_Account:nt,To_Account:it}=J;if(1===re){const J=it;it=nt,nt=J}if(Qe){const{Reason:J,Revoker_Account:Z,Revoker_FromUin:ee}=Qe;tt={reason:J,revoker:Z,revokerFromUin:ee,userID:Z}}return{from:nt,avatar:Z,nick:ee,needReadReceipt:1===ne,isSyncMessage:re,clientTime:le,messageLifeTime:pe,random:_e,sequence:ve,time:ye,messageControlInfo:{excludedFromLastMessage:1===(null==Fe?void 0:Fe.NoLastMsg),excludedFromUnreadCount:1===(null==Fe?void 0:Fe.NoUnread)},isSupportExtension:qe,to:it,tinyID:$e,checkResult:He,cloudCustomData:Ye,revokerInfo:tt,messageVersion:Je,messageFlagBits:Xe,readReceiptSentByPeer:se,elements:Oh(ae),onlineOnlyFlag:0===pe}}function Ch(J){const{From_Account:Z,MsgBody:ee,MsgClientTime:ne,MsgRandom:se,MsgSeq:re,MsgTimeStamp:ae,To_Account:le,MsgVersion:pe,CloudCustomData:_e,MsgCheckResult:ve}=J;return{from:Z,clientTime:ne,random:se,sequence:re,time:ae,to:le,elements:Oh(ee),messageVersion:pe,cloudCustomData:_e,checkResult:ve}}function Mh(J){const{ClientSeq:Z,From_Account:ee,GroupInfo:ne,MsgBody:se,MsgClientTime:re,MsgRandom:ae,MsgSeq:le,MsgTimeStamp:pe,SendMsgControl:_e,SupportMessageExtension:ve,TinyId:ye,CloudCustomData:Fe,MsgVersion:qe,MsgCheckResult:$e,NeedReadReceipt:He,IsPlaceMsg:Ye,RevokerInfo:Je,GroupAtInfo:Xe,OnlineOnlyFlag:Qe}=J;let tt,nt=$p.MSG_PRIORITY_NORMAL;if(Object.keys(Hp).includes(String(J.MsgPriority))&&(nt=Hp[J.MsgPriority]),Je){const{Reason:J,Revoker_Account:Z,Revoker_FromUin:ee}=Je;tt={reason:J,revoker:Z,revokerFromUin:ee,userID:Z}}const it=function(J){const Z=[];return Array.isArray(J)&&J.forEach((J=>{0===J.GroupAtAllFlag?Z.push(J.GroupAt_Account):1===J.GroupAtAllFlag&&Z.push(Ko.MSG_AT_ALL)})),Z}(Xe);return{clientSequence:Z,from:ee,groupProfile:ne,clientTime:re,priority:nt,random:ae,sequence:le,time:pe,messageControlInfo:{excludedFromLastMessage:1===(null==_e?void 0:_e.NoLastMsg),excludedFromUnreadCount:1===(null==_e?void 0:_e.NoUnread)},isSupportExtension:ve,tinyID:ye,cloudCustomData:Fe,messageVersion:qe,checkResult:$e,needReadReceipt:He,isPlaceMessage:Ye,revokerInfo:tt,atUserList:it,elements:Oh(se),to:yh(J),onlineOnlyFlag:1===Qe}}function yh(J){const{utils:{isEmpty:Z},constants:{IS_TOPIC_MESSAGE:ee}}=_o,{ToGroupId:ne,GroupInfo:{MillionGroupFlag:se=0,TopicId:re}={}}=J;return se!==ee||Z(re)?ne:re}function Oh(J){if(!J)return null;if(Array.isArray(J))return J.map((J=>{const Z=_o.message.messageFactory.getElementClass(J.MsgType);return null==Z?void 0:Z.parseServerPushElement(J)}));const Z=_o.message.messageFactory.getElementClass(J.MsgType);return null==Z?void 0:Z.parseServerPushElement(J)}function Ah(J){const{From_Account:Z,MsgBody:ee,MsgClientTime:ne,MsgRandom:se,MsgSeq:re,MsgTimeStamp:ae,GroupId:le,TopicId:pe,MsgVersion:_e,CloudCustomData:ve,MsgCheckResult:ye}=J;return{from:Z,clientTime:ne,random:se,sequence:re,time:ae,groupID:le,topicID:pe,elements:Oh(ee),messageVersion:_e,cloudCustomData:ve,checkResult:ye}}function Th({conversationUpdateFields:J,message:Z}){const{conversationID:ee,conversationType:ne,conversationSubType:se,flow:re,_isExcludedFromUnreadCount:ae,_isExcludedFromLastMessage:le}=Z,pe=le?"":Z,_e=!ae&&re===Kp.IN;J.has(ee)?(J.get(ee).lastMessage=pe,_e&&J.get(ee).unreadCount++):J.set(ee,{conversationID:ee,type:ne,subType:se,unreadCount:_e?1:0,lastMessage:pe})}function Rh(J){return J.filter((J=>{const Z=!Ie(null==J?void 0:J._elements),ee=1===(null==J?void 0:J.isPlaceMessage);return Z||_o.ssoLog.error("emptyMessageBody",`from:${J.from} to:${J.to} sequence:${J.sequence}`),Z&&!ee}))}function Dh(J){const{messageDataHandler:Z}=_o.message;return!Z.isInMessageList(J)&&!Z.isMessageSentByCurrentInstance(J)}var Xp=Object.freeze({__proto__:null,autoIncrementIndex:ch,filterValidMessages:Rh,parseServerGroupMessage:Mh,parseServerPushC2CModifyMessage:Ch,parseServerPushGroupModifyMessage:Ah,parseServerPushMessage:Sh,parseServerPushMessageElement:Oh,shouldStoreMessage:Dh,updateConversationFields:Th});const{isPlainObject:Qp}=_o.utils;function Lh(J,Z={}){const{onlineUserOnly:ee,messageControlInfo:ne}=Z;let{offlinePushInfo:se}=Z;J.conversationType===Vp.CONV_C2C&&!0===ee&&(se?se.disablePush=!0:se={disablePush:!0});let re="";"string"==typeof J.cloudCustomData&&J.cloudCustomData.length>0&&(re=J.cloudCustomData);const ae=[];if(ne&&Qp(ne)){const{excludedFromUnreadCount:J,excludedFromLastMessage:Z,excludedFromContentModeration:ee}=ne;!0===J&&ae.push("NoUnread"),!0===Z&&ae.push("NoLastMsg"),!0===ee&&ae.push("NoMsgCheck")}return{onlineUserOnly:ee,cloudCustomData:re,messageControlInfo:ae,offlinePushInfo:se}}function Ph(J){const{webhookInfo:{disableCloudMessagePreHook:Z=!1,disableCloudMessagePostHook:ee=!1}={}}=J||{};if(!Z&&!ee)return;const ne=[];return Z&&ne.push("ForbidBeforeSendMsgCallback"),ee&&ne.push("ForbidAfterSendMsgCallback"),ne}function Gh(J,Z){return ge(this,void 0,void 0,(function*(){const ee=J.conversationType===Vp.CONV_GROUP?function(J,Z){var ee;const ne=Lh(J,Z),{onlineUserOnly:se,cloudCustomData:re,messageControlInfo:ae,offlinePushInfo:le}=ne,pe=JSON.parse(JSON.stringify(J.transformElementsToServerFormat()));let _e;return n(J._receiverList)&&J._receiverList.length>0&&(_e=J._receiverList,J._receiverList.length>50&&(_e=J._receiverList.slice(0,50),console.warn("ReceiverListLimit"))),{servcmd:"group_open_http_svc.send_group_msg",data:{From_Account:null===(ee=_o.store.get("login"))||void 0===ee?void 0:ee.userId,GroupId:J.to,MsgBody:pe,CloudCustomData:re,Random:J.random,MsgPriority:J.priority,ClientSeq:J.clientSequence,GroupAtInfo:J._groupAtInfoList,OnlineOnlyFlag:se?1:0,MsgClientTime:J.clientTime,OfflinePushInfo:Eh(le),SendMsgControl:se?void 0:ae,NeedReadReceipt:!0===J.needReadReceipt?1:0,To_Account:_e,SupportMessageExtension:!0===J.isSupportExtension?1:0,IsRelayMsg:!0===J._relayFlag?1:0,CustomModerationConfigID:J._cmConfigID,ForbidCallbackControl:Ph(Z)}}}(J,Z):function(J,Z){var ee;const ne=Lh(J,Z),{onlineUserOnly:se,cloudCustomData:re,messageControlInfo:ae,offlinePushInfo:le}=ne,pe=!0===se?0:void 0,_e=JSON.parse(JSON.stringify(J.transformElementsToServerFormat()));return{servcmd:"openim.sendmsg",data:{From_Account:null===(ee=_o.store.get("login"))||void 0===ee?void 0:ee.userId,To_Account:J.to,MsgBody:_e,CloudCustomData:re,MsgSeq:J.sequence,MsgRandom:J.random,MsgLifeTime:pe,From_AccountNick:J.nick,From_AccountHeadurl:J.avatar,SendMsgControl:0!==pe?ae:void 0,MsgClientTime:J.clientTime,IsNeedReadReceipt:!0===J.needReadReceipt?1:0,SupportMessageExtension:!0===J.isSupportExtension?1:0,IsRelayMsg:!0===J._relayFlag?1:0,CustomModerationConfigID:J._cmConfigID,OfflinePushInfo:Eh(le),ForbidCallbackControl:Ph(Z)}}}(J,Z),ne=yield dn(ee);return ne?{time:ne.MsgTime,messageDropReason:ne.MsgDropReason,sequence:ne.MsgSeq}:null}))}const{isPlainObject:eg}=_o.utils,{MSG_AUDIO:tg,MSG_FILE:ng,MSG_IMAGE:sg,MSG_VIDEO:ig,MSG_MERGER:rg}=Ko;class qh{init(){Yd.getInstance().registerApi({apiName:"sendMessage",context:this,matcher:J=>![tg,ng,sg,ig,rg].includes(J[0].type)})}sendMessage(J,Z){return ge(this,void 0,void 0,(function*(){const{TOTAL_COUNT:ee,SEND_COST:ne,SUCCESS_COUNT:se,FAILED_COUNT:re}=Qo;if(!(J instanceof uh))throw new Ws({code:Wo.MSG_INSTANCE_REQUIRED});const ae=J.validateBeforeSend();if(!ae.isValid){const{code:J,message:Z=""}=ae.error||{};throw new Ws({code:J,message:Z})}this._reportMessageSendQuality({name:ee,message:J});let le=!1;const{messageDataHandler:pe}=_o.message||{};try{const{messageControlInfo:ee}=Z||{};let re=null;pe.addRandomOfSentMessage(J.random);const ae=Date.now();if(J.conversationType===Vp.CONV_C2C?(le=!0===(null==Z?void 0:Z.onlineUserOnly),re=yield Gh(J,Z)):J.conversationType===Vp.CONV_GROUP&&(yield this._validateBeforeSendGroupMessage(J),re=yield Gh(J,Z)),re){const{messageDropReason:Z,sequence:_e,time:ve}=re;if(this._updateNickAndAvatarOfSentMessageByMe(J),Z&&this._logRateLimitInfo(J,_e,Z),this._reportMessageSendQuality({name:se,message:J}),this._reportMessageSendQuality({name:ne,message:J,startTs:ae}),!0===J.isResend){const Z=pe.findMessage(J.ID);Z&&(_o.ssoLog.debug("sendMessage",`sendMessage resend ok. ID:${Z.ID}`),pe.deleteConversationMessage(Z))}return J.status=wo.SUCCESS,J.time=ve,J.conversationType===Vp.CONV_GROUP&&(J.sequence=_e),le?J._onlineOnlyFlag=!0:(pe.storeConversationMessage(J),this._applySentMessageControlInfo(J,ee),this._emitOnlineMessageSent(J)),{code:0,data:{message:J}}}}catch(Z){J.status=wo.FAIL,pe.removeRandomOfSentMessage(J.random);let{errorCode:ee}=Z||{},ne=(null==Z?void 0:Z.errorInfo)||(null==Z?void 0:Z.message)||"";throw this._hasRiskContent(ee)&&(J.hasRiskContent=!0),le||this._isRejectedByRestApi(ee)||pe.storeConversationMessage(J),this._reportMessageSendQuality({name:re,message:J,error:Z}),new Ws({code:ee,message:ne,data:{message:J},moreMessage:`type:${J.type} from:${J.from} to:${J.to}`})}}))}_hasRiskContent(J){return 80001===J||80004===J}_isRejectedByRestApi(J){return J>=10100&&J<=10200||J>=120001&&J<=13e4}_emitOnlineMessageSent(J){const Z=J._isExcludedFromLastMessage?"":J,{conversationID:ee,conversationType:ne}=J,se=cn(ee)?Mo.TOPIC_NEW_MESSAGE:Mo.NEW_MESSAGE;_o.notificationCenter.emitInnerEvent(se,{result:{conversationUpdateFieldList:[{conversationID:ee,type:ne,message:J,lastMessage:Z,unreadCount:0}]}})}_applySentMessageControlInfo(J,Z){Z&&eg(Z)&&(!0===Z.excludedFromLastMessage&&(J._isExcludedFromLastMessage=!0),!0===Z.excludedFromUnreadCount&&(J._isExcludedFromUnreadCount=!0))}_logRateLimitInfo(J,Z,ee){const ne=`from:${J.from} to:${J.to} sequence:${Z} messageDropReason:${ee}`;_o.ssoLog.warn("messageDropReason",ne)}_updateNickAndAvatarOfSentMessageByMe(J){const{messageDataHandler:Z}=_o.message||{};let ee=!1;const{conversationID:ne}=J,se=Z.getLatestMsgSentByMe(ne);if(se){const{nick:re,avatar:ae}=se;re===J.nick&&ae===J.avatar||(ee=!0),ee&&Z.updateNickAndAvatarOfSentMessage({conversationID:ne,latestNick:J.nick,latestAvatar:J.avatar,isSentByMe:!0})}}_validateBeforeSendGroupMessage(J){return ge(this,void 0,void 0,(function*(){var Z,ee,ne;const{to:se,from:re}=J;let ae=se,le=Up.getGroup(ae);if(an({groupID:ae})&&(null==le?void 0:le.isSupportTopic))throw new Ws({code:Wo.MSG_SEND_GRP_WITH_TOPIC_FAIL});if(cn(se)&&([ae]=se.split(Vo.TOPIC),le=Up.getGroup(ae)),!le&&"function"==typeof(null===(Z=Yd.getInstance().getApiMap())||void 0===Z?void 0:Z.getGroupProfile)){const J=yield Yd.getInstance().getApiMap().getGroupProfile({groupID:ae});if((null===(ne=null===(ee=null==J?void 0:J.data)||void 0===ee?void 0:ee.group)||void 0===ne?void 0:ne.type)===Ko.GRP_AVCHATROOM){const J=Ks({code:Wo.MSG_SEND_FAIL_NOT_IN_AV,replacement1:re,replacement2:ae});throw new Ws({code:Wo.MSG_SEND_FAIL_NOT_IN_AV,message:J})}}return!0}))}_reportMessageSendQuality(J){_o.notificationCenter.emitInnerEvent(Mo.QUALITY_STAT,{label:Xo.MESSAGE_SEND_SUCCESS_RATE,data:J})}}var og=new class{constructor(){this._sparseMessagesByConversation=new Map,this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map,this._randomOfSentMessageList=new Set}init(){_o.notificationCenter.subscribeInnerEvent(Mo.LOGOUT,this._reset,this),_o.notificationCenter.subscribeInnerEvent(Mo.DESTROY,this._dispose,this)}get _messagesByConversation(){return Gp.getMessages()}storeConversationMessage(J,Z=!1){const{conversationID:ee}=J;if(!ee)return!1;if(this._messagesByConversation.has(ee)||this._messagesByConversation.set(ee,new Map),this._shouldSkipStoreMessage(J,Z))return!1;const ne=this._getUniqueIdOfMessage(J);return this._messagesByConversation.get(ee).set(ne,J),this._updateLatestMessageMap(J),!0}_updateLatestMessageMap(J){const{conversationID:Z}=J;"out"===J.flow?this._setLatestMsgSentByMe(Z,J):Z.startsWith("C2C")&&this._setLatestMsgSentByPeer(Z,J)}_shouldSkipStoreMessage(J,Z){const ee=this._getUniqueIdOfMessage(J),ne=this._messagesByConversation.get(J.conversationID);if(null==ne?void 0:ne.has(ee)){const J=null==ne?void 0:ne.get(ee);if(!Z||!0===(null==J?void 0:J.isModified))return!0}return!1}deleteConversationMessage(J){var Z;const{conversationID:ee=""}=J,ne=this._getUniqueIdOfMessage(J);this._messagesByConversation.has(ee)&&(null===(Z=this._messagesByConversation.get(ee))||void 0===Z||Z.delete(ne))}modifyConversationMessage(J,Z){var ee;if(!this._messagesByConversation.has(J)&&!this._sparseMessagesByConversation.has(J))return{isUpdated:!1,message:null};const ne=this._getUniqueIdOfMessage(Z),se=this._getMessageFromLocalMessage(J,ne);if(se){const{messageVersion:ne,elements:re,cloudCustomData:ae,checkResult:le=0}=Z,pe=le>1;if(console.log(`conversationToMessageMap modifyConversationMessage localVersion:${se.version} remoteVersion:${ne}`),se.version<ne){const Z=this._getUniqueIdOfMessage(se),le=Ee(re);return(null===(ee=this._messagesByConversation.get(J))||void 0===ee?void 0:ee.has(Z))?Gp.updateMessage(J,[Z],{isModified:!0,version:ne,_elements:le,payload:le[0].content,type:le[0].type,cloudCustomData:ae,hasRiskContent:pe,operation:Ro.modify}):(se.version=ne,se._elements=le,se.payload=se._elements[0].content,se.type=se._elements[0].type,se.cloudCustomData=ae,se.isModified=!0,se.hasRiskContent=pe),{isUpdated:!0,message:se}}return{isUpdated:!1,message:se}}return{isUpdated:!1,message:null}}_getMessageFromLocalMessage(J,Z){var ee;if(this._messagesByConversation.has(J))return null===(ee=this._messagesByConversation.get(J))||void 0===ee?void 0:ee.get(Z);if(this._sparseMessagesByConversation.has(J)){const ee=[...this._sparseMessagesByConversation.get(J).values()];for(let J=0;J<ee.length;J++)if(this._getUniqueIdOfMessage(ee[J])===Z)return ee[J]}return null}findMessage(J){let Z=null;const ee=Array.from(this._messagesByConversation.values());for(const ne of ee)if(Z=Array.from(ne.values()).find((Z=>Z.ID===J))||null,Z)break;if(!Z){const ee=Array.from(this._sparseMessagesByConversation.values());for(const ne of ee)if(Z=ne.get(J)||null,Z)break}return Z}deleteConversationMessageList(J){this._messagesByConversation.has(J)&&(this._messagesByConversation.delete(J),this._latestMessageSentByMeMap.delete(J),this._latestMessageSentByPeerMap.delete(J)),this._sparseMessagesByConversation.has(J)&&this._sparseMessagesByConversation.delete(J)}revokeMessage({conversationID:J,sequence:Z,random:ee,revoker:ne}){const se=this._messagesByConversation.get(J);let re=null;if(se){const ae=Array.from(se.values());if(re=this._findMessageBySequenceAndRandom({messageList:ae,random:ee,sequence:Z}),re){const Z=this._getUniqueIdOfMessage(re);return Gp.updateMessage(J,[Z],{isRevoked:!0,revoker:ne,operation:Ro.revoke}),re}}if(this._sparseMessagesByConversation.has(J)){const se=Array.from(this._sparseMessagesByConversation.get(J).values());if(re=this._findMessageBySequenceAndRandom({messageList:se,random:ee,sequence:Z}),re)return re.isRevoked=!0,re.revoker=ne,re}}_findMessageBySequenceAndRandom({messageList:J,sequence:Z,random:ee}){for(let ne=0;ne<J.length;ne+=1){const se=J[ne];if(se.sequence===Z&&(e(ee)||se.random===ee))return se}return null}prependLocalMessageList(J){const{messageList:Z,conversationID:ee}=J;if(0===Z.length)return[];const ne=[],se=[],re=this._messagesByConversation.get(ee)||new Map;for(const J of Z){const Z=this._getUniqueIdOfMessage(J);re.has(Z)||(ne.push(J),se.push([Z,J]))}if(se.length>0){const J=new Map([...se,...re.entries()]);this._messagesByConversation.set(ee,J),this._updateLatestMessageSentByMe(ee),this._updateLatestMessageSentByPeer(ee)}return ne}storeSparseMessageList(J){if(0===J.length)return;const{conversationID:Z}=J[0],ee=J.length;this._sparseMessagesByConversation.has(Z)||this._sparseMessagesByConversation.set(Z,new Map);const ne=this._sparseMessagesByConversation.get(Z);for(let Z=0;Z<ee;Z++){const ee=J[Z];ne.has(ee.ID)||ne.set(ee.ID,ee)}}_updateLatestMessageSentByMe(J){var Z;const ee=Array.from((null===(Z=this._messagesByConversation.get(J))||void 0===Z?void 0:Z.values())||[]);if(0!==ee.length)for(let Z=ee.length-1;Z>=0;Z--)if("out"===ee[Z].flow){this._setLatestMsgSentByMe(J,ee[Z]);break}}_updateLatestMessageSentByPeer(J){var Z;const ee=Array.from((null===(Z=this._messagesByConversation.get(J))||void 0===Z?void 0:Z.values())||[]);if(0!==ee.length&&J.startsWith("C2C"))for(let Z=ee.length-1;Z>=0;Z--)if("in"===ee[Z].flow){this._setLatestMsgSentByPeer(J,ee[Z]);break}}_getUniqueIdOfMessage(J){const{from:Z,to:ee,random:ne,sequence:se,time:re}=J;return`${Z}-${ee}-${ne}-${se}-${re}`}_setLatestMsgSentByPeer(J,Z){this._latestMessageSentByPeerMap.set(J,Z)}_setLatestMsgSentByMe(J,Z){this._latestMessageSentByMeMap.set(J,Z)}getLatestMsgSentByPeer(J){return this._latestMessageSentByPeerMap.get(J)}getLatestMsgSentByMe(J){return this._latestMessageSentByMeMap.get(J)}addRandomOfSentMessage(J){this._randomOfSentMessageList.add(J)}removeRandomOfSentMessage(J){this._randomOfSentMessageList.delete(J)}updateNickAndAvatarOfSentMessage(J){const{conversationID:Z="",latestAvatar:ee,latestNick:ne,isSentByMe:se=!0}=J,re=this._messagesByConversation.get(Z);if(!re)return;const ae=Array.from(re.values()),le=se?"out":"in";ae.forEach((J=>{const{nick:Z,avatar:se,flow:re}=J;re===le&&(Z!==ne&&(J.nick=ne),se!==ee&&(J.avatar=ee))}))}isInMessageList(J){var Z;const{conversationID:ee}=J;if(!ee)return!1;if(!this._messagesByConversation.has(ee))return!1;const ne=this._getUniqueIdOfMessage(J);return null===(Z=this._messagesByConversation.get(ee))||void 0===Z?void 0:Z.has(ne)}isMessageSentByCurrentInstance(J){const{random:Z}=J;return this._randomOfSentMessageList.has(Z)}getContinuousMessagesByConversation(){return this._messagesByConversation}getLocalMessageList(J){const Z=this._messagesByConversation.get(J);return Z?[...Z.values()]:[]}getSparseMessageList(J){const Z=this._sparseMessagesByConversation.get(J);return Z?[...Z.values()]:[]}_reset(){this._messagesByConversation.clear(),this._latestMessageSentByPeerMap.clear(),this._latestMessageSentByMeMap.clear(),this._randomOfSentMessageList.clear()}_dispose(){this._reset(),_o.notificationCenter.unSubscribeInnerEvent(Mo.LOGOUT,this._reset,this),_o.notificationCenter.unSubscribeInnerEvent(Mo.DESTROY,this._dispose,this)}};function Bh(J,Z){const ee=Pp.getConversation(J);if(null==ee?void 0:ee.lastMessage){const{lastMessage:ne}=ee,{lastTime:se,lastSequence:re,version:ae}=ne,{time:le,sequence:pe,messageVersion:_e,elements:ve,cloudCustomData:ye}=Z;se===le&&re===pe&&ae!==_e&&(ne.type=ve[0].type,ne.payload=ve[0].content,ne.messageForShow=Sn(ne.type,ne.payload),ne.cloudCustomData=ye,ne.version=_e,Pp.updateConversation(J,{lastMessage:ne}))}}class jh{init(){Yd.getInstance().registerApi({apiName:"modifyMessage",context:this})}modifyMessage(J){return ge(this,void 0,void 0,(function*(){const{to:Z,payload:ee,sequence:ne,conversationType:se,random:re,time:ae,from:le,type:pe}=J;if(this._canModifyMessageElement(pe)){const Z=(null==J?void 0:J._elements)||[];Z.length>=1&&(Z[0].type=pe,Z[0].content=ee)}try{let ee=null,pe=null;if(se===Vp.CONV_C2C?ee=yield function(J){return ge(this,void 0,void 0,(function*(){const{from:Z,to:ee,version:ne=0,sequence:se,random:re,time:ae,type:le,cloudCustomData:pe}=J,_e={From_Account:Z,To_Account:ee,MsgVersion:ne,MsgSeq:se,MsgRandom:re,MsgTime:ae,MsgType:le,MsgBody:J.transformElementsToServerFormat(),CloudCustomData:pe},ve=yield dn({servcmd:"openim.modify_c2c_msg",data:_e});if(ve){const{MsgBody:J,MsgVersion:Z,CloudCustomData:ee}=ve;return{elements:Oh(J),messageVersion:Z,cloudCustomData:ee}}}))}(J):se===Vp.CONV_GROUP&&(ee=yield function(J){return ge(this,void 0,void 0,(function*(){const{to:Z,version:ee=0,sequence:ne,cloudCustomData:se}=J,re={GroupId:Z,MsgVersion:ee,MsgSeq:ne,MsgBody:J.transformElementsToServerFormat(),CloudCustomData:se},ae=yield dn({servcmd:"openim.modify_group_msg",data:re});if(ae){const{MsgBody:J,MsgVersion:Z,CloudCustomData:ee}=ae;return{elements:Oh(J),messageVersion:Z,cloudCustomData:ee}}}))}(J)),ee){let _e=`${se}${Z}`;return Z===_n()&&se===Vp.CONV_C2C&&(_e=`${se}${le}`),pe={conversationType:se,from:le,to:Z,time:ae,random:re,sequence:ne,elements:null==ee?void 0:ee.elements,cloudCustomData:null==ee?void 0:ee.cloudCustomData,messageVersion:null==ee?void 0:ee.messageVersion,conversationID:_e},this._handleModifyMessageSuccess(pe),{code:0,data:{message:J},successLog:{message:`to:${Z}`}}}}catch(J){const{errorCode:Z}=J||{};throw new Ws({functionName:"modifyMessage",code:Z})}}))}_handleModifyMessageSuccess(J){const{conversationID:Z}=J,{isUpdated:ee,message:ne}=_o.message.messageDataHandler.modifyConversationMessage(Z,J);!0===ee&&_o.notificationCenter.emitOuterEvent(So.MESSAGE_MODIFIED,{name:So.MESSAGE_MODIFIED,data:[ne]}),_o.notificationCenter.emitInnerEvent(Mo.MESSAGE_MODIFIED,{conversationID:Z,message:ne}),Bh(Z,J)}_canModifyMessageElement(J){return[jp.MSG_TEXT,jp.MSG_CUSTOM,jp.MSG_LOCATION,jp.MSG_FACE].includes(J)}}class Hh{init(){const{notificationCenter:J}=_o,{InnerEventSubType:Z}=J;on.getInstance().registerWorkflowStep(zo.RECEIVE_C2C_NEW_MESSAGE,Jo.HANDLE_C2C_NEW_MESSAGE,this._handleC2CMessagePush,this),on.getInstance().registerWorkflowStep(zo.RECEIVE_C2C_NEW_MESSAGE,Jo.EMIT_C2C_MESSAGE_EVENT,this._emitMessageEventsAfterReceiveNewMessage,this),on.getInstance().registerWorkflowStep(zo.SYNC_SERVER_INFO_AFTER_RE_ONLINE,Jo.EMIT_C2C_MESSAGE_EVENT,this._emitMessageEventsAfterSyncUnreadMessage,this),J.subscribeInnerEvent(Mo.MESSAGE_PUSH,Z.C2C_REALTIME_MESSAGE,this._executeReceiverNewMessageWorkFlow,this),J.subscribeInnerEvent(Mo.MESSAGE_PUSH,Z.C2C_MESSAGE_MODIFIED,this._handleC2CMessageModify,this),J.subscribeInnerEvent(Mo.DESTROY,this._dispose,this)}_executeReceiverNewMessageWorkFlow(J){on.getInstance().executeWorkflow(zo.RECEIVE_C2C_NEW_MESSAGE,J)}_handleC2CMessagePush(J){const Z=J.data||{},{messageDataHandler:ee}=_o.message||{},ne=[],se=new Map;return Z.C2cMsgArray.forEach((J=>{const Z=this._generateC2CMessage(J);this._updateMessageProfile(Z);let re=1===Z.isModified;ee.isMessageSentByCurrentInstance(Z)?Z.isModified=re:re=!1,Z._onlineOnlyFlag?ee.isMessageSentByCurrentInstance(Z)||ne.push(Z):Dh(Z)&&(ee.storeConversationMessage(Z)&&Th({conversationUpdateFields:se,message:Z}),ee.isMessageSentByCurrentInstance(Z)&&!re||ne.push(Z))})),{conversationUpdateFieldList:[...se.values()],messages:ne}}_emitMessageEventsAfterReceiveNewMessage(J){var Z;const{messages:ee=[]}=(null===(Z=J.result)||void 0===Z?void 0:Z[Jo.HANDLE_C2C_NEW_MESSAGE])||{};this._emitMessageEvents(ee)}_emitMessageEventsAfterSyncUnreadMessage(J){var Z;const{messages:ee=[]}=(null===(Z=J.result)||void 0===Z?void 0:Z[Jo.UNREAD_MESSAGE_SYNC])||{};this._emitMessageEvents(ee)}_emitMessageEvents(J){const Z=(null==J?void 0:J.filter((J=>!0===(null==J?void 0:J.isModified))))||[];Z.length>0&&_o.notificationCenter.emitOuterEvent("onMessageModified",{name:"onMessageModified",data:Z});const ee=null==J?void 0:J.filter((J=>!(null==J?void 0:J.isModified)));ee.length>0&&_o.notificationCenter.emitOuterEvent("onMessageReceived",{name:"onMessageReceived",data:ee})}_generateC2CMessage(J){const Z=Vp.CONV_C2C,ee=Sh(J),ne=_o.message.messageFactory.createMessage(Object.assign(Object.assign({},ee),{conversationType:Z,flow:Kp.IN})),{elements:se}=ee;return ne.setElement(se),ne}_updateMessageProfile(J){var Z;const{messageDataHandler:ee}=_o.message||{},ne=null===(Z=_o.store.get("login"))||void 0===Z?void 0:Z.userId,{from:se,nick:re,avatar:ae,conversationID:le=""}=J;if(se!==ne){const Z=ee.getLatestMsgSentByPeer(le);if(Z){const{nick:ne,avatar:se}=Z;e(re)||e(ae)?(J.nick=t(ne)?ne:J.nick,J.avatar=t(se)?se:J.avatar):re===ne&&ae===se||(ee.updateNickAndAvatarOfSentMessage({conversationID:le,latestNick:re,latestAvatar:ae,isSentByMe:!1}),this._updateConversationUserProfile({conversationID:le,nick:re,avatar:ae}))}}else{const J=ee.getLatestMsgSentByMe(le);!J||re===J.nick&&ae===J.avatar||ee.updateNickAndAvatarOfSentMessage({conversationID:le,latestNick:re,latestAvatar:ae,isSentByMe:!0})}}_updateConversationUserProfile(J){const{conversationID:Z,nick:ee,avatar:ne}=J,se=Pp.getConversation(Z),{userProfile:re={}}=se||{};re.avatar===ne&&re.nick===ee||Pp.updateConversation(Z,{userProfile:Object.assign(Object.assign({},re),{nick:ee,avatar:ne})})}_updateMessageListDueToModify(J){const{conversationID:Z}=J,{isUpdated:ee,message:ne}=_o.message.messageDataHandler.modifyConversationMessage(Z,J);!0===ee&&_o.notificationCenter.emitOuterEvent("onMessageModified",{name:"onMessageModified",data:[ne]}),_o.notificationCenter.emitInnerEvent("ModifyMessageSuccess",J),Bh(Z,J)}_handleC2CMessageModify(J){J.C2cMsgModNotifys.forEach((J=>{var Z;const ee=Vp.CONV_C2C;let ne=Ch(J);const{to:se,from:re}=ne;let ae=`${ee}${se}`;se===(null===(Z=_o.store.get("login"))||void 0===Z?void 0:Z.userId)&&(ae=`${ee}${re}`),ne=Object.assign({conversationType:ee,conversationID:ae},ne),this._updateMessageListDueToModify(ne)}))}_dispose(){const{notificationCenter:J}=_o,{InnerEventSubType:Z}=J;_o.notificationCenter.unSubscribeInnerEvent(Mo.MESSAGE_PUSH,Z.C2C_REALTIME_MESSAGE,this._handleC2CMessagePush,this),_o.notificationCenter.unSubscribeInnerEvent(Mo.MESSAGE_PUSH,Z.C2C_MESSAGE_MODIFIED,this._handleC2CMessageModify,this),_o.notificationCenter.unSubscribeInnerEvent(Mo.DESTROY,this._dispose,this)}}class Kh{init(){const{notificationCenter:J}=_o,{InnerEventSubType:Z}=J;on.getInstance().registerWorkflowStep(zo.RECEIVE_GROUP_NEW_MESSAGE,Jo.HANDLE_GROUP_NEW_MESSAGE,this._handleGroupMessagePush,this),on.getInstance().registerWorkflowStep(zo.RECEIVE_GROUP_NEW_MESSAGE,Jo.EMIT_GROUP_MESSAGE_EVENT,this._emitMessageEvents,this),J.subscribeInnerEvent(Mo.MESSAGE_PUSH,Z.GROUP_REALTIME_MESSAGE,this._executeReceiverNewMessageWorkFlow,this),J.subscribeInnerEvent(Mo.MESSAGE_PUSH,Z.GROUP_MESSAGE_MODIFIED,this._handleGroupMessageModify,this),J.subscribeInnerEvent(Mo.DESTROY,this._dispose,this)}_executeReceiverNewMessageWorkFlow(J){this._canExecuteReceiverNewMessageWorkFlow(J)&&on.getInstance().executeWorkflow(zo.RECEIVE_GROUP_NEW_MESSAGE,J)}_handleGroupMessagePush(J){const Z=J.data||{},{messageDataHandler:ee}=_o.message,ne=[],se=new Map,re=null==Z?void 0:Z.GroupMsgArray;return null==re||re.forEach((J=>{if(1===J.GroupInfo.NotVisible)return;const Z=this._generateGroupMessage(J);this.updateMessageProfile(Z);let re=1===Z.isModified;ee.isMessageSentByCurrentInstance(Z)?Z.isModified=re:re=!1,Z._onlineOnlyFlag?ee.isMessageSentByCurrentInstance(Z)||ne.push(Z):Dh(Z)&&ee.storeConversationMessage(Z)&&(ne.push(Z),Th({conversationUpdateFields:se,message:Z}))})),{conversationUpdateFieldList:[...se.values()],messages:ne}}_emitMessageEvents(J){var Z;const{messages:ee}=(null===(Z=J.result)||void 0===Z?void 0:Z[Jo.HANDLE_GROUP_NEW_MESSAGE])||{},ne=(null==ee?void 0:ee.filter((J=>!0===(null==J?void 0:J.isModified))))||[];ne.length>0&&_o.notificationCenter.emitOuterEvent("onMessageModified",{name:"onMessageModified",data:ne});const se=(null==ee?void 0:ee.filter((J=>!(null==J?void 0:J.isModified))))||[];se.length>0&&_o.notificationCenter.emitOuterEvent("onMessageReceived",{name:"onMessageReceived",data:se})}_generateGroupMessage(J){const Z=Vp.CONV_GROUP,ee=Mh(J),ne=_o.message.messageFactory.createMessage(Object.assign(Object.assign({},ee),{conversationType:Z,flow:Kp.IN})),{elements:se}=ee;return ne.setElement(se),ne}updateMessageProfile(J){var Z;const{messageDataHandler:ee}=_o.message||{},ne=null===(Z=_o.store.get("login"))||void 0===Z?void 0:Z.userId,{from:se,nick:re,avatar:ae,conversationID:le="",_elements:pe}=J;if(se===ne){const J=ee.getLatestMsgSentByMe(le);!J||re===J.nick&&ae===J.avatar||ee.updateNickAndAvatarOfSentMessage({conversationID:le,latestNick:re,latestAvatar:ae,isSentByMe:!0})}else if(se===Ko.CONV_SYSTEM){const{operationType:Z,memberInfoList:ee,operatorInfo:ne}=pe;let se={};if(Ie(ee)?Ie(ne)||(se=ne):[$o.JOINED,$o.KICKED,$o.ADMIN_SET,$o.ADMIN_CANCELED].includes(Z)&&(se=Object.assign({},ee[0])),!Ie(se)){const{nick:Z="",avatar:ee=""}=se;J.nick=Z,J.avatar=ee}}}_updateMessageListDueToModify(J){const{conversationID:Z}=J,{isUpdated:ee,message:ne}=_o.message.messageDataHandler.modifyConversationMessage(Z,J);!0===ee&&_o.notificationCenter.emitOuterEvent("onMessageModified",{name:"onMessageModified",data:[ne]}),Bh(Z,J)}_handleGroupMessageModify(J){J.GroupMsgModNotifys.forEach((J=>{const Z=Vp.CONV_GROUP;let ee=Ah(J);const{topicID:ne,groupID:se}=ee,re=ne||se,ae=`${Z}${re}`;ee=Object.assign({conversationType:Z,conversationID:ae,to:re},ee),this._updateMessageListDueToModify(ee)}))}_dispose(){const{notificationCenter:J}=_o,{InnerEventSubType:{GROUP_REALTIME_MESSAGE:Z,GROUP_MESSAGE_MODIFIED:ee}}=J;J.unSubscribeInnerEvent(Mo.MESSAGE_PUSH,Z,this._handleGroupMessagePush,this),J.unSubscribeInnerEvent(Mo.MESSAGE_PUSH,ee,this._handleGroupMessageModify,this),J.unSubscribeInnerEvent(Mo.DESTROY,this._dispose,this)}_canExecuteReceiverNewMessageWorkFlow(J){var Z,ee;const{GroupId:ne,GroupType:se}=(null===(ee=null===(Z=null==J?void 0:J.GroupMsgArray)||void 0===Z?void 0:Z[0])||void 0===ee?void 0:ee.GroupInfo)||{},re=se===qo.GRP_AVCHATROOM;return!(!Up.getGroup(ne)&&re)}}var ag=new class{constructor(){this.c2cMessageReceiver=new Hh,this.groupMessageReceiver=new Kh}init(){this.c2cMessageReceiver.init(),this.groupMessageReceiver.init()}};const cg={createCustomMessage:{to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1},payload:{required:!0,rules:["object"],allowEmpty:!1},cloudCustomData:{required:!1,rules:["string"],allowEmpty:!1},priority:{required:!1,rules:["string"],allowEmpty:!1},customModerationConfigurationID:{required:!1,rules:["string"],allowEmpty:!1}},sendMessage:[{key:"message",required:!0,rules:["object"],allowEmpty:!1},{key:"options",required:!1,rules:["object"],allowEmpty:!1}],createTextMessage:{to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1,customValidator:J=>!(!J.startsWith("C2C")&&!J.startsWith("GROUP"))||"conversationType is invalid."},payload:{required:!0,rules:["object"],allowEmpty:!1,customValidator:J=>function(J){var Z;return"string"==typeof(null==J?void 0:J.text)&&("string"!=typeof J.text||0!==(null===(Z=null==J?void 0:J.text)||void 0===Z?void 0:Z.length))||"payload.text must be a string"}(J)}}},dg={createCustomMessage:!0,sendMessage:!0,modifyMessage:!0};var pg=new class{constructor(){this._historyMessageListFetchAnchors=new Map,this.completedHistoryConversations=new Set}getGroupRoamingMessagesByAnchor(J){return ge(this,void 0,void 0,(function*(){try{const{conversationID:Z,count:ee,direction:ne,sequence:se,messageSequenceList:re,shouldMarkCompleted:ae=!1,getType:le}=J,pe=Z.replace(xo.CONV_GROUP,""),_e=[];let ve=se;if(ne===Do.BACKWARD){if("number"!=typeof se)return{messageList:[],hasNoMoreHistoryMessage:!1,nextReqMessageIDFromServer:""};ve=se+ee-1}const ye=yield function(J){return ge(this,void 0,void 0,(function*(){const{groupID:Z,count:ee,messageSequence:ne,messageSequenceList:se,getType:re}=J,ae={GroupId:Z,ReqMsgNumber:ee,WithRecalledMsg:1,Version:1,GetType:re};return ne&&(ae.ReqMsgSeq=ne),n(se)&&se.length>0&&(ae.ReqMsgSeqList=se),yield dn({servcmd:"group_open_http_svc.group_msg_get",data:ae})}))}({groupID:pe,count:ee,messageSequence:ve,messageSequenceList:re,getType:le});if(ye){const{RspMsgList:J=[],NextReqMsgSeq:ee=0,IsFinished:re,InvisibleMsgSeq:le}=ye,Fe=`groupID:${pe} sequence:${se} reqSeq:${ve} direction:${ne} complete:${re} nextSequence:${ee} remoteMsgCount:${J.length} invisibleSequenceList:${le}`,qe=[];for(let Z=0;Z<J.length;Z++){const ee=J[Z];ee.From_Account===Ko.CONV_SYSTEM&&_e.push(ee);const ne=this._parseMessage(ee);qe.push(ne)}qe.reverse();let $e=2===re;ne===Do.BACKWARD&&($e=qe[qe.length-1].sequence>=se),$e&&ae&&this.completedHistoryConversations.add(Z);const He=Rh(qe);return _o.ssoLog.info("getGroupRoamingMessagesByAnchor",Fe),{messageList:He,invisibleSequenceList:le,nextReqMessageIDFromServer:ee,hasNoMoreHistoryMessage:$e,serverGroupTipList:_e}}}catch(J){const{errorCode:Z,errorInfo:ee}=J||{};throw new Ws({code:Z,message:ee})}}))}clearHistoryMessageListFetchAnchors(J){this._historyMessageListFetchAnchors.delete(J)}isHistoryMessageFetchCompleted(J){return this.completedHistoryConversations.has(J)}_parseMessage(J){var Z;const ee=xo.CONV_GROUP;4===J.Event&&(J.MsgBody.MsgType=Ko.MSG_GRP_TIP);const ne=Mh(J),se=Yp.createMessage(Object.assign(Object.assign({},ne),{conversationType:ee,flow:"in"}));return $d((null===(Z=ne.elements)||void 0===Z?void 0:Z.content)||{},se),se.setElement(ne.elements),se}getC2CRoamingMessagesByAnchor(J){return ge(this,void 0,void 0,(function*(){var Z;try{const{conversationID:ee,count:ne,messageID:se,time:re,direction:ae,shouldMarkCompleted:le=!1}=J;let pe=re,_e="";if(!re){const J=se?_o.message.messageDataHandler.findMessage(se):null;if(pe=(null==J?void 0:J.time)||0,se&&this._historyMessageListFetchAnchors.has(ee)){const J=this._historyMessageListFetchAnchors.get(ee);pe=J.lastMessageTime,_e=J.messageKey}}const ve=ee.replace(xo.CONV_C2C,""),ye=yield function(J){return ge(this,void 0,void 0,(function*(){const{peerAccount:Z,count:ee,lastMessageTime:ne,messageKey:se,direction:re}=J;return dn({servcmd:"openim.getroammsg",data:{Peer_Account:Z,MaxCnt:ee,WithRecalledMsg:1,LastMsgTime:ne,MsgKey:se,GetDirection:re}})}))}({count:ne,lastMessageTime:pe,messageKey:_e,peerAccount:ve,direction:ae});if(ye){const{MsgList:J=[],Complete:ne,MsgKey:se,LastMsgTime:re}=ye;this._historyMessageListFetchAnchors.set(ee,{messageKey:se,lastMessageTime:re});const ae=[];for(let Z=0;Z<J.length;Z++){const ee=J[Z],ne=this._parseC2CMessage(ee);ae.push(ne)}const pe=Rh(ae),_e=null===(Z=pe[0])||void 0===Z?void 0:Z.ID,ve=1===ne;return ve&&le&&this.completedHistoryConversations.add(ee),{messageList:pe,nextReqMessageIDFromServer:_e,lastMessageTime:re,hasNoMoreHistoryMessage:ve}}}catch(J){throw _o.ssoLog.debug("getC2CRoamingMessagesByAnchor",Se(J)),J}}))}_parseC2CMessage(J){const Z=xo.CONV_C2C,ee=Sh(J),ne=Yp.createMessage(Object.assign(Object.assign({},ee),{conversationType:Z,flow:"in"}));return ne.setElement(ee.elements),ne}reset(){this._historyMessageListFetchAnchors.clear(),this.completedHistoryConversations.clear()}};class Qh{constructor(){this.messageHelper=Xp,this.messageFactory=Yp,this.messageSender=new qh,this.messageAction=new jh,this.messageReceiver=ag,this.messageDataHandler=og,this.messageHistory=pg,this.messageSender.init(),this.messageFactory.init(),this.messageAction.init(),this.messageReceiver.init(),this.messageDataHandler.init(),sn({auth:dg,params:cg}),_o.notificationCenter.subscribeInnerEvent(Mo.LOGOUT,this._reset,this),_o.notificationCenter.subscribeInnerEvent(Mo.DESTROY,this._dispose,this)}_reset(){this.messageHistory.reset()}_dispose(){this._reset(),_o.notificationCenter.unSubscribeInnerEvent(Mo.LOGOUT,this._reset,this),_o.notificationCenter.unSubscribeInnerEvent(Mo.DESTROY,this._dispose,this)}}const gg="Tag_Profile_IM_",mg={NICK:`${gg}Nick`,GENDER:`${gg}Gender`,BIRTHDAY:`${gg}BirthDay`,LOCATION:`${gg}Location`,SELFSIGNATURE:`${gg}SelfSignature`,ALLOWTYPE:`${gg}AllowType`,LANGUAGE:`${gg}Language`,AVATAR:`${gg}Image`,MESSAGESETTINGS:`${gg}MsgSettings`,ADMINFORBIDTYPE:`${gg}AdminForbidType`,LEVEL:`${gg}Level`,ROLE:`${gg}Role`},vg="Tag_Profile_Custom",yg="profileCustomField",Sg={userID:"",nick:"",gender:"Gender_Type_Unknown",birthday:0,location:"",selfSignature:"",allowType:"AllowType_Type_AllowAny",language:0,avatar:"",messageSettings:0,adminForbidType:"AdminForbid_Type_None",level:0,role:0,lastUpdatedTime:0,profileCustomField:[]},Eg=new Map([[mg.NICK,"nick"],[mg.GENDER,"gender"],[mg.BIRTHDAY,"birthday"],[mg.LOCATION,"location"],[mg.SELFSIGNATURE,"selfSignature"],[mg.ALLOWTYPE,"allowType"],[mg.LANGUAGE,"language"],[mg.AVATAR,"avatar"],[mg.MESSAGESETTINGS,"messageSettings"],[mg.ADMINFORBIDTYPE,"adminForbidType"],[mg.LEVEL,"level"],[mg.ROLE,"role"]]);var bg=new class{createProfile(J,Z){const ee={userID:J,profileCustomField:[]};return Z.forEach((J=>{const{tag:Z,value:ne}=J;Z&&Z.indexOf(vg)>-1?ee.profileCustomField.push({key:Z,value:ne}):Eg.has(Z)&&(ee[Eg.get(Z)]=ne)})),Object.assign(Object.assign({},Sg),ee)}parseProfileItem(J=[]){const Z=[];return J.forEach((J=>{Z.push({tag:J.Tag,value:J.Value})})),Z}parseProfileList(J=[]){const Z=[];return J.forEach((J=>{Z.push({tag:J.Tag,value:J.ValueBytes})})),Z}convertParamsToProfile(J){const Z=[];return Object.keys(J).forEach((ee=>{ee!==yg&&Z.push({tag:mg[ee.toUpperCase()],value:J[ee]})})),J.profileCustomField&&n(J.profileCustomField)&&J.profileCustomField.forEach((J=>{Z.push({tag:J.key,value:J.value})})),Z}normalizeProfileFields(J){const Z={},ee=[];return J.forEach((J=>{const{tag:ne,value:se}=J;if(ne&&ne.indexOf(vg)>-1&&ee.push({key:ne,value:se}),Eg.has(ne)&&void 0!==se){const J=Eg.get(ne);Z[J]=se}})),ee.length>0&&(Z.profileCustomField=ee),Z}};const{generateProtocolData:Ag}=_o.common;function ug(J){return ge(this,void 0,void 0,(function*(){const Z="profile.portrait_get_all",ee={From_Account:_n(),UserItem:[]};J.forEach((J=>{ee.UserItem.push({CustomSequence:0,StandardSequence:0,To_Account:J})}));const ne=Ag({servcmd:Z,data:ee}),se=`${ne.head.seq}${Z}`,re=yield _o.channel.sendPacket(ne,{requestId:se});if(re)return function(J){const{ActionStatus:Z,ErrorCode:ee,ErrorDisplay:ne,ErrorInfo:se,UserProfileItem:re}=J,ae=[];return re.map((J=>{const{To_Account:Z,CustomSequence:ee,ResultCode:ne,ResultInfo:se,StandardSequence:re,ProfileItem:le}=J,pe=bg.parseProfileItem(le);ae.push({userId:Z,customSequence:ee,resultCode:ne,resultInfo:se,standardSequence:re,profileItem:pe})})),{actionStatus:Z,errorCode:ee,errorDisplay:ne,errorInfo:se,userProfile:ae}}(re)}))}function lg(J){return xp.getFriendMap().has(J)}const{isEmpty:Og}=_o.utils;class hg{constructor(){this._strangerProfileMap=new Map}init(){Yd.getInstance().registerApi({apiName:"getMyProfile",context:this}),Yd.getInstance().registerApi({apiName:"getUserProfile",context:this}),Yd.getInstance().registerApi({apiName:"updateMyProfile",context:this}),this.createProfile=bg.createProfile.bind(bg);const{notificationCenter:J}=_o;on.getInstance().registerWorkflowStep(zo.SYNC_SERVER_INFO_AFTER_LOGIN,Jo.USER_PROFILE_SYNC,this.getMyProfileCacheThenServer,this),J.subscribeInnerEvent(Mo.MESSAGE_PUSH,J.InnerEventSubType.PROFILE_MODIFIED,this._onProfileDataModify,this),J.subscribeInnerEvent(Mo.LOGOUT,this._reset,this),J.subscribeInnerEvent(Mo.DESTROY,this._dispose,this)}getMyProfile(){return ge(this,void 0,void 0,(function*(){try{const J=_n(),Z=yield ug([J]);if(Z){const ee=this._handleProfileFormResponse(Z)[0];return xp.getUserProfileMap().set(J,ee),{code:0,data:ee}}}catch(J){const{errorCode:Z,errorInfo:ee}=J;throw new Ws({functionName:"getMyProfile",code:Z,message:ee})}}))}getUserProfile(J){return ge(this,void 0,void 0,(function*(){try{let{userIDList:Z}=J;const{userIdListToRequest:ee,profileFromCache:ne}=this._filterRequestAndCacheUsers(Z);if(0===ee.length)return{code:0,data:ne,successLog:{message:`userIDList.length:${Z.length}`}};ee.length>1e3&&(_o.ssoLog.warn("getUserProfile","userIdListToRequest.length > 1000"),ee.length=1e3);const{data:se,error:re}=yield this._batchFetchUserProfiles(ee),ae=ee.length,le=se.length,pe=ae-le;if(0===ne.length&&ae===pe&&!Og(re))throw re;if(n(se)){se.forEach((J=>{lg(J.userID)?xp.getUserProfileMap().set(J.userID,J):this._strangerProfileMap.set(J.userID,J)}));return{code:0,data:se.concat(ne),successLog:{message:`getUserProfile query:${ae} success:${le} fail:${pe} from cache:${ne.length}`}}}}catch(J){const{errorCode:Z}=J;throw new Ws({functionName:"getUserProfile",code:Z})}}))}getMyProfileCacheThenServer(){return ge(this,void 0,void 0,(function*(){const J=_n(),Z=xp.getUserProfileMap().has(J);return Z?{code:0,data:Z}:this.getMyProfile()}))}updateMyProfile(J){return ge(this,void 0,void 0,(function*(){const Z=_n(),ee={};for(const Z in J)void 0!==J[Z]&&(ee[Z]=J[Z]);const ne=bg.convertParamsToProfile(ee);try{const J={From_Account:Z,ProfileItem:ne};yield function(J){return ge(this,void 0,void 0,(function*(){const Z="profile.portrait_set",ee=Ag({servcmd:Z,data:J}),ne=`${ee.head.seq}${Z}`,se=yield _o.channel.sendPacket(ee,{requestId:ne});if(se){const{ActionStatus:J,ErrorCode:Z,ErrorDisplay:ee,ErrorInfo:ne}=se;return{actionStatus:J,errorCode:Z,errorDisplay:ee,errorInfo:ne}}}))}(J);const se=xp.getUserProfile(Z);let re;re=se?Object.assign(Object.assign({},se),ee):bg.createProfile(Z,ne);const ae=!Jt(se,re,["lastUpdatedTime"]);return re.lastUpdatedTime=Date.now(),xp.getUserProfileMap().set(Z,re),ae&&this._emitProfileUpdated(re),{code:0,data:re,successLog:{message:`profileArray: ${_o.utils.safeStringify(ne)}`}}}catch(J){const{errorCode:Z,errorInfo:ee}=J;throw new Ws({functionName:"updateMyProfile",code:Z,message:ee})}}))}updateMyNickAndAvatar(J){return ge(this,void 0,void 0,(function*(){const Z=_n(),ee=Date.now(),ne=xp.getUserProfile(Z);let se={};se=ne?Object.assign(ne,J):bg.createProfile(Z,J),se.lastUpdatedTime=ee,xp.getUserProfileMap().set(Z,se)}))}_onProfileDataModify(J){const Z=function(J){const{Profile_Account:Z,PushType:ee,ProfileList:ne}=J;return{userId:Z,pushType:ee,profileList:bg.parseProfileList(ne)}}(J.ProfileDataMod[0]);if(Og(Z))return;const{isProfileUpdated:ee,profile:ne}=this._handleProfileModified(Z);ee&&this._emitProfileUpdated(ne)}_emitProfileUpdated(J){_o.notificationCenter.emitInnerEvent(Mo.PROFILE_UPDATE,{name:Mo.PROFILE_UPDATE,data:[J]}),_o.notificationCenter.emitOuterEvent(So.PROFILE_UPDATED,{name:So.PROFILE_UPDATED,data:[J]}),Pp.updateConversation(`C2C${null==J?void 0:J.userID}`,{userProfile:J})}_dispose(){const{notificationCenter:J}=_o;J.unSubscribeInnerEvent(Mo.LOGOUT,this._reset,this),J.unSubscribeInnerEvent(Mo.MESSAGE_PUSH,J.InnerEventSubType.PROFILE_MODIFIED,this._onProfileDataModify,this),J.unSubscribeInnerEvent(Mo.DESTROY,this._dispose,this),this._reset()}_handleProfileModified(J){const{userId:Z,profileList:ee}=J,ne=xp.getUserProfile(Z);if(!(_n()===Z||lg(Z)&&ne))return{isProfileUpdated:!1,profile:null};const se=bg.normalizeProfileFields(ee),re=Object.keys(se).some((J=>J===yg?this._isCustomFieldChanged(ne.profileCustomField,se.profileCustomField):ne[J]!==se[J]));if(!re)return{isProfileUpdated:!1,profile:ne};const ae=Date.now(),le=Object.prototype.hasOwnProperty.call(se,yg)?this._mergeProfileCustomField(ne.profileCustomField,se.profileCustomField):ne.profileCustomField,pe=Object.assign(Object.assign(Object.assign({},ne),se),{profileCustomField:le,lastUpdatedTime:ae});return xp.getUserProfileMap().set(Z,pe),{isProfileUpdated:re,profile:pe}}_filterRequestAndCacheUsers(J){const Z=[],ee=[];return J.forEach((J=>{const ne=xp.getUserProfileMap().has(J);lg(J)&&ne?ee.push(xp.getUserProfile(J)):this._isStrangerAndProfileValid(J)?ee.push(this._strangerProfileMap.get(J)):Z.push(J)})),{userIdListToRequest:Z,profileFromCache:ee}}_handleProfileFormResponse(J){const{userProfile:Z}=J;if(!Array.isArray(Z))return[];const ee=Z.filter((J=>"@TLS#NOT_FOUND"!==J.userId&&""!==J.userId&&!Og(J.profileItem))),ne=Date.now();return ee.map((J=>{const Z=bg.createProfile(J.userId,J.profileItem);return Z.lastUpdatedTime=ne,Z}))}_isStrangerAndProfileValid(J){var Z;if(!lg(J)){const{lastUpdatedTime:ee=0}=this._strangerProfileMap.get(J)||{},ne=(null===(Z=_o.store.get("cloudConfig"))||void 0===Z?void 0:Z.stranger_profile_expiration_time)||6e5;return Date.now()-ee<=ne}return!1}_chunkUserIDList(J,Z){return Array.from({length:Math.ceil(J.length/Z)},((ee,ne)=>J.slice(ne*Z,(ne+1)*Z)))}_batchFetchUserProfiles(J){return ge(this,void 0,void 0,(function*(){const Z=[],ee=[];let ne={};return this._chunkUserIDList(J,100).forEach((J=>{Z.push(ug(J))})),(yield Promise.allSettled(Z)).forEach((J=>{if("fulfilled"===J.status){const Z=J.value,ne=this._handleProfileFormResponse(Z);n(ne)&&ee.push(...ne)}else if("rejected"===J.status){const{code:Z,message:ee}=J.reason||{};ne={errorCode:Z,message:ee}}})),{data:ee,error:ne}}))}_isCustomFieldChanged(J=[],Z=[]){if(!n(Z)||0===Z.length)return!1;if(!n(J)||0===J.length)return!0;const ee=new Map(J.map((J=>[J.key,J.value])));return Z.some((J=>ee.get(J.key)!==J.value))}_mergeProfileCustomField(J=[],Z=[]){const ee=n(J)?J.map((J=>Object.assign({},J))):[];return n(Z)&&0!==Z.length?(Z.forEach((({key:J,value:Z})=>{const ne=ee.find((Z=>Z.key===J));ne?ne.value=Z:ee.push({key:J,value:Z})})),ee):ee}_reset(){xp.getUserProfileMap().clear(),this._strangerProfileMap.clear()}}const wg=new Map,Dg=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];for(let J=0,Z=Dg.length;J<Z;J++)wg.set(J,Dg[J]);function _g(J){if(!J)return"";const Z=String(J).replace(/[=]+$/,"");let ee="";if(Z.length%4==1)return"";for(let J,ne,se=0,re=0;ne=Z.charAt(re++);~ne&&(J=se%4?64*J+ne:ne,se++%4)?ee+=String.fromCharCode(255&J>>(-2*se&6)):0)ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(ne);try{return decodeURIComponent(escape(ee))}catch(J){return console.warn(J),""}}const{isEmpty:Ng}=_o.utils,{generateProtocolData:Lg}=_o.common;class Ig{constructor(){this._customStatus=""}init(){const{notificationCenter:J}=_o;Yd.getInstance().registerApi({apiName:"getUserStatus",context:this}),Yd.getInstance().registerApi({apiName:"setSelfStatus",context:this}),Yd.getInstance().registerApi({apiName:"subscribeUserStatus",context:this}),Yd.getInstance().registerApi({apiName:"unsubscribeUserStatus",context:this}),on.getInstance().registerWorkflowStep(zo.SYNC_SERVER_INFO_AFTER_RE_ONLINE,Jo.USER_STATUS_UPDATE,this._onReOnline,this),J.subscribeInnerEvent(Mo.MESSAGE_PUSH,J.InnerEventSubType.USER_STATUS_UPDATE,this._onUserStatusUpdate,this),J.subscribeInnerEvent(Mo.LOGOUT,this._reset,this),J.subscribeInnerEvent(Mo.DESTROY,this._dispose,this)}setSelfStatus(J){return ge(this,void 0,void 0,(function*(){const Z=_n(),{customStatus:ee}=J;try{return yield function(J){return ge(this,void 0,void 0,(function*(){const Z="im_open_status.ws_set_custom_status",ee=Lg({servcmd:Z,data:{CustomStatus:J}}),ne=`${ee.head.seq}${Z}`,se=yield _o.channel.sendPacket(ee,{requestId:ne});if(se){const{ErrorCode:J,ErrorInfo:Z}=se;return{errorCode:J,errorInfo:Z}}}))}(ee),this._customStatus=ee,{code:0,data:{userID:Z,statusType:1,customStatus:ee},successLog:{message:`customStatus: ${ee}`}}}catch(J){const{errorCode:Z,errorInfo:ee}=J;throw new Ws({functionName:"setSelfStatus",code:Z,message:ee})}}))}getUserStatus(J){return ge(this,void 0,void 0,(function*(){const{userIDList:Z=[]}=J;if(this._isOnlyMeInArray(Z))return this._getMyStatus();const ee=yield this._getUserStatus(Z);return Object.assign(Object.assign({},ee),{successLog:{message:`userIDList length: ${Z.length}`}})}))}setCustomStatus(J){const Z=_g(J);this._customStatus=Z}subscribeUserStatus(J){return ge(this,void 0,void 0,(function*(){try{const{userIDList:Z=[]}=J;this._checkBusinessCapabilityBits("subscribeUserStatus");const ee=this._getMaxUserCount("subscribe"),ne=this._sliceUserIDList(Z,ee),se=yield function(J){return ge(this,void 0,void 0,(function*(){const{channel:Z}=_o,ee="im_open_status.ws_status_subscribe",ne=Lg({servcmd:ee,data:{To_Account:J}}),se=`${ne.head.seq}${ee}`;return yield Z.sendPacket(ne,{requestId:se})}))}(ne),re=this._parseResponse(se);return{code:0,data:{failureUserList:re},successLog:{message:`userID length:${Z.length} failCount: ${re.length}`}}}catch(J){const{errorCode:Z}=J;throw new Ws({functionName:"subscribeUserStatus",code:Z})}}))}unsubscribeUserStatus(J){return ge(this,void 0,void 0,(function*(){try{this._checkBusinessCapabilityBits("unsubscribeUserStatus");const{userIDList:Z=[]}=J,ee=this._getMaxUserCount("unsubscribe"),ne=this._sliceUserIDList(Z,ee),se=yield function(J){return ge(this,void 0,void 0,(function*(){const{channel:Z}=_o,ee="im_open_status.ws_status_unsubscribe";let ne={};ne=0===J.length?{UnsubscribeAll:1}:{To_Account:J};const se=Lg({servcmd:ee,data:ne}),re=`${se.head.seq}${ee}`;return yield Z.sendPacket(se,{requestId:re})}))}(ne),re=this._parseResponse(se);return{code:0,data:{failureUserList:re},successLog:{message:`userID length:${Z.length} failCount: ${re.length}`}}}catch(J){const{errorCode:Z}=J;throw new Ws({functionName:"unsubscribeUserStatus",code:Z})}}))}_onUserStatusUpdate(J){const{UserStatusList:Z=[]}=J||{},ee=Z.map((J=>{const{To_Account:Z,Status:ee,CustomStatus:ne}=J;return{userID:Z,statusType:ee,customStatus:_g(ne)}}));this._emitUserStatusUpdatedEvent(ee)}_onReOnline(J){const Z=_g(J.data.customStatus);if(this._customStatus===Z)return;this._customStatus=Z;const ee={userID:_n(),statusType:1,customStatus:Z};this._emitUserStatusUpdatedEvent(ee)}_emitUserStatusUpdatedEvent(J){_o.notificationCenter.emitOuterEvent(So.USER_STATUS_UPDATED,{name:So.USER_STATUS_UPDATED,data:J})}_sliceUserIDList(J,Z){return J.slice(0,Z)}_parseResponse(J){const{ErrorList:Z=[]}=J;return Z.map((J=>{const{To_Account:Z,Invalid_Account:ee,ErrorCode:ne,ErrorInfo:se}=J;return{userID:_o.utils.isEmpty(ee)?Z:ee,code:ne,message:se}}))}_checkBusinessCapabilityBits(J){if(!_o.store.get("commercialConfig").get("USER_STATUS"))throw new Ws({functionName:J,code:Wo.NO_USE,replacement1:J})}_getMaxUserCount(J){const Z=_o.store.get("cloudConfig")||{},{key:ee,default:ne}={query:{key:"status_query_count",default:500},subscribe:{key:"status_sub_count",default:100},unsubscribe:{key:"status_unsub_count",default:100}}[J],se=Z[ee]||ne;return parseInt(se,10)}_getMyStatus(){return{code:0,data:{successUserList:[{userID:_n(),statusType:1,customStatus:this._customStatus}],failureUserList:[]}}}_getUserStatus(J){return ge(this,void 0,void 0,(function*(){try{this._checkBusinessCapabilityBits("getUserStatus");const Z=this._getMaxUserCount("query"),ee=this._sliceUserIDList(J,Z),ne=yield function fg(J){return ge(this,void 0,void 0,(function*(){const Z="im_open_status.ws_get_user_status",ee=Lg({servcmd:Z,data:{To_Account:J}}),ne=`${ee.head.seq}${Z}`,se=yield _o.channel.sendPacket(ee,{requestId:ne});if(se)return function(J){const{ErrorCode:Z,ErrorInfo:ee,ErrorList:ne=[],UserStatusList:se=[]}=J,re=se.map((J=>{const{To_Account:Z,Status:ee,CustomStatus:ne}=J;return{userID:Z,statusType:ee,customStatus:_g(ne)}})),ae=ne.map((J=>{const{To_Account:Z,Invalid_Account:ee,ErrorCode:ne,ErrorInfo:se}=J;return{userID:Ng(ee)?Z:ee,code:ne,message:se}}));return{errorCode:Z,errorInfo:ee,successUserList:re,failureUserList:ae}}(se)}))}(ee),{successUserList:se,failureUserList:re}=ne||{};return{code:0,data:{successUserList:se,failureUserList:re}}}catch(J){const{errorCode:Z}=J;throw new Ws({functionName:"getUserStatus",code:Z})}}))}_isOnlyMeInArray(J){const Z=_n();return 1===J.length&&J.indexOf(Z)>-1}_dispose(){const{notificationCenter:J}=_o;J.unSubscribeInnerEvent(Mo.MESSAGE_PUSH,J.InnerEventSubType.USER_STATUS_UPDATE,this._onUserStatusUpdate,this),J.unSubscribeInnerEvent(Mo.DESTROY,this._dispose,this),J.unSubscribeInnerEvent(Mo.LOGOUT,this._reset,this),this._reset()}_reset(){this._customStatus=""}}const kg={getUserProfile:{userIDList:{required:!0,rules:["array"],allowEmpty:!1}},updateMyProfile:{nick:{required:!1,rules:["string"],allowEmpty:!0},avatar:{required:!1,rules:["string"],allowEmpty:!0},gender:{required:!1,rules:["string"],allowEmpty:!0},selfSignature:{required:!1,rules:["string"],allowEmpty:!0},allowType:{required:!1,rules:["string"],allowEmpty:!0},birthday:{required:!1,rules:["number"],allowEmpty:!1},language:{required:!1,rules:["string"],allowEmpty:!0},messageSettings:{required:!1,rules:["string"],allowEmpty:!0},adminForbidType:{required:!1,rules:["string"],allowEmpty:!0},level:{required:!1,rules:["number"],allowEmpty:!1},role:{required:!1,rules:["number"],allowEmpty:!0},profileCustomField:{required:!1,rules:["array"],allowEmpty:!0,customValidator:function(J){for(const Z of J){if("object"!=typeof Z)return"Each item in profileCustomField must be an object";if("string"!=typeof(null==Z?void 0:Z.key))return"Each item.key in profileCustomField must be a string";if(!(null==Z?void 0:Z.key.startsWith(vg)))return'Each item.key in profileCustomField must start with "Tag_Profile_Custom"'}return!0}}},setSelfStatus:{customStatus:{required:!0,rules:["string"],allowEmpty:!0}},getUserStatus:{userIDList:{required:!0,rules:["array"],allowEmpty:!1}},subscribeUserStatus:{userIDList:{required:!0,rules:["array"],allowEmpty:!1}},unsubscribeUserStatus:{userIDList:{required:!1,rules:["array"],allowEmpty:!0}}},Pg={getMyProfile:!0,getUserProfile:!0,updateMyProfile:!0,setSelfStatus:!0,getUserStatus:!0,subscribeUserStatus:!0,unsubscribeUserStatus:!0};class Cg{constructor(){this.userProfile=new hg,this.userStatus=new Ig,this.userProfile.init(),this.userStatus.init(),sn({auth:Pg,params:kg})}}function Mg(J){const Z=[];if(!t(J))return Z;const ee=J.length;if(0===ee)return Z;for(let ne=ee-1;ne>=0;ne--)"1"===J[ne]&&Z.push(2**(ee-ne-1));return Z}var Ug,Gg,xg;!function(J){J.NOT_START="notStart",J.PENDING="pending",J.RESOLVED="resolved",J.REJECTED="rejected"}(Ug||(Ug={})),function(J){J[J.C2C=1]="C2C",J[J.GROUP=2]="GROUP"}(Gg||(Gg={})),function(J){J[J.C2C=8]="C2C",J[J.GROUP=2]="GROUP"}(xg||(xg={}));class Tg{constructor(){this._name="SyncConversationHandler",this._pagingStatus=Ug.NOT_START,this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0}init(){const{notificationCenter:J}=_o;on.getInstance().registerWorkflowStep(zo.SYNC_SERVER_INFO_AFTER_RE_ONLINE,Jo.CONVERSATION_RECOVER,this._syncConversationList,this),on.getInstance().registerWorkflowStep(zo.SYNC_SERVER_INFO_AFTER_LOGIN,Jo.CONVERSATION_LIST_SYNC,this._syncConversationListAfterLogin,this),J.subscribeInnerEvent(Mo.LOGOUT,this._reset,this),J.subscribeInnerEvent(Mo.DESTROY,this._dispose,this),_o.ssoLog.debug(`${this._name}.init`)}isSyncCompleted(){return this._pagingStatus===Ug.RESOLVED}_syncConversationListAfterLogin(){return ge(this,void 0,void 0,(function*(){return this._pagingStatus=Ug.NOT_START,this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._syncConversationList()}))}_syncConversationList(){return ge(this,void 0,void 0,(function*(){const{ssoLog:J,utils:{safeStringify:Z}}=_o;J.debug("_syncConversationList","start");try{const Z=yield this._pagingGetConversationList(!0);this._pagingStatus=Ug.RESOLVED;const{conversationList:ee=[]}=Z||{};return J.info("_syncConversationList",`success count:${ee.length}`),Z}catch(ee){const{errorCode:ne,errorInfo:se}=ee,re=new Ws({code:ne,message:se});J.error("_syncConversationList",`fail ${Z(ee)}`,{error:re})}}))}_pagingGetConversationList(J){return ge(this,void 0,void 0,(function*(){try{const Z=[];this._pagingStatus=Ug.PENDING;const ee=yield function(J){return ge(this,void 0,void 0,(function*(){const{fromAccount:Z,pagingTimeStamp:ee,pagingStartIndex:ne,pagingPinnedTimeStamp:se,pagingPinnedStartIndex:re}=J;return dn({servcmd:"recentcontact.page_get",data:{AssistFlags:31,MsgAssistFlags:15,OrderType:1,From_Account:Z,StartIndex:ne,TimeStamp:ee,TopStartIndex:re,TopTimeStamp:se}})}))}({fromAccount:_n(),pagingTimeStamp:J?this._pagingTimeStamp:0,pagingStartIndex:J?this._pagingStartIndex:0,pagingPinnedTimeStamp:J?this._pagingPinnedTimeStamp:0,pagingPinnedStartIndex:J?this._pagingPinnedStartIndex:0}),{CompleteFlag:ne,SessionItem:se=[],TimeStamp:re,StartIndex:ae,TopTimeStamp:le,TopStartIndex:pe}=ee||{};let _e=[];if(1===ne&&(this._pagingStatus=Ug.RESOLVED),se.length>0&&(_e=this._getConversationOptions(se),Z.push(..._e)),_o.notificationCenter.emitInnerEvent(Mo.SYNC_CONVERSATION_LIST,{conversationUpdateFieldList:_e}),this._pagingTimeStamp=re,this._pagingStartIndex=ae,this._pagingPinnedTimeStamp=le,this._pagingPinnedStartIndex=pe,1!==ne){const{conversationList:ee}=yield this._pagingGetConversationList(J);Z.push(...ee)}return{conversationList:Z}}catch(J){throw J}}))}_getConversationOptions(J){const{utils:{isUndefined:Z}}=_o,ee=this._convertConversationKey(J);return this._filterValidConversations(ee).map((J=>(Z(J.lastMsg)&&(J.lastMsg={elements:[]}),J.type===Gg.C2C?this._assembleC2COption(J):this._assembleGroupOption(J))))}_filterValidConversations(J){return J.filter((({type:J,userID:Z})=>J===Gg.C2C&&!function(J){let Z;return J.startsWith(Ko.CONV_C2C)&&(Z=J.replace(Ko.CONV_C2C,"")),"@TLS#ERROR"===Z||"@TLS#NOT_FOUND"===Z}(Z)||2===J))}_assembleC2COption(J){var Z,ee,ne,se,re,ae,le,pe;const _e=this._createUserprofile(J);return{conversationID:`${Ko.CONV_C2C}${J.userID}`,type:Ko.CONV_C2C,lastMessage:{lastTime:J.time,lastSequence:J.sequence,fromAccount:J.lastC2CMsgFromAccount,type:(null===(Z=J.lastMsg)||void 0===Z?void 0:Z.elements[0])?null===(ee=J.lastMsg)||void 0===ee?void 0:ee.elements[0].type:null,payload:(null===(ne=J.lastMsg)||void 0===ne?void 0:ne.elements[0])?this._amendLayersOverLimitProp(J.lastMsg.elements[0].content):null,cloudCustomData:(null===(ae=null===(re=null===(se=J.lastMsg)||void 0===se?void 0:se.elements)||void 0===re?void 0:re[0])||void 0===ae?void 0:ae.cloudCustomData)||"",isRevoked:J.lastMessageFlag===xg.C2C,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:this._computeIsPeerRead(J),revoker:(null===(pe=null===(le=J.lastMsg)||void 0===le?void 0:le.revokerInfo)||void 0===pe?void 0:pe.revoker)||null},unreadCount:0,userProfile:_e,peerReadTime:J.peerReadTime,isPinned:1===J.isPinned,customData:J.customMark||"",markList:Mg(J.standardMark),conversationGroupList:[],remark:J.friendRemark||"",messageRemindType:this._transMsgRemindType(J.messageRemindType)}}_createUserprofile(J){var Z;const{userID:ee,nick:ne,peerAvatar:se}=J,re=[{tag:"Tag_Profile_IM_Nick",value:ne},{tag:"Tag_Profile_IM_Image",value:se}];return null===(Z=_o.user.userProfile)||void 0===Z?void 0:Z.createProfile(ee,re)}_computeIsPeerRead(J){const Z=_n(),{lastC2CMsgFromAccount:ee,time:ne,c2cPeerReadTime:se}=J;return ee===Z&&ne<=se}_assembleGroupOption(J){var Z,ee,ne;return{conversationID:`${Ko.CONV_GROUP}${J.groupID}`,type:Ko.CONV_GROUP,lastMessage:Object.assign(Object.assign({lastTime:J.time,lastSequence:J.sequence,fromAccount:J.msgGroupFromAccount},this._patchTypeAndPayload(J)),{cloudCustomData:(null===(Z=J.lastMsg)||void 0===Z?void 0:Z.cloudCustomData)||"",isRevoked:J.lastMessageFlag===xg.GROUP,onlineOnlyFlag:!1,nick:J.msgGroupFromNickName||"",nameCard:J.msgGroupFromCardName||"",revoker:(null===(ne=null===(ee=J.lastMsg)||void 0===ee?void 0:ee.revokerInfo)||void 0===ne?void 0:ne.revoker)||null}),groupProfile:{groupID:J.groupID,name:J.groupNick,avatar:J.groupImage,type:J.groupType,nextMessageSeq:J.nextMessageSeq},unreadCount:this._computeGroupUnreadCount(J),peerReadTime:0,isPinned:1===J.isPinned,version:0,customData:J.customMark||"",markList:Mg(J.standardMark),conversationGroupList:[],messageRemindType:this._transMsgRemindType(J.messageRemindType),subType:J.groupType}}_convertConversationKey(J){return J.map((J=>({type:J.Type,userID:J.To_Account,nick:J.C2cNick,peerAvatar:J.C2cImage,time:J.MsgTimeStamp,sequence:J.MsgSeq,lastC2CMsgFromAccount:J.LastC2cMsgFrom_Account,lastMsg:this._convertLastMsgKey(J.LastMsg),lastMessageFlag:J.LastMsgFlags,c2cPeerReadTime:J.C2cPeerReadTime,peerReadTime:J.C2cPeerReadTime,friendRemark:J.C2cRemark,isPinned:J.TopFlags,standardMark:J.StandardMark,customMark:J.CustomMark,messageRemindType:J.MsgRecvOption,groupID:J.ToAccount,groupNick:J.GroupNick,groupImage:J.GroupImage,groupType:J.GroupType,nextMessageSeq:J.GroupNextMsgSeq,msgGroupFromAccount:J.MsgGroupFrom_Account,msgGroupFromNickName:J.MsgGroupFromNickName,msgGroupFromCardName:J.MsgGroupFromCardName,unreadCount:J.UnreadMsgCount,noUnreadCount:J.GroupIgnoredUnreadSeqCount})))}_convertLastMsgKey(J){var Z,ee,ne;const{utils:{isEmpty:se}}=_o;if(se(J))return null;let re="",ae=null;if(!se(J.GroupTips)){const{From_Account:ee,GroupName:ne}=(null===(Z=J.GroupTips)||void 0===Z?void 0:Z.GroupInfo)||{};re=Ko.MSG_GRP_TIP,ae=Object.assign(Object.assign({},this._parseContent(re,J.GroupTips.MsgBody)),{groupProfile:{from:ee,groupName:ne}})}return J.MsgBody&&(re=null===(ee=J.MsgBody[0])||void 0===ee?void 0:ee.MsgType,ae=this._parseContent(re,J.MsgBody[0])),{event:J.Event,elements:[{type:re,content:ae,cloudCustomData:J.CloudCustomData}],revokerInfo:{revoker:null===(ne=J.RevokerInfo)||void 0===ne?void 0:ne.Revoker_Account}}}_parseContent(J,Z){var ee;if(!Z)return Z;const ne=_o.message.messageFactory.getElementClass(J);return ne?null===(ee=ne.parseServerPushElement(Z))||void 0===ee?void 0:ee.content:Z}_amendLayersOverLimitProp(J){const{LayersOverLimit:Z}=J;return he(J,["LayersOverLimit"]).layersOverLimit=1===Z,J}_transMsgRemindType(J){let Z="";return 0===J?Z=Ko.MSG_REMIND_ACPT_AND_NOTE:1===J?Z=Ko.MSG_REMIND_DISCARD:2===J?Z=Ko.MSG_REMIND_ACPT_NOT_NOTE:3===J&&(Z=Ko.NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT),Z}_patchTypeAndPayload(J){var Z;const{utils:{isUndefined:ee}}=_o,{event:ne,elements:se=[]}=J.lastMsg||{};return ee(ne)?{type:se[0]?se[0].type:null,payload:se[0]?this._amendLayersOverLimitProp(se[0].content):null}:{type:Ko.MSG_GRP_TIP,payload:(null===(Z=null==se?void 0:se[0])||void 0===Z?void 0:Z.content)||{}}}_computeGroupUnreadCount(J){const{unreadCount:Z=0,noUnreadCount:ee=0}=J,ne=Z-ee;return ne>0?ne:0}_reset(){this._pagingStatus=Ug.NOT_START,this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0}_dispose(){this._reset();const{notificationCenter:J}=_o;J.unSubscribeInnerEvent(Mo.LOGOUT,this._reset,this),J.unSubscribeInnerEvent(Mo.DESTROY,this._dispose,this)}}class Rg{constructor(){this.syncConversationHandler=new Tg,this.syncConversationHandler.init()}}console.log(`TencentCloudLiteChat.VERSION:${zi}`);var Fg={create:function(J){var Z,ee;const{SDKAppID:ne,testEnv:se=!1,devMode:re=!1,unlimitedAVChatRoom:ae=!1,scene:le="",oversea:pe=!1,instance:_e,disableIndependentDomain:ve=!1}=J;let ye=ne;if(!function(J){if("number"==typeof J)return!0;const Z=Number(J);return!Number.isNaN(Z)}(ye))return console.error("Create SDK instance failed. Failed to parse the SDKAppID, please check the arguments"),null;if(ye=Number(ye),ba.has(ye))return ba.get(ye);let Fe=null;if(_e)Fe=_e,Fe._workflowManager&&on.setInstance(Fe._workflowManager),Fe._pluginManager&&Fe._pluginManager.installBuiltInPlugin(Lp),_e.isReady()&&(null===(ee=(Z=on.getInstance()).executeWorkflow)||void 0===ee||ee.call(Z,zo.SYNC_SERVER_INFO_AFTER_LOGIN));else{const J=function(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()+e()}${e()}${e()}${e()}${e()}${e()}${e()}`}();_o.init({sdkAppId:ye,instanceId:J,testEnv:se,devMode:re,unlimitedAVChatRoom:ae,disableIndependentDomain:ve,scene:le,oversea:pe,sdkEdition:Np,version:zi}),on.getInstance().init(),_o.message=new Qh,_o.user=new Cg,_o.login=new Xd,_o.conversation=new Rg,qd.getInstance().installBuiltInPlugin(Lp),Fe=Yd.getInstance().exposeApiForClient(),Fe._workflowManager=on.getInstance(),Fe._pluginManager=qd.getInstance();const{utils:{IS_WORKER_AVAILABLE:Z,USER_AGENT:ee,getPlatformType:_e,isIOSWebView:qe}}=_o,$e=`instanceID:${J} SDKAppID:${ne} platform:${_e()} isIOSWebView:${qe} workerAvailable:${Z} UserAgent:${ee}`;_o.ssoLog.info("sdkConstruct",$e)}return ba.set(ye,Fe),Fe},TSignaling:To,EVENT:So,VERSION:zi,TYPES:Ko};var Bg=function await_to_js_es5_to(J,Z){return J.then((function(J){return[null,J]})).catch((function(J){return Z&&Object.assign(J,Z),[J,void 0]}))};const qg={trace:0,debug:1,info:2,log:2,warn:3,error:4,silent:5};let Vg=qg.info;function setLogLevel(J){"number"!=typeof J?"string"==typeof J&&void 0!==qg[J.toLowerCase()]&&(Vg=qg[J.toLowerCase()]):Vg=J}function createLogger(J=""){const Z=J?`[${J}]`:"",ee="[vhall-mp]",enabled=J=>J>=Vg;return{trace:function trace(...J){enabled(qg.trace)&&console.trace(`${ee}${Z}`,...J)},debug:function debug(...J){enabled(qg.debug)&&console.debug(`${ee}${Z}`,...J)},info:function info(...J){enabled(qg.info)&&console.info(`${ee}${Z}`,...J)},log:function log(...J){enabled(qg.log)&&console.log(`${ee}${Z}`,...J)},warn:function warn(...J){enabled(qg.warn)&&console.warn(`${ee}${Z}`,...J)},error:function error(...J){enabled(qg.error)&&console.error(`${ee}${Z}`,...J)}}}const $g={createLogger,setLogLevel,getLogLevel:function getLogLevel(){return Vg}};var jg=createLogger;const Hg=jg("IM_tim");class Tim extends Je{constructor(J,Z){super(),this._msgIns=Z,this.sdk_app_id=J.sdk_app_id,this.user_id=J.user_id,this.user_sig=J.user_sig,this.group_list=J.group_list||[],this.chatIns=null,this.createTime=Date.now(),this.retryCount=0,this._pingTimer=0,this._pingTryCount=0}async initialize(){Hg.debug(`initialize retryCount=${this.retryCount}`),this.retryCount++,this.chatIns||(this.chatIns=this._create()),this.chatIns&&(this.isReady()?await this.joinGroups(1):(Hg.debug("登录 start"),await this._login()))}_create(){if(this.chatIns)return this.chatIns;try{return this.chatIns=Fg.create({SDKAppID:this.sdk_app_id,unlimitedAVChatRoom:!0}),this.chatIns.setLogLevel(1),this.initEvents(),Hg.debug("创建 TencentCloudChat 实例成功"),this.chatIns}catch(J){return Hg.error("创建 TencentCloudChat 实例失败:",J),this._handleTimInitFailed({type:"createTimInstanceFailed"}),null}}async _login(){const J={userID:this.user_id,userSig:this.user_sig};Hg.debug("登录参数",JSON.stringify(J));const[Z,ee]=await Bg(this.chatIns.login(J));if(0===ee?.code)Hg.debug("登录成功","code=0");else if(2025===Z?.code)Hg.debug("重复登录","code=2025");else if(7501===ee?.code)Hg.debug("登录正在执行中",`res.code=${ee.code}`);else{const J=Z||ee;Hg.error("登录失败 login error:",J),this._handleTimInitFailed({type:"loginFailed"})}}async joinGroups(J=0){if(Hg.debug(`joinGroups call scence=${J}`),!this.chatIns)return;let Z=[];for(const J of this.group_list){let ee=this.chatIns.joinGroup({groupID:J.group_id,type:J.group_type});Z.push(ee)}const ee=await Promise.allSettled(Z),ne=[];for(let J=0;J<ee.length;J++){const Z=ee[J];10013!==Z?.reason?.code&&2903!==Z?.reason?.code&&0!==Z?.value?.code||ne.push(this.group_list[J].group_id)}const se=ne.length===this.group_list.length;return se?(Hg.debug("加入全部群组成功"),this.emit("evTimJoinGroupSuccess"),this._msgIns.emit(it)):(Hg.error("加入全部群组失败"),0!==J&&1!==J||this._handleTimInitFailed({type:"joinGroupFailed"}),this._msgIns.emit(ot)),se}async quitGroups(){if(Hg.debug("quitGroups call"),!this.chatIns)return;const J=[];for(const Z of this.group_list){let ee=this.chatIns.quitGroup(Z.group_id);J.push(ee)}const Z=await Promise.allSettled(J);for(let J=0;J<Z.length;J++){const ee=Z[J];"rejected"===ee.status&&Hg.error("quitGroups error.",JSON.stringify(ee.reason))}return Z}logout(){if(this.chatIns)return this.chatIns.logout().then((J=>(Hg.debug(`logout success. code=${J?.code}`),J))).catch((J=>{if(2024===J.code)return Hg.debug("logout success. code=2024"),J;throw Hg.debug("logout failed. ",JSON.stringify(J)),J}))}isReady(){return!!this.chatIns?.isReady()}async disconnect(J=!1){if(this.removeEvents(),Hg.debug("disconnect call"),!this.chatIns)return Hg.warn("tim chat instance is null when call the disconnect method"),!0;try{return J?(await this.quitGroups(),Hg.debug("Tim destroy call"),await this.chatIns.destroy(),this.chatIns=null):(Hg.debug("Tim logout call (keep instance for reconnect)"),await this.logout()),!0}catch(J){return Hg.error("disconnect error:",JSON.stringify(J?.message)),!1}}async getSelfStatus(){if(!this.chatIns)return Hg.debug("getSelfStatus: -1"),-1;return this.chatIns.getUserStatus({userIDList:[`${this.user_id}`]}).then((function(J){const{successUserList:Z}=J.data,ee=Z[0];return Hg.debug(`getSelfStatus: ${ee.statusType}`),ee.statusType})).catch((function(J){return Hg.error("getSelfStatus: -2, error:",J),-2}))}initEvents(){this.chatIns.on(Fg.EVENT.SDK_READY,this._onTimSdkReady,this),this.chatIns.on(Fg.EVENT.MESSAGE_RECEIVED,this._onTimMessageReceived,this),this.chatIns.on(Fg.EVENT.KICKED_OUT,this._onTimKickedOut,this),this.chatIns.on(Fg.EVENT.NET_STATE_CHANGE,this._onTimNetStateChange,this),this.chatIns.on(Fg.EVENT.ERROR,this._onTimError,this)}removeEvents(){this.chatIns&&(this.chatIns.off(Fg.EVENT.SDK_READY,this._onTimSdkReady,this),this.chatIns.off(Fg.EVENT.MESSAGE_RECEIVED,this._onTimMessageReceived,this),this.chatIns.off(Fg.EVENT.KICKED_OUT,this._onTimKickedOut,this),this.chatIns.off(Fg.EVENT.NET_STATE_CHANGE,this._onTimNetStateChange,this),this.chatIns.off(Fg.EVENT.ERROR,this._onTimError,this))}_handleTimInitFailed(J){Hg.error(`_handleTimInitFailed type=${J.type}`),Date.now()-this.createTime<1e4&&setTimeout((()=>{this.initialize(1)}),this.retryCount>0?200*this.retryCount:200)}_onTimSdkReady(J){Hg.debug("sdk is ready"),this.joinGroups(1)}_onTimMessageReceived(J){Hg.debug(`${function(J,Z="HH:MM:SS.sss"){const ee=String(J.getHours()).padStart(2,"0"),ne=String(J.getMinutes()).padStart(2,"0"),se=String(J.getSeconds()).padStart(2,"0"),re=String(J.getMilliseconds()).padStart(3,"0");let ae=Z;return ae=ae.replace("HH",ee).replace("MM",ne).replace("SS",se).replace("sss",re),ae}(new Date)} 触发 onMessageReceived 事件`,J);J.data.forEach((J=>{J.type===Fg.TYPES.MSG_TEXT?this.group_list.findIndex((Z=>Z.group_id===J.to))>-1&&this.emit("evMessageReceived",J.payload.text):J.type===Fg.TYPES.MSG_CUSTOM&&this.group_list.findIndex((Z=>Z.group_id===J.to))>-1&&this.emit("evMessageReceived",J.payload.data)}))}_onTimKickedOut(J){Hg.debug("触发 onKickedOut 事件",J.data.type),this._msgIns.emit(pt,J.data.type)}_onTimNetStateChange(J){Hg.debug("触发 onNetStateChange 事件",J.data.state),J.data.state===Fg.TYPES.NET_STATE_CONNECTED&&this.isReady()&&this.joinGroups(2),this._msgIns.emit(mt,J.data.state)}_onTimError(J){Hg.debug("触发 error 事件",J),this._msgIns.emit(It,J)}}const Kg=__webpack_require__(241),Wg=jg("IM_adapter");class Adapter extends Je{constructor(J,Z){super(),this._msgIns=Z,this.opt=J||{},this.opt.context&&"string"!=typeof this.opt.context&&(this.opt.context=JSON.stringify(this.opt.context)),this.opt.timConnectionInfo=this.opt.extra_connection_info?.tim_connection_info?.sdk_app_id?this.opt.extra_connection_info.tim_connection_info:null,this.online=!1,this._ws=null,this._ps=null,this._tim=null,this.reconnectionAttempts=999,this.reconnectionDelayMax=8e3,this.lastPing=null,this.lastPingCheckTime=3e4,this._psReconnectCount=0,this._psMaxReconnectAttempts=99,this._psIsReconnecting=!1,this._psReconnectTimer=null,this.selfClose=!1}async connect(){this.selfClose=!1;const{channelId:J,socket_server:Z,connection_token:ee,nginx_server:ne,timConnectionInfo:se}=this.opt;if(se){this._tim&&this._tim._msgIns===this._msgIns?(this._tim.createTime=Date.now(),this._tim.retryCount=0,Wg.debug("[tim] user _tim")):(this._tim=new Tim(se,this._msgIns),this._timAddEventListener(),Wg.debug("[tim] new Tim")),this._initSocket(Z,ee,J);const ne=new Promise(((J,Z)=>{this._ws.once("joined",J),setTimeout((()=>Z(new Error("join timeout"))),1e4)})),re=new Promise(((J,Z)=>{this._tim.once("evTimJoinGroupSuccess",J),setTimeout((()=>Z(new Error("tim init timeout"))),1e4)}));this.join(J);const[ae,le]=await Promise.allSettled([ne,re]);return"rejected"===le.status&&this.destroyTim(!1),"rejected"===ae.status||"rejected"===le.status?Promise.reject(ae.reason||le.reason):Promise.resolve(ae.value)}return this._initSocket(Z,ee),this._initPushStream(ne,J),this.join(J),new Promise(((J,Z)=>{this._ws.once("joined",(Z=>J(Z))),setTimeout((()=>{Z(new Error("join timeout"))}),1e4)}))}_initSocket(J,Z){Wg.debug("iows_initSocket");const ee={query:`token=${Z}&ver=1.0.1&s=${Bn}`,reconnectionAttempts:this.reconnectionAttempts,reconnectionDelayMax:this.reconnectionDelayMax,path:"/socket.io",rememberUpgrade:!0,autoConnect:!1,forceNew:!0,transports:["websocket"]},ne=Kg(J,ee);ne.connect(),ne.on("connecting",(()=>{Wg.debug("iows_connecting event")})),ne.on("connect",(()=>{Wg.debug("iows_connect event")})),ne.on("connected",(()=>{Wg.debug("iows_connected event")})),ne.on("joined",(J=>{Wg.debug("iows_joined event:",J),this._onJoined(J)})),ne.on("disconnect",(J=>{Wg.debug("iows_disconnect event:",J),this.emit("disconnect",J)})),ne.on("reconnecting",(J=>{Wg.debug("iows_reconnecting event:"),this._onReconnecting(0,J)})),ne.on("reconnect_attempt",(J=>{Wg.debug("iows_reconnect_attempt event, attempt:",J),this.emit("reconnectAttempt",J)})),ne.on("reconnect",(J=>{Wg.debug("iows_reconnect event, attempt:",J),this._onReconnect(0,J)})),ne.io.on("packet",(J=>{this.lastPingCheckTime=Date.now()})),ne.on("error",(J=>null)),ne.on("msg",(J=>{this._ondata("iows",J)})),ne.connect(),this._ws=ne}_initPushStream(J,Z){Wg.debug("psws_initPushStream");const ee=this,ne=`wss://${J.match(/^(https?:\/\/)?([^\/]+)/)[2]}/ws/${Z}?_=1739435966054&tag=&time=&eventid=`;this._ps&&(this._ps.close(),this._ps=null);const _reconnect=()=>{if(ee._psIsReconnecting||ee._psReconnectCount>=ee._psMaxReconnectAttempts)return;ee._psIsReconnecting=!0,Wg.debug(`psws_pushstream服务,第${ee._psReconnectCount+1}次重连...`);const ne=1e3*Math.pow(2,ee._psReconnectCount);ee._psReconnectTimer=setTimeout((()=>{ee._initPushStream(J,Z),ee._psReconnectCount++,ee._psIsReconnecting=!1}),ne)},se=wx.connectSocket({url:ne,success(J){Wg.debug("psws_wx.connectSocket success",J)},fail(J){Wg.error("psws_wx.connectSocket fail",J),_reconnect()}});this._ps=se,se.onOpen((J=>{Wg.debug("psws_onOpen event"),ee._psReconnectCount=0})),se.onClose((J=>{Wg.debug("psws_onClose event:",J),this.selfClose?Wg.debug("psws_onClose 主动调用断开不重连"):_reconnect()})),se.onError((J=>{Wg.warn("psws_onError",J),this.selfClose||_reconnect()})),se.onMessage((J=>{Wg.debug("psws_onMessage:",J);const Z=JSON.parse(J.data).text,ee=decodeURIComponent(Z);this._ondata("psws",ee)}))}join(J,Z,ee){this.opt.timConnectionInfo&&this._tim&&this._tim.initialize(),this._emitwsjoin(J)}leave(){this._ws&&this._ws.emit("leave",{channel:this.opt.channelId,third_party_user_id:this.opt.third_party_user_id}),Wg.debug(`leave channelId: ${this.opt.channelId} , third_party_user_id: ${this.opt.third_party_user_id}`)}disconnect(J=!1){this.selfClose=!0,this._ws&&this._ws.disconnect(),this._ps&&this._ps.close(),this._tim&&this.destroyTim(J),Wg.debug("disconnect all websocket")}_onTimData(J){this._ondata("tim",J)}destroyTim(J=!1){this._tim&&(this._tim.off("evMessageReceived",this._onTimData.bind(this)),this._tim.disconnect(J),this._tim=null)}_emitwsjoin(J){const Z=this.opt,{third_party_user_id:ee,context:ne,hide:se}=Z,re={channel:J,third_party_user_id:ee,context:ne,hide:se};this._ws&&this._ws.emit("join",re),Wg.debug("_emitwsjoin call:",re)}_onJoined(J){this.online=!0,this.emit("online",J)}_onReconnecting(J,Z){Wg.warn(`socket reconnecting, attempt: ${Z}`),this.online&&(this.online=!1,this.emit("offline",{}))}_onReconnect(J,Z){Wg.warn(`socket reconnected success, attempt: ${Z}`),this._emitwsjoin(this.opt.channelId)}_timAddEventListener(){this._tim&&this._tim.on("evMessageReceived",this._onTimData.bind(this))}async _ondata(J,Z){let ee=await this._parseData(Z);if(Wg.debug(`${J} msg parsed:`,ee),ee){Array.isArray(ee)||(ee=[ee]);for(let J of ee){let Z=utils_safeJsonParse(J);Array.isArray(Z)?this._dispatch(utils_safeJsonParse(Z[Z.length-1])):this._dispatch(Z)}}}async _parseData(J){J=utils_safeJsonParse(J);const Z=J?.comp_alg;if(!Z)return J;const ee=J.encoding;let ne,se;try{ne="b64"===ee?decode(J.content):"b64_2"===ee?toUint8Array(J.content):J.content}catch(Z){Z&&Z.message.indexOf("TypedArray.from requires")>-1&&(ne=function(J){try{J=J.replace(/[^A-Za-z0-9+/]/g,"").replace(/[-_]/g,(J=>"-"==J?"+":"/"));const Z="function"==typeof Buffer?Buffer.from(J,"base64"):$t(J).split("").map((J=>J.charCodeAt(0)));return new Uint8Array(Array.prototype.slice.call(Z,0))}catch(J){console.error("toUint8ArrayExt exec error:",J)}}(J.content))}if(ne)if("gz"===Z){let J;try{J=await async function decompressData(J){return Xt.inflate(J,{to:"string"})}(ne)}catch(J){Wg.error("gunzip data error:",J)}se=utils_safeJsonParse(J)}else se=utils_safeJsonParse(ne);return se}_dirMsgFilter(J,Z){return"string"!=typeof J?1:(J=J.split(","),Array.isArray(J)?J.length&&J.indexOf(Z+"")>=0?2:-1:0)}_dispatch(J){J&&(this._dirMsgFilter(J.user_ids,this.opt.third_party_user_id)<=0||this.emit("service_message",J))}}class WxHttp{constructor(J){this.store=J}request(J,Z={},ee="POST"){return new Promise(((ne,se)=>{const re={url:J,method:ee,data:Z,header:{"Content-Type":"application/x-www-form-urlencoded"},timeout:1e4,success:J=>this._handleSuccess(J,ne,se),fail:J=>this._handleFail(J,se)};wx.request(re)}))}_handleSuccess(J,Z,ee){if(200!==J.statusCode)return ee({code:J.statusCode,msg:"网络请求失败"});const ne=J.data||{};200==+ne.code?Z(ne.data):ee(ne)}_handleFail(J,Z){Z({code:-1,msg:"网络连接失败",errMsg:J.errMsg})}}const Yg="wechat_applet",zg="package_check";class WxApi{constructor(J){this.currentEnvConfig=J.currentEnvConfig,this.opt=J.opt,this.http=new WxHttp}requestVhallyunInit(J){const Z=utils_safeUrlJoin(this.currentEnvConfig.VHALLYUN_API_BASE,Xe),ee={app_id:this.opt.appId,channel_id:this.opt.channelId,third_party_user_id:this.opt.third_party_user_id,access_token:this.opt.token,random_key:J,version:"weapp_0.1.0",client:Yg,package_check:zg};return this.http.request(Z,ee)}sendMsg(J,Z={},ee={},ne=0,se){const re=utils_safeUrlJoin(this.currentEnvConfig.VHALLYUN_API_BASE,Qe),ae={app_id:this.opt.appId,channel_id:this.opt.channelId,access_token:this.opt.token,third_party_user_id:this.opt.third_party_user_id,type:J,no_audit:ne,context:JSON.stringify(ee),body:"string"==typeof Z?Z:JSON.stringify(Z),client:Yg,package_check:zg};se&&(ae.tag=se),ae.signed_at=Date.now(),ae.sign_type=ns;const le=function(J,Z,ee){if(Z||(Z=ts),!Z)return console.warn("secretKey is empty"),"";isNaN(ee)&&(ee=ns),"[object object]"!==Object.prototype.toString.call(J).toLowerCase()&&(J={});const ne=Object.keys(J).sort();let se="";for(const Z of ne)se+=`${Z}${J[Z]}`;const re=`${Z}${se}${Z}`;return 3===ee?es(re).toString().toLocaleLowerCase():0===ee?Kn.MD5(re).toString().toLocaleLowerCase():Kn.SHA256(re).toString().toLocaleLowerCase()}(ae);return le&&(ae.sign=le),this.http.request(re,ae)}sendDirect(J,Z={},ee={},ne=0,se,re){}}class VhallImInterface extends Je{constructor(J,Z){super(),this.VhallMsg=J,this.opt=Z,this.compChannelId=void 0,this.adapter=null,this.currentEnvConfig=Z?.env&&Fe.envConfig[Z.env]?Fe.envConfig[Z.env]:Fe.envConfig.production,this.api=new WxApi(this)}async init(){const J=function(J=48){const Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let ee="";for(var ne=0;ne<J;ne++){let J=Math.floor(62*Math.random());ee+=Z.substring(J,J+1)}return ee}(48),Z=function(J,Z){const ee=new Hn;return ee.setPublicKey(Z),ee.encrypt(J)}(J,this.currentEnvConfig.PUBLIC_KEY);if(this.info=await this.api.requestVhallyunInit(Z),this.info.comp_channel_id&&(this.compChannelId=this.info.comp_channel_id),this.info.secret_key){const Z=function(J,Z,ee){"string"!=typeof J&&(J=JSON.stringify(J));const ne=Kn.AES.decrypt(J,Kn.enc.Utf8.parse(Z),{iv:Kn.enc.Utf8.parse(ee)});return Kn.enc.Utf8.stringify(ne)}(this.info.secret_key,J.substring(0,32),J.substring(32,48));ee=this.info.sign_type,isNaN(ee)||(ns=ee),function(J){ts=J}(Z)}var ee}async connect(){if(this.adapter)return"function"==typeof callback?(this.adapter.join(this.compChannelId||this.opt.channelId,this.opt,callback),this):new Promise(((J,Z)=>{this.adapter.join(this.compChannelId||this.opt.channelId,this.opt,(function(Z){J(Z)})),setTimeout((()=>Z(new Error("join timeout"))),1e4)}));{const J={channelId:this.compChannelId||this.opt.channelId,third_party_user_id:this.opt.third_party_user_id,socket_server:this.info.socket_server,connection_token:this.info.connection_token,nginx_server:this.info.nginx_server,context:this.opt.context,hide:this.opt.hide,extra_connection_info:this.info?.extra_connection_info};this.adapter=new Adapter(J,this),this.adapter.on("online",(J=>{this.emit("online",J)})),this.adapter.on("offline",(J=>{this.emit("offline",J)})),this.adapter.on("service_message",(Z=>{var ee;if(Z.service_type&&(!Z.channel||J.channelId.includes(Z.channel)))if("service_im"==Z.service_type){let J=JSON.stringify({});const{type:ne}=JSON.parse(Z.data);Z.context&&(J=JSON.parse(Z.context),"nickname"in J&&delete J.nickname);const se={type:JSON.parse(Z.data).type,text_content:ne===nt.TYPE_TEXT?(ee=JSON.parse(Z.data).text_content,ee.replace(/</g,"&lt;").replace(/>/g,"&gt;")):JSON.parse(Z.data).text_content,data:JSON.parse(Z.data),user_id:Z.sender_id,target_id:JSON.parse(Z.data).target_id,context:J,msg_id:Z.msg_id,date_time:Z.date_time};this.emit(Z.service_type,se)}else if("service_online"==Z.service_type){switch(utils_safeJsonParse(Z.data).type){case"Join":this.emit("service_online_join",Z);break;case"Leave":this.emit("service_online_leave",Z)}}else this.emit(Z.service_type,Z)}));return await this.adapter.connect()}}updateOption(J){}initSubEvent(){}onOnLine(J){return this.on("online",J)}onOffLine(J){return this.on("offline",J)}onJoin(J){return this.on("service_online_join",J)}onLeave(J){return this.on("service_online_leave",J)}onChat(J){return this.on("service_im",J)}onCustomMsg(J){return this.on("service_custom",J)}onRoomMsg(J){return this.on("service_room",J)}onDocMsg(J){return this.on("service_document",J)}async _sendEvent(J){if(!this.adapter.online)throw{code:"",message:"Adapter is offline",data:{}};const{type:Z,msg:ee,context:ne,no_audit:se=0,tag:re,user_ids:ae}=J;return await this.api.sendMsg(Z,ee,ne,se,re)}sendChat(J){const{data:Z="",context:ee={},inspection:ne=!0}=J;if("string"!=typeof Z||"boolean"!=typeof ne)return Promise.reject({code:"",message:"无效的参数",data:{}});const se={type:"service_im",msg:{type:"text",text_content:Z},context:Object.assign({avatar:this.opt?.userInfo?.avatar,nickname:this.opt?.userInfo?.nickname,role_name:this.opt?.userInfo?.role_name,user_id:this.opt?.userInfo?.user_id,member_level:this.opt?.userInfo?.member_level},ee),no_audit:Number(!ne),user_ids:J&&J.user_ids};return"string"==typeof J.tag&&(se.tag=J.tag),this._sendEvent(se)}sendCustomEvent(J){let Z=J&&J.data;"string"==typeof Z&&(Z=JSON.parse(Z));const ee={type:"service_custom",msg:Z,user_ids:J&&J.user_ids};return"string"==typeof J.tag&&(ee.tag=J.tag),this._sendEvent(ee)}sendRoomEvent(J){let Z=J&&J.data;"string"==typeof Z&&(Z=JSON.parse(Z));const ee={type:"service_room",msg:Z,user_ids:J&&J.user_ids};return"string"==typeof J.tag&&(ee.tag=J.tag),this._sendEvent(ee)}destroy(J=!1){this.api=null,this.adapter&&(this.adapter.leave(),this.adapter.disconnect(J)),this.clearEvents(),this.VhallMsg.channlIdMap[this.opt.channelId]=null}}const Jg=jg("IM_VhallMsg");class VhallMsg{static channlIdMap={};static async createInstance(J){if(Jg.debug("createInstance start:"),!J)return;const Z=J.env;let{user:ee,interact:ne,kickMark:se,webinarId:re,watchInitData:ae,interactToolStatus:le}=J.store.get("");se||(se=`${re}_${function guid(){return"xxxxxxxx-xxxxxxxx".replace(/[xy]/g,(function(J){var Z=16*Math.random()|0;return("x"===J?Z:3&Z|8).toString(16)}))}()}`,J.store.set("kickMark",se));const pe=ee,_e=ne.paas_app_id,ve=ne.channel_id,ye=ne.paas_access_token,Fe=ee.user_id;try{if(!(_e&&ve&&ye)){throw{code:"",message:"无效的参数",data:{}}}let J=VhallMsg.channlIdMap[ve];if(J)return J.clearEvents(),J;const ee={appId:_e,channelId:ve,token:ye,third_party_user_id:Fe,userInfo:pe,env:Z,context:{role_name:2,nickname:pe.nickname,avatar:pe.avatar,user_id:pe.user_id,openid:pe.openid,device_type:1,device_status:0,kick_id:ae?.sso?.kick_id,kick_mark:se,pv:ae?.pv&&(ae.pv.num2??ae.pv.real),uv:ae?.online&&(ae.online.num||ae.online.virtual),is_banned:le?.is_banned,privacies:ae?.join_info.privacies||""}};J=new VhallImInterface(VhallMsg,ee),await J.init();await J.connect();return VhallMsg.channlIdMap[ve]=J,Jg.debug("createInstance success."),J}catch(J){throw Jg.error("createInstance error:",J),J instanceof Error?J:new Error(JSON.stringify(J))}}static Type=nt}function formatTimestamp(J,Z="YYYY-MM-DD HH:mm:ss"){const ee=10===J.toString().length?1e3*J:J,ne=new Date(ee),se=ne.getFullYear(),re=String(ne.getMonth()+1).padStart(2,"0"),ae=String(ne.getDate()).padStart(2,"0"),le=String(ne.getHours()).padStart(2,"0"),pe=String(ne.getMinutes()).padStart(2,"0"),_e=String(ne.getSeconds()).padStart(2,"0");return Z?Z.replaceAll("YYYY",se).replaceAll("MM",re).replaceAll("DD",ae).replaceAll("HH",le).replaceAll("mm",pe).replaceAll("ss",_e):`${se}-${re}-${ae} ${le}:${pe}:${_e}`}let Zg;const Xg=jg("RoomServer");getApp();let Qg;class RoomServer{static name="RoomServer";constructor(J){this.sdkInstance=J,this.wxApi=this.sdkInstance.wxApi,this.sdkInstance.on(this.sdkInstance.EVENT.FOREGROUND_REFRESH,((...J)=>this.onForeground(...J)))}async initRoom(){const{webinarId:J}=this.sdkInstance,Z=this.sdkInstance.store.get("user");Z?.token?this.wxApi.setCommonHeaders("token",Z?.token):Z?.scope_token&&this.wxApi.setCommonHeaders("scope-token",Z?.scope_token);const ee=await this.wxApi.sendPost("/v3/webinars/watch/sdk-init",Object.fromEntries(Object.entries({webinar_id:J,nickname:truncateString(Z?.nickname),token:Z?.token,avatar:Z?.avatar,openid:Z?.openid,email:Z?.email,visitor_id:He.getStorageSync("vh_visitor_id")||void 0}).filter((([J,Z])=>void 0!==Z))));if(200===ee?.code){const{webinar:J,join_info:Z,interact:ne}=ee.data;this.wxApi.setCommonHeaders("Interact-Token",ee.data.interact.interact_token),this.sdkInstance.store.set("watchInitData",ee.data),this.sdkInstance.store.set({liveInfo:Object.assign({},this.sdkInstance.store.get("liveInfo"),{bussinessId:J.userinfo.user_id,mode:J.webinar_show_type,coverImg:0==J.webinar_show_type&&J.vertical_img_url?J.vertical_img_url:J.img_url,title:J.subject,status:J.type,introduction:J.introduction,startTime:J.start_time}),interact:ne});const se=this.sdkInstance.get("userServer");se?.updateLocalUser({role_name:Z.role_name,avatar:Z.avatar,user_id:Z.third_party_user_id||Z.user_id,nickname:Z.nickname}),He.setStorage({key:"vh_visitor_id",data:ee.data.visitor_id})}return ee}async initIM(){if(Xg.log("initIM"),this.sdkInstance.leaveRoom)try{await this.sdkInstance.leaveRoom(!1)}catch(J){this.sdkInstance.BRSAgent?.customLog("leaveRoom error:",JSON.stringify(J))}this.imInstance=await VhallMsg.createInstance(this.sdkInstance),this.imInstance.on("onTimNetStateChange",(Z=>{this.sdkInstance.emit(J.NET_STATE_CHANGE,Z),"disconnected"===Z?Qg=Date.now():"connecting"===Z||"connected"===Z&&(Qg>0&&(this.sdkInstance.BRSAgent?.customLog(`NetState:disconnected: ${formatTimestamp(Qg)}`),Qg=0),this.sdkInstance.BRSAgent?.customLog(`NetState:${Z}`))})),this.imInstance.onChat((Z=>{const ee=this.sdkInstance.store.get("user"),ne=this.sdkInstance.store;switch(Z.type){case"image":case"text":ee.user_id!=Z.user_id&&this.sdkInstance.emit(J.CHAT_MSG,Z);break;case"disable":Z.target_id==ee.user_id&&ne.set("interactToolStatus.is_banned",!0);break;case"permit":"customPraiseTotal"==Z.data.event_type?this.sdkInstance.emit(J.LIKE_MSG,Z):Z.target_id==ee.user_id&&ne.set("interactToolStatus.is_banned",!1);break;case"disable_all":ne.set("interactToolStatus.all_banned",!0);break;case"permit_all":ne.set("interactToolStatus.all_banned",!1)}})),this.imInstance.onJoin((Z=>{this.sdkInstance.emit(J.JOIN_MSG,Z)})),this.imInstance.onLeave((Z=>{this.sdkInstance.emit(J.LEAVE_MSG,Z)})),this.imInstance.onRoomMsg((Z=>{if(Z){if(Z.data=safeJsonParse(Z.data),"banned_mode_update"===Z.data.type)this.sdkInstance.store.set("interactToolStatus.banned_mode",Z.data.mode);this.sdkInstance.emit(J.ROOM_MSG,Z)}})),this.imInstance.onCustomMsg((Z=>{Z&&(Z.data=safeJsonParse(Z.data),this.sdkInstance.emit(J.CUSTOM_MSG,Z))})),this.sdkInstance.sendChat=async Z=>{const{all_banned:ee,is_banned:ne,banned_mode:se}=this.sdkInstance.store.get("interactToolStatus");if(!Z||ee||ne&&1!=se)return;const re=this.sdkInstance.store.get("user");(!ne||1!=se)&&this.imInstance.sendChat(Z),this.sdkInstance.emit(J.CHAT_MSG,{type:"text",data:{text_content:Z.data},context:{role_name:"2",nick_name:re.nickname,avatar:re.avatar,user_id:re.user_id,member_level:re.member_level||""}})},this.sdkInstance.leaveRoom=async(J=!1,Z)=>this.imInstance?.destroy(J)}async getCommonConfig(){const J=["webinar-tag","screen-poster","public-account","invite-card","keywords","like","sign","timer","menu","member-level"],Z=this.sdkInstance.store.get("watchInitData");if(!Z?.webinar)return;5!=Z.webinar.type&&J.push("room-tool");const ee={webinar_id:Z.webinar.id,switch_id:Z.switch?.switch_id,tags:J},ne=await this.wxApi.sendPost("/v3/interacts/union/common-config",ee);return 200===ne?.code&&(this.sdkInstance.store.set("webinarTag",ne.data?.["webinar-tag"]?.data||{}),this.sdkInstance.store.set("screenPosterInfo",ne.data?.["screen-poster"]?.data||{}),this.sdkInstance.store.set("officicalInfo",ne.data?.["public-account"]?.data||{}),this.sdkInstance.store.set("advDefault",ne.data?.["adv-default"]?.data||{}),this.sdkInstance.store.set("inviteCardStatus",ne.data?.["invite-card"]?.data||{}),this.sdkInstance.store.set("keywords",ne.data?.keywords?.data||{}),this.sdkInstance.store.set("redPacket",ne.data?.["red-packet"]?.data||{}),this.sdkInstance.store.set("pwdRedPacket",ne.data?.["pwd-red-packet"]?.data||{}),this.sdkInstance.store.set("likeCount",ne.data?.like?.data.total||0),this.sdkInstance.store.set("noticeInfo",ne.data?.announcement?.data||{}),this.sdkInstance.store.set("signinInfo",ne.data?.sign?.data||{}),this.sdkInstance.store.set("timerInfo",ne.data?.timer?.data||{}),this.sdkInstance.store.set("examInfo",ne.data?.exam?.data||{}),this.sdkInstance.store.set("pushCardInfo",ne.data?.["push-screen-card"]?.data||{}),this.sdkInstance.store.set("interactToolStatus",ne.data?.["room-tool"]?.data||{}),this.sdkInstance.store.set("customMenu",this._resolveCustomMenu(ne.data?.menu)),this.sdkInstance.store.set("memberLevel",ne.data?.member_level?.data||{})),ne}_resolveCustomMenu(J){if(!J||!J.data||!J.data.list)return{};const Z=function isInPc(){try{return Zg||this.getDevicePlatform(),"windows"===Zg||"mac"===Zg}catch(J){return!1}}();for(let ee=J.data.list.length-1;ee>-1;ee--){const ne=J.data.list[ee];1==ne.type?Z&&0==ne.pc_show?J.data.list.splice(ee,1):Z||0!=ne.wap_show||J.data.list.splice(ee,1):5!==ne.type&&(ne.status=Z?1==ne.pc_show?1:2:1==ne.wap_show?1:2)}return J.data}async getInavToolStatus(){const J=this.sdkInstance.store.get("watchInitData");if(5==J.webinar.type){if(!J.interact?.interact_token)return{msg:"请检查活动是否设置了观看限制"};const Z=await this.wxApi.sendGet("/v3/interacts/room/get-inav-tool-status",{room_id:J.interact.room_id,webinar_switch_id:J.switch.switch_id});return 200===Z?.code&&Z.data&&this.sdkInstance.store.set("interactToolStatus",Z.data),Z}return null}async getPermissions(){const{webinarId:J}=this.sdkInstance,Z=this.sdkInstance.store.get("liveInfo").bussinessId,ee=await this.wxApi.sendGet("/v3/users/permission/get-config-list",{webinar_id:J,webinar_user_id:Z,scene_id:3});return 200===ee.code&&this.sdkInstance.store.set(this._resolvePermissionResult(ee.data)),ee}_resolvePermissionResult(J){return{permissions:"string"==typeof J.permissions?JSON.parse(J.permissions):J.permissions,permissionValue:"string"==typeof J.permission_value?JSON.parse(J.permission_value):J.permission_value}}onForeground=({gap:J})=>Promise.all([this.getCommonConfig(),this.getPermissions()]).catch((J=>Xg.error("RoomServer.onForeground refresh failed:",J)));destroy(J){this.imInstance?.destroy(J)}}const ef=jg("UserServer");class UserServer extends BaseServer{static name="UserServer";constructor(J){super(),this.sdkInstance=J,this.wxApi=J.wxApi}async login(J){const Z=J.third_user_id?"/v3/users/open-user/login":"/v3/users/open-user/get-scope-token",ee=await this.wxApi.sendPost(Z,J,{headers:{"Content-Type":"application/x-www-form-urlencoded"}});return 200==ee.code&&(J.third_user_id?this.updateLocalUser({token:ee.data.token}):this.updateLocalUser({scope_token:ee.data.scope_token})),ee}async updateUserInfo(J){return cosnt[(basicRes,joinRes)]=await Promise.all([this._updateUserBasicInfo(J),this._updateUserJoinInfo(J)]),200==basicRes.code&&200==joinRes.code&&(updateLocalUser(parms),!0)}async _updateUserBasicInfo(J){const Z=this.sdkInstance.store.get("watchInitData"),ee=this.sdkInstance.store.get("user"),ne={...J,biz_id:2,biz_application_id:Z?.interact?.paas_app_id,consumer_id:ee?.user_id};if(!ne.biz_application_id||!ne.consumer_id||!ee?.token)return ef.error("updateUserBasicInfo params: ",ne),Promise.reject("用户基本信息参数错误,请刷新直播间重试.");console.log("updateUserBasicInfo params: ",ne);const se=await this.wxApi.sendPost("/v1/ucenter/app/user/modify-basic-info",ne,{headers:{"Content-Type":"application/x-www-form-urlencoded",token:ee.token}});return 200!==se?.code&&this.sdkInstance.BRSAgent?.customLog(`updateUserJoinInfo error. ${JSON.stringify(se)}`),se}async _updateUserJoinInfo(J){const Z=this.sdkInstance.store.get("watchInitData"),ee={...J,webinar_id:Z?.webinar?.id};if(!ee?.webinar_id||!Z.interact?.interact_token)return ef.error("updateUserJoinInfo params: ",ee),Promise.reject("用户参会信息参数错误,请刷新直播间重试.");console.log("updateUserJoinInfo params: ",ee);const ne=await this.wxApi.sendPost("/v3/webinars/watch/update-join-info",ee);return 200!==ne?.code&&this.sdkInstance.BRSAgent?.customLog(`updateUserJoinInfo error. ${JSON.stringify(ne)}`),ne}updateLocalUser(J){if(!J||"object"!=typeof J)return;J.nick_name&&(J.nickname=J.nick_name,delete J.nick_name);const Z=this.sdkInstance.store.get("user")||{};this.sdkInstance.store.set("user",{...Z,...J})}async getUserInfo(){}}const tf=jg("LogReportServer");class LogReportServer{static name="LogReportServer";constructor(J){tf.log("LogReportServer ctor:"),this.sdkInstance=J,this.logReportBaseUrl=this.sdkInstance.envConfig.LOG_REPORT_BASE_URL,this.commonReportData=null,this._setCommonReportData();const Z=this.sdkInstance.store.get("watchInitData");[1,5].includes(Z.webinar.type)&&this.report(606001,{behavior:6})}_setCommonReportData(){const J=this.sdkInstance.store.get("watchInitData");this.commonReportData={bu:0,user_id:J?.join_info?.join_id,app_id:J?.interact?.paas_app_id,webinar_id:this.sdkInstance.webinarId,t_start:formatTimestamp(Date.now()),os:this._getReportOs(),type:8,entry_time:formatTimestamp(Date.now()),pf:9,env:this.sdkInstance.env,ua:"",user_agent:""}}_getReportOs(){const J=function getDevicePlatform(){try{if(!Zg){const J=wx.getDeviceInfo();Zg=J.platform}return Zg}catch(J){return"unkown"}}();let Z=0;return"windows"===J?Z=12:"mac"===J||("android"===J?Z=10:"ios"===J&&(Z=11)),Z}async report(J,Z){const ee=Object.assign({},this.commonReportData),ne={k:J,id:Date.now(),bu:0,token:Zt(JSON.stringify(ee))};wx.request({url:this.logReportBaseUrl,method:"GET",data:ne,success(J){},fail(J){}})}}const nf=__webpack_require__(406),sf=jg("VhallMiniSdk");getApp();class VhallMiniSdk extends BaseServer{static EVENT=J;constructor(J){super();const Z=nf.start({configAddress:"https://oneupload.bonree.com/RUM/config",appId:"96fac09b1a64485082d11c7079aa3020"});this.BRSAgent=Z,Z?.setUserId(J.account||J.email);try{this.options=(J=>{if(!J||"object"!=typeof J)throw new Error("sdk初始化参数错误");if(J&&J.hasOwnProperty("loglevel")&&setLogLevel(J.loglevel),!(J.app_key&&J.signedat&&J.sign&&J.username))throw new Error("参数`app_key`、`signedat`、`sign`、`username`参数必填,请检查");if(!J.roomid==!J.webinar_id)throw new Error("参数`roomid`和`webinar_id`二选一必填,请检查");if(!J.account==!J.email)throw new Error("参数`account`和`email`二选一必填,请检查");const Z={env:"production",app_key:"",sign:"",signedat:"",sign_type:0,roomid:"",webinar_id:"",wx_app_id:"",head:"",open_id:"",query_invite_code:"",username:"",account:"",email:"",member_level:void 0};for(const ee in Z)!Z.hasOwnProperty(ee)||J.hasOwnProperty(ee)&&void 0!==J[ee]||(J[ee]=Z[ee]);J.wx_app_id||(J.wx_app_id=wx.getAccountInfoSync().miniProgram.appId),["test","production"].includes(J.env)||J.env.env;const ee=parseInt(J.member_level,10);return J.member_level=Number.isNaN(ee)?void 0:ee,J})(J)}catch(J){throw sf.error(J),J}const{roomid:ee,webinar_id:ne}=this.options;this.env=this.options.env,this.envConfig=Fe.envConfig[this.env],this.wxApi=new RequestUtil({baseUrl:Fe.envConfig[this.env].BASE_URL,platform:Fe._PLATFORM}),this.log=$g,this.webinarId=ee||ne,this.wxAppId=this.options.wx_app_id,this._isReady=!1,this.startTs=0,this.store=new Store,this.store.set("webinarId",ee||ne),this.store.set("env",this.env),this.store.set("user",{nickname:this.options.username,user_id:this.options.account,open_id:this.options.open_id,avatar:this.options.head,member_level:this.options.member_level,email:this.options.email}),this.store.set("query_invite_code",this.options.query_invite_code),this.listenEvent(),this._bindAppShow(),this._modules=new SerializableMap,this.registerPlugin([RoomServer,UserServer]),this.options?.modules&&this.registerPlugin(J.modules)}EVENT=J;get=J=>{const Z=this._modules.get(J);if("function"==typeof Z)return Z();sf.warn(`模块不存在:${J}`)};registerPlugin=J=>{if(Array.isArray(J)&&J.length>0)for(const Z of J)this._registerSinglePlugin(Z);else this._registerSinglePlugin(J)};_registerSinglePlugin(J){if(J&&"function"==typeof J&&J.name)if(ye[J.name]){const Z=function firstLetterToLower(J){return"string"!=typeof J||0===J.length?J:J.charAt(0).toLowerCase()+J.slice(1)}(J.name);if(!this._modules.has(Z)){let ee;this._modules.set(Z,(()=>(ee||(ee=new J(this)),ee)),!0)}}else sf.error("不支持的模块 registerSinglePlugin=>:",J.name);else sf.error("注册模块格式错误")}init=async()=>{sf.debug("init exec");const ee=this.get("roomServer"),se=this.get("userServer");try{const{app_key:ae,signedat:ve,sign:ye,account:Fe,username:qe,head:$e,sign_type:He=0,email:Ye,roomid:Je,webinar_id:Xe}=this.options,Qe={app_key:ae,signedat:ve,sign:ye,nick_name:qe,head:$e,sign_type:He};Fe?Qe.third_user_id=Fe:Qe.email=Ye,Je?Qe.roomid=Je:Xe&&(Qe.webinar_id=Xe);const tt=await(se?.login(Qe));if(200!==tt?.code)return this._handleInitResult(ne,tt);const nt=await ee.initRoom();if(200!==nt?.code)return this._handleInitResult(re,nt);const[it,ot,pt,mt]=await Promise.all([ee.initIM(),ee.getPermissions(),ee.getCommonConfig(),ee.getInavToolStatus()]);if(200!==ot?.code)return this._handleInitResult(le,ot);if(200!==pt?.code)return this._handleInitResult(pe,pt);if(5==nt.data.webinar.type&&200!==mt?.code)return this._handleInitResult(_e,mt);this._handleBizErrorCode(""),this.startTs=Date.now(),this._isReady=!0;const It=this.store.get("user")?.openid,St=this.store.get("query_invite_code");if(this.BRSAgent?.customLog(`bindInviteRelation: query_invite_code=${St} openid=${It}`),St&&It){const J=this.get("inviteCardServer");J?.bindInviteRelation(St,It)}return this.registerPlugin(LogReportServer),this.emit(J.SDK_READY,"ok"),this._handleInitResult(Z)}catch(J){return console.error("init error:",J),this._handleInitResult(ve,J)}};isReady=()=>this._isReady;listenEvent(){this.unlistener&&this.unlistener(),this.unlistener=this.on({[J.ROOM_MSG]:Z=>{switch(sf.debug("收到房间消息:",Z),Z.data?.type){case"live_start":this.emit(J.LIVE_START);break;case"live_over":this.emit(J.LIVE_END);break;case"room_kickout":const ee=this.store.get("user");Z.data.target_id==ee?.user_id&&(this.emit(J.KICKOUT,Z.data),this._handleBizErrorCode(512514));break;case"record_watch_expire_set":this.emit(J.RECORD_WATCH_EXPIRE_SET,Z.data);break;case"mall_reward_push":this.emit(J.MALL_REWARD_PUSH,Z);break;case"mall_reward_end":this.emit(J.MALL_REWARD_END,Z)}},[J.JOIN_MSG]:J=>{sf.debug("上线消息(onJoin) msg:",J);const Z=this.store.get("watchInitData");if(1==Z?.sso?.enabled){const ee=safeJsonParse(J?.context),ne=this.store.get("kickMark");ee?.kick_id&&ee?.kick_id===Z.sso.kick_id&&ee.kick_mark!==ne&&this._handleBizErrorCode(900002)}},[J.LEAVE_MSG]:J=>{sf.debug("下线消息(onLeave) msg:",J)}})}_bindAppShow(){if(VhallMiniSdk._appShowBound)return;VhallMiniSdk._appShowBound=!0;let Z=0;wx.onAppHide((()=>{Z=Date.now(),this.BRSAgent?.customLog(`onAppHide hideTime:${Z}`)})),wx.onAppShow((()=>{this.BRSAgent?.customLog(`onAppShow showTime:${Date.now()}`);const ee=Date.now()-Z;Z=0,ee<3e3||this._isReady&&this.emit(J.FOREGROUND_REFRESH,{gap:ee})}))}_handleBizErrorCode=(J,Z)=>{if(sf.log("_handleBizErrorCode code:",J," detail:",Z),J){switch(J){case 511006:break;case 512514:case 900002:case 900004:this.destroy(!1)}this.store.set("errorResp",{code:J,detail:Z})}else this.store.set("errorResp",{code:"",detail:null})};_handleInitResult(ee,ne){if(sf.log("InitResult code:",ee),sf.log("InitResult detail:",ne),ee===Z)return packReturnMsg(ee);{const Z=packReturnMsg(ee,ne);return this.emit(J.INIT_FAILED,Z),this._handleBizErrorCode(ne?.code&&500!==ne.code?ne.code:ee,ne),Z}}destroy(J=!1){const Z=this.get("roomServer");Z?.destroy(J)}}function packReturnMsg(J,ee){switch(J){case Z:return{code:Z,message:"成功"};case se:return{code:se,message:"init-before执行失败",detail:ee};case re:return{code:re,message:"初始化房间失败",detail:ee};case ae:return{code:ae,message:"初始化im失败",detail:ee};case le:return{code:le,message:"初始化权限失败",detail:ee};case pe:return{code:pe,message:"初始化通用配置失败",detail:ee};case ve:return{code:ve,message:"初始化异常",detail:ee};default:return"string"==typeof ee?{code:J,message:ee}:{code:J,detail:ee}}}var rf=VhallMiniSdk}(),module.exports=ee}();