@amityco/ts-sdk 0.0.1-beta.8 → 0.0.1-beta.9

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 (244) hide show
  1. package/dist/@types/core/events.d.ts +63 -17
  2. package/dist/@types/core/events.d.ts.map +1 -1
  3. package/dist/@types/core/transport.d.ts +15 -0
  4. package/dist/@types/core/transport.d.ts.map +1 -1
  5. package/dist/@types/domains/client.d.ts +3 -0
  6. package/dist/@types/domains/client.d.ts.map +1 -1
  7. package/dist/@types/domains/comment.d.ts +1 -1
  8. package/dist/@types/domains/comment.d.ts.map +1 -1
  9. package/dist/@types/domains/community.d.ts +1 -1
  10. package/dist/@types/domains/community.d.ts.map +1 -1
  11. package/dist/@types/domains/group.d.ts +2 -2
  12. package/dist/@types/domains/group.d.ts.map +1 -1
  13. package/dist/@types/domains/partials.d.ts +3 -0
  14. package/dist/@types/domains/partials.d.ts.map +1 -1
  15. package/dist/@types/domains/post.d.ts +1 -1
  16. package/dist/@types/domains/post.d.ts.map +1 -1
  17. package/dist/@types/domains/user.d.ts +2 -1
  18. package/dist/@types/domains/user.d.ts.map +1 -1
  19. package/dist/client/api/connectClient.d.ts.map +1 -1
  20. package/dist/client/api/createClient.d.ts +2 -1
  21. package/dist/client/api/createClient.d.ts.map +1 -1
  22. package/dist/client/api/disconnectClient.d.ts.map +1 -1
  23. package/dist/client/api/getToken.d.ts +3 -1
  24. package/dist/client/api/getToken.d.ts.map +1 -1
  25. package/dist/comment/api/deleteComment.d.ts +1 -0
  26. package/dist/comment/api/deleteComment.d.ts.map +1 -1
  27. package/dist/comment/events/index.d.ts +4 -0
  28. package/dist/comment/events/index.d.ts.map +1 -1
  29. package/dist/comment/events/onCommentCreated.d.ts +1 -1
  30. package/dist/comment/events/onCommentCreated.d.ts.map +1 -1
  31. package/dist/comment/events/onCommentDeleted.d.ts +1 -1
  32. package/dist/comment/events/onCommentDeleted.d.ts.map +1 -1
  33. package/dist/comment/events/onCommentFlagged.d.ts +17 -0
  34. package/dist/comment/events/onCommentFlagged.d.ts.map +1 -0
  35. package/dist/comment/events/onCommentReactionAdded.d.ts +17 -0
  36. package/dist/comment/events/onCommentReactionAdded.d.ts.map +1 -0
  37. package/dist/comment/events/onCommentReactionRemoved.d.ts +17 -0
  38. package/dist/comment/events/onCommentReactionRemoved.d.ts.map +1 -0
  39. package/dist/comment/events/onCommentUnflagged.d.ts +17 -0
  40. package/dist/comment/events/onCommentUnflagged.d.ts.map +1 -0
  41. package/dist/comment/events/onCommentUpdated.d.ts +1 -1
  42. package/dist/comment/events/onCommentUpdated.d.ts.map +1 -1
  43. package/dist/comment/events/utils.d.ts +2 -0
  44. package/dist/comment/events/utils.d.ts.map +1 -0
  45. package/dist/comment/observers/observeComment.d.ts +1 -1
  46. package/dist/comment/observers/observeComment.d.ts.map +1 -1
  47. package/dist/comment/observers/observeComments.d.ts +5 -1
  48. package/dist/comment/observers/observeComments.d.ts.map +1 -1
  49. package/dist/community/events/index.d.ts +4 -0
  50. package/dist/community/events/index.d.ts.map +1 -1
  51. package/dist/community/events/onCommunityCreated.d.ts +2 -2
  52. package/dist/community/events/onCommunityCreated.d.ts.map +1 -1
  53. package/dist/community/events/onCommunityDeleted.d.ts +2 -2
  54. package/dist/community/events/onCommunityDeleted.d.ts.map +1 -1
  55. package/dist/community/events/onCommunityJoined.d.ts +3 -3
  56. package/dist/community/events/onCommunityJoined.d.ts.map +1 -1
  57. package/dist/community/events/onCommunityLeft.d.ts +3 -3
  58. package/dist/community/events/onCommunityLeft.d.ts.map +1 -1
  59. package/dist/community/events/onCommunityUpdated.d.ts +2 -2
  60. package/dist/community/events/onCommunityUpdated.d.ts.map +1 -1
  61. package/dist/community/events/onCommunityUserAdded.d.ts +17 -0
  62. package/dist/community/events/onCommunityUserAdded.d.ts.map +1 -0
  63. package/dist/community/events/onCommunityUserBanned.d.ts +17 -0
  64. package/dist/community/events/onCommunityUserBanned.d.ts.map +1 -0
  65. package/dist/community/events/onCommunityUserRemoved.d.ts +17 -0
  66. package/dist/community/events/onCommunityUserRemoved.d.ts.map +1 -0
  67. package/dist/community/events/onCommunityUserUnbanned.d.ts +17 -0
  68. package/dist/community/events/onCommunityUserUnbanned.d.ts.map +1 -0
  69. package/dist/community/events/utils.d.ts +3 -0
  70. package/dist/community/events/utils.d.ts.map +1 -0
  71. package/dist/community/observers/observeCommunity.d.ts +1 -1
  72. package/dist/community/observers/observeCommunity.d.ts.map +1 -1
  73. package/dist/core/cache/ingest.d.ts.map +1 -1
  74. package/dist/core/events.d.ts +4 -2
  75. package/dist/core/events.d.ts.map +1 -1
  76. package/dist/core/model/index.d.ts +1 -0
  77. package/dist/core/model/index.d.ts.map +1 -1
  78. package/dist/core/model/isMatch.d.ts +3 -0
  79. package/dist/core/model/isMatch.d.ts.map +1 -0
  80. package/dist/core/network.d.ts +11 -0
  81. package/dist/core/network.d.ts.map +1 -0
  82. package/dist/core/subscription.d.ts +14 -0
  83. package/dist/core/subscription.d.ts.map +1 -0
  84. package/dist/core/transports/http.d.ts +11 -0
  85. package/dist/core/transports/http.d.ts.map +1 -0
  86. package/dist/core/transports/index.d.ts +4 -0
  87. package/dist/core/transports/index.d.ts.map +1 -0
  88. package/dist/core/transports/mqtt.d.ts +17 -0
  89. package/dist/core/transports/mqtt.d.ts.map +1 -0
  90. package/dist/core/transports/utils.d.ts +13 -0
  91. package/dist/core/transports/utils.d.ts.map +1 -0
  92. package/dist/core/transports/ws.d.ts +27 -0
  93. package/dist/core/transports/ws.d.ts.map +1 -0
  94. package/dist/index.cjs.js +1208 -514
  95. package/dist/index.d.ts +1 -0
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.esm.js +1185 -515
  98. package/dist/index.umd.js +5 -3
  99. package/dist/post/api/deletePost.d.ts +1 -0
  100. package/dist/post/api/deletePost.d.ts.map +1 -1
  101. package/dist/post/events/index.d.ts +6 -0
  102. package/dist/post/events/index.d.ts.map +1 -1
  103. package/dist/post/events/onPostApproved.d.ts +17 -0
  104. package/dist/post/events/onPostApproved.d.ts.map +1 -0
  105. package/dist/post/events/onPostCreated.d.ts +1 -1
  106. package/dist/post/events/onPostCreated.d.ts.map +1 -1
  107. package/dist/post/events/onPostDeclined.d.ts +17 -0
  108. package/dist/post/events/onPostDeclined.d.ts.map +1 -0
  109. package/dist/post/events/onPostDeleted.d.ts +1 -1
  110. package/dist/post/events/onPostDeleted.d.ts.map +1 -1
  111. package/dist/post/events/onPostFlagged.d.ts +17 -0
  112. package/dist/post/events/onPostFlagged.d.ts.map +1 -0
  113. package/dist/post/events/onPostReactionAdded.d.ts +17 -0
  114. package/dist/post/events/onPostReactionAdded.d.ts.map +1 -0
  115. package/dist/post/events/onPostReactionRemoved.d.ts +17 -0
  116. package/dist/post/events/onPostReactionRemoved.d.ts.map +1 -0
  117. package/dist/post/events/onPostUnflagged.d.ts +17 -0
  118. package/dist/post/events/onPostUnflagged.d.ts.map +1 -0
  119. package/dist/post/events/onPostUpdated.d.ts +1 -1
  120. package/dist/post/events/onPostUpdated.d.ts.map +1 -1
  121. package/dist/post/events/utils.d.ts +2 -0
  122. package/dist/post/events/utils.d.ts.map +1 -0
  123. package/dist/post/observers/observePost.d.ts +1 -1
  124. package/dist/post/observers/observePost.d.ts.map +1 -1
  125. package/dist/post/observers/observePosts.d.ts +1 -1
  126. package/dist/post/observers/observePosts.d.ts.map +1 -1
  127. package/dist/reaction/events/onReactionAdded.d.ts +4 -2
  128. package/dist/reaction/events/onReactionAdded.d.ts.map +1 -1
  129. package/dist/reaction/events/onReactionRemoved.d.ts +4 -2
  130. package/dist/reaction/events/onReactionRemoved.d.ts.map +1 -1
  131. package/dist/reaction/utils/index.d.ts +1 -0
  132. package/dist/reaction/utils/index.d.ts.map +1 -1
  133. package/dist/reaction/utils/preparePayloadForCache.d.ts +3 -0
  134. package/dist/reaction/utils/preparePayloadForCache.d.ts.map +1 -0
  135. package/dist/report/api/createReport.d.ts.map +1 -1
  136. package/dist/report/api/deleteReport.d.ts.map +1 -1
  137. package/dist/user/events/index.d.ts +3 -0
  138. package/dist/user/events/index.d.ts.map +1 -1
  139. package/dist/user/events/onUserFlagCleared.d.ts +17 -0
  140. package/dist/user/events/onUserFlagCleared.d.ts.map +1 -0
  141. package/dist/user/events/onUserFlagged.d.ts +17 -0
  142. package/dist/user/events/onUserFlagged.d.ts.map +1 -0
  143. package/dist/user/events/onUserUnflagged.d.ts +17 -0
  144. package/dist/user/events/onUserUnflagged.d.ts.map +1 -0
  145. package/dist/user/events/onUserUpdated.d.ts +1 -1
  146. package/dist/user/events/onUserUpdated.d.ts.map +1 -1
  147. package/dist/user/events/utils.d.ts +2 -0
  148. package/dist/user/events/utils.d.ts.map +1 -0
  149. package/dist/user/observers/observeUser.d.ts +1 -1
  150. package/dist/user/observers/observeUser.d.ts.map +1 -1
  151. package/package.json +4 -1
  152. package/rollup.config.js +2 -2
  153. package/src/@types/core/events.ts +64 -23
  154. package/src/@types/core/transport.ts +14 -0
  155. package/src/@types/domains/client.ts +3 -0
  156. package/src/@types/domains/comment.ts +1 -0
  157. package/src/@types/domains/community.ts +1 -0
  158. package/src/@types/domains/group.ts +2 -2
  159. package/src/@types/domains/partials.ts +4 -0
  160. package/src/@types/domains/post.ts +1 -0
  161. package/src/@types/domains/user.ts +2 -0
  162. package/src/client/api/connectClient.ts +12 -2
  163. package/src/client/api/createClient.ts +7 -7
  164. package/src/client/api/disconnectClient.ts +5 -0
  165. package/src/client/api/getToken.ts +1 -1
  166. package/src/client/events/onConnectionError.ts +1 -1
  167. package/src/comment/api/createComment.ts +2 -2
  168. package/src/comment/api/deleteComment.ts +2 -2
  169. package/src/comment/api/updateComment.ts +1 -1
  170. package/src/comment/events/index.ts +6 -0
  171. package/src/comment/events/onCommentCreated.ts +4 -22
  172. package/src/comment/events/onCommentDeleted.ts +4 -22
  173. package/src/comment/events/onCommentFlagged.ts +21 -0
  174. package/src/comment/events/onCommentReactionAdded.ts +52 -0
  175. package/src/comment/events/onCommentReactionRemoved.ts +52 -0
  176. package/src/comment/events/onCommentUnflagged.ts +21 -0
  177. package/src/comment/events/onCommentUpdated.ts +4 -22
  178. package/src/comment/events/utils.ts +34 -0
  179. package/src/comment/observers/observeComment.ts +21 -7
  180. package/src/comment/observers/observeComments.ts +11 -3
  181. package/src/community/api/addCommunityMembers.ts +1 -1
  182. package/src/community/api/createCommunity.ts +1 -1
  183. package/src/community/api/deleteCommunity.ts +1 -1
  184. package/src/community/api/joinCommunity.ts +1 -1
  185. package/src/community/api/leaveCommunity.ts +1 -1
  186. package/src/community/api/removeCommunityMembers.ts +1 -1
  187. package/src/community/api/updateCommunity.ts +1 -1
  188. package/src/community/events/index.ts +5 -0
  189. package/src/community/events/onCommunityCreated.ts +5 -23
  190. package/src/community/events/onCommunityDeleted.ts +5 -23
  191. package/src/community/events/onCommunityJoined.ts +5 -23
  192. package/src/community/events/onCommunityLeft.ts +5 -23
  193. package/src/community/events/onCommunityUpdated.ts +5 -23
  194. package/src/community/events/onCommunityUserAdded.ts +19 -0
  195. package/src/community/events/onCommunityUserBanned.ts +19 -0
  196. package/src/community/events/onCommunityUserRemoved.ts +19 -0
  197. package/src/community/events/onCommunityUserUnbanned.ts +19 -0
  198. package/src/community/events/utils.ts +108 -0
  199. package/src/community/observers/observeCommunity.ts +23 -9
  200. package/src/core/cache/ingest.ts +19 -3
  201. package/src/core/events.ts +45 -4
  202. package/src/core/model/index.ts +1 -0
  203. package/src/core/model/isMatch.ts +12 -0
  204. package/src/core/network.ts +14 -0
  205. package/src/core/subscription.ts +75 -0
  206. package/src/core/transports/http.ts +63 -0
  207. package/src/core/transports/index.ts +3 -0
  208. package/src/core/transports/mqtt.ts +141 -0
  209. package/src/core/transports/utils.ts +25 -0
  210. package/src/core/transports/ws.ts +61 -0
  211. package/src/index.ts +1 -0
  212. package/src/post/api/createPost.ts +2 -2
  213. package/src/post/api/deletePost.ts +2 -2
  214. package/src/post/api/updatePost.ts +1 -1
  215. package/src/post/events/index.ts +9 -0
  216. package/src/post/events/onPostApproved.ts +19 -0
  217. package/src/post/events/onPostCreated.ts +4 -24
  218. package/src/post/events/onPostDeclined.ts +19 -0
  219. package/src/post/events/onPostDeleted.ts +4 -24
  220. package/src/post/events/onPostFlagged.ts +19 -0
  221. package/src/post/events/onPostReactionAdded.ts +50 -0
  222. package/src/post/events/onPostReactionRemoved.ts +50 -0
  223. package/src/post/events/onPostUnflagged.ts +19 -0
  224. package/src/post/events/onPostUpdated.ts +4 -24
  225. package/src/post/events/utils.ts +40 -0
  226. package/src/post/observers/observePost.ts +25 -7
  227. package/src/post/observers/observePosts.ts +12 -2
  228. package/src/reaction/events/onReactionAdded.ts +36 -15
  229. package/src/reaction/events/onReactionRemoved.ts +37 -14
  230. package/src/reaction/utils/dispatchReactable.ts +2 -2
  231. package/src/reaction/utils/index.ts +1 -0
  232. package/src/reaction/utils/preparePayloadForCache.ts +45 -0
  233. package/src/report/api/createReport.ts +5 -1
  234. package/src/report/api/deleteReport.ts +5 -1
  235. package/src/user/events/index.ts +4 -0
  236. package/src/user/events/onUserFlagCleared.ts +19 -0
  237. package/src/user/events/onUserFlagged.ts +19 -0
  238. package/src/user/events/onUserUnflagged.ts +19 -0
  239. package/src/user/events/onUserUpdated.ts +4 -24
  240. package/src/user/events/utils.ts +24 -0
  241. package/src/user/observers/observeUser.ts +11 -3
  242. package/dist/core/transports.d.ts +0 -49
  243. package/dist/core/transports.d.ts.map +0 -1
  244. package/src/core/transports.ts +0 -151
package/dist/index.umd.js CHANGED
@@ -1,5 +1,7 @@
1
- var Amity=function(e){"use strict";var t;const n=null!==(t="v0.0.1-beta.8-umd")?t:"__dev__";class r extends Error{constructor(e,t,n){super(`Amity SDK (${t}): ${e}`),this.code=t,this.level=n,this.type="ASC",this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}}class o extends r{constructor(e,t,n){super(e,t,n)}}class s extends r{constructor(e=8e5,t="fatal"){super("Unexpected error",e,t)}}class i extends r{constructor(e,t="SDK client is having connection issues"){super(`${t} (${e})`,"disconnected"===e?800211:800210,"error"),this.event=e}}let a=null;const c=()=>{if(!a)throw new r("There is no active client",8e5,"fatal");return a},l=e=>{a=e},u=(e,...t)=>{var n;const{cache:r}=c(),o=null==r?void 0:r[e];if(!r||!o)return;const s=null!==(n=o.read())&&void 0!==n?n:{};return(null==t?void 0:t.length)?t.map((t=>{const n=r.lookup[`${e}#${t}`];return s[n]})).filter(Boolean):Object.values(s)},p={user:({userId:e})=>e,file:({fileId:e})=>e,role:({roleId:e})=>e,channel:({channelId:e})=>e,channelUsers:({channelId:e,userId:t})=>`${e}#${t}`,message:({messageId:e})=>e,community:({communityId:e})=>e,communityUsers:({communityId:e,userId:t})=>`${e}#${t}`,post:({postId:e})=>e,comment:({commentId:e})=>e,stream:({streamId:e})=>e},d=e=>p[e],h={users:"user",files:"file",roles:"role",channels:"channel",channelUsers:"channelUsers",messages:"message",communities:"community",communityUsers:"communityUsers",posts:"post",postChildren:"post",comments:"comment",videoStreamings:"stream"},f=(e,...t)=>{const{cache:n}=c(),r=null==n?void 0:n[e];if(!n||!r)return;const o=t.filter(Boolean);if(!o.length)return;const s=Object.fromEntries(o.map((t=>{var r,o,s;const i=d(e)(t),a=null!==(r=(o=n.lookup)[s=`${e}#${i}`])&&void 0!==r?r:o[s]=t.localId;return[a,Object.assign(Object.assign({syncedAt:Date.now()},t),{localId:a})]})));r.write(s)},m=(e,t)=>{const{cache:n}=c(),r=null==n?void 0:n[e];if(!n||!r)return[];const o=d(e)(t),s=n.lookup[`${e}#${o}`];delete n.lookup[`${e}#${o}`],r.erase(s)},g={file:["fileId","attributes"],user:["userId","avatarFileId"],role:["roleId"],channel:["channelId","rateLimit"],channelUsers:["channelId","userId","membership"],message:["messageId"],community:["communityId","onlyAdminCanPost"],communityUsers:["userId","communityId","communityMembership"],post:["postId","feedId"],comment:["commentId","referenceId"],stream:["streamId"]},y=e=>{var t;return null===(t=Object.entries(g).find((([t,n])=>((e,t)=>{const n=Object.keys(e);return t.every((e=>n.includes(e)))})(e,n))))||void 0===t?void 0:t[0]},v=(e,t)=>{var n;const{cache:r,log:o}=c(),s=null!==(n=y(e))&&void 0!==n?n:y(t);if(!s)return void o("syncInCache","could not identify the models",{original:e,replacement:t});const i=null==r?void 0:r[s];r&&i&&(m(s,e),m(s,t),t.localId=e.localId,f(s,t))},C=(e={},t=Object.keys(e))=>{t.forEach((t=>{const n=h[t];n&&f(n,...e[t])}))},b=(e,t,n)=>{var r;const[o]=null!==(r=u(e,t))&&void 0!==r?r:[];if(!o)return;const s=n(o);return s&&f(e,Object.assign(Object.assign({},o),s)),s},w=(e,t)=>{const n=d(e)(t);b(e,n,(e=>Object.assign(Object.assign({},e),t)))},F=e=>Object.assign({lookup:{}},e),k="function"==typeof atob,A="function"==typeof btoa,x="function"==typeof Buffer,O="function"==typeof TextDecoder?new TextDecoder:void 0,S="function"==typeof TextEncoder?new TextEncoder:void 0,I=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],E=(e=>{let t={};return e.forEach(((e,n)=>t[e]=n)),t})(I),j=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,B=String.fromCharCode.bind(String),N="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),P=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),U=A?e=>btoa(e):x?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,n,r,o,s="";const i=e.length%3;for(let i=0;i<e.length;){if((n=e.charCodeAt(i++))>255||(r=e.charCodeAt(i++))>255||(o=e.charCodeAt(i++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,s+=I[t>>18&63]+I[t>>12&63]+I[t>>6&63]+I[63&t]}return i?s.slice(0,i-3)+"===".substring(i):s},R=x?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(B.apply(null,e.subarray(n,n+4096)));return U(t.join(""))},_=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?B(192|t>>>6)+B(128|63&t):B(224|t>>>12&15)+B(128|t>>>6&63)+B(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return B(240|t>>>18&7)+B(128|t>>>12&63)+B(128|t>>>6&63)+B(128|63&t)},D=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,T=x?e=>Buffer.from(e,"utf8").toString("base64"):S?e=>R(S.encode(e)):e=>U(e.replace(D,_)),M=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,$=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return B(55296+(t>>>10))+B(56320+(1023&t));case 3:return B((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return B((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},q=k?e=>atob(P(e)):x?e=>Buffer.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!j.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,n,r,o="";for(let s=0;s<e.length;)t=E[e.charAt(s++)]<<18|E[e.charAt(s++)]<<12|(n=E[e.charAt(s++)])<<6|(r=E[e.charAt(s++)]),o+=64===n?B(t>>16&255):64===r?B(t>>16&255,t>>8&255):B(t>>16&255,t>>8&255,255&t);return o},L=x?e=>N(Buffer.from(e,"base64")):e=>N(q(e),(e=>e.charCodeAt(0))),z=x?e=>Buffer.from(e,"base64").toString("utf8"):O?e=>O.decode(L(e)):e=>q(e).replace(M,$),H=e=>z(P(e.replace(/[-_]/g,(e=>"-"==e?"+":"/")))),J=e=>["skip","limit"].some((t=>t in e)),X=e=>["after","before","first","last"].some((t=>t in e)),K=e=>(null==e?void 0:e.hasOwnProperty("data"))&&(null==e?void 0:e.hasOwnProperty("nextPage"))&&(null==e?void 0:e.hasOwnProperty("prevPage")),W=(e,t)=>{var n;if(!e||!Object.keys(e).length)return;let r={};return"skiplimit"===t?r={skip:null!==(n=e.after)&&void 0!==n?n:0,limit:e.limit}:"afterbefore"===t&&(isNaN(null==e?void 0:e.before)?isNaN(null==e?void 0:e.after)?isNaN(null==e?void 0:e.limit)||(r={last:e.limit}):r={after:e.after,first:e.limit}:r={before:e.before,last:e.limit}),Object.keys(r).length?((e,t=!1)=>t?(e=>e.replace(/[+\/]/g,(e=>"+"==e?"-":"_")).replace(/=+$/m,""))(T(e)):T(e))(JSON.stringify(r)):void 0},V=e=>{if(!e)return null;const t=JSON.parse(H(e));if(J(t))return{after:t.skip,limit:t.limit};if(X(t)){if("before"in t)return{before:t.before,limit:t.last};if("after"in t)return{after:t.after,limit:t.first}}return null},Y=e=>"locally"in e,Z=e=>"optimistically"in e,G=e=>Y(e)||Z(e),Q=e=>null==e?void 0:e.hasOwnProperty("syncedAt"),ee=e=>Q(e)&&-1===(null==e?void 0:e.syncedAt),te=(e,t=0)=>{var n;return Date.now()-(null!==(n=null==e?void 0:e.syncedAt)&&void 0!==n?n:0)<=t},ne=(e,t=0)=>ee(e)||te(e,t),re=(e,...t)=>({func:e,args:t}),oe=(e,t=12e4)=>"cache_only"===e?{lifeSpan:1/0}:"server_only"===e?{lifeSpan:0}:{lifeSpan:t},se=e=>!e||(!(!K(e)||!se(e.data))||!Object.keys(e).length),ie=(e,t)=>!(!K(e)||!ie(e.data,t))||(!!ne(e,t.lifeSpan)||!!(Object.values(e).length>0&&Object.values(e).every((e=>ne(e,t.lifeSpan))))),ae=({func:e,args:t},n,r=oe("cache_then_server"))=>{if(!G(e)||0===r.lifeSpan)return null==n||n(ce(void 0,{origin:"server",loading:!0})),void e(...t).then((e=>{null==n||n(ce(e,{origin:"server",loading:!1}))})).catch((e=>{null==n||n(ce(void 0,{error:e,loading:!1}))}));const o=Z(e)?e.optimistically(...t):e.locally(...t);se(o)||null==n||n(ce(o,{origin:"local"})),o&&Y(e)&&ie(o,r)||(null==n||n(ce(o,{origin:"local",loading:!0})),e(...t).then((e=>{ee(o)&&v(o,e),null==n||n(ce(e,{origin:"server",loading:!1}))})).catch((e=>{null==n||n(ce(o,{error:e,loading:!1}))})))},ce=(e,t={})=>K(e)?Object.assign(Object.assign({},t),e):Object.assign(Object.assign({},t),{data:e});var le="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ue(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}var pe={},de={},he={};Object.defineProperty(he,"__esModule",{value:!0}),he.bytesToString=he.stringToBytes=he.NIL=he.X500=he.OID=he.URL=he.DNS=he.hexToByte=he.byteToHex=void 0;let fe=[],me={};for(var ge=0;ge<256;ge++)fe[ge]=(ge+256).toString(16).substr(1),me[fe[ge]]=ge;he.byteToHex=fe,he.hexToByte=me,he.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",he.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",he.OID="6ba7b812-9dad-11d1-80b4-00c04fd430c8",he.X500="6ba7b814-9dad-11d1-80b4-00c04fd430c8",he.NIL="00000000-0000-0000-0000-000000000000";he.stringToBytes=e=>{e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t};he.bytesToString=e=>{const t=new Uint8Array(e,0,e.byteLength);return String.fromCharCode.apply(null,Array.from(t))},Object.defineProperty(de,"__esModule",{value:!0}),de.parse=void 0;const ye=he;de.parse=(e,t,n)=>{let r=t&&n||0,o=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,(e=>(o<16&&t&&(t[r+o++]=ye.hexToByte[e]),"")));o<16;)t[r+o++]=0;return t};var ve={};Object.defineProperty(ve,"__esModule",{value:!0}),ve.unparse=void 0;const Ce=he;ve.unparse=(e,t)=>{let n=t||0,r=Ce.byteToHex;return r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]};var be={},we={};Object.defineProperty(we,"__esModule",{value:!0});we.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;var Fe=le&&le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(be,"__esModule",{value:!0}),be.validate=void 0;const ke=Fe(we);be.validate=e=>"string"==typeof e&&ke.default.test(e);var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.version=void 0;const xe=be;Ae.version=e=>{if(!xe.validate(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)};var Oe={},Se={};Object.defineProperty(Se,"__esModule",{value:!0}),Se.stringify=void 0;const Ie=be,Ee=[];for(let e=0;e<256;++e)Ee.push((e+256).toString(16).substr(1));Se.stringify=(e,t=0)=>{const n=(Ee[e[t+0]]+Ee[e[t+1]]+Ee[e[t+2]]+Ee[e[t+3]]+"-"+Ee[e[t+4]]+Ee[e[t+5]]+"-"+Ee[e[t+6]]+Ee[e[t+7]]+"-"+Ee[e[t+8]]+Ee[e[t+9]]+"-"+Ee[e[t+10]]+Ee[e[t+11]]+Ee[e[t+12]]+Ee[e[t+13]]+Ee[e[t+14]]+Ee[e[t+15]]).toLowerCase();if(!Ie.validate(n))throw TypeError("Stringified UUID is invalid");return n};var je={};Object.defineProperty(je,"__esModule",{value:!0}),je.rng=void 0;je.rng=()=>{let e=new Array(16);for(let t=0;t<16;t++)e[t]=255&256*Math.random()+0;return e},Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.v1=void 0;const Be=Se,Ne=je;let Pe,Ue,Re=0,_e=0;Oe.v1=(e,t,n=0)=>{let r=t&&n||0;const o=t||new Uint8Array(16);let s=e&&e.node?e.node:Pe,i=e&&e.clockseq?e.clockseq:Ue;if(null==s||null==i){const t=e&&e.random?e.random:e&&e.rng?e.rng():Ne.rng();null==s&&(s=Pe=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==i&&(i=Ue=16383&(t[6]<<8|t[7]))}let a=e&&e.msecs?e.msecs:Date.now(),c=e&&e.nsecs?e.nsecs:_e+1;const l=a-Re+(c-_e)/1e4;if(l<0&&e&&!e.clockseq&&(i=i+1&16383),(l<0||a>Re)&&e&&!e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Re=a,_e=c,Ue=i,a+=122192928e5;const u=(1e4*(268435455&a)+c)%4294967296;o[r++]=u>>>24&255,o[r++]=u>>>16&255,o[r++]=u>>>8&255,o[r++]=255&u;const p=a/4294967296*1e4&268435455;o[r++]=p>>>8&255,o[r++]=255&p,o[r++]=p>>>24&15|16,o[r++]=p>>>16&255,o[r++]=i>>>8|128,o[r++]=255&i;for(let e=0;e<6;++e)o[r+e]=s[e];return t||Be.stringify(o)};var De={};Object.defineProperty(De,"__esModule",{value:!0}),De.v4=void 0;const Te=ve,Me=je;De.v4=(e,t,n)=>{let r=t&&n||0,o=Me.rng();if(!e||e instanceof String||(e.random&&(o=e.random),e.rng&&(o=e.rng())),o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;s++)t[r+s]=o[s];return t||Te.unparse(o)};var $e={},qe={};Object.defineProperty(qe,"__esModule",{value:!0}),qe.v35=void 0;const Le=Se,ze=de,He=he;qe.v35=(e,t,n)=>(e,r,o,s=0)=>{if("string"==typeof e&&(e=He.stringToBytes(e)),"string"==typeof r&&(r=ze.parse(r)),r&&16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let i=new Uint8Array(16+e.length);if(i.set(r),i.set(e,r.length),i=He.stringToBytes(n(He.bytesToString(i))),i[6]=15&i[6]|t,i[8]=63&i[8]|128,o)for(let e=0;e<16;++e)o[s+e]=i[e];return o||Le.stringify(i)};var Je={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.any_hmac_sha1=e.b64_hmac_sha1=e.hex_hmac_sha1=e.any_sha1=e.b64_sha1=e.hex_sha1=void 0;let t=0,n="";e.hex_sha1=e=>s(r(c(e))),e.default=e.hex_sha1;e.b64_sha1=e=>i(r(c(e)));e.any_sha1=(e,t)=>a(r(c(e)),t);e.hex_hmac_sha1=(e,t)=>s(o(c(e),c(t)));e.b64_hmac_sha1=(e,t)=>i(o(c(e),c(t)));e.any_hmac_sha1=(e,t,n)=>a(o(c(e),c(t)),n);const r=e=>u(p(l(e),8*e.length)),o=(e,t)=>{let n=l(e);n.length>16&&(n=p(n,8*e.length));let r=Array(16),o=Array(16);for(var s=0;s<16;s++)r[s]=909522486^n[s],o[s]=1549556828^n[s];var i=p(r.concat(l(t)),512+8*t.length);return u(p(o.concat(i),672))},s=e=>{for(var n,r=t?"0123456789ABCDEF":"0123456789abcdef",o="",s=0;s<e.length;s++)n=e.charCodeAt(s),o+=r.charAt(n>>>4&15)+r.charAt(15&n);return o},i=e=>{for(var t="",r=e.length,o=0;o<r;o+=3)for(var s=e.charCodeAt(o)<<16|(o+1<r?e.charCodeAt(o+1)<<8:0)|(o+2<r?e.charCodeAt(o+2):0),i=0;i<4;i++)8*o+6*i>8*e.length?t+=n:t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(s>>>6*(3-i)&63);return t},a=(e,t)=>{var n,r,o,s,i=t.length,a=[],c=Array(Math.ceil(e.length/2));for(n=0;n<c.length;n++)c[n]=e.charCodeAt(2*n)<<8|e.charCodeAt(2*n+1);for(;c.length>0;){for(s=[],o=0,n=0;n<c.length;n++)o=(o<<16)+c[n],o-=(r=Math.floor(o/i))*i,(s.length>0||r>0)&&(s[s.length]=r);a[a.length]=o,c=s}var l="";for(n=a.length-1;n>=0;n--)l+=t.charAt(a[n]);var u=Math.ceil(8*e.length/(Math.log(t.length)/Math.log(2)));for(n=l.length;n<u;n++)l=t[0]+l;return l},c=e=>{for(var t,n,r="",o=-1;++o<e.length;)t=e.charCodeAt(o),n=o+1<e.length?e.charCodeAt(o+1):0,t>=55296&&t<=56319&&n>=56320&&n<=57343&&(t=65536+((1023&t)<<10)+(1023&n),o++),t<=127?r+=String.fromCharCode(t):t<=2047?r+=String.fromCharCode(192|t>>>6&31,128|63&t):t<=65535?r+=String.fromCharCode(224|t>>>12&15,128|t>>>6&63,128|63&t):t<=2097151&&(r+=String.fromCharCode(240|t>>>18&7,128|t>>>12&63,128|t>>>6&63,128|63&t));return r},l=e=>{for(var t=Array(e.length>>2),n=0;n<t.length;n++)t[n]=0;for(n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t},u=e=>{for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t},p=(e,t)=>{e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n=Array(80),r=1732584193,o=-271733879,s=-1732584194,i=271733878,a=-1009589776,c=0;c<e.length;c+=16){for(var l=r,u=o,p=s,g=i,y=a,v=0;v<80;v++){n[v]=v<16?e[c+v]:m(n[v-3]^n[v-8]^n[v-14]^n[v-16],1);let t=f(f(m(r,5),d(v,o,s,i)),f(f(a,n[v]),h(v)));a=i,i=s,s=m(o,30),o=r,r=t}r=f(r,l),o=f(o,u),s=f(s,p),i=f(i,g),a=f(a,y)}return[r,o,s,i,a]},d=(e,t,n,r)=>e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r,h=e=>e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514,f=(e,t)=>{var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},m=(e,t)=>e<<t|e>>>32-t}(Je);var Xe=le&&le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($e,"__esModule",{value:!0}),$e.v5=void 0;const Ke=qe,We=Xe(Je);$e.v5=Ke.v35("v5",80,We.default),Object.defineProperty(pe,"__esModule",{value:!0});const Ve=de,Ye=ve,Ze=be,Ge=Ae,Qe=Oe,et=De,tt=$e,nt=he;var rt=pe.default={parse:Ve.parse,unparse:Ye.unparse,validate:Ze.validate,version:Ge.version,v1:Qe.v1,v4:et.v4,v5:tt.v5,NIL:nt.NIL,DNS:nt.DNS,URL:nt.URL,OID:nt.OID,X500:nt.X500};const ot=()=>rt.v4().toString();var st={exports:{}},it=1e3,at=6e4,ct=60*at,lt=24*ct,ut=7*lt,pt=365.25*lt,dt=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*pt;case"weeks":case"week":case"w":return n*ut;case"days":case"day":case"d":return n*lt;case"hours":case"hour":case"hrs":case"hr":case"h":return n*ct;case"minutes":case"minute":case"mins":case"min":case"m":return n*at;case"seconds":case"second":case"secs":case"sec":case"s":return n*it;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=lt)return ht(e,t,lt,"day");if(t>=ct)return ht(e,t,ct,"hour");if(t>=at)return ht(e,t,at,"minute");if(t>=it)return ht(e,t,it,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=lt)return Math.round(e/lt)+"d";if(t>=ct)return Math.round(e/ct)+"h";if(t>=at)return Math.round(e/at)+"m";if(t>=it)return Math.round(e/it)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function ht(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}var ft=function(e){function t(e){let r,o,s,i=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),s=o-(r||o);n.diff=s,n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,o)=>{if("%%"===r)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];r=s.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=dt,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(o=r))})),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=ft(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(st,st.exports);var mt=st.exports;var gt={exports:{}},yt=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},vt=yt,Ct=Object.prototype.toString;function bt(e){return"[object Array]"===Ct.call(e)}function wt(e){return void 0===e}function Ft(e){return null!==e&&"object"==typeof e}function kt(e){if("[object Object]"!==Ct.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function At(e){return"[object Function]"===Ct.call(e)}function xt(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),bt(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var Ot={isArray:bt,isArrayBuffer:function(e){return"[object ArrayBuffer]"===Ct.call(e)},isBuffer:function(e){return null!==e&&!wt(e)&&null!==e.constructor&&!wt(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Ft,isPlainObject:kt,isUndefined:wt,isDate:function(e){return"[object Date]"===Ct.call(e)},isFile:function(e){return"[object File]"===Ct.call(e)},isBlob:function(e){return"[object Blob]"===Ct.call(e)},isFunction:At,isStream:function(e){return Ft(e)&&At(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:xt,merge:function e(){var t={};function n(n,r){kt(t[r])&&kt(n)?t[r]=e(t[r],n):kt(n)?t[r]=e({},n):bt(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)xt(arguments[r],n);return t},extend:function(e,t,n){return xt(t,(function(t,r){e[r]=n&&"function"==typeof t?vt(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}},St=Ot;function It(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Et=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(St.isURLSearchParams(t))r=t.toString();else{var o=[];St.forEach(t,(function(e,t){null!=e&&(St.isArray(e)?t+="[]":e=[e],St.forEach(e,(function(e){St.isDate(e)?e=e.toISOString():St.isObject(e)&&(e=JSON.stringify(e)),o.push(It(t)+"="+It(e))})))})),r=o.join("&")}if(r){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e},jt=Ot;function Bt(){this.handlers=[]}Bt.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},Bt.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},Bt.prototype.forEach=function(e){jt.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var Nt=Bt,Pt=Ot,Ut=function(e){return!(!e||!e.__CANCEL__)},Rt=Ot,_t=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},Dt=function(e,t,n,r,o){var s=new Error(e);return _t(s,t,n,r,o)},Tt=Dt,Mt=Ot,$t=Mt.isStandardBrowserEnv()?{write:function(e,t,n,r,o,s){var i=[];i.push(e+"="+encodeURIComponent(t)),Mt.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),Mt.isString(r)&&i.push("path="+r),Mt.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},qt=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},Lt=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e},zt=Ot,Ht=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],Jt=Ot,Xt=Jt.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=Jt.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},Kt=Ot,Wt=function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(Tt("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)},Vt=$t,Yt=Et,Zt=function(e,t){return e&&!qt(t)?Lt(e,t):t},Gt=function(e){var t,n,r,o={};return e?(zt.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=zt.trim(e.substr(0,r)).toLowerCase(),n=zt.trim(e.substr(r+1)),t){if(o[t]&&Ht.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o},Qt=Xt,en=Dt,tn=function(e){return new Promise((function(t,n){var r=e.data,o=e.headers;Kt.isFormData(r)&&delete o["Content-Type"];var s=new XMLHttpRequest;if(e.auth){var i=e.auth.username||"",a=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(i+":"+a)}var c=Zt(e.baseURL,e.url);if(s.open(e.method.toUpperCase(),Yt(c,e.params,e.paramsSerializer),!0),s.timeout=e.timeout,s.onreadystatechange=function(){if(s&&4===s.readyState&&(0!==s.status||s.responseURL&&0===s.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in s?Gt(s.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?s.response:s.responseText,status:s.status,statusText:s.statusText,headers:r,config:e,request:s};Wt(t,n,o),s=null}},s.onabort=function(){s&&(n(en("Request aborted",e,"ECONNABORTED",s)),s=null)},s.onerror=function(){n(en("Network Error",e,null,s)),s=null},s.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(en(t,e,"ECONNABORTED",s)),s=null},Kt.isStandardBrowserEnv()){var l=(e.withCredentials||Qt(c))&&e.xsrfCookieName?Vt.read(e.xsrfCookieName):void 0;l&&(o[e.xsrfHeaderName]=l)}if("setRequestHeader"in s&&Kt.forEach(o,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete o[t]:s.setRequestHeader(t,e)})),Kt.isUndefined(e.withCredentials)||(s.withCredentials=!!e.withCredentials),e.responseType)try{s.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&s.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&s.upload&&s.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){s&&(s.abort(),n(e),s=null)})),r||(r=null),s.send(r)}))},nn=Ot,rn=function(e,t){Rt.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},on={"Content-Type":"application/x-www-form-urlencoded"};function sn(e,t){!nn.isUndefined(e)&&nn.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var an,cn={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(an=tn),an),transformRequest:[function(e,t){return rn(t,"Accept"),rn(t,"Content-Type"),nn.isFormData(e)||nn.isArrayBuffer(e)||nn.isBuffer(e)||nn.isStream(e)||nn.isFile(e)||nn.isBlob(e)?e:nn.isArrayBufferView(e)?e.buffer:nn.isURLSearchParams(e)?(sn(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):nn.isObject(e)?(sn(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};cn.headers={common:{Accept:"application/json, text/plain, */*"}},nn.forEach(["delete","get","head"],(function(e){cn.headers[e]={}})),nn.forEach(["post","put","patch"],(function(e){cn.headers[e]=nn.merge(on)}));var ln=cn,un=Ot,pn=function(e,t,n){return Pt.forEach(n,(function(n){e=n(e,t)})),e},dn=Ut,hn=ln;function fn(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var mn=Ot,gn=function(e,t){t=t||{};var n={},r=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function a(e,t){return mn.isPlainObject(e)&&mn.isPlainObject(t)?mn.merge(e,t):mn.isPlainObject(t)?mn.merge({},t):mn.isArray(t)?t.slice():t}function c(r){mn.isUndefined(t[r])?mn.isUndefined(e[r])||(n[r]=a(void 0,e[r])):n[r]=a(e[r],t[r])}mn.forEach(r,(function(e){mn.isUndefined(t[e])||(n[e]=a(void 0,t[e]))})),mn.forEach(o,c),mn.forEach(s,(function(r){mn.isUndefined(t[r])?mn.isUndefined(e[r])||(n[r]=a(void 0,e[r])):n[r]=a(void 0,t[r])})),mn.forEach(i,(function(r){r in t?n[r]=a(e[r],t[r]):r in e&&(n[r]=a(void 0,e[r]))}));var l=r.concat(o).concat(s).concat(i),u=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return mn.forEach(u,c),n},yn=Ot,vn=Et,Cn=Nt,bn=function(e){return fn(e),e.headers=e.headers||{},e.data=pn(e.data,e.headers,e.transformRequest),e.headers=un.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),un.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||hn.adapter)(e).then((function(t){return fn(e),t.data=pn(t.data,t.headers,e.transformResponse),t}),(function(t){return dn(t)||(fn(e),t&&t.response&&(t.response.data=pn(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},wn=gn;function Fn(e){this.defaults=e,this.interceptors={request:new Cn,response:new Cn}}Fn.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=wn(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[bn,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},Fn.prototype.getUri=function(e){return e=wn(this.defaults,e),vn(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},yn.forEach(["delete","get","head","options"],(function(e){Fn.prototype[e]=function(t,n){return this.request(wn(n||{},{method:e,url:t,data:(n||{}).data}))}})),yn.forEach(["post","put","patch"],(function(e){Fn.prototype[e]=function(t,n,r){return this.request(wn(r||{},{method:e,url:t,data:n}))}}));var kn=Fn;function An(e){this.message=e}An.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},An.prototype.__CANCEL__=!0;var xn=An,On=xn;function Sn(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new On(e),t(n.reason))}))}Sn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Sn.source=function(){var e;return{token:new Sn((function(t){e=t})),cancel:e}};var In=Sn,En=Ot,jn=yt,Bn=kn,Nn=gn;function Pn(e){var t=new Bn(e),n=jn(Bn.prototype.request,t);return En.extend(n,Bn.prototype,t),En.extend(n,t),n}var Un=Pn(ln);Un.Axios=Bn,Un.create=function(e){return Pn(Nn(Un.defaults,e))},Un.Cancel=xn,Un.CancelToken=In,Un.isCancel=Ut,Un.all=function(e){return Promise.all(e)},Un.spread=function(e){return function(t){return e.apply(null,t)}},Un.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError},gt.exports=Un,gt.exports.default=Un;var Rn=gt.exports,_n={exports:{}};_n.exports=Tn;var Dn=_n.exports.HttpsAgent=Tn;function Tn(){}var Mn=_n.exports,$n={exports:{}},qn=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Ln=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],zn=function(e){var t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));for(var o=qn.exec(e||""),s={},i=14;i--;)s[Ln[i]]=o[i]||"";return-1!=n&&-1!=r&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s},Hn={exports:{}},Jn={exports:{}},Xn=1e3,Kn=60*Xn,Wn=60*Kn,Vn=24*Wn,Yn=365.25*Vn,Zn=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Yn;case"days":case"day":case"d":return n*Vn;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Wn;case"minutes":case"minute":case"mins":case"min":case"m":return n*Kn;case"seconds":case"second":case"secs":case"sec":case"s":return n*Xn;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&!1===isNaN(e))return t.long?function(e){return Gn(e,Vn,"day")||Gn(e,Wn,"hour")||Gn(e,Kn,"minute")||Gn(e,Xn,"second")||e+" ms"}(e):function(e){if(e>=Vn)return Math.round(e/Vn)+"d";if(e>=Wn)return Math.round(e/Wn)+"h";if(e>=Kn)return Math.round(e/Kn)+"m";if(e>=Xn)return Math.round(e/Xn)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Gn(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}!function(e,t){function n(e){var n;function o(){if(o.enabled){var e=o,r=+new Date,s=r-(n||r);e.diff=s,e.prev=n,e.curr=r,n=r;for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];i[0]=t.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var c=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;c++;var o=t.formatters[r];if("function"==typeof o){var s=i[c];n=o.call(e,s),i.splice(c,1),c--}return n})),t.formatArgs.call(e,i);var l=o.log||t.log||console.log.bind(console);l.apply(e,i)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),o.destroy=r,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var s=t.instances[n];s.enabled=t.enabled(s.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=Zn,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Jn,Jn.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Jn.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(o++,"%c"===e&&(s=o))})),e.splice(s,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(Hn,Hn.exports);var Qn=zn,er=Hn.exports("socket.io-client:url"),tr=function(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(er("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),er("parse %s",e),n=Qn(e));n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443"));n.path=n.path||"/";var r=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port,n.href=n.protocol+"://"+r+(t&&t.port===n.port?"":":"+n.port),n};var nr={},rr={exports:{}},or={exports:{}};!function(e,t){function n(e){var n;function o(){if(o.enabled){var e=o,r=+new Date,s=r-(n||r);e.diff=s,e.prev=n,e.curr=r,n=r;for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];i[0]=t.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var c=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;c++;var o=t.formatters[r];if("function"==typeof o){var s=i[c];n=o.call(e,s),i.splice(c,1),c--}return n})),t.formatArgs.call(e,i);var l=o.log||t.log||console.log.bind(console);l.apply(e,i)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),o.destroy=r,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var s=t.instances[n];s.enabled=t.enabled(s.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=Zn,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(or,or.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=or.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(o++,"%c"===e&&(s=o))})),e.splice(s,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(rr,rr.exports);var sr={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(sr);var ir={},ar={}.toString,cr=Array.isArray||function(e){return"[object Array]"==ar.call(e)},lr=function(e){return ur&&Buffer.isBuffer(e)||pr&&(e instanceof ArrayBuffer||function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer}(e))},ur="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,pr="function"==typeof ArrayBuffer;var dr=cr,hr=lr,fr=Object.prototype.toString,mr="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===fr.call(Blob),gr="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===fr.call(File);function yr(e,t){if(!e)return e;if(hr(e)){var n={_placeholder:!0,num:t.length};return t.push(e),n}if(dr(e)){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=yr(e[o],t);return r}if("object"==typeof e&&!(e instanceof Date)){r={};for(var s in e)r[s]=yr(e[s],t);return r}return e}function vr(e,t){if(!e)return e;if(e&&e._placeholder)return t[e.num];if(dr(e))for(var n=0;n<e.length;n++)e[n]=vr(e[n],t);else if("object"==typeof e)for(var r in e)e[r]=vr(e[r],t);return e}ir.deconstructPacket=function(e){var t=[],n=e.data,r=e;return r.data=yr(n,t),r.attachments=t.length,{packet:r,buffers:t}},ir.reconstructPacket=function(e,t){return e.data=vr(e.data,t),e.attachments=void 0,e},ir.removeBlobs=function(e,t){var n=0,r=e;!function e(o,s,i){if(!o)return o;if(mr&&o instanceof Blob||gr&&o instanceof File){n++;var a=new FileReader;a.onload=function(){i?i[s]=this.result:r=this.result,--n||t(r)},a.readAsArrayBuffer(o)}else if(dr(o))for(var c=0;c<o.length;c++)e(o[c],c,o);else if("object"==typeof o&&!hr(o))for(var l in o)e(o[l],l,o)}(r),n||t(r)},function(e){var t=rr.exports("socket.io-parser"),n=sr.exports,r=ir,o=cr,s=lr;function i(){}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=i,e.Decoder=l;var a=e.ERROR+'"encode error"';function c(n){var r=""+n.type;if(e.BINARY_EVENT!==n.type&&e.BINARY_ACK!==n.type||(r+=n.attachments+"-"),n.nsp&&"/"!==n.nsp&&(r+=n.nsp+","),null!=n.id&&(r+=n.id),null!=n.data){var o=function(e){try{return JSON.stringify(e)}catch(e){return!1}}(n.data);if(!1===o)return a;r+=o}return t("encoded %j as %s",n,r),r}function l(){this.reconstructor=null}function u(e){this.reconPack=e,this.buffers=[]}function p(t){return{type:e.ERROR,data:"parser error: "+t}}i.prototype.encode=function(n,o){(t("encoding packet %j",n),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type)?function(e,t){function n(e){var n=r.deconstructPacket(e),o=c(n.packet),s=n.buffers;s.unshift(o),t(s)}r.removeBlobs(e,n)}(n,o):o([c(n)])},n(l.prototype),l.prototype.add=function(n){var r;if("string"==typeof n)r=function(n){var r=0,s={type:Number(n.charAt(0))};if(null==e.types[s.type])return p("unknown packet type "+s.type);if(e.BINARY_EVENT===s.type||e.BINARY_ACK===s.type){for(var i=r+1;"-"!==n.charAt(++r)&&r!=n.length;);var a=n.substring(i,r);if(a!=Number(a)||"-"!==n.charAt(r))throw new Error("Illegal attachments");s.attachments=Number(a)}if("/"===n.charAt(r+1)){for(i=r+1;++r;){if(","===(l=n.charAt(r)))break;if(r===n.length)break}s.nsp=n.substring(i,r)}else s.nsp="/";var c=n.charAt(r+1);if(""!==c&&Number(c)==c){for(i=r+1;++r;){var l;if(null==(l=n.charAt(r))||Number(l)!=l){--r;break}if(r===n.length)break}s.id=Number(n.substring(i,r+1))}if(n.charAt(++r)){var u=function(e){try{return JSON.parse(e)}catch(e){return!1}}(n.substr(r));if(!(!1!==u&&(s.type===e.ERROR||o(u))))return p("invalid payload");s.data=u}return t("decoded %s as %j",n,s),s}(n),e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type?(this.reconstructor=new u(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!s(n)&&!n.base64)throw new Error("Unknown type: "+n);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(r=this.reconstructor.takeBinaryData(n))&&(this.reconstructor=null,this.emit("decoded",r))}},l.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},u.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=r.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},u.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}}(nr);var Cr={exports:{}},br={},wr={exports:{}};try{wr.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){wr.exports=!1}var Fr=wr.exports,kr=function(e){var t=e.xdomain,n=e.xscheme,r=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Fr))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!n&&r)return new XDomainRequest}catch(e){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}},Ar={exports:{}},xr={},Or=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t},Sr={}.toString,Ir=Array.isArray||function(e){return"[object Array]"==Sr.call(e)},Er=Object.prototype.toString,jr="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Er.call(Blob),Br="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Er.call(File),Nr=function e(t){if(!t||"object"!=typeof t)return!1;if(Ir(t)){for(var n=0,r=t.length;n<r;n++)if(e(t[n]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(t)||"function"==typeof ArrayBuffer&&t instanceof ArrayBuffer||jr&&t instanceof Blob||Br&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return e(t.toJSON(),!0);for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&e(t[o]))return!0;return!1};var Pr=function(e,t,n){var r=e.byteLength;if(t=t||0,n=n||r,e.slice)return e.slice(t,n);if(t<0&&(t+=r),n<0&&(n+=r),n>r&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(e),s=new Uint8Array(n-t),i=t,a=0;i<n;i++,a++)s[a]=o[i];return s.buffer},Ur=function(e,t,n){var r=!1;return n=n||Rr,o.count=e,0===e?t():o;function o(e,s){if(o.count<=0)throw new Error("after called too many times");--o.count,e?(r=!0,t(e),t=n):0!==o.count||r||t(null,s)}};function Rr(){}
2
- /*! https://mths.be/utf8js v2.1.2 by @mathias */var _r,Dr,Tr,Mr=String.fromCharCode;function $r(e){for(var t,n,r=[],o=0,s=e.length;o<s;)(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<s?56320==(64512&(n=e.charCodeAt(o++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),o--):r.push(t);return r}function qr(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function Lr(e,t){return Mr(e>>t&63|128)}function zr(e,t){if(0==(4294967168&e))return Mr(e);var n="";return 0==(4294965248&e)?n=Mr(e>>6&31|192):0==(4294901760&e)?(qr(e,t)||(e=65533),n=Mr(e>>12&15|224),n+=Lr(e,6)):0==(4292870144&e)&&(n=Mr(e>>18&7|240),n+=Lr(e,12),n+=Lr(e,6)),n+=Mr(63&e|128)}function Hr(){if(Tr>=Dr)throw Error("Invalid byte index");var e=255&_r[Tr];if(Tr++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function Jr(e){var t,n;if(Tr>Dr)throw Error("Invalid byte index");if(Tr==Dr)return!1;if(t=255&_r[Tr],Tr++,0==(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|Hr())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|Hr()<<6|Hr())>=2048)return qr(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|Hr()<<12|Hr()<<6|Hr())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var Xr={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,r=$r(e),o=r.length,s=-1,i="";++s<o;)i+=zr(r[s],n);return i},decode:function(e,t){var n=!1!==(t=t||{}).strict;_r=$r(e),Dr=_r.length,Tr=0;for(var r,o=[];!1!==(r=Jr(n));)o.push(r);return function(e){for(var t,n=e.length,r=-1,o="";++r<n;)(t=e[r])>65535&&(o+=Mr((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=Mr(t);return o}(o)}},Kr={};!function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new Uint8Array(256),n=0;n<e.length;n++)t[e.charCodeAt(n)]=n;Kr.encode=function(t){var n,r=new Uint8Array(t),o=r.length,s="";for(n=0;n<o;n+=3)s+=e[r[n]>>2],s+=e[(3&r[n])<<4|r[n+1]>>4],s+=e[(15&r[n+1])<<2|r[n+2]>>6],s+=e[63&r[n+2]];return o%3==2?s=s.substring(0,s.length-1)+"=":o%3==1&&(s=s.substring(0,s.length-2)+"=="),s},Kr.decode=function(e){var n,r,o,s,i,a=.75*e.length,c=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var u=new ArrayBuffer(a),p=new Uint8Array(u);for(n=0;n<c;n+=4)r=t[e.charCodeAt(n)],o=t[e.charCodeAt(n+1)],s=t[e.charCodeAt(n+2)],i=t[e.charCodeAt(n+3)],p[l++]=r<<2|o>>4,p[l++]=(15&o)<<4|s>>2,p[l++]=(3&s)<<6|63&i;return u}}();var Wr=void 0!==Wr?Wr:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,Vr=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),Yr=Vr&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),Zr=Wr&&Wr.prototype.append&&Wr.prototype.getBlob;function Gr(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e}))}function Qr(e,t){t=t||{};var n=new Wr;return Gr(e).forEach((function(e){n.append(e)})),t.type?n.getBlob(t.type):n.getBlob()}function eo(e,t){return new Blob(Gr(e),t||{})}"undefined"!=typeof Blob&&(Qr.prototype=Blob.prototype,eo.prototype=Blob.prototype);var to=Vr?Yr?Blob:eo:Zr?Qr:void 0;!function(e){var t,n=Or,r=Nr,o=Pr,s=Ur,i=Xr;"undefined"!=typeof ArrayBuffer&&(t=Kr);var a="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),c="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),l=a||c;e.protocol=3;var u=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},p=n(u),d={type:"error",data:"parser error"},h=to;function f(e,t,n){for(var r=new Array(e.length),o=s(e.length,n),i=function(e,n,o){t(n,(function(t,n){r[e]=n,o(t,r)}))},a=0;a<e.length;a++)i(a,e[a],o)}e.encodePacket=function(t,n,r,o){"function"==typeof n&&(o=n,n=!1),"function"==typeof r&&(o=r,r=null);var s=void 0===t.data?void 0:t.data.buffer||t.data;if("undefined"!=typeof ArrayBuffer&&s instanceof ArrayBuffer)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=t.data,s=new Uint8Array(o),i=new Uint8Array(1+o.byteLength);i[0]=u[t.type];for(var a=0;a<s.length;a++)i[a+1]=s[a];return r(i.buffer)}(t,n,o);if(void 0!==h&&s instanceof h)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);if(l)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=new FileReader;return o.onload=function(){e.encodePacket({type:t.type,data:o.result},n,!0,r)},o.readAsArrayBuffer(t.data)}(t,n,r);var o=new Uint8Array(1);o[0]=u[t.type];var s=new h([o.buffer,t.data]);return r(s)}(t,n,o);if(s&&s.base64)return function(t,n){var r="b"+e.packets[t.type]+t.data.data;return n(r)}(t,o);var a=u[t.type];return void 0!==t.data&&(a+=r?i.encode(String(t.data),{strict:!1}):String(t.data)),o(""+a)},e.encodeBase64Packet=function(t,n){var r,o="b"+e.packets[t.type];if(void 0!==h&&t.data instanceof h){var s=new FileReader;return s.onload=function(){var e=s.result.split(",")[1];n(o+e)},s.readAsDataURL(t.data)}try{r=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(e){for(var i=new Uint8Array(t.data),a=new Array(i.length),c=0;c<i.length;c++)a[c]=i[c];r=String.fromCharCode.apply(null,a)}return o+=btoa(r),n(o)},e.decodePacket=function(t,n,r){if(void 0===t)return d;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),n);if(r&&!1===(t=function(e){try{e=i.decode(e,{strict:!1})}catch(e){return!1}return e}(t)))return d;var s=t.charAt(0);return Number(s)==s&&p[s]?t.length>1?{type:p[s],data:t.substring(1)}:{type:p[s]}:d}s=new Uint8Array(t)[0];var a=o(t,1);return h&&"blob"===n&&(a=new h([a])),{type:p[s],data:a}},e.decodeBase64Packet=function(e,n){var r=p[e.charAt(0)];if(!t)return{type:r,data:{base64:!0,data:e.substr(1)}};var o=t.decode(e.substr(1));return"blob"===n&&h&&(o=new h([o])),{type:r,data:o}},e.encodePayload=function(t,n,o){"function"==typeof n&&(o=n,n=null);var s=r(t);if(n&&s)return h&&!l?e.encodePayloadAsBlob(t,o):e.encodePayloadAsArrayBuffer(t,o);if(!t.length)return o("0:");f(t,(function(t,r){e.encodePacket(t,!!s&&n,!1,(function(e){r(null,function(e){return e.length+":"+e}(e))}))}),(function(e,t){return o(t.join(""))}))},e.decodePayload=function(t,n,r){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,r);var o;if("function"==typeof n&&(r=n,n=null),""===t)return r(d,0,1);for(var s,i,a="",c=0,l=t.length;c<l;c++){var u=t.charAt(c);if(":"===u){if(""===a||a!=(s=Number(a)))return r(d,0,1);if(a!=(i=t.substr(c+1,s)).length)return r(d,0,1);if(i.length){if(o=e.decodePacket(i,n,!1),d.type===o.type&&d.data===o.data)return r(d,0,1);if(!1===r(o,c+s,l))return}c+=s,a=""}else a+=u}return""!==a?r(d,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,n){if(!t.length)return n(new ArrayBuffer(0));f(t,(function(t,n){e.encodePacket(t,!0,!0,(function(e){return n(null,e)}))}),(function(e,t){var r=t.reduce((function(e,t){var n;return e+(n="string"==typeof t?t.length:t.byteLength).toString().length+n+2}),0),o=new Uint8Array(r),s=0;return t.forEach((function(e){var t="string"==typeof e,n=e;if(t){for(var r=new Uint8Array(e.length),i=0;i<e.length;i++)r[i]=e.charCodeAt(i);n=r.buffer}o[s++]=t?0:1;var a=n.byteLength.toString();for(i=0;i<a.length;i++)o[s++]=parseInt(a[i]);o[s++]=255;for(r=new Uint8Array(n),i=0;i<r.length;i++)o[s++]=r[i]})),n(o.buffer)}))},e.encodePayloadAsBlob=function(t,n){f(t,(function(t,n){e.encodePacket(t,!0,!0,(function(e){var t=new Uint8Array(1);if(t[0]=1,"string"==typeof e){for(var r=new Uint8Array(e.length),o=0;o<e.length;o++)r[o]=e.charCodeAt(o);e=r.buffer,t[0]=0}var s=(e instanceof ArrayBuffer?e.byteLength:e.size).toString(),i=new Uint8Array(s.length+1);for(o=0;o<s.length;o++)i[o]=parseInt(s[o]);if(i[s.length]=255,h){var a=new h([t.buffer,i.buffer,e]);n(null,a)}}))}),(function(e,t){return n(new h(t))}))},e.decodePayloadAsBinary=function(t,n,r){"function"==typeof n&&(r=n,n=null);for(var s=t,i=[];s.byteLength>0;){for(var a=new Uint8Array(s),c=0===a[0],l="",u=1;255!==a[u];u++){if(l.length>310)return r(d,0,1);l+=a[u]}s=o(s,2+l.length),l=parseInt(l);var p=o(s,0,l);if(c)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(e){var h=new Uint8Array(p);p="";for(u=0;u<h.length;u++)p+=String.fromCharCode(h[u])}i.push(p),s=o(s,l)}var f=i.length;i.forEach((function(t,o){r(e.decodePacket(t,n,!0),o,f)}))}}(xr);var no={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t);return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(no);var ro=xr,oo=so;function so(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}(0,no.exports)(so.prototype),so.prototype.onError=function(e,t){var n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},so.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},so.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},so.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},so.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},so.prototype.onData=function(e){var t=ro.decodePacket(e,this.socket.binaryType);this.onPacket(t)},so.prototype.onPacket=function(e){this.emit("packet",e)},so.prototype.onClose=function(){this.readyState="closed",this.emit("close")};var io,ao={encode:function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},decode:function(e){for(var t={},n=e.split("&"),r=0,o=n.length;r<o;r++){var s=n[r].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}},co=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},lo="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),uo={},po=0,ho=0;function fo(e){var t="";do{t=lo[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function mo(){var e=fo(+new Date);return e!==io?(po=0,io=e):e+"."+fo(po++)}for(;ho<64;ho++)uo[lo[ho]]=ho;mo.encode=fo,mo.decode=function(e){var t=0;for(ho=0;ho<e.length;ho++)t=64*t+uo[e.charAt(ho)];return t};var go=mo,yo={exports:{}},vo={exports:{}};!function(e,t){function n(e){var n;function o(){if(o.enabled){var e=o,r=+new Date,s=r-(n||r);e.diff=s,e.prev=n,e.curr=r,n=r;for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];i[0]=t.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var c=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;c++;var o=t.formatters[r];if("function"==typeof o){var s=i[c];n=o.call(e,s),i.splice(c,1),c--}return n})),t.formatArgs.call(e,i);var l=o.log||t.log||console.log.bind(console);l.apply(e,i)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),o.destroy=r,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var s=t.instances[n];s.enabled=t.enabled(s.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=Zn,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(vo,vo.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=vo.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(o++,"%c"===e&&(s=o))})),e.splice(s,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(yo,yo.exports);var Co=oo,bo=ao,wo=xr,Fo=co,ko=go,Ao=yo.exports("engine.io-client:polling"),xo=So,Oo=null!=new kr({xdomain:!1}).responseType;function So(e){var t=e&&e.forceBase64;Oo&&!t||(this.supportsBinary=!1),Co.call(this,e)}Fo(So,Co),So.prototype.name="polling",So.prototype.doOpen=function(){this.poll()},So.prototype.pause=function(e){var t=this;function n(){Ao("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(Ao("we are currently polling - waiting to pause"),r++,this.once("pollComplete",(function(){Ao("pre-pause polling complete"),--r||n()}))),this.writable||(Ao("we are currently writing - waiting to pause"),r++,this.once("drain",(function(){Ao("pre-pause writing complete"),--r||n()})))}else n()},So.prototype.poll=function(){Ao("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},So.prototype.onData=function(e){var t=this;Ao("polling got data %s",e);wo.decodePayload(e,this.socket.binaryType,(function(e,n,r){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():Ao('ignoring poll - transport state "%s"',this.readyState))},So.prototype.doClose=function(){var e=this;function t(){Ao("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(Ao("transport open - closing"),t()):(Ao("transport not open - deferring close"),this.once("open",t))},So.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};wo.encodePayload(e,this.supportsBinary,(function(e){t.doWrite(e,n)}))},So.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=ko()),this.supportsBinary||e.sid||(e.b64=1),e=bo.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e};var Io=kr,Eo=xo,jo=no.exports,Bo=co,No=yo.exports("engine.io-client:polling-xhr");function Po(){}function Uo(e){if(Eo.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,"undefined"!=typeof location){var t="https:"===location.protocol,n=location.port;n||(n=t?443:80),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==t}}function Ro(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}if(Ar.exports=Uo,Ar.exports.Request=Ro,Bo(Uo,Eo),Uo.prototype.supportsBinary=!0,Uo.prototype.request=function(e){return(e=e||{}).uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new Ro(e)},Uo.prototype.doWrite=function(e,t){var n="string"!=typeof e&&void 0!==e,r=this.request({method:"POST",data:e,isBinary:n}),o=this;r.on("success",t),r.on("error",(function(e){o.onError("xhr post error",e)})),this.sendXhr=r},Uo.prototype.doPoll=function(){No("xhr poll");var e=this.request(),t=this;e.on("data",(function(e){t.onData(e)})),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e},jo(Ro.prototype),Ro.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var t=this.xhr=new Io(e),n=this;try{No("xhr open %s: %s",this.method,this.uri),t.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var r in t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(r)&&t.setRequestHeader(r,this.extraHeaders[r])}catch(e){}if("POST"===this.method)try{this.isBinary?t.setRequestHeader("Content-type","application/octet-stream"):t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=!0),this.requestTimeout&&(t.timeout=this.requestTimeout),this.hasXDR()?(t.onload=function(){n.onLoad()},t.onerror=function(){n.onError(t.responseText)}):t.onreadystatechange=function(){if(2===t.readyState)try{var e=t.getResponseHeader("Content-Type");n.supportsBinary&&"application/octet-stream"===e&&(t.responseType="arraybuffer")}catch(e){}4===t.readyState&&(200===t.status||1223===t.status?n.onLoad():setTimeout((function(){n.onError(t.status)}),0))},No("xhr data %s",this.data),t.send(this.data)}catch(e){return void setTimeout((function(){n.onError(e)}),0)}"undefined"!=typeof document&&(this.index=Ro.requestsCount++,Ro.requests[this.index]=this)},Ro.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},Ro.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},Ro.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},Ro.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=Po:this.xhr.onreadystatechange=Po,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Ro.requests[this.index],this.xhr=null}},Ro.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(e){}e="application/octet-stream"===t&&this.xhr.response||this.xhr.responseText}catch(e){this.onError(e)}null!=e&&this.onData(e)},Ro.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},Ro.prototype.abort=function(){this.cleanup()},Ro.requestsCount=0,Ro.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Do);else if("function"==typeof addEventListener){var _o="onpagehide"in self?"pagehide":"unload";addEventListener(_o,Do,!1)}function Do(){for(var e in Ro.requests)Ro.requests.hasOwnProperty(e)&&Ro.requests[e].abort()}var To,Mo=xo,$o=Jo,qo=/\n/g,Lo=/\\n/g;function zo(){}function Ho(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==le?le:{}}function Jo(e){if(Mo.call(this,e),this.query=this.query||{},!To){var t=Ho();To=t.___eio=t.___eio||[]}this.index=To.length;var n=this;To.push((function(e){n.onData(e)})),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",(function(){n.script&&(n.script.onerror=zo)}),!1)}co(Jo,Mo),Jo.prototype.supportsBinary=!1,Jo.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),Mo.prototype.doClose.call(this)},Jo.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(t,n):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)}),100)},Jo.prototype.doWrite=function(e,t){var n=this;if(!this.form){var r,o=document.createElement("form"),s=document.createElement("textarea"),i=this.iframeId="eio_iframe_"+this.index;o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=i,o.method="POST",o.setAttribute("accept-charset","utf-8"),s.name="d",o.appendChild(s),document.body.appendChild(o),this.form=o,this.area=s}function a(){c(),t()}function c(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(e){n.onError("jsonp polling iframe removal error",e)}try{var e='<iframe src="javascript:0" name="'+n.iframeId+'">';r=document.createElement(e)}catch(e){(r=document.createElement("iframe")).name=n.iframeId,r.src="javascript:0"}r.id=n.iframeId,n.form.appendChild(r),n.iframe=r}this.form.action=this.uri(),c(),e=e.replace(Lo,"\\\n"),this.area.value=e.replace(qo,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&a()}:this.iframe.onload=a};var Xo,Ko,Wo=ue(Object.freeze({__proto__:null,default:{}})),Vo=oo,Yo=xr,Zo=ao,Go=co,Qo=go,es=yo.exports("engine.io-client:websocket");if("undefined"!=typeof WebSocket)Xo=WebSocket;else if("undefined"!=typeof self)Xo=self.WebSocket||self.MozWebSocket;else try{Ko=Wo}catch(e){}var ts=Xo||Ko,ns=rs;function rs(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=Xo&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(ts=Ko),Vo.call(this,e)}Go(rs,Vo),rs.prototype.name="websocket",rs.prototype.supportsBinary=!0,rs.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?t?new ts(e,t):new ts(e):new ts(e,t,n)}catch(e){return this.emit("error",e)}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()}},rs.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},rs.prototype.write=function(e){var t=this;this.writable=!1;for(var n=e.length,r=0,o=n;r<o;r++)!function(e){Yo.encodePacket(e,t.supportsBinary,(function(r){if(!t.usingBrowserWebSocket){var o={};if(e.options&&(o.compress=e.options.compress),t.perMessageDeflate)("string"==typeof r?Buffer.byteLength(r):r.length)<t.perMessageDeflate.threshold&&(o.compress=!1)}try{t.usingBrowserWebSocket?t.ws.send(r):t.ws.send(r,o)}catch(e){es("websocket closed before onclose event")}--n||s()}))}(e[r]);function s(){t.emit("flush"),setTimeout((function(){t.writable=!0,t.emit("drain")}),0)}},rs.prototype.onClose=function(){Vo.prototype.onClose.call(this)},rs.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},rs.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=Qo()),this.supportsBinary||(e.b64=1),(e=Zo.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e},rs.prototype.check=function(){return!(!ts||"__initialize"in ts&&this.name===rs.prototype.name)};var os=kr,ss=Ar.exports,is=$o,as=ns;br.polling=function(e){var t=!1,n=!1,r=!1!==e.jsonp;if("undefined"!=typeof location){var o="https:"===location.protocol,s=location.port;s||(s=o?443:80),t=e.hostname!==location.hostname||s!==e.port,n=e.secure!==o}if(e.xdomain=t,e.xscheme=n,"open"in new os(e)&&!e.forceJSONP)return new ss(e);if(!r)throw new Error("JSONP disabled");return new is(e)},br.websocket=as;var cs=[].indexOf,ls=function(e,t){if(cs)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},us=br,ps=no.exports,ds=yo.exports("engine.io-client:socket"),hs=ls,fs=xr,ms=zn,gs=ao,ys=vs;function vs(e,t){if(!(this instanceof vs))return new vs(e,t);t=t||{},e&&"object"==typeof e&&(t=e,e=null),e?(e=ms(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ms(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=gs.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}vs.priorWebsocketSuccess=!1,ps(vs.prototype),vs.protocol=fs.protocol,vs.Socket=vs,vs.Transport=oo,vs.transports=br,vs.parser=xr,vs.prototype.createTransport=function(e){ds('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=fs.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new us[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},vs.prototype.open=function(){var e;if(this.rememberUpgrade&&vs.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},vs.prototype.setTransport=function(e){ds("setting transport %s",e.name);var t=this;this.transport&&(ds("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},vs.prototype.probe=function(e){ds('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function o(){if(r.onlyBinaryUpgrades){var o=!this.supportsBinary&&r.transport.supportsBinary;n=n||o}n||(ds('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(o){if(!n)if("pong"===o.type&&"probe"===o.data){if(ds('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;vs.priorWebsocketSuccess="websocket"===t.name,ds('pausing current transport "%s"',r.transport.name),r.transport.pause((function(){n||"closed"!==r.readyState&&(ds("changing transport and sending upgrade packet"),u(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())}))}else{ds('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,r.emit("upgradeError",s)}})))}function s(){n||(n=!0,u(),t.close(),t=null)}function i(n){var o=new Error("probe error: "+n);o.transport=t.name,s(),ds('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",o)}function a(){i("transport closed")}function c(){i("socket closed")}function l(e){t&&e.name!==t.name&&(ds('"%s" works - aborting "%s"',e.name,t.name),s())}function u(){t.removeListener("open",o),t.removeListener("error",i),t.removeListener("close",a),r.removeListener("close",c),r.removeListener("upgrading",l)}vs.priorWebsocketSuccess=!1,t.once("open",o),t.once("error",i),t.once("close",a),this.once("close",c),this.once("upgrading",l),t.open()},vs.prototype.onOpen=function(){if(ds("socket open"),this.readyState="open",vs.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){ds("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},vs.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(ds('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else ds('packet received with socket readyState "%s"',this.readyState)},vs.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},vs.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout((function(){"closed"!==t.readyState&&t.onClose("ping timeout")}),e||t.pingInterval+t.pingTimeout)},vs.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout((function(){ds("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)}),e.pingInterval)},vs.prototype.ping=function(){var e=this;this.sendPacket("ping",(function(){e.emit("ping")}))},vs.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},vs.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(ds("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},vs.prototype.write=vs.prototype.send=function(e,t,n){return this.sendPacket("message",e,t,n),this},vs.prototype.sendPacket=function(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var o={type:e,data:t,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}},vs.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?r():t()})):this.upgrading?r():t()}function t(){e.onClose("forced close"),ds("socket closing - telling transport to close"),e.transport.close()}function n(){e.removeListener("upgrade",n),e.removeListener("upgradeError",n),t()}function r(){e.once("upgrade",n),e.once("upgradeError",n)}return this},vs.prototype.onError=function(e){ds("socket error %j",e),vs.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},vs.prototype.onClose=function(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){ds('socket close with reason: "%s"',e);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",e,t),this.writeBuffer=[],this.prevBufferLen=0}},vs.prototype.filterUpgrades=function(e){for(var t=[],n=0,r=e.length;n<r;n++)~hs(this.transports,e[n])&&t.push(e[n]);return t},Cr.exports=ys,Cr.exports.parser=xr;var Cs={exports:{}},bs={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t);return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(bs);var ws=function(e,t){for(var n=[],r=(t=t||0)||0;r<e.length;r++)n[r-t]=e[r];return n};var Fs=function(e,t,n){return e.on(t,n),{destroy:function(){e.removeListener(t,n)}}};var ks=[].slice,As=function(e,t){if("string"==typeof t&&(t=e[t]),"function"!=typeof t)throw new Error("bind() requires a function");var n=ks.call(arguments,2);return function(){return t.apply(e,n.concat(ks.call(arguments)))}};!function(e,t){var n=nr,r=bs.exports,o=ws,s=Fs,i=As,a=Hn.exports("socket.io-client:socket"),c=ao,l=Nr;e.exports=d;var u={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},p=r.prototype.emit;function d(e,t,n){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}r(d.prototype),d.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[s(e,"open",i(this,"onopen")),s(e,"packet",i(this,"onpacket")),s(e,"close",i(this,"onclose"))]}},d.prototype.open=d.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},d.prototype.send=function(){var e=o(arguments);return e.unshift("message"),this.emit.apply(this,e),this},d.prototype.emit=function(e){if(u.hasOwnProperty(e))return p.apply(this,arguments),this;var t=o(arguments),r={type:(void 0!==this.flags.binary?this.flags.binary:l(t))?n.BINARY_EVENT:n.EVENT,data:t,options:{}};return r.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(a("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),r.id=this.ids++),this.connected?this.packet(r):this.sendBuffer.push(r),this.flags={},this},d.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},d.prototype.onopen=function(){if(a("transport is open - connecting"),"/"!==this.nsp)if(this.query){var e="object"==typeof this.query?c.encode(this.query):this.query;a("sending connect packet with query %s",e),this.packet({type:n.CONNECT,query:e})}else this.packet({type:n.CONNECT})},d.prototype.onclose=function(e){a("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},d.prototype.onpacket=function(e){var t=e.nsp===this.nsp,r=e.type===n.ERROR&&"/"===e.nsp;if(t||r)switch(e.type){case n.CONNECT:this.onconnect();break;case n.EVENT:case n.BINARY_EVENT:this.onevent(e);break;case n.ACK:case n.BINARY_ACK:this.onack(e);break;case n.DISCONNECT:this.ondisconnect();break;case n.ERROR:this.emit("error",e.data)}},d.prototype.onevent=function(e){var t=e.data||[];a("emitting event %j",t),null!=e.id&&(a("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?p.apply(this,t):this.receiveBuffer.push(t)},d.prototype.ack=function(e){var t=this,r=!1;return function(){if(!r){r=!0;var s=o(arguments);a("sending ack %j",s),t.packet({type:l(s)?n.BINARY_ACK:n.ACK,id:e,data:s})}}},d.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(a("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):a("bad ack %s",e.id)},d.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},d.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++)p.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},d.prototype.ondisconnect=function(){a("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},d.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},d.prototype.close=d.prototype.disconnect=function(){return this.connected&&(a("performing disconnect (%s)",this.nsp),this.packet({type:n.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},d.prototype.compress=function(e){return this.flags.compress=e,this},d.prototype.binary=function(e){return this.flags.binary=e,this}}(Cs);var xs=Os;function Os(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Os.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},Os.prototype.reset=function(){this.attempts=0},Os.prototype.setMin=function(e){this.ms=e},Os.prototype.setMax=function(e){this.max=e},Os.prototype.setJitter=function(e){this.jitter=e};var Ss=Cr.exports,Is=Cs.exports,Es=bs.exports,js=nr,Bs=Fs,Ns=As,Ps=Hn.exports("socket.io-client:manager"),Us=ls,Rs=xs,_s=Object.prototype.hasOwnProperty,Ds=Ts;function Ts(e,t){if(!(this instanceof Ts))return new Ts(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new Rs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||js;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}Ts.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)_s.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},Ts.prototype.updateSocketIds=function(){for(var e in this.nsps)_s.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},Ts.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},Es(Ts.prototype),Ts.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},Ts.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},Ts.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},Ts.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},Ts.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},Ts.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},Ts.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},Ts.prototype.open=Ts.prototype.connect=function(e,t){if(Ps("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;Ps("opening %s",this.uri),this.engine=Ss(this.uri,this.opts);var n=this.engine,r=this;this.readyState="opening",this.skipReconnect=!1;var o=Bs(n,"open",(function(){r.onopen(),e&&e()})),s=Bs(n,"error",(function(t){if(Ps("connect_error"),r.cleanup(),r.readyState="closed",r.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else r.maybeReconnectOnOpen()}));if(!1!==this._timeout){var i=this._timeout;Ps("connect attempt will timeout after %d",i);var a=setTimeout((function(){Ps("connect attempt timed out after %d",i),o.destroy(),n.close(),n.emit("error","timeout"),r.emitAll("connect_timeout",i)}),i);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(o),this.subs.push(s),this},Ts.prototype.onopen=function(){Ps("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(Bs(e,"data",Ns(this,"ondata"))),this.subs.push(Bs(e,"ping",Ns(this,"onping"))),this.subs.push(Bs(e,"pong",Ns(this,"onpong"))),this.subs.push(Bs(e,"error",Ns(this,"onerror"))),this.subs.push(Bs(e,"close",Ns(this,"onclose"))),this.subs.push(Bs(this.decoder,"decoded",Ns(this,"ondecoded")))},Ts.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},Ts.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},Ts.prototype.ondata=function(e){this.decoder.add(e)},Ts.prototype.ondecoded=function(e){this.emit("packet",e)},Ts.prototype.onerror=function(e){Ps("error",e),this.emitAll("error",e)},Ts.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new Is(this,e,t),this.nsps[e]=n;var r=this;n.on("connecting",o),n.on("connect",(function(){n.id=r.generateId(e)})),this.autoConnect&&o()}function o(){~Us(r.connecting,n)||r.connecting.push(n)}return n},Ts.prototype.destroy=function(e){var t=Us(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},Ts.prototype.packet=function(e){Ps("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,(function(n){for(var r=0;r<n.length;r++)t.engine.write(n[r],e.options);t.encoding=!1,t.processPacketQueue()})))},Ts.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},Ts.prototype.cleanup=function(){Ps("cleanup");for(var e=this.subs.length,t=0;t<e;t++){this.subs.shift().destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},Ts.prototype.close=Ts.prototype.disconnect=function(){Ps("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},Ts.prototype.onclose=function(e){Ps("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},Ts.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)Ps("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();Ps("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout((function(){e.skipReconnect||(Ps("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(Ps("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(Ps("reconnect success"),e.onreconnect())})))}),t);this.subs.push({destroy:function(){clearTimeout(n)}})}},Ts.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)},function(e,t){var n=tr,r=nr,o=Ds,s=Hn.exports("socket.io-client");e.exports=t=a;var i=t.managers={};function a(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,a=n(e),c=a.source,l=a.id,u=a.path,p=i[l]&&u in i[l].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||p?(s("ignoring socket cache for %s",c),r=o(c,t)):(i[l]||(s("new io instance for %s",c),i[l]=o(c,t)),r=i[l]),a.query&&!t.query&&(t.query=a.query),r.socket(a.path,t)}t.protocol=r.protocol,t.connect=a,t.Manager=Ds,t.Socket=Cs.exports}($n,$n.exports);var Ms=$n.exports;const $s=(e,t)=>Object.entries(e).filter((([,e])=>void 0!==e)).map((([e,n])=>{const r=t?`${t}[${e}]`:e;return Array.isArray(n)?n.map((e=>`${r}[]=${e}`)).join("&"):"object"!=typeof n?`${r}=${n}`:$s(n,null!=t?t:e)})).join("&"),qs=e=>{if("success"===e.status)return e.data;if("fail"===e.status)throw new s(e.code);if("error"===e.status)throw new o(e.message,e.code,"error")};const Ls=["disconnected","error","connect_error","reconnect_error","reconnect_failed","v3.user.didUpdate","v3.channel.didUpdate","v3.channel.didUpdate","v3.channel.didJoin","v3.channel.didLeave","v3.channel.didAddUsers","v3.channel.didRemoveUsers","v3.channel.didBan","v3.channel.didUnban","v3.message.didCreate","v3.message.didUpdate","v3.message.didDelete"],zs=()=>{return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map((function(e){e(n)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,n)}))}};var e},Hs=(e,t,n,r)=>{const{log:o,emitter:s}=e,i=Date.now();o(`${t}(tmpid: ${i}) > listen`);const a=(...e)=>{o(`${t}(tmpid: ${i}) > trigger`,e),r(...e)};return s.on(n,a),()=>{o(`${t}(tmpid: ${i}) > dispose`),s.off(n,a)}},Js=(e,t)=>{const{emitter:n}=c();setTimeout((()=>{n.emit(e,t)}),0)},Xs=()=>{const e=(()=>{var e,t;return(null===(e=null===process||void 0===process?void 0:process.versions)||void 0===e?void 0:e.node)?process.versions.node:navigator?`${navigator.product.toLowerCase()}#${null!==(t=navigator.userAgent)&&void 0!==t?t:"unknown_agent"}`:"unknown_model"})();return{version:"11.0.0",kind:"web",model:e}},Ks=(e={})=>{const t=e;return{read:()=>t,write:e=>{Object.assign(t,e)},erase:(...e)=>{e.length||(e=Object.keys(t)),e.forEach((e=>delete t[e]))}}},Ws=(...e)=>e.reduce(((e,t)=>{const n=Ks();return Object.assign(Object.assign({},e),{[t]:n})}),{});const Vs=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},{hasOwnProperty:Ys}=Object.prototype,{propertyIsEnumerable:Zs}=Object,Gs=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}),Qs=le,ei={concatArrays:!1,ignoreUndefined:!1},ti=e=>{const t=[];for(const n in e)Ys.call(e,n)&&t.push(n);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(e);for(const r of n)Zs.call(e,r)&&t.push(r)}return t};function ni(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return ti(e).forEach((n=>{Gs(t,n,ni(e[n]))})),t}(e):Vs(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return ti(e).forEach((n=>{Gs(t,n,ni(e[n]))})),t}(e):e}const ri=(e,t,n,r)=>(n.forEach((n=>{void 0===t[n]&&r.ignoreUndefined||(n in e&&e[n]!==Object.getPrototypeOf(e)?Gs(e,n,oi(e[n],t[n],r)):Gs(e,n,ni(t[n])))})),e);function oi(e,t,n){return n.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,n)=>{let r=e.slice(0,0),o=0;return[e,t].forEach((t=>{const s=[];for(let n=0;n<t.length;n++)Ys.call(t,n)&&(s.push(String(n)),Gs(r,o++,t===e?t[n]:ni(t[n])));r=ri(r,t,ti(t).filter((e=>!s.includes(e))),n)})),r})(e,t,n):Vs(t)&&Vs(e)?ri(e,t,ti(t),n):ni(t)}const si=function(...e){const t=oi(ni(ei),this!==Qs&&this||{},ei);let n={_:{}};for(const r of e)if(void 0!==r){if(!Vs(r))throw new TypeError("`"+r+"` is not an Option Object");n=oi(n,{_:r},t)}return n._}.bind({concatArrays:!0,ignoreUndefined:!0}),ii=(e,t)=>new Promise(((n,r)=>{try{const r=e();t&&t(null,r),n(r)}catch(e){t&&t(e),r(e)}})),ai=(e,t,n)=>Promise.all(e).then((e=>{const r=n?n(e):null;return t&&t(null,r),Promise.resolve(r)}),(e=>(t&&t(e),Promise.reject(e))));class ci{static getItem(e,t){return ii((()=>window.localStorage.getItem(e)),t)}static setItem(e,t,n){return ii((()=>{window.localStorage.setItem(e,t)}),n)}static removeItem(e,t){return ii((()=>window.localStorage.removeItem(e)),t)}static mergeItem(e,t,n){return ii((()=>{((e,t)=>{const n=window.localStorage.getItem(e),r=JSON.parse(n),o=JSON.parse(t),s=JSON.stringify(si(r,o));window.localStorage.setItem(e,s)})(e,t)}),n)}static clear(e){return ii((()=>{window.localStorage.clear()}),e)}static getAllKeys(e){return ii((()=>{const e=window.localStorage.length,t=[];for(let n=0;n<e;n+=1){const e=window.localStorage.key(n);t.push(e)}return t}),e)}static flushGetRequests(){}static multiGet(e,t){const n=e.map((e=>ci.getItem(e)));return ai(n,t,(t=>t.map(((t,n)=>[e[n],t]))))}static multiSet(e,t){const n=e.map((e=>ci.setItem(e[0],e[1])));return ai(n,t)}static multiRemove(e,t){const n=e.map((e=>ci.removeItem(e)));return ai(n,t)}static multiMerge(e,t){const n=e.map((e=>ci.mergeItem(e[0],e[1])));return ai(n,t)}}const li=e=>e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.localId]:t})),{}),ui=(e,t=Date.now(),n=h)=>{Object.fromEntries(Object.entries(e).map((([e,r])=>[e,pi(r,t,n[e])])))},pi=(e,t=Date.now(),n)=>{e.forEach((e=>di(e,t,n)))},di=(e,t=Date.now(),n=y(e))=>{var r,o;null!==(r=e.syncedAt)&&void 0!==r||(e.syncedAt=t);const{cache:s}=c();if(n){const t=d(n)(e);e.localId=null!==(o=null==s?void 0:s.lookup[`${n}#${t}`])&&void 0!==o?o:ot()}},hi=(e,t,n)=>void 0!==n?e.filter((e=>e[t]===n)):e,fi=({channelSegment:e},{channelSegment:t})=>e-t,mi=({segmentNumber:e},{segmentNumber:t})=>e-t,gi=["disconnected","error","connect_error","reconnect_error","reconnect_failed"],yi=e=>{const t=c(),n=gi.map((n=>Hs(t,`client/onConnectionError(${n})`,n,(t=>{const o=t&&"code"in t?new r(t.message,t.code,"fatal"):new i(n);e(o)}))));return()=>{n.forEach((e=>e()))}},vi=async e=>{const t=c();t.log("user/getUser",e);const{data:n}=await t.http.get(`/api/v3/users/${e}`);ui(n),C(n);const{users:r}=n;return r.find((t=>t.userId===e))};vi.locally=e=>{var t;c().log("user/getUser.locally",e);const[n]=null!==(t=u("user",e))&&void 0!==t?t:[];return n};const Ci=async e=>{const t=c();t.log("user/getUsers",e);const{data:n}=await t.http.get("/api/v3/users/list",{params:{userIds:e}});ui(n),C(n);const{users:r}=n;return li(r)};
1
+ var Amity=function(e,t,n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i,s=o(t),a=o(n),c=o(r);const l=null!==(i="v0.0.1-beta.9-umd")?i:"__dev__";class u extends Error{constructor(e,t,n){super(`Amity SDK (${t}): ${e}`),this.code=t,this.level=n,this.type="ASC",this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,u)}}class p extends u{constructor(e,t,n){super(e,t,n)}}class d extends u{constructor(e=8e5,t="fatal"){super("Unexpected error",e,t)}}class f extends u{constructor(e,t="SDK client is having connection issues"){super(`${t} (${e})`,"disconnected"===e?800211:800210,"error"),this.event=e}}let h=null;const m=()=>{if(!h)throw new u("There is no active client",8e5,"fatal");return h},g=e=>{h=e},y=(e,...t)=>{var n;const{cache:r}=m(),o=null==r?void 0:r[e];if(!r||!o)return;const i=null!==(n=o.read())&&void 0!==n?n:{};return(null==t?void 0:t.length)?t.map((t=>{const n=r.lookup[`${e}#${t}`];return i[n]})).filter(Boolean):Object.values(i)},b={user:({userId:e})=>e,file:({fileId:e})=>e,role:({roleId:e})=>e,channel:({channelId:e})=>e,channelUsers:({channelId:e,userId:t})=>`${e}#${t}`,message:({messageId:e})=>e,community:({communityId:e})=>e,communityUsers:({communityId:e,userId:t})=>`${e}#${t}`,post:({postId:e})=>e,comment:({commentId:e})=>e,stream:({streamId:e})=>e},v=e=>b[e],_={users:"user",files:"file",roles:"role",channels:"channel",channelUsers:"channelUsers",messages:"message",communities:"community",communityUsers:"communityUsers",posts:"post",postChildren:"post",comments:"comment",videoStreamings:"stream"},w=(e,...t)=>{const{cache:n}=m(),r=null==n?void 0:n[e];if(!n||!r)return;const o=t.filter(Boolean);if(!o.length)return;const i=Object.fromEntries(o.map((t=>{var r,o,i;const s=v(e)(t),a=null!==(r=(o=n.lookup)[i=`${e}#${s}`])&&void 0!==r?r:o[i]=t.localId;return[a,Object.assign(Object.assign({syncedAt:Date.now()},t),{localId:a})]})));r.write(i)},C=(e,t)=>{const{cache:n}=m(),r=null==n?void 0:n[e];if(!n||!r)return[];const o=v(e)(t),i=n.lookup[`${e}#${o}`];delete n.lookup[`${e}#${o}`],r.erase(i)},S={file:["fileId","attributes"],user:["userId","avatarFileId"],role:["roleId"],channel:["channelId","rateLimit"],channelUsers:["channelId","userId","membership"],message:["messageId"],community:["communityId","onlyAdminCanPost"],communityUsers:["userId","communityId","communityMembership"],post:["postId","feedId"],comment:["commentId","referenceId"],stream:["streamId"]},k=e=>{var t;return null===(t=Object.entries(S).find((([t,n])=>((e,t)=>{const n=Object.keys(e);return t.every((e=>n.includes(e)))})(e,n))))||void 0===t?void 0:t[0]},E=(e,t)=>{var n;const{cache:r,log:o}=m(),i=null!==(n=k(e))&&void 0!==n?n:k(t);if(!i)return void o("syncInCache","could not identify the models",{original:e,replacement:t});const s=null==r?void 0:r[i];r&&s&&(C(i,e),C(i,t),t.localId=e.localId,w(i,t))},R=(e,t,n)=>{var r;const[o]=null!==(r=y(e,t))&&void 0!==r?r:[];if(!o)return;const i=n(o);return i&&w(e,Object.assign(Object.assign({},o),i)),i},I=(e,t)=>{const n=v(e)(t);R(e,n,(e=>Object.assign(Object.assign({},e),t)))},A=e=>e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.localId]:t})),{});var O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function T(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}var x={exports:{}};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Array]",s="[object Boolean]",a="[object Date]",c="[object Error]",l="[object Function]",u="[object Map]",p="[object Number]",d="[object Object]",f="[object Promise]",h="[object RegExp]",m="[object Set]",g="[object String]",y="[object Symbol]",b="[object WeakMap]",v="[object ArrayBuffer]",_="[object DataView]",w=/^\[object .+?Constructor\]$/,C=/^(?:0|[1-9]\d*)$/,S={};S["[object Float32Array]"]=S["[object Float64Array]"]=S["[object Int8Array]"]=S["[object Int16Array]"]=S["[object Int32Array]"]=S["[object Uint8Array]"]=S["[object Uint8ClampedArray]"]=S["[object Uint16Array]"]=S["[object Uint32Array]"]=!0,S[o]=S[i]=S[v]=S[s]=S[_]=S[a]=S[c]=S[l]=S[u]=S[p]=S[d]=S[h]=S[m]=S[g]=S[b]=!1;var k="object"==typeof O&&O&&O.Object===Object&&O,E="object"==typeof self&&self&&self.Object===Object&&self,R=k||E||Function("return this")(),I=t&&!t.nodeType&&t,A=I&&e&&!e.nodeType&&e,T=A&&A.exports===I&&k.process,x=function(){try{return T&&T.binding("util")}catch(e){}}(),P=x&&x.isTypedArray;function M(e,t){for(var n=-1,r=e?e.length:0;++n<r;)if(t(e[n],n,e))return!0;return!1}function B(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function j(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function N(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var F,U,L,D=Array.prototype,q=Function.prototype,$=Object.prototype,H=R["__core-js_shared__"],W=(F=/[^.]+$/.exec(H&&H.keys&&H.keys.IE_PROTO||""))?"Symbol(src)_1."+F:"",V=q.toString,K=$.hasOwnProperty,z=$.toString,J=RegExp("^"+V.call(K).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Y=R.Symbol,Q=R.Uint8Array,X=$.propertyIsEnumerable,G=D.splice,Z=(U=Object.keys,L=Object,function(e){return U(L(e))}),ee=Ee(R,"DataView"),te=Ee(R,"Map"),ne=Ee(R,"Promise"),re=Ee(R,"Set"),oe=Ee(R,"WeakMap"),ie=Ee(Object,"create"),se=Oe(ee),ae=Oe(te),ce=Oe(ne),le=Oe(re),ue=Oe(oe),pe=Y?Y.prototype:void 0,de=pe?pe.valueOf:void 0;function fe(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function he(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function me(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ge(e){var t=-1,n=e?e.length:0;for(this.__data__=new me;++t<n;)this.add(e[t])}function ye(e){this.__data__=new he(e)}function be(e,t){var n=xe(e)||function(e){return function(e){return Ne(e)&&Pe(e)}(e)&&K.call(e,"callee")&&(!X.call(e,"callee")||z.call(e)==o)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var s in e)!t&&!K.call(e,s)||i&&("length"==s||Ie(s,r))||n.push(s);return n}function ve(e,t){for(var n=e.length;n--;)if(Te(e[n][0],t))return n;return-1}function _e(e,t,n,r,l){return e===t||(null==e||null==t||!je(e)&&!Ne(t)?e!=e&&t!=t:function(e,t,n,r,l,f){var b=xe(e),w=xe(t),C=i,S=i;b||(C=(C=Re(e))==o?d:C);w||(S=(S=Re(t))==o?d:S);var k=C==d&&!B(e),E=S==d&&!B(t),R=C==S;if(R&&!k)return f||(f=new ye),b||Fe(e)?Se(e,t,n,r,l,f):function(e,t,n,r,o,i,l){switch(n){case _:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case v:return!(e.byteLength!=t.byteLength||!r(new Q(e),new Q(t)));case s:case a:case p:return Te(+e,+t);case c:return e.name==t.name&&e.message==t.message;case h:case g:return e==t+"";case u:var d=j;case m:var f=2&i;if(d||(d=N),e.size!=t.size&&!f)return!1;var b=l.get(e);if(b)return b==t;i|=1,l.set(e,t);var w=Se(d(e),d(t),r,o,i,l);return l.delete(e),w;case y:if(de)return de.call(e)==de.call(t)}return!1}(e,t,C,n,r,l,f);if(!(2&l)){var I=k&&K.call(e,"__wrapped__"),A=E&&K.call(t,"__wrapped__");if(I||A){var O=I?e.value():e,T=A?t.value():t;return f||(f=new ye),n(O,T,r,l,f)}}if(!R)return!1;return f||(f=new ye),function(e,t,n,r,o,i){var s=2&o,a=Ue(e),c=a.length,l=Ue(t).length;if(c!=l&&!s)return!1;var u=c;for(;u--;){var p=a[u];if(!(s?p in t:K.call(t,p)))return!1}var d=i.get(e);if(d&&i.get(t))return d==t;var f=!0;i.set(e,t),i.set(t,e);var h=s;for(;++u<c;){var m=e[p=a[u]],g=t[p];if(r)var y=s?r(g,m,p,t,e,i):r(m,g,p,e,t,i);if(!(void 0===y?m===g||n(m,g,r,o,i):y)){f=!1;break}h||(h="constructor"==p)}if(f&&!h){var b=e.constructor,v=t.constructor;b==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v||(f=!1)}return i.delete(e),i.delete(t),f}(e,t,n,r,l,f)}(e,t,_e,n,r,l))}function we(e){return!(!je(e)||function(e){return!!W&&W in e}(e))&&(Me(e)||B(e)?J:w).test(Oe(e))}function Ce(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||$,t!==r)return Z(e);var t,n,r,o=[];for(var i in Object(e))K.call(e,i)&&"constructor"!=i&&o.push(i);return o}function Se(e,t,n,r,o,i){var s=2&o,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=i.get(e);if(l&&i.get(t))return l==t;var u=-1,p=!0,d=1&o?new ge:void 0;for(i.set(e,t),i.set(t,e);++u<a;){var f=e[u],h=t[u];if(r)var m=s?r(h,f,u,t,e,i):r(f,h,u,e,t,i);if(void 0!==m){if(m)continue;p=!1;break}if(d){if(!M(t,(function(e,t){if(!d.has(t)&&(f===e||n(f,e,r,o,i)))return d.add(t)}))){p=!1;break}}else if(f!==h&&!n(f,h,r,o,i)){p=!1;break}}return i.delete(e),i.delete(t),p}function ke(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Ee(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return we(n)?n:void 0}fe.prototype.clear=function(){this.__data__=ie?ie(null):{}},fe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},fe.prototype.get=function(e){var t=this.__data__;if(ie){var r=t[e];return r===n?void 0:r}return K.call(t,e)?t[e]:void 0},fe.prototype.has=function(e){var t=this.__data__;return ie?void 0!==t[e]:K.call(t,e)},fe.prototype.set=function(e,t){return this.__data__[e]=ie&&void 0===t?n:t,this},he.prototype.clear=function(){this.__data__=[]},he.prototype.delete=function(e){var t=this.__data__,n=ve(t,e);return!(n<0)&&(n==t.length-1?t.pop():G.call(t,n,1),!0)},he.prototype.get=function(e){var t=this.__data__,n=ve(t,e);return n<0?void 0:t[n][1]},he.prototype.has=function(e){return ve(this.__data__,e)>-1},he.prototype.set=function(e,t){var n=this.__data__,r=ve(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},me.prototype.clear=function(){this.__data__={hash:new fe,map:new(te||he),string:new fe}},me.prototype.delete=function(e){return ke(this,e).delete(e)},me.prototype.get=function(e){return ke(this,e).get(e)},me.prototype.has=function(e){return ke(this,e).has(e)},me.prototype.set=function(e,t){return ke(this,e).set(e,t),this},ge.prototype.add=ge.prototype.push=function(e){return this.__data__.set(e,n),this},ge.prototype.has=function(e){return this.__data__.has(e)},ye.prototype.clear=function(){this.__data__=new he},ye.prototype.delete=function(e){return this.__data__.delete(e)},ye.prototype.get=function(e){return this.__data__.get(e)},ye.prototype.has=function(e){return this.__data__.has(e)},ye.prototype.set=function(e,t){var n=this.__data__;if(n instanceof he){var r=n.__data__;if(!te||r.length<199)return r.push([e,t]),this;n=this.__data__=new me(r)}return n.set(e,t),this};var Re=function(e){return z.call(e)};function Ie(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||C.test(e))&&e>-1&&e%1==0&&e<t}function Ae(e){return e==e&&!je(e)}function Oe(e){if(null!=e){try{return V.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Te(e,t){return e===t||e!=e&&t!=t}(ee&&Re(new ee(new ArrayBuffer(1)))!=_||te&&Re(new te)!=u||ne&&Re(ne.resolve())!=f||re&&Re(new re)!=m||oe&&Re(new oe)!=b)&&(Re=function(e){var t=z.call(e),n=t==d?e.constructor:void 0,r=n?Oe(n):void 0;if(r)switch(r){case se:return _;case ae:return u;case ce:return f;case le:return m;case ue:return b}return t});var xe=Array.isArray;function Pe(e){return null!=e&&Be(e.length)&&!Me(e)}function Me(e){var t=je(e)?z.call(e):"";return t==l||"[object GeneratorFunction]"==t}function Be(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function je(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ne(e){return!!e&&"object"==typeof e}var Fe=P?function(e){return function(t){return e(t)}}(P):function(e){return Ne(e)&&Be(e.length)&&!!S[z.call(e)]};function Ue(e){return Pe(e)?be(e):Ce(e)}e.exports=function(e,t,n){return n="function"==typeof n?n:void 0,function(e,t,n,r){var o=n.length,i=o,s=!r;if(null==e)return!i;for(e=Object(e);o--;){var a=n[o];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++o<i;){var c=(a=n[o])[0],l=e[c],u=a[1];if(s&&a[2]){if(void 0===l&&!(c in e))return!1}else{var p=new ye;if(r)var d=r(l,u,c,e,t,p);if(!(void 0===d?_e(u,l,r,3,p):d))return!1}}return!0}(e,t,function(e){for(var t=Ue(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,Ae(o)]}return t}(t),n)}}(x,x.exports);var P=x.exports;const M=(e,t)=>P(e,t,((e,t,n)=>{if("syncedAt"===n)return!0})),B=(e={},t=Object.keys(e))=>{t.forEach((t=>{const n=_[t];n&&e[t].forEach((e=>{var t;const[r]=null!==(t=y(n,v(n)(e)))&&void 0!==t?t:[];if(r){if(r.updatedAt&&r.updatedAt>e.updatedAt)return;I(n,e)}else w(n,e)}))}))},j=e=>Object.assign({lookup:{}},e),N="function"==typeof atob,F="function"==typeof btoa,U="function"==typeof Buffer,L="function"==typeof TextDecoder?new TextDecoder:void 0,D="function"==typeof TextEncoder?new TextEncoder:void 0,q=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],$=(e=>{let t={};return e.forEach(((e,n)=>t[e]=n)),t})(q),H=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,W=String.fromCharCode.bind(String),V="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),K=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),z=F?e=>btoa(e):U?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,n,r,o,i="";const s=e.length%3;for(let s=0;s<e.length;){if((n=e.charCodeAt(s++))>255||(r=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=q[t>>18&63]+q[t>>12&63]+q[t>>6&63]+q[63&t]}return s?i.slice(0,s-3)+"===".substring(s):i},J=U?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(W.apply(null,e.subarray(n,n+4096)));return z(t.join(""))},Y=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?W(192|t>>>6)+W(128|63&t):W(224|t>>>12&15)+W(128|t>>>6&63)+W(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return W(240|t>>>18&7)+W(128|t>>>12&63)+W(128|t>>>6&63)+W(128|63&t)},Q=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,X=U?e=>Buffer.from(e,"utf8").toString("base64"):D?e=>J(D.encode(e)):e=>z(e.replace(Q,Y)),G=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Z=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return W(55296+(t>>>10))+W(56320+(1023&t));case 3:return W((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return W((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},ee=N?e=>atob(K(e)):U?e=>Buffer.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!H.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,n,r,o="";for(let i=0;i<e.length;)t=$[e.charAt(i++)]<<18|$[e.charAt(i++)]<<12|(n=$[e.charAt(i++)])<<6|(r=$[e.charAt(i++)]),o+=64===n?W(t>>16&255):64===r?W(t>>16&255,t>>8&255):W(t>>16&255,t>>8&255,255&t);return o},te=U?e=>V(Buffer.from(e,"base64")):e=>V(ee(e),(e=>e.charCodeAt(0))),ne=U?e=>Buffer.from(e,"base64").toString("utf8"):L?e=>L.decode(te(e)):e=>ee(e).replace(G,Z),re=e=>ne(K(e.replace(/[-_]/g,(e=>"-"==e?"+":"/")))),oe=e=>["skip","limit"].some((t=>t in e)),ie=e=>["after","before","first","last"].some((t=>t in e)),se=e=>(null==e?void 0:e.hasOwnProperty("data"))&&(null==e?void 0:e.hasOwnProperty("nextPage"))&&(null==e?void 0:e.hasOwnProperty("prevPage")),ae=(e,t)=>{var n;if(!e||!Object.keys(e).length)return;let r={};return"skiplimit"===t?r={skip:null!==(n=e.after)&&void 0!==n?n:0,limit:e.limit}:"afterbefore"===t&&(isNaN(null==e?void 0:e.before)?isNaN(null==e?void 0:e.after)?isNaN(null==e?void 0:e.limit)||(r={last:e.limit}):r={after:e.after,first:e.limit}:r={before:e.before,last:e.limit}),Object.keys(r).length?((e,t=!1)=>t?(e=>e.replace(/[+\/]/g,(e=>"+"==e?"-":"_")).replace(/=+$/m,""))(X(e)):X(e))(JSON.stringify(r)):void 0},ce=e=>{if(!e)return null;const t=JSON.parse(re(e));if(oe(t))return{after:t.skip,limit:t.limit};if(ie(t)){if("before"in t)return{before:t.before,limit:t.last};if("after"in t)return{after:t.after,limit:t.first}}return null},le=e=>"locally"in e,ue=e=>"optimistically"in e,pe=e=>le(e)||ue(e),de=e=>null==e?void 0:e.hasOwnProperty("syncedAt"),fe=e=>de(e)&&-1===(null==e?void 0:e.syncedAt),he=(e,t=0)=>{var n;return Date.now()-(null!==(n=null==e?void 0:e.syncedAt)&&void 0!==n?n:0)<=t},me=(e,t=0)=>fe(e)||he(e,t),ge=(e,...t)=>({func:e,args:t}),ye=(e,t=12e4)=>"cache_only"===e?{lifeSpan:1/0}:"server_only"===e?{lifeSpan:0}:{lifeSpan:t},be=e=>!e||(!(!se(e)||!be(e.data))||!Object.keys(e).length),ve=(e,t)=>!(!se(e)||!ve(e.data,t))||(!!me(e,t.lifeSpan)||!!(Object.values(e).length>0&&Object.values(e).every((e=>me(e,t.lifeSpan))))),_e=({func:e,args:t},n,r=ye("cache_then_server"))=>{if(!pe(e)||0===r.lifeSpan)return null==n||n(we(void 0,{origin:"server",loading:!0})),void e(...t).then((e=>{null==n||n(we(e,{origin:"server",loading:!1}))})).catch((e=>{null==n||n(we(void 0,{error:e,loading:!1}))}));const o=ue(e)?e.optimistically(...t):e.locally(...t);be(o)||null==n||n(we(o,{origin:"local"})),o&&le(e)&&ve(o,r)||(null==n||n(we(o,{origin:"local",loading:!0})),e(...t).then((e=>{fe(o)&&E(o,e),null==n||n(we(e,{origin:"server",loading:!1}))})).catch((e=>{null==n||n(we(o,{error:e,loading:!1}))})))},we=(e,t={})=>se(e)?Object.assign(Object.assign({},t),e):Object.assign(Object.assign({},t),{data:e});var Ce={},Se={},ke={};Object.defineProperty(ke,"__esModule",{value:!0}),ke.bytesToString=ke.stringToBytes=ke.NIL=ke.X500=ke.OID=ke.URL=ke.DNS=ke.hexToByte=ke.byteToHex=void 0;let Ee=[],Re={};for(var Ie=0;Ie<256;Ie++)Ee[Ie]=(Ie+256).toString(16).substr(1),Re[Ee[Ie]]=Ie;ke.byteToHex=Ee,ke.hexToByte=Re,ke.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ke.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",ke.OID="6ba7b812-9dad-11d1-80b4-00c04fd430c8",ke.X500="6ba7b814-9dad-11d1-80b4-00c04fd430c8",ke.NIL="00000000-0000-0000-0000-000000000000";ke.stringToBytes=e=>{e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t};ke.bytesToString=e=>{const t=new Uint8Array(e,0,e.byteLength);return String.fromCharCode.apply(null,Array.from(t))},Object.defineProperty(Se,"__esModule",{value:!0}),Se.parse=void 0;const Ae=ke;Se.parse=(e,t,n)=>{let r=t&&n||0,o=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,(e=>(o<16&&t&&(t[r+o++]=Ae.hexToByte[e]),"")));o<16;)t[r+o++]=0;return t};var Oe={};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.unparse=void 0;const Te=ke;Oe.unparse=(e,t)=>{let n=t||0,r=Te.byteToHex;return r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]};var xe={},Pe={};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;var Me=O&&O.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xe,"__esModule",{value:!0}),xe.validate=void 0;const Be=Me(Pe);xe.validate=e=>"string"==typeof e&&Be.default.test(e);var je={};Object.defineProperty(je,"__esModule",{value:!0}),je.version=void 0;const Ne=xe;je.version=e=>{if(!Ne.validate(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)};var Fe={},Ue={};Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.stringify=void 0;const Le=xe,De=[];for(let e=0;e<256;++e)De.push((e+256).toString(16).substr(1));Ue.stringify=(e,t=0)=>{const n=(De[e[t+0]]+De[e[t+1]]+De[e[t+2]]+De[e[t+3]]+"-"+De[e[t+4]]+De[e[t+5]]+"-"+De[e[t+6]]+De[e[t+7]]+"-"+De[e[t+8]]+De[e[t+9]]+"-"+De[e[t+10]]+De[e[t+11]]+De[e[t+12]]+De[e[t+13]]+De[e[t+14]]+De[e[t+15]]).toLowerCase();if(!Le.validate(n))throw TypeError("Stringified UUID is invalid");return n};var qe={};Object.defineProperty(qe,"__esModule",{value:!0}),qe.rng=void 0;qe.rng=()=>{let e=new Array(16);for(let t=0;t<16;t++)e[t]=255&256*Math.random()+0;return e},Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.v1=void 0;const $e=Ue,He=qe;let We,Ve,Ke=0,ze=0;Fe.v1=(e,t,n=0)=>{let r=t&&n||0;const o=t||new Uint8Array(16);let i=e&&e.node?e.node:We,s=e&&e.clockseq?e.clockseq:Ve;if(null==i||null==s){const t=e&&e.random?e.random:e&&e.rng?e.rng():He.rng();null==i&&(i=We=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==s&&(s=Ve=16383&(t[6]<<8|t[7]))}let a=e&&e.msecs?e.msecs:Date.now(),c=e&&e.nsecs?e.nsecs:ze+1;const l=a-Ke+(c-ze)/1e4;if(l<0&&e&&!e.clockseq&&(s=s+1&16383),(l<0||a>Ke)&&e&&!e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ke=a,ze=c,Ve=s,a+=122192928e5;const u=(1e4*(268435455&a)+c)%4294967296;o[r++]=u>>>24&255,o[r++]=u>>>16&255,o[r++]=u>>>8&255,o[r++]=255&u;const p=a/4294967296*1e4&268435455;o[r++]=p>>>8&255,o[r++]=255&p,o[r++]=p>>>24&15|16,o[r++]=p>>>16&255,o[r++]=s>>>8|128,o[r++]=255&s;for(let e=0;e<6;++e)o[r+e]=i[e];return t||$e.stringify(o)};var Je={};Object.defineProperty(Je,"__esModule",{value:!0}),Je.v4=void 0;const Ye=Oe,Qe=qe;Je.v4=(e,t,n)=>{let r=t&&n||0,o=Qe.rng();if(!e||e instanceof String||(e.random&&(o=e.random),e.rng&&(o=e.rng())),o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var i=0;i<16;i++)t[r+i]=o[i];return t||Ye.unparse(o)};var Xe={},Ge={};Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.v35=void 0;const Ze=Ue,et=Se,tt=ke;Ge.v35=(e,t,n)=>(e,r,o,i=0)=>{if("string"==typeof e&&(e=tt.stringToBytes(e)),"string"==typeof r&&(r=et.parse(r)),r&&16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let s=new Uint8Array(16+e.length);if(s.set(r),s.set(e,r.length),s=tt.stringToBytes(n(tt.bytesToString(s))),s[6]=15&s[6]|t,s[8]=63&s[8]|128,o)for(let e=0;e<16;++e)o[i+e]=s[e];return o||Ze.stringify(s)};var nt={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.any_hmac_sha1=e.b64_hmac_sha1=e.hex_hmac_sha1=e.any_sha1=e.b64_sha1=e.hex_sha1=void 0;let t=0,n="";e.hex_sha1=e=>i(r(c(e))),e.default=e.hex_sha1;e.b64_sha1=e=>s(r(c(e)));e.any_sha1=(e,t)=>a(r(c(e)),t);e.hex_hmac_sha1=(e,t)=>i(o(c(e),c(t)));e.b64_hmac_sha1=(e,t)=>s(o(c(e),c(t)));e.any_hmac_sha1=(e,t,n)=>a(o(c(e),c(t)),n);const r=e=>u(p(l(e),8*e.length)),o=(e,t)=>{let n=l(e);n.length>16&&(n=p(n,8*e.length));let r=Array(16),o=Array(16);for(var i=0;i<16;i++)r[i]=909522486^n[i],o[i]=1549556828^n[i];var s=p(r.concat(l(t)),512+8*t.length);return u(p(o.concat(s),672))},i=e=>{for(var n,r=t?"0123456789ABCDEF":"0123456789abcdef",o="",i=0;i<e.length;i++)n=e.charCodeAt(i),o+=r.charAt(n>>>4&15)+r.charAt(15&n);return o},s=e=>{for(var t="",r=e.length,o=0;o<r;o+=3)for(var i=e.charCodeAt(o)<<16|(o+1<r?e.charCodeAt(o+1)<<8:0)|(o+2<r?e.charCodeAt(o+2):0),s=0;s<4;s++)8*o+6*s>8*e.length?t+=n:t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-s)&63);return t},a=(e,t)=>{var n,r,o,i,s=t.length,a=[],c=Array(Math.ceil(e.length/2));for(n=0;n<c.length;n++)c[n]=e.charCodeAt(2*n)<<8|e.charCodeAt(2*n+1);for(;c.length>0;){for(i=[],o=0,n=0;n<c.length;n++)o=(o<<16)+c[n],o-=(r=Math.floor(o/s))*s,(i.length>0||r>0)&&(i[i.length]=r);a[a.length]=o,c=i}var l="";for(n=a.length-1;n>=0;n--)l+=t.charAt(a[n]);var u=Math.ceil(8*e.length/(Math.log(t.length)/Math.log(2)));for(n=l.length;n<u;n++)l=t[0]+l;return l},c=e=>{for(var t,n,r="",o=-1;++o<e.length;)t=e.charCodeAt(o),n=o+1<e.length?e.charCodeAt(o+1):0,t>=55296&&t<=56319&&n>=56320&&n<=57343&&(t=65536+((1023&t)<<10)+(1023&n),o++),t<=127?r+=String.fromCharCode(t):t<=2047?r+=String.fromCharCode(192|t>>>6&31,128|63&t):t<=65535?r+=String.fromCharCode(224|t>>>12&15,128|t>>>6&63,128|63&t):t<=2097151&&(r+=String.fromCharCode(240|t>>>18&7,128|t>>>12&63,128|t>>>6&63,128|63&t));return r},l=e=>{for(var t=Array(e.length>>2),n=0;n<t.length;n++)t[n]=0;for(n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t},u=e=>{for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t},p=(e,t)=>{e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n=Array(80),r=1732584193,o=-271733879,i=-1732584194,s=271733878,a=-1009589776,c=0;c<e.length;c+=16){for(var l=r,u=o,p=i,g=s,y=a,b=0;b<80;b++){n[b]=b<16?e[c+b]:m(n[b-3]^n[b-8]^n[b-14]^n[b-16],1);let t=h(h(m(r,5),d(b,o,i,s)),h(h(a,n[b]),f(b)));a=s,s=i,i=m(o,30),o=r,r=t}r=h(r,l),o=h(o,u),i=h(i,p),s=h(s,g),a=h(a,y)}return[r,o,i,s,a]},d=(e,t,n,r)=>e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r,f=e=>e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514,h=(e,t)=>{var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},m=(e,t)=>e<<t|e>>>32-t}(nt);var rt=O&&O.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.v5=void 0;const ot=Ge,it=rt(nt);Xe.v5=ot.v35("v5",80,it.default),Object.defineProperty(Ce,"__esModule",{value:!0});const st=Se,at=Oe,ct=xe,lt=je,ut=Fe,pt=Je,dt=Xe,ft=ke;var ht=Ce.default={parse:st.parse,unparse:at.unparse,validate:ct.validate,version:lt.version,v1:ut.v1,v4:pt.v4,v5:dt.v5,NIL:ft.NIL,DNS:ft.DNS,URL:ft.URL,OID:ft.OID,X500:ft.X500};const mt=()=>ht.v4().toString();var gt={exports:{}},yt=1e3,bt=6e4,vt=60*bt,_t=24*vt,wt=7*_t,Ct=365.25*_t,St=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Ct;case"weeks":case"week":case"w":return n*wt;case"days":case"day":case"d":return n*_t;case"hours":case"hour":case"hrs":case"hr":case"h":return n*vt;case"minutes":case"minute":case"mins":case"min":case"m":return n*bt;case"seconds":case"second":case"secs":case"sec":case"s":return n*yt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=_t)return kt(e,t,_t,"day");if(t>=vt)return kt(e,t,vt,"hour");if(t>=bt)return kt(e,t,bt,"minute");if(t>=yt)return kt(e,t,yt,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=_t)return Math.round(e/_t)+"d";if(t>=vt)return Math.round(e/vt)+"h";if(t>=bt)return Math.round(e/bt)+"m";if(t>=yt)return Math.round(e/yt)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function kt(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}var Et=function(e){function t(e){let r,o,i,s=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),i=o-(r||o);n.diff=i,n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,o)=>{if("%%"===r)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];r=i.call(n,t),e.splice(s,1),s--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=St,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(o=r))})),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Et(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(gt,gt.exports);var Rt=gt.exports;const It="sg";var At;!function(e){e.HTTP="https://api.{region}.amity.co",e.MQTT="wss://sse.{region}.amity.co:443/mqtt"}(At||(At={}));const Ot=(e,t)=>e.replace("{region}",t);var Tt={exports:{}},xt=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},Pt=xt,Mt=Object.prototype.toString;function Bt(e){return"[object Array]"===Mt.call(e)}function jt(e){return void 0===e}function Nt(e){return null!==e&&"object"==typeof e}function Ft(e){if("[object Object]"!==Mt.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Ut(e){return"[object Function]"===Mt.call(e)}function Lt(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),Bt(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var Dt={isArray:Bt,isArrayBuffer:function(e){return"[object ArrayBuffer]"===Mt.call(e)},isBuffer:function(e){return null!==e&&!jt(e)&&null!==e.constructor&&!jt(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Nt,isPlainObject:Ft,isUndefined:jt,isDate:function(e){return"[object Date]"===Mt.call(e)},isFile:function(e){return"[object File]"===Mt.call(e)},isBlob:function(e){return"[object Blob]"===Mt.call(e)},isFunction:Ut,isStream:function(e){return Nt(e)&&Ut(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:Lt,merge:function e(){var t={};function n(n,r){Ft(t[r])&&Ft(n)?t[r]=e(t[r],n):Ft(n)?t[r]=e({},n):Bt(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)Lt(arguments[r],n);return t},extend:function(e,t,n){return Lt(t,(function(t,r){e[r]=n&&"function"==typeof t?Pt(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}},qt=Dt;function $t(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Ht=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(qt.isURLSearchParams(t))r=t.toString();else{var o=[];qt.forEach(t,(function(e,t){null!=e&&(qt.isArray(e)?t+="[]":e=[e],qt.forEach(e,(function(e){qt.isDate(e)?e=e.toISOString():qt.isObject(e)&&(e=JSON.stringify(e)),o.push($t(t)+"="+$t(e))})))})),r=o.join("&")}if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e},Wt=Dt;function Vt(){this.handlers=[]}Vt.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},Vt.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},Vt.prototype.forEach=function(e){Wt.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var Kt=Vt,zt=Dt,Jt=function(e){return!(!e||!e.__CANCEL__)},Yt=Dt,Qt=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},Xt=function(e,t,n,r,o){var i=new Error(e);return Qt(i,t,n,r,o)},Gt=Xt,Zt=Dt,en=Zt.isStandardBrowserEnv()?{write:function(e,t,n,r,o,i){var s=[];s.push(e+"="+encodeURIComponent(t)),Zt.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),Zt.isString(r)&&s.push("path="+r),Zt.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},tn=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},nn=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e},rn=Dt,on=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],sn=Dt,an=sn.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=sn.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},cn=Dt,ln=function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(Gt("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)},un=en,pn=Ht,dn=function(e,t){return e&&!tn(t)?nn(e,t):t},fn=function(e){var t,n,r,o={};return e?(rn.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=rn.trim(e.substr(0,r)).toLowerCase(),n=rn.trim(e.substr(r+1)),t){if(o[t]&&on.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o},hn=an,mn=Xt,gn=function(e){return new Promise((function(t,n){var r=e.data,o=e.headers;cn.isFormData(r)&&delete o["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var s=e.auth.username||"",a=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(s+":"+a)}var c=dn(e.baseURL,e.url);if(i.open(e.method.toUpperCase(),pn(c,e.params,e.paramsSerializer),!0),i.timeout=e.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in i?fn(i.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:r,config:e,request:i};ln(t,n,o),i=null}},i.onabort=function(){i&&(n(mn("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){n(mn("Network Error",e,null,i)),i=null},i.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(mn(t,e,"ECONNABORTED",i)),i=null},cn.isStandardBrowserEnv()){var l=(e.withCredentials||hn(c))&&e.xsrfCookieName?un.read(e.xsrfCookieName):void 0;l&&(o[e.xsrfHeaderName]=l)}if("setRequestHeader"in i&&cn.forEach(o,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete o[t]:i.setRequestHeader(t,e)})),cn.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),e.responseType)try{i.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&i.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){i&&(i.abort(),n(e),i=null)})),r||(r=null),i.send(r)}))},yn=Dt,bn=function(e,t){Yt.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},vn={"Content-Type":"application/x-www-form-urlencoded"};function _n(e,t){!yn.isUndefined(e)&&yn.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var wn,Cn={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(wn=gn),wn),transformRequest:[function(e,t){return bn(t,"Accept"),bn(t,"Content-Type"),yn.isFormData(e)||yn.isArrayBuffer(e)||yn.isBuffer(e)||yn.isStream(e)||yn.isFile(e)||yn.isBlob(e)?e:yn.isArrayBufferView(e)?e.buffer:yn.isURLSearchParams(e)?(_n(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):yn.isObject(e)?(_n(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};Cn.headers={common:{Accept:"application/json, text/plain, */*"}},yn.forEach(["delete","get","head"],(function(e){Cn.headers[e]={}})),yn.forEach(["post","put","patch"],(function(e){Cn.headers[e]=yn.merge(vn)}));var Sn=Cn,kn=Dt,En=function(e,t,n){return zt.forEach(n,(function(n){e=n(e,t)})),e},Rn=Jt,In=Sn;function An(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var On=Dt,Tn=function(e,t){t=t||{};var n={},r=["url","method","data"],o=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function a(e,t){return On.isPlainObject(e)&&On.isPlainObject(t)?On.merge(e,t):On.isPlainObject(t)?On.merge({},t):On.isArray(t)?t.slice():t}function c(r){On.isUndefined(t[r])?On.isUndefined(e[r])||(n[r]=a(void 0,e[r])):n[r]=a(e[r],t[r])}On.forEach(r,(function(e){On.isUndefined(t[e])||(n[e]=a(void 0,t[e]))})),On.forEach(o,c),On.forEach(i,(function(r){On.isUndefined(t[r])?On.isUndefined(e[r])||(n[r]=a(void 0,e[r])):n[r]=a(void 0,t[r])})),On.forEach(s,(function(r){r in t?n[r]=a(e[r],t[r]):r in e&&(n[r]=a(void 0,e[r]))}));var l=r.concat(o).concat(i).concat(s),u=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return On.forEach(u,c),n},xn=Dt,Pn=Ht,Mn=Kt,Bn=function(e){return An(e),e.headers=e.headers||{},e.data=En(e.data,e.headers,e.transformRequest),e.headers=kn.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),kn.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||In.adapter)(e).then((function(t){return An(e),t.data=En(t.data,t.headers,e.transformResponse),t}),(function(t){return Rn(t)||(An(e),t&&t.response&&(t.response.data=En(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},jn=Tn;function Nn(e){this.defaults=e,this.interceptors={request:new Mn,response:new Mn}}Nn.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=jn(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Bn,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},Nn.prototype.getUri=function(e){return e=jn(this.defaults,e),Pn(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},xn.forEach(["delete","get","head","options"],(function(e){Nn.prototype[e]=function(t,n){return this.request(jn(n||{},{method:e,url:t,data:(n||{}).data}))}})),xn.forEach(["post","put","patch"],(function(e){Nn.prototype[e]=function(t,n,r){return this.request(jn(r||{},{method:e,url:t,data:n}))}}));var Fn=Nn;function Un(e){this.message=e}Un.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Un.prototype.__CANCEL__=!0;var Ln=Un,Dn=Ln;function qn(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new Dn(e),t(n.reason))}))}qn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},qn.source=function(){var e;return{token:new qn((function(t){e=t})),cancel:e}};var $n=qn,Hn=Dt,Wn=xt,Vn=Fn,Kn=Tn;function zn(e){var t=new Vn(e),n=Wn(Vn.prototype.request,t);return Hn.extend(n,Vn.prototype,t),Hn.extend(n,t),n}var Jn=zn(Sn);Jn.Axios=Vn,Jn.create=function(e){return zn(Kn(Jn.defaults,e))},Jn.Cancel=Ln,Jn.CancelToken=$n,Jn.isCancel=Jt,Jn.all=function(e){return Promise.all(e)},Jn.spread=function(e){return function(t){return e.apply(null,t)}},Jn.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError},Tt.exports=Jn,Tt.exports.default=Jn;var Yn=Tt.exports,Qn={exports:{}};Qn.exports=Gn;var Xn=Qn.exports.HttpsAgent=Gn;function Gn(){}var Zn=Qn.exports;const er=e=>{if("success"===e.status)return e.data;if("fail"===e.status)throw new d(e.code);if("error"===e.status)throw new p(e.message,e.code,"error")},tr=(e,t)=>Object.entries(e).filter((([,e])=>void 0!==e)).map((([e,n])=>{const r=t?`${t}[${e}]`:e;return Array.isArray(n)?n.map((e=>`${r}[]=${e}`)).join("&"):"object"!=typeof n?`${r}=${n}`:tr(n,null!=t?t:e)})).join("&");var nr={exports:{}},rr=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,or=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],ir=function(e){var t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));for(var o=rr.exec(e||""),i={},s=14;s--;)i[or[s]]=o[s]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i},sr={exports:{}},ar={exports:{}},cr=1e3,lr=60*cr,ur=60*lr,pr=24*ur,dr=365.25*pr,fr=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*dr;case"days":case"day":case"d":return n*pr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*ur;case"minutes":case"minute":case"mins":case"min":case"m":return n*lr;case"seconds":case"second":case"secs":case"sec":case"s":return n*cr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&!1===isNaN(e))return t.long?function(e){return hr(e,pr,"day")||hr(e,ur,"hour")||hr(e,lr,"minute")||hr(e,cr,"second")||e+" ms"}(e):function(e){if(e>=pr)return Math.round(e/pr)+"d";if(e>=ur)return Math.round(e/ur)+"h";if(e>=lr)return Math.round(e/lr)+"m";if(e>=cr)return Math.round(e/cr)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function hr(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}!function(e,t){function n(e){var n;function o(){if(o.enabled){var e=o,r=+new Date,i=r-(n||r);e.diff=i,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;c++;var o=t.formatters[r];if("function"==typeof o){var i=s[c];n=o.call(e,i),s.splice(c,1),c--}return n})),t.formatArgs.call(e,s);var l=o.log||t.log||console.log.bind(console);l.apply(e,s)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),o.destroy=r,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var i=t.instances[n];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=fr,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(ar,ar.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=ar.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))})),e.splice(i,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(sr,sr.exports);var mr=ir,gr=sr.exports("socket.io-client:url"),yr=function(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(gr("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),gr("parse %s",e),n=mr(e));n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443"));n.path=n.path||"/";var r=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port,n.href=n.protocol+"://"+r+(t&&t.port===n.port?"":":"+n.port),n};var br={},vr={exports:{}},_r={exports:{}};!function(e,t){function n(e){var n;function o(){if(o.enabled){var e=o,r=+new Date,i=r-(n||r);e.diff=i,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;c++;var o=t.formatters[r];if("function"==typeof o){var i=s[c];n=o.call(e,i),s.splice(c,1),c--}return n})),t.formatArgs.call(e,s);var l=o.log||t.log||console.log.bind(console);l.apply(e,s)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),o.destroy=r,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var i=t.instances[n];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=fr,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(_r,_r.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=_r.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))})),e.splice(i,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(vr,vr.exports);var wr={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(wr);var Cr={},Sr={}.toString,kr=Array.isArray||function(e){return"[object Array]"==Sr.call(e)},Er=function(e){return Rr&&Buffer.isBuffer(e)||Ir&&(e instanceof ArrayBuffer||function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer}(e))},Rr="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,Ir="function"==typeof ArrayBuffer;var Ar=kr,Or=Er,Tr=Object.prototype.toString,xr="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Tr.call(Blob),Pr="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Tr.call(File);function Mr(e,t){if(!e)return e;if(Or(e)){var n={_placeholder:!0,num:t.length};return t.push(e),n}if(Ar(e)){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=Mr(e[o],t);return r}if("object"==typeof e&&!(e instanceof Date)){r={};for(var i in e)r[i]=Mr(e[i],t);return r}return e}function Br(e,t){if(!e)return e;if(e&&e._placeholder)return t[e.num];if(Ar(e))for(var n=0;n<e.length;n++)e[n]=Br(e[n],t);else if("object"==typeof e)for(var r in e)e[r]=Br(e[r],t);return e}Cr.deconstructPacket=function(e){var t=[],n=e.data,r=e;return r.data=Mr(n,t),r.attachments=t.length,{packet:r,buffers:t}},Cr.reconstructPacket=function(e,t){return e.data=Br(e.data,t),e.attachments=void 0,e},Cr.removeBlobs=function(e,t){var n=0,r=e;!function e(o,i,s){if(!o)return o;if(xr&&o instanceof Blob||Pr&&o instanceof File){n++;var a=new FileReader;a.onload=function(){s?s[i]=this.result:r=this.result,--n||t(r)},a.readAsArrayBuffer(o)}else if(Ar(o))for(var c=0;c<o.length;c++)e(o[c],c,o);else if("object"==typeof o&&!Or(o))for(var l in o)e(o[l],l,o)}(r),n||t(r)},function(e){var t=vr.exports("socket.io-parser"),n=wr.exports,r=Cr,o=kr,i=Er;function s(){}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=s,e.Decoder=l;var a=e.ERROR+'"encode error"';function c(n){var r=""+n.type;if(e.BINARY_EVENT!==n.type&&e.BINARY_ACK!==n.type||(r+=n.attachments+"-"),n.nsp&&"/"!==n.nsp&&(r+=n.nsp+","),null!=n.id&&(r+=n.id),null!=n.data){var o=function(e){try{return JSON.stringify(e)}catch(e){return!1}}(n.data);if(!1===o)return a;r+=o}return t("encoded %j as %s",n,r),r}function l(){this.reconstructor=null}function u(e){this.reconPack=e,this.buffers=[]}function p(t){return{type:e.ERROR,data:"parser error: "+t}}s.prototype.encode=function(n,o){(t("encoding packet %j",n),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type)?function(e,t){function n(e){var n=r.deconstructPacket(e),o=c(n.packet),i=n.buffers;i.unshift(o),t(i)}r.removeBlobs(e,n)}(n,o):o([c(n)])},n(l.prototype),l.prototype.add=function(n){var r;if("string"==typeof n)r=function(n){var r=0,i={type:Number(n.charAt(0))};if(null==e.types[i.type])return p("unknown packet type "+i.type);if(e.BINARY_EVENT===i.type||e.BINARY_ACK===i.type){for(var s=r+1;"-"!==n.charAt(++r)&&r!=n.length;);var a=n.substring(s,r);if(a!=Number(a)||"-"!==n.charAt(r))throw new Error("Illegal attachments");i.attachments=Number(a)}if("/"===n.charAt(r+1)){for(s=r+1;++r;){if(","===(l=n.charAt(r)))break;if(r===n.length)break}i.nsp=n.substring(s,r)}else i.nsp="/";var c=n.charAt(r+1);if(""!==c&&Number(c)==c){for(s=r+1;++r;){var l;if(null==(l=n.charAt(r))||Number(l)!=l){--r;break}if(r===n.length)break}i.id=Number(n.substring(s,r+1))}if(n.charAt(++r)){var u=function(e){try{return JSON.parse(e)}catch(e){return!1}}(n.substr(r));if(!(!1!==u&&(i.type===e.ERROR||o(u))))return p("invalid payload");i.data=u}return t("decoded %s as %j",n,i),i}(n),e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type?(this.reconstructor=new u(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!i(n)&&!n.base64)throw new Error("Unknown type: "+n);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(r=this.reconstructor.takeBinaryData(n))&&(this.reconstructor=null,this.emit("decoded",r))}},l.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},u.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=r.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},u.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}}(br);var jr={exports:{}},Nr={},Fr={exports:{}};try{Fr.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){Fr.exports=!1}var Ur=Fr.exports,Lr=function(e){var t=e.xdomain,n=e.xscheme,r=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Ur))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!n&&r)return new XDomainRequest}catch(e){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}},Dr={exports:{}},qr={},$r=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t},Hr={}.toString,Wr=Array.isArray||function(e){return"[object Array]"==Hr.call(e)},Vr=Object.prototype.toString,Kr="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Vr.call(Blob),zr="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Vr.call(File),Jr=function e(t){if(!t||"object"!=typeof t)return!1;if(Wr(t)){for(var n=0,r=t.length;n<r;n++)if(e(t[n]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(t)||"function"==typeof ArrayBuffer&&t instanceof ArrayBuffer||Kr&&t instanceof Blob||zr&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return e(t.toJSON(),!0);for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&e(t[o]))return!0;return!1};var Yr=function(e,t,n){var r=e.byteLength;if(t=t||0,n=n||r,e.slice)return e.slice(t,n);if(t<0&&(t+=r),n<0&&(n+=r),n>r&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(e),i=new Uint8Array(n-t),s=t,a=0;s<n;s++,a++)i[a]=o[s];return i.buffer},Qr=function(e,t,n){var r=!1;return n=n||Xr,o.count=e,0===e?t():o;function o(e,i){if(o.count<=0)throw new Error("after called too many times");--o.count,e?(r=!0,t(e),t=n):0!==o.count||r||t(null,i)}};function Xr(){}
2
+ /*! https://mths.be/utf8js v2.1.2 by @mathias */var Gr,Zr,eo,to=String.fromCharCode;function no(e){for(var t,n,r=[],o=0,i=e.length;o<i;)(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<i?56320==(64512&(n=e.charCodeAt(o++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),o--):r.push(t);return r}function ro(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function oo(e,t){return to(e>>t&63|128)}function io(e,t){if(0==(4294967168&e))return to(e);var n="";return 0==(4294965248&e)?n=to(e>>6&31|192):0==(4294901760&e)?(ro(e,t)||(e=65533),n=to(e>>12&15|224),n+=oo(e,6)):0==(4292870144&e)&&(n=to(e>>18&7|240),n+=oo(e,12),n+=oo(e,6)),n+=to(63&e|128)}function so(){if(eo>=Zr)throw Error("Invalid byte index");var e=255&Gr[eo];if(eo++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function ao(e){var t,n;if(eo>Zr)throw Error("Invalid byte index");if(eo==Zr)return!1;if(t=255&Gr[eo],eo++,0==(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|so())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|so()<<6|so())>=2048)return ro(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|so()<<12|so()<<6|so())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var co={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,r=no(e),o=r.length,i=-1,s="";++i<o;)s+=io(r[i],n);return s},decode:function(e,t){var n=!1!==(t=t||{}).strict;Gr=no(e),Zr=Gr.length,eo=0;for(var r,o=[];!1!==(r=ao(n));)o.push(r);return function(e){for(var t,n=e.length,r=-1,o="";++r<n;)(t=e[r])>65535&&(o+=to((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=to(t);return o}(o)}},lo={};!function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new Uint8Array(256),n=0;n<e.length;n++)t[e.charCodeAt(n)]=n;lo.encode=function(t){var n,r=new Uint8Array(t),o=r.length,i="";for(n=0;n<o;n+=3)i+=e[r[n]>>2],i+=e[(3&r[n])<<4|r[n+1]>>4],i+=e[(15&r[n+1])<<2|r[n+2]>>6],i+=e[63&r[n+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},lo.decode=function(e){var n,r,o,i,s,a=.75*e.length,c=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var u=new ArrayBuffer(a),p=new Uint8Array(u);for(n=0;n<c;n+=4)r=t[e.charCodeAt(n)],o=t[e.charCodeAt(n+1)],i=t[e.charCodeAt(n+2)],s=t[e.charCodeAt(n+3)],p[l++]=r<<2|o>>4,p[l++]=(15&o)<<4|i>>2,p[l++]=(3&i)<<6|63&s;return u}}();var uo=void 0!==uo?uo:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,po=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),fo=po&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),ho=uo&&uo.prototype.append&&uo.prototype.getBlob;function mo(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e}))}function go(e,t){t=t||{};var n=new uo;return mo(e).forEach((function(e){n.append(e)})),t.type?n.getBlob(t.type):n.getBlob()}function yo(e,t){return new Blob(mo(e),t||{})}"undefined"!=typeof Blob&&(go.prototype=Blob.prototype,yo.prototype=Blob.prototype);var bo=po?fo?Blob:yo:ho?go:void 0;!function(e){var t,n=$r,r=Jr,o=Yr,i=Qr,s=co;"undefined"!=typeof ArrayBuffer&&(t=lo);var a="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),c="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),l=a||c;e.protocol=3;var u=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},p=n(u),d={type:"error",data:"parser error"},f=bo;function h(e,t,n){for(var r=new Array(e.length),o=i(e.length,n),s=function(e,n,o){t(n,(function(t,n){r[e]=n,o(t,r)}))},a=0;a<e.length;a++)s(a,e[a],o)}e.encodePacket=function(t,n,r,o){"function"==typeof n&&(o=n,n=!1),"function"==typeof r&&(o=r,r=null);var i=void 0===t.data?void 0:t.data.buffer||t.data;if("undefined"!=typeof ArrayBuffer&&i instanceof ArrayBuffer)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=t.data,i=new Uint8Array(o),s=new Uint8Array(1+o.byteLength);s[0]=u[t.type];for(var a=0;a<i.length;a++)s[a+1]=i[a];return r(s.buffer)}(t,n,o);if(void 0!==f&&i instanceof f)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);if(l)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=new FileReader;return o.onload=function(){e.encodePacket({type:t.type,data:o.result},n,!0,r)},o.readAsArrayBuffer(t.data)}(t,n,r);var o=new Uint8Array(1);o[0]=u[t.type];var i=new f([o.buffer,t.data]);return r(i)}(t,n,o);if(i&&i.base64)return function(t,n){var r="b"+e.packets[t.type]+t.data.data;return n(r)}(t,o);var a=u[t.type];return void 0!==t.data&&(a+=r?s.encode(String(t.data),{strict:!1}):String(t.data)),o(""+a)},e.encodeBase64Packet=function(t,n){var r,o="b"+e.packets[t.type];if(void 0!==f&&t.data instanceof f){var i=new FileReader;return i.onload=function(){var e=i.result.split(",")[1];n(o+e)},i.readAsDataURL(t.data)}try{r=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(e){for(var s=new Uint8Array(t.data),a=new Array(s.length),c=0;c<s.length;c++)a[c]=s[c];r=String.fromCharCode.apply(null,a)}return o+=btoa(r),n(o)},e.decodePacket=function(t,n,r){if(void 0===t)return d;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),n);if(r&&!1===(t=function(e){try{e=s.decode(e,{strict:!1})}catch(e){return!1}return e}(t)))return d;var i=t.charAt(0);return Number(i)==i&&p[i]?t.length>1?{type:p[i],data:t.substring(1)}:{type:p[i]}:d}i=new Uint8Array(t)[0];var a=o(t,1);return f&&"blob"===n&&(a=new f([a])),{type:p[i],data:a}},e.decodeBase64Packet=function(e,n){var r=p[e.charAt(0)];if(!t)return{type:r,data:{base64:!0,data:e.substr(1)}};var o=t.decode(e.substr(1));return"blob"===n&&f&&(o=new f([o])),{type:r,data:o}},e.encodePayload=function(t,n,o){"function"==typeof n&&(o=n,n=null);var i=r(t);if(n&&i)return f&&!l?e.encodePayloadAsBlob(t,o):e.encodePayloadAsArrayBuffer(t,o);if(!t.length)return o("0:");h(t,(function(t,r){e.encodePacket(t,!!i&&n,!1,(function(e){r(null,function(e){return e.length+":"+e}(e))}))}),(function(e,t){return o(t.join(""))}))},e.decodePayload=function(t,n,r){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,r);var o;if("function"==typeof n&&(r=n,n=null),""===t)return r(d,0,1);for(var i,s,a="",c=0,l=t.length;c<l;c++){var u=t.charAt(c);if(":"===u){if(""===a||a!=(i=Number(a)))return r(d,0,1);if(a!=(s=t.substr(c+1,i)).length)return r(d,0,1);if(s.length){if(o=e.decodePacket(s,n,!1),d.type===o.type&&d.data===o.data)return r(d,0,1);if(!1===r(o,c+i,l))return}c+=i,a=""}else a+=u}return""!==a?r(d,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,n){if(!t.length)return n(new ArrayBuffer(0));h(t,(function(t,n){e.encodePacket(t,!0,!0,(function(e){return n(null,e)}))}),(function(e,t){var r=t.reduce((function(e,t){var n;return e+(n="string"==typeof t?t.length:t.byteLength).toString().length+n+2}),0),o=new Uint8Array(r),i=0;return t.forEach((function(e){var t="string"==typeof e,n=e;if(t){for(var r=new Uint8Array(e.length),s=0;s<e.length;s++)r[s]=e.charCodeAt(s);n=r.buffer}o[i++]=t?0:1;var a=n.byteLength.toString();for(s=0;s<a.length;s++)o[i++]=parseInt(a[s]);o[i++]=255;for(r=new Uint8Array(n),s=0;s<r.length;s++)o[i++]=r[s]})),n(o.buffer)}))},e.encodePayloadAsBlob=function(t,n){h(t,(function(t,n){e.encodePacket(t,!0,!0,(function(e){var t=new Uint8Array(1);if(t[0]=1,"string"==typeof e){for(var r=new Uint8Array(e.length),o=0;o<e.length;o++)r[o]=e.charCodeAt(o);e=r.buffer,t[0]=0}var i=(e instanceof ArrayBuffer?e.byteLength:e.size).toString(),s=new Uint8Array(i.length+1);for(o=0;o<i.length;o++)s[o]=parseInt(i[o]);if(s[i.length]=255,f){var a=new f([t.buffer,s.buffer,e]);n(null,a)}}))}),(function(e,t){return n(new f(t))}))},e.decodePayloadAsBinary=function(t,n,r){"function"==typeof n&&(r=n,n=null);for(var i=t,s=[];i.byteLength>0;){for(var a=new Uint8Array(i),c=0===a[0],l="",u=1;255!==a[u];u++){if(l.length>310)return r(d,0,1);l+=a[u]}i=o(i,2+l.length),l=parseInt(l);var p=o(i,0,l);if(c)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(e){var f=new Uint8Array(p);p="";for(u=0;u<f.length;u++)p+=String.fromCharCode(f[u])}s.push(p),i=o(i,l)}var h=s.length;s.forEach((function(t,o){r(e.decodePacket(t,n,!0),o,h)}))}}(qr);var vo={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t);return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(vo);var _o=qr,wo=Co;function Co(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}(0,vo.exports)(Co.prototype),Co.prototype.onError=function(e,t){var n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},Co.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},Co.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},Co.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},Co.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},Co.prototype.onData=function(e){var t=_o.decodePacket(e,this.socket.binaryType);this.onPacket(t)},Co.prototype.onPacket=function(e){this.emit("packet",e)},Co.prototype.onClose=function(){this.readyState="closed",this.emit("close")};var So,ko={encode:function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},decode:function(e){for(var t={},n=e.split("&"),r=0,o=n.length;r<o;r++){var i=n[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}},Eo=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},Ro="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Io={},Ao=0,Oo=0;function To(e){var t="";do{t=Ro[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function xo(){var e=To(+new Date);return e!==So?(Ao=0,So=e):e+"."+To(Ao++)}for(;Oo<64;Oo++)Io[Ro[Oo]]=Oo;xo.encode=To,xo.decode=function(e){var t=0;for(Oo=0;Oo<e.length;Oo++)t=64*t+Io[e.charAt(Oo)];return t};var Po=xo,Mo={exports:{}},Bo={exports:{}};!function(e,t){function n(e){var n;function o(){if(o.enabled){var e=o,r=+new Date,i=r-(n||r);e.diff=i,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;c++;var o=t.formatters[r];if("function"==typeof o){var i=s[c];n=o.call(e,i),s.splice(c,1),c--}return n})),t.formatArgs.call(e,s);var l=o.log||t.log||console.log.bind(console);l.apply(e,s)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),o.destroy=r,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var i=t.instances[n];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=fr,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Bo,Bo.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Bo.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))})),e.splice(i,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(Mo,Mo.exports);var jo=wo,No=ko,Fo=qr,Uo=Eo,Lo=Po,Do=Mo.exports("engine.io-client:polling"),qo=Ho,$o=null!=new Lr({xdomain:!1}).responseType;function Ho(e){var t=e&&e.forceBase64;$o&&!t||(this.supportsBinary=!1),jo.call(this,e)}Uo(Ho,jo),Ho.prototype.name="polling",Ho.prototype.doOpen=function(){this.poll()},Ho.prototype.pause=function(e){var t=this;function n(){Do("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(Do("we are currently polling - waiting to pause"),r++,this.once("pollComplete",(function(){Do("pre-pause polling complete"),--r||n()}))),this.writable||(Do("we are currently writing - waiting to pause"),r++,this.once("drain",(function(){Do("pre-pause writing complete"),--r||n()})))}else n()},Ho.prototype.poll=function(){Do("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},Ho.prototype.onData=function(e){var t=this;Do("polling got data %s",e);Fo.decodePayload(e,this.socket.binaryType,(function(e,n,r){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():Do('ignoring poll - transport state "%s"',this.readyState))},Ho.prototype.doClose=function(){var e=this;function t(){Do("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(Do("transport open - closing"),t()):(Do("transport not open - deferring close"),this.once("open",t))},Ho.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};Fo.encodePayload(e,this.supportsBinary,(function(e){t.doWrite(e,n)}))},Ho.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=Lo()),this.supportsBinary||e.sid||(e.b64=1),e=No.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e};var Wo=Lr,Vo=qo,Ko=vo.exports,zo=Eo,Jo=Mo.exports("engine.io-client:polling-xhr");function Yo(){}function Qo(e){if(Vo.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,"undefined"!=typeof location){var t="https:"===location.protocol,n=location.port;n||(n=t?443:80),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==t}}function Xo(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}if(Dr.exports=Qo,Dr.exports.Request=Xo,zo(Qo,Vo),Qo.prototype.supportsBinary=!0,Qo.prototype.request=function(e){return(e=e||{}).uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new Xo(e)},Qo.prototype.doWrite=function(e,t){var n="string"!=typeof e&&void 0!==e,r=this.request({method:"POST",data:e,isBinary:n}),o=this;r.on("success",t),r.on("error",(function(e){o.onError("xhr post error",e)})),this.sendXhr=r},Qo.prototype.doPoll=function(){Jo("xhr poll");var e=this.request(),t=this;e.on("data",(function(e){t.onData(e)})),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e},Ko(Xo.prototype),Xo.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var t=this.xhr=new Wo(e),n=this;try{Jo("xhr open %s: %s",this.method,this.uri),t.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var r in t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(r)&&t.setRequestHeader(r,this.extraHeaders[r])}catch(e){}if("POST"===this.method)try{this.isBinary?t.setRequestHeader("Content-type","application/octet-stream"):t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=!0),this.requestTimeout&&(t.timeout=this.requestTimeout),this.hasXDR()?(t.onload=function(){n.onLoad()},t.onerror=function(){n.onError(t.responseText)}):t.onreadystatechange=function(){if(2===t.readyState)try{var e=t.getResponseHeader("Content-Type");n.supportsBinary&&"application/octet-stream"===e&&(t.responseType="arraybuffer")}catch(e){}4===t.readyState&&(200===t.status||1223===t.status?n.onLoad():setTimeout((function(){n.onError(t.status)}),0))},Jo("xhr data %s",this.data),t.send(this.data)}catch(e){return void setTimeout((function(){n.onError(e)}),0)}"undefined"!=typeof document&&(this.index=Xo.requestsCount++,Xo.requests[this.index]=this)},Xo.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},Xo.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},Xo.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},Xo.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=Yo:this.xhr.onreadystatechange=Yo,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Xo.requests[this.index],this.xhr=null}},Xo.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(e){}e="application/octet-stream"===t&&this.xhr.response||this.xhr.responseText}catch(e){this.onError(e)}null!=e&&this.onData(e)},Xo.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},Xo.prototype.abort=function(){this.cleanup()},Xo.requestsCount=0,Xo.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Zo);else if("function"==typeof addEventListener){var Go="onpagehide"in self?"pagehide":"unload";addEventListener(Go,Zo,!1)}function Zo(){for(var e in Xo.requests)Xo.requests.hasOwnProperty(e)&&Xo.requests[e].abort()}var ei,ti=qo,ni=ai,ri=/\n/g,oi=/\\n/g;function ii(){}function si(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==O?O:{}}function ai(e){if(ti.call(this,e),this.query=this.query||{},!ei){var t=si();ei=t.___eio=t.___eio||[]}this.index=ei.length;var n=this;ei.push((function(e){n.onData(e)})),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",(function(){n.script&&(n.script.onerror=ii)}),!1)}Eo(ai,ti),ai.prototype.supportsBinary=!1,ai.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),ti.prototype.doClose.call(this)},ai.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(t,n):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)}),100)},ai.prototype.doWrite=function(e,t){var n=this;if(!this.form){var r,o=document.createElement("form"),i=document.createElement("textarea"),s=this.iframeId="eio_iframe_"+this.index;o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=s,o.method="POST",o.setAttribute("accept-charset","utf-8"),i.name="d",o.appendChild(i),document.body.appendChild(o),this.form=o,this.area=i}function a(){c(),t()}function c(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(e){n.onError("jsonp polling iframe removal error",e)}try{var e='<iframe src="javascript:0" name="'+n.iframeId+'">';r=document.createElement(e)}catch(e){(r=document.createElement("iframe")).name=n.iframeId,r.src="javascript:0"}r.id=n.iframeId,n.form.appendChild(r),n.iframe=r}this.form.action=this.uri(),c(),e=e.replace(oi,"\\\n"),this.area.value=e.replace(ri,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&a()}:this.iframe.onload=a};var ci,li,ui=T(Object.freeze({__proto__:null,default:{}})),pi=wo,di=qr,fi=ko,hi=Eo,mi=Po,gi=Mo.exports("engine.io-client:websocket");if("undefined"!=typeof WebSocket)ci=WebSocket;else if("undefined"!=typeof self)ci=self.WebSocket||self.MozWebSocket;else try{li=ui}catch(e){}var yi=ci||li,bi=vi;function vi(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=ci&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(yi=li),pi.call(this,e)}hi(vi,pi),vi.prototype.name="websocket",vi.prototype.supportsBinary=!0,vi.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?t?new yi(e,t):new yi(e):new yi(e,t,n)}catch(e){return this.emit("error",e)}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()}},vi.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},vi.prototype.write=function(e){var t=this;this.writable=!1;for(var n=e.length,r=0,o=n;r<o;r++)!function(e){di.encodePacket(e,t.supportsBinary,(function(r){if(!t.usingBrowserWebSocket){var o={};if(e.options&&(o.compress=e.options.compress),t.perMessageDeflate)("string"==typeof r?Buffer.byteLength(r):r.length)<t.perMessageDeflate.threshold&&(o.compress=!1)}try{t.usingBrowserWebSocket?t.ws.send(r):t.ws.send(r,o)}catch(e){gi("websocket closed before onclose event")}--n||i()}))}(e[r]);function i(){t.emit("flush"),setTimeout((function(){t.writable=!0,t.emit("drain")}),0)}},vi.prototype.onClose=function(){pi.prototype.onClose.call(this)},vi.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},vi.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=mi()),this.supportsBinary||(e.b64=1),(e=fi.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e},vi.prototype.check=function(){return!(!yi||"__initialize"in yi&&this.name===vi.prototype.name)};var _i=Lr,wi=Dr.exports,Ci=ni,Si=bi;Nr.polling=function(e){var t=!1,n=!1,r=!1!==e.jsonp;if("undefined"!=typeof location){var o="https:"===location.protocol,i=location.port;i||(i=o?443:80),t=e.hostname!==location.hostname||i!==e.port,n=e.secure!==o}if(e.xdomain=t,e.xscheme=n,"open"in new _i(e)&&!e.forceJSONP)return new wi(e);if(!r)throw new Error("JSONP disabled");return new Ci(e)},Nr.websocket=Si;var ki=[].indexOf,Ei=function(e,t){if(ki)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},Ri=Nr,Ii=vo.exports,Ai=Mo.exports("engine.io-client:socket"),Oi=Ei,Ti=qr,xi=ir,Pi=ko,Mi=Bi;function Bi(e,t){if(!(this instanceof Bi))return new Bi(e,t);t=t||{},e&&"object"==typeof e&&(t=e,e=null),e?(e=xi(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=xi(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=Pi.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}Bi.priorWebsocketSuccess=!1,Ii(Bi.prototype),Bi.protocol=Ti.protocol,Bi.Socket=Bi,Bi.Transport=wo,Bi.transports=Nr,Bi.parser=qr,Bi.prototype.createTransport=function(e){Ai('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=Ti.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new Ri[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},Bi.prototype.open=function(){var e;if(this.rememberUpgrade&&Bi.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},Bi.prototype.setTransport=function(e){Ai("setting transport %s",e.name);var t=this;this.transport&&(Ai("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},Bi.prototype.probe=function(e){Ai('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function o(){if(r.onlyBinaryUpgrades){var o=!this.supportsBinary&&r.transport.supportsBinary;n=n||o}n||(Ai('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(o){if(!n)if("pong"===o.type&&"probe"===o.data){if(Ai('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;Bi.priorWebsocketSuccess="websocket"===t.name,Ai('pausing current transport "%s"',r.transport.name),r.transport.pause((function(){n||"closed"!==r.readyState&&(Ai("changing transport and sending upgrade packet"),u(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())}))}else{Ai('probe transport "%s" failed',e);var i=new Error("probe error");i.transport=t.name,r.emit("upgradeError",i)}})))}function i(){n||(n=!0,u(),t.close(),t=null)}function s(n){var o=new Error("probe error: "+n);o.transport=t.name,i(),Ai('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",o)}function a(){s("transport closed")}function c(){s("socket closed")}function l(e){t&&e.name!==t.name&&(Ai('"%s" works - aborting "%s"',e.name,t.name),i())}function u(){t.removeListener("open",o),t.removeListener("error",s),t.removeListener("close",a),r.removeListener("close",c),r.removeListener("upgrading",l)}Bi.priorWebsocketSuccess=!1,t.once("open",o),t.once("error",s),t.once("close",a),this.once("close",c),this.once("upgrading",l),t.open()},Bi.prototype.onOpen=function(){if(Ai("socket open"),this.readyState="open",Bi.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){Ai("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},Bi.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(Ai('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else Ai('packet received with socket readyState "%s"',this.readyState)},Bi.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},Bi.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout((function(){"closed"!==t.readyState&&t.onClose("ping timeout")}),e||t.pingInterval+t.pingTimeout)},Bi.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout((function(){Ai("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)}),e.pingInterval)},Bi.prototype.ping=function(){var e=this;this.sendPacket("ping",(function(){e.emit("ping")}))},Bi.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},Bi.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(Ai("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},Bi.prototype.write=Bi.prototype.send=function(e,t,n){return this.sendPacket("message",e,t,n),this},Bi.prototype.sendPacket=function(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var o={type:e,data:t,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}},Bi.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?r():t()})):this.upgrading?r():t()}function t(){e.onClose("forced close"),Ai("socket closing - telling transport to close"),e.transport.close()}function n(){e.removeListener("upgrade",n),e.removeListener("upgradeError",n),t()}function r(){e.once("upgrade",n),e.once("upgradeError",n)}return this},Bi.prototype.onError=function(e){Ai("socket error %j",e),Bi.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},Bi.prototype.onClose=function(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){Ai('socket close with reason: "%s"',e);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",e,t),this.writeBuffer=[],this.prevBufferLen=0}},Bi.prototype.filterUpgrades=function(e){for(var t=[],n=0,r=e.length;n<r;n++)~Oi(this.transports,e[n])&&t.push(e[n]);return t},jr.exports=Mi,jr.exports.parser=qr;var ji={exports:{}},Ni={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t);return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(Ni);var Fi=function(e,t){for(var n=[],r=(t=t||0)||0;r<e.length;r++)n[r-t]=e[r];return n};var Ui=function(e,t,n){return e.on(t,n),{destroy:function(){e.removeListener(t,n)}}};var Li=[].slice,Di=function(e,t){if("string"==typeof t&&(t=e[t]),"function"!=typeof t)throw new Error("bind() requires a function");var n=Li.call(arguments,2);return function(){return t.apply(e,n.concat(Li.call(arguments)))}};!function(e,t){var n=br,r=Ni.exports,o=Fi,i=Ui,s=Di,a=sr.exports("socket.io-client:socket"),c=ko,l=Jr;e.exports=d;var u={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},p=r.prototype.emit;function d(e,t,n){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}r(d.prototype),d.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[i(e,"open",s(this,"onopen")),i(e,"packet",s(this,"onpacket")),i(e,"close",s(this,"onclose"))]}},d.prototype.open=d.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},d.prototype.send=function(){var e=o(arguments);return e.unshift("message"),this.emit.apply(this,e),this},d.prototype.emit=function(e){if(u.hasOwnProperty(e))return p.apply(this,arguments),this;var t=o(arguments),r={type:(void 0!==this.flags.binary?this.flags.binary:l(t))?n.BINARY_EVENT:n.EVENT,data:t,options:{}};return r.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(a("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),r.id=this.ids++),this.connected?this.packet(r):this.sendBuffer.push(r),this.flags={},this},d.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},d.prototype.onopen=function(){if(a("transport is open - connecting"),"/"!==this.nsp)if(this.query){var e="object"==typeof this.query?c.encode(this.query):this.query;a("sending connect packet with query %s",e),this.packet({type:n.CONNECT,query:e})}else this.packet({type:n.CONNECT})},d.prototype.onclose=function(e){a("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},d.prototype.onpacket=function(e){var t=e.nsp===this.nsp,r=e.type===n.ERROR&&"/"===e.nsp;if(t||r)switch(e.type){case n.CONNECT:this.onconnect();break;case n.EVENT:case n.BINARY_EVENT:this.onevent(e);break;case n.ACK:case n.BINARY_ACK:this.onack(e);break;case n.DISCONNECT:this.ondisconnect();break;case n.ERROR:this.emit("error",e.data)}},d.prototype.onevent=function(e){var t=e.data||[];a("emitting event %j",t),null!=e.id&&(a("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?p.apply(this,t):this.receiveBuffer.push(t)},d.prototype.ack=function(e){var t=this,r=!1;return function(){if(!r){r=!0;var i=o(arguments);a("sending ack %j",i),t.packet({type:l(i)?n.BINARY_ACK:n.ACK,id:e,data:i})}}},d.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(a("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):a("bad ack %s",e.id)},d.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},d.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++)p.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},d.prototype.ondisconnect=function(){a("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},d.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},d.prototype.close=d.prototype.disconnect=function(){return this.connected&&(a("performing disconnect (%s)",this.nsp),this.packet({type:n.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},d.prototype.compress=function(e){return this.flags.compress=e,this},d.prototype.binary=function(e){return this.flags.binary=e,this}}(ji);var qi=$i;function $i(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}$i.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},$i.prototype.reset=function(){this.attempts=0},$i.prototype.setMin=function(e){this.ms=e},$i.prototype.setMax=function(e){this.max=e},$i.prototype.setJitter=function(e){this.jitter=e};var Hi=jr.exports,Wi=ji.exports,Vi=Ni.exports,Ki=br,zi=Ui,Ji=Di,Yi=sr.exports("socket.io-client:manager"),Qi=Ei,Xi=qi,Gi=Object.prototype.hasOwnProperty,Zi=es;function es(e,t){if(!(this instanceof es))return new es(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new Xi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||Ki;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}es.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)Gi.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},es.prototype.updateSocketIds=function(){for(var e in this.nsps)Gi.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},es.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},Vi(es.prototype),es.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},es.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},es.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},es.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},es.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},es.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},es.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},es.prototype.open=es.prototype.connect=function(e,t){if(Yi("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;Yi("opening %s",this.uri),this.engine=Hi(this.uri,this.opts);var n=this.engine,r=this;this.readyState="opening",this.skipReconnect=!1;var o=zi(n,"open",(function(){r.onopen(),e&&e()})),i=zi(n,"error",(function(t){if(Yi("connect_error"),r.cleanup(),r.readyState="closed",r.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else r.maybeReconnectOnOpen()}));if(!1!==this._timeout){var s=this._timeout;Yi("connect attempt will timeout after %d",s);var a=setTimeout((function(){Yi("connect attempt timed out after %d",s),o.destroy(),n.close(),n.emit("error","timeout"),r.emitAll("connect_timeout",s)}),s);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(o),this.subs.push(i),this},es.prototype.onopen=function(){Yi("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(zi(e,"data",Ji(this,"ondata"))),this.subs.push(zi(e,"ping",Ji(this,"onping"))),this.subs.push(zi(e,"pong",Ji(this,"onpong"))),this.subs.push(zi(e,"error",Ji(this,"onerror"))),this.subs.push(zi(e,"close",Ji(this,"onclose"))),this.subs.push(zi(this.decoder,"decoded",Ji(this,"ondecoded")))},es.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},es.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},es.prototype.ondata=function(e){this.decoder.add(e)},es.prototype.ondecoded=function(e){this.emit("packet",e)},es.prototype.onerror=function(e){Yi("error",e),this.emitAll("error",e)},es.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new Wi(this,e,t),this.nsps[e]=n;var r=this;n.on("connecting",o),n.on("connect",(function(){n.id=r.generateId(e)})),this.autoConnect&&o()}function o(){~Qi(r.connecting,n)||r.connecting.push(n)}return n},es.prototype.destroy=function(e){var t=Qi(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},es.prototype.packet=function(e){Yi("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,(function(n){for(var r=0;r<n.length;r++)t.engine.write(n[r],e.options);t.encoding=!1,t.processPacketQueue()})))},es.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},es.prototype.cleanup=function(){Yi("cleanup");for(var e=this.subs.length,t=0;t<e;t++){this.subs.shift().destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},es.prototype.close=es.prototype.disconnect=function(){Yi("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},es.prototype.onclose=function(e){Yi("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},es.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)Yi("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();Yi("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout((function(){e.skipReconnect||(Yi("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(Yi("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(Yi("reconnect success"),e.onreconnect())})))}),t);this.subs.push({destroy:function(){clearTimeout(n)}})}},es.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)},function(e,t){var n=yr,r=br,o=Zi,i=sr.exports("socket.io-client");e.exports=t=a;var s=t.managers={};function a(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,a=n(e),c=a.source,l=a.id,u=a.path,p=s[l]&&u in s[l].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||p?(i("ignoring socket cache for %s",c),r=o(c,t)):(s[l]||(i("new io instance for %s",c),s[l]=o(c,t)),r=s[l]),a.query&&!t.query&&(t.query=a.query),r.socket(a.path,t)}t.protocol=r.protocol,t.connect=a,t.Manager=Zi,t.Socket=ji.exports}(nr,nr.exports);var ts=nr.exports;var ns={exports:{}},rs=function(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var r in n)os.call(n,r)&&(e[r]=n[r])}return e},os=Object.prototype.hasOwnProperty;var is={exports:{}},ss=s.default.EventEmitter;function as(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function cs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ls(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var us=a.default.Buffer,ps=ui.inspect,ds=ps&&ps.custom||"inspect";var fs=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,n,r;return t=e,n=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return us.alloc(0);for(var t,n,r,o=us.allocUnsafe(e>>>0),i=this.head,s=0;i;)t=i.data,n=o,r=s,us.prototype.copy.call(t,n,r),s+=i.data.length,i=i.next;return o}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var o=t.data,i=e>o.length?o.length:e;if(i===o.length?r+=o:r+=o.slice(0,e),0==(e-=i)){i===o.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=o.slice(i));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=us.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var o=n.data,i=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,i),0==(e-=i)){i===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(i));break}++r}return this.length-=r,t}},{key:ds,value:function(e,t){return ps(this,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?as(Object(n),!0).forEach((function(t){cs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):as(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}],n&&ls(t.prototype,n),r&&ls(t,r),e}();function hs(e,t){gs(e,t),ms(e)}function ms(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function gs(e,t){e.emit("error",t)}var ys={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return r||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(gs,this,e)):process.nextTick(gs,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?process.nextTick(ms,n):(n._writableState.errorEmitted=!0,process.nextTick(hs,n,e)):process.nextTick(hs,n,e):t?(process.nextTick(ms,n),t(e)):process.nextTick(ms,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},bs={};var vs={};function _s(e,t,n){n||(n=Error);var r=function(e){var n,r;function o(n,r,o){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,o))||this}return r=e,(n=o).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,o}(n);r.prototype.name=n.name,r.prototype.code=e,vs[e]=r}function ws(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}_s("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),_s("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,o,i,s;if("string"==typeof t&&(o="not ",t.substr(!i||i<0?0:+i,o.length)===o)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))s="The ".concat(e," ").concat(r," ").concat(ws(t,"type"));else{var a=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(a," ").concat(r," ").concat(ws(t,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),_s("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),_s("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),_s("ERR_STREAM_PREMATURE_CLOSE","Premature close"),_s("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),_s("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),_s("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),_s("ERR_STREAM_WRITE_AFTER_END","write after end"),_s("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),_s("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),_s("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),bs.codes=vs;var Cs=bs.codes.ERR_INVALID_OPT_VALUE;var Ss={getHighWaterMark:function(e,t,n,r){var o=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new Cs(r?n:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}},ks={exports:{}};"function"==typeof Object.create?ks.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ks.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}};var Es=function(e,t){if(Rs("noDeprecation"))return e;var n=!1;return function(){if(!n){if(Rs("throwDeprecation"))throw new Error(t);Rs("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function Rs(e){try{if(!O.localStorage)return!1}catch(e){return!1}var t=O.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}var Is,As=Ys;function Os(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}Ys.WritableState=Js;var Ts={deprecate:Es},xs=ss,Ps=a.default.Buffer,Ms=O.Uint8Array||function(){};var Bs,js=ys,Ns=Ss.getHighWaterMark,Fs=bs.codes,Us=Fs.ERR_INVALID_ARG_TYPE,Ls=Fs.ERR_METHOD_NOT_IMPLEMENTED,Ds=Fs.ERR_MULTIPLE_CALLBACK,qs=Fs.ERR_STREAM_CANNOT_PIPE,$s=Fs.ERR_STREAM_DESTROYED,Hs=Fs.ERR_STREAM_NULL_VALUES,Ws=Fs.ERR_STREAM_WRITE_AFTER_END,Vs=Fs.ERR_UNKNOWN_ENCODING,Ks=js.errorOrDestroy;function zs(){}function Js(e,t,n){Is=Is||ra,e=e||{},"boolean"!=typeof n&&(n=t instanceof Is),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=Ns(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var r=!1===e.decodeStrings;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new Ds;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,o){--t.pendingcb,n?(process.nextTick(o,r),process.nextTick(ta,e,t),e._writableState.errorEmitted=!0,Ks(e,r)):(o(r),e._writableState.errorEmitted=!0,Ks(e,r),ta(e,t))}(e,n,r,t,o);else{var i=Zs(n)||e.destroyed;i||n.corked||n.bufferProcessing||!n.bufferedRequest||Gs(e,n),r?process.nextTick(Xs,e,n,i,o):Xs(e,n,i,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Os(this)}function Ys(e){var t=this instanceof(Is=Is||ra);if(!t&&!Bs.call(Ys,this))return new Ys(e);this._writableState=new Js(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),xs.call(this)}function Qs(e,t,n,r,o,i,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new $s("write")):n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function Xs(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),ta(e,t)}function Gs(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var s=0,a=!0;n;)o[s]=n,n.isBuf||(a=!1),n=n.next,s+=1;o.allBuffers=a,Qs(e,t,!0,t.length,o,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new Os(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,u=n.callback;if(Qs(e,t,!1,t.objectMode?1:c.length,c,l,u),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function Zs(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function ea(e,t){e._final((function(n){t.pendingcb--,n&&Ks(e,n),t.prefinished=!0,e.emit("prefinish"),ta(e,t)}))}function ta(e,t){var n=Zs(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(ea,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}ks.exports(Ys,xs),Js.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(Js.prototype,"buffer",{get:Ts.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(Bs=Function.prototype[Symbol.hasInstance],Object.defineProperty(Ys,Symbol.hasInstance,{value:function(e){return!!Bs.call(this,e)||this===Ys&&(e&&e._writableState instanceof Js)}})):Bs=function(e){return e instanceof this},Ys.prototype.pipe=function(){Ks(this,new qs)},Ys.prototype.write=function(e,t,n){var r,o=this._writableState,i=!1,s=!o.objectMode&&(r=e,Ps.isBuffer(r)||r instanceof Ms);return s&&!Ps.isBuffer(e)&&(e=function(e){return Ps.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=zs),o.ending?function(e,t){var n=new Ws;Ks(e,n),process.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var o;return null===n?o=new Hs:"string"==typeof n||t.objectMode||(o=new Us("chunk",["string","Buffer"],n)),!o||(Ks(e,o),process.nextTick(r,o),!1)}(this,o,e,n))&&(o.pendingcb++,i=function(e,t,n,r,o,i){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Ps.from(t,n));return t}(t,r,o);r!==s&&(n=!0,o="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:o,isBuf:n,callback:i,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Qs(e,t,!1,a,r,o,i);return c}(this,o,s,e,t,n)),i},Ys.prototype.cork=function(){this._writableState.corked++},Ys.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||Gs(this,e))},Ys.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new Vs(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Ys.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Ys.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Ys.prototype._write=function(e,t,n){n(new Ls("_write()"))},Ys.prototype._writev=null,Ys.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,ta(e,t),n&&(t.finished?process.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(Ys.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Ys.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Ys.prototype.destroy=js.destroy,Ys.prototype._undestroy=js.undestroy,Ys.prototype._destroy=function(e,t){t(e)};var na=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},ra=la,oa=Ka,ia=As;ks.exports(la,oa);for(var sa=na(ia.prototype),aa=0;aa<sa.length;aa++){var ca=sa[aa];la.prototype[ca]||(la.prototype[ca]=ia.prototype[ca])}function la(e){if(!(this instanceof la))return new la(e);oa.call(this,e),ia.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",ua)))}function ua(){this._writableState.ended||process.nextTick(pa,this)}function pa(e){e.end()}Object.defineProperty(la.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(la.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(la.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(la.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});var da={},fa={exports:{}};
3
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
4
+ !function(e,t){var n=a.default,r=n.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=i),i.prototype=Object.create(r.prototype),o(r,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var o=r(e);return void 0!==t?"string"==typeof n?o.fill(t,n):o.fill(t):o.fill(0),o},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(fa,fa.exports);var ha=fa.exports.Buffer,ma=ha.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function ga(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(ha.isEncoding===ma||!ma(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=va,this.end=_a,t=4;break;case"utf8":this.fillLast=ba,t=4;break;case"base64":this.text=wa,this.end=Ca,t=3;break;default:return this.write=Sa,void(this.end=ka)}this.lastNeed=0,this.lastTotal=0,this.lastChar=ha.allocUnsafe(t)}function ya(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function ba(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function va(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function _a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function wa(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function Ca(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Sa(e){return e.toString(this.encoding)}function ka(e){return e&&e.length?this.write(e):""}da.StringDecoder=ga,ga.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},ga.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},ga.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var o=ya(t[r]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--r<n||-2===o)return 0;if((o=ya(t[r]))>=0)return o>0&&(e.lastNeed=o-2),o;if(--r<n||-2===o)return 0;if((o=ya(t[r]))>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},ga.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};var Ea=bs.codes.ERR_STREAM_PREMATURE_CLOSE;function Ra(){}var Ia,Aa=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];e.apply(this,r)}}}(r||Ra);var o=n.readable||!1!==n.readable&&t.readable,i=n.writable||!1!==n.writable&&t.writable,s=function(){t.writable||c()},a=t._writableState&&t._writableState.finished,c=function(){i=!1,a=!0,o||r.call(t)},l=t._readableState&&t._readableState.endEmitted,u=function(){o=!1,l=!0,i||r.call(t)},p=function(e){r.call(t,e)},d=function(){var e;return o&&!l?(t._readableState&&t._readableState.ended||(e=new Ea),r.call(t,e)):i&&!a?(t._writableState&&t._writableState.ended||(e=new Ea),r.call(t,e)):void 0},f=function(){t.req.on("finish",c)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?i&&!t._writableState&&(t.on("end",s),t.on("close",s)):(t.on("complete",c),t.on("abort",d),t.req?f():t.on("request",f)),t.on("end",u),t.on("finish",c),!1!==n.error&&t.on("error",p),t.on("close",d),function(){t.removeListener("complete",c),t.removeListener("abort",d),t.removeListener("request",f),t.req&&t.req.removeListener("finish",c),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",c),t.removeListener("end",u),t.removeListener("error",p),t.removeListener("close",d)}};function Oa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ta=Aa,xa=Symbol("lastResolve"),Pa=Symbol("lastReject"),Ma=Symbol("error"),Ba=Symbol("ended"),ja=Symbol("lastPromise"),Na=Symbol("handlePromise"),Fa=Symbol("stream");function Ua(e,t){return{value:e,done:t}}function La(e){var t=e[xa];if(null!==t){var n=e[Fa].read();null!==n&&(e[ja]=null,e[xa]=null,e[Pa]=null,t(Ua(n,!1)))}}function Da(e){process.nextTick(La,e)}var qa,$a=Object.getPrototypeOf((function(){})),Ha=Object.setPrototypeOf((Oa(Ia={get stream(){return this[Fa]},next:function(){var e=this,t=this[Ma];if(null!==t)return Promise.reject(t);if(this[Ba])return Promise.resolve(Ua(void 0,!0));if(this[Fa].destroyed)return new Promise((function(t,n){process.nextTick((function(){e[Ma]?n(e[Ma]):t(Ua(void 0,!0))}))}));var n,r=this[ja];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[Ba]?n(Ua(void 0,!0)):t[Na](n,r)}),r)}}(r,this));else{var o=this[Fa].read();if(null!==o)return Promise.resolve(Ua(o,!1));n=new Promise(this[Na])}return this[ja]=n,n}},Symbol.asyncIterator,(function(){return this})),Oa(Ia,"return",(function(){var e=this;return new Promise((function(t,n){e[Fa].destroy(null,(function(e){e?n(e):t(Ua(void 0,!0))}))}))})),Ia),$a),Wa=function(e){var t,n=Object.create(Ha,(Oa(t={},Fa,{value:e,writable:!0}),Oa(t,xa,{value:null,writable:!0}),Oa(t,Pa,{value:null,writable:!0}),Oa(t,Ma,{value:null,writable:!0}),Oa(t,Ba,{value:e._readableState.endEmitted,writable:!0}),Oa(t,Na,{value:function(e,t){var r=n[Fa].read();r?(n[ja]=null,n[xa]=null,n[Pa]=null,e(Ua(r,!1))):(n[xa]=e,n[Pa]=t)},writable:!0}),t));return n[ja]=null,Ta(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[Pa];return null!==t&&(n[ja]=null,n[xa]=null,n[Pa]=null,t(e)),void(n[Ma]=e)}var r=n[xa];null!==r&&(n[ja]=null,n[xa]=null,n[Pa]=null,r(Ua(void 0,!0))),n[Ba]=!0})),e.on("readable",Da.bind(null,n)),n},Va=function(){throw new Error("Readable.from is not available in the browser")},Ka=fc;fc.ReadableState=dc,s.default.EventEmitter;var za=function(e,t){return e.listeners(t).length},Ja=ss,Ya=a.default.Buffer,Qa=O.Uint8Array||function(){};var Xa,Ga=ui;Xa=Ga&&Ga.debuglog?Ga.debuglog("stream"):function(){};var Za,ec,tc,nc=fs,rc=ys,oc=Ss.getHighWaterMark,ic=bs.codes,sc=ic.ERR_INVALID_ARG_TYPE,ac=ic.ERR_STREAM_PUSH_AFTER_EOF,cc=ic.ERR_METHOD_NOT_IMPLEMENTED,lc=ic.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;ks.exports(fc,Ja);var uc=rc.errorOrDestroy,pc=["error","close","destroy","pause","resume"];function dc(e,t,n){qa=qa||ra,e=e||{},"boolean"!=typeof n&&(n=t instanceof qa),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=oc(this,e,"readableHighWaterMark",n),this.buffer=new nc,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(Za||(Za=da.StringDecoder),this.decoder=new Za(e.encoding),this.encoding=e.encoding)}function fc(e){if(qa=qa||ra,!(this instanceof fc))return new fc(e);var t=this instanceof qa;this._readableState=new dc(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),Ja.call(this)}function hc(e,t,n,r,o){Xa("readableAddChunk",t);var i,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(Xa("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?bc(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,vc(e)))}(e,s);else if(o||(i=function(e,t){var n;r=t,Ya.isBuffer(r)||r instanceof Qa||"string"==typeof t||void 0===t||e.objectMode||(n=new sc("chunk",["string","Buffer","Uint8Array"],t));var r;return n}(s,t)),i)uc(e,i);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===Ya.prototype||(t=function(e){return Ya.from(e)}(t)),r)s.endEmitted?uc(e,new lc):mc(e,s,t,!0);else if(s.ended)uc(e,new ac);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?mc(e,s,t,!1):_c(e,s)):mc(e,s,t,!1)}else r||(s.reading=!1,_c(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function mc(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&bc(e)),_c(e,t)}Object.defineProperty(fc.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),fc.prototype.destroy=rc.destroy,fc.prototype._undestroy=rc.undestroy,fc.prototype._destroy=function(e,t){t(e)},fc.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=Ya.from(e,t),t=""),n=!0),hc(this,e,t,!1,n)},fc.prototype.unshift=function(e){return hc(this,e,null,!0,!1)},fc.prototype.isPaused=function(){return!1===this._readableState.flowing},fc.prototype.setEncoding=function(e){Za||(Za=da.StringDecoder);var t=new Za(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var gc=1073741824;function yc(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=gc?e=gc:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function bc(e){var t=e._readableState;Xa("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(Xa("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(vc,e))}function vc(e){var t=e._readableState;Xa("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Ec(e)}function _c(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(wc,e,t))}function wc(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(Xa("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function Cc(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function Sc(e){Xa("readable nexttick read 0"),e.read(0)}function kc(e,t){Xa("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Ec(e),t.flowing&&!t.reading&&e.read(0)}function Ec(e){var t=e._readableState;for(Xa("flow",t.flowing);t.flowing&&null!==e.read(););}function Rc(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function Ic(e){var t=e._readableState;Xa("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(Ac,t,e))}function Ac(e,t){if(Xa("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function Oc(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}fc.prototype.read=function(e){Xa("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return Xa("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Ic(this):bc(this),null;if(0===(e=yc(e,t))&&t.ended)return 0===t.length&&Ic(this),null;var r,o=t.needReadable;return Xa("need readable",o),(0===t.length||t.length-e<t.highWaterMark)&&Xa("length less than watermark",o=!0),t.ended||t.reading?Xa("reading or ended",o=!1):o&&(Xa("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=yc(n,t))),null===(r=e>0?Rc(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Ic(this)),null!==r&&this.emit("data",r),r},fc.prototype._read=function(e){uc(this,new cc("_read()"))},fc.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,Xa("pipe count=%d opts=%j",r.pipesCount,t);var o=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?s:f;function i(t,o){Xa("onunpipe"),t===n&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,Xa("cleanup"),e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",a),e.removeListener("error",u),e.removeListener("unpipe",i),n.removeListener("end",s),n.removeListener("end",f),n.removeListener("data",l),c=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||a())}function s(){Xa("onend"),e.end()}r.endEmitted?process.nextTick(o):n.once("end",o),e.on("unpipe",i);var a=function(e){return function(){var t=e._readableState;Xa("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&za(e,"data")&&(t.flowing=!0,Ec(e))}}(n);e.on("drain",a);var c=!1;function l(t){Xa("ondata");var o=e.write(t);Xa("dest.write",o),!1===o&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==Oc(r.pipes,e))&&!c&&(Xa("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function u(t){Xa("onerror",t),f(),e.removeListener("error",u),0===za(e,"error")&&uc(e,t)}function p(){e.removeListener("finish",d),f()}function d(){Xa("onfinish"),e.removeListener("close",p),f()}function f(){Xa("unpipe"),n.unpipe(e)}return n.on("data",l),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",u),e.once("close",p),e.once("finish",d),e.emit("pipe",n),r.flowing||(Xa("pipe resume"),n.resume()),e},fc.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<o;i++)r[i].emit("unpipe",this,{hasUnpiped:!1});return this}var s=Oc(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},fc.prototype.on=function(e,t){var n=Ja.prototype.on.call(this,e,t),r=this._readableState;return"data"===e?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,Xa("on readable",r.length,r.reading),r.length?bc(this):r.reading||process.nextTick(Sc,this))),n},fc.prototype.addListener=fc.prototype.on,fc.prototype.removeListener=function(e,t){var n=Ja.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(Cc,this),n},fc.prototype.removeAllListeners=function(e){var t=Ja.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(Cc,this),t},fc.prototype.resume=function(){var e=this._readableState;return e.flowing||(Xa("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(kc,e,t))}(this,e)),e.paused=!1,this},fc.prototype.pause=function(){return Xa("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(Xa("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},fc.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var o in e.on("end",(function(){if(Xa("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(o){(Xa("wrapped data"),n.decoder&&(o=n.decoder.write(o)),n.objectMode&&null==o)||(n.objectMode||o&&o.length)&&(t.push(o)||(r=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var i=0;i<pc.length;i++)e.on(pc[i],this.emit.bind(this,pc[i]));return this._read=function(t){Xa("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(fc.prototype[Symbol.asyncIterator]=function(){return void 0===ec&&(ec=Wa),ec(this)}),Object.defineProperty(fc.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(fc.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(fc.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),fc._fromList=Rc,Object.defineProperty(fc.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(fc.from=function(e,t){return void 0===tc&&(tc=Va),tc(fc,e,t)});var Tc=Uc,xc=bs.codes,Pc=xc.ERR_METHOD_NOT_IMPLEMENTED,Mc=xc.ERR_MULTIPLE_CALLBACK,Bc=xc.ERR_TRANSFORM_ALREADY_TRANSFORMING,jc=xc.ERR_TRANSFORM_WITH_LENGTH_0,Nc=ra;function Fc(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new Mc);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function Uc(e){if(!(this instanceof Uc))return new Uc(e);Nc.call(this,e),this._transformState={afterTransform:Fc.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Lc)}function Lc(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Dc(this,null,null):this._flush((function(t,n){Dc(e,t,n)}))}function Dc(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new jc;if(e._transformState.transforming)throw new Bc;return e.push(null)}ks.exports(Uc,Nc),Uc.prototype.push=function(e,t){return this._transformState.needTransform=!1,Nc.prototype.push.call(this,e,t)},Uc.prototype._transform=function(e,t,n){n(new Pc("_transform()"))},Uc.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var o=this._readableState;(r.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},Uc.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},Uc.prototype._destroy=function(e,t){Nc.prototype._destroy.call(this,e,(function(e){t(e)}))};var qc,$c=Wc,Hc=Tc;function Wc(e){if(!(this instanceof Wc))return new Wc(e);Hc.call(this,e)}ks.exports(Wc,Hc),Wc.prototype._transform=function(e,t,n){n(null,e)};var Vc=bs.codes,Kc=Vc.ERR_MISSING_ARGS,zc=Vc.ERR_STREAM_DESTROYED;function Jc(e){if(e)throw e}function Yc(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var o=!1;e.on("close",(function(){o=!0})),void 0===qc&&(qc=Aa),qc(e,{readable:t,writable:n},(function(e){if(e)return r(e);o=!0,r()}));var i=!1;return function(t){if(!o&&!i)return i=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new zc("pipe"))}}function Qc(e){e()}function Xc(e,t){return e.pipe(t)}function Gc(e){return e.length?"function"!=typeof e[e.length-1]?Jc:e.pop():Jc}var Zc=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,o=Gc(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Kc("streams");var i=t.map((function(e,n){var s=n<t.length-1;return Yc(e,s,n>0,(function(e){r||(r=e),e&&i.forEach(Qc),s||(i.forEach(Qc),o(r))}))}));return t.reduce(Xc)};!function(e,t){(t=e.exports=Ka).Stream=t,t.Readable=t,t.Writable=As,t.Duplex=ra,t.Transform=Tc,t.PassThrough=$c,t.finished=Aa,t.pipeline=Zc}(is,is.exports);var el=rs,tl=is.exports.Readable,nl={objectMode:!0},rl={clean:!0};function ol(e){if(!(this instanceof ol))return new ol(e);this.options=e||{},this.options=el(rl,e),this._inflights=new Map}ol.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},ol.prototype.createStream=function(){var e=new tl(nl),t=!1,n=[],r=0;return this._inflights.forEach((function(e,t){n.push(e)})),e._read=function(){!t&&r<n.length?this.push(n[r++]):this.push(null)},e.destroy=function(){if(!t){var e=this;t=!0,setTimeout((function(){e.emit("close")}),0)}},e},ol.prototype.del=function(e,t){return(e=this._inflights.get(e.messageId))?(this._inflights.delete(e.messageId),t(null,e)):t&&t(new Error("missing packet")),this},ol.prototype.get=function(e,t){return(e=this._inflights.get(e.messageId))?t(null,e):t&&t(new Error("missing packet")),this},ol.prototype.close=function(e){this.options.clean&&(this._inflights=null),e&&e()};var il=ol,sl={},al={exports:{}},cl={exports:{}},ll=s.default.EventEmitter;function ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var fl=a.default.Buffer,hl=ui.inspect,ml=hl&&hl.custom||"inspect";var gl=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,n,r;return t=e,n=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return fl.alloc(0);for(var t,n,r,o=fl.allocUnsafe(e>>>0),i=this.head,s=0;i;)t=i.data,n=o,r=s,fl.prototype.copy.call(t,n,r),s+=i.data.length,i=i.next;return o}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var o=t.data,i=e>o.length?o.length:e;if(i===o.length?r+=o:r+=o.slice(0,e),0==(e-=i)){i===o.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=o.slice(i));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=fl.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var o=n.data,i=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,i),0==(e-=i)){i===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(i));break}++r}return this.length-=r,t}},{key:ml,value:function(e,t){return hl(this,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ul(Object(n),!0).forEach((function(t){pl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ul(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}],n&&dl(t.prototype,n),r&&dl(t,r),e}();function yl(e,t){vl(e,t),bl(e)}function bl(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function vl(e,t){e.emit("error",t)}var _l={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return r||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(vl,this,e)):process.nextTick(vl,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?process.nextTick(bl,n):(n._writableState.errorEmitted=!0,process.nextTick(yl,n,e)):process.nextTick(yl,n,e):t?(process.nextTick(bl,n),t(e)):process.nextTick(bl,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},wl={};var Cl={};function Sl(e,t,n){n||(n=Error);var r=function(e){var n,r;function o(n,r,o){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,o))||this}return r=e,(n=o).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,o}(n);r.prototype.name=n.name,r.prototype.code=e,Cl[e]=r}function kl(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}Sl("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),Sl("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,o,i,s;if("string"==typeof t&&(o="not ",t.substr(!i||i<0?0:+i,o.length)===o)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))s="The ".concat(e," ").concat(r," ").concat(kl(t,"type"));else{var a=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(a," ").concat(r," ").concat(kl(t,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),Sl("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Sl("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),Sl("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Sl("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),Sl("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Sl("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Sl("ERR_STREAM_WRITE_AFTER_END","write after end"),Sl("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Sl("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),Sl("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),wl.codes=Cl;var El=wl.codes.ERR_INVALID_OPT_VALUE;var Rl,Il={getHighWaterMark:function(e,t,n,r){var o=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new El(r?n:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}},Al=Yl;function Ol(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}Yl.WritableState=Jl;var Tl={deprecate:Es},xl=ll,Pl=a.default.Buffer,Ml=O.Uint8Array||function(){};var Bl,jl=_l,Nl=Il.getHighWaterMark,Fl=wl.codes,Ul=Fl.ERR_INVALID_ARG_TYPE,Ll=Fl.ERR_METHOD_NOT_IMPLEMENTED,Dl=Fl.ERR_MULTIPLE_CALLBACK,ql=Fl.ERR_STREAM_CANNOT_PIPE,$l=Fl.ERR_STREAM_DESTROYED,Hl=Fl.ERR_STREAM_NULL_VALUES,Wl=Fl.ERR_STREAM_WRITE_AFTER_END,Vl=Fl.ERR_UNKNOWN_ENCODING,Kl=jl.errorOrDestroy;function zl(){}function Jl(e,t,n){Rl=Rl||ru,e=e||{},"boolean"!=typeof n&&(n=t instanceof Rl),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=Nl(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var r=!1===e.decodeStrings;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new Dl;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,o){--t.pendingcb,n?(process.nextTick(o,r),process.nextTick(tu,e,t),e._writableState.errorEmitted=!0,Kl(e,r)):(o(r),e._writableState.errorEmitted=!0,Kl(e,r),tu(e,t))}(e,n,r,t,o);else{var i=Zl(n)||e.destroyed;i||n.corked||n.bufferProcessing||!n.bufferedRequest||Gl(e,n),r?process.nextTick(Xl,e,n,i,o):Xl(e,n,i,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Ol(this)}function Yl(e){var t=this instanceof(Rl=Rl||ru);if(!t&&!Bl.call(Yl,this))return new Yl(e);this._writableState=new Jl(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),xl.call(this)}function Ql(e,t,n,r,o,i,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new $l("write")):n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function Xl(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),tu(e,t)}function Gl(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var s=0,a=!0;n;)o[s]=n,n.isBuf||(a=!1),n=n.next,s+=1;o.allBuffers=a,Ql(e,t,!0,t.length,o,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new Ol(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,u=n.callback;if(Ql(e,t,!1,t.objectMode?1:c.length,c,l,u),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function Zl(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function eu(e,t){e._final((function(n){t.pendingcb--,n&&Kl(e,n),t.prefinished=!0,e.emit("prefinish"),tu(e,t)}))}function tu(e,t){var n=Zl(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(eu,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}ks.exports(Yl,xl),Jl.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(Jl.prototype,"buffer",{get:Tl.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(Bl=Function.prototype[Symbol.hasInstance],Object.defineProperty(Yl,Symbol.hasInstance,{value:function(e){return!!Bl.call(this,e)||this===Yl&&(e&&e._writableState instanceof Jl)}})):Bl=function(e){return e instanceof this},Yl.prototype.pipe=function(){Kl(this,new ql)},Yl.prototype.write=function(e,t,n){var r,o=this._writableState,i=!1,s=!o.objectMode&&(r=e,Pl.isBuffer(r)||r instanceof Ml);return s&&!Pl.isBuffer(e)&&(e=function(e){return Pl.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=zl),o.ending?function(e,t){var n=new Wl;Kl(e,n),process.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var o;return null===n?o=new Hl:"string"==typeof n||t.objectMode||(o=new Ul("chunk",["string","Buffer"],n)),!o||(Kl(e,o),process.nextTick(r,o),!1)}(this,o,e,n))&&(o.pendingcb++,i=function(e,t,n,r,o,i){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Pl.from(t,n));return t}(t,r,o);r!==s&&(n=!0,o="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:o,isBuf:n,callback:i,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Ql(e,t,!1,a,r,o,i);return c}(this,o,s,e,t,n)),i},Yl.prototype.cork=function(){this._writableState.corked++},Yl.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||Gl(this,e))},Yl.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new Vl(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Yl.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Yl.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Yl.prototype._write=function(e,t,n){n(new Ll("_write()"))},Yl.prototype._writev=null,Yl.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,tu(e,t),n&&(t.finished?process.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(Yl.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Yl.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Yl.prototype.destroy=jl.destroy,Yl.prototype._undestroy=jl.undestroy,Yl.prototype._destroy=function(e,t){t(e)};var nu=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},ru=lu,ou=Mu,iu=Al;ks.exports(lu,ou);for(var su=nu(iu.prototype),au=0;au<su.length;au++){var cu=su[au];lu.prototype[cu]||(lu.prototype[cu]=iu.prototype[cu])}function lu(e){if(!(this instanceof lu))return new lu(e);ou.call(this,e),iu.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",uu)))}function uu(){this._writableState.ended||process.nextTick(pu,this)}function pu(e){e.end()}Object.defineProperty(lu.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(lu.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(lu.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(lu.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});var du=wl.codes.ERR_STREAM_PREMATURE_CLOSE;function fu(){}var hu,mu=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];e.apply(this,r)}}}(r||fu);var o=n.readable||!1!==n.readable&&t.readable,i=n.writable||!1!==n.writable&&t.writable,s=function(){t.writable||c()},a=t._writableState&&t._writableState.finished,c=function(){i=!1,a=!0,o||r.call(t)},l=t._readableState&&t._readableState.endEmitted,u=function(){o=!1,l=!0,i||r.call(t)},p=function(e){r.call(t,e)},d=function(){var e;return o&&!l?(t._readableState&&t._readableState.ended||(e=new du),r.call(t,e)):i&&!a?(t._writableState&&t._writableState.ended||(e=new du),r.call(t,e)):void 0},f=function(){t.req.on("finish",c)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?i&&!t._writableState&&(t.on("end",s),t.on("close",s)):(t.on("complete",c),t.on("abort",d),t.req?f():t.on("request",f)),t.on("end",u),t.on("finish",c),!1!==n.error&&t.on("error",p),t.on("close",d),function(){t.removeListener("complete",c),t.removeListener("abort",d),t.removeListener("request",f),t.req&&t.req.removeListener("finish",c),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",c),t.removeListener("end",u),t.removeListener("error",p),t.removeListener("close",d)}};function gu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var yu=mu,bu=Symbol("lastResolve"),vu=Symbol("lastReject"),_u=Symbol("error"),wu=Symbol("ended"),Cu=Symbol("lastPromise"),Su=Symbol("handlePromise"),ku=Symbol("stream");function Eu(e,t){return{value:e,done:t}}function Ru(e){var t=e[bu];if(null!==t){var n=e[ku].read();null!==n&&(e[Cu]=null,e[bu]=null,e[vu]=null,t(Eu(n,!1)))}}function Iu(e){process.nextTick(Ru,e)}var Au,Ou=Object.getPrototypeOf((function(){})),Tu=Object.setPrototypeOf((gu(hu={get stream(){return this[ku]},next:function(){var e=this,t=this[_u];if(null!==t)return Promise.reject(t);if(this[wu])return Promise.resolve(Eu(void 0,!0));if(this[ku].destroyed)return new Promise((function(t,n){process.nextTick((function(){e[_u]?n(e[_u]):t(Eu(void 0,!0))}))}));var n,r=this[Cu];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[wu]?n(Eu(void 0,!0)):t[Su](n,r)}),r)}}(r,this));else{var o=this[ku].read();if(null!==o)return Promise.resolve(Eu(o,!1));n=new Promise(this[Su])}return this[Cu]=n,n}},Symbol.asyncIterator,(function(){return this})),gu(hu,"return",(function(){var e=this;return new Promise((function(t,n){e[ku].destroy(null,(function(e){e?n(e):t(Eu(void 0,!0))}))}))})),hu),Ou),xu=function(e){var t,n=Object.create(Tu,(gu(t={},ku,{value:e,writable:!0}),gu(t,bu,{value:null,writable:!0}),gu(t,vu,{value:null,writable:!0}),gu(t,_u,{value:null,writable:!0}),gu(t,wu,{value:e._readableState.endEmitted,writable:!0}),gu(t,Su,{value:function(e,t){var r=n[ku].read();r?(n[Cu]=null,n[bu]=null,n[vu]=null,e(Eu(r,!1))):(n[bu]=e,n[vu]=t)},writable:!0}),t));return n[Cu]=null,yu(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[vu];return null!==t&&(n[Cu]=null,n[bu]=null,n[vu]=null,t(e)),void(n[_u]=e)}var r=n[bu];null!==r&&(n[Cu]=null,n[bu]=null,n[vu]=null,r(Eu(void 0,!0))),n[wu]=!0})),e.on("readable",Iu.bind(null,n)),n},Pu=function(){throw new Error("Readable.from is not available in the browser")},Mu=ep;ep.ReadableState=Zu,s.default.EventEmitter;var Bu=function(e,t){return e.listeners(t).length},ju=ll,Nu=a.default.Buffer,Fu=O.Uint8Array||function(){};var Uu,Lu=ui;Uu=Lu&&Lu.debuglog?Lu.debuglog("stream"):function(){};var Du,qu,$u,Hu=gl,Wu=_l,Vu=Il.getHighWaterMark,Ku=wl.codes,zu=Ku.ERR_INVALID_ARG_TYPE,Ju=Ku.ERR_STREAM_PUSH_AFTER_EOF,Yu=Ku.ERR_METHOD_NOT_IMPLEMENTED,Qu=Ku.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;ks.exports(ep,ju);var Xu=Wu.errorOrDestroy,Gu=["error","close","destroy","pause","resume"];function Zu(e,t,n){Au=Au||ru,e=e||{},"boolean"!=typeof n&&(n=t instanceof Au),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=Vu(this,e,"readableHighWaterMark",n),this.buffer=new Hu,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(Du||(Du=da.StringDecoder),this.decoder=new Du(e.encoding),this.encoding=e.encoding)}function ep(e){if(Au=Au||ru,!(this instanceof ep))return new ep(e);var t=this instanceof Au;this._readableState=new Zu(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),ju.call(this)}function tp(e,t,n,r,o){Uu("readableAddChunk",t);var i,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(Uu("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?ip(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,sp(e)))}(e,s);else if(o||(i=function(e,t){var n;r=t,Nu.isBuffer(r)||r instanceof Fu||"string"==typeof t||void 0===t||e.objectMode||(n=new zu("chunk",["string","Buffer","Uint8Array"],t));var r;return n}(s,t)),i)Xu(e,i);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===Nu.prototype||(t=function(e){return Nu.from(e)}(t)),r)s.endEmitted?Xu(e,new Qu):np(e,s,t,!0);else if(s.ended)Xu(e,new Ju);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?np(e,s,t,!1):ap(e,s)):np(e,s,t,!1)}else r||(s.reading=!1,ap(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function np(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&ip(e)),ap(e,t)}Object.defineProperty(ep.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),ep.prototype.destroy=Wu.destroy,ep.prototype._undestroy=Wu.undestroy,ep.prototype._destroy=function(e,t){t(e)},ep.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=Nu.from(e,t),t=""),n=!0),tp(this,e,t,!1,n)},ep.prototype.unshift=function(e){return tp(this,e,null,!0,!1)},ep.prototype.isPaused=function(){return!1===this._readableState.flowing},ep.prototype.setEncoding=function(e){Du||(Du=da.StringDecoder);var t=new Du(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var rp=1073741824;function op(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=rp?e=rp:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function ip(e){var t=e._readableState;Uu("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(Uu("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(sp,e))}function sp(e){var t=e._readableState;Uu("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,dp(e)}function ap(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(cp,e,t))}function cp(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(Uu("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function lp(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function up(e){Uu("readable nexttick read 0"),e.read(0)}function pp(e,t){Uu("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),dp(e),t.flowing&&!t.reading&&e.read(0)}function dp(e){var t=e._readableState;for(Uu("flow",t.flowing);t.flowing&&null!==e.read(););}function fp(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function hp(e){var t=e._readableState;Uu("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(mp,t,e))}function mp(e,t){if(Uu("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function gp(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}ep.prototype.read=function(e){Uu("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return Uu("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?hp(this):ip(this),null;if(0===(e=op(e,t))&&t.ended)return 0===t.length&&hp(this),null;var r,o=t.needReadable;return Uu("need readable",o),(0===t.length||t.length-e<t.highWaterMark)&&Uu("length less than watermark",o=!0),t.ended||t.reading?Uu("reading or ended",o=!1):o&&(Uu("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=op(n,t))),null===(r=e>0?fp(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&hp(this)),null!==r&&this.emit("data",r),r},ep.prototype._read=function(e){Xu(this,new Yu("_read()"))},ep.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,Uu("pipe count=%d opts=%j",r.pipesCount,t);var o=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?s:f;function i(t,o){Uu("onunpipe"),t===n&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,Uu("cleanup"),e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",a),e.removeListener("error",u),e.removeListener("unpipe",i),n.removeListener("end",s),n.removeListener("end",f),n.removeListener("data",l),c=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||a())}function s(){Uu("onend"),e.end()}r.endEmitted?process.nextTick(o):n.once("end",o),e.on("unpipe",i);var a=function(e){return function(){var t=e._readableState;Uu("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&Bu(e,"data")&&(t.flowing=!0,dp(e))}}(n);e.on("drain",a);var c=!1;function l(t){Uu("ondata");var o=e.write(t);Uu("dest.write",o),!1===o&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==gp(r.pipes,e))&&!c&&(Uu("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function u(t){Uu("onerror",t),f(),e.removeListener("error",u),0===Bu(e,"error")&&Xu(e,t)}function p(){e.removeListener("finish",d),f()}function d(){Uu("onfinish"),e.removeListener("close",p),f()}function f(){Uu("unpipe"),n.unpipe(e)}return n.on("data",l),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",u),e.once("close",p),e.once("finish",d),e.emit("pipe",n),r.flowing||(Uu("pipe resume"),n.resume()),e},ep.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<o;i++)r[i].emit("unpipe",this,{hasUnpiped:!1});return this}var s=gp(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},ep.prototype.on=function(e,t){var n=ju.prototype.on.call(this,e,t),r=this._readableState;return"data"===e?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,Uu("on readable",r.length,r.reading),r.length?ip(this):r.reading||process.nextTick(up,this))),n},ep.prototype.addListener=ep.prototype.on,ep.prototype.removeListener=function(e,t){var n=ju.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(lp,this),n},ep.prototype.removeAllListeners=function(e){var t=ju.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(lp,this),t},ep.prototype.resume=function(){var e=this._readableState;return e.flowing||(Uu("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(pp,e,t))}(this,e)),e.paused=!1,this},ep.prototype.pause=function(){return Uu("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(Uu("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},ep.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var o in e.on("end",(function(){if(Uu("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(o){(Uu("wrapped data"),n.decoder&&(o=n.decoder.write(o)),n.objectMode&&null==o)||(n.objectMode||o&&o.length)&&(t.push(o)||(r=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var i=0;i<Gu.length;i++)e.on(Gu[i],this.emit.bind(this,Gu[i]));return this._read=function(t){Uu("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(ep.prototype[Symbol.asyncIterator]=function(){return void 0===qu&&(qu=xu),qu(this)}),Object.defineProperty(ep.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(ep.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(ep.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),ep._fromList=fp,Object.defineProperty(ep.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(ep.from=function(e,t){return void 0===$u&&($u=Pu),$u(ep,e,t)});var yp=Ep,bp=wl.codes,vp=bp.ERR_METHOD_NOT_IMPLEMENTED,_p=bp.ERR_MULTIPLE_CALLBACK,wp=bp.ERR_TRANSFORM_ALREADY_TRANSFORMING,Cp=bp.ERR_TRANSFORM_WITH_LENGTH_0,Sp=ru;function kp(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new _p);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function Ep(e){if(!(this instanceof Ep))return new Ep(e);Sp.call(this,e),this._transformState={afterTransform:kp.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Rp)}function Rp(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Ip(this,null,null):this._flush((function(t,n){Ip(e,t,n)}))}function Ip(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Cp;if(e._transformState.transforming)throw new wp;return e.push(null)}ks.exports(Ep,Sp),Ep.prototype.push=function(e,t){return this._transformState.needTransform=!1,Sp.prototype.push.call(this,e,t)},Ep.prototype._transform=function(e,t,n){n(new vp("_transform()"))},Ep.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var o=this._readableState;(r.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},Ep.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},Ep.prototype._destroy=function(e,t){Sp.prototype._destroy.call(this,e,(function(e){t(e)}))};var Ap,Op=xp,Tp=yp;function xp(e){if(!(this instanceof xp))return new xp(e);Tp.call(this,e)}ks.exports(xp,Tp),xp.prototype._transform=function(e,t,n){n(null,e)};var Pp=wl.codes,Mp=Pp.ERR_MISSING_ARGS,Bp=Pp.ERR_STREAM_DESTROYED;function jp(e){if(e)throw e}function Np(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var o=!1;e.on("close",(function(){o=!0})),void 0===Ap&&(Ap=mu),Ap(e,{readable:t,writable:n},(function(e){if(e)return r(e);o=!0,r()}));var i=!1;return function(t){if(!o&&!i)return i=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new Bp("pipe"))}}function Fp(e){e()}function Up(e,t){return e.pipe(t)}function Lp(e){return e.length?"function"!=typeof e[e.length-1]?jp:e.pop():jp}var Dp=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,o=Lp(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Mp("streams");var i=t.map((function(e,n){var s=n<t.length-1;return Np(e,s,n>0,(function(e){r||(r=e),e&&i.forEach(Fp),s||(i.forEach(Fp),o(r))}))}));return t.reduce(Up)};!function(e,t){(t=e.exports=Mu).Stream=t,t.Readable=t,t.Writable=Al,t.Duplex=ru,t.Transform=yp,t.PassThrough=Op,t.finished=mu,t.pipeline=Dp}(cl,cl.exports);const{Buffer:qp}=a.default,$p=Symbol.for("BufferList");function Hp(e){if(!(this instanceof Hp))return new Hp(e);Hp._init.call(this,e)}Hp._init=function(e){Object.defineProperty(this,$p,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},Hp.prototype._new=function(e){return new Hp(e)},Hp.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let n=0;n<this._bufs.length;n++){const r=t+this._bufs[n].length;if(e<r||n===this._bufs.length-1)return[n,e-t];t=r}},Hp.prototype._reverseOffset=function(e){const t=e[0];let n=e[1];for(let e=0;e<t;e++)n+=this._bufs[e].length;return n},Hp.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},Hp.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},Hp.prototype.copy=function(e,t,n,r){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof r||r>this.length)&&(r=this.length),n>=this.length)return e||qp.alloc(0);if(r<=0)return e||qp.alloc(0);const o=!!e,i=this._offset(n),s=r-n;let a=s,c=o&&t||0,l=i[1];if(0===n&&r===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:qp.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,c),c+=this._bufs[t].length;return e}if(a<=this._bufs[i[0]].length-l)return o?this._bufs[i[0]].copy(e,t,l,l+a):this._bufs[i[0]].slice(l,l+a);o||(e=qp.allocUnsafe(s));for(let t=i[0];t<this._bufs.length;t++){const n=this._bufs[t].length-l;if(!(a>n)){this._bufs[t].copy(e,c,l,l+a),c+=n;break}this._bufs[t].copy(e,c,l),c+=n,a-=n,l&&(l=0)}return e.length>c?e.slice(0,c):e},Hp.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const n=this._offset(e),r=this._offset(t),o=this._bufs.slice(n[0],r[0]+1);return 0===r[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,r[1]),0!==n[1]&&(o[0]=o[0].slice(n[1])),this._new(o)},Hp.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},Hp.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},Hp.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},Hp.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(qp.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(qp.from(e));return this},Hp.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},Hp.prototype.indexOf=function(e,t,n){if(void 0===n&&"string"==typeof t&&(n=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=qp.from([e]):"string"==typeof e?e=qp.from(e,n):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=qp.from(e.buffer,e.byteOffset,e.byteLength):qp.isBuffer(e)||(e=qp.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const r=this._offset(t);let o=r[0],i=r[1];for(;o<this._bufs.length;o++){const t=this._bufs[o];for(;i<t.length;){if(t.length-i>=e.length){const n=t.indexOf(e,i);if(-1!==n)return this._reverseOffset([o,n]);i=t.length-e.length+1}else{const t=this._reverseOffset([o,i]);if(this._match(t,e))return t;i++}}i=0}return-1},Hp.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let n=0;n<t.length;n++)if(this.get(e+n)!==t[n])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)!function(t){Hp.prototype[t]=null===e[t]?function(e,n){return this.slice(e,e+n)[t](0,n)}:function(n=0){return this.slice(n,n+e[t])[t](0)}}(t)}(),Hp.prototype._isBufferList=function(e){return e instanceof Hp||Hp.isBufferList(e)},Hp.isBufferList=function(e){return null!=e&&e[$p]};var Wp=Hp;const Vp=cl.exports.Duplex,Kp=ks.exports,zp=Wp;function Jp(e){if(!(this instanceof Jp))return new Jp(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)})),e=null}zp._init.call(this,e),Vp.call(this)}Kp(Jp,Vp),Object.assign(Jp.prototype,zp.prototype),Jp.prototype._new=function(e){return new Jp(e)},Jp.prototype._write=function(e,t,n){this._appendBuffer(e),"function"==typeof n&&n()},Jp.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},Jp.prototype.end=function(e){Vp.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},Jp.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},Jp.prototype._isBufferList=function(e){return e instanceof Jp||e instanceof zp||Jp.isBufferList(e)},Jp.isBufferList=zp.isBufferList,al.exports=Jp,al.exports.BufferListStream=Jp,al.exports.BufferList=zp;var Yp=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}},Qp={exports:{}};!function(e){const t=e.exports;t.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},t.codes={};for(const e in t.types){const n=t.types[e];t.codes[n]=e}t.CMD_SHIFT=4,t.CMD_MASK=240,t.DUP_MASK=8,t.QOS_MASK=3,t.QOS_SHIFT=1,t.RETAIN_MASK=1,t.VARBYTEINT_MASK=127,t.VARBYTEINT_FIN_MASK=128,t.VARBYTEINT_MAX=268435455,t.SESSIONPRESENT_MASK=1,t.SESSIONPRESENT_HEADER=Buffer.from([t.SESSIONPRESENT_MASK]),t.CONNACK_HEADER=Buffer.from([t.codes.connack<<t.CMD_SHIFT]),t.USERNAME_MASK=128,t.PASSWORD_MASK=64,t.WILL_RETAIN_MASK=32,t.WILL_QOS_MASK=24,t.WILL_QOS_SHIFT=3,t.WILL_FLAG_MASK=4,t.CLEAN_SESSION_MASK=2,t.CONNECT_HEADER=Buffer.from([t.codes.connect<<t.CMD_SHIFT]),t.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},t.propertiesCodes={};for(const e in t.properties){const n=t.properties[e];t.propertiesCodes[n]=e}function n(e){return[0,1,2].map((n=>[0,1].map((r=>[0,1].map((o=>{const i=Buffer.alloc(1);return i.writeUInt8(t.codes[e]<<t.CMD_SHIFT|(r?t.DUP_MASK:0)|n<<t.QOS_SHIFT|o,0,!0),i}))))))}t.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},t.PUBLISH_HEADER=n("publish"),t.SUBSCRIBE_HEADER=n("subscribe"),t.SUBSCRIBE_OPTIONS_QOS_MASK=3,t.SUBSCRIBE_OPTIONS_NL_MASK=1,t.SUBSCRIBE_OPTIONS_NL_SHIFT=2,t.SUBSCRIBE_OPTIONS_RAP_MASK=1,t.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,t.SUBSCRIBE_OPTIONS_RH_MASK=3,t.SUBSCRIBE_OPTIONS_RH_SHIFT=4,t.SUBSCRIBE_OPTIONS_RH=[0,16,32],t.SUBSCRIBE_OPTIONS_NL=4,t.SUBSCRIBE_OPTIONS_RAP=8,t.SUBSCRIBE_OPTIONS_QOS=[0,1,2],t.UNSUBSCRIBE_HEADER=n("unsubscribe"),t.ACKS={unsuback:n("unsuback"),puback:n("puback"),pubcomp:n("pubcomp"),pubrel:n("pubrel"),pubrec:n("pubrec")},t.SUBACK_HEADER=Buffer.from([t.codes.suback<<t.CMD_SHIFT]),t.VERSION3=Buffer.from([3]),t.VERSION4=Buffer.from([4]),t.VERSION5=Buffer.from([5]),t.VERSION131=Buffer.from([131]),t.VERSION132=Buffer.from([132]),t.QOS=[0,1,2].map((e=>Buffer.from([e]))),t.EMPTY={pingreq:Buffer.from([t.codes.pingreq<<4,0]),pingresp:Buffer.from([t.codes.pingresp<<4,0]),disconnect:Buffer.from([t.codes.disconnect<<4,0])}}(Qp);const Xp=al.exports,Gp=s.default,Zp=Yp,ed=Qp.exports,td=gt.exports("mqtt-packet:parser");class nd extends Gp{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof nd?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new nd).parser(e)}_resetState(){td("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new Zp,this.error=null,this._list=Xp(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),td("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,td("parse: state complete. _stateCounter is now: %d",this._stateCounter),td("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return td("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const e=this._list.readUInt8(0);return this.packet.cmd=ed.types[e>>ed.CMD_SHIFT],this.packet.retain=0!=(e&ed.RETAIN_MASK),this.packet.qos=e>>ed.QOS_SHIFT&ed.QOS_MASK,this.packet.dup=0!=(e&ed.DUP_MASK),td("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),td("_parseLength %d",e.value),!!e}_parsePayload(){td("_parsePayload: payload %O",this._list);let e=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}e=!0}return td("_parsePayload complete result: %s",e),e}_parseConnect(){let e,t,n,r;td("_parseConnect");const o={},i=this.packet,s=this._parseString();if(null===s)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==s&&"MQIsdp"!==s)return this._emitError(new Error("Invalid protocolId"));if(i.protocolId=s,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(i.protocolVersion=this._list.readUInt8(this._pos),i.protocolVersion>=128&&(i.bridgeMode=!0,i.protocolVersion=i.protocolVersion-128),3!==i.protocolVersion&&4!==i.protocolVersion&&5!==i.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(o.username=this._list.readUInt8(this._pos)&ed.USERNAME_MASK,o.password=this._list.readUInt8(this._pos)&ed.PASSWORD_MASK,o.will=this._list.readUInt8(this._pos)&ed.WILL_FLAG_MASK,o.will&&(i.will={},i.will.retain=0!=(this._list.readUInt8(this._pos)&ed.WILL_RETAIN_MASK),i.will.qos=(this._list.readUInt8(this._pos)&ed.WILL_QOS_MASK)>>ed.WILL_QOS_SHIFT),i.clean=0!=(this._list.readUInt8(this._pos)&ed.CLEAN_SESSION_MASK),this._pos++,i.keepalive=this._parseNum(),-1===i.keepalive)return this._emitError(new Error("Packet too short"));if(5===i.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(i.properties=e)}const a=this._parseString();if(null===a)return this._emitError(new Error("Packet too short"));if(i.clientId=a,td("_parseConnect: packet.clientId: %s",i.clientId),o.will){if(5===i.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(i.will.properties=e)}if(e=this._parseString(),null===e)return this._emitError(new Error("Cannot parse will topic"));if(i.will.topic=e,td("_parseConnect: packet.will.topic: %s",i.will.topic),t=this._parseBuffer(),null===t)return this._emitError(new Error("Cannot parse will payload"));i.will.payload=t,td("_parseConnect: packet.will.paylaod: %s",i.will.payload)}if(o.username){if(r=this._parseString(),null===r)return this._emitError(new Error("Cannot parse username"));i.username=r,td("_parseConnect: packet.username: %s",i.username)}if(o.password){if(n=this._parseBuffer(),null===n)return this._emitError(new Error("Cannot parse password"));i.password=n}return this.settings=i,td("_parseConnect: complete"),i}_parseConnack(){td("_parseConnack");const e=this.packet;if(this._list.length<1)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&ed.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(-1===e.returnCode||-1===e.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}td("_parseConnack: complete")}_parsePublish(){td("_parsePublish");const e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),td("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){td("_parseSubscribe");const e=this.packet;let t,n,r,o,i,s,a;if(1!==e.qos)return this._emitError(new Error("Wrong subscribe header"));if(e.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));n=this._parseByte(),r=n&ed.SUBSCRIBE_OPTIONS_QOS_MASK,s=0!=(n>>ed.SUBSCRIBE_OPTIONS_NL_SHIFT&ed.SUBSCRIBE_OPTIONS_NL_MASK),i=0!=(n>>ed.SUBSCRIBE_OPTIONS_RAP_SHIFT&ed.SUBSCRIBE_OPTIONS_RAP_MASK),o=n>>ed.SUBSCRIBE_OPTIONS_RH_SHIFT&ed.SUBSCRIBE_OPTIONS_RH_MASK,a={topic:t,qos:r},5===this.settings.protocolVersion?(a.nl=s,a.rap=i,a.rh=o):this.settings.bridgeMode&&(a.rh=0,a.rap=!0,a.nl=!0),td("_parseSubscribe: push subscription `%s` to subscription",a),e.subscriptions.push(a)}}}_parseSuback(){td("_parseSuback");const e=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){td("_parseUnsubscribe");const e=this.packet;if(e.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){const t=this._parseString();if(null===t)return this._emitError(new Error("Cannot parse topic"));td("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),e.unsubscriptions.push(t)}}}_parseUnsuback(){td("_parseUnsuback");const e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){td("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const e=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(e.length>2?(e.reasonCode=this._parseByte(),td("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)):e.reasonCode=0,e.length>3)){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return!0}_parseDisconnect(){const e=this.packet;if(td("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?e.reasonCode=this._parseByte():e.reasonCode=0;const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return td("_parseDisconnect result: true"),!0}_parseAuth(){td("_parseAuth");const e=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));e.reasonCode=this._parseByte();const t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),td("_parseAuth: result: true"),!0}_parseMessageId(){const e=this.packet;return e.messageId=this._parseNum(),null===e.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(td("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){const t=this._parseNum(),n=t+this._pos;if(-1===t||n>this._list.length||n>this.packet.length)return null;const r=this._list.toString("utf8",this._pos,n);return this._pos+=t,td("_parseString: result: %s",r),r}_parseStringPair(){return td("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const e=this._parseNum(),t=e+this._pos;if(-1===e||t>this._list.length||t>this.packet.length)return null;const n=this._list.slice(this._pos,t);return this._pos+=e,td("_parseBuffer: result: %o",n),n}_parseNum(){if(this._list.length-this._pos<2)return-1;const e=this._list.readUInt16BE(this._pos);return this._pos+=2,td("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const e=this._list.readUInt32BE(this._pos);return this._pos+=4,td("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){td("_parseVarByteNum");let t,n=0,r=1,o=0,i=!1;const s=this._pos?this._pos:0;for(;n<4&&s+n<this._list.length;){if(t=this._list.readUInt8(s+n++),o+=r*(t&ed.VARBYTEINT_MASK),r*=128,0==(t&ed.VARBYTEINT_FIN_MASK)){i=!0;break}if(this._list.length<=n)break}return!i&&4===n&&this._list.length>=n&&this._emitError(new Error("Invalid variable byte integer")),s&&(this._pos+=n),i=!!i&&(e?{bytes:n,value:o}:o),td("_parseVarByteNum: result: %o",i),i}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),td("_parseByte: result: %o",e),e}_parseByType(e){switch(td("_parseByType: type: %s",e),e){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){td("_parseProperties");const e=this._parseVarByteNum(),t=this._pos+e,n={};for(;this._pos<t;){const e=this._parseByte();if(!e)return this._emitError(new Error("Cannot parse property code type")),!1;const t=ed.propertiesCodes[e];if(!t)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==t)n[t]?(Array.isArray(n[t])||(n[t]=[n[t]]),n[t].push(this._parseByType(ed.propertiesTypes[t]))):n[t]=this._parseByType(ed.propertiesTypes[t]);else{n[t]||(n[t]=Object.create(null));const e=this._parseByType(ed.propertiesTypes[t]);if(n[t][e.name])if(Array.isArray(n[t][e.name]))n[t][e.name].push(e.value);else{const r=n[t][e.name];n[t][e.name]=[r],n[t][e.name].push(e.value)}else n[t][e.name]=e.value}}return n}_newPacket(){return td("_newPacket"),this.packet&&(this._list.consume(this.packet.length),td("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),td("_newPacket: new packet"),this.packet=new Zp,this._pos=0,!0}_emitError(e){td("_emitError"),this.error=e,this.emit("error",e)}}var rd=nd;const od={},id=Buffer.isBuffer(Buffer.from([1,2]).subarray(0,1));function sd(e){const t=Buffer.allocUnsafe(2);return t.writeUInt8(e>>8,0),t.writeUInt8(255&e,1),t}var ad={cache:od,generateCache:function(){for(let e=0;e<65536;e++)od[e]=sd(e)},generateNumber:sd,genBufVariableByteInt:function(e){let t=0,n=0;const r=Buffer.allocUnsafe(4);do{t=e%128|0,(e=e/128|0)>0&&(t|=128),r.writeUInt8(t,n++)}while(e>0&&n<4);return e>0&&(n=0),id?r.subarray(0,n):r.slice(0,n)},generate4ByteBuffer:function(e){const t=Buffer.allocUnsafe(4);return t.writeUInt32BE(e,0),t}},cd={exports:{}};"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?cd.exports={nextTick:function(e,t,n,r){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,i,s=arguments.length;switch(s){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick((function(){e.call(null,t)}));case 3:return process.nextTick((function(){e.call(null,t,n)}));case 4:return process.nextTick((function(){e.call(null,t,n,r)}));default:for(o=new Array(s-1),i=0;i<o.length;)o[i++]=arguments[i];return process.nextTick((function(){e.apply(null,o)}))}}}:cd.exports=process;const ld=Qp.exports,ud=Buffer.allocUnsafe(0),pd=Buffer.from([0]),dd=ad,fd=cd.exports.nextTick,hd=gt.exports("mqtt-packet:writeToStream"),md=dd.cache,gd=dd.generateNumber,yd=dd.generateCache,bd=dd.genBufVariableByteInt,vd=dd.generate4ByteBuffer;let _d=Ad,wd=!0;function Cd(e,t,n){switch(hd("generate called"),t.cork&&(t.cork(),fd(Sd,t)),wd&&(wd=!1,yd()),hd("generate: packet.cmd: %s",e.cmd),e.cmd){case"connect":return function(e,t,n){const r=e||{},o=r.protocolId||"MQTT";let i=r.protocolVersion||4;const s=r.will;let a=r.clean;const c=r.keepalive||0,l=r.clientId||"",u=r.username,p=r.password,d=r.properties;void 0===a&&(a=!0);let f=0;if(!o||"string"!=typeof o&&!Buffer.isBuffer(o))return t.emit("error",new Error("Invalid protocolId")),!1;f+=o.length+2;if(3!==i&&4!==i&&5!==i)return t.emit("error",new Error("Invalid protocol version")),!1;f+=1;if(("string"==typeof l||Buffer.isBuffer(l))&&(l||i>=4)&&(l||a))f+=Buffer.byteLength(l)+2;else{if(i<4)return t.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*a==0)return t.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof c||c<0||c>65535||c%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;f+=2;if(f+=1,5===i){var h=xd(t,d);if(!h)return!1;f+=h.length}if(s){if("object"!=typeof s)return t.emit("error",new Error("Invalid will")),!1;if(!s.topic||"string"!=typeof s.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(f+=Buffer.byteLength(s.topic)+2,f+=2,s.payload){if(!(s.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof s.payload?f+=Buffer.byteLength(s.payload):f+=s.payload.length}var m={};if(5===i){if(!(m=xd(t,s.properties)))return!1;f+=m.length}}let g=!1;if(null!=u){if(!Nd(u))return t.emit("error",new Error("Invalid username")),!1;g=!0,f+=Buffer.byteLength(u)+2}if(null!=p){if(!g)return t.emit("error",new Error("Username is required to use password")),!1;if(!Nd(p))return t.emit("error",new Error("Invalid password")),!1;f+=jd(p)+2}t.write(ld.CONNECT_HEADER),Ed(t,f),Td(t,o),r.bridgeMode&&(i+=128);t.write(131===i?ld.VERSION131:132===i?ld.VERSION132:4===i?ld.VERSION4:5===i?ld.VERSION5:ld.VERSION3);let y=0;y|=null!=u?ld.USERNAME_MASK:0,y|=null!=p?ld.PASSWORD_MASK:0,y|=s&&s.retain?ld.WILL_RETAIN_MASK:0,y|=s&&s.qos?s.qos<<ld.WILL_QOS_SHIFT:0,y|=s?ld.WILL_FLAG_MASK:0,y|=a?ld.CLEAN_SESSION_MASK:0,t.write(Buffer.from([y])),_d(t,c),5===i&&h.write();Td(t,l),s&&(5===i&&m.write(),Rd(t,s.topic),Td(t,s.payload));null!=u&&Td(t,u);null!=p&&Td(t,p);return!0}(e,t);case"connack":return function(e,t,n){const r=n?n.protocolVersion:4,o=e||{},i=5===r?o.reasonCode:o.returnCode,s=o.properties;let a=2;if("number"!=typeof i)return t.emit("error",new Error("Invalid return code")),!1;let c=null;if(5===r){if(c=xd(t,s),!c)return!1;a+=c.length}t.write(ld.CONNACK_HEADER),Ed(t,a),t.write(o.sessionPresent?ld.SESSIONPRESENT_HEADER:pd),t.write(Buffer.from([i])),null!=c&&c.write();return!0}(e,t,n);case"publish":return function(e,t,n){hd("publish: packet: %o",e);const r=n?n.protocolVersion:4,o=e||{},i=o.qos||0,s=o.retain?ld.RETAIN_MASK:0,a=o.topic,c=o.payload||ud,l=o.messageId,u=o.properties;let p=0;if("string"==typeof a)p+=Buffer.byteLength(a)+2;else{if(!Buffer.isBuffer(a))return t.emit("error",new Error("Invalid topic")),!1;p+=a.length+2}Buffer.isBuffer(c)?p+=c.length:p+=Buffer.byteLength(c);if(i&&"number"!=typeof l)return t.emit("error",new Error("Invalid messageId")),!1;i&&(p+=2);let d=null;if(5===r){if(d=xd(t,u),!d)return!1;p+=d.length}t.write(ld.PUBLISH_HEADER[i][o.dup?1:0][s?1:0]),Ed(t,p),_d(t,jd(a)),t.write(a),i>0&&_d(t,l);null!=d&&d.write();return hd("publish: payload: %o",c),t.write(c)}(e,t,n);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(e,t,n){const r=n?n.protocolVersion:4,o=e||{},i=o.cmd||"puback",s=o.messageId,a=o.dup&&"pubrel"===i?ld.DUP_MASK:0;let c=0;const l=o.reasonCode,u=o.properties;let p=5===r?3:2;"pubrel"===i&&(c=1);if("number"!=typeof s)return t.emit("error",new Error("Invalid messageId")),!1;let d=null;if(5===r&&"object"==typeof u){if(d=Pd(t,u,n,p),!d)return!1;p+=d.length}t.write(ld.ACKS[i][c][a][0]),Ed(t,p),_d(t,s),5===r&&t.write(Buffer.from([l]));null!==d&&d.write();return!0}(e,t,n);case"subscribe":return function(e,t,n){hd("subscribe: packet: ");const r=n?n.protocolVersion:4,o=e||{},i=o.dup?ld.DUP_MASK:0,s=o.messageId,a=o.subscriptions,c=o.properties;let l=0;if("number"!=typeof s)return t.emit("error",new Error("Invalid messageId")),!1;l+=2;let u=null;if(5===r){if(u=xd(t,c),!u)return!1;l+=u.length}if("object"!=typeof a||!a.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(let e=0;e<a.length;e+=1){const n=a[e].topic,o=a[e].qos;if("string"!=typeof n)return t.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof o)return t.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===r){if("boolean"!=typeof(a[e].nl||!1))return t.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(a[e].rap||!1))return t.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const n=a[e].rh||0;if("number"!=typeof n||n>2)return t.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}l+=Buffer.byteLength(n)+2+1}hd("subscribe: writing to stream: %o",ld.SUBSCRIBE_HEADER),t.write(ld.SUBSCRIBE_HEADER[1][i?1:0][0]),Ed(t,l),_d(t,s),null!==u&&u.write();let p=!0;for(const e of a){const n=e.topic,o=e.qos,i=+e.nl,s=+e.rap,a=e.rh;let c;Rd(t,n),c=ld.SUBSCRIBE_OPTIONS_QOS[o],5===r&&(c|=i?ld.SUBSCRIBE_OPTIONS_NL:0,c|=s?ld.SUBSCRIBE_OPTIONS_RAP:0,c|=a?ld.SUBSCRIBE_OPTIONS_RH[a]:0),p=t.write(Buffer.from([c]))}return p}(e,t,n);case"suback":return function(e,t,n){const r=n?n.protocolVersion:4,o=e||{},i=o.messageId,s=o.granted,a=o.properties;let c=0;if("number"!=typeof i)return t.emit("error",new Error("Invalid messageId")),!1;c+=2;if("object"!=typeof s||!s.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<s.length;e+=1){if("number"!=typeof s[e])return t.emit("error",new Error("Invalid qos vector")),!1;c+=1}let l=null;if(5===r){if(l=Pd(t,a,n,c),!l)return!1;c+=l.length}t.write(ld.SUBACK_HEADER),Ed(t,c),_d(t,i),null!==l&&l.write();return t.write(Buffer.from(s))}(e,t,n);case"unsubscribe":return function(e,t,n){const r=n?n.protocolVersion:4,o=e||{},i=o.messageId,s=o.dup?ld.DUP_MASK:0,a=o.unsubscriptions,c=o.properties;let l=0;if("number"!=typeof i)return t.emit("error",new Error("Invalid messageId")),!1;l+=2;if("object"!=typeof a||!a.length)return t.emit("error",new Error("Invalid unsubscriptions")),!1;for(let e=0;e<a.length;e+=1){if("string"!=typeof a[e])return t.emit("error",new Error("Invalid unsubscriptions")),!1;l+=Buffer.byteLength(a[e])+2}let u=null;if(5===r){if(u=xd(t,c),!u)return!1;l+=u.length}t.write(ld.UNSUBSCRIBE_HEADER[1][s?1:0][0]),Ed(t,l),_d(t,i),null!==u&&u.write();let p=!0;for(let e=0;e<a.length;e++)p=Rd(t,a[e]);return p}(e,t,n);case"unsuback":return function(e,t,n){const r=n?n.protocolVersion:4,o=e||{},i=o.messageId,s=o.dup?ld.DUP_MASK:0,a=o.granted,c=o.properties,l=o.cmd,u=0;let p=2;if("number"!=typeof i)return t.emit("error",new Error("Invalid messageId")),!1;if(5===r){if("object"!=typeof a||!a.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<a.length;e+=1){if("number"!=typeof a[e])return t.emit("error",new Error("Invalid qos vector")),!1;p+=1}}let d=null;if(5===r){if(d=Pd(t,c,n,p),!d)return!1;p+=d.length}t.write(ld.ACKS[l][u][s][0]),Ed(t,p),_d(t,i),null!==d&&d.write();5===r&&t.write(Buffer.from(a));return!0}(e,t,n);case"pingreq":case"pingresp":return function(e,t,n){return t.write(ld.EMPTY[e.cmd])}(e,t);case"disconnect":return function(e,t,n){const r=n?n.protocolVersion:4,o=e||{},i=o.reasonCode,s=o.properties;let a=5===r?1:0,c=null;if(5===r){if(c=Pd(t,s,n,a),!c)return!1;a+=c.length}t.write(Buffer.from([ld.codes.disconnect<<4])),Ed(t,a),5===r&&t.write(Buffer.from([i]));null!==c&&c.write();return!0}(e,t,n);case"auth":return function(e,t,n){const r=n?n.protocolVersion:4,o=e||{},i=o.reasonCode,s=o.properties;let a=5===r?1:0;5!==r&&t.emit("error",new Error("Invalid mqtt version for auth packet"));const c=Pd(t,s,n,a);if(!c)return!1;a+=c.length,t.write(Buffer.from([ld.codes.auth<<4])),Ed(t,a),t.write(Buffer.from([i])),null!==c&&c.write();return!0}(e,t,n);default:return t.emit("error",new Error("Unknown command")),!1}}function Sd(e){e.uncork()}Object.defineProperty(Cd,"cacheNumbers",{get:()=>_d===Ad,set(e){e?(md&&0!==Object.keys(md).length||(wd=!0),_d=Ad):(wd=!1,_d=Od)}});const kd={};function Ed(e,t){if(t>ld.VARBYTEINT_MAX)return e.emit("error",new Error(`Invalid variable byte integer: ${t}`)),!1;let n=kd[t];return n||(n=bd(t),t<16384&&(kd[t]=n)),hd("writeVarByteInt: writing to stream: %o",n),e.write(n)}function Rd(e,t){const n=Buffer.byteLength(t);return _d(e,n),hd("writeString: %s",t),e.write(t,"utf8")}function Id(e,t,n){Rd(e,t),Rd(e,n)}function Ad(e,t){return hd("writeNumberCached: number: %d",t),hd("writeNumberCached: %o",md[t]),e.write(md[t])}function Od(e,t){const n=gd(t);return hd("writeNumberGenerated: %o",n),e.write(n)}function Td(e,t){"string"==typeof t?Rd(e,t):t?(_d(e,t.length),e.write(t)):_d(e,0)}function xd(e,t){if("object"!=typeof t||null!=t.length)return{length:1,write(){Bd(e,{},0)}};let n=0;function r(t,n){let r=0;switch(ld.propertiesTypes[t]){case"byte":if("boolean"!=typeof n)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;r+=2;break;case"int8":if("number"!=typeof n||n<0||n>255)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;r+=2;break;case"binary":if(n&&null===n)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;r+=1+Buffer.byteLength(n)+2;break;case"int16":if("number"!=typeof n||n<0||n>65535)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;r+=3;break;case"int32":if("number"!=typeof n||n<0||n>4294967295)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;r+=5;break;case"var":if("number"!=typeof n||n<0||n>268435455)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;r+=1+Buffer.byteLength(bd(n));break;case"string":if("string"!=typeof n)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;r+=3+Buffer.byteLength(n.toString());break;case"pair":if("object"!=typeof n)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;r+=Object.getOwnPropertyNames(n).reduce(((e,t)=>{const r=n[t];return Array.isArray(r)?e+=r.reduce(((e,n)=>e+=3+Buffer.byteLength(t.toString())+2+Buffer.byteLength(n.toString())),0):e+=3+Buffer.byteLength(t.toString())+2+Buffer.byteLength(n[t].toString()),e}),0);break;default:return e.emit("error",new Error(`Invalid property ${t}: ${n}`)),!1}return r}if(t)for(const e in t){let o=0,i=0;const s=t[e];if(Array.isArray(s))for(let t=0;t<s.length;t++){if(i=r(e,s[t]),!i)return!1;o+=i}else{if(i=r(e,s),!i)return!1;o=i}if(!o)return!1;n+=o}return{length:Buffer.byteLength(bd(n))+n,write(){Bd(e,t,n)}}}function Pd(e,t,n,r){const o=["reasonString","userProperties"],i=n&&n.properties&&n.properties.maximumPacketSize?n.properties.maximumPacketSize:0;let s=xd(e,t);if(i)for(;r+s.length>i;){const n=o.shift();if(!n||!t[n])return!1;delete t[n],s=xd(e,t)}return s}function Md(e,t,n){switch(ld.propertiesTypes[t]){case"byte":e.write(Buffer.from([ld.properties[t]])),e.write(Buffer.from([+n]));break;case"int8":e.write(Buffer.from([ld.properties[t]])),e.write(Buffer.from([n]));break;case"binary":e.write(Buffer.from([ld.properties[t]])),Td(e,n);break;case"int16":e.write(Buffer.from([ld.properties[t]])),_d(e,n);break;case"int32":e.write(Buffer.from([ld.properties[t]])),function(e,t){const n=vd(t);hd("write4ByteNumber: %o",n),e.write(n)}(e,n);break;case"var":e.write(Buffer.from([ld.properties[t]])),Ed(e,n);break;case"string":e.write(Buffer.from([ld.properties[t]])),Rd(e,n);break;case"pair":Object.getOwnPropertyNames(n).forEach((r=>{const o=n[r];Array.isArray(o)?o.forEach((n=>{e.write(Buffer.from([ld.properties[t]])),Id(e,r.toString(),n.toString())})):(e.write(Buffer.from([ld.properties[t]])),Id(e,r.toString(),o.toString()))}));break;default:return e.emit("error",new Error(`Invalid property ${t} value: ${n}`)),!1}}function Bd(e,t,n){Ed(e,n);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&null!==t[n]){const r=t[n];if(Array.isArray(r))for(let t=0;t<r.length;t++)Md(e,n,r[t]);else Md(e,n,r)}}function jd(e){return e?e instanceof Buffer?e.length:Buffer.byteLength(e):0}function Nd(e){return"string"==typeof e||e instanceof Buffer}var Fd=Cd;const Ud=Fd,Ld=s.default;class Dd extends Ld{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0;const t=new Array(this._array.length),n=this._array;let r,o=0;for(r=0;r<n.length&&void 0!==n[r];r++)"string"!=typeof n[r]?t[r]=n[r].length:t[r]=Buffer.byteLength(n[r]),e+=t[r];const i=Buffer.allocUnsafe(e);for(r=0;r<n.length&&void 0!==n[r];r++)"string"!=typeof n[r]?(n[r].copy(i,o),o+=t[r]):(i.write(n[r],o),o+=t[r]);return i}}var qd=function(e,t){const n=new Dd;return Ud(e,n,t),n.concat()};function $d(e,t,n){var r=this;this._callback=e,this._args=n,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=r._interval),r._interval&&clearInterval(r._interval),r._interval=setInterval(r._callback,e,r._args)},this.clear=function(){r._interval&&(clearInterval(r._interval),r._interval=void 0)},this.destroy=function(){r._interval&&clearInterval(r._interval),r._callback=void 0,r._interval=void 0,r._args=void 0}}sl.parser=rd.parser,sl.generate=qd,sl.writeToStream=Fd;var Hd=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new $d(arguments[0],arguments[1],e)};function Wd(e){for(var t=e.split("/"),n=0;n<t.length;n++)if("+"!==t[n]){if("#"===t[n])return n===t.length-1;if(-1!==t[n].indexOf("+")||-1!==t[n].indexOf("#"))return!1}return!0}var Vd={validateTopics:function(e){if(0===e.length)return"empty_topic_list";for(var t=0;t<e.length;t++)if(!Wd(e[t]))return e[t];return null}},Kd=s.default.EventEmitter,zd=il,Jd=sl,Yd=is.exports.Writable,Qd=ks.exports,Xd=Hd,Gd=Vd,Zd=rs,ef=gt.exports("mqttjs:client"),tf=process?process.nextTick:function(e){setTimeout(e,0)},nf=O.setImmediate||function(e){tf(e)},rf={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},of=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],sf={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function af(e,t,n){ef("sendPacket :: packet: %O",t),ef("sendPacket :: emitting `packetsend`"),e.emit("packetsend",t),ef("sendPacket :: writing to stream");var r=Jd.writeToStream(t,e.stream,e.options);ef("sendPacket :: writeToStream result %s",r),!r&&n?(ef("sendPacket :: handle events on `drain` once through callback."),e.stream.once("drain",n)):n&&(ef("sendPacket :: invoking cb"),n())}function cf(e){e&&(ef("flush: queue exists? %b",!!e),Object.keys(e).forEach((function(t){"function"==typeof e[t].cb&&(e[t].cb(new Error("Connection closed")),delete e[t])})))}function lf(e,t,n,r){ef("storeAndSend :: store packet with cmd %s to outgoingStore",t.cmd),e.outgoingStore.put(t,(function(o){if(o)return n&&n(o);r(),af(e,t,n)}))}function uf(e){ef("nop ::",e)}function pf(e,t){var n,r=this;if(!(this instanceof pf))return new pf(e,t);for(n in this.options=t||{},rf)void 0===this.options[n]?this.options[n]=rf[n]:this.options[n]=t[n];ef("MqttClient :: options.protocol",t.protocol),ef("MqttClient :: options.protocolVersion",t.protocolVersion),ef("MqttClient :: options.username",t.username),ef("MqttClient :: options.keepalive",t.keepalive),ef("MqttClient :: options.reconnectPeriod",t.reconnectPeriod),ef("MqttClient :: options.rejectUnauthorized",t.rejectUnauthorized),this.options.clientId="string"==typeof t.clientId?t.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),ef("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===t.protocolVersion&&t.customHandleAcks?t.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=e,this.outgoingStore=t.outgoingStore||new zd,this.incomingStore=t.incomingStore||new zd,this.queueQoSZero=void 0===t.queueQoSZero||t.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this.nextId=Math.max(1,Math.floor(65535*Math.random())),this.outgoing={},this._firstConnection=!0,this.on("connect",(function(){var e=this.queue;ef("connect :: sending queued packets"),function t(){var n,o=e.shift();ef("deliver :: entry %o",o),o&&(n=o.packet,ef("deliver :: call _sendPacket for %o",n),r._sendPacket(n,(function(e){o.cb&&o.cb(e),t()})))}()})),this.on("close",(function(){ef("close :: connected set to `false`"),this.connected=!1,ef("close :: clearing connackTimer"),clearTimeout(this.connackTimer),ef("close :: clearing ping timer"),null!==r.pingTimer&&(r.pingTimer.clear(),r.pingTimer=null),ef("close :: calling _setupReconnect"),this._setupReconnect()})),Kd.call(this),ef("MqttClient :: setting up stream"),this._setupStream()}Qd(pf,Kd),pf.prototype._setupStream=function(){var e,t=this,n=new Yd,r=Jd.parser(this.options),o=null,i=[];function s(){if(i.length)tf(a);else{var e=o;o=null,e()}}function a(){ef("work :: getting next packet in queue");var e=i.shift();if(e)ef("work :: packet pulled from queue"),t._handlePacket(e,s);else{ef("work :: no packets in queue");var n=o;o=null,ef("work :: done flag is %s",!!n),n&&n()}}if(ef("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),ef("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),r.on("packet",(function(e){ef("parser :: on packet push to packets array."),i.push(e)})),n._write=function(e,t,n){o=n,ef("writable stream :: parsing buffer"),r.parse(e),a()},ef("_setupStream :: pipe stream to writable stream"),this.stream.pipe(n),this.stream.on("error",(function(e){ef("streamErrorHandler :: error",e.message),of.includes(e.code)?(ef("streamErrorHandler :: emitting error"),t.emit("error",e)):uf(e)})),this.stream.on("close",(function(){var e;ef("(%s)stream :: on close",t.options.clientId),(e=t.outgoing)&&(ef("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(e).forEach((function(t){e[t].volatile&&"function"==typeof e[t].cb&&(e[t].cb(new Error("Connection closed")),delete e[t])}))),ef("stream: emit close to MqttClient"),t.emit("close")})),ef("_setupStream: sending packet `connect`"),(e=Object.create(this.options)).cmd="connect",af(this,e),r.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return t.end((()=>this.emit("error",new Error("Packet has no Authentication Method")))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket)af(this,Zd({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){ef("!!connectTimeout hit!! Calling _cleanUp with force `true`"),t._cleanUp(!0)}),this.options.connectTimeout)},pf.prototype._handlePacket=function(e,t){var n=this.options;if(5===n.protocolVersion&&n.properties&&n.properties.maximumPacketSize&&n.properties.maximumPacketSize<e.length)return this.emit("error",new Error("exceeding packets size "+e.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(ef("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"pingresp":this._handlePingresp(e),t();break;case"disconnect":this._handleDisconnect(e),t()}},pf.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},pf.prototype.publish=function(e,t,n,r){var o;ef("publish :: message `%s` to topic `%s`",t,e);var i=this.options;"function"==typeof n&&(r=n,n=null);if(n=Zd({qos:0,retain:!1,dup:!1},n),this._checkDisconnecting(r))return this;switch(o={cmd:"publish",topic:e,payload:t,qos:n.qos,retain:n.retain,messageId:this._nextId(),dup:n.dup},5===i.protocolVersion&&(o.properties=n.properties,(!i.properties&&o.properties&&o.properties.topicAlias||n.properties&&i.properties&&(n.properties.topicAlias&&i.properties.topicAliasMaximum&&n.properties.topicAlias>i.properties.topicAliasMaximum||!i.properties.topicAliasMaximum&&n.properties.topicAlias))&&delete o.properties.topicAlias),ef("publish :: qos",n.qos),n.qos){case 1:case 2:this.outgoing[o.messageId]={volatile:!1,cb:r||uf},this._storeProcessing?(ef("_storeProcessing enabled"),this._packetIdsDuringStoreProcessing[o.messageId]=!1,this._storePacket(o,void 0,n.cbStorePut)):(ef("MqttClient:publish: packet cmd: %s",o.cmd),this._sendPacket(o,void 0,n.cbStorePut));break;default:this._storeProcessing?(ef("_storeProcessing enabled"),this._storePacket(o,r,n.cbStorePut)):(ef("MqttClient:publish: packet cmd: %s",o.cmd),this._sendPacket(o,r,n.cbStorePut))}return this},pf.prototype.subscribe=function(){for(var e,t=new Array(arguments.length),n=0;n<arguments.length;n++)t[n]=arguments[n];var r,o=[],i=t.shift(),s=i.resubscribe,a=t.pop()||uf,c=t.pop(),l=this,u=this.options.protocolVersion;if(delete i.resubscribe,"string"==typeof i&&(i=[i]),"function"!=typeof a&&(c=a,a=uf),null!==(r=Gd.validateTopics(i)))return nf(a,new Error("Invalid topic "+r)),this;if(this._checkDisconnecting(a))return ef("subscribe: discconecting true"),this;var p={qos:0};if(5===u&&(p.nl=!1,p.rap=!1,p.rh=0),c=Zd(p,c),Array.isArray(i)?i.forEach((function(e){if(ef("subscribe: array topic %s",e),!l._resubscribeTopics.hasOwnProperty(e)||l._resubscribeTopics[e].qos<c.qos||s){var t={topic:e,qos:c.qos};5===u&&(t.nl=c.nl,t.rap=c.rap,t.rh=c.rh,t.properties=c.properties),ef("subscribe: pushing topic `%s` and qos `%s` to subs list",t.topic,t.qos),o.push(t)}})):Object.keys(i).forEach((function(e){if(ef("subscribe: object topic %s",e),!l._resubscribeTopics.hasOwnProperty(e)||l._resubscribeTopics[e].qos<i[e].qos||s){var t={topic:e,qos:i[e].qos};5===u&&(t.nl=i[e].nl,t.rap=i[e].rap,t.rh=i[e].rh,t.properties=c.properties),ef("subscribe: pushing `%s` to subs list",t),o.push(t)}})),e={cmd:"subscribe",subscriptions:o,qos:1,retain:!1,dup:!1,messageId:this._nextId()},c.properties&&(e.properties=c.properties),o.length){if(this.options.resubscribe){ef("subscribe :: resubscribe true");var d=[];o.forEach((function(e){if(l.options.reconnectPeriod>0){var t={qos:e.qos};5===u&&(t.nl=e.nl||!1,t.rap=e.rap||!1,t.rh=e.rh||0,t.properties=e.properties),l._resubscribeTopics[e.topic]=t,d.push(e.topic)}})),l.messageIdToTopic[e.messageId]=d}return this.outgoing[e.messageId]={volatile:!0,cb:function(e,t){if(!e)for(var n=t.granted,r=0;r<n.length;r+=1)o[r].qos=n[r];a(e,o)}},ef("subscribe :: call _sendPacket"),this._sendPacket(e),this}a(null,[])},pf.prototype.unsubscribe=function(){for(var e={cmd:"unsubscribe",qos:1,messageId:this._nextId()},t=this,n=new Array(arguments.length),r=0;r<arguments.length;r++)n[r]=arguments[r];var o=n.shift(),i=n.pop()||uf,s=n.pop();return"string"==typeof o&&(o=[o]),"function"!=typeof i&&(s=i,i=uf),this._checkDisconnecting(i)||("string"==typeof o?e.unsubscriptions=[o]:Array.isArray(o)&&(e.unsubscriptions=o),this.options.resubscribe&&e.unsubscriptions.forEach((function(e){delete t._resubscribeTopics[e]})),"object"==typeof s&&s.properties&&(e.properties=s.properties),this.outgoing[e.messageId]={volatile:!0,cb:i},ef("unsubscribe: call _sendPacket"),this._sendPacket(e)),this},pf.prototype.end=function(e,t,n){var r=this;function o(){ef("end :: closeStores: closing incoming and outgoing stores"),r.disconnected=!0,r.incomingStore.close((function(e){r.outgoingStore.close((function(t){if(ef("end :: closeStores: emitting end"),r.emit("end"),n){let r=e||t;ef("end :: closeStores: invoking callback with args"),n(r)}}))})),r._deferredReconnect&&r._deferredReconnect()}function i(){ef("end :: (%s) :: finish :: calling _cleanUp with force %s",r.options.clientId,e),r._cleanUp(e,(()=>{ef("end :: finish :: calling process.nextTick on closeStores"),tf(o.bind(r))}),t)}return ef("end :: (%s)",this.options.clientId),null!=e&&"boolean"==typeof e||(n=t||uf,t=e,e=!1,"object"!=typeof t&&(n=t,t=null,"function"!=typeof n&&(n=uf))),"object"!=typeof t&&(n=t,t=null),ef("end :: cb? %s",!!n),n=n||uf,this.disconnecting?(n(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(ef("end :: (%s) :: calling finish in 10ms once outgoing is empty",r.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,i,10))):(ef("end :: (%s) :: immediately calling finish",r.options.clientId),i()),this)},pf.prototype.removeOutgoingMessage=function(e){var t=this.outgoing[e]?this.outgoing[e].cb:null;return delete this.outgoing[e],this.outgoingStore.del({messageId:e},(function(){t(new Error("Message removed"))})),this},pf.prototype.reconnect=function(e){ef("client reconnect");var t=this,n=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new zd,t.outgoingStore=t.options.outgoingStore||new zd,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=n:n(),this},pf.prototype._reconnect=function(){ef("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end((()=>{this._setupStream()})),ef("client already connected. disconnecting first.")):(ef("_reconnect: calling _setupStream"),this._setupStream())},pf.prototype._setupReconnect=function(){var e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0?(this.reconnecting||(ef("_setupReconnect :: emit `offline` state"),this.emit("offline"),ef("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),ef("_setupReconnect :: setting reconnectTimer for %d ms",e.options.reconnectPeriod),e.reconnectTimer=setInterval((function(){ef("reconnectTimer :: reconnect triggered!"),e._reconnect()}),e.options.reconnectPeriod)):ef("_setupReconnect :: doing nothing...")},pf.prototype._clearReconnect=function(){ef("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},pf.prototype._cleanUp=function(e,t){var n=arguments[2];if(t&&(ef("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",t)),ef("_cleanUp :: forced? %s",e),e)0===this.options.reconnectPeriod&&this.options.clean&&cf(this.outgoing),ef("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{var r=Zd({cmd:"disconnect"},n);ef("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(r,nf.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(ef("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(ef("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(ef("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",t),t())},pf.prototype._sendPacket=function(e,t,n){if(ef("_sendPacket :: (%s) :: start",this.options.clientId),n=n||uf,!this.connected)return ef("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(e,t,n);switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void lf(this,e,t,n);default:return void af(this,e,t)}switch(e.qos){case 2:case 1:lf(this,e,t,n);break;default:af(this,e,t)}ef("_sendPacket :: (%s) :: end",this.options.clientId)},pf.prototype._storePacket=function(e,t,n){ef("_storePacket :: packet: %o",e),ef("_storePacket :: cb? %s",!!t),n=n||uf,0===(e.qos||0)&&this.queueQoSZero||"publish"!==e.cmd?this.queue.push({packet:e,cb:t}):e.qos>0?(t=this.outgoing[e.messageId]?this.outgoing[e.messageId].cb:null,this.outgoingStore.put(e,(function(e){if(e)return t&&t(e);n()}))):t&&t(new Error("No connection to broker"))},pf.prototype._setupPingTimer=function(){ef("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);var e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=Xd((function(){e._checkPing()}),1e3*this.options.keepalive))},pf.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},pf.prototype._checkPing=function(){ef("_checkPing :: checking ping..."),this.pingResp?(ef("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(ef("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},pf.prototype._handlePingresp=function(){this.pingResp=!0},pf.prototype._handleConnack=function(e){ef("_handleConnack");var t=this.options,n=5===t.protocolVersion?e.reasonCode:e.returnCode;if(clearTimeout(this.connackTimer),e.properties&&(e.properties.topicAliasMaximum&&(t.properties||(t.properties={}),t.properties.topicAliasMaximum=e.properties.topicAliasMaximum),e.properties.serverKeepAlive&&t.keepalive&&(t.keepalive=e.properties.serverKeepAlive,this._shiftPingInterval()),e.properties.maximumPacketSize&&(t.properties||(t.properties={}),t.properties.maximumPacketSize=e.properties.maximumPacketSize)),0===n)this.reconnecting=!1,this._onConnect(e);else if(n>0){var r=new Error("Connection refused: "+sf[n]);r.code=n,this.emit("error",r)}},pf.prototype._handlePublish=function(e,t){ef("_handlePublish: packet %o",e),t=void 0!==t?t:uf;var n=e.topic.toString(),r=e.payload,o=e.qos,i=e.messageId,s=this,a=this.options,c=[0,16,128,131,135,144,145,151,153];switch(ef("_handlePublish: qos %d",o),o){case 2:a.customHandleAcks(n,r,e,(function(n,r){return n instanceof Error||(r=n,n=null),n?s.emit("error",n):-1===c.indexOf(r)?s.emit("error",new Error("Wrong reason code for pubrec")):void(r?s._sendPacket({cmd:"pubrec",messageId:i,reasonCode:r},t):s.incomingStore.put(e,(function(){s._sendPacket({cmd:"pubrec",messageId:i},t)})))}));break;case 1:a.customHandleAcks(n,r,e,(function(o,a){return o instanceof Error||(a=o,o=null),o?s.emit("error",o):-1===c.indexOf(a)?s.emit("error",new Error("Wrong reason code for puback")):(a||s.emit("message",n,r,e),void s.handleMessage(e,(function(e){if(e)return t&&t(e);s._sendPacket({cmd:"puback",messageId:i,reasonCode:a},t)})))}));break;case 0:this.emit("message",n,r,e),this.handleMessage(e,t);break;default:ef("_handlePublish: unknown QoS. Doing nothing.")}},pf.prototype.handleMessage=function(e,t){t()},pf.prototype._handleAck=function(e){var t,n=e.messageId,r=e.cmd,o=null,i=this.outgoing[n]?this.outgoing[n].cb:null,s=this;if(i){switch(ef("_handleAck :: packet type",r),r){case"pubcomp":case"puback":var a=e.reasonCode;a&&a>0&&16!==a&&((t=new Error("Publish error: "+sf[a])).code=a,i(t,e)),delete this.outgoing[n],this.outgoingStore.del(e,i);break;case"pubrec":o={cmd:"pubrel",qos:2,messageId:n};var c=e.reasonCode;c&&c>0&&16!==c?((t=new Error("Publish error: "+sf[c])).code=c,i(t,e)):this._sendPacket(o);break;case"suback":delete this.outgoing[n];for(var l=0;l<e.granted.length;l++)if(0!=(128&e.granted[l])){var u=this.messageIdToTopic[n];u&&u.forEach((function(e){delete s._resubscribeTopics[e]}))}i(null,e);break;case"unsuback":delete this.outgoing[n],i(null);break;default:s.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else ef("_handleAck :: Server sent an ack in error. Ignoring.")},pf.prototype._handlePubrel=function(e,t){ef("handling pubrel packet"),t=void 0!==t?t:uf;var n=e.messageId,r=this,o={cmd:"pubcomp",messageId:n};r.incomingStore.get(e,(function(e,n){e?r._sendPacket(o,t):(r.emit("message",n.topic,n.payload,n),r.handleMessage(n,(function(e){if(e)return t(e);r.incomingStore.del(n,uf),r._sendPacket(o,t)})))}))},pf.prototype._handleDisconnect=function(e){this.emit("disconnect",e)},pf.prototype._nextId=function(){var e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},pf.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},pf.prototype._resubscribe=function(e){ef("_resubscribe");var t=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!e.sessionPresent)&&t.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){ef("_resubscribe: protocolVersion 5");for(var n=0;n<t.length;n++){var r={};r[t[n]]=this._resubscribeTopics[t[n]],r.resubscribe=!0,this.subscribe(r,{properties:r[t[n]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},pf.prototype._onConnect=function(e){if(this.disconnected)this.emit("connect",e);else{var t=this;this._setupPingTimer(),this._resubscribe(e),this.connected=!0,function n(){var r=t.outgoingStore.createStream();function o(){t._storeProcessing=!1,t._packetIdsDuringStoreProcessing={}}function i(){r.destroy(),r=null,o()}t.once("close",i),r.on("error",(function(e){o(),t.removeListener("close",i),t.emit("error",e)})),r.on("end",(function(){var r=!0;for(var s in t._packetIdsDuringStoreProcessing)if(!t._packetIdsDuringStoreProcessing[s]){r=!1;break}r?(o(),t.removeListener("close",i),t.emit("connect",e)):n()})),function e(){if(r){t._storeProcessing=!0;var n,o=r.read(1);o?t._packetIdsDuringStoreProcessing[o.messageId]?e():t.disconnecting||t.reconnectTimer?r.destroy&&r.destroy():(n=t.outgoing[o.messageId]?t.outgoing[o.messageId].cb:null,t.outgoing[o.messageId]={volatile:!1,cb:function(t,r){n&&n(t,r),e()}},t._packetIdsDuringStoreProcessing[o.messageId]=!0,t._sendPacket(o)):r.once("readable",e)}}()}()}};var df=pf,ff=ui,hf=gt.exports("mqttjs:tcp");var mf=function(e,t){var n,r;return t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost",n=t.port,r=t.hostname,hf("port %d and host %s",n,r),ff.createConnection(n,r)},gf=ui,yf=gt.exports("mqttjs:tls");var bf=function(e,t){var n;function r(r){t.rejectUnauthorized&&e.emit("error",r),n.end()}return t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",t.servername=t.host,t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,yf("port %d host %s rejectUnauthorized %b",t.port,t.host,t.rejectUnauthorized),(n=gf.connect(t)).on("secureConnect",(function(){t.rejectUnauthorized&&!n.authorized?n.emit("error",new Error("TLS not authorized")):n.removeListener("error",r)})),n.on("error",r),n},vf={exports:{}},_f=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){r[e]=t[e]})),r;function r(){for(var e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];var r=t.apply(this,e),o=e[e.length-1];return"function"==typeof r&&r!==o&&Object.keys(o).forEach((function(e){r[e]=o[e]})),r}};var wf=_f;function Cf(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function Sf(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}vf.exports=wf(Cf),vf.exports.strict=wf(Sf),Cf.proto=Cf((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Cf(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Sf(this)},configurable:!0})}));var kf=vf.exports,Ef=function(){},Rf=function(e,t,n){if("function"==typeof t)return Rf(e,null,t);t||(t={}),n=kf(n||Ef);var r=e._writableState,o=e._readableState,i=t.readable||!1!==t.readable&&e.readable,s=t.writable||!1!==t.writable&&e.writable,a=!1,c=function(){e.writable||l()},l=function(){s=!1,i||n.call(e)},u=function(){i=!1,s||n.call(e)},p=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},d=function(t){n.call(e,t)},f=function(){process.nextTick(h)},h=function(){if(!a)return(!i||o&&o.ended&&!o.destroyed)&&(!s||r&&r.ended&&!r.destroyed)?void 0:n.call(e,new Error("premature close"))},m=function(){e.req.on("finish",l)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?s&&!r&&(e.on("end",c),e.on("close",c)):(e.on("complete",l),e.on("abort",f),e.req?m():e.on("request",m)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",p),e.on("end",u),e.on("finish",l),!1!==t.error&&e.on("error",d),e.on("close",f),function(){a=!0,e.removeListener("complete",l),e.removeListener("abort",f),e.removeListener("request",m),e.req&&e.req.removeListener("finish",l),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",l),e.removeListener("exit",p),e.removeListener("end",u),e.removeListener("error",d),e.removeListener("close",f)}},If=function(e){var t=e._readableState;return t?t.objectMode||"number"==typeof e._duplexState?e.read():e.read(function(e){if(e.buffer.length)return e.buffer.head?e.buffer.head.data.length:e.buffer[0].length;return e.length}(t)):null};var Af=is.exports,Of=Rf,Tf=ks.exports,xf=If,Pf=Buffer.from&&Buffer.from!==Uint8Array.from?Buffer.from([0]):new Buffer([0]),Mf=function(e,t){e._corked?e.once("uncork",t):t()},Bf=function(e,t){return function(n){n?function(e,t){e._autoDestroy&&e.destroy(t)}(e,"premature close"===n.message?null:n):t&&!e._ended&&e.end()}},jf=function(){},Nf=function(e,t,n){if(!(this instanceof Nf))return new Nf(e,t,n);Af.Duplex.call(this,n),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!n||!1!==n.autoDestroy,this._forwardDestroy=!n||!1!==n.destroy,this._forwardEnd=!n||!1!==n.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};Tf(Nf,Af.Duplex),Nf.obj=function(e,t,n){return n||(n={}),n.objectMode=!0,n.highWaterMark=16,new Nf(e,t,n)},Nf.prototype.cork=function(){1==++this._corked&&this.emit("cork")},Nf.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},Nf.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed)e&&e.destroy&&e.destroy();else if(null!==e&&!1!==e){var t=this,n=Of(e,{writable:!0,readable:!1},Bf(this,this._forwardEnd)),r=function(){var e=t._ondrain;t._ondrain=null,e&&e()};this._unwrite&&process.nextTick(r),this._writable=e,this._writable.on("drain",r),this._unwrite=function(){t._writable.removeListener("drain",r),n()},this.uncork()}else this.end()},Nf.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed)e&&e.destroy&&e.destroy();else{if(null===e||!1===e)return this.push(null),void this.resume();var t,n=this,r=Of(e,{writable:!1,readable:!0},Bf(this)),o=function(){n._forward()},i=function(){n.push(null)};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:(t=e,new Af.Readable({objectMode:!0,highWaterMark:16}).wrap(t)),this._readable2.on("readable",o),this._readable2.on("end",i),this._unread=function(){n._readable2.removeListener("readable",o),n._readable2.removeListener("end",i),r()},this._forward()}},Nf.prototype._read=function(){this._drained=!0,this._forward()},Nf.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var e;for(this._forwarding=!0;this._drained&&null!==(e=xf(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},Nf.prototype.destroy=function(e,t){if(t||(t=jf),this.destroyed)return t(null);this.destroyed=!0;var n=this;process.nextTick((function(){n._destroy(e),t(null)}))},Nf.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},Nf.prototype._write=function(e,t,n){if(!this.destroyed)return this._corked?Mf(this,this._write.bind(this,e,t,n)):e===Pf?this._finish(n):this._writable?void(!1===this._writable.write(e)?this._ondrain=n:this.destroyed||n()):n()},Nf.prototype._finish=function(e){var t=this;this.emit("preend"),Mf(this,(function(){!function(e,t){e?e._writableState&&e._writableState.finished?t():e._writableState?e.end(t):(e.end(),t()):t()}(t._forwardEnd&&t._writable,(function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),Mf(t,e)}))}))},Nf.prototype.end=function(e,t,n){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this._writableState.destroyed||this.write(Pf),Af.Writable.prototype.end.call(this,n))};var Ff,Uf,Lf,Df=Nf,qf=is.exports.Transform,$f=Df;var Hf,Wf,Vf,Kf=function(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");var n="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);var r=function(e,t){var n="wxs"===e.protocol?"wss":"ws",r=n+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(r=n+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}(t,e);Ff=wx.connectSocket({url:r,protocols:[n]}),Uf=function(){var e=new qf;return e._write=function(e,t,n){Ff.send({data:e.buffer,success:function(){n()},fail:function(e){n(new Error(e))}})},e._flush=function(e){Ff.close({success:function(){e()}})},e}(),(Lf=$f.obj())._destroy=function(e,t){Ff.close({success:function(){t&&t(e)}})};var o=Lf.destroy;return Lf.destroy=function(){Lf.destroy=o;var e=this;setTimeout((function(){Ff.close({fail:function(){e._destroy(new Error)}})}),0)}.bind(Lf),Ff.onOpen((function(){Lf.setReadable(Uf),Lf.setWritable(Uf),Lf.emit("connect")})),Ff.onMessage((function(e){var t=e.data;t=t instanceof ArrayBuffer?Buffer.from(t):Buffer.from(t,"utf8"),Uf.push(t)})),Ff.onClose((function(){Lf.end(),Lf.destroy()})),Ff.onError((function(e){Lf.destroy(new Error(e.errMsg))})),Lf},zf=is.exports.Transform,Jf=Df,Yf=!1;var Qf=function(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");var n="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);var r=function(e,t){var n="alis"===e.protocol?"wss":"ws",r=n+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(r=n+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}(t,e);return(Hf=t.my).connectSocket({url:r,protocols:n}),Wf=function(){var e=new zf;return e._write=function(e,t,n){Hf.sendSocketMessage({data:e.buffer,success:function(){n()},fail:function(){n(new Error)}})},e._flush=function(e){Hf.closeSocket({success:function(){e()}})},e}(),Vf=Jf.obj(),Yf||(Yf=!0,Hf.onSocketOpen((function(){Vf.setReadable(Wf),Vf.setWritable(Wf),Vf.emit("connect")})),Hf.onSocketMessage((function(e){if("string"==typeof e.data){var t=Buffer.from(e.data,"base64");Wf.push(t)}else{var n=new FileReader;n.addEventListener("load",(function(){var e=n.result;e=e instanceof ArrayBuffer?Buffer.from(e):Buffer.from(e,"utf8"),Wf.push(e)})),n.readAsArrayBuffer(e.data)}})),Hf.onSocketClose((function(){Vf.end(),Vf.destroy()})),Hf.onSocketError((function(e){Vf.destroy(e)}))),Vf},Xf={exports:{}};const Gf=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")},Zf=gt.exports("mqttjs:ws"),eh=Df,th=is.exports.Transform;let nh=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];const rh="undefined"!=typeof process&&"browser"===process.title||"function"==typeof __webpack_require__;function oh(e,t){let n=e.protocol+"://"+e.hostname+":"+e.port+e.path;return"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}function ih(e){let t=e;return e.hostname||(t.hostname="localhost"),e.port||("wss"===e.protocol?t.port=443:t.port=80),e.path||(t.path="/"),e.wsOptions||(t.wsOptions={}),rh||"wss"!==e.protocol||nh.forEach((function(n){e.hasOwnProperty(n)&&!e.wsOptions.hasOwnProperty(n)&&(t.wsOptions[n]=e[n])})),t}Xf.exports=rh?function(e,t){let n;Zf("browserStreamBuilder");let r=function(e){let t=ih(e);if(t.hostname||(t.hostname=t.host),!t.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const e=new URL(document.URL);t.hostname=e.hostname,t.port||(t.port=e.port)}return void 0===t.objectMode&&(t.objectMode=!(!0===t.binary||void 0===t.binary)),t}(t);const o=r.browserBufferSize||524288,i=t.browserBufferTimeout||1e3,s=!t.objectMode;let a=function(e,t){const n="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";let r=oh(t,e),o=new WebSocket(r,[n]);return o.binaryType="arraybuffer",o}(e,t),c=function(e,t,n){let r=new th({objectModeMode:e.objectMode});return r._write=t,r._flush=n,r}(t,(function e(t,n,r){a.bufferedAmount>o&&setTimeout(e,i,t,n,r),s&&"string"==typeof t&&(t=Buffer.from(t,"utf8"));try{a.send(t)}catch(e){return r(e)}r()}),(function(e){a.close(),e()}));t.objectMode||(c._writev=h),c.on("close",(()=>{a.close()}));const l=void 0!==a.addEventListener;function u(){n.setReadable(c),n.setWritable(c),n.emit("connect")}function p(){n.end(),n.destroy()}function d(e){n.destroy(e)}function f(e){let t=e.data;t=t instanceof ArrayBuffer?Buffer.from(t):Buffer.from(t,"utf8"),c.push(t)}function h(e,t){const n=new Array(e.length);for(let t=0;t<e.length;t++)"string"==typeof e[t].chunk?n[t]=Buffer.from(e[t],"utf8"):n[t]=e[t].chunk;this._write(Buffer.concat(n),"binary",t)}return a.readyState===a.OPEN?n=c:(n=n=eh(void 0,void 0,t),t.objectMode||(n._writev=h),l?a.addEventListener("open",u):a.onopen=u),n.socket=a,l?(a.addEventListener("close",p),a.addEventListener("error",d),a.addEventListener("message",f)):(a.onclose=p,a.onerror=d,a.onmessage=f),n}:function(e,t){Zf("streamBuilder");let n=ih(t);const r=oh(n,e);let o=function(e,t,n){Zf("createWebSocket"),Zf("protocol: "+n.protocolId+" "+n.protocolVersion);const r="MQIsdp"===n.protocolId&&3===n.protocolVersion?"mqttv3.1":"mqtt";return Zf("creating new Websocket for url: "+t+" and protocol: "+r),new Gf(t,[r],n.wsOptions)}(0,r,n),i=Gf.createWebSocketStream(o,n.wsOptions);return i.url=r,o.on("close",(()=>{i.destroy()})),i};var sh=df,ah=il,ch=c.default,lh=rs,uh=gt.exports("mqttjs"),ph={};function dh(e,t){if(uh("connecting to an MQTT broker..."),"object"!=typeof e||t||(t=e,e=null),t=t||{},e){var n=ch.parse(e,!0);if(null!=n.port&&(n.port=Number(n.port)),null===(t=lh(n,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(function(e){var t;e.auth&&((t=e.auth.match(/^(.+):(.+)$/))?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;case"ali":t.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!ph[t.protocol]){var r=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(e,t){return(!r||t%2!=0)&&"function"==typeof ph[e]}))[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");t.protocol&&(t.defaultProtocol=t.protocol);var o=new sh((function(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),uh("calling streambuilder for",t.protocol),ph[t.protocol](e,t)}),t);return o.on("error",(function(){})),o}"undefined"!=typeof process&&"browser"!==process.title||"function"!=typeof __webpack_require__?(ph.mqtt=mf,ph.tcp=mf,ph.ssl=bf,ph.tls=bf,ph.mqtts=bf):(ph.wx=Kf,ph.wxs=Kf,ph.ali=Qf,ph.alis=Qf),ph.ws=Xf.exports,ph.wss=Xf.exports,ns.exports=dh,ns.exports.connect=dh,ns.exports.MqttClient=sh,ns.exports.Store=ah;var fh=ns.exports;var hh;!function(e){e[e.IDENTIFIER_REJECTED=2]="IDENTIFIER_REJECTED",e[e.BAD_USERNAME_OR_PASSWORD=4]="BAD_USERNAME_OR_PASSWORD",e[e.NOT_AUTHORIZED=5]="NOT_AUTHORIZED"}(hh||(hh={}));const mh=e=>{let t,n=0,r=!0;const o=()=>{setTimeout((()=>{n+=1,t.reconnect()}),1e3*Math.pow(2,n>10?10:n))};return{connect:async function(i){return t&&(t.removeAllListeners(),t.end(!0)),t=fh.connect(e,function(e){return Object.assign({clean:!1,clientId:`mqttjs_ + ${Math.random().toString(16).substr(2,8)}`,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:0,will:{topic:"WillMsg",payload:"Connection Closed abnormally..!",qos:0,retain:!1}},e)}({username:i.userId,password:i.accessToken})),t.on("connect",(()=>{n=0,r=!0})),t.on("error",(e=>{switch(e.code){case 2:case 4:case 5:r=!1}})),t.on("close",(()=>{r&&o()})),new Promise((e=>t.once("connect",(()=>e()))))},async disconnect(){if(r=!1,this.connected)return new Promise((e=>null==t?void 0:t.end(!0,void 0,(()=>e()))))},get connected(){return!!(null==t?void 0:t.connected)},on(e,n){null==t||t.on(e,n)},once(e,n){null==t||t.once(e,n)},off(e,n){void 0!==n?null==t||t.off(e,n):null==t||t.removeAllListeners(e)},removeAllListeners(){null==t||t.removeAllListeners()},subscribe(e,n){const r=(t,r)=>{if(t||128===r[0].qos){const r=t?new u(t.message,8e5,"error"):new d(8e5,"error");console.error(`Failed to subscribe to topic ${e}`,r),null==n||n(r)}else console.log(`Subscribed to topic ${r[0].topic}`),null==n||n()};return t?t.subscribe(e,{qos:0},r):r(new Error("No connection to broker"),[]),()=>null==t?void 0:t.unsubscribe(e)},unsubscribe(e){null==t||t.unsubscribe(e)}}};const gh=["disconnected","error","connect_error","reconnect_error","reconnect_failed","v3.channel.didUpdate","v3.channel.didUpdate","v3.channel.didJoin","v3.channel.didLeave","v3.channel.didAddUsers","v3.channel.didRemoveUsers","v3.channel.didBan","v3.channel.didUnban","v3.message.didCreate","v3.message.didUpdate","v3.message.didDelete"],yh=["connect","message","disconnect","error","close","end","reconnect"],bh=()=>{return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map((function(e){e(n)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,n)}))}};var e},vh=(e,t,n,r)=>{const{log:o,emitter:i}=e,s=Date.now();o(`${t}(tmpid: ${s}) > listen`);const a=(...e)=>{o(`${t}(tmpid: ${s}) > trigger`,e),r(...e)};return i.on(n,a),()=>{o(`${t}(tmpid: ${s}) > dispose`),i.off(n,a)}},_h=(e,t)=>{const{emitter:n}=m();setTimeout((()=>{n.emit(e,t)}),0)},wh=async()=>{const e=m();return e.log("client/api/disconnectClient"),await new Promise((t=>{e.ws.once("disconnect",t),e.ws.disconnect(),e.mqtt.disconnect()})),e.emitter.all.clear(),e.ws.removeAllListeners(),e.mqtt.removeAllListeners(),e.userId=void 0,e.user=void 0,e.accessToken=void 0,!e.ws.connected},Ch=()=>{const e=(()=>{var e,t;return(null===(e=null===process||void 0===process?void 0:process.versions)||void 0===e?void 0:e.node)?process.versions.node:navigator?`${navigator.product.toLowerCase()}#${null!==(t=navigator.userAgent)&&void 0!==t?t:"unknown_agent"}`:"unknown_model"})();return{version:"11.0.0",kind:"web",model:e}},Sh=["disconnected","error","connect_error","reconnect_error","reconnect_failed"],kh=e=>{const t=m(),n=Sh.map((n=>vh(t,`client/onConnectionError(${n})`,n,(t=>{const r=t&&"code"in t?new u(t.message,t.code,"fatal"):new f(n);e(r)}))));return()=>{n.forEach((e=>e()))}},Eh=e=>kh((({code:t})=>{400312===t&&e()})),Rh=(e={})=>{const t=e;return{read:()=>t,write:e=>{Object.assign(t,e)},erase:(...e)=>{e.length||(e=Object.keys(t)),e.forEach((e=>delete t[e]))}}},Ih=(...e)=>e.reduce(((e,t)=>{const n=Rh();return Object.assign(Object.assign({},e),{[t]:n})}),{});const Ah=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},{hasOwnProperty:Oh}=Object.prototype,{propertyIsEnumerable:Th}=Object,xh=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}),Ph=O,Mh={concatArrays:!1,ignoreUndefined:!1},Bh=e=>{const t=[];for(const n in e)Oh.call(e,n)&&t.push(n);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(e);for(const r of n)Th.call(e,r)&&t.push(r)}return t};function jh(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return Bh(e).forEach((n=>{xh(t,n,jh(e[n]))})),t}(e):Ah(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return Bh(e).forEach((n=>{xh(t,n,jh(e[n]))})),t}(e):e}const Nh=(e,t,n,r)=>(n.forEach((n=>{void 0===t[n]&&r.ignoreUndefined||(n in e&&e[n]!==Object.getPrototypeOf(e)?xh(e,n,Fh(e[n],t[n],r)):xh(e,n,jh(t[n])))})),e);function Fh(e,t,n){return n.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,n)=>{let r=e.slice(0,0),o=0;return[e,t].forEach((t=>{const i=[];for(let n=0;n<t.length;n++)Oh.call(t,n)&&(i.push(String(n)),xh(r,o++,t===e?t[n]:jh(t[n])));r=Nh(r,t,Bh(t).filter((e=>!i.includes(e))),n)})),r})(e,t,n):Ah(t)&&Ah(e)?Nh(e,t,Bh(t),n):jh(t)}const Uh=function(...e){const t=Fh(jh(Mh),this!==Ph&&this||{},Mh);let n={_:{}};for(const r of e)if(void 0!==r){if(!Ah(r))throw new TypeError("`"+r+"` is not an Option Object");n=Fh(n,{_:r},t)}return n._}.bind({concatArrays:!0,ignoreUndefined:!0}),Lh=(e,t)=>new Promise(((n,r)=>{try{const r=e();t&&t(null,r),n(r)}catch(e){t&&t(e),r(e)}})),Dh=(e,t,n)=>Promise.all(e).then((e=>{const r=n?n(e):null;return t&&t(null,r),Promise.resolve(r)}),(e=>(t&&t(e),Promise.reject(e))));class qh{static getItem(e,t){return Lh((()=>window.localStorage.getItem(e)),t)}static setItem(e,t,n){return Lh((()=>{window.localStorage.setItem(e,t)}),n)}static removeItem(e,t){return Lh((()=>window.localStorage.removeItem(e)),t)}static mergeItem(e,t,n){return Lh((()=>{((e,t)=>{const n=window.localStorage.getItem(e),r=JSON.parse(n),o=JSON.parse(t),i=JSON.stringify(Uh(r,o));window.localStorage.setItem(e,i)})(e,t)}),n)}static clear(e){return Lh((()=>{window.localStorage.clear()}),e)}static getAllKeys(e){return Lh((()=>{const e=window.localStorage.length,t=[];for(let n=0;n<e;n+=1){const e=window.localStorage.key(n);t.push(e)}return t}),e)}static flushGetRequests(){}static multiGet(e,t){const n=e.map((e=>qh.getItem(e)));return Dh(n,t,(t=>t.map(((t,n)=>[e[n],t]))))}static multiSet(e,t){const n=e.map((e=>qh.setItem(e[0],e[1])));return Dh(n,t)}static multiRemove(e,t){const n=e.map((e=>qh.removeItem(e)));return Dh(n,t)}static multiMerge(e,t){const n=e.map((e=>qh.mergeItem(e[0],e[1])));return Dh(n,t)}}const $h=(e,t=Date.now(),n=_)=>{Object.fromEntries(Object.entries(e).map((([e,r])=>[e,Hh(r,t,n[e])])))},Hh=(e,t=Date.now(),n)=>{e.forEach((e=>Wh(e,t,n)))},Wh=(e,t=Date.now(),n=k(e))=>{var r,o;null!==(r=e.syncedAt)&&void 0!==r||(e.syncedAt=t);const{cache:i}=m();if(n){const t=v(n)(e);e.localId=null!==(o=null==i?void 0:i.lookup[`${n}#${t}`])&&void 0!==o?o:mt()}},Vh=(e,t,n)=>void 0!==n?e.filter((e=>e[t]===n)):e,Kh=({channelSegment:e},{channelSegment:t})=>e-t,zh=({segmentNumber:e},{segmentNumber:t})=>e-t;var Jh;e.SubscriptionLevels=void 0,(Jh=e.SubscriptionLevels||(e.SubscriptionLevels={})).COMMUNITY="community",Jh.POST="post",Jh.COMMENT="comment",Jh.POST_AND_COMMENT="post_and_comment",Jh.USER="user";const Yh=({path:e},t)=>{switch(t){case"post":return`${e}/post/+`;case"comment":return`${e}/post/+/comment/+`;case"post_and_comment":return`${e}/post/#`;default:return e}};let Qh,Xh;const Gh=async e=>{const t=m();t.log("user/getUser",e);const{data:n}=await t.http.get(`/api/v3/users/${e}`);$h(n),B(n);const{users:r}=n;return r.find((t=>t.userId===e))};Gh.locally=e=>{var t;m().log("user/getUser.locally",e);const[n]=null!==(t=y("user",e))&&void 0!==t?t:[];return n};const Zh=async e=>{const t=m();t.log("user/getUsers",e);const{data:n}=await t.http.get("/api/v3/users/list",{params:{userIds:e}});$h(n),B(n);const{users:r}=n;return A(r)};
3
5
  /*! *****************************************************************************
4
6
  Copyright (c) Microsoft Corporation.
5
7
 
@@ -14,4 +16,4 @@ var Amity=function(e){"use strict";var t;const n=null!==(t="v0.0.1-beta.8-umd")?
14
16
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
17
  PERFORMANCE OF THIS SOFTWARE.
16
18
  ***************************************************************************** */
17
- function bi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}Ci.locally=e=>{var t;const n=null!==(t=u("user",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return li(n)};const wi=async e=>{const t=c();t.log("user/queryUsers",e);const n=null!=e?e:{},{page:r,displayName:o,filter:s="all",sortBy:i="displayName"}=n,a=bi(n,["page","displayName","filter","sortBy"]),{data:l}=await t.http.get("/api/v3/users",{params:Object.assign(Object.assign({},a),{keyword:o,filter:s,sortBy:i,options:{token:W(r,"skiplimit")}})}),{paging:u}=l,p=bi(l,["paging"]);ui(p),C(p);const d=V(u.previous),h=V(u.next),{users:f}=p;return{data:li(f),prevPage:d,nextPage:h}};wi.locally=e=>{c().log("user/queryUsers.locally",e)};const Fi=e=>{const t=c();return Hs(t,"user/onUserUpdate","v3.user.didUpdate",(t=>{ui(t),C(t),e(t.users[0])}))},ki=async e=>{const t=c();t.log("file/getFile",e);const{data:n}=await t.http.get(`/api/v3/files/${e}`);return di(n),C({files:[n]}),n};ki.locally=e=>{var t;c().log("file/getFile.locally",e);const[n]=null!==(t=u("file",e))&&void 0!==t?t:[];return n};const Ai=async e=>{const t=c();t.log("role/queryRoles",e);const n=null!=e?e:{},{page:r,displayName:o,sortBy:s}=n,i=bi(n,["page","displayName","sortBy"]),{data:a}=await t.http.get("/api/v3/roles",{params:Object.assign(Object.assign({},i),{keyword:o,sortBy:s,options:{token:W(r,"skiplimit")}})}),{paging:l}=a,u=bi(a,["paging"]);ui(u),C(u);const p=V(l.previous),d=V(l.next),{roles:h}=u;return{data:li(h),prevPage:p,nextPage:d}};Ai.locally=e=>{c().log("role/queryRoles.locally",e)};const xi=async e=>{const t=c();t.log("role/getRole",e);const{data:n}=await t.http.get(`/api/v3/roles/${e}`);return pi(n),C({roles:n}),n.find((t=>t.roleId===e))};xi.locally=e=>{var t;c().log("role/getRole.locally",e);const[n]=null!==(t=u("role",e))&&void 0!==t?t:[];return n};const Oi=(e,t)=>{"message"===e?Js("v3.message.didUpdate",{messages:[t]}):"post"===e?Js("v3.post.didUpdate",{posts:[t]}):"comment"===e&&Js("v3.comment.didUpdate",{comments:[t]})},Si=async e=>{const t=c();t.log("message/getMessage",e);const{data:n}=await t.http.get(`/api/v3/messages/${e}`);ui(n),C(n);const{messages:r}=n;return r.find((t=>t.messageId===e))};Si.locally=e=>{var t;c().log("message/getMessage.locally",e);const[n]=null!==(t=u("message",e))&&void 0!==t?t:[];return n};const Ii=async e=>{const t=c();t.log("message/getMessages",e);const{data:n}=await t.http.get("/api/v3/messages/list",{params:{messageIds:e}});ui(n),C(n);const{messages:r}=n;return li(r)};Ii.locally=e=>{var t;c().log("message/getMessages.locally",e);const n=null!==(t=u("message",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return li(n)};const Ei=async e=>{const t=c();t.log("message/queryMessages",e);const n=null!=e?e:{},{page:r}=n,o=bi(n,["page"]),{data:s}=await t.http.get("/api/v3/messages",{params:Object.assign(Object.assign({},o),{options:{token:W(r,"afterbefore")}})}),{paging:i}=s,a=bi(s,["paging"]);ui(a),C(a);const{messages:l}=a,u=V(i.next),p=V(i.previous);return{data:li(l),nextPage:u,prevPage:p}};Ei.locally=e=>{var t,n,r,o,s;c().log("message/queryMessages.locally",e);const{channelId:i,page:a}=e,[l]=null!==(t=u("channel",i))&&void 0!==t?t:[];let p=null!==(n=u("message"))&&void 0!==n?n:[];if(p=hi(p,"channelId",i),p=p.sort(fi),a){let e,t=0;"after"in a?(t=0!==a.after?p.findIndex((e=>e.channelSegment===(null==a?void 0:a.after)))+1:0,e=t+a.limit):"before"in a&&(e=0!==a.before?p.findIndex((e=>e.channelSegment===(null==a?void 0:a.before)))+1:p.length-1,t=e>a.limit?e-a.limit:0);const n=p.slice(t,e);p=n.length===a.limit?n:[]}const d=(null===(r=p[0])||void 0===r?void 0:r.channelSegment)>0?{before:p[0].channelSegment,limit:null==a?void 0:a.limit}:void 0,h=(null===(o=p[p.length-1])||void 0===o?void 0:o.channelSegment)<(null!==(s=null==l?void 0:l.messageCount)&&void 0!==s?s:0)?{after:p[p.length-1].channelSegment,limit:null==a?void 0:a.limit}:void 0;return{data:li(p),nextPage:h,prevPage:d}};const ji=async e=>{const t=c();t.log("user/createMessage",e);const{data:n}=await t.http.post("/api/v3/messages",e);ui(n),C(n);const{messages:r}=n;return r[0]};ji.optimistically=e=>{var t,n,r;const o=c();if(o.log("user/createMessage.locally",e),!o.cache)return;const[s]=null!==(t=u("channel",e.channelId))&&void 0!==t?t:[];f("channel",Object.assign(Object.assign({},s),{messageCount:(null!==(n=s.messageCount)&&void 0!==n?n:0)+1}));const i=Object.assign(Object.assign({localId:ot(),messageId:Math.random().toString(16),userId:o.userId,channelSegment:(null!==(r=null==s?void 0:s.messageCount)&&void 0!==r?r:0)+1,createdAt:(new Date).toISOString()},e),{syncedAt:-1});return f("message",i),Js("v3.message.didCreate",{messages:[i]}),i};const Bi=async(e,t)=>{const n=c();n.log("user/updateMessage",t);const{data:r}=await n.http.put(`/api/v3/messages/${e}`,t);return ui(r),C(r),r.messages.find((t=>t.messageId===e))};Bi.optimistically=(e,t)=>{var n;c().log("user/updateMessage",t);const[r]=null!==(n=u("message",e))&&void 0!==n?n:[];if(!r)return;const o=Object.assign(Object.assign(Object.assign({},r),t),{updatedAt:(new Date).toISOString()});return f("message",o),Js("v3.message.didUpdate",{messages:[o]}),o};const Ni=async e=>{const t=c();t.log("message/deleteMessage",e),await t.http.delete(`/api/v3/messages/${e}`);return await Si(e)};Ni.optimistically=e=>{var t;c().log("message/deleteMessage",e);const[n]=null!==(t=u("message",e))&&void 0!==t?t:[];if(!n)return;const r=Object.assign(Object.assign({},n),{isDeleted:!0,updatedAt:(new Date).toISOString()});return f("message",r),Js("v3.message.didDelete",{messages:[r]}),r};const Pi=async e=>{const t=c();t.log("post/queryPosts",e);const n=null!=e?e:{},{page:r}=n,o=bi(n,["page"]),{data:s}=await t.http.get("/api/v3/posts",{params:Object.assign(Object.assign({},o),{options:{token:W(r,"skiplimit")}})}),{paging:i}=s,a=bi(s,["paging"]);ui(a),C(a);const{posts:l}=a,u=V(i.next),p=V(i.previous);return{data:li(l),nextPage:u,prevPage:p}};Pi.locally=e=>{c().log("post/queryPosts.locally",e)};const Ui=async e=>{const t=c();t.log("post/getPosts",e);const{data:n}=await t.http.get("/api/v3/posts/list",{params:{postIds:e}});ui(n),C(n);const{posts:r}=n;return r};Ui.locally=e=>{var t;c().log("post/getPosts.locally",e);const n=null!==(t=u("post",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return li(n)};const Ri=async e=>{var t;const n=c();let r;n.log("post/getPost",e);try{r=(await n.http.get(`/api/v3/posts/${e}`)).data}catch(n){throw 400400===(null===(t=n)||void 0===t?void 0:t.code)&&m("post",{postId:e}),n}ui(r),C(r);const{posts:o}=r;return o.find((t=>t.postId===e))};Ri.locally=e=>{var t;c().log("post/getPost.locally",e);const[n]=null!==(t=u("post",e))&&void 0!==t?t:[];return n};const _i=async e=>{const t=c();t.log("channel/queryCommunities",e);const n=null!=e?e:{},{page:r,displayName:o,membership:s}=n,i=bi(n,["page","displayName","membership"]),{data:a}=await t.http.get("/api/v3/communities",{params:Object.assign(Object.assign({},i),{keyword:o,filter:s,options:{token:W(r,"skiplimit")}})}),{paging:l}=a,u=bi(a,["paging"]);ui(u),C(u);const p=V(null==l?void 0:l.previous),d=V(null==l?void 0:l.next),{communities:h}=u;return{data:li(h),prevPage:p,nextPage:d}};_i.locally=e=>{c().log("community/queryCommunities.locally",e)};const Di=async e=>{const t=c();t.log("community/getCommunities",e);const{data:n}=await t.http.get("/api/v3/communities/list",{params:{communityIds:e}});ui(n),C(n);const{communities:r}=n;return li(r)};Di.locally=e=>{var t;c().log("community/getCommunities.locally",e);const n=null!==(t=u("community",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return li(n)};const Ti=async e=>{const t=c();t.log("community/getCommunity",e);const{data:n}=await t.http.get(`/api/v3/communities/${e}`);ui(n),C(n);const{communities:r}=n;return r.find((t=>t.communityId===e))};Ti.locally=e=>{var t;c().log("community/getCommunity.locally",e);const[n]=null!==(t=u("community",e))&&void 0!==t?t:[];return n};const Mi=async e=>{const t=c();t.log("community/queryCommunityMembers",e);const n=null!=e?e:{},{page:r,communityId:o}=n,s=bi(n,["page","communityId"]),{data:i}=await t.http.get(`/api/v3/communities/${o}/users`,{params:Object.assign(Object.assign({},s),{options:{token:W(r,"skiplimit")}})}),{paging:a}=i,l=bi(i,["paging"]);ui(l),C(l);const{communityUsers:u}=l,p=V(a.next),d=V(a.previous);return{data:li(u),nextPage:p,prevPage:d}};Mi.locally=e=>{c().log("community/queryCommunityMembers",e)};const $i=async e=>{const t=c();t.log("comment/queryComments",e);const{page:n}=e,r=bi(e,["page"]);e.parentId;const{data:o}=await t.http.get("/api/v3/comments",{params:Object.assign(Object.assign({},r),{options:{token:W(n,"afterbefore")}})}),{paging:s}=o,i=bi(o,["paging"]);ui(i),C(i);const a=V(s.previous),l=V(s.next),{comments:u}=i;return{data:li(u),prevPage:a,nextPage:l}};$i.locally=e=>{var t;c().log("post/queryComments.locally",e);const{referenceId:n,referenceType:r,parentId:o,isDeleted:s,page:i={before:0,limit:5}}=e;isNaN(i.limit)&&(i.limit=5);let a=null!==(t=u("comment"))&&void 0!==t?t:[];if(!a.length)return;if(a=hi(a,"referenceId",n),a=hi(a,"referenceType",r),a=hi(a,"parentId",o),a=hi(a,"isDeleted",s),!a.length)return;a=a.sort(mi);const l=isNaN(i.after)?0:a.findIndex((({segmentNumber:e})=>e===i.after+1)),p=isNaN(i.before)||0===i.before?a.length:a.findIndex((({segmentNumber:e})=>e===i.before-1))+1;if(l<0||p<0)return;let d=a.slice(-1!==l?l:0,-1!==p?p:void 0);if(d.length<i.limit)return;(isNaN(i.after)||isNaN(i.before))&&(d=isNaN(i.after)?(isNaN(i.before),d.slice(-i.limit)):d.slice(0,i.limit));for(let e=0;e<d.length-1;e++)if(d[e].segmentNumber!==d[e+1].segmentNumber-1)return;const h=d[0].segmentNumber>1?{before:d[0].segmentNumber,limit:i.limit}:void 0,f=d[d.length-1].segmentNumber<a[a.length-1].segmentNumber?{after:d[d.length-1].segmentNumber,limit:i.limit}:void 0;return{data:li(d),nextPage:f,prevPage:h}};const qi=async e=>{const t=c();t.log("comment/getComments",e);const{data:n}=await t.http.get("/api/v3/comments/list",{params:{commentIds:e}});ui(n),C(n);const{comments:r}=n;return li(r)};qi.locally=e=>{var t;c().log("comment/getComments.locally",e);const n=null!==(t=u("comment",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return li(n)};const Li=async e=>{var t;const n=c();let r;n.log("comment/getComment",e);try{r=(await n.http.get(`/api/v3/comments/${e}`)).data}catch(n){throw 400400===(null===(t=n)||void 0===t?void 0:t.code)&&m("comment",{commentId:e}),n}ui(r),C(r);const{comments:o}=r;return o.find((t=>t.commentId===e))};Li.locally=e=>{var t;c().log("comment/getComment.locally",e);const[n]=null!==(t=u("comment",e))&&void 0!==t?t:[];return n};const zi=async(e,t)=>{if("message"===e)return Si(t);if("post"===e)return Ri(t);if("comment"===e)return Li(t);throw new Error(`Incorrect referenceType: ${e}`)},Hi=async(e,t,n)=>{var r,o;const s=c();s.log("reaction/createReaction",{referenceId:t,referenceType:e,reactionName:n}),await s.http.post("/api/v2/reactions",{referenceId:t,referenceType:e,reactionName:n});const i=await zi(e,t);return Oi(e,i),null!==(o=null===(r=i.myReactions)||void 0===r?void 0:r.includes(n))&&void 0!==o&&o};Hi.optimistically=(e,t,n)=>{var r,o;const s=b(e,t,(e=>{var t,r,o;if(!(null===(t=e.myReactions)||void 0===t?void 0:t.includes(n)))return Object.assign(Object.assign({},e),{syncedAt:-1,reactionsCount:e.reactionsCount+1,myReactions:[...null!==(r=e.myReactions)&&void 0!==r?r:[],n],reactions:Object.assign(Object.assign({},e.reactions),{[n]:(null!==(o=e.reactions[n])&&void 0!==o?o:0)+1})})}));return s&&Oi(e,s),null!==(o=null===(r=null==s?void 0:s.myReactions)||void 0===r?void 0:r.includes(n))&&void 0!==o&&o};const Ji=async(e,t,n)=>{var r,o;const s=c();s.log("reaction/removeReaction",{referenceId:t,referenceType:e,reactionName:n}),await s.http.delete("/api/v2/reactions",{data:{referenceId:t,referenceType:e,reactionName:n}});const i=await zi(e,t);return Oi(e,i),null!==(o=!(null===(r=i.myReactions)||void 0===r?void 0:r.includes(n)))&&void 0!==o&&o};Ji.optimistically=(e,t,n)=>{var r,o;const s=b(e,t,(e=>{var t,r,o;if(null===(t=e.myReactions)||void 0===t?void 0:t.includes(n))return Object.assign(Object.assign({},e),{syncedAt:-1,reactionsCount:Math.max(0,e.reactionsCount-1),myReactions:(null!==(r=e.myReactions)&&void 0!==r?r:[]).filter((e=>e!==n)),reactions:Object.assign(Object.assign({},e.reactions),{[n]:Math.max(0,(null!==(o=e.reactions[n])&&void 0!==o?o:0)-1)})})}));return s&&Oi(e,s),null!==(o=!(null===(r=null==s?void 0:s.myReactions)||void 0===r?void 0:r.includes(n)))&&void 0!==o&&o};var Xi={post:{domainName:"posts",eventName:"v3/post.isflagbyme",primaryKey:"postId"},comment:{domainName:"comments",eventName:"v3/comment.isflagbyme",primaryKey:"commentId"},message:{domainName:"messages",eventName:"v3/message.isFlaggedByMe",primaryKey:"messageId"},user:{domainName:"users",eventName:"user.isFlagByMe",primaryKey:"userId"}};const Ki=async e=>{const t=c();t.log("channel/queryChannels",e);const n=null!=e?e:{},{page:r,displayName:o,membership:s}=n,i=bi(n,["page","displayName","membership"]),{data:a}=await t.http.get("/api/v3/channels",{params:Object.assign(Object.assign({},i),{keyword:o,filter:s,options:{token:W(r,"skiplimit")}})}),{paging:l}=a,u=bi(a,["paging"]);ui(u),C(u);const p=V(null==l?void 0:l.previous),d=V(null==l?void 0:l.next),{channels:h}=u;return{data:li(h),prevPage:p,nextPage:d}};Ki.locally=e=>{c().log("channel/queryChannels.locally",e)};const Wi=async e=>{const t=c();t.log("channel/getChannels",e);const{data:n}=await t.http.get("/api/v3/channels/list",{params:{channelIds:e}});ui(n),C(n);const{channels:r}=n;return li(r)};Wi.locally=e=>{var t;c().log("channel/getChannels.locally",e);const n=null!==(t=u("channel",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return li(n)};const Vi=async e=>{const t=c();t.log("channel/getChannel",e);const{data:n}=await t.http.get(`/api/v3/channels/${e}`);ui(n),C(n);const{channels:r}=n;return r.find((t=>t.channelId===e))};Vi.locally=e=>{var t;c().log("channel/getChannel.locally",e);const[n]=null!==(t=u("channel",e))&&void 0!==t?t:[];return n};const Yi=async e=>{const t=c();t.log("channel/queryChannelMembers",e);const n=null!=e?e:{},{page:r,channelId:o,membership:s}=n,i=bi(n,["page","channelId","membership"]),{data:a}=await t.http.get(`/api/v3/channels/${o}/users`,{params:Object.assign(Object.assign({},i),{filter:s,options:{token:W(r,"skiplimit")}})}),{paging:l}=a,u=bi(a,["paging"]);ui(u),C(u);const{channelUsers:p}=u,d=V(l.next),h=V(l.previous);return{data:li(p),nextPage:d,prevPage:h}};Yi.locally=e=>{c().log("channel/queryChannelMembers",e)};const Zi=e=>{const t=c();return Hs(t,"onChannelUpdated","v3.channel.didUpdate",(t=>{ui(t),C(t),e(t.channels[0])}))},Gi=e=>{const t=c();return Hs(t,"onChannelDeleted","v3.channel.didDelete",(t=>{ui(t),C(t),e(t.channels[0])}))},Qi=e=>{const t=c();return Hs(t,"onChannelJoined","v3.channel.didJoin",(t=>{ui(t),C(t),e(t.channels[0])}))},ea=e=>{const t=c();return Hs(t,"onChannelLeft","v3.channel.didLeave",(t=>{ui(t),C(t),e(t.channels[0])}))},ta=e=>{const t=c();return Hs(t,"onMemberAdded","v3.channel.didAddUsers",(t=>{ui(t),C(t),e(t.channels[0])}))},na=e=>{const t=c();return Hs(t,"onMemberRemoved","v3.channel.didRemoveUsers",(t=>{ui(t),C(t),e(t.channels[0])}))},ra=e=>{const t=c();return Hs(t,"message/onMessageCreated","v3.message.didCreate",(t=>{ui(t),C(t),e(t.messages[0])}))},oa=e=>{const t=c();return Hs(t,"message/onMessageUpdated","v3.message.didUpdate",(t=>{ui(t),C(t),e(t.messages[0])}))},sa=e=>{const t=c();return Hs(t,"message/onMessageDeleted","v3.message.didDelete",(t=>{ui(t),C(t),e(t.messages[0])}))},ia=e=>{const t=c();return Hs(t,"onCommunityUpdated","v3.community.didUpdate",(t=>{ui(t),C(t),e(t.communities[0])}))},aa=e=>{const t=c();return Hs(t,"onCommunityDeleted","v3.community.didDelete",(t=>{ui(t),C(t),e(t.communities[0])}))},ca=e=>{const t=c();return Hs(t,"onCommunityJoined","v3.community.didJoin",(t=>{ui(t),C(t),e(t.communities[0])}))},la=e=>{const t=c();return Hs(t,"onCommunityLeft","v3.community.didLeave",(t=>{ui(t),C(t),e(t.communities[0])}))},ua=e=>{const t=c();return Hs(t,"message/onPostCreated","v3.post.didCreate",(t=>{ui(t),C(t),e(t.posts[0])}))},pa=e=>{const t=c();return Hs(t,"message/onPostUpdated","v3.post.didUpdate",(t=>{ui(t),C(t),e(t.posts[0])}))},da=e=>{const t=c();return Hs(t,"message/onPostDeleted","v3.post.didDelete",(t=>{ui(t),C(t),e(t.posts[0])}))},ha=e=>{const t=c();return Hs(t,"message/onCommentCreated","v3.comment.didCreate",(t=>{ui(t),C(t),e(t.comments[0])}))},fa=e=>{const t=c();return Hs(t,"message/onCommentUpdated","v3.comment.didUpdate",(t=>{ui(t),C(t),e(t.comments[0])}))},ma=e=>{const t=c();return Hs(t,"message/onCommentDeleted","v3.comment.didDelete",(t=>{ui(t),C(t),e(t.comments[0])}))},ga=async e=>{const t=c();t.log("stream/getStream",e);const{data:n}=await t.http.get(`/api/v3/video-streaming/${e}`);ui(n),C(n);const{videoStreamings:r}=n;return r.find((t=>t.streamId===e))};ga.locally=e=>{var t;c().log("stream/getStream",e);const[n]=null!==(t=u("stream",e))&&void 0!==t?t:[];return n};const ya=async e=>{const t=c();t.log("stream/queryStreams",e);const n=null!=e?e:{},{page:r}=n,o=bi(n,["page"]),{data:s}=await t.http.get("/api/v3/video-streaming",{params:Object.assign(Object.assign({},o),{options:{token:W(r,"skiplimit")}})}),{paging:i,results:a}=s;ui(a),C(a);const l=V(null==i?void 0:i.previous),u=V(null==i?void 0:i.next),{videoStreamings:p}=a;return{data:li(p),prevPage:l,nextPage:u}};ya.locally=e=>{c().log("stream/queryStreams.locally",e)};return e.VERSION=n,e.addChannelMembers=async(e,t)=>{const n=c();n.log("channel/addChannelMembers",e,t);const{data:r}=await n.http.post(`/api/v3/channels/${e}/users`,{channelId:e,userIds:t});ui(r),C(r),Js("v3.channel.didAddUsers",{channels:r.channels});const{channelUsers:o}=r;return!!o.find((t=>t.channelId===e&&"member"===t.membership))},e.addChannelMembersRole=async(e,t,n)=>{const r=c();r.log("channel/addChannelMembersRole",e,t,n);const{data:o}=await r.http.post(`/api/v3/channels/${e}/users/roles`,{channelId:e,role:t,userIds:n});ui(o),C(o);const{channelUsers:s}=o;return!!s.find((n=>n.channelId===e&&n.roles.includes(t)))},e.addCommunityMembers=async(e,t)=>{const n=c();n.log("community/addCommunityMembers",e,t);const{data:r}=await n.http.post(`/api/v3/communities/${e}/users`,{communityId:e,userIds:t});ui(r),C(r),Js("v3.community.didAddUsers",{communities:r.communities});const{communityUsers:o}=r;return!!o.find((t=>t.communityId===e&&"member"===t.communityMembership))},e.addCommunityMembersRole=async(e,t,n)=>{const r=c();r.log("community/addCommunityMembersRole",e,t,n);const{data:o}=await r.http.post(`/api/v3/communities/${e}/users/roles`,{communityId:e,role:t,userIds:n});ui(o),C(o);const{communityUsers:s}=o;return!!s.find((n=>n.communityId===e&&n.roles.includes(t)))},e.addReaction=Hi,e.clearCache=(e=["user","file","channel","message","community","post","comment"])=>{const t=c();t.log("client/api/enableCache"),e.forEach((e=>{var n,r;return null===(r=null===(n=t.cache)||void 0===n?void 0:n[e])||void 0===r?void 0:r.erase()}))},e.connectClient=async e=>{var t,n;const r=c();r.log("client/api/connectClient",Object.assign({apiKey:r.apiKey},e)),null!==(t=e.displayName)&&void 0!==t||(e.displayName=e.userId),null!==(n=e.deviceId)&&void 0!==n||(e.deviceId=`ascWebSdk#${Math.random().toString(16)}`);const{accessToken:o}=await(async e=>{const t=c();t.log("client/api/getToken",e);const n=await Xs(),{data:r}=await t.http.post("/v1/device",Object.assign(Object.assign({},e),{deviceInfo:n}),{headers:{"X-API-Key":t.apiKey}});return r})(e);var s,i;return r.http.defaults.headers.common.Authorization=`Bearer ${o}`,r.ws.io.opts.query={token:o},s=r.ws,i=r.emitter,Ls.forEach((e=>{s.on(e,(t=>i.emit(e,t)))})),await new Promise((e=>{r.ws.once("connect",e),r.ws.open()})),r.userId=e.userId,r.ws.connected},e.createCache=F,e.createChannel=async e=>{const t=c();t.log("user/createChannel",e);const{data:n}=await t.http.post("/api/v3/channels",e);ui(n),C(n);const{channels:r}=n;return r[0]},e.createClient=(e,t="https://api.amity.co",r="amity")=>{const o=(e=>{const t=`${null==e?void 0:e.trim()}`.length>0&&"production"!==process.env.NODE_ENV,n=mt(e),r=(e,...r)=>{t&&n(e,r)};return r.__instance__=n,r})(r);o("client/api/createClient",{apiKey:e.replace(/.{5}$/g,"xxxxx"),apiEndpoint:t});const s=((e="https://api.amity.co")=>{const t={maxSockets:100,maxFreeSockets:10,timeout:6e4,freeSocketTimeout:3e4},n=Rn.create({baseURL:e,httpAgent:new Mn(t),httpsAgent:new Dn(t),paramsSerializer:$s});return n.interceptors.response.use((e=>e),(e=>{var t;const{response:n}=e;console.error(null!==(t=null==n?void 0:n.data)&&void 0!==t?t:e),n&&qs(n.data)})),n})(t),i=((e="https://api.ekomedia.technology")=>{const t=Ms(e,{autoConnect:!1,reconnectionDelay:2e3,transports:["websocket"]});return t.on("disconnect",(e=>{"io server disconnect"===e&&t.connect()})),t})(t),a=zs(),u={version:`${n}`,apiKey:e,log:o,http:s,ws:i,emitter:a,use:()=>l(u)};try{c()}catch(e){l(u)}return u},e.createComment=async e=>{const t=c();t.log("comment/createComment",e);const{data:n}=await t.http.post("/api/v3/comments",e);ui(n),C(n);const r=await Ri(e.referenceId);Js("v3.post.didUpdate",{posts:[r]}),Js("v3.comment.didCreate",n);const{comments:o}=n;return o[0]},e.createCommunity=async e=>{const t=c();t.log("user/createCommunity",e);const{data:n}=await t.http.post("/api/v3/communities/",e);ui(n),C(n),Js("v3.community.didCreate",n);const{communities:r}=n;return r[0]},e.createFile=async(e,t)=>{const n=c();if(n.log("file/createFile",e),!e.getAll("file").length)throw new Error("The formData object must have a `file` key.");const r="getHeaders"in e?e.getHeaders():{"content-type":"multipart/form-data"},{data:o}=await n.http.post("/api/v3/files",e,{headers:r,onUploadProgress({loaded:e,total:n}){t&&t(Math.round(100*e/n))}});return pi(o),C({files:o}),o[0]},e.createMessage=ji,e.createPost=async e=>{const t=c();t.log("post/createPost",e),e.dataType&&!["text","image","file"].includes(e.dataType)||delete e.dataType;const{data:n}=await t.http.post("/api/v3/posts",e);ui(n),C(n),Js("v3.community.didUpdate",{communities:n.communities}),Js("v3.post.didCreate",n);const{posts:r}=n;return r[0]},e.createQuery=re,e.createReport=async(e,t)=>{const n=c();n.log("report/createReport",{referenceType:e,referenceId:t});const{domainName:r}=Xi[e],{data:o}=await n.http.post(`/api/v3/${r}/${t}/flag`);return ui(o),C(o),Js(`v3.${e}.didUpdate`,o),!!o},e.createStream=async e=>{const t=c();t.log("stream/createStream",e);const{data:n}=await t.http.post("/api/v3/video-streaming",e);ui(n),C(n);const{videoStreamings:r}=n;return r[0]},e.decorateModel=di,e.decorateModels=pi,e.decoratePayload=ui,e.deleteChannel=async e=>{const t=c();t.log("channel/deleteChannel",e),await t.http.delete(`/api/v3/channels/${e}`);return await Vi(e)},e.deleteComment=async(e,t=!1)=>{const n=c();n.log("comment/deleteComment",e);const r=await Li(e);await n.http.delete(`/api/v4/comments/${e}`,{params:{commentId:e,permanent:t}});const o=Object.assign(Object.assign({},r),{isDeleted:!0}),s=await Ri(r.referenceId);return Js("v3.post.didUpdate",{posts:[s]}),Js("v3.comment.didDelete",{comments:[o]}),t?setTimeout((()=>{m("comment",{commentId:e})}),0):w("comment",{commentId:e,isDeleted:!0}),o},e.deleteCommunity=async e=>{const t=c();t.log("community/deleteCommunity",e),await t.http.delete(`/api/v3/communities/${e}`);const n=await Ti(e);return Js("v3.community.didDelete",{communities:[n]}),n},e.deleteFile=async e=>{const t=c();t.log("file/deleteFile",e);const{data:n}=await t.http.delete(`/api/v3/files/${e}`);return m("file",{fileId:n.fileId}),{success:!0}},e.deleteMessage=Ni,e.deletePost=async(e,t=!1)=>{const n=c();n.log("post/deletePost",e);let r=await Ri(e);if(await n.http.delete(`/api/v4/posts/${e}`,{params:{postId:e,permanent:t}}),"community"===r.targetType){const e=await Ti(r.targetId);Js("v3.community.didUpdate",{communities:[e]})}const o=Object.assign(Object.assign({},r),{isDeleted:!0});return Js("v3.post.didDelete",{posts:[o]}),t?setTimeout((()=>{m("post",{postId:e})}),0):w("post",{postId:e,isDeleted:!0}),o},e.deleteReport=async(e,t)=>{const n=c();n.log("report/deleteReport",{referenceType:e,referenceId:t});const{domainName:r}=Xi[e],{data:o}=await n.http.delete(`/api/v3/${r}/${t}/unflag`);return ui(o),C(o),Js(`v3.${e}.didUpdate`,o),!!o},e.deleteStream=async e=>{const t=c();t.log("stream/deleteStream",e);const{data:n}=await t.http.delete(`/api/v3/video-streaming/${e}`),{success:r}=n;return r},e.disconnectClient=async()=>{const e=c();return e.log("client/api/disconnectClient"),await new Promise((t=>{e.ws.once("disconnect",t),e.ws.disconnect()})),e.emitter.all.clear(),e.ws.removeAllListeners(),e.userId=void 0,!e.ws.connected},e.disposeStream=async e=>{const t=c();t.log("stream/disposeStream",e);const{data:n}=await t.http.delete(`/api/v3/video-streaming/${e}/streaming-url`);ui(n),C(n);const{videoStreamings:r}=n;return r.find((t=>t.streamId===e))},e.dropFromCache=m,e.enableCache=(e=Ws("user","file","channel","message","community","post","comment","communityUsers","channelUsers","stream"))=>{const t=c();t.log("client/api/enableCache"),t.cache=F(e)},e.fileUrlWithSize=(e,t)=>`${e}?size=${t}`,e.filterByPropEquality=hi,e.getActiveClient=c,e.getChannel=Vi,e.getChannels=Wi,e.getComment=Li,e.getComments=qi,e.getCommunities=Di,e.getCommunity=Ti,e.getFile=ki,e.getMessage=Si,e.getMessages=Ii,e.getPost=Ri,e.getPosts=Ui,e.getRole=xi,e.getStream=ga,e.getUser=vi,e.getUsers=Ci,e.ingestInCache=C,e.isAfterBefore=X,e.isConnected=()=>{var e,t;const n=c();return n.log("client/api/isConnected",n),!!(n.userId&&(null===(t=null===(e=n.http.defaults.headers.common)||void 0===e?void 0:e.Authorization)||void 0===t?void 0:t.length)&&n.ws.connected)},e.isFetcher=Y,e.isFresh=te,e.isLocal=ee,e.isMutator=Z,e.isOffline=G,e.isPaged=K,e.isReportedByMe=async(e,t)=>{var n,r;const o=c();o.log("report/isReportedByMe",{referenceType:e,referenceId:t});const{eventName:s,primaryKey:i}=Xi[e],{result:a,isFlagByMe:l}=null!==(n=await(async(e,t,n)=>{const{ws:r}=e;return await new Promise(((e,o)=>{r.emit(t,n,(t=>{try{e(qs(t))}catch(e){o(e)}}))}))})(o,s,{[i]:t}))&&void 0!==n?n:{};return null!==(r=null!=a?a:l)&&void 0!==r&&r},e.isSkipLimit=J,e.isSyncable=Q,e.isSynced=ne,e.joinChannel=async e=>{const t=c();t.log("channel/joinChannel",e);const{data:n}=await t.http.post(`/api/v3/channels/${e}/join`);ui(n),C(n);const{channelUsers:r}=n;return!!r.find((t=>t.channelId===e&&"member"===t.membership))},e.joinCommunity=async e=>{const t=c();t.log("community/joinCommunity",e);const{data:n}=await t.http.post(`/api/v3/communities/${e}/join`);ui(n),C(n),Js("v3.community.didJoin",{communities:n.communities});const{communityUsers:r}=n;return!!r.find((t=>t.communityId===e&&"member"===t.communityMembership))},e.leaveChannel=async e=>{const t=c();t.log("channel/leaveChannel",e);const{data:n}=await t.http.delete(`/api/v3/channels/${e}/leave`);ui(n),C(n);const{channelUsers:r}=n;return!!r.find((t=>t.channelId===e&&"member"!==t.membership))},e.leaveCommunity=async e=>{const t=c();t.log("community/leaveCommunity",e);const{data:n}=await t.http.delete(`/api/v3/communities/${e}/leave`);ui(n),C(n),Js("v3.community.didJoin",{communities:n.communities});const{communityUsers:r}=n;return!!r.find((t=>t.communityId===e&&"member"!==t.communityMembership))},e.memoryStore=Ks,e.memoryStores=Ws,e.mergeInCache=w,e.mutateCache=b,e.observeChannel=(e,t)=>{const{log:n}=c(),r=Date.now();n(`observeChannel(tmpid: ${r}) > listen`);const o=(n,r)=>{var o,s,i;if((null===(o=n.data)||void 0===o?void 0:o.channelId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(s=t.onEvent)||void 0===s||s.call(t,r,n)),null===(i=t[r])||void 0===i||i.call(t,n)}},s=[];return s.push(Zi((e=>o({data:e},"onUpdate"))),Gi((e=>o({data:e},"onDelete"))),Qi((e=>o({data:e},"onJoin"))),ea((e=>o({data:e},"onLeft"))),ta((e=>o({data:e},"onMemberAdded"))),na((e=>o({data:e},"onMemberRemoved")))),ae(re(Vi,e),(e=>e.data&&o(e,"onFetch"))),()=>{n(`observeChannel(tmpid: ${r}) > dispose`),s.forEach((e=>e()))}},e.observeComment=(e,t,n="cache_then_server")=>{const{log:r}=c(),o=Date.now();r(`observeComment(tmpid: ${o}) > listen`);const s=(n,r)=>{var o,s,i;if((null===(o=n.data)||void 0===o?void 0:o.commentId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(s=t.onEvent)||void 0===s||s.call(t,r,n)),null===(i=t[r])||void 0===i||i.call(t,n)}},i=[];return i.push(fa((e=>s({data:e},"onUpdate"))),ma((e=>s({data:e},"onDelete")))),ae(re(Li,e),(e=>e.data&&s(e,"onFetch")),oe(n)),()=>{r(`observeComment(tmpid: ${o}) > dispose`),i.forEach((e=>e()))}},e.observeComments=(e,t)=>{const{log:n}=c(),r=Date.now();n(`observeComments(tmpid: ${r}) > listen`);const o=[],s=(n,r)=>{var o,s;if(n.referenceId===e){if(t instanceof Function)return t(n);null===(o=t.onEvent)||void 0===o||o.call(t,r,n),null===(s=t[r])||void 0===s||s.call(t,n)}};return o.push(ha((e=>s(e,"onCreate"))),fa((e=>s(e,"onUpdate"))),ma((e=>s(e,"onDelete")))),()=>{n(`observeComments(tmpid: ${r}) > dispose`),o.forEach((e=>e()))}},e.observeCommunity=(e,t)=>{const{log:n}=c(),r=Date.now();n(`observeCommunity(tmpid: ${r}) > listen`);const o=(n,r)=>{var o,s,i;if((null===(o=n.data)||void 0===o?void 0:o.communityId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(s=t.onEvent)||void 0===s||s.call(t,r,n)),null===(i=t[r])||void 0===i||i.call(t,n)}},s=[];return s.push(ia((e=>o({data:e},"onUpdate"))),aa((e=>o({data:e},"onDelete"))),ca((e=>o({data:e},"onJoin"))),la((e=>o({data:e},"onLeft")))),ae(re(Ti,e),(e=>e.data&&o(e,"onFetch"))),()=>{n(`observeCommunity(tmpid: ${r}) > dispose`),s.forEach((e=>e()))}},e.observeFile=(e,t)=>{const{log:n}=c(),r=Date.now();n(`observeFile(tmpid: ${r}) > listen`);return ae(re(ki,e),(n=>n.data&&((n,r)=>{var o,s,i;if((null===(o=n.data)||void 0===o?void 0:o.fileId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(s=t.onEvent)||void 0===s||s.call(t,r,n)),null===(i=t[r])||void 0===i||i.call(t,n)}})(n,"onFetch"))),()=>{n(`observeFile(tmpid: ${r}) > dispose`)}},e.observeMessage=(e,t,n="cache_then_server")=>{const{log:r}=c(),o=Date.now();r(`observeMessage(tmpid: ${o}) > listen`);const s=(n,r)=>{var o,s,i;if((null===(o=n.data)||void 0===o?void 0:o.messageId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(s=t.onEvent)||void 0===s||s.call(t,r,n)),null===(i=t[r])||void 0===i||i.call(t,n)}},i=[];return i.push(oa((e=>s(e,"onUpdate"))),sa((e=>s(e,"onDelete")))),"no_fetch"!==n&&ae(re(Si,e),(e=>e.data&&s(e,"onFetch")),oe(n)),()=>{r(`observeMessages(tmpid: ${o}) > dispose`),i.forEach((e=>e()))}},e.observeMessages=(e,t)=>{const{log:n}=c(),r=Date.now();n(`observeMessages(tmpid: ${r}) > listen`);const o=[],s=(n,r)=>{var o,s;if(n.channelId===e){if(t instanceof Function)return t(n);null===(o=t.onEvent)||void 0===o||o.call(t,r,n),null===(s=t[r])||void 0===s||s.call(t,n)}};return o.push(ra((e=>s(e,"onCreate"))),oa((e=>s(e,"onUpdate"))),sa((e=>s(e,"onDelete")))),()=>{n(`observeMessages(tmpid: ${r}) > dispose`),o.forEach((e=>e()))}},e.observePost=(e,t,n="cache_then_server")=>{const{log:r}=c(),o=Date.now();r(`observePost(tmpid: ${o}) > listen`);const s=(n,r)=>{var o,s,i;if((null===(o=n.data)||void 0===o?void 0:o.postId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(s=t.onEvent)||void 0===s||s.call(t,r,n)),null===(i=t[r])||void 0===i||i.call(t,n)}},i=[];return i.push(pa((e=>s({data:e},"onUpdate"))),da((e=>s({data:e},"onDelete")))),ae(re(Ri,e),(e=>e.data&&s(e,"onFetch")),oe(n)),()=>{r(`observePosts(tmpid: ${o}) > dispose`),i.forEach((e=>e()))}},e.observePosts=(e,t)=>{const{log:n}=c(),r=Date.now();n(`observePosts(tmpid: ${r}) > listen`);const o=[],s=(n,r)=>{var o,s;if(e.targetId===n.targetId&&e.targetType===n.targetType){if(t instanceof Function)return t(n);null===(o=t.onEvent)||void 0===o||o.call(t,r,n),null===(s=t[r])||void 0===s||s.call(t,n)}};return o.push(ua((e=>s(e,"onCreate"))),pa((e=>s(e,"onUpdate"))),da((e=>s(e,"onDelete")))),()=>{n(`observePosts(tmpid: ${r}) > dispose`),o.forEach((e=>e()))}},e.observeUser=(e,t)=>{const{log:n}=c(),r=Date.now();n(`observeUser(tmpid: ${r}) > listen`);const o=(n,r)=>{var o,s,i;if((null===(o=n.data)||void 0===o?void 0:o.userId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(s=t.onEvent)||void 0===s||s.call(t,r,n)),null===(i=t[r])||void 0===i||i.call(t,n)}},s=[];return s.push(Fi((e=>o({data:e},"onUpdate")))),ae(re(vi,e),(e=>e.data&&o(e,"onFetch"))),()=>{n(`observeUser(tmpid: ${r}) > dispose`),s.forEach((e=>e()))}},e.onChannelDeleted=Gi,e.onChannelJoined=Qi,e.onChannelLeft=ea,e.onChannelUpdated=Zi,e.onClientBanned=e=>yi((({code:t})=>{400312===t&&e()})),e.onClientDisconnected=e=>yi((({code:t})=>{800211===t&&e()})),e.onCommentCreated=ha,e.onCommentDeleted=ma,e.onCommentUpdated=fa,e.onCommunityCreated=e=>{const t=c();return Hs(t,"onCommunityCreated","v3.community.didCreate",(t=>{ui(t),C(t),e(t.communities[0])}))},e.onCommunityDeleted=aa,e.onCommunityJoined=ca,e.onCommunityLeft=la,e.onCommunityUpdated=ia,e.onConnectionError=yi,e.onMemberAdded=ta,e.onMemberRemoved=na,e.onMessageCreated=ra,e.onMessageDeleted=sa,e.onMessageUpdated=oa,e.onPostCreated=ua,e.onPostDeleted=da,e.onPostUpdated=pa,e.onReactionRemoved=(e,t,n)=>{const r=c();return Hs(r,"reaction/onReactionRemoved","v3.message.didUpdate",(e=>{ui(e),C(e)}))},e.onUserUpdated=Fi,e.persistentStore=async(e,t={},n=250)=>{let r=t;const o=await ci.getItem(e);if(o)try{r=JSON.parse(o)}catch(e){}const s=Ks(r);let i=null;const a=()=>{i?i.then((()=>a())):(clearTimeout(undefined),setTimeout((async()=>{i=Promise.resolve().then((()=>ci.setItem(e,JSON.stringify(s.read())))).then((()=>i=null))}),n))};return{read:s.read,write:e=>{s.write(e),a()},erase:(...e)=>{s.erase(...e),a()}}},e.pullFromCache=u,e.pushToCache=f,e.queryChannelMembers=Yi,e.queryChannels=Ki,e.queryComments=$i,e.queryCommunities=_i,e.queryCommunityMembers=Mi,e.queryGlobalFeed=async e=>{const t=c();t.log("feed/queryGlobalFeed",e);const n=null!=e?e:{},{page:r}=n,o=bi(n,["page"]),{data:s}=await t.http.get("/api/v4/me/global-feeds",{params:Object.assign(Object.assign({},o),{options:{token:W(r,"skiplimit")}})}),{paging:i}=s,a=bi(s,["paging"]);ui(a),C(a);const{posts:l}=a,u=V(i.next),p=V(i.previous);return{data:li(l),nextPage:u,prevPage:p}},e.queryMessages=Ei,e.queryOptions=oe,e.queryPosts=Pi,e.queryRoles=Ai,e.queryStreams=ya,e.queryUsers=wi,e.removeChannelMembers=async(e,t)=>{const n=c();n.log("channel/removeChannelMembers",e,t);const{data:r}=await n.http.delete(`/api/v3/channels/${e}/users`,{data:{channelId:e,userIds:t}});ui(r),C(r),Js("v3.channel.didRemoveUsers",{channels:r.channels});const{channelUsers:o}=r;return!!o.find((t=>t.channelId===e&&"member"!==t.membership))},e.removeChannelMembersRole=async(e,t,n)=>{const r=c();r.log("channel/removeChannelMembersRole",e,t,n);const{data:o}=await r.http.delete(`/api/v3/channels/${e}/users/roles`,{data:{channelId:e,role:t,userIds:n}});ui(o),C(o);const{channelUsers:s}=o;return!!s.find((n=>n.channelId===e&&!n.roles.includes(t)))},e.removeCommunityMembers=async(e,t)=>{const n=c();n.log("community/removeCommunityMembers",e,t);const{data:r}=await n.http.delete(`/api/v3/communities/${e}/users`,{data:{communityId:e,userIds:t}});ui(r),C(r),Js("v3.community.didRemoveUsers",{communities:r.communities});const{communityUsers:o}=r;return!!o.find((t=>t.communityId===e&&"member"!==t.communityMembership))},e.removeCommunityMembersRole=async(e,t,n)=>{const r=c();r.log("community/removeCommunityMembersRole",e,t,n);const{data:o}=await r.http.delete(`/api/v3/communities/${e}/users/roles`,{data:{communityId:e,role:t,userIds:n}});ui(o),C(o);const{communityUsers:s}=o;return!!s.find((n=>n.communityId===e&&!n.roles.includes(t)))},e.removeReaction=Ji,e.runQuery=ae,e.sliceByPaging=(e,t,n)=>{if(console.log("slice by paging",n),!n)return t.slice();let r,o=0;n.after?(o=n.after,r=o+n.limit):n.before&&(r=n.before+1,o=r>n.limit?r-n.limit:0);const s=t.slice(o,r);return s.length===n.limit?s:void 0},e.sortByChannelSegment=fi,e.sortByDisplayName=({displayName:e},{displayName:t})=>e===t?0:e<t?-1:1,e.sortByFirstCreated=({createdAt:e},{createdAt:t})=>new Date(e).valueOf()-new Date(t).valueOf(),e.sortByLastActivity=({lastActivity:e},{lastActivity:t})=>new Date(t).valueOf()-new Date(e).valueOf(),e.sortByLastCreated=({createdAt:e},{createdAt:t})=>new Date(t).valueOf()-new Date(e).valueOf(),e.sortBySegmentNumber=mi,e.syncInCache=v,e.toPage=V,e.toToken=W,e.updateChannel=async(e,t)=>{const n=c();n.log("channel/updateChannel",e,t);const{data:r}=await n.http.put(`/api/v3/channels/${e}`,t);ui(r),C(r);const{channels:o}=r;return o.find((t=>t.channelId===e))},e.updateComment=async(e,t)=>{const n=c();n.log("user/updateComment",t);const{data:r}=await n.http.put(`/api/v3/comments/${e}`,t);ui(r),C(r),Js("v3.comment.didUpdate",r);const{comments:o}=r;return o.find((t=>t.commentId===e))},e.updateCommunity=async(e,t)=>{const n=c();n.log("community/updateCommunity",e,t);const{data:r}=await n.http.put(`/api/v3/communities/${e}`,t);ui(r),C(r),Js("v3.community.didUpdate",r);const{communities:o}=r;return o.find((t=>t.communityId===e))},e.updateMessage=Bi,e.updatePost=async(e,t)=>{const n=c();n.log("user/updatePost",t);const{data:r}=await n.http.put(`/api/v3/posts/${e}`,t);ui(r),C(r),Js("v3.post.didUpdate",r);const{posts:o}=r;return o.find((t=>t.postId===e))},e.updateStream=async(e,t)=>{const n=c();n.log("stream/updateStream",e,t);const{data:r}=await n.http.put(`/api/v3/video-streaming/${e}`,t);ui(r),C(r);const{videoStreamings:o}=r;return o.find((t=>t.streamId===e))},e.updateUser=async(e,t)=>{const n=c();n.log("user/updateUser",e,t);const{data:r}=await n.http.put("/api/v3/users/",Object.assign(Object.assign({userId:e},t),{createNewUserWhenNotFound:!1}));return ui(r),C(r),r.users.find((t=>t.userId===e))},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
19
+ function em(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}Zh.locally=e=>{var t;const n=null!==(t=y("user",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return A(n)};const tm=async e=>{const t=m();t.log("user/queryUsers",e);const n=null!=e?e:{},{page:r,displayName:o,filter:i="all",sortBy:s="displayName"}=n,a=em(n,["page","displayName","filter","sortBy"]),{data:c}=await t.http.get("/api/v3/users",{params:Object.assign(Object.assign({},a),{keyword:o,filter:i,sortBy:s,options:{token:ae(r,"skiplimit")}})}),{paging:l}=c,u=em(c,["paging"]);$h(u),B(u);const p=ce(l.previous),d=ce(l.next),{users:f}=u;return{data:A(f),prevPage:p,nextPage:d}};tm.locally=e=>{m().log("user/queryUsers.locally",e)};const nm=(e,t)=>{const n=m();return vh(n,e,e,(e=>{$h(e),B(e),t(e.users[0])}))},rm=e=>nm("user.updated",e),om=e=>nm("user.flagged",e),im=e=>nm("user.unflagged",e),sm=e=>nm("user.flagCleared",e),am=async e=>{const t=m();t.log("file/getFile",e);const{data:n}=await t.http.get(`/api/v3/files/${e}`);return Wh(n),B({files:[n]}),n};am.locally=e=>{var t;m().log("file/getFile.locally",e);const[n]=null!==(t=y("file",e))&&void 0!==t?t:[];return n};const cm=async e=>{const t=m();t.log("role/queryRoles",e);const n=null!=e?e:{},{page:r,displayName:o,sortBy:i}=n,s=em(n,["page","displayName","sortBy"]),{data:a}=await t.http.get("/api/v3/roles",{params:Object.assign(Object.assign({},s),{keyword:o,sortBy:i,options:{token:ae(r,"skiplimit")}})}),{paging:c}=a,l=em(a,["paging"]);$h(l),B(l);const u=ce(c.previous),p=ce(c.next),{roles:d}=l;return{data:A(d),prevPage:u,nextPage:p}};cm.locally=e=>{m().log("role/queryRoles.locally",e)};const lm=async e=>{const t=m();t.log("role/getRole",e);const{data:n}=await t.http.get(`/api/v3/roles/${e}`);return Hh(n),B({roles:n}),n.find((t=>t.roleId===e))};lm.locally=e=>{var t;m().log("role/getRole.locally",e);const[n]=null!==(t=y("role",e))&&void 0!==t?t:[];return n};const um=(e,t)=>{"message"===e?_h("v3.message.didUpdate",{messages:[t]}):"post"===e?_h("post.updated",{posts:[t]}):"comment"===e&&_h("comment.updated",{comments:[t]})},pm=async e=>{const t=m();t.log("message/getMessage",e);const{data:n}=await t.http.get(`/api/v3/messages/${e}`);$h(n),B(n);const{messages:r}=n;return r.find((t=>t.messageId===e))};pm.locally=e=>{var t;m().log("message/getMessage.locally",e);const[n]=null!==(t=y("message",e))&&void 0!==t?t:[];return n};const dm=async e=>{const t=m();t.log("message/getMessages",e);const{data:n}=await t.http.get("/api/v3/messages/list",{params:{messageIds:e}});$h(n),B(n);const{messages:r}=n;return A(r)};dm.locally=e=>{var t;m().log("message/getMessages.locally",e);const n=null!==(t=y("message",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return A(n)};const fm=async e=>{const t=m();t.log("message/queryMessages",e);const n=null!=e?e:{},{page:r}=n,o=em(n,["page"]),{data:i}=await t.http.get("/api/v3/messages",{params:Object.assign(Object.assign({},o),{options:{token:ae(r,"afterbefore")}})}),{paging:s}=i,a=em(i,["paging"]);$h(a),B(a);const{messages:c}=a,l=ce(s.next),u=ce(s.previous);return{data:A(c),nextPage:l,prevPage:u}};fm.locally=e=>{var t,n,r,o,i;m().log("message/queryMessages.locally",e);const{channelId:s,page:a}=e,[c]=null!==(t=y("channel",s))&&void 0!==t?t:[];let l=null!==(n=y("message"))&&void 0!==n?n:[];if(l=Vh(l,"channelId",s),l=l.sort(Kh),a){let e,t=0;"after"in a?(t=0!==a.after?l.findIndex((e=>e.channelSegment===(null==a?void 0:a.after)))+1:0,e=t+a.limit):"before"in a&&(e=0!==a.before?l.findIndex((e=>e.channelSegment===(null==a?void 0:a.before)))+1:l.length-1,t=e>a.limit?e-a.limit:0);const n=l.slice(t,e);l=n.length===a.limit?n:[]}const u=(null===(r=l[0])||void 0===r?void 0:r.channelSegment)>0?{before:l[0].channelSegment,limit:null==a?void 0:a.limit}:void 0,p=(null===(o=l[l.length-1])||void 0===o?void 0:o.channelSegment)<(null!==(i=null==c?void 0:c.messageCount)&&void 0!==i?i:0)?{after:l[l.length-1].channelSegment,limit:null==a?void 0:a.limit}:void 0;return{data:A(l),nextPage:p,prevPage:u}};const hm=async e=>{const t=m();t.log("user/createMessage",e);const{data:n}=await t.http.post("/api/v3/messages",e);$h(n),B(n);const{messages:r}=n;return r[0]};hm.optimistically=e=>{var t,n,r;const o=m();if(o.log("user/createMessage.locally",e),!o.cache)return;const[i]=null!==(t=y("channel",e.channelId))&&void 0!==t?t:[];w("channel",Object.assign(Object.assign({},i),{messageCount:(null!==(n=i.messageCount)&&void 0!==n?n:0)+1}));const s=Object.assign(Object.assign({localId:mt(),messageId:Math.random().toString(16),userId:o.userId,channelSegment:(null!==(r=null==i?void 0:i.messageCount)&&void 0!==r?r:0)+1,createdAt:(new Date).toISOString()},e),{syncedAt:-1});return w("message",s),_h("v3.message.didCreate",{messages:[s]}),s};const mm=async(e,t)=>{const n=m();n.log("user/updateMessage",t);const{data:r}=await n.http.put(`/api/v3/messages/${e}`,t);return $h(r),B(r),r.messages.find((t=>t.messageId===e))};mm.optimistically=(e,t)=>{var n;m().log("user/updateMessage",t);const[r]=null!==(n=y("message",e))&&void 0!==n?n:[];if(!r)return;const o=Object.assign(Object.assign(Object.assign({},r),t),{updatedAt:(new Date).toISOString()});return w("message",o),_h("v3.message.didUpdate",{messages:[o]}),o};const gm=async e=>{const t=m();t.log("message/deleteMessage",e),await t.http.delete(`/api/v3/messages/${e}`);return await pm(e)};gm.optimistically=e=>{var t;m().log("message/deleteMessage",e);const[n]=null!==(t=y("message",e))&&void 0!==t?t:[];if(!n)return;const r=Object.assign(Object.assign({},n),{isDeleted:!0,updatedAt:(new Date).toISOString()});return w("message",r),_h("v3.message.didDelete",{messages:[r]}),r};const ym=async e=>{const t=m();t.log("post/queryPosts",e);const n=null!=e?e:{},{page:r}=n,o=em(n,["page"]),{data:i}=await t.http.get("/api/v3/posts",{params:Object.assign(Object.assign({},o),{options:{token:ae(r,"skiplimit")}})}),{paging:s}=i,a=em(i,["paging"]);$h(a),B(a);const{posts:c}=a,l=ce(s.next),u=ce(s.previous);return{data:A(c),nextPage:l,prevPage:u}};ym.locally=e=>{m().log("post/queryPosts.locally",e)};const bm=async e=>{const t=m();t.log("post/getPosts",e);const{data:n}=await t.http.get("/api/v3/posts/list",{params:{postIds:e}});$h(n),B(n);const{posts:r}=n;return r};bm.locally=e=>{var t;m().log("post/getPosts.locally",e);const n=null!==(t=y("post",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return A(n)};const vm=async e=>{var t;const n=m();let r;n.log("post/getPost",e);try{r=(await n.http.get(`/api/v3/posts/${e}`)).data}catch(n){throw 400400===(null===(t=n)||void 0===t?void 0:t.code)&&C("post",{postId:e}),n}$h(r),B(r);const{posts:o}=r;return o.find((t=>t.postId===e))};vm.locally=e=>{var t;m().log("post/getPost.locally",e);const[n]=null!==(t=y("post",e))&&void 0!==t?t:[];return n};const _m=async e=>{const t=m();t.log("channel/queryCommunities",e);const n=null!=e?e:{},{page:r,displayName:o,membership:i}=n,s=em(n,["page","displayName","membership"]),{data:a}=await t.http.get("/api/v3/communities",{params:Object.assign(Object.assign({},s),{keyword:o,filter:i,options:{token:ae(r,"skiplimit")}})}),{paging:c}=a,l=em(a,["paging"]);$h(l),B(l);const u=ce(null==c?void 0:c.previous),p=ce(null==c?void 0:c.next),{communities:d}=l;return{data:A(d),prevPage:u,nextPage:p}};_m.locally=e=>{m().log("community/queryCommunities.locally",e)};const wm=async e=>{const t=m();t.log("community/getCommunities",e);const{data:n}=await t.http.get("/api/v3/communities/list",{params:{communityIds:e}});$h(n),B(n);const{communities:r}=n;return A(r)};wm.locally=e=>{var t;m().log("community/getCommunities.locally",e);const n=null!==(t=y("community",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return A(n)};const Cm=async e=>{const t=m();t.log("community/getCommunity",e);const{data:n}=await t.http.get(`/api/v3/communities/${e}`);$h(n),B(n);const{communities:r}=n;return r.find((t=>t.communityId===e))};Cm.locally=e=>{var t;m().log("community/getCommunity.locally",e);const[n]=null!==(t=y("community",e))&&void 0!==t?t:[];return n};const Sm=async e=>{const t=m();t.log("community/queryCommunityMembers",e);const n=null!=e?e:{},{page:r,communityId:o}=n,i=em(n,["page","communityId"]),{data:s}=await t.http.get(`/api/v3/communities/${o}/users`,{params:Object.assign(Object.assign({},i),{options:{token:ae(r,"skiplimit")}})}),{paging:a}=s,c=em(s,["paging"]);$h(c),B(c);const{communityUsers:l}=c,u=ce(a.next),p=ce(a.previous);return{data:A(l),nextPage:u,prevPage:p}};Sm.locally=e=>{m().log("community/queryCommunityMembers",e)};const km=async e=>{const t=m();t.log("comment/queryComments",e);const{page:n}=e,r=em(e,["page"]);e.parentId;const{data:o}=await t.http.get("/api/v3/comments",{params:Object.assign(Object.assign({},r),{options:{token:ae(n,"afterbefore")}})}),{paging:i}=o,s=em(o,["paging"]);$h(s),B(s);const a=ce(i.previous),c=ce(i.next),{comments:l}=s;return{data:A(l),prevPage:a,nextPage:c}};km.locally=e=>{var t;m().log("post/queryComments.locally",e);const{referenceId:n,referenceType:r,parentId:o,isDeleted:i,page:s={before:0,limit:5}}=e;isNaN(s.limit)&&(s.limit=5);let a=null!==(t=y("comment"))&&void 0!==t?t:[];if(!a.length)return;if(a=Vh(a,"referenceId",n),a=Vh(a,"referenceType",r),a=Vh(a,"parentId",o),a=Vh(a,"isDeleted",i),!a.length)return;a=a.sort(zh);const c=isNaN(s.after)?0:a.findIndex((({segmentNumber:e})=>e===s.after+1)),l=isNaN(s.before)||0===s.before?a.length:a.findIndex((({segmentNumber:e})=>e===s.before-1))+1;if(c<0||l<0)return;let u=a.slice(-1!==c?c:0,-1!==l?l:void 0);if(u.length<s.limit)return;(isNaN(s.after)||isNaN(s.before))&&(u=isNaN(s.after)?(isNaN(s.before),u.slice(-s.limit)):u.slice(0,s.limit));for(let e=0;e<u.length-1;e++)if(u[e].segmentNumber!==u[e+1].segmentNumber-1)return;const p=u[0].segmentNumber>1?{before:u[0].segmentNumber,limit:s.limit}:void 0,d=u[u.length-1].segmentNumber<a[a.length-1].segmentNumber?{after:u[u.length-1].segmentNumber,limit:s.limit}:void 0;return{data:A(u),nextPage:d,prevPage:p}};const Em=async e=>{const t=m();t.log("comment/getComments",e);const{data:n}=await t.http.get("/api/v3/comments/list",{params:{commentIds:e}});$h(n),B(n);const{comments:r}=n;return A(r)};Em.locally=e=>{var t;m().log("comment/getComments.locally",e);const n=null!==(t=y("comment",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return A(n)};const Rm=async e=>{var t;const n=m();let r;n.log("comment/getComment",e);try{r=(await n.http.get(`/api/v3/comments/${e}`)).data}catch(n){throw 400400===(null===(t=n)||void 0===t?void 0:t.code)&&C("comment",{commentId:e}),n}$h(r),B(r);const{comments:o}=r;return o.find((t=>t.commentId===e))};Rm.locally=e=>{var t;m().log("comment/getComment.locally",e);const[n]=null!==(t=y("comment",e))&&void 0!==t?t:[];return n};const Im=async(e,t)=>{if("message"===e)return pm(t);if("post"===e)return vm(t);if("comment"===e)return Rm(t);throw new Error(`Incorrect referenceType: ${e}`)},Am=(e,t)=>{var n,r;if(m().userId!==t.reactor.userId)return;let o,i;if("post.addReaction"===e||"post.removeReaction"===e){const e=t.posts[0];i=(null!==(n=y("post",e.postId))&&void 0!==n?n:[])[0],o=e}else{const e=t.comments[0];i=(null!==(r=y("comment",e.commentId))&&void 0!==r?r:[])[0],o=e}if(i&&i.myReactions)if("post.addReaction"===e||"comment.addReaction"===e){if(i.myReactions.includes(t.reactor.reactionName))return;Object.assign(o,{myReactions:[...i.myReactions,t.reactor.reactionName]})}else{if(!i.myReactions.includes(t.reactor.reactionName))return;Object.assign(o,{myReactions:i.myReactions.filter((e=>e!==t.reactor.reactionName))})}},Om=async(e,t,n)=>{var r,o;const i=m();i.log("reaction/createReaction",{referenceId:t,referenceType:e,reactionName:n}),await i.http.post("/api/v2/reactions",{referenceId:t,referenceType:e,reactionName:n});const s=await Im(e,t);return um(e,s),null!==(o=null===(r=s.myReactions)||void 0===r?void 0:r.includes(n))&&void 0!==o&&o};Om.optimistically=(e,t,n)=>{var r,o;const i=R(e,t,(e=>{var t,r,o;if(!(null===(t=e.myReactions)||void 0===t?void 0:t.includes(n)))return Object.assign(Object.assign({},e),{syncedAt:-1,reactionsCount:e.reactionsCount+1,myReactions:[...null!==(r=e.myReactions)&&void 0!==r?r:[],n],reactions:Object.assign(Object.assign({},e.reactions),{[n]:(null!==(o=e.reactions[n])&&void 0!==o?o:0)+1})})}));return i&&um(e,i),null!==(o=null===(r=null==i?void 0:i.myReactions)||void 0===r?void 0:r.includes(n))&&void 0!==o&&o};const Tm=async(e,t,n)=>{var r,o;const i=m();i.log("reaction/removeReaction",{referenceId:t,referenceType:e,reactionName:n}),await i.http.delete("/api/v2/reactions",{data:{referenceId:t,referenceType:e,reactionName:n}});const s=await Im(e,t);return um(e,s),null!==(o=!(null===(r=s.myReactions)||void 0===r?void 0:r.includes(n)))&&void 0!==o&&o};Tm.optimistically=(e,t,n)=>{var r,o;const i=R(e,t,(e=>{var t,r,o;if(null===(t=e.myReactions)||void 0===t?void 0:t.includes(n))return Object.assign(Object.assign({},e),{syncedAt:-1,reactionsCount:Math.max(0,e.reactionsCount-1),myReactions:(null!==(r=e.myReactions)&&void 0!==r?r:[]).filter((e=>e!==n)),reactions:Object.assign(Object.assign({},e.reactions),{[n]:Math.max(0,(null!==(o=e.reactions[n])&&void 0!==o?o:0)-1)})})}));return i&&um(e,i),null!==(o=!(null===(r=null==i?void 0:i.myReactions)||void 0===r?void 0:r.includes(n)))&&void 0!==o&&o};const xm=(e,t)=>{const n=m();return vh(n,e,e,(e=>{var n,r;const[o]=null!==(n=y("post",e.posts[0].postId))&&void 0!==n?n:[],{communities:i}=e,s=em(e,["communities"]);$h(s),B(s),(null==i?void 0:i[0])&&_h("community.updated",{communities:i});const[a]=null!==(r=y("post",s.posts[0].postId))&&void 0!==r?r:[];o&&M(o,a)||t(a)}))},Pm=e=>xm("post.created",e),Mm=e=>xm("post.updated",e),Bm=e=>xm("post.deleted",e),jm=e=>xm("post.approved",e),Nm=e=>xm("post.declined",e),Fm=e=>xm("post.flagged",e),Um=e=>xm("post.unflagged",e),Lm=e=>{const t=m();return vh(t,"post.addReaction","post.addReaction",(t=>{var n,r;const[o]=null!==(n=y("post",t.posts[0].postId))&&void 0!==n?n:[],i=em(t,["reactor"]);$h(i),Am("post.addReaction",t),B(i);const[s]=null!==(r=y("post",t.posts[0].postId))&&void 0!==r?r:[];o&&M(o,s)||e(s)}))},Dm=e=>{const t=m();return vh(t,"post.removeReaction","post.removeReaction",(t=>{var n,r;const[o]=null!==(n=y("post",t.posts[0].postId))&&void 0!==n?n:[],i=em(t,["reactor"]);$h(i),Am("post.removeReaction",t),B(i);const[s]=null!==(r=y("post",t.posts[0].postId))&&void 0!==r?r:[];o&&M(o,s)||e(s)}))},qm=(e,t)=>{const n=m();return vh(n,e,e,(e=>{var n,r;const[o]=null!==(n=y("comment",e.comments[0].commentId))&&void 0!==n?n:[];$h(e),B(e);const[i]=null!==(r=y("comment",e.comments[0].commentId))&&void 0!==r?r:[];o&&M(o,i)||t(i)}))},$m=e=>qm("comment.created",e),Hm=e=>qm("comment.updated",e),Wm=e=>qm("comment.deleted",e),Vm=e=>qm("comment.flagged",e),Km=e=>qm("comment.unflagged",e),zm=e=>{const t=m();return vh(t,"comment.addReaction","comment.addReaction",(t=>{var n,r;const[o]=null!==(n=y("comment",t.comments[0].commentId))&&void 0!==n?n:[],i=em(t,["reactor"]);$h(i),Am("comment.addReaction",t),B(i);const[s]=null!==(r=y("comment",t.comments[0].commentId))&&void 0!==r?r:[];o&&M(o,s)||e(s)}))},Jm=e=>{const t=m();return vh(t,"comment.removeReaction","comment.removeReaction",(t=>{var n,r;const[o]=null!==(n=y("comment",t.comments[0].commentId))&&void 0!==n?n:[],i=em(t,["reactor"]);$h(i),Am("comment.removeReaction",t),B(i);const[s]=null!==(r=y("comment",t.comments[0].commentId))&&void 0!==r?r:[];o&&M(o,s)||e(s)}))};var Ym={post:{domainName:"posts",eventName:"v3/post.isflagbyme",primaryKey:"postId"},comment:{domainName:"comments",eventName:"v3/comment.isflagbyme",primaryKey:"commentId"},message:{domainName:"messages",eventName:"v3/message.isFlaggedByMe",primaryKey:"messageId"},user:{domainName:"users",eventName:"user.isFlagByMe",primaryKey:"userId"}};const Qm=async e=>{const t=m();t.log("channel/queryChannels",e);const n=null!=e?e:{},{page:r,displayName:o,membership:i}=n,s=em(n,["page","displayName","membership"]),{data:a}=await t.http.get("/api/v3/channels",{params:Object.assign(Object.assign({},s),{keyword:o,filter:i,options:{token:ae(r,"skiplimit")}})}),{paging:c}=a,l=em(a,["paging"]);$h(l),B(l);const u=ce(null==c?void 0:c.previous),p=ce(null==c?void 0:c.next),{channels:d}=l;return{data:A(d),prevPage:u,nextPage:p}};Qm.locally=e=>{m().log("channel/queryChannels.locally",e)};const Xm=async e=>{const t=m();t.log("channel/getChannels",e);const{data:n}=await t.http.get("/api/v3/channels/list",{params:{channelIds:e}});$h(n),B(n);const{channels:r}=n;return A(r)};Xm.locally=e=>{var t;m().log("channel/getChannels.locally",e);const n=null!==(t=y("channel",...e))&&void 0!==t?t:[];if((null==n?void 0:n.length)===e.length)return A(n)};const Gm=async e=>{const t=m();t.log("channel/getChannel",e);const{data:n}=await t.http.get(`/api/v3/channels/${e}`);$h(n),B(n);const{channels:r}=n;return r.find((t=>t.channelId===e))};Gm.locally=e=>{var t;m().log("channel/getChannel.locally",e);const[n]=null!==(t=y("channel",e))&&void 0!==t?t:[];return n};const Zm=async e=>{const t=m();t.log("channel/queryChannelMembers",e);const n=null!=e?e:{},{page:r,channelId:o,membership:i}=n,s=em(n,["page","channelId","membership"]),{data:a}=await t.http.get(`/api/v3/channels/${o}/users`,{params:Object.assign(Object.assign({},s),{filter:i,options:{token:ae(r,"skiplimit")}})}),{paging:c}=a,l=em(a,["paging"]);$h(l),B(l);const{channelUsers:u}=l,p=ce(c.next),d=ce(c.previous);return{data:A(u),nextPage:p,prevPage:d}};Zm.locally=e=>{m().log("channel/queryChannelMembers",e)};const eg=e=>{const t=m();return vh(t,"onChannelUpdated","v3.channel.didUpdate",(t=>{$h(t),B(t),e(t.channels[0])}))},tg=e=>{const t=m();return vh(t,"onChannelDeleted","v3.channel.didDelete",(t=>{$h(t),B(t),e(t.channels[0])}))},ng=e=>{const t=m();return vh(t,"onChannelJoined","v3.channel.didJoin",(t=>{$h(t),B(t),e(t.channels[0])}))},rg=e=>{const t=m();return vh(t,"onChannelLeft","v3.channel.didLeave",(t=>{$h(t),B(t),e(t.channels[0])}))},og=e=>{const t=m();return vh(t,"onMemberAdded","v3.channel.didAddUsers",(t=>{$h(t),B(t),e(t.channels[0])}))},ig=e=>{const t=m();return vh(t,"onMemberRemoved","v3.channel.didRemoveUsers",(t=>{$h(t),B(t),e(t.channels[0])}))},sg=e=>{const t=m();return vh(t,"message/onMessageCreated","v3.message.didCreate",(t=>{$h(t),B(t),e(t.messages[0])}))},ag=e=>{const t=m();return vh(t,"message/onMessageUpdated","v3.message.didUpdate",(t=>{$h(t),B(t),e(t.messages[0])}))},cg=e=>{const t=m();return vh(t,"message/onMessageDeleted","v3.message.didDelete",(t=>{$h(t),B(t),e(t.messages[0])}))},lg=(e,t)=>{const n=m();return vh(n,e,e,(e=>{var n,r;const[o]=null!==(n=y("community",e.communities[0].communityId))&&void 0!==n?n:[];$h(e),B(e);const[i]=null!==(r=y("community",e.communities[0].communityId))&&void 0!==r?r:[];o&&M(o,i)||t(i)}))};function ug(e,t,n){return!!e.permissions.some((e=>e===n))||t.users.find((t=>t.userId===e.userId)).permissions.some((e=>e===n))}function pg(e,t){return"community.joined"===e||"community.left"===e?t.communityUsers[0]:"community.userRemoved"===e?t.communityUsers.filter((e=>"none"===e.communityMembership))[0]:"community.userBanned"===e?t.communityUsers.filter((e=>"banned"===e.communityMembership))[0]:"community.userUnbanned"===e?t.communityUsers.filter((e=>!ug(e,t,"BAN_COMMUNITY_USER")))[0]:t.communityUsers.filter((e=>!ug(e,t,"ADD_COMMUNITY_USER")))[0]}const dg=(e,t)=>{const n=m();return vh(n,e,e,(n=>{var r,o,i,s;const[a]=null!==(r=y("community",n.communities[0].communityId))&&void 0!==r?r:[],[c]=null!==(o=y("communityUsers",v("communityUsers")(pg(e,n))))&&void 0!==o?o:[];$h(n),B(n);const[l]=null!==(i=y("community",n.communities[0].communityId))&&void 0!==i?i:[],[u]=null!==(s=y("communityUsers",v("communityUsers")(pg(e,n))))&&void 0!==s?s:[];a&&M(a,l)&&c&&M(c,u)||t(l,u)}))},fg=e=>lg("community.updated",e),hg=e=>lg("community.deleted",e),mg=e=>dg("community.joined",e),gg=e=>dg("community.left",e),yg=e=>dg("community.userAdded",e),bg=e=>dg("community.userRemoved",e),vg=e=>dg("community.userBanned",e),_g=e=>dg("community.userUnbanned",e),wg=async e=>{const t=m();t.log("stream/getStream",e);const{data:n}=await t.http.get(`/api/v3/video-streaming/${e}`);$h(n),B(n);const{videoStreamings:r}=n;return r.find((t=>t.streamId===e))};wg.locally=e=>{var t;m().log("stream/getStream",e);const[n]=null!==(t=y("stream",e))&&void 0!==t?t:[];return n};const Cg=async e=>{const t=m();t.log("stream/queryStreams",e);const n=null!=e?e:{},{page:r}=n,o=em(n,["page"]),{data:i}=await t.http.get("/api/v3/video-streaming",{params:Object.assign(Object.assign({},o),{options:{token:ae(r,"skiplimit")}})}),{paging:s,results:a}=i;$h(a),B(a);const c=ce(null==s?void 0:s.previous),l=ce(null==s?void 0:s.next),{videoStreamings:u}=a;return{data:A(u),prevPage:c,nextPage:l}};Cg.locally=e=>{m().log("stream/queryStreams.locally",e)};return e.VERSION=l,e.addChannelMembers=async(e,t)=>{const n=m();n.log("channel/addChannelMembers",e,t);const{data:r}=await n.http.post(`/api/v3/channels/${e}/users`,{channelId:e,userIds:t});$h(r),B(r),_h("v3.channel.didAddUsers",{channels:r.channels});const{channelUsers:o}=r;return!!o.find((t=>t.channelId===e&&"member"===t.membership))},e.addChannelMembersRole=async(e,t,n)=>{const r=m();r.log("channel/addChannelMembersRole",e,t,n);const{data:o}=await r.http.post(`/api/v3/channels/${e}/users/roles`,{channelId:e,role:t,userIds:n});$h(o),B(o);const{channelUsers:i}=o;return!!i.find((n=>n.channelId===e&&n.roles.includes(t)))},e.addCommunityMembers=async(e,t)=>{const n=m();n.log("community/addCommunityMembers",e,t);const{data:r}=await n.http.post(`/api/v3/communities/${e}/users`,{communityId:e,userIds:t});$h(r),B(r),_h("community.userAdded",{communities:r.communities});const{communityUsers:o}=r;return!!o.find((t=>t.communityId===e&&"member"===t.communityMembership))},e.addCommunityMembersRole=async(e,t,n)=>{const r=m();r.log("community/addCommunityMembersRole",e,t,n);const{data:o}=await r.http.post(`/api/v3/communities/${e}/users/roles`,{communityId:e,role:t,userIds:n});$h(o),B(o);const{communityUsers:i}=o;return!!i.find((n=>n.communityId===e&&n.roles.includes(t)))},e.addReaction=Om,e.clearCache=(e=["user","file","channel","message","community","post","comment"])=>{const t=m();t.log("client/api/enableCache"),e.forEach((e=>{var n,r;return null===(r=null===(n=t.cache)||void 0===n?void 0:n[e])||void 0===r?void 0:r.erase()}))},e.connectClient=async e=>{var t,n;const r=m();r.log("client/api/connectClient",Object.assign({apiKey:r.apiKey},e)),null!==(t=e.displayName)&&void 0!==t||(e.displayName=e.userId),null!==(n=e.deviceId)&&void 0!==n||(e.deviceId=`ascWebSdk#${Math.random().toString(16)}`);const{accessToken:o,users:i}=await(async e=>{const t=m();t.log("client/api/getToken",e);const n=await Ch(),{data:r}=await t.http.post("/v1/device",Object.assign(Object.assign({},e),{deviceInfo:n}),{headers:{"X-API-Key":t.apiKey}});return r})(e);r.http.defaults.headers.common.Authorization=`Bearer ${o}`,r.ws.io.opts.query={token:o},((e,t)=>{gh.forEach((n=>{e.on(n,(e=>t.emit(n,e)))}))})(r.ws,r.emitter),await new Promise((e=>{r.ws.once("connect",e),r.ws.open()}));const s=Eh((()=>{wh(),s()}));return r.userId=e.userId,r.user=i[0],r.accessToken=o,r.ws.connected},e.createCache=j,e.createChannel=async e=>{const t=m();t.log("user/createChannel",e);const{data:n}=await t.http.post("/api/v3/channels",e);$h(n),B(n);const{channels:r}=n;return r[0]},e.createClient=(e,t=It,n="amity")=>{const r=(e=>{const t=`${null==e?void 0:e.trim()}`.length>0&&"production"!==process.env.NODE_ENV,n=Rt(e),r=(e,...r)=>{t&&n(e,r)};return r.__instance__=n,r})(n);r("client/api/createClient",{apiKey:e.replace(/.{5}$/g,"xxxxx"),apiEndpoint:t});const o=(e=>{const t={maxSockets:100,maxFreeSockets:10,timeout:6e4,freeSocketTimeout:3e4},n=Yn.create({baseURL:e,httpAgent:new Zn(t),httpsAgent:new Xn(t),paramsSerializer:tr});return n.interceptors.response.use((e=>e),(e=>{var t;const{response:n}=e;console.error(null!==(t=null==n?void 0:n.data)&&void 0!==t?t:e),n&&er(n.data)})),n})(Ot(At.HTTP,t)),i=(e=>{const t=ts(e,{autoConnect:!1,reconnectionDelay:2e3,transports:["websocket"]});return t.on("disconnect",(e=>{"io server disconnect"===e&&t.connect()})),t})(Ot(At.HTTP,t)),s=mh(Ot(At.MQTT,t)),a=bh(),c={version:`${l}`,apiKey:e,log:r,http:o,ws:i,mqtt:s,emitter:a,use:()=>g(c)};try{m()}catch(e){g(c)}return c},e.createComment=async e=>{const t=m();t.log("comment/createComment",e);const{data:n}=await t.http.post("/api/v3/comments",e);$h(n),B(n);const r=await vm(e.referenceId);_h("post.updated",{posts:[r]}),_h("comment.created",n);const{comments:o}=n;return o[0]},e.createCommunity=async e=>{const t=m();t.log("user/createCommunity",e);const{data:n}=await t.http.post("/api/v3/communities/",e);$h(n),B(n),_h("community.created",n);const{communities:r}=n;return r[0]},e.createFile=async(e,t)=>{const n=m();if(n.log("file/createFile",e),!e.getAll("file").length)throw new Error("The formData object must have a `file` key.");const r="getHeaders"in e?e.getHeaders():{"content-type":"multipart/form-data"},{data:o}=await n.http.post("/api/v3/files",e,{headers:r,onUploadProgress({loaded:e,total:n}){t&&t(Math.round(100*e/n))}});return Hh(o),B({files:o}),o[0]},e.createMessage=hm,e.createPost=async e=>{const t=m();t.log("post/createPost",e),e.dataType&&!["text","image","file"].includes(e.dataType)||delete e.dataType;const{data:n}=await t.http.post("/api/v3/posts",e);$h(n),B(n),_h("community.updated",{communities:n.communities}),_h("post.created",n);const{posts:r}=n;return r[0]},e.createQuery=ge,e.createReport=async(e,t)=>{const n=m();n.log("report/createReport",{referenceType:e,referenceId:t});const{domainName:r}=Ym[e],{data:o}=await n.http.post(`/api/v3/${r}/${t}/flag`),i="message"===e?"v3.message.didUpdate":`${e}.updated`;return $h(o),B(o),_h(i,o),!!o},e.createStream=async e=>{const t=m();t.log("stream/createStream",e);const{data:n}=await t.http.post("/api/v3/video-streaming",e);$h(n),B(n);const{videoStreamings:r}=n;return r[0]},e.decorateModel=Wh,e.decorateModels=Hh,e.decoratePayload=$h,e.deleteChannel=async e=>{const t=m();t.log("channel/deleteChannel",e),await t.http.delete(`/api/v3/channels/${e}`);return await Gm(e)},e.deleteComment=async(e,t=!1)=>{const n=m();n.log("comment/deleteComment",e);const r=await Rm(e);await n.http.delete(`/api/v4/comments/${e}`,{params:{commentId:e,permanent:t}});const o=Object.assign(Object.assign({},r),{isDeleted:!0}),i=await vm(r.referenceId);return _h("post.updated",{posts:[i]}),_h("comment.deleted",{comments:[o]}),t?setTimeout((()=>{C("comment",{commentId:e})}),0):I("comment",{commentId:e,isDeleted:!0}),o},e.deleteCommunity=async e=>{const t=m();t.log("community/deleteCommunity",e),await t.http.delete(`/api/v3/communities/${e}`);const n=await Cm(e);return _h("community.deleted",{communities:[n]}),n},e.deleteFile=async e=>{const t=m();t.log("file/deleteFile",e);const{data:n}=await t.http.delete(`/api/v3/files/${e}`);return C("file",{fileId:n.fileId}),{success:!0}},e.deleteMessage=gm,e.deletePost=async(e,t=!1)=>{const n=m();n.log("post/deletePost",e);let r=await vm(e);if(await n.http.delete(`/api/v4/posts/${e}`,{params:{postId:e,permanent:t}}),"community"===r.targetType){const e=await Cm(r.targetId);_h("community.updated",{communities:[e]})}const o=Object.assign(Object.assign({},r),{isDeleted:!0});return _h("post.deleted",{posts:[o]}),t?setTimeout((()=>{C("post",{postId:e})}),0):I("post",{postId:e,isDeleted:!0}),o},e.deleteReport=async(e,t)=>{const n=m();n.log("report/deleteReport",{referenceType:e,referenceId:t});const{domainName:r}=Ym[e],{data:o}=await n.http.delete(`/api/v3/${r}/${t}/unflag`),i="message"===e?"v3.message.didUpdate":`${e}.updated`;return $h(o),B(o),_h(i,o),!!o},e.deleteStream=async e=>{const t=m();t.log("stream/deleteStream",e);const{data:n}=await t.http.delete(`/api/v3/video-streaming/${e}`),{success:r}=n;return r},e.disconnectClient=wh,e.disposeStream=async e=>{const t=m();t.log("stream/disposeStream",e);const{data:n}=await t.http.delete(`/api/v3/video-streaming/${e}/streaming-url`);$h(n),B(n);const{videoStreamings:r}=n;return r.find((t=>t.streamId===e))},e.dropFromCache=C,e.enableCache=(e=Ih("user","file","channel","message","community","post","comment","communityUsers","channelUsers","stream"))=>{const t=m();t.log("client/api/enableCache"),t.cache=j(e)},e.fileUrlWithSize=(e,t)=>`${e}?size=${t}`,e.filterByPropEquality=Vh,e.getActiveClient=m,e.getChannel=Gm,e.getChannels=Xm,e.getComment=Rm,e.getCommentTopic=({path:e})=>e,e.getComments=Em,e.getCommunities=wm,e.getCommunity=Cm,e.getCommunityTopic=({path:t},n=e.SubscriptionLevels.COMMUNITY)=>Yh({path:t},n),e.getFile=am,e.getMessage=pm,e.getMessages=dm,e.getPost=vm,e.getPostTopic=({path:t},n=e.SubscriptionLevels.POST)=>"comment"===n?`${t}/comment/+`:t,e.getPosts=bm,e.getRole=lm,e.getStream=wg,e.getUser=Gh,e.getUserTopic=({path:t},n=e.SubscriptionLevels.USER)=>Yh({path:t},n),e.getUsers=Zh,e.ingestInCache=B,e.isAfterBefore=ie,e.isConnected=()=>{var e,t;const n=m();return n.log("client/api/isConnected",n),!!(n.userId&&(null===(t=null===(e=n.http.defaults.headers.common)||void 0===e?void 0:e.Authorization)||void 0===t?void 0:t.length)&&n.ws.connected)},e.isFetcher=le,e.isFresh=he,e.isLocal=fe,e.isMutator=ue,e.isOffline=pe,e.isPaged=se,e.isReportedByMe=async(e,t)=>{var n,r;const o=m();o.log("report/isReportedByMe",{referenceType:e,referenceId:t});const{eventName:i,primaryKey:s}=Ym[e],{result:a,isFlagByMe:c}=null!==(n=await(async(e,t,n)=>{const{ws:r}=e;return await new Promise(((e,o)=>{r.emit(t,n,(t=>{try{e(er(t))}catch(e){o(e)}}))}))})(o,i,{[s]:t}))&&void 0!==n?n:{};return null!==(r=null!=a?a:c)&&void 0!==r&&r},e.isSkipLimit=oe,e.isSyncable=de,e.isSynced=me,e.joinChannel=async e=>{const t=m();t.log("channel/joinChannel",e);const{data:n}=await t.http.post(`/api/v3/channels/${e}/join`);$h(n),B(n);const{channelUsers:r}=n;return!!r.find((t=>t.channelId===e&&"member"===t.membership))},e.joinCommunity=async e=>{const t=m();t.log("community/joinCommunity",e);const{data:n}=await t.http.post(`/api/v3/communities/${e}/join`);$h(n),B(n),_h("community.joined",{communities:n.communities});const{communityUsers:r}=n;return!!r.find((t=>t.communityId===e&&"member"===t.communityMembership))},e.leaveChannel=async e=>{const t=m();t.log("channel/leaveChannel",e);const{data:n}=await t.http.delete(`/api/v3/channels/${e}/leave`);$h(n),B(n);const{channelUsers:r}=n;return!!r.find((t=>t.channelId===e&&"member"!==t.membership))},e.leaveCommunity=async e=>{const t=m();t.log("community/leaveCommunity",e);const{data:n}=await t.http.delete(`/api/v3/communities/${e}/leave`);$h(n),B(n),_h("community.left",{communities:n.communities});const{communityUsers:r}=n;return!!r.find((t=>t.communityId===e&&"member"!==t.communityMembership))},e.memoryStore=Rh,e.memoryStores=Ih,e.mergeInCache=I,e.mutateCache=R,e.observeChannel=(e,t)=>{const{log:n}=m(),r=Date.now();n(`observeChannel(tmpid: ${r}) > listen`);const o=(n,r)=>{var o,i,s;if((null===(o=n.data)||void 0===o?void 0:o.channelId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(i=t.onEvent)||void 0===i||i.call(t,r,n)),null===(s=t[r])||void 0===s||s.call(t,n)}},i=[];return i.push(eg((e=>o({data:e},"onUpdate"))),tg((e=>o({data:e},"onDelete"))),ng((e=>o({data:e},"onJoin"))),rg((e=>o({data:e},"onLeft"))),og((e=>o({data:e},"onMemberAdded"))),ig((e=>o({data:e},"onMemberRemoved")))),_e(ge(Gm,e),(e=>e.data&&o(e,"onFetch"))),()=>{n(`observeChannel(tmpid: ${r}) > dispose`),i.forEach((e=>e()))}},e.observeComment=(e,t,n="cache_then_server")=>{const{log:r}=m(),o=Date.now();r(`observeComment(tmpid: ${o}) > listen`);const i=(e,n)=>{var r,o;if(t instanceof Function)return t(e);"onFetch"!==n&&(null===(r=t.onEvent)||void 0===r||r.call(t,n,e)),null===(o=t[n])||void 0===o||o.call(t,e)},s=(t,n)=>{var r;(null===(r=t.data)||void 0===r?void 0:r.commentId)===e&&i(t,n)},a=[];return a.push(Hm((e=>s({data:e},"onUpdate"))),Wm((e=>s({data:e},"onDelete"))),Vm((e=>s({data:e},"onFlagged"))),Km((e=>s({data:e},"onUnflagged"))),zm((e=>s({data:e},"onReactionAdded"))),Jm((e=>s({data:e},"onReactionRemoved")))),_e(ge(Rm,e),(e=>i(e,"onFetch")),ye(n)),()=>{r(`observeComment(tmpid: ${o}) > dispose`),a.forEach((e=>e()))}},e.observeComments=(e,t)=>{const{log:n}=m(),r=Date.now();n(`observeComments(tmpid: ${r}) > listen`);const o=[],i=(n,r)=>{var o,i;if(n.referenceId===e){if(t instanceof Function)return t(n);null===(o=t.onEvent)||void 0===o||o.call(t,r,n),null===(i=t[r])||void 0===i||i.call(t,n)}};return o.push($m((e=>i(e,"onCreate"))),Hm((e=>i(e,"onUpdate"))),Wm((e=>i(e,"onDelete"))),Vm((e=>i(e,"onFlagged"))),Km((e=>i(e,"onUnflagged"))),zm((e=>i(e,"onReactionAdded"))),Jm((e=>i(e,"onReactionRemoved")))),()=>{n(`observeComments(tmpid: ${r}) > dispose`),o.forEach((e=>e()))}},e.observeCommunity=(e,t)=>{const{log:n}=m(),r=Date.now();n(`observeCommunity(tmpid: ${r}) > listen`);const o=(e,n)=>{var r,o;if(t instanceof Function)return t(e);"onFetch"!==n&&(null===(r=t.onEvent)||void 0===r||r.call(t,n,e)),null===(o=t[n])||void 0===o||o.call(t,e)},i=(t,n)=>{var r;(null===(r=t.data)||void 0===r?void 0:r.communityId)===e&&o(t,n)},s=[];return s.push(fg((e=>i({data:e},"onUpdate"))),hg((e=>i({data:e},"onDelete"))),mg((e=>i({data:e},"onJoin"))),gg((e=>i({data:e},"onLeft"))),yg((e=>i({data:e},"onUserAdded"))),bg((e=>i({data:e},"onUserRemoved"))),vg((e=>i({data:e},"onUserBanned"))),_g((e=>i({data:e},"onUserUnbanned")))),_e(ge(Cm,e),(e=>o(e,"onFetch"))),()=>{n(`observeCommunity(tmpid: ${r}) > dispose`),s.forEach((e=>e()))}},e.observeFile=(e,t)=>{const{log:n}=m(),r=Date.now();n(`observeFile(tmpid: ${r}) > listen`);return _e(ge(am,e),(n=>n.data&&((n,r)=>{var o,i,s;if((null===(o=n.data)||void 0===o?void 0:o.fileId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(i=t.onEvent)||void 0===i||i.call(t,r,n)),null===(s=t[r])||void 0===s||s.call(t,n)}})(n,"onFetch"))),()=>{n(`observeFile(tmpid: ${r}) > dispose`)}},e.observeMessage=(e,t,n="cache_then_server")=>{const{log:r}=m(),o=Date.now();r(`observeMessage(tmpid: ${o}) > listen`);const i=(n,r)=>{var o,i,s;if((null===(o=n.data)||void 0===o?void 0:o.messageId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(i=t.onEvent)||void 0===i||i.call(t,r,n)),null===(s=t[r])||void 0===s||s.call(t,n)}},s=[];return s.push(ag((e=>i(e,"onUpdate"))),cg((e=>i(e,"onDelete")))),"no_fetch"!==n&&_e(ge(pm,e),(e=>e.data&&i(e,"onFetch")),ye(n)),()=>{r(`observeMessages(tmpid: ${o}) > dispose`),s.forEach((e=>e()))}},e.observeMessages=(e,t)=>{const{log:n}=m(),r=Date.now();n(`observeMessages(tmpid: ${r}) > listen`);const o=[],i=(n,r)=>{var o,i;if(n.channelId===e){if(t instanceof Function)return t(n);null===(o=t.onEvent)||void 0===o||o.call(t,r,n),null===(i=t[r])||void 0===i||i.call(t,n)}};return o.push(sg((e=>i(e,"onCreate"))),ag((e=>i(e,"onUpdate"))),cg((e=>i(e,"onDelete")))),()=>{n(`observeMessages(tmpid: ${r}) > dispose`),o.forEach((e=>e()))}},e.observePost=(e,t,n="cache_then_server")=>{const{log:r}=m(),o=Date.now();r(`observePost(tmpid: ${o}) > listen`);const i=(e,n)=>{var r,o;if(t instanceof Function)return t(e);"onFetch"!==n&&(null===(r=t.onEvent)||void 0===r||r.call(t,n,e)),null===(o=t[n])||void 0===o||o.call(t,e)},s=(t,n)=>{var r;(null===(r=t.data)||void 0===r?void 0:r.postId)===e&&i(t,n)},a=[];return a.push(Mm((e=>s({data:e},"onUpdate"))),Bm((e=>s({data:e},"onDelete"))),jm((e=>s({data:e},"onApproved"))),Nm((e=>s({data:e},"onDeclined"))),Fm((e=>s({data:e},"onFlagged"))),Um((e=>s({data:e},"onUnflagged"))),Lm((e=>s({data:e},"onReactionAdded"))),Dm((e=>s({data:e},"onReactionRemoved")))),_e(ge(vm,e),(e=>i(e,"onFetch")),ye(n)),()=>{r(`observePosts(tmpid: ${o}) > dispose`),a.forEach((e=>e()))}},e.observePosts=(e,t)=>{const{log:n}=m(),r=Date.now();n(`observePosts(tmpid: ${r}) > listen`);const o=[],i=(n,r)=>{var o,i;if(e.targetId===n.targetId&&e.targetType===n.targetType){if(t instanceof Function)return t(n);null===(o=t.onEvent)||void 0===o||o.call(t,r,n),null===(i=t[r])||void 0===i||i.call(t,n)}};return o.push(Pm((e=>i(e,"onCreate"))),Mm((e=>i(e,"onUpdate"))),Bm((e=>i(e,"onDelete"))),jm((e=>i(e,"onApproved"))),Nm((e=>i(e,"onDeclined"))),Fm((e=>i(e,"onFlagged"))),Um((e=>i(e,"onUnflagged"))),Lm((e=>i(e,"onReactionAdded"))),Dm((e=>i(e,"onReactionRemoved")))),()=>{n(`observePosts(tmpid: ${r}) > dispose`),o.forEach((e=>e()))}},e.observeUser=(e,t)=>{const{log:n}=m(),r=Date.now();n(`observeUser(tmpid: ${r}) > listen`);const o=(n,r)=>{var o,i,s;if((null===(o=n.data)||void 0===o?void 0:o.userId)===e){if(t instanceof Function)return t(n);"onFetch"!==r&&(null===(i=t.onEvent)||void 0===i||i.call(t,r,n)),null===(s=t[r])||void 0===s||s.call(t,n)}},i=[];return i.push(rm((e=>o({data:e},"onUpdate"))),om((e=>o({data:e},"onFlagged"))),im((e=>o({data:e},"onUnflagged"))),sm((e=>o({data:e},"onFlagCleared")))),_e(ge(Gh,e),(e=>e.data&&o(e,"onFetch"))),()=>{n(`observeUser(tmpid: ${r}) > dispose`),i.forEach((e=>e()))}},e.onChannelDeleted=tg,e.onChannelJoined=ng,e.onChannelLeft=rg,e.onChannelUpdated=eg,e.onClientBanned=Eh,e.onClientDisconnected=e=>kh((({code:t})=>{800211===t&&e()})),e.onCommentCreated=$m,e.onCommentDeleted=Wm,e.onCommentFlagged=Vm,e.onCommentReactionAdded=zm,e.onCommentReactionRemoved=Jm,e.onCommentUnflagged=Km,e.onCommentUpdated=Hm,e.onCommunityCreated=e=>lg("community.created",e),e.onCommunityDeleted=hg,e.onCommunityJoined=mg,e.onCommunityLeft=gg,e.onCommunityUpdated=fg,e.onCommunityUserAdded=yg,e.onCommunityUserBanned=vg,e.onCommunityUserRemoved=bg,e.onCommunityUserUnbanned=_g,e.onConnectionError=kh,e.onMemberAdded=og,e.onMemberRemoved=ig,e.onMessageCreated=sg,e.onMessageDeleted=cg,e.onMessageUpdated=ag,e.onPostApproved=jm,e.onPostCreated=Pm,e.onPostDeclined=Nm,e.onPostDeleted=Bm,e.onPostFlagged=Fm,e.onPostReactionAdded=Lm,e.onPostReactionRemoved=Dm,e.onPostUnflagged=Um,e.onPostUpdated=Mm,e.onReactionRemoved=(e,t,n)=>{const r=r=>{v(e)(r)===t&&n(r)};if("message"===e){const e=m(),t=e=>{var t,n;const o=(null===(n=(null!==(t=y("message",e.messages[0].messageId))&&void 0!==t?t:[])[0])||void 0===n?void 0:n.reactionsCount)!==e.messages[0].reactionsCount;$h(e),B(e),o&&r(e.messages[0])};return vh(e,"reaction/onReactionRemoved","v3.message.didUpdate",t)}return"post"===e?Dm(r):Jm(r)},e.onUserFlagCleared=sm,e.onUserFlagged=om,e.onUserUnflagged=im,e.onUserUpdated=rm,e.persistentStore=async(e,t={},n=250)=>{let r=t;const o=await qh.getItem(e);if(o)try{r=JSON.parse(o)}catch(e){}const i=Rh(r);let s=null;const a=()=>{s?s.then((()=>a())):(clearTimeout(undefined),setTimeout((async()=>{s=Promise.resolve().then((()=>qh.setItem(e,JSON.stringify(i.read())))).then((()=>s=null))}),n))};return{read:i.read,write:e=>{i.write(e),a()},erase:(...e)=>{i.erase(...e),a()}}},e.pullFromCache=y,e.pushToCache=w,e.queryChannelMembers=Zm,e.queryChannels=Qm,e.queryComments=km,e.queryCommunities=_m,e.queryCommunityMembers=Sm,e.queryGlobalFeed=async e=>{const t=m();t.log("feed/queryGlobalFeed",e);const n=null!=e?e:{},{page:r}=n,o=em(n,["page"]),{data:i}=await t.http.get("/api/v4/me/global-feeds",{params:Object.assign(Object.assign({},o),{options:{token:ae(r,"skiplimit")}})}),{paging:s}=i,a=em(i,["paging"]);$h(a),B(a);const{posts:c}=a,l=ce(s.next),u=ce(s.previous);return{data:A(c),nextPage:l,prevPage:u}},e.queryMessages=fm,e.queryOptions=ye,e.queryPosts=ym,e.queryRoles=cm,e.queryStreams=Cg,e.queryUsers=tm,e.removeChannelMembers=async(e,t)=>{const n=m();n.log("channel/removeChannelMembers",e,t);const{data:r}=await n.http.delete(`/api/v3/channels/${e}/users`,{data:{channelId:e,userIds:t}});$h(r),B(r),_h("v3.channel.didRemoveUsers",{channels:r.channels});const{channelUsers:o}=r;return!!o.find((t=>t.channelId===e&&"member"!==t.membership))},e.removeChannelMembersRole=async(e,t,n)=>{const r=m();r.log("channel/removeChannelMembersRole",e,t,n);const{data:o}=await r.http.delete(`/api/v3/channels/${e}/users/roles`,{data:{channelId:e,role:t,userIds:n}});$h(o),B(o);const{channelUsers:i}=o;return!!i.find((n=>n.channelId===e&&!n.roles.includes(t)))},e.removeCommunityMembers=async(e,t)=>{const n=m();n.log("community/removeCommunityMembers",e,t);const{data:r}=await n.http.delete(`/api/v3/communities/${e}/users`,{data:{communityId:e,userIds:t}});$h(r),B(r),_h("community.userRemoved",{communities:r.communities});const{communityUsers:o}=r;return!!o.find((t=>t.communityId===e&&"member"!==t.communityMembership))},e.removeCommunityMembersRole=async(e,t,n)=>{const r=m();r.log("community/removeCommunityMembersRole",e,t,n);const{data:o}=await r.http.delete(`/api/v3/communities/${e}/users/roles`,{data:{communityId:e,role:t,userIds:n}});$h(o),B(o);const{communityUsers:i}=o;return!!i.find((n=>n.communityId===e&&!n.roles.includes(t)))},e.removeReaction=Tm,e.runQuery=_e,e.sliceByPaging=(e,t,n)=>{if(console.log("slice by paging",n),!n)return t.slice();let r,o=0;n.after?(o=n.after,r=o+n.limit):n.before&&(r=n.before+1,o=r>n.limit?r-n.limit:0);const i=t.slice(o,r);return i.length===n.limit?i:void 0},e.sortByChannelSegment=Kh,e.sortByDisplayName=({displayName:e},{displayName:t})=>e===t?0:e<t?-1:1,e.sortByFirstCreated=({createdAt:e},{createdAt:t})=>new Date(e).valueOf()-new Date(t).valueOf(),e.sortByLastActivity=({lastActivity:e},{lastActivity:t})=>new Date(t).valueOf()-new Date(e).valueOf(),e.sortByLastCreated=({createdAt:e},{createdAt:t})=>new Date(t).valueOf()-new Date(e).valueOf(),e.sortBySegmentNumber=zh,e.subscribeTopic=function(e,t){const{mqtt:n,emitter:r,accessToken:o,user:i}=m();return Qh===o&&Xh===i._id||(Qh=o,Xh=i._id,n.connect({accessToken:o,userId:i._id}),((e,t)=>{yh.forEach((n=>{e.on(n,((...e)=>t.emit(n,1===e.length?e[0]:e)))})),e.on("message",((e,n)=>{const r=JSON.parse(n.toString());t.emit(r.eventType,r.data)}))})(n,r)),n.subscribe(e,t)},e.syncInCache=E,e.toPage=ce,e.toToken=ae,e.updateChannel=async(e,t)=>{const n=m();n.log("channel/updateChannel",e,t);const{data:r}=await n.http.put(`/api/v3/channels/${e}`,t);$h(r),B(r);const{channels:o}=r;return o.find((t=>t.channelId===e))},e.updateComment=async(e,t)=>{const n=m();n.log("user/updateComment",t);const{data:r}=await n.http.put(`/api/v3/comments/${e}`,t);$h(r),B(r),_h("comment.updated",r);const{comments:o}=r;return o.find((t=>t.commentId===e))},e.updateCommunity=async(e,t)=>{const n=m();n.log("community/updateCommunity",e,t);const{data:r}=await n.http.put(`/api/v3/communities/${e}`,t);$h(r),B(r),_h("community.updated",r);const{communities:o}=r;return o.find((t=>t.communityId===e))},e.updateMessage=mm,e.updatePost=async(e,t)=>{const n=m();n.log("user/updatePost",t);const{data:r}=await n.http.put(`/api/v3/posts/${e}`,t);$h(r),B(r),_h("post.updated",r);const{posts:o}=r;return o.find((t=>t.postId===e))},e.updateStream=async(e,t)=>{const n=m();n.log("stream/updateStream",e,t);const{data:r}=await n.http.put(`/api/v3/video-streaming/${e}`,t);$h(r),B(r);const{videoStreamings:o}=r;return o.find((t=>t.streamId===e))},e.updateUser=async(e,t)=>{const n=m();n.log("user/updateUser",e,t);const{data:r}=await n.http.put("/api/v3/users/",Object.assign(Object.assign({userId:e},t),{createNewUserWhenNotFound:!1}));return $h(r),B(r),r.users.find((t=>t.userId===e))},Object.defineProperty(e,"__esModule",{value:!0}),e}({},require$$0$1,require$$2,require$$2$1);