socket.io.js 111 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406
  1. !(function (t, e) {
  2. "object" == typeof exports && "object" == typeof module
  3. ? (module.exports = e())
  4. : "function" == typeof define && define.amd
  5. ? define([], e)
  6. : "object" == typeof exports
  7. ? (exports.io = e())
  8. : (t.io = e());
  9. })(this, function () {
  10. return (function (t) {
  11. function e(r) {
  12. if (n[r]) return n[r].exports;
  13. var o = (n[r] = { exports: {}, id: r, loaded: !1 });
  14. return t[r].call(o.exports, o, o.exports, e), (o.loaded = !0), o.exports;
  15. }
  16. var n = {};
  17. return (e.m = t), (e.c = n), (e.p = ""), e(0);
  18. })([
  19. function (t, e, n) {
  20. "use strict";
  21. function r(t, e) {
  22. "object" === ("undefined" == typeof t ? "undefined" : o(t)) &&
  23. ((e = t), (t = void 0)),
  24. (e = e || {});
  25. var n,
  26. r = i(t),
  27. s = r.source,
  28. u = r.id,
  29. h = r.path,
  30. f = p[u] && h in p[u].nsps,
  31. l =
  32. e.forceNew || e["force new connection"] || !1 === e.multiplex || f;
  33. return (
  34. l
  35. ? (c("ignoring socket cache for %s", s), (n = a(s, e)))
  36. : (p[u] || (c("new io instance for %s", s), (p[u] = a(s, e))),
  37. (n = p[u])),
  38. r.query && !e.query && (e.query = r.query),
  39. n.socket(r.path, e)
  40. );
  41. }
  42. var o =
  43. "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
  44. ? function (t) {
  45. return typeof t;
  46. }
  47. : function (t) {
  48. return t &&
  49. "function" == typeof Symbol &&
  50. t.constructor === Symbol &&
  51. t !== Symbol.prototype
  52. ? "symbol"
  53. : typeof t;
  54. },
  55. i = n(1),
  56. s = n(7),
  57. a = n(13),
  58. c = n(3)("socket.io-client");
  59. t.exports = e = r;
  60. var p = (e.managers = {});
  61. (e.protocol = s.protocol),
  62. (e.connect = r),
  63. (e.Manager = n(13)),
  64. (e.Socket = n(39));
  65. },
  66. function (t, e, n) {
  67. (function (e) {
  68. "use strict";
  69. function r(t, n) {
  70. var r = t;
  71. (n = n || e.location),
  72. null == t && (t = n.protocol + "//" + n.host),
  73. "string" == typeof t &&
  74. ("/" === t.charAt(0) &&
  75. (t = "/" === t.charAt(1) ? n.protocol + t : n.host + t),
  76. /^(https?|wss?):\/\//.test(t) ||
  77. (i("protocol-less url %s", t),
  78. (t =
  79. "undefined" != typeof n
  80. ? n.protocol + "//" + t
  81. : "https://" + t)),
  82. i("parse %s", t),
  83. (r = o(t))),
  84. r.port ||
  85. (/^(http|ws)$/.test(r.protocol)
  86. ? (r.port = "80")
  87. : /^(http|ws)s$/.test(r.protocol) && (r.port = "443")),
  88. (r.path = r.path || "/");
  89. var s = r.host.indexOf(":") !== -1,
  90. a = s ? "[" + r.host + "]" : r.host;
  91. return (
  92. (r.id = r.protocol + "://" + a + ":" + r.port),
  93. (r.href =
  94. r.protocol +
  95. "://" +
  96. a +
  97. (n && n.port === r.port ? "" : ":" + r.port)),
  98. r
  99. );
  100. }
  101. var o = n(2),
  102. i = n(3)("socket.io-client:url");
  103. t.exports = r;
  104. }).call(
  105. e,
  106. (function () {
  107. return this;
  108. })()
  109. );
  110. },
  111. function (t, e) {
  112. var n =
  113. /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,
  114. r = [
  115. "source",
  116. "protocol",
  117. "authority",
  118. "userInfo",
  119. "user",
  120. "password",
  121. "host",
  122. "port",
  123. "relative",
  124. "path",
  125. "directory",
  126. "file",
  127. "query",
  128. "anchor",
  129. ];
  130. t.exports = function (t) {
  131. var e = t,
  132. o = t.indexOf("["),
  133. i = t.indexOf("]");
  134. o != -1 &&
  135. i != -1 &&
  136. (t =
  137. t.substring(0, o) +
  138. t.substring(o, i).replace(/:/g, ";") +
  139. t.substring(i, t.length));
  140. for (var s = n.exec(t || ""), a = {}, c = 14; c--; )
  141. a[r[c]] = s[c] || "";
  142. return (
  143. o != -1 &&
  144. i != -1 &&
  145. ((a.source = e),
  146. (a.host = a.host
  147. .substring(1, a.host.length - 1)
  148. .replace(/;/g, ":")),
  149. (a.authority = a.authority
  150. .replace("[", "")
  151. .replace("]", "")
  152. .replace(/;/g, ":")),
  153. (a.ipv6uri = !0)),
  154. a
  155. );
  156. };
  157. },
  158. function (t, e, n) {
  159. (function (r) {
  160. function o() {
  161. return (
  162. !(
  163. "undefined" == typeof window ||
  164. !window.process ||
  165. "renderer" !== window.process.type
  166. ) ||
  167. ("undefined" != typeof document &&
  168. document.documentElement &&
  169. document.documentElement.style &&
  170. document.documentElement.style.WebkitAppearance) ||
  171. ("undefined" != typeof window &&
  172. window.console &&
  173. (window.console.firebug ||
  174. (window.console.exception && window.console.table))) ||
  175. ("undefined" != typeof navigator &&
  176. navigator.userAgent &&
  177. navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) &&
  178. parseInt(RegExp.$1, 10) >= 31) ||
  179. ("undefined" != typeof navigator &&
  180. navigator.userAgent &&
  181. navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))
  182. );
  183. }
  184. function i(t) {
  185. var n = this.useColors;
  186. if (
  187. ((t[0] =
  188. (n ? "%c" : "") +
  189. this.namespace +
  190. (n ? " %c" : " ") +
  191. t[0] +
  192. (n ? "%c " : " ") +
  193. "+" +
  194. e.humanize(this.diff)),
  195. n)
  196. ) {
  197. var r = "color: " + this.color;
  198. t.splice(1, 0, r, "color: inherit");
  199. var o = 0,
  200. i = 0;
  201. t[0].replace(/%[a-zA-Z%]/g, function (t) {
  202. "%%" !== t && (o++, "%c" === t && (i = o));
  203. }),
  204. t.splice(i, 0, r);
  205. }
  206. }
  207. function s() {
  208. return (
  209. "object" == typeof console &&
  210. console.log &&
  211. Function.prototype.apply.call(console.log, console, arguments)
  212. );
  213. }
  214. function a(t) {
  215. try {
  216. null == t ? e.storage.removeItem("debug") : (e.storage.debug = t);
  217. } catch (n) {}
  218. }
  219. function c() {
  220. var t;
  221. try {
  222. t = e.storage.debug;
  223. } catch (n) {}
  224. return (
  225. !t && "undefined" != typeof r && "env" in r && (t = r.env.DEBUG), t
  226. );
  227. }
  228. function p() {
  229. try {
  230. return window.localStorage;
  231. } catch (t) {}
  232. }
  233. (e = t.exports = n(5)),
  234. (e.log = s),
  235. (e.formatArgs = i),
  236. (e.save = a),
  237. (e.load = c),
  238. (e.useColors = o),
  239. (e.storage =
  240. "undefined" != typeof chrome && "undefined" != typeof chrome.storage
  241. ? chrome.storage.local
  242. : p()),
  243. (e.colors = [
  244. "lightseagreen",
  245. "forestgreen",
  246. "goldenrod",
  247. "dodgerblue",
  248. "darkorchid",
  249. "crimson",
  250. ]),
  251. (e.formatters.j = function (t) {
  252. try {
  253. return JSON.stringify(t);
  254. } catch (e) {
  255. return "[UnexpectedJSONParseError]: " + e.message;
  256. }
  257. }),
  258. e.enable(c());
  259. }).call(e, n(4));
  260. },
  261. function (t, e) {
  262. function n() {
  263. throw new Error("setTimeout has not been defined");
  264. }
  265. function r() {
  266. throw new Error("clearTimeout has not been defined");
  267. }
  268. function o(t) {
  269. if (u === setTimeout) return setTimeout(t, 0);
  270. if ((u === n || !u) && setTimeout)
  271. return (u = setTimeout), setTimeout(t, 0);
  272. try {
  273. return u(t, 0);
  274. } catch (e) {
  275. try {
  276. return u.call(null, t, 0);
  277. } catch (e) {
  278. return u.call(this, t, 0);
  279. }
  280. }
  281. }
  282. function i(t) {
  283. if (h === clearTimeout) return clearTimeout(t);
  284. if ((h === r || !h) && clearTimeout)
  285. return (h = clearTimeout), clearTimeout(t);
  286. try {
  287. return h(t);
  288. } catch (e) {
  289. try {
  290. return h.call(null, t);
  291. } catch (e) {
  292. return h.call(this, t);
  293. }
  294. }
  295. }
  296. function s() {
  297. y &&
  298. l &&
  299. ((y = !1), l.length ? (d = l.concat(d)) : (m = -1), d.length && a());
  300. }
  301. function a() {
  302. if (!y) {
  303. var t = o(s);
  304. y = !0;
  305. for (var e = d.length; e; ) {
  306. for (l = d, d = []; ++m < e; ) l && l[m].run();
  307. (m = -1), (e = d.length);
  308. }
  309. (l = null), (y = !1), i(t);
  310. }
  311. }
  312. function c(t, e) {
  313. (this.fun = t), (this.array = e);
  314. }
  315. function p() {}
  316. var u,
  317. h,
  318. f = (t.exports = {});
  319. !(function () {
  320. try {
  321. u = "function" == typeof setTimeout ? setTimeout : n;
  322. } catch (t) {
  323. u = n;
  324. }
  325. try {
  326. h = "function" == typeof clearTimeout ? clearTimeout : r;
  327. } catch (t) {
  328. h = r;
  329. }
  330. })();
  331. var l,
  332. d = [],
  333. y = !1,
  334. m = -1;
  335. (f.nextTick = function (t) {
  336. var e = new Array(arguments.length - 1);
  337. if (arguments.length > 1)
  338. for (var n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
  339. d.push(new c(t, e)), 1 !== d.length || y || o(a);
  340. }),
  341. (c.prototype.run = function () {
  342. this.fun.apply(null, this.array);
  343. }),
  344. (f.title = "browser"),
  345. (f.browser = !0),
  346. (f.env = {}),
  347. (f.argv = []),
  348. (f.version = ""),
  349. (f.versions = {}),
  350. (f.on = p),
  351. (f.addListener = p),
  352. (f.once = p),
  353. (f.off = p),
  354. (f.removeListener = p),
  355. (f.removeAllListeners = p),
  356. (f.emit = p),
  357. (f.prependListener = p),
  358. (f.prependOnceListener = p),
  359. (f.listeners = function (t) {
  360. return [];
  361. }),
  362. (f.binding = function (t) {
  363. throw new Error("process.binding is not supported");
  364. }),
  365. (f.cwd = function () {
  366. return "/";
  367. }),
  368. (f.chdir = function (t) {
  369. throw new Error("process.chdir is not supported");
  370. }),
  371. (f.umask = function () {
  372. return 0;
  373. });
  374. },
  375. function (t, e, n) {
  376. function r(t) {
  377. var n,
  378. r = 0;
  379. for (n in t) (r = (r << 5) - r + t.charCodeAt(n)), (r |= 0);
  380. return e.colors[Math.abs(r) % e.colors.length];
  381. }
  382. function o(t) {
  383. function n() {
  384. if (n.enabled) {
  385. var t = n,
  386. r = +new Date(),
  387. o = r - (p || r);
  388. (t.diff = o), (t.prev = p), (t.curr = r), (p = r);
  389. for (var i = new Array(arguments.length), s = 0; s < i.length; s++)
  390. i[s] = arguments[s];
  391. (i[0] = e.coerce(i[0])), "string" != typeof i[0] && i.unshift("%O");
  392. var a = 0;
  393. (i[0] = i[0].replace(/%([a-zA-Z%])/g, function (n, r) {
  394. if ("%%" === n) return n;
  395. a++;
  396. var o = e.formatters[r];
  397. if ("function" == typeof o) {
  398. var s = i[a];
  399. (n = o.call(t, s)), i.splice(a, 1), a--;
  400. }
  401. return n;
  402. })),
  403. e.formatArgs.call(t, i);
  404. var c = n.log || e.log || console.log.bind(console);
  405. c.apply(t, i);
  406. }
  407. }
  408. return (
  409. (n.namespace = t),
  410. (n.enabled = e.enabled(t)),
  411. (n.useColors = e.useColors()),
  412. (n.color = r(t)),
  413. "function" == typeof e.init && e.init(n),
  414. n
  415. );
  416. }
  417. function i(t) {
  418. e.save(t), (e.names = []), (e.skips = []);
  419. for (
  420. var n = ("string" == typeof t ? t : "").split(/[\s,]+/),
  421. r = n.length,
  422. o = 0;
  423. o < r;
  424. o++
  425. )
  426. n[o] &&
  427. ((t = n[o].replace(/\*/g, ".*?")),
  428. "-" === t[0]
  429. ? e.skips.push(new RegExp("^" + t.substr(1) + "$"))
  430. : e.names.push(new RegExp("^" + t + "$")));
  431. }
  432. function s() {
  433. e.enable("");
  434. }
  435. function a(t) {
  436. var n, r;
  437. for (n = 0, r = e.skips.length; n < r; n++)
  438. if (e.skips[n].test(t)) return !1;
  439. for (n = 0, r = e.names.length; n < r; n++)
  440. if (e.names[n].test(t)) return !0;
  441. return !1;
  442. }
  443. function c(t) {
  444. return t instanceof Error ? t.stack || t.message : t;
  445. }
  446. (e = t.exports = o.debug = o["default"] = o),
  447. (e.coerce = c),
  448. (e.disable = s),
  449. (e.enable = i),
  450. (e.enabled = a),
  451. (e.humanize = n(6)),
  452. (e.names = []),
  453. (e.skips = []),
  454. (e.formatters = {});
  455. var p;
  456. },
  457. function (t, e) {
  458. function n(t) {
  459. if (((t = String(t)), !(t.length > 100))) {
  460. var e =
  461. /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
  462. t
  463. );
  464. if (e) {
  465. var n = parseFloat(e[1]),
  466. r = (e[2] || "ms").toLowerCase();
  467. switch (r) {
  468. case "years":
  469. case "year":
  470. case "yrs":
  471. case "yr":
  472. case "y":
  473. return n * u;
  474. case "days":
  475. case "day":
  476. case "d":
  477. return n * p;
  478. case "hours":
  479. case "hour":
  480. case "hrs":
  481. case "hr":
  482. case "h":
  483. return n * c;
  484. case "minutes":
  485. case "minute":
  486. case "mins":
  487. case "min":
  488. case "m":
  489. return n * a;
  490. case "seconds":
  491. case "second":
  492. case "secs":
  493. case "sec":
  494. case "s":
  495. return n * s;
  496. case "milliseconds":
  497. case "millisecond":
  498. case "msecs":
  499. case "msec":
  500. case "ms":
  501. return n;
  502. default:
  503. return;
  504. }
  505. }
  506. }
  507. }
  508. function r(t) {
  509. return t >= p
  510. ? Math.round(t / p) + "d"
  511. : t >= c
  512. ? Math.round(t / c) + "h"
  513. : t >= a
  514. ? Math.round(t / a) + "m"
  515. : t >= s
  516. ? Math.round(t / s) + "s"
  517. : t + "ms";
  518. }
  519. function o(t) {
  520. return (
  521. i(t, p, "day") ||
  522. i(t, c, "hour") ||
  523. i(t, a, "minute") ||
  524. i(t, s, "second") ||
  525. t + " ms"
  526. );
  527. }
  528. function i(t, e, n) {
  529. if (!(t < e))
  530. return t < 1.5 * e
  531. ? Math.floor(t / e) + " " + n
  532. : Math.ceil(t / e) + " " + n + "s";
  533. }
  534. var s = 1e3,
  535. a = 60 * s,
  536. c = 60 * a,
  537. p = 24 * c,
  538. u = 365.25 * p;
  539. t.exports = function (t, e) {
  540. e = e || {};
  541. var i = typeof t;
  542. if ("string" === i && t.length > 0) return n(t);
  543. if ("number" === i && isNaN(t) === !1) return e["long"] ? o(t) : r(t);
  544. throw new Error(
  545. "val is not a non-empty string or a valid number. val=" +
  546. JSON.stringify(t)
  547. );
  548. };
  549. },
  550. function (t, e, n) {
  551. function r() {}
  552. function o(t) {
  553. var n = "" + t.type;
  554. return (
  555. (e.BINARY_EVENT !== t.type && e.BINARY_ACK !== t.type) ||
  556. (n += t.attachments + "-"),
  557. t.nsp && "/" !== t.nsp && (n += t.nsp + ","),
  558. null != t.id && (n += t.id),
  559. null != t.data && (n += JSON.stringify(t.data)),
  560. h("encoded %j as %s", t, n),
  561. n
  562. );
  563. }
  564. function i(t, e) {
  565. function n(t) {
  566. var n = d.deconstructPacket(t),
  567. r = o(n.packet),
  568. i = n.buffers;
  569. i.unshift(r), e(i);
  570. }
  571. d.removeBlobs(t, n);
  572. }
  573. function s() {
  574. this.reconstructor = null;
  575. }
  576. function a(t) {
  577. var n = 0,
  578. r = { type: Number(t.charAt(0)) };
  579. if (null == e.types[r.type]) return u();
  580. if (e.BINARY_EVENT === r.type || e.BINARY_ACK === r.type) {
  581. for (
  582. var o = "";
  583. "-" !== t.charAt(++n) && ((o += t.charAt(n)), n != t.length);
  584. );
  585. if (o != Number(o) || "-" !== t.charAt(n))
  586. throw new Error("Illegal attachments");
  587. r.attachments = Number(o);
  588. }
  589. if ("/" === t.charAt(n + 1))
  590. for (r.nsp = ""; ++n; ) {
  591. var i = t.charAt(n);
  592. if ("," === i) break;
  593. if (((r.nsp += i), n === t.length)) break;
  594. }
  595. else r.nsp = "/";
  596. var s = t.charAt(n + 1);
  597. if ("" !== s && Number(s) == s) {
  598. for (r.id = ""; ++n; ) {
  599. var i = t.charAt(n);
  600. if (null == i || Number(i) != i) {
  601. --n;
  602. break;
  603. }
  604. if (((r.id += t.charAt(n)), n === t.length)) break;
  605. }
  606. r.id = Number(r.id);
  607. }
  608. return (
  609. t.charAt(++n) && (r = c(r, t.substr(n))),
  610. h("decoded %s as %j", t, r),
  611. r
  612. );
  613. }
  614. function c(t, e) {
  615. try {
  616. t.data = JSON.parse(e);
  617. } catch (n) {
  618. return u();
  619. }
  620. return t;
  621. }
  622. function p(t) {
  623. (this.reconPack = t), (this.buffers = []);
  624. }
  625. function u() {
  626. return { type: e.ERROR, data: "parser error" };
  627. }
  628. var h = n(3)("socket.io-parser"),
  629. f = n(8),
  630. l = n(9),
  631. d = n(11),
  632. y = n(12);
  633. (e.protocol = 4),
  634. (e.types = [
  635. "CONNECT",
  636. "DISCONNECT",
  637. "EVENT",
  638. "ACK",
  639. "ERROR",
  640. "BINARY_EVENT",
  641. "BINARY_ACK",
  642. ]),
  643. (e.CONNECT = 0),
  644. (e.DISCONNECT = 1),
  645. (e.EVENT = 2),
  646. (e.ACK = 3),
  647. (e.ERROR = 4),
  648. (e.BINARY_EVENT = 5),
  649. (e.BINARY_ACK = 6),
  650. (e.Encoder = r),
  651. (e.Decoder = s),
  652. (r.prototype.encode = function (t, n) {
  653. if (
  654. ((t.type !== e.EVENT && t.type !== e.ACK) ||
  655. !l(t.data) ||
  656. (t.type = t.type === e.EVENT ? e.BINARY_EVENT : e.BINARY_ACK),
  657. h("encoding packet %j", t),
  658. e.BINARY_EVENT === t.type || e.BINARY_ACK === t.type)
  659. )
  660. i(t, n);
  661. else {
  662. var r = o(t);
  663. n([r]);
  664. }
  665. }),
  666. f(s.prototype),
  667. (s.prototype.add = function (t) {
  668. var n;
  669. if ("string" == typeof t)
  670. (n = a(t)),
  671. e.BINARY_EVENT === n.type || e.BINARY_ACK === n.type
  672. ? ((this.reconstructor = new p(n)),
  673. 0 === this.reconstructor.reconPack.attachments &&
  674. this.emit("decoded", n))
  675. : this.emit("decoded", n);
  676. else {
  677. if (!y(t) && !t.base64) throw new Error("Unknown type: " + t);
  678. if (!this.reconstructor)
  679. throw new Error(
  680. "got binary data when not reconstructing a packet"
  681. );
  682. (n = this.reconstructor.takeBinaryData(t)),
  683. n && ((this.reconstructor = null), this.emit("decoded", n));
  684. }
  685. }),
  686. (s.prototype.destroy = function () {
  687. this.reconstructor && this.reconstructor.finishedReconstruction();
  688. }),
  689. (p.prototype.takeBinaryData = function (t) {
  690. if (
  691. (this.buffers.push(t),
  692. this.buffers.length === this.reconPack.attachments)
  693. ) {
  694. var e = d.reconstructPacket(this.reconPack, this.buffers);
  695. return this.finishedReconstruction(), e;
  696. }
  697. return null;
  698. }),
  699. (p.prototype.finishedReconstruction = function () {
  700. (this.reconPack = null), (this.buffers = []);
  701. });
  702. },
  703. function (t, e, n) {
  704. function r(t) {
  705. if (t) return o(t);
  706. }
  707. function o(t) {
  708. for (var e in r.prototype) t[e] = r.prototype[e];
  709. return t;
  710. }
  711. (t.exports = r),
  712. (r.prototype.on = r.prototype.addEventListener =
  713. function (t, e) {
  714. return (
  715. (this._callbacks = this._callbacks || {}),
  716. (this._callbacks["$" + t] = this._callbacks["$" + t] || []).push(
  717. e
  718. ),
  719. this
  720. );
  721. }),
  722. (r.prototype.once = function (t, e) {
  723. function n() {
  724. this.off(t, n), e.apply(this, arguments);
  725. }
  726. return (n.fn = e), this.on(t, n), this;
  727. }),
  728. (r.prototype.off =
  729. r.prototype.removeListener =
  730. r.prototype.removeAllListeners =
  731. r.prototype.removeEventListener =
  732. function (t, e) {
  733. if (
  734. ((this._callbacks = this._callbacks || {}),
  735. 0 == arguments.length)
  736. )
  737. return (this._callbacks = {}), this;
  738. var n = this._callbacks["$" + t];
  739. if (!n) return this;
  740. if (1 == arguments.length)
  741. return delete this._callbacks["$" + t], this;
  742. for (var r, o = 0; o < n.length; o++)
  743. if (((r = n[o]), r === e || r.fn === e)) {
  744. n.splice(o, 1);
  745. break;
  746. }
  747. return this;
  748. }),
  749. (r.prototype.emit = function (t) {
  750. this._callbacks = this._callbacks || {};
  751. var e = [].slice.call(arguments, 1),
  752. n = this._callbacks["$" + t];
  753. if (n) {
  754. n = n.slice(0);
  755. for (var r = 0, o = n.length; r < o; ++r) n[r].apply(this, e);
  756. }
  757. return this;
  758. }),
  759. (r.prototype.listeners = function (t) {
  760. return (
  761. (this._callbacks = this._callbacks || {}),
  762. this._callbacks["$" + t] || []
  763. );
  764. }),
  765. (r.prototype.hasListeners = function (t) {
  766. return !!this.listeners(t).length;
  767. });
  768. },
  769. function (t, e, n) {
  770. (function (e) {
  771. function r(t) {
  772. if (!t || "object" != typeof t) return !1;
  773. if (o(t)) {
  774. for (var n = 0, i = t.length; n < i; n++) if (r(t[n])) return !0;
  775. return !1;
  776. }
  777. if (
  778. ("function" == typeof e.Buffer &&
  779. e.Buffer.isBuffer &&
  780. e.Buffer.isBuffer(t)) ||
  781. ("function" == typeof e.ArrayBuffer && t instanceof ArrayBuffer) ||
  782. (s && t instanceof Blob) ||
  783. (a && t instanceof File)
  784. )
  785. return !0;
  786. if (
  787. t.toJSON &&
  788. "function" == typeof t.toJSON &&
  789. 1 === arguments.length
  790. )
  791. return r(t.toJSON(), !0);
  792. for (var c in t)
  793. if (Object.prototype.hasOwnProperty.call(t, c) && r(t[c]))
  794. return !0;
  795. return !1;
  796. }
  797. var o = n(10),
  798. i = Object.prototype.toString,
  799. s =
  800. "function" == typeof e.Blob ||
  801. "[object BlobConstructor]" === i.call(e.Blob),
  802. a =
  803. "function" == typeof e.File ||
  804. "[object FileConstructor]" === i.call(e.File);
  805. t.exports = r;
  806. }).call(
  807. e,
  808. (function () {
  809. return this;
  810. })()
  811. );
  812. },
  813. function (t, e) {
  814. var n = {}.toString;
  815. t.exports =
  816. Array.isArray ||
  817. function (t) {
  818. return "[object Array]" == n.call(t);
  819. };
  820. },
  821. function (t, e, n) {
  822. (function (t) {
  823. function r(t, e) {
  824. if (!t) return t;
  825. if (s(t)) {
  826. var n = { _placeholder: !0, num: e.length };
  827. return e.push(t), n;
  828. }
  829. if (i(t)) {
  830. for (var o = new Array(t.length), a = 0; a < t.length; a++)
  831. o[a] = r(t[a], e);
  832. return o;
  833. }
  834. if ("object" == typeof t && !(t instanceof Date)) {
  835. var o = {};
  836. for (var c in t) o[c] = r(t[c], e);
  837. return o;
  838. }
  839. return t;
  840. }
  841. function o(t, e) {
  842. if (!t) return t;
  843. if (t && t._placeholder) return e[t.num];
  844. if (i(t)) for (var n = 0; n < t.length; n++) t[n] = o(t[n], e);
  845. else if ("object" == typeof t) for (var r in t) t[r] = o(t[r], e);
  846. return t;
  847. }
  848. var i = n(10),
  849. s = n(12),
  850. a = Object.prototype.toString,
  851. c =
  852. "function" == typeof t.Blob ||
  853. "[object BlobConstructor]" === a.call(t.Blob),
  854. p =
  855. "function" == typeof t.File ||
  856. "[object FileConstructor]" === a.call(t.File);
  857. (e.deconstructPacket = function (t) {
  858. var e = [],
  859. n = t.data,
  860. o = t;
  861. return (
  862. (o.data = r(n, e)),
  863. (o.attachments = e.length),
  864. { packet: o, buffers: e }
  865. );
  866. }),
  867. (e.reconstructPacket = function (t, e) {
  868. return (t.data = o(t.data, e)), (t.attachments = void 0), t;
  869. }),
  870. (e.removeBlobs = function (t, e) {
  871. function n(t, a, u) {
  872. if (!t) return t;
  873. if ((c && t instanceof Blob) || (p && t instanceof File)) {
  874. r++;
  875. var h = new FileReader();
  876. (h.onload = function () {
  877. u ? (u[a] = this.result) : (o = this.result), --r || e(o);
  878. }),
  879. h.readAsArrayBuffer(t);
  880. } else if (i(t)) for (var f = 0; f < t.length; f++) n(t[f], f, t);
  881. else if ("object" == typeof t && !s(t))
  882. for (var l in t) n(t[l], l, t);
  883. }
  884. var r = 0,
  885. o = t;
  886. n(o), r || e(o);
  887. });
  888. }).call(
  889. e,
  890. (function () {
  891. return this;
  892. })()
  893. );
  894. },
  895. function (t, e) {
  896. (function (e) {
  897. function n(t) {
  898. return (
  899. (e.Buffer && e.Buffer.isBuffer(t)) ||
  900. (e.ArrayBuffer && t instanceof ArrayBuffer)
  901. );
  902. }
  903. t.exports = n;
  904. }).call(
  905. e,
  906. (function () {
  907. return this;
  908. })()
  909. );
  910. },
  911. function (t, e, n) {
  912. "use strict";
  913. function r(t, e) {
  914. if (!(this instanceof r)) return new r(t, e);
  915. t &&
  916. "object" === ("undefined" == typeof t ? "undefined" : o(t)) &&
  917. ((e = t), (t = void 0)),
  918. (e = e || {}),
  919. (e.path = e.path || "/socket.io"),
  920. (this.nsps = {}),
  921. (this.subs = []),
  922. (this.opts = e),
  923. this.reconnection(e.reconnection !== !1),
  924. this.reconnectionAttempts(e.reconnectionAttempts || 1 / 0),
  925. this.reconnectionDelay(e.reconnectionDelay || 1e3),
  926. this.reconnectionDelayMax(e.reconnectionDelayMax || 5e3),
  927. this.randomizationFactor(e.randomizationFactor || 0.5),
  928. (this.backoff = new l({
  929. min: this.reconnectionDelay(),
  930. max: this.reconnectionDelayMax(),
  931. jitter: this.randomizationFactor(),
  932. })),
  933. this.timeout(null == e.timeout ? 2e4 : e.timeout),
  934. (this.readyState = "closed"),
  935. (this.uri = t),
  936. (this.connecting = []),
  937. (this.lastPing = null),
  938. (this.encoding = !1),
  939. (this.packetBuffer = []);
  940. var n = e.parser || c;
  941. (this.encoder = new n.Encoder()),
  942. (this.decoder = new n.Decoder()),
  943. (this.autoConnect = e.autoConnect !== !1),
  944. this.autoConnect && this.open();
  945. }
  946. var o =
  947. "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
  948. ? function (t) {
  949. return typeof t;
  950. }
  951. : function (t) {
  952. return t &&
  953. "function" == typeof Symbol &&
  954. t.constructor === Symbol &&
  955. t !== Symbol.prototype
  956. ? "symbol"
  957. : typeof t;
  958. },
  959. i = n(14),
  960. s = n(39),
  961. a = n(8),
  962. c = n(7),
  963. p = n(41),
  964. u = n(42),
  965. h = n(3)("socket.io-client:manager"),
  966. f = n(37),
  967. l = n(43),
  968. d = Object.prototype.hasOwnProperty;
  969. (t.exports = r),
  970. (r.prototype.emitAll = function () {
  971. this.emit.apply(this, arguments);
  972. for (var t in this.nsps)
  973. d.call(this.nsps, t) &&
  974. this.nsps[t].emit.apply(this.nsps[t], arguments);
  975. }),
  976. (r.prototype.updateSocketIds = function () {
  977. for (var t in this.nsps)
  978. d.call(this.nsps, t) && (this.nsps[t].id = this.generateId(t));
  979. }),
  980. (r.prototype.generateId = function (t) {
  981. return ("/" === t ? "" : t + "#") + this.engine.id;
  982. }),
  983. a(r.prototype),
  984. (r.prototype.reconnection = function (t) {
  985. return arguments.length
  986. ? ((this._reconnection = !!t), this)
  987. : this._reconnection;
  988. }),
  989. (r.prototype.reconnectionAttempts = function (t) {
  990. return arguments.length
  991. ? ((this._reconnectionAttempts = t), this)
  992. : this._reconnectionAttempts;
  993. }),
  994. (r.prototype.reconnectionDelay = function (t) {
  995. return arguments.length
  996. ? ((this._reconnectionDelay = t),
  997. this.backoff && this.backoff.setMin(t),
  998. this)
  999. : this._reconnectionDelay;
  1000. }),
  1001. (r.prototype.randomizationFactor = function (t) {
  1002. return arguments.length
  1003. ? ((this._randomizationFactor = t),
  1004. this.backoff && this.backoff.setJitter(t),
  1005. this)
  1006. : this._randomizationFactor;
  1007. }),
  1008. (r.prototype.reconnectionDelayMax = function (t) {
  1009. return arguments.length
  1010. ? ((this._reconnectionDelayMax = t),
  1011. this.backoff && this.backoff.setMax(t),
  1012. this)
  1013. : this._reconnectionDelayMax;
  1014. }),
  1015. (r.prototype.timeout = function (t) {
  1016. return arguments.length ? ((this._timeout = t), this) : this._timeout;
  1017. }),
  1018. (r.prototype.maybeReconnectOnOpen = function () {
  1019. !this.reconnecting &&
  1020. this._reconnection &&
  1021. 0 === this.backoff.attempts &&
  1022. this.reconnect();
  1023. }),
  1024. (r.prototype.open = r.prototype.connect =
  1025. function (t, e) {
  1026. if (
  1027. (h("readyState %s", this.readyState),
  1028. ~this.readyState.indexOf("open"))
  1029. )
  1030. return this;
  1031. h("opening %s", this.uri), (this.engine = i(this.uri, this.opts));
  1032. var n = this.engine,
  1033. r = this;
  1034. (this.readyState = "opening"), (this.skipReconnect = !1);
  1035. var o = p(n, "open", function () {
  1036. r.onopen(), t && t();
  1037. }),
  1038. s = p(n, "error", function (e) {
  1039. if (
  1040. (h("connect_error"),
  1041. r.cleanup(),
  1042. (r.readyState = "closed"),
  1043. r.emitAll("connect_error", e),
  1044. t)
  1045. ) {
  1046. var n = new Error("Connection error");
  1047. (n.data = e), t(n);
  1048. } else r.maybeReconnectOnOpen();
  1049. });
  1050. if (!1 !== this._timeout) {
  1051. var a = this._timeout;
  1052. h("connect attempt will timeout after %d", a);
  1053. var c = setTimeout(function () {
  1054. h("connect attempt timed out after %d", a),
  1055. o.destroy(),
  1056. n.close(),
  1057. n.emit("error", "timeout"),
  1058. r.emitAll("connect_timeout", a);
  1059. }, a);
  1060. this.subs.push({
  1061. destroy: function () {
  1062. clearTimeout(c);
  1063. },
  1064. });
  1065. }
  1066. return this.subs.push(o), this.subs.push(s), this;
  1067. }),
  1068. (r.prototype.onopen = function () {
  1069. h("open"),
  1070. this.cleanup(),
  1071. (this.readyState = "open"),
  1072. this.emit("open");
  1073. var t = this.engine;
  1074. this.subs.push(p(t, "data", u(this, "ondata"))),
  1075. this.subs.push(p(t, "ping", u(this, "onping"))),
  1076. this.subs.push(p(t, "pong", u(this, "onpong"))),
  1077. this.subs.push(p(t, "error", u(this, "onerror"))),
  1078. this.subs.push(p(t, "close", u(this, "onclose"))),
  1079. this.subs.push(p(this.decoder, "decoded", u(this, "ondecoded")));
  1080. }),
  1081. (r.prototype.onping = function () {
  1082. (this.lastPing = new Date()), this.emitAll("ping");
  1083. }),
  1084. (r.prototype.onpong = function () {
  1085. this.emitAll("pong", new Date() - this.lastPing);
  1086. }),
  1087. (r.prototype.ondata = function (t) {
  1088. this.decoder.add(t);
  1089. }),
  1090. (r.prototype.ondecoded = function (t) {
  1091. this.emit("packet", t);
  1092. }),
  1093. (r.prototype.onerror = function (t) {
  1094. h("error", t), this.emitAll("error", t);
  1095. }),
  1096. (r.prototype.socket = function (t, e) {
  1097. function n() {
  1098. ~f(o.connecting, r) || o.connecting.push(r);
  1099. }
  1100. var r = this.nsps[t];
  1101. if (!r) {
  1102. (r = new s(this, t, e)), (this.nsps[t] = r);
  1103. var o = this;
  1104. r.on("connecting", n),
  1105. r.on("connect", function () {
  1106. r.id = o.generateId(t);
  1107. }),
  1108. this.autoConnect && n();
  1109. }
  1110. return r;
  1111. }),
  1112. (r.prototype.destroy = function (t) {
  1113. var e = f(this.connecting, t);
  1114. ~e && this.connecting.splice(e, 1),
  1115. this.connecting.length || this.close();
  1116. }),
  1117. (r.prototype.packet = function (t) {
  1118. h("writing packet %j", t);
  1119. var e = this;
  1120. t.query && 0 === t.type && (t.nsp += "?" + t.query),
  1121. e.encoding
  1122. ? e.packetBuffer.push(t)
  1123. : ((e.encoding = !0),
  1124. this.encoder.encode(t, function (n) {
  1125. for (var r = 0; r < n.length; r++)
  1126. e.engine.write(n[r], t.options);
  1127. (e.encoding = !1), e.processPacketQueue();
  1128. }));
  1129. }),
  1130. (r.prototype.processPacketQueue = function () {
  1131. if (this.packetBuffer.length > 0 && !this.encoding) {
  1132. var t = this.packetBuffer.shift();
  1133. this.packet(t);
  1134. }
  1135. }),
  1136. (r.prototype.cleanup = function () {
  1137. h("cleanup");
  1138. for (var t = this.subs.length, e = 0; e < t; e++) {
  1139. var n = this.subs.shift();
  1140. n.destroy();
  1141. }
  1142. (this.packetBuffer = []),
  1143. (this.encoding = !1),
  1144. (this.lastPing = null),
  1145. this.decoder.destroy();
  1146. }),
  1147. (r.prototype.close = r.prototype.disconnect =
  1148. function () {
  1149. h("disconnect"),
  1150. (this.skipReconnect = !0),
  1151. (this.reconnecting = !1),
  1152. "opening" === this.readyState && this.cleanup(),
  1153. this.backoff.reset(),
  1154. (this.readyState = "closed"),
  1155. this.engine && this.engine.close();
  1156. }),
  1157. (r.prototype.onclose = function (t) {
  1158. h("onclose"),
  1159. this.cleanup(),
  1160. this.backoff.reset(),
  1161. (this.readyState = "closed"),
  1162. this.emit("close", t),
  1163. this._reconnection && !this.skipReconnect && this.reconnect();
  1164. }),
  1165. (r.prototype.reconnect = function () {
  1166. if (this.reconnecting || this.skipReconnect) return this;
  1167. var t = this;
  1168. if (this.backoff.attempts >= this._reconnectionAttempts)
  1169. h("reconnect failed"),
  1170. this.backoff.reset(),
  1171. this.emitAll("reconnect_failed"),
  1172. (this.reconnecting = !1);
  1173. else {
  1174. var e = this.backoff.duration();
  1175. h("will wait %dms before reconnect attempt", e),
  1176. (this.reconnecting = !0);
  1177. var n = setTimeout(function () {
  1178. t.skipReconnect ||
  1179. (h("attempting reconnect"),
  1180. t.emitAll("reconnect_attempt", t.backoff.attempts),
  1181. t.emitAll("reconnecting", t.backoff.attempts),
  1182. t.skipReconnect ||
  1183. t.open(function (e) {
  1184. e
  1185. ? (h("reconnect attempt error"),
  1186. (t.reconnecting = !1),
  1187. t.reconnect(),
  1188. t.emitAll("reconnect_error", e.data))
  1189. : (h("reconnect success"), t.onreconnect());
  1190. }));
  1191. }, e);
  1192. this.subs.push({
  1193. destroy: function () {
  1194. clearTimeout(n);
  1195. },
  1196. });
  1197. }
  1198. }),
  1199. (r.prototype.onreconnect = function () {
  1200. var t = this.backoff.attempts;
  1201. (this.reconnecting = !1),
  1202. this.backoff.reset(),
  1203. this.updateSocketIds(),
  1204. this.emitAll("reconnect", t);
  1205. });
  1206. },
  1207. function (t, e, n) {
  1208. t.exports = n(15);
  1209. },
  1210. function (t, e, n) {
  1211. (t.exports = n(16)), (t.exports.parser = n(23));
  1212. },
  1213. function (t, e, n) {
  1214. (function (e) {
  1215. function r(t, n) {
  1216. if (!(this instanceof r)) return new r(t, n);
  1217. (n = n || {}),
  1218. t && "object" == typeof t && ((n = t), (t = null)),
  1219. t
  1220. ? ((t = u(t)),
  1221. (n.hostname = t.host),
  1222. (n.secure = "https" === t.protocol || "wss" === t.protocol),
  1223. (n.port = t.port),
  1224. t.query && (n.query = t.query))
  1225. : n.host && (n.hostname = u(n.host).host),
  1226. (this.secure =
  1227. null != n.secure
  1228. ? n.secure
  1229. : e.location && "https:" === location.protocol),
  1230. n.hostname && !n.port && (n.port = this.secure ? "443" : "80"),
  1231. (this.agent = n.agent || !1),
  1232. (this.hostname =
  1233. n.hostname || (e.location ? location.hostname : "localhost")),
  1234. (this.port =
  1235. n.port ||
  1236. (e.location && location.port
  1237. ? location.port
  1238. : this.secure
  1239. ? 443
  1240. : 80)),
  1241. (this.query = n.query || {}),
  1242. "string" == typeof this.query &&
  1243. (this.query = f.decode(this.query)),
  1244. (this.upgrade = !1 !== n.upgrade),
  1245. (this.path = (n.path || "/engine.io").replace(/\/$/, "") + "/"),
  1246. (this.forceJSONP = !!n.forceJSONP),
  1247. (this.jsonp = !1 !== n.jsonp),
  1248. (this.forceBase64 = !!n.forceBase64),
  1249. (this.enablesXDR = !!n.enablesXDR),
  1250. (this.timestampParam = n.timestampParam || "t"),
  1251. (this.timestampRequests = n.timestampRequests),
  1252. (this.transports = n.transports || ["polling", "websocket"]),
  1253. (this.transportOptions = n.transportOptions || {}),
  1254. (this.readyState = ""),
  1255. (this.writeBuffer = []),
  1256. (this.prevBufferLen = 0),
  1257. (this.policyPort = n.policyPort || 843),
  1258. (this.rememberUpgrade = n.rememberUpgrade || !1),
  1259. (this.binaryType = null),
  1260. (this.onlyBinaryUpgrades = n.onlyBinaryUpgrades),
  1261. (this.perMessageDeflate =
  1262. !1 !== n.perMessageDeflate && (n.perMessageDeflate || {})),
  1263. !0 === this.perMessageDeflate && (this.perMessageDeflate = {}),
  1264. this.perMessageDeflate &&
  1265. null == this.perMessageDeflate.threshold &&
  1266. (this.perMessageDeflate.threshold = 1024),
  1267. (this.pfx = n.pfx || null),
  1268. (this.key = n.key || null),
  1269. (this.passphrase = n.passphrase || null),
  1270. (this.cert = n.cert || null),
  1271. (this.ca = n.ca || null),
  1272. (this.ciphers = n.ciphers || null),
  1273. (this.rejectUnauthorized =
  1274. void 0 === n.rejectUnauthorized || n.rejectUnauthorized),
  1275. (this.forceNode = !!n.forceNode);
  1276. var o = "object" == typeof e && e;
  1277. o.global === o &&
  1278. (n.extraHeaders &&
  1279. Object.keys(n.extraHeaders).length > 0 &&
  1280. (this.extraHeaders = n.extraHeaders),
  1281. n.localAddress && (this.localAddress = n.localAddress)),
  1282. (this.id = null),
  1283. (this.upgrades = null),
  1284. (this.pingInterval = null),
  1285. (this.pingTimeout = null),
  1286. (this.pingIntervalTimer = null),
  1287. (this.pingTimeoutTimer = null),
  1288. this.open();
  1289. }
  1290. function o(t) {
  1291. var e = {};
  1292. for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
  1293. return e;
  1294. }
  1295. var i = n(17),
  1296. s = n(8),
  1297. a = n(3)("engine.io-client:socket"),
  1298. c = n(37),
  1299. p = n(23),
  1300. u = n(2),
  1301. h = n(38),
  1302. f = n(31);
  1303. (t.exports = r),
  1304. (r.priorWebsocketSuccess = !1),
  1305. s(r.prototype),
  1306. (r.protocol = p.protocol),
  1307. (r.Socket = r),
  1308. (r.Transport = n(22)),
  1309. (r.transports = n(17)),
  1310. (r.parser = n(23)),
  1311. (r.prototype.createTransport = function (t) {
  1312. a('creating transport "%s"', t);
  1313. var e = o(this.query);
  1314. (e.EIO = p.protocol), (e.transport = t);
  1315. var n = this.transportOptions[t] || {};
  1316. this.id && (e.sid = this.id);
  1317. var r = new i[t]({
  1318. query: e,
  1319. socket: this,
  1320. agent: n.agent || this.agent,
  1321. hostname: n.hostname || this.hostname,
  1322. port: n.port || this.port,
  1323. secure: n.secure || this.secure,
  1324. path: n.path || this.path,
  1325. forceJSONP: n.forceJSONP || this.forceJSONP,
  1326. jsonp: n.jsonp || this.jsonp,
  1327. forceBase64: n.forceBase64 || this.forceBase64,
  1328. enablesXDR: n.enablesXDR || this.enablesXDR,
  1329. timestampRequests: n.timestampRequests || this.timestampRequests,
  1330. timestampParam: n.timestampParam || this.timestampParam,
  1331. policyPort: n.policyPort || this.policyPort,
  1332. pfx: n.pfx || this.pfx,
  1333. key: n.key || this.key,
  1334. passphrase: n.passphrase || this.passphrase,
  1335. cert: n.cert || this.cert,
  1336. ca: n.ca || this.ca,
  1337. ciphers: n.ciphers || this.ciphers,
  1338. rejectUnauthorized:
  1339. n.rejectUnauthorized || this.rejectUnauthorized,
  1340. perMessageDeflate: n.perMessageDeflate || this.perMessageDeflate,
  1341. extraHeaders: n.extraHeaders || this.extraHeaders,
  1342. forceNode: n.forceNode || this.forceNode,
  1343. localAddress: n.localAddress || this.localAddress,
  1344. requestTimeout: n.requestTimeout || this.requestTimeout,
  1345. protocols: n.protocols || void 0,
  1346. });
  1347. return r;
  1348. }),
  1349. (r.prototype.open = function () {
  1350. var t;
  1351. if (
  1352. this.rememberUpgrade &&
  1353. r.priorWebsocketSuccess &&
  1354. this.transports.indexOf("websocket") !== -1
  1355. )
  1356. t = "websocket";
  1357. else {
  1358. if (0 === this.transports.length) {
  1359. var e = this;
  1360. return void setTimeout(function () {
  1361. e.emit("error", "No transports available");
  1362. }, 0);
  1363. }
  1364. t = this.transports[0];
  1365. }
  1366. this.readyState = "opening";
  1367. try {
  1368. t = this.createTransport(t);
  1369. } catch (n) {
  1370. return this.transports.shift(), void this.open();
  1371. }
  1372. t.open(), this.setTransport(t);
  1373. }),
  1374. (r.prototype.setTransport = function (t) {
  1375. a("setting transport %s", t.name);
  1376. var e = this;
  1377. this.transport &&
  1378. (a("clearing existing transport %s", this.transport.name),
  1379. this.transport.removeAllListeners()),
  1380. (this.transport = t),
  1381. t
  1382. .on("drain", function () {
  1383. e.onDrain();
  1384. })
  1385. .on("packet", function (t) {
  1386. e.onPacket(t);
  1387. })
  1388. .on("error", function (t) {
  1389. e.onError(t);
  1390. })
  1391. .on("close", function () {
  1392. e.onClose("transport close");
  1393. });
  1394. }),
  1395. (r.prototype.probe = function (t) {
  1396. function e() {
  1397. if (f.onlyBinaryUpgrades) {
  1398. var e = !this.supportsBinary && f.transport.supportsBinary;
  1399. h = h || e;
  1400. }
  1401. h ||
  1402. (a('probe transport "%s" opened', t),
  1403. u.send([{ type: "ping", data: "probe" }]),
  1404. u.once("packet", function (e) {
  1405. if (!h)
  1406. if ("pong" === e.type && "probe" === e.data) {
  1407. if (
  1408. (a('probe transport "%s" pong', t),
  1409. (f.upgrading = !0),
  1410. f.emit("upgrading", u),
  1411. !u)
  1412. )
  1413. return;
  1414. (r.priorWebsocketSuccess = "websocket" === u.name),
  1415. a('pausing current transport "%s"', f.transport.name),
  1416. f.transport.pause(function () {
  1417. h ||
  1418. ("closed" !== f.readyState &&
  1419. (a(
  1420. "changing transport and sending upgrade packet"
  1421. ),
  1422. p(),
  1423. f.setTransport(u),
  1424. u.send([{ type: "upgrade" }]),
  1425. f.emit("upgrade", u),
  1426. (u = null),
  1427. (f.upgrading = !1),
  1428. f.flush()));
  1429. });
  1430. } else {
  1431. a('probe transport "%s" failed', t);
  1432. var n = new Error("probe error");
  1433. (n.transport = u.name), f.emit("upgradeError", n);
  1434. }
  1435. }));
  1436. }
  1437. function n() {
  1438. h || ((h = !0), p(), u.close(), (u = null));
  1439. }
  1440. function o(e) {
  1441. var r = new Error("probe error: " + e);
  1442. (r.transport = u.name),
  1443. n(),
  1444. a('probe transport "%s" failed because of error: %s', t, e),
  1445. f.emit("upgradeError", r);
  1446. }
  1447. function i() {
  1448. o("transport closed");
  1449. }
  1450. function s() {
  1451. o("socket closed");
  1452. }
  1453. function c(t) {
  1454. u &&
  1455. t.name !== u.name &&
  1456. (a('"%s" works - aborting "%s"', t.name, u.name), n());
  1457. }
  1458. function p() {
  1459. u.removeListener("open", e),
  1460. u.removeListener("error", o),
  1461. u.removeListener("close", i),
  1462. f.removeListener("close", s),
  1463. f.removeListener("upgrading", c);
  1464. }
  1465. a('probing transport "%s"', t);
  1466. var u = this.createTransport(t, { probe: 1 }),
  1467. h = !1,
  1468. f = this;
  1469. (r.priorWebsocketSuccess = !1),
  1470. u.once("open", e),
  1471. u.once("error", o),
  1472. u.once("close", i),
  1473. this.once("close", s),
  1474. this.once("upgrading", c),
  1475. u.open();
  1476. }),
  1477. (r.prototype.onOpen = function () {
  1478. if (
  1479. (a("socket open"),
  1480. (this.readyState = "open"),
  1481. (r.priorWebsocketSuccess = "websocket" === this.transport.name),
  1482. this.emit("open"),
  1483. this.flush(),
  1484. "open" === this.readyState &&
  1485. this.upgrade &&
  1486. this.transport.pause)
  1487. ) {
  1488. a("starting upgrade probes");
  1489. for (var t = 0, e = this.upgrades.length; t < e; t++)
  1490. this.probe(this.upgrades[t]);
  1491. }
  1492. }),
  1493. (r.prototype.onPacket = function (t) {
  1494. if (
  1495. "opening" === this.readyState ||
  1496. "open" === this.readyState ||
  1497. "closing" === this.readyState
  1498. )
  1499. switch (
  1500. (a('socket receive: type "%s", data "%s"', t.type, t.data),
  1501. this.emit("packet", t),
  1502. this.emit("heartbeat"),
  1503. t.type)
  1504. ) {
  1505. case "open":
  1506. this.onHandshake(h(t.data));
  1507. break;
  1508. case "pong":
  1509. this.setPing(), this.emit("pong");
  1510. break;
  1511. case "error":
  1512. var e = new Error("server error");
  1513. (e.code = t.data), this.onError(e);
  1514. break;
  1515. case "message":
  1516. this.emit("data", t.data), this.emit("message", t.data);
  1517. }
  1518. else
  1519. a('packet received with socket readyState "%s"', this.readyState);
  1520. }),
  1521. (r.prototype.onHandshake = function (t) {
  1522. this.emit("handshake", t),
  1523. (this.id = t.sid),
  1524. (this.transport.query.sid = t.sid),
  1525. (this.upgrades = this.filterUpgrades(t.upgrades)),
  1526. (this.pingInterval = t.pingInterval),
  1527. (this.pingTimeout = t.pingTimeout),
  1528. this.onOpen(),
  1529. "closed" !== this.readyState &&
  1530. (this.setPing(),
  1531. this.removeListener("heartbeat", this.onHeartbeat),
  1532. this.on("heartbeat", this.onHeartbeat));
  1533. }),
  1534. (r.prototype.onHeartbeat = function (t) {
  1535. clearTimeout(this.pingTimeoutTimer);
  1536. var e = this;
  1537. e.pingTimeoutTimer = setTimeout(function () {
  1538. "closed" !== e.readyState && e.onClose("ping timeout");
  1539. }, t || e.pingInterval + e.pingTimeout);
  1540. }),
  1541. (r.prototype.setPing = function () {
  1542. var t = this;
  1543. clearTimeout(t.pingIntervalTimer),
  1544. (t.pingIntervalTimer = setTimeout(function () {
  1545. a(
  1546. "writing ping packet - expecting pong within %sms",
  1547. t.pingTimeout
  1548. ),
  1549. t.ping(),
  1550. t.onHeartbeat(t.pingTimeout);
  1551. }, t.pingInterval));
  1552. }),
  1553. (r.prototype.ping = function () {
  1554. var t = this;
  1555. this.sendPacket("ping", function () {
  1556. t.emit("ping");
  1557. });
  1558. }),
  1559. (r.prototype.onDrain = function () {
  1560. this.writeBuffer.splice(0, this.prevBufferLen),
  1561. (this.prevBufferLen = 0),
  1562. 0 === this.writeBuffer.length ? this.emit("drain") : this.flush();
  1563. }),
  1564. (r.prototype.flush = function () {
  1565. "closed" !== this.readyState &&
  1566. this.transport.writable &&
  1567. !this.upgrading &&
  1568. this.writeBuffer.length &&
  1569. (a("flushing %d packets in socket", this.writeBuffer.length),
  1570. this.transport.send(this.writeBuffer),
  1571. (this.prevBufferLen = this.writeBuffer.length),
  1572. this.emit("flush"));
  1573. }),
  1574. (r.prototype.write = r.prototype.send =
  1575. function (t, e, n) {
  1576. return this.sendPacket("message", t, e, n), this;
  1577. }),
  1578. (r.prototype.sendPacket = function (t, e, n, r) {
  1579. if (
  1580. ("function" == typeof e && ((r = e), (e = void 0)),
  1581. "function" == typeof n && ((r = n), (n = null)),
  1582. "closing" !== this.readyState && "closed" !== this.readyState)
  1583. ) {
  1584. (n = n || {}), (n.compress = !1 !== n.compress);
  1585. var o = { type: t, data: e, options: n };
  1586. this.emit("packetCreate", o),
  1587. this.writeBuffer.push(o),
  1588. r && this.once("flush", r),
  1589. this.flush();
  1590. }
  1591. }),
  1592. (r.prototype.close = function () {
  1593. function t() {
  1594. r.onClose("forced close"),
  1595. a("socket closing - telling transport to close"),
  1596. r.transport.close();
  1597. }
  1598. function e() {
  1599. r.removeListener("upgrade", e),
  1600. r.removeListener("upgradeError", e),
  1601. t();
  1602. }
  1603. function n() {
  1604. r.once("upgrade", e), r.once("upgradeError", e);
  1605. }
  1606. if ("opening" === this.readyState || "open" === this.readyState) {
  1607. this.readyState = "closing";
  1608. var r = this;
  1609. this.writeBuffer.length
  1610. ? this.once("drain", function () {
  1611. this.upgrading ? n() : t();
  1612. })
  1613. : this.upgrading
  1614. ? n()
  1615. : t();
  1616. }
  1617. return this;
  1618. }),
  1619. (r.prototype.onError = function (t) {
  1620. a("socket error %j", t),
  1621. (r.priorWebsocketSuccess = !1),
  1622. this.emit("error", t),
  1623. this.onClose("transport error", t);
  1624. }),
  1625. (r.prototype.onClose = function (t, e) {
  1626. if (
  1627. "opening" === this.readyState ||
  1628. "open" === this.readyState ||
  1629. "closing" === this.readyState
  1630. ) {
  1631. a('socket close with reason: "%s"', t);
  1632. var n = this;
  1633. clearTimeout(this.pingIntervalTimer),
  1634. clearTimeout(this.pingTimeoutTimer),
  1635. this.transport.removeAllListeners("close"),
  1636. this.transport.close(),
  1637. this.transport.removeAllListeners(),
  1638. (this.readyState = "closed"),
  1639. (this.id = null),
  1640. this.emit("close", t, e),
  1641. (n.writeBuffer = []),
  1642. (n.prevBufferLen = 0);
  1643. }
  1644. }),
  1645. (r.prototype.filterUpgrades = function (t) {
  1646. for (var e = [], n = 0, r = t.length; n < r; n++)
  1647. ~c(this.transports, t[n]) && e.push(t[n]);
  1648. return e;
  1649. });
  1650. }).call(
  1651. e,
  1652. (function () {
  1653. return this;
  1654. })()
  1655. );
  1656. },
  1657. function (t, e, n) {
  1658. (function (t) {
  1659. function r(e) {
  1660. var n,
  1661. r = !1,
  1662. a = !1,
  1663. c = !1 !== e.jsonp;
  1664. if (t.location) {
  1665. var p = "https:" === location.protocol,
  1666. u = location.port;
  1667. u || (u = p ? 443 : 80),
  1668. (r = e.hostname !== location.hostname || u !== e.port),
  1669. (a = e.secure !== p);
  1670. }
  1671. if (
  1672. ((e.xdomain = r),
  1673. (e.xscheme = a),
  1674. (n = new o(e)),
  1675. "open" in n && !e.forceJSONP)
  1676. )
  1677. return new i(e);
  1678. if (!c) throw new Error("JSONP disabled");
  1679. return new s(e);
  1680. }
  1681. var o = n(18),
  1682. i = n(20),
  1683. s = n(34),
  1684. a = n(35);
  1685. (e.polling = r), (e.websocket = a);
  1686. }).call(
  1687. e,
  1688. (function () {
  1689. return this;
  1690. })()
  1691. );
  1692. },
  1693. function (t, e, n) {
  1694. (function (e) {
  1695. var r = n(19);
  1696. t.exports = function (t) {
  1697. var n = t.xdomain,
  1698. o = t.xscheme,
  1699. i = t.enablesXDR;
  1700. try {
  1701. if ("undefined" != typeof XMLHttpRequest && (!n || r))
  1702. return new XMLHttpRequest();
  1703. } catch (s) {}
  1704. try {
  1705. if ("undefined" != typeof XDomainRequest && !o && i)
  1706. return new XDomainRequest();
  1707. } catch (s) {}
  1708. if (!n)
  1709. try {
  1710. return new e[["Active"].concat("Object").join("X")](
  1711. "Microsoft.XMLHTTP"
  1712. );
  1713. } catch (s) {}
  1714. };
  1715. }).call(
  1716. e,
  1717. (function () {
  1718. return this;
  1719. })()
  1720. );
  1721. },
  1722. function (t, e) {
  1723. try {
  1724. t.exports =
  1725. "undefined" != typeof XMLHttpRequest &&
  1726. "withCredentials" in new XMLHttpRequest();
  1727. } catch (n) {
  1728. t.exports = !1;
  1729. }
  1730. },
  1731. function (t, e, n) {
  1732. (function (e) {
  1733. function r() {}
  1734. function o(t) {
  1735. if (
  1736. (c.call(this, t),
  1737. (this.requestTimeout = t.requestTimeout),
  1738. (this.extraHeaders = t.extraHeaders),
  1739. e.location)
  1740. ) {
  1741. var n = "https:" === location.protocol,
  1742. r = location.port;
  1743. r || (r = n ? 443 : 80),
  1744. (this.xd = t.hostname !== e.location.hostname || r !== t.port),
  1745. (this.xs = t.secure !== n);
  1746. }
  1747. }
  1748. function i(t) {
  1749. (this.method = t.method || "GET"),
  1750. (this.uri = t.uri),
  1751. (this.xd = !!t.xd),
  1752. (this.xs = !!t.xs),
  1753. (this.async = !1 !== t.async),
  1754. (this.data = void 0 !== t.data ? t.data : null),
  1755. (this.agent = t.agent),
  1756. (this.isBinary = t.isBinary),
  1757. (this.supportsBinary = t.supportsBinary),
  1758. (this.enablesXDR = t.enablesXDR),
  1759. (this.requestTimeout = t.requestTimeout),
  1760. (this.pfx = t.pfx),
  1761. (this.key = t.key),
  1762. (this.passphrase = t.passphrase),
  1763. (this.cert = t.cert),
  1764. (this.ca = t.ca),
  1765. (this.ciphers = t.ciphers),
  1766. (this.rejectUnauthorized = t.rejectUnauthorized),
  1767. (this.extraHeaders = t.extraHeaders),
  1768. this.create();
  1769. }
  1770. function s() {
  1771. for (var t in i.requests)
  1772. i.requests.hasOwnProperty(t) && i.requests[t].abort();
  1773. }
  1774. var a = n(18),
  1775. c = n(21),
  1776. p = n(8),
  1777. u = n(32),
  1778. h = n(3)("engine.io-client:polling-xhr");
  1779. (t.exports = o),
  1780. (t.exports.Request = i),
  1781. u(o, c),
  1782. (o.prototype.supportsBinary = !0),
  1783. (o.prototype.request = function (t) {
  1784. return (
  1785. (t = t || {}),
  1786. (t.uri = this.uri()),
  1787. (t.xd = this.xd),
  1788. (t.xs = this.xs),
  1789. (t.agent = this.agent || !1),
  1790. (t.supportsBinary = this.supportsBinary),
  1791. (t.enablesXDR = this.enablesXDR),
  1792. (t.pfx = this.pfx),
  1793. (t.key = this.key),
  1794. (t.passphrase = this.passphrase),
  1795. (t.cert = this.cert),
  1796. (t.ca = this.ca),
  1797. (t.ciphers = this.ciphers),
  1798. (t.rejectUnauthorized = this.rejectUnauthorized),
  1799. (t.requestTimeout = this.requestTimeout),
  1800. (t.extraHeaders = this.extraHeaders),
  1801. new i(t)
  1802. );
  1803. }),
  1804. (o.prototype.doWrite = function (t, e) {
  1805. var n = "string" != typeof t && void 0 !== t,
  1806. r = this.request({ method: "POST", data: t, isBinary: n }),
  1807. o = this;
  1808. r.on("success", e),
  1809. r.on("error", function (t) {
  1810. o.onError("xhr post error", t);
  1811. }),
  1812. (this.sendXhr = r);
  1813. }),
  1814. (o.prototype.doPoll = function () {
  1815. h("xhr poll");
  1816. var t = this.request(),
  1817. e = this;
  1818. t.on("data", function (t) {
  1819. e.onData(t);
  1820. }),
  1821. t.on("error", function (t) {
  1822. e.onError("xhr poll error", t);
  1823. }),
  1824. (this.pollXhr = t);
  1825. }),
  1826. p(i.prototype),
  1827. (i.prototype.create = function () {
  1828. var t = {
  1829. agent: this.agent,
  1830. xdomain: this.xd,
  1831. xscheme: this.xs,
  1832. enablesXDR: this.enablesXDR,
  1833. };
  1834. (t.pfx = this.pfx),
  1835. (t.key = this.key),
  1836. (t.passphrase = this.passphrase),
  1837. (t.cert = this.cert),
  1838. (t.ca = this.ca),
  1839. (t.ciphers = this.ciphers),
  1840. (t.rejectUnauthorized = this.rejectUnauthorized);
  1841. var n = (this.xhr = new a(t)),
  1842. r = this;
  1843. try {
  1844. h("xhr open %s: %s", this.method, this.uri),
  1845. n.open(this.method, this.uri, this.async);
  1846. try {
  1847. if (this.extraHeaders) {
  1848. n.setDisableHeaderCheck && n.setDisableHeaderCheck(!0);
  1849. for (var o in this.extraHeaders)
  1850. this.extraHeaders.hasOwnProperty(o) &&
  1851. n.setRequestHeader(o, this.extraHeaders[o]);
  1852. }
  1853. } catch (s) {}
  1854. if ("POST" === this.method)
  1855. try {
  1856. this.isBinary
  1857. ? n.setRequestHeader(
  1858. "Content-type",
  1859. "application/octet-stream"
  1860. )
  1861. : n.setRequestHeader(
  1862. "Content-type",
  1863. "text/plain;charset=UTF-8"
  1864. );
  1865. } catch (s) {}
  1866. try {
  1867. n.setRequestHeader("Accept", "*/*");
  1868. } catch (s) {}
  1869. "withCredentials" in n && (n.withCredentials = !0),
  1870. this.requestTimeout && (n.timeout = this.requestTimeout),
  1871. this.hasXDR()
  1872. ? ((n.onload = function () {
  1873. r.onLoad();
  1874. }),
  1875. (n.onerror = function () {
  1876. r.onError(n.responseText);
  1877. }))
  1878. : (n.onreadystatechange = function () {
  1879. if (2 === n.readyState) {
  1880. var t;
  1881. try {
  1882. t = n.getResponseHeader("Content-Type");
  1883. } catch (e) {}
  1884. "application/octet-stream" === t &&
  1885. (n.responseType = "arraybuffer");
  1886. }
  1887. 4 === n.readyState &&
  1888. (200 === n.status || 1223 === n.status
  1889. ? r.onLoad()
  1890. : setTimeout(function () {
  1891. r.onError(n.status);
  1892. }, 0));
  1893. }),
  1894. h("xhr data %s", this.data),
  1895. n.send(this.data);
  1896. } catch (s) {
  1897. return void setTimeout(function () {
  1898. r.onError(s);
  1899. }, 0);
  1900. }
  1901. e.document &&
  1902. ((this.index = i.requestsCount++),
  1903. (i.requests[this.index] = this));
  1904. }),
  1905. (i.prototype.onSuccess = function () {
  1906. this.emit("success"), this.cleanup();
  1907. }),
  1908. (i.prototype.onData = function (t) {
  1909. this.emit("data", t), this.onSuccess();
  1910. }),
  1911. (i.prototype.onError = function (t) {
  1912. this.emit("error", t), this.cleanup(!0);
  1913. }),
  1914. (i.prototype.cleanup = function (t) {
  1915. if ("undefined" != typeof this.xhr && null !== this.xhr) {
  1916. if (
  1917. (this.hasXDR()
  1918. ? (this.xhr.onload = this.xhr.onerror = r)
  1919. : (this.xhr.onreadystatechange = r),
  1920. t)
  1921. )
  1922. try {
  1923. this.xhr.abort();
  1924. } catch (n) {}
  1925. e.document && delete i.requests[this.index], (this.xhr = null);
  1926. }
  1927. }),
  1928. (i.prototype.onLoad = function () {
  1929. var t;
  1930. try {
  1931. var e;
  1932. try {
  1933. e = this.xhr.getResponseHeader("Content-Type");
  1934. } catch (n) {}
  1935. t =
  1936. "application/octet-stream" === e
  1937. ? this.xhr.response || this.xhr.responseText
  1938. : this.xhr.responseText;
  1939. } catch (n) {
  1940. this.onError(n);
  1941. }
  1942. null != t && this.onData(t);
  1943. }),
  1944. (i.prototype.hasXDR = function () {
  1945. return (
  1946. "undefined" != typeof e.XDomainRequest &&
  1947. !this.xs &&
  1948. this.enablesXDR
  1949. );
  1950. }),
  1951. (i.prototype.abort = function () {
  1952. this.cleanup();
  1953. }),
  1954. (i.requestsCount = 0),
  1955. (i.requests = {}),
  1956. e.document &&
  1957. (e.attachEvent
  1958. ? e.attachEvent("onunload", s)
  1959. : e.addEventListener &&
  1960. e.addEventListener("beforeunload", s, !1));
  1961. }).call(
  1962. e,
  1963. (function () {
  1964. return this;
  1965. })()
  1966. );
  1967. },
  1968. function (t, e, n) {
  1969. function r(t) {
  1970. var e = t && t.forceBase64;
  1971. (u && !e) || (this.supportsBinary = !1), o.call(this, t);
  1972. }
  1973. var o = n(22),
  1974. i = n(31),
  1975. s = n(23),
  1976. a = n(32),
  1977. c = n(33),
  1978. p = n(3)("engine.io-client:polling");
  1979. t.exports = r;
  1980. var u = (function () {
  1981. var t = n(18),
  1982. e = new t({ xdomain: !1 });
  1983. return null != e.responseType;
  1984. })();
  1985. a(r, o),
  1986. (r.prototype.name = "polling"),
  1987. (r.prototype.doOpen = function () {
  1988. this.poll();
  1989. }),
  1990. (r.prototype.pause = function (t) {
  1991. function e() {
  1992. p("paused"), (n.readyState = "paused"), t();
  1993. }
  1994. var n = this;
  1995. if (((this.readyState = "pausing"), this.polling || !this.writable)) {
  1996. var r = 0;
  1997. this.polling &&
  1998. (p("we are currently polling - waiting to pause"),
  1999. r++,
  2000. this.once("pollComplete", function () {
  2001. p("pre-pause polling complete"), --r || e();
  2002. })),
  2003. this.writable ||
  2004. (p("we are currently writing - waiting to pause"),
  2005. r++,
  2006. this.once("drain", function () {
  2007. p("pre-pause writing complete"), --r || e();
  2008. }));
  2009. } else e();
  2010. }),
  2011. (r.prototype.poll = function () {
  2012. p("polling"), (this.polling = !0), this.doPoll(), this.emit("poll");
  2013. }),
  2014. (r.prototype.onData = function (t) {
  2015. var e = this;
  2016. p("polling got data %s", t);
  2017. var n = function (t, n, r) {
  2018. return (
  2019. "opening" === e.readyState && e.onOpen(),
  2020. "close" === t.type ? (e.onClose(), !1) : void e.onPacket(t)
  2021. );
  2022. };
  2023. s.decodePayload(t, this.socket.binaryType, n),
  2024. "closed" !== this.readyState &&
  2025. ((this.polling = !1),
  2026. this.emit("pollComplete"),
  2027. "open" === this.readyState
  2028. ? this.poll()
  2029. : p('ignoring poll - transport state "%s"', this.readyState));
  2030. }),
  2031. (r.prototype.doClose = function () {
  2032. function t() {
  2033. p("writing close packet"), e.write([{ type: "close" }]);
  2034. }
  2035. var e = this;
  2036. "open" === this.readyState
  2037. ? (p("transport open - closing"), t())
  2038. : (p("transport not open - deferring close"), this.once("open", t));
  2039. }),
  2040. (r.prototype.write = function (t) {
  2041. var e = this;
  2042. this.writable = !1;
  2043. var n = function () {
  2044. (e.writable = !0), e.emit("drain");
  2045. };
  2046. s.encodePayload(t, this.supportsBinary, function (t) {
  2047. e.doWrite(t, n);
  2048. });
  2049. }),
  2050. (r.prototype.uri = function () {
  2051. var t = this.query || {},
  2052. e = this.secure ? "https" : "http",
  2053. n = "";
  2054. !1 !== this.timestampRequests && (t[this.timestampParam] = c()),
  2055. this.supportsBinary || t.sid || (t.b64 = 1),
  2056. (t = i.encode(t)),
  2057. this.port &&
  2058. (("https" === e && 443 !== Number(this.port)) ||
  2059. ("http" === e && 80 !== Number(this.port))) &&
  2060. (n = ":" + this.port),
  2061. t.length && (t = "?" + t);
  2062. var r = this.hostname.indexOf(":") !== -1;
  2063. return (
  2064. e +
  2065. "://" +
  2066. (r ? "[" + this.hostname + "]" : this.hostname) +
  2067. n +
  2068. this.path +
  2069. t
  2070. );
  2071. });
  2072. },
  2073. function (t, e, n) {
  2074. function r(t) {
  2075. (this.path = t.path),
  2076. (this.hostname = t.hostname),
  2077. (this.port = t.port),
  2078. (this.secure = t.secure),
  2079. (this.query = t.query),
  2080. (this.timestampParam = t.timestampParam),
  2081. (this.timestampRequests = t.timestampRequests),
  2082. (this.readyState = ""),
  2083. (this.agent = t.agent || !1),
  2084. (this.socket = t.socket),
  2085. (this.enablesXDR = t.enablesXDR),
  2086. (this.pfx = t.pfx),
  2087. (this.key = t.key),
  2088. (this.passphrase = t.passphrase),
  2089. (this.cert = t.cert),
  2090. (this.ca = t.ca),
  2091. (this.ciphers = t.ciphers),
  2092. (this.rejectUnauthorized = t.rejectUnauthorized),
  2093. (this.forceNode = t.forceNode),
  2094. (this.extraHeaders = t.extraHeaders),
  2095. (this.localAddress = t.localAddress);
  2096. }
  2097. var o = n(23),
  2098. i = n(8);
  2099. (t.exports = r),
  2100. i(r.prototype),
  2101. (r.prototype.onError = function (t, e) {
  2102. var n = new Error(t);
  2103. return (
  2104. (n.type = "TransportError"),
  2105. (n.description = e),
  2106. this.emit("error", n),
  2107. this
  2108. );
  2109. }),
  2110. (r.prototype.open = function () {
  2111. return (
  2112. ("closed" !== this.readyState && "" !== this.readyState) ||
  2113. ((this.readyState = "opening"), this.doOpen()),
  2114. this
  2115. );
  2116. }),
  2117. (r.prototype.close = function () {
  2118. return (
  2119. ("opening" !== this.readyState && "open" !== this.readyState) ||
  2120. (this.doClose(), this.onClose()),
  2121. this
  2122. );
  2123. }),
  2124. (r.prototype.send = function (t) {
  2125. if ("open" !== this.readyState) throw new Error("Transport not open");
  2126. this.write(t);
  2127. }),
  2128. (r.prototype.onOpen = function () {
  2129. (this.readyState = "open"), (this.writable = !0), this.emit("open");
  2130. }),
  2131. (r.prototype.onData = function (t) {
  2132. var e = o.decodePacket(t, this.socket.binaryType);
  2133. this.onPacket(e);
  2134. }),
  2135. (r.prototype.onPacket = function (t) {
  2136. this.emit("packet", t);
  2137. }),
  2138. (r.prototype.onClose = function () {
  2139. (this.readyState = "closed"), this.emit("close");
  2140. });
  2141. },
  2142. function (t, e, n) {
  2143. (function (t) {
  2144. function r(t, n) {
  2145. var r = "b" + e.packets[t.type] + t.data.data;
  2146. return n(r);
  2147. }
  2148. function o(t, n, r) {
  2149. if (!n) return e.encodeBase64Packet(t, r);
  2150. var o = t.data,
  2151. i = new Uint8Array(o),
  2152. s = new Uint8Array(1 + o.byteLength);
  2153. s[0] = v[t.type];
  2154. for (var a = 0; a < i.length; a++) s[a + 1] = i[a];
  2155. return r(s.buffer);
  2156. }
  2157. function i(t, n, r) {
  2158. if (!n) return e.encodeBase64Packet(t, r);
  2159. var o = new FileReader();
  2160. return (
  2161. (o.onload = function () {
  2162. (t.data = o.result), e.encodePacket(t, n, !0, r);
  2163. }),
  2164. o.readAsArrayBuffer(t.data)
  2165. );
  2166. }
  2167. function s(t, n, r) {
  2168. if (!n) return e.encodeBase64Packet(t, r);
  2169. if (g) return i(t, n, r);
  2170. var o = new Uint8Array(1);
  2171. o[0] = v[t.type];
  2172. var s = new k([o.buffer, t.data]);
  2173. return r(s);
  2174. }
  2175. function a(t) {
  2176. try {
  2177. t = d.decode(t, { strict: !1 });
  2178. } catch (e) {
  2179. return !1;
  2180. }
  2181. return t;
  2182. }
  2183. function c(t, e, n) {
  2184. for (
  2185. var r = new Array(t.length),
  2186. o = l(t.length, n),
  2187. i = function (t, n, o) {
  2188. e(n, function (e, n) {
  2189. (r[t] = n), o(e, r);
  2190. });
  2191. },
  2192. s = 0;
  2193. s < t.length;
  2194. s++
  2195. )
  2196. i(s, t[s], o);
  2197. }
  2198. var p,
  2199. u = n(24),
  2200. h = n(9),
  2201. f = n(25),
  2202. l = n(26),
  2203. d = n(27);
  2204. t && t.ArrayBuffer && (p = n(29));
  2205. var y =
  2206. "undefined" != typeof navigator &&
  2207. /Android/i.test(navigator.userAgent),
  2208. m =
  2209. "undefined" != typeof navigator &&
  2210. /PhantomJS/i.test(navigator.userAgent),
  2211. g = y || m;
  2212. e.protocol = 3;
  2213. var v = (e.packets = {
  2214. open: 0,
  2215. close: 1,
  2216. ping: 2,
  2217. pong: 3,
  2218. message: 4,
  2219. upgrade: 5,
  2220. noop: 6,
  2221. }),
  2222. b = u(v),
  2223. w = { type: "error", data: "parser error" },
  2224. k = n(30);
  2225. (e.encodePacket = function (e, n, i, a) {
  2226. "function" == typeof n && ((a = n), (n = !1)),
  2227. "function" == typeof i && ((a = i), (i = null));
  2228. var c = void 0 === e.data ? void 0 : e.data.buffer || e.data;
  2229. if (t.ArrayBuffer && c instanceof ArrayBuffer) return o(e, n, a);
  2230. if (k && c instanceof t.Blob) return s(e, n, a);
  2231. if (c && c.base64) return r(e, a);
  2232. var p = v[e.type];
  2233. return (
  2234. void 0 !== e.data &&
  2235. (p += i
  2236. ? d.encode(String(e.data), { strict: !1 })
  2237. : String(e.data)),
  2238. a("" + p)
  2239. );
  2240. }),
  2241. (e.encodeBase64Packet = function (n, r) {
  2242. var o = "b" + e.packets[n.type];
  2243. if (k && n.data instanceof t.Blob) {
  2244. var i = new FileReader();
  2245. return (
  2246. (i.onload = function () {
  2247. var t = i.result.split(",")[1];
  2248. r(o + t);
  2249. }),
  2250. i.readAsDataURL(n.data)
  2251. );
  2252. }
  2253. var s;
  2254. try {
  2255. s = String.fromCharCode.apply(null, new Uint8Array(n.data));
  2256. } catch (a) {
  2257. for (
  2258. var c = new Uint8Array(n.data), p = new Array(c.length), u = 0;
  2259. u < c.length;
  2260. u++
  2261. )
  2262. p[u] = c[u];
  2263. s = String.fromCharCode.apply(null, p);
  2264. }
  2265. return (o += t.btoa(s)), r(o);
  2266. }),
  2267. (e.decodePacket = function (t, n, r) {
  2268. if (void 0 === t) return w;
  2269. if ("string" == typeof t) {
  2270. if ("b" === t.charAt(0))
  2271. return e.decodeBase64Packet(t.substr(1), n);
  2272. if (r && ((t = a(t)), t === !1)) return w;
  2273. var o = t.charAt(0);
  2274. return Number(o) == o && b[o]
  2275. ? t.length > 1
  2276. ? { type: b[o], data: t.substring(1) }
  2277. : { type: b[o] }
  2278. : w;
  2279. }
  2280. var i = new Uint8Array(t),
  2281. o = i[0],
  2282. s = f(t, 1);
  2283. return (
  2284. k && "blob" === n && (s = new k([s])), { type: b[o], data: s }
  2285. );
  2286. }),
  2287. (e.decodeBase64Packet = function (t, e) {
  2288. var n = b[t.charAt(0)];
  2289. if (!p) return { type: n, data: { base64: !0, data: t.substr(1) } };
  2290. var r = p.decode(t.substr(1));
  2291. return "blob" === e && k && (r = new k([r])), { type: n, data: r };
  2292. }),
  2293. (e.encodePayload = function (t, n, r) {
  2294. function o(t) {
  2295. return t.length + ":" + t;
  2296. }
  2297. function i(t, r) {
  2298. e.encodePacket(t, !!s && n, !1, function (t) {
  2299. r(null, o(t));
  2300. });
  2301. }
  2302. "function" == typeof n && ((r = n), (n = null));
  2303. var s = h(t);
  2304. return n && s
  2305. ? k && !g
  2306. ? e.encodePayloadAsBlob(t, r)
  2307. : e.encodePayloadAsArrayBuffer(t, r)
  2308. : t.length
  2309. ? void c(t, i, function (t, e) {
  2310. return r(e.join(""));
  2311. })
  2312. : r("0:");
  2313. }),
  2314. (e.decodePayload = function (t, n, r) {
  2315. if ("string" != typeof t) return e.decodePayloadAsBinary(t, n, r);
  2316. "function" == typeof n && ((r = n), (n = null));
  2317. var o;
  2318. if ("" === t) return r(w, 0, 1);
  2319. for (var i, s, a = "", c = 0, p = t.length; c < p; c++) {
  2320. var u = t.charAt(c);
  2321. if (":" === u) {
  2322. if ("" === a || a != (i = Number(a))) return r(w, 0, 1);
  2323. if (((s = t.substr(c + 1, i)), a != s.length))
  2324. return r(w, 0, 1);
  2325. if (s.length) {
  2326. if (
  2327. ((o = e.decodePacket(s, n, !1)),
  2328. w.type === o.type && w.data === o.data)
  2329. )
  2330. return r(w, 0, 1);
  2331. var h = r(o, c + i, p);
  2332. if (!1 === h) return;
  2333. }
  2334. (c += i), (a = "");
  2335. } else a += u;
  2336. }
  2337. return "" !== a ? r(w, 0, 1) : void 0;
  2338. }),
  2339. (e.encodePayloadAsArrayBuffer = function (t, n) {
  2340. function r(t, n) {
  2341. e.encodePacket(t, !0, !0, function (t) {
  2342. return n(null, t);
  2343. });
  2344. }
  2345. return t.length
  2346. ? void c(t, r, function (t, e) {
  2347. var r = e.reduce(function (t, e) {
  2348. var n;
  2349. return (
  2350. (n = "string" == typeof e ? e.length : e.byteLength),
  2351. t + n.toString().length + n + 2
  2352. );
  2353. }, 0),
  2354. o = new Uint8Array(r),
  2355. i = 0;
  2356. return (
  2357. e.forEach(function (t) {
  2358. var e = "string" == typeof t,
  2359. n = t;
  2360. if (e) {
  2361. for (
  2362. var r = new Uint8Array(t.length), s = 0;
  2363. s < t.length;
  2364. s++
  2365. )
  2366. r[s] = t.charCodeAt(s);
  2367. n = r.buffer;
  2368. }
  2369. e ? (o[i++] = 0) : (o[i++] = 1);
  2370. for (
  2371. var a = n.byteLength.toString(), s = 0;
  2372. s < a.length;
  2373. s++
  2374. )
  2375. o[i++] = parseInt(a[s]);
  2376. o[i++] = 255;
  2377. for (var r = new Uint8Array(n), s = 0; s < r.length; s++)
  2378. o[i++] = r[s];
  2379. }),
  2380. n(o.buffer)
  2381. );
  2382. })
  2383. : n(new ArrayBuffer(0));
  2384. }),
  2385. (e.encodePayloadAsBlob = function (t, n) {
  2386. function r(t, n) {
  2387. e.encodePacket(t, !0, !0, function (t) {
  2388. var e = new Uint8Array(1);
  2389. if (((e[0] = 1), "string" == typeof t)) {
  2390. for (
  2391. var r = new Uint8Array(t.length), o = 0;
  2392. o < t.length;
  2393. o++
  2394. )
  2395. r[o] = t.charCodeAt(o);
  2396. (t = r.buffer), (e[0] = 0);
  2397. }
  2398. for (
  2399. var i = t instanceof ArrayBuffer ? t.byteLength : t.size,
  2400. s = i.toString(),
  2401. a = new Uint8Array(s.length + 1),
  2402. o = 0;
  2403. o < s.length;
  2404. o++
  2405. )
  2406. a[o] = parseInt(s[o]);
  2407. if (((a[s.length] = 255), k)) {
  2408. var c = new k([e.buffer, a.buffer, t]);
  2409. n(null, c);
  2410. }
  2411. });
  2412. }
  2413. c(t, r, function (t, e) {
  2414. return n(new k(e));
  2415. });
  2416. }),
  2417. (e.decodePayloadAsBinary = function (t, n, r) {
  2418. "function" == typeof n && ((r = n), (n = null));
  2419. for (var o = t, i = []; o.byteLength > 0; ) {
  2420. for (
  2421. var s = new Uint8Array(o), a = 0 === s[0], c = "", p = 1;
  2422. 255 !== s[p];
  2423. p++
  2424. ) {
  2425. if (c.length > 310) return r(w, 0, 1);
  2426. c += s[p];
  2427. }
  2428. (o = f(o, 2 + c.length)), (c = parseInt(c));
  2429. var u = f(o, 0, c);
  2430. if (a)
  2431. try {
  2432. u = String.fromCharCode.apply(null, new Uint8Array(u));
  2433. } catch (h) {
  2434. var l = new Uint8Array(u);
  2435. u = "";
  2436. for (var p = 0; p < l.length; p++)
  2437. u += String.fromCharCode(l[p]);
  2438. }
  2439. i.push(u), (o = f(o, c));
  2440. }
  2441. var d = i.length;
  2442. i.forEach(function (t, o) {
  2443. r(e.decodePacket(t, n, !0), o, d);
  2444. });
  2445. });
  2446. }).call(
  2447. e,
  2448. (function () {
  2449. return this;
  2450. })()
  2451. );
  2452. },
  2453. function (t, e) {
  2454. t.exports =
  2455. Object.keys ||
  2456. function (t) {
  2457. var e = [],
  2458. n = Object.prototype.hasOwnProperty;
  2459. for (var r in t) n.call(t, r) && e.push(r);
  2460. return e;
  2461. };
  2462. },
  2463. function (t, e) {
  2464. t.exports = function (t, e, n) {
  2465. var r = t.byteLength;
  2466. if (((e = e || 0), (n = n || r), t.slice)) return t.slice(e, n);
  2467. if (
  2468. (e < 0 && (e += r),
  2469. n < 0 && (n += r),
  2470. n > r && (n = r),
  2471. e >= r || e >= n || 0 === r)
  2472. )
  2473. return new ArrayBuffer(0);
  2474. for (
  2475. var o = new Uint8Array(t), i = new Uint8Array(n - e), s = e, a = 0;
  2476. s < n;
  2477. s++, a++
  2478. )
  2479. i[a] = o[s];
  2480. return i.buffer;
  2481. };
  2482. },
  2483. function (t, e) {
  2484. function n(t, e, n) {
  2485. function o(t, r) {
  2486. if (o.count <= 0) throw new Error("after called too many times");
  2487. --o.count,
  2488. t ? ((i = !0), e(t), (e = n)) : 0 !== o.count || i || e(null, r);
  2489. }
  2490. var i = !1;
  2491. return (n = n || r), (o.count = t), 0 === t ? e() : o;
  2492. }
  2493. function r() {}
  2494. t.exports = n;
  2495. },
  2496. function (t, e, n) {
  2497. var r;
  2498. (function (t, o) {
  2499. !(function (i) {
  2500. function s(t) {
  2501. for (var e, n, r = [], o = 0, i = t.length; o < i; )
  2502. (e = t.charCodeAt(o++)),
  2503. e >= 55296 && e <= 56319 && o < i
  2504. ? ((n = t.charCodeAt(o++)),
  2505. 56320 == (64512 & n)
  2506. ? r.push(((1023 & e) << 10) + (1023 & n) + 65536)
  2507. : (r.push(e), o--))
  2508. : r.push(e);
  2509. return r;
  2510. }
  2511. function a(t) {
  2512. for (var e, n = t.length, r = -1, o = ""; ++r < n; )
  2513. (e = t[r]),
  2514. e > 65535 &&
  2515. ((e -= 65536),
  2516. (o += w(((e >>> 10) & 1023) | 55296)),
  2517. (e = 56320 | (1023 & e))),
  2518. (o += w(e));
  2519. return o;
  2520. }
  2521. function c(t, e) {
  2522. if (t >= 55296 && t <= 57343) {
  2523. if (e)
  2524. throw Error(
  2525. "Lone surrogate U+" +
  2526. t.toString(16).toUpperCase() +
  2527. " is not a scalar value"
  2528. );
  2529. return !1;
  2530. }
  2531. return !0;
  2532. }
  2533. function p(t, e) {
  2534. return w(((t >> e) & 63) | 128);
  2535. }
  2536. function u(t, e) {
  2537. if (0 == (4294967168 & t)) return w(t);
  2538. var n = "";
  2539. return (
  2540. 0 == (4294965248 & t)
  2541. ? (n = w(((t >> 6) & 31) | 192))
  2542. : 0 == (4294901760 & t)
  2543. ? (c(t, e) || (t = 65533),
  2544. (n = w(((t >> 12) & 15) | 224)),
  2545. (n += p(t, 6)))
  2546. : 0 == (4292870144 & t) &&
  2547. ((n = w(((t >> 18) & 7) | 240)),
  2548. (n += p(t, 12)),
  2549. (n += p(t, 6))),
  2550. (n += w((63 & t) | 128))
  2551. );
  2552. }
  2553. function h(t, e) {
  2554. e = e || {};
  2555. for (
  2556. var n,
  2557. r = !1 !== e.strict,
  2558. o = s(t),
  2559. i = o.length,
  2560. a = -1,
  2561. c = "";
  2562. ++a < i;
  2563. )
  2564. (n = o[a]), (c += u(n, r));
  2565. return c;
  2566. }
  2567. function f() {
  2568. if (b >= v) throw Error("Invalid byte index");
  2569. var t = 255 & g[b];
  2570. if ((b++, 128 == (192 & t))) return 63 & t;
  2571. throw Error("Invalid continuation byte");
  2572. }
  2573. function l(t) {
  2574. var e, n, r, o, i;
  2575. if (b > v) throw Error("Invalid byte index");
  2576. if (b == v) return !1;
  2577. if (((e = 255 & g[b]), b++, 0 == (128 & e))) return e;
  2578. if (192 == (224 & e)) {
  2579. if (((n = f()), (i = ((31 & e) << 6) | n), i >= 128)) return i;
  2580. throw Error("Invalid continuation byte");
  2581. }
  2582. if (224 == (240 & e)) {
  2583. if (
  2584. ((n = f()),
  2585. (r = f()),
  2586. (i = ((15 & e) << 12) | (n << 6) | r),
  2587. i >= 2048)
  2588. )
  2589. return c(i, t) ? i : 65533;
  2590. throw Error("Invalid continuation byte");
  2591. }
  2592. if (
  2593. 240 == (248 & e) &&
  2594. ((n = f()),
  2595. (r = f()),
  2596. (o = f()),
  2597. (i = ((7 & e) << 18) | (n << 12) | (r << 6) | o),
  2598. i >= 65536 && i <= 1114111)
  2599. )
  2600. return i;
  2601. throw Error("Invalid UTF-8 detected");
  2602. }
  2603. function d(t, e) {
  2604. e = e || {};
  2605. var n = !1 !== e.strict;
  2606. (g = s(t)), (v = g.length), (b = 0);
  2607. for (var r, o = []; (r = l(n)) !== !1; ) o.push(r);
  2608. return a(o);
  2609. }
  2610. var y = "object" == typeof e && e,
  2611. m =
  2612. ("object" == typeof t && t && t.exports == y && t,
  2613. "object" == typeof o && o);
  2614. (m.global !== m && m.window !== m) || (i = m);
  2615. var g,
  2616. v,
  2617. b,
  2618. w = String.fromCharCode,
  2619. k = { version: "2.1.2", encode: h, decode: d };
  2620. (r = function () {
  2621. return k;
  2622. }.call(e, n, e, t)),
  2623. !(void 0 !== r && (t.exports = r));
  2624. })(this);
  2625. }).call(
  2626. e,
  2627. n(28)(t),
  2628. (function () {
  2629. return this;
  2630. })()
  2631. );
  2632. },
  2633. function (t, e) {
  2634. t.exports = function (t) {
  2635. return (
  2636. t.webpackPolyfill ||
  2637. ((t.deprecate = function () {}),
  2638. (t.paths = []),
  2639. (t.children = []),
  2640. (t.webpackPolyfill = 1)),
  2641. t
  2642. );
  2643. };
  2644. },
  2645. function (t, e) {
  2646. !(function () {
  2647. "use strict";
  2648. for (
  2649. var t =
  2650. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
  2651. n = new Uint8Array(256),
  2652. r = 0;
  2653. r < t.length;
  2654. r++
  2655. )
  2656. n[t.charCodeAt(r)] = r;
  2657. (e.encode = function (e) {
  2658. var n,
  2659. r = new Uint8Array(e),
  2660. o = r.length,
  2661. i = "";
  2662. for (n = 0; n < o; n += 3)
  2663. (i += t[r[n] >> 2]),
  2664. (i += t[((3 & r[n]) << 4) | (r[n + 1] >> 4)]),
  2665. (i += t[((15 & r[n + 1]) << 2) | (r[n + 2] >> 6)]),
  2666. (i += t[63 & r[n + 2]]);
  2667. return (
  2668. o % 3 === 2
  2669. ? (i = i.substring(0, i.length - 1) + "=")
  2670. : o % 3 === 1 && (i = i.substring(0, i.length - 2) + "=="),
  2671. i
  2672. );
  2673. }),
  2674. (e.decode = function (t) {
  2675. var e,
  2676. r,
  2677. o,
  2678. i,
  2679. s,
  2680. a = 0.75 * t.length,
  2681. c = t.length,
  2682. p = 0;
  2683. "=" === t[t.length - 1] && (a--, "=" === t[t.length - 2] && a--);
  2684. var u = new ArrayBuffer(a),
  2685. h = new Uint8Array(u);
  2686. for (e = 0; e < c; e += 4)
  2687. (r = n[t.charCodeAt(e)]),
  2688. (o = n[t.charCodeAt(e + 1)]),
  2689. (i = n[t.charCodeAt(e + 2)]),
  2690. (s = n[t.charCodeAt(e + 3)]),
  2691. (h[p++] = (r << 2) | (o >> 4)),
  2692. (h[p++] = ((15 & o) << 4) | (i >> 2)),
  2693. (h[p++] = ((3 & i) << 6) | (63 & s));
  2694. return u;
  2695. });
  2696. })();
  2697. },
  2698. function (t, e) {
  2699. (function (e) {
  2700. function n(t) {
  2701. for (var e = 0; e < t.length; e++) {
  2702. var n = t[e];
  2703. if (n.buffer instanceof ArrayBuffer) {
  2704. var r = n.buffer;
  2705. if (n.byteLength !== r.byteLength) {
  2706. var o = new Uint8Array(n.byteLength);
  2707. o.set(new Uint8Array(r, n.byteOffset, n.byteLength)),
  2708. (r = o.buffer);
  2709. }
  2710. t[e] = r;
  2711. }
  2712. }
  2713. }
  2714. function r(t, e) {
  2715. e = e || {};
  2716. var r = new i();
  2717. n(t);
  2718. for (var o = 0; o < t.length; o++) r.append(t[o]);
  2719. return e.type ? r.getBlob(e.type) : r.getBlob();
  2720. }
  2721. function o(t, e) {
  2722. return n(t), new Blob(t, e || {});
  2723. }
  2724. var i =
  2725. e.BlobBuilder ||
  2726. e.WebKitBlobBuilder ||
  2727. e.MSBlobBuilder ||
  2728. e.MozBlobBuilder,
  2729. s = (function () {
  2730. try {
  2731. var t = new Blob(["hi"]);
  2732. return 2 === t.size;
  2733. } catch (e) {
  2734. return !1;
  2735. }
  2736. })(),
  2737. a =
  2738. s &&
  2739. (function () {
  2740. try {
  2741. var t = new Blob([new Uint8Array([1, 2])]);
  2742. return 2 === t.size;
  2743. } catch (e) {
  2744. return !1;
  2745. }
  2746. })(),
  2747. c = i && i.prototype.append && i.prototype.getBlob;
  2748. t.exports = (function () {
  2749. return s ? (a ? e.Blob : o) : c ? r : void 0;
  2750. })();
  2751. }).call(
  2752. e,
  2753. (function () {
  2754. return this;
  2755. })()
  2756. );
  2757. },
  2758. function (t, e) {
  2759. (e.encode = function (t) {
  2760. var e = "";
  2761. for (var n in t)
  2762. t.hasOwnProperty(n) &&
  2763. (e.length && (e += "&"),
  2764. (e += encodeURIComponent(n) + "=" + encodeURIComponent(t[n])));
  2765. return e;
  2766. }),
  2767. (e.decode = function (t) {
  2768. for (var e = {}, n = t.split("&"), r = 0, o = n.length; r < o; r++) {
  2769. var i = n[r].split("=");
  2770. e[decodeURIComponent(i[0])] = decodeURIComponent(i[1]);
  2771. }
  2772. return e;
  2773. });
  2774. },
  2775. function (t, e) {
  2776. t.exports = function (t, e) {
  2777. var n = function () {};
  2778. (n.prototype = e.prototype),
  2779. (t.prototype = new n()),
  2780. (t.prototype.constructor = t);
  2781. };
  2782. },
  2783. function (t, e) {
  2784. "use strict";
  2785. function n(t) {
  2786. var e = "";
  2787. do (e = s[t % a] + e), (t = Math.floor(t / a));
  2788. while (t > 0);
  2789. return e;
  2790. }
  2791. function r(t) {
  2792. var e = 0;
  2793. for (u = 0; u < t.length; u++) e = e * a + c[t.charAt(u)];
  2794. return e;
  2795. }
  2796. function o() {
  2797. var t = n(+new Date());
  2798. return t !== i ? ((p = 0), (i = t)) : t + "." + n(p++);
  2799. }
  2800. for (
  2801. var i,
  2802. s =
  2803. "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(
  2804. ""
  2805. ),
  2806. a = 64,
  2807. c = {},
  2808. p = 0,
  2809. u = 0;
  2810. u < a;
  2811. u++
  2812. )
  2813. c[s[u]] = u;
  2814. (o.encode = n), (o.decode = r), (t.exports = o);
  2815. },
  2816. function (t, e, n) {
  2817. (function (e) {
  2818. function r() {}
  2819. function o(t) {
  2820. i.call(this, t),
  2821. (this.query = this.query || {}),
  2822. a || (e.___eio || (e.___eio = []), (a = e.___eio)),
  2823. (this.index = a.length);
  2824. var n = this;
  2825. a.push(function (t) {
  2826. n.onData(t);
  2827. }),
  2828. (this.query.j = this.index),
  2829. e.document &&
  2830. e.addEventListener &&
  2831. e.addEventListener(
  2832. "beforeunload",
  2833. function () {
  2834. n.script && (n.script.onerror = r);
  2835. },
  2836. !1
  2837. );
  2838. }
  2839. var i = n(21),
  2840. s = n(32);
  2841. t.exports = o;
  2842. var a,
  2843. c = /\n/g,
  2844. p = /\\n/g;
  2845. s(o, i),
  2846. (o.prototype.supportsBinary = !1),
  2847. (o.prototype.doClose = function () {
  2848. this.script &&
  2849. (this.script.parentNode.removeChild(this.script),
  2850. (this.script = null)),
  2851. this.form &&
  2852. (this.form.parentNode.removeChild(this.form),
  2853. (this.form = null),
  2854. (this.iframe = null)),
  2855. i.prototype.doClose.call(this);
  2856. }),
  2857. (o.prototype.doPoll = function () {
  2858. var t = this,
  2859. e = document.createElement("script");
  2860. this.script &&
  2861. (this.script.parentNode.removeChild(this.script),
  2862. (this.script = null)),
  2863. (e.async = !0),
  2864. (e.src = this.uri()),
  2865. (e.onerror = function (e) {
  2866. t.onError("jsonp poll error", e);
  2867. });
  2868. var n = document.getElementsByTagName("script")[0];
  2869. n
  2870. ? n.parentNode.insertBefore(e, n)
  2871. : (document.head || document.body).appendChild(e),
  2872. (this.script = e);
  2873. var r =
  2874. "undefined" != typeof navigator &&
  2875. /gecko/i.test(navigator.userAgent);
  2876. r &&
  2877. setTimeout(function () {
  2878. var t = document.createElement("iframe");
  2879. document.body.appendChild(t), document.body.removeChild(t);
  2880. }, 100);
  2881. }),
  2882. (o.prototype.doWrite = function (t, e) {
  2883. function n() {
  2884. r(), e();
  2885. }
  2886. function r() {
  2887. if (o.iframe)
  2888. try {
  2889. o.form.removeChild(o.iframe);
  2890. } catch (t) {
  2891. o.onError("jsonp polling iframe removal error", t);
  2892. }
  2893. try {
  2894. var e = '<iframe src="javascript:0" name="' + o.iframeId + '">';
  2895. i = document.createElement(e);
  2896. } catch (t) {
  2897. (i = document.createElement("iframe")),
  2898. (i.name = o.iframeId),
  2899. (i.src = "javascript:0");
  2900. }
  2901. (i.id = o.iframeId), o.form.appendChild(i), (o.iframe = i);
  2902. }
  2903. var o = this;
  2904. if (!this.form) {
  2905. var i,
  2906. s = document.createElement("form"),
  2907. a = document.createElement("textarea"),
  2908. u = (this.iframeId = "eio_iframe_" + this.index);
  2909. (s.className = "socketio"),
  2910. (s.style.position = "absolute"),
  2911. (s.style.top = "-1000px"),
  2912. (s.style.left = "-1000px"),
  2913. (s.target = u),
  2914. (s.method = "POST"),
  2915. s.setAttribute("accept-charset", "utf-8"),
  2916. (a.name = "d"),
  2917. s.appendChild(a),
  2918. document.body.appendChild(s),
  2919. (this.form = s),
  2920. (this.area = a);
  2921. }
  2922. (this.form.action = this.uri()),
  2923. r(),
  2924. (t = t.replace(p, "\\\n")),
  2925. (this.area.value = t.replace(c, "\\n"));
  2926. try {
  2927. this.form.submit();
  2928. } catch (h) {}
  2929. this.iframe.attachEvent
  2930. ? (this.iframe.onreadystatechange = function () {
  2931. "complete" === o.iframe.readyState && n();
  2932. })
  2933. : (this.iframe.onload = n);
  2934. });
  2935. }).call(
  2936. e,
  2937. (function () {
  2938. return this;
  2939. })()
  2940. );
  2941. },
  2942. function (t, e, n) {
  2943. (function (e) {
  2944. function r(t) {
  2945. var e = t && t.forceBase64;
  2946. e && (this.supportsBinary = !1),
  2947. (this.perMessageDeflate = t.perMessageDeflate),
  2948. (this.usingBrowserWebSocket = h && !t.forceNode),
  2949. (this.protocols = t.protocols),
  2950. this.usingBrowserWebSocket || (l = o),
  2951. i.call(this, t);
  2952. }
  2953. var o,
  2954. i = n(22),
  2955. s = n(23),
  2956. a = n(31),
  2957. c = n(32),
  2958. p = n(33),
  2959. u = n(3)("engine.io-client:websocket"),
  2960. h = e.WebSocket || e.MozWebSocket;
  2961. if ("undefined" == typeof window)
  2962. try {
  2963. o = n(36);
  2964. } catch (f) {}
  2965. var l = h;
  2966. l || "undefined" != typeof window || (l = o),
  2967. (t.exports = r),
  2968. c(r, i),
  2969. (r.prototype.name = "websocket"),
  2970. (r.prototype.supportsBinary = !0),
  2971. (r.prototype.doOpen = function () {
  2972. if (this.check()) {
  2973. var t = this.uri(),
  2974. e = this.protocols,
  2975. n = {
  2976. agent: this.agent,
  2977. perMessageDeflate: this.perMessageDeflate,
  2978. };
  2979. (n.pfx = this.pfx),
  2980. (n.key = this.key),
  2981. (n.passphrase = this.passphrase),
  2982. (n.cert = this.cert),
  2983. (n.ca = this.ca),
  2984. (n.ciphers = this.ciphers),
  2985. (n.rejectUnauthorized = this.rejectUnauthorized),
  2986. this.extraHeaders && (n.headers = this.extraHeaders),
  2987. this.localAddress && (n.localAddress = this.localAddress);
  2988. try {
  2989. this.ws = this.usingBrowserWebSocket
  2990. ? e
  2991. ? new l(t, e)
  2992. : new l(t)
  2993. : new l(t, e, n);
  2994. } catch (r) {
  2995. return this.emit("error", r);
  2996. }
  2997. void 0 === this.ws.binaryType && (this.supportsBinary = !1),
  2998. this.ws.supports && this.ws.supports.binary
  2999. ? ((this.supportsBinary = !0),
  3000. (this.ws.binaryType = "nodebuffer"))
  3001. : (this.ws.binaryType = "arraybuffer"),
  3002. this.addEventListeners();
  3003. }
  3004. }),
  3005. (r.prototype.addEventListeners = function () {
  3006. var t = this;
  3007. (this.ws.onopen = function () {
  3008. t.onOpen();
  3009. }),
  3010. (this.ws.onclose = function () {
  3011. t.onClose();
  3012. }),
  3013. (this.ws.onmessage = function (e) {
  3014. t.onData(e.data);
  3015. }),
  3016. (this.ws.onerror = function (e) {
  3017. t.onError("websocket error", e);
  3018. });
  3019. }),
  3020. (r.prototype.write = function (t) {
  3021. function n() {
  3022. r.emit("flush"),
  3023. setTimeout(function () {
  3024. (r.writable = !0), r.emit("drain");
  3025. }, 0);
  3026. }
  3027. var r = this;
  3028. this.writable = !1;
  3029. for (var o = t.length, i = 0, a = o; i < a; i++)
  3030. !(function (t) {
  3031. s.encodePacket(t, r.supportsBinary, function (i) {
  3032. if (!r.usingBrowserWebSocket) {
  3033. var s = {};
  3034. if (
  3035. (t.options && (s.compress = t.options.compress),
  3036. r.perMessageDeflate)
  3037. ) {
  3038. var a =
  3039. "string" == typeof i
  3040. ? e.Buffer.byteLength(i)
  3041. : i.length;
  3042. a < r.perMessageDeflate.threshold && (s.compress = !1);
  3043. }
  3044. }
  3045. try {
  3046. r.usingBrowserWebSocket ? r.ws.send(i) : r.ws.send(i, s);
  3047. } catch (c) {
  3048. u("websocket closed before onclose event");
  3049. }
  3050. --o || n();
  3051. });
  3052. })(t[i]);
  3053. }),
  3054. (r.prototype.onClose = function () {
  3055. i.prototype.onClose.call(this);
  3056. }),
  3057. (r.prototype.doClose = function () {
  3058. "undefined" != typeof this.ws && this.ws.close();
  3059. }),
  3060. (r.prototype.uri = function () {
  3061. var t = this.query || {},
  3062. e = this.secure ? "wss" : "ws",
  3063. n = "";
  3064. this.port &&
  3065. (("wss" === e && 443 !== Number(this.port)) ||
  3066. ("ws" === e && 80 !== Number(this.port))) &&
  3067. (n = ":" + this.port),
  3068. this.timestampRequests && (t[this.timestampParam] = p()),
  3069. this.supportsBinary || (t.b64 = 1),
  3070. (t = a.encode(t)),
  3071. t.length && (t = "?" + t);
  3072. var r = this.hostname.indexOf(":") !== -1;
  3073. return (
  3074. e +
  3075. "://" +
  3076. (r ? "[" + this.hostname + "]" : this.hostname) +
  3077. n +
  3078. this.path +
  3079. t
  3080. );
  3081. }),
  3082. (r.prototype.check = function () {
  3083. return !(
  3084. !l ||
  3085. ("__initialize" in l && this.name === r.prototype.name)
  3086. );
  3087. });
  3088. }).call(
  3089. e,
  3090. (function () {
  3091. return this;
  3092. })()
  3093. );
  3094. },
  3095. function (t, e) {},
  3096. function (t, e) {
  3097. var n = [].indexOf;
  3098. t.exports = function (t, e) {
  3099. if (n) return t.indexOf(e);
  3100. for (var r = 0; r < t.length; ++r) if (t[r] === e) return r;
  3101. return -1;
  3102. };
  3103. },
  3104. function (t, e) {
  3105. (function (e) {
  3106. var n = /^[\],:{}\s]*$/,
  3107. r = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
  3108. o =
  3109. /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  3110. i = /(?:^|:|,)(?:\s*\[)+/g,
  3111. s = /^\s+/,
  3112. a = /\s+$/;
  3113. t.exports = function (t) {
  3114. return "string" == typeof t && t
  3115. ? ((t = t.replace(s, "").replace(a, "")),
  3116. e.JSON && JSON.parse
  3117. ? JSON.parse(t)
  3118. : n.test(t.replace(r, "@").replace(o, "]").replace(i, ""))
  3119. ? new Function("return " + t)()
  3120. : void 0)
  3121. : null;
  3122. };
  3123. }).call(
  3124. e,
  3125. (function () {
  3126. return this;
  3127. })()
  3128. );
  3129. },
  3130. function (t, e, n) {
  3131. "use strict";
  3132. function r(t, e, n) {
  3133. (this.io = t),
  3134. (this.nsp = e),
  3135. (this.json = this),
  3136. (this.ids = 0),
  3137. (this.acks = {}),
  3138. (this.receiveBuffer = []),
  3139. (this.sendBuffer = []),
  3140. (this.connected = !1),
  3141. (this.disconnected = !0),
  3142. n && n.query && (this.query = n.query),
  3143. this.io.autoConnect && this.open();
  3144. }
  3145. var o =
  3146. "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
  3147. ? function (t) {
  3148. return typeof t;
  3149. }
  3150. : function (t) {
  3151. return t &&
  3152. "function" == typeof Symbol &&
  3153. t.constructor === Symbol &&
  3154. t !== Symbol.prototype
  3155. ? "symbol"
  3156. : typeof t;
  3157. },
  3158. i = n(7),
  3159. s = n(8),
  3160. a = n(40),
  3161. c = n(41),
  3162. p = n(42),
  3163. u = n(3)("socket.io-client:socket"),
  3164. h = n(31);
  3165. t.exports = e = r;
  3166. var f = {
  3167. connect: 1,
  3168. connect_error: 1,
  3169. connect_timeout: 1,
  3170. connecting: 1,
  3171. disconnect: 1,
  3172. error: 1,
  3173. reconnect: 1,
  3174. reconnect_attempt: 1,
  3175. reconnect_failed: 1,
  3176. reconnect_error: 1,
  3177. reconnecting: 1,
  3178. ping: 1,
  3179. pong: 1,
  3180. },
  3181. l = s.prototype.emit;
  3182. s(r.prototype),
  3183. (r.prototype.subEvents = function () {
  3184. if (!this.subs) {
  3185. var t = this.io;
  3186. this.subs = [
  3187. c(t, "open", p(this, "onopen")),
  3188. c(t, "packet", p(this, "onpacket")),
  3189. c(t, "close", p(this, "onclose")),
  3190. ];
  3191. }
  3192. }),
  3193. (r.prototype.open = r.prototype.connect =
  3194. function () {
  3195. return this.connected
  3196. ? this
  3197. : (this.subEvents(),
  3198. this.io.open(),
  3199. "open" === this.io.readyState && this.onopen(),
  3200. this.emit("connecting"),
  3201. this);
  3202. }),
  3203. (r.prototype.send = function () {
  3204. var t = a(arguments);
  3205. return t.unshift("message"), this.emit.apply(this, t), this;
  3206. }),
  3207. (r.prototype.emit = function (t) {
  3208. if (f.hasOwnProperty(t)) return l.apply(this, arguments), this;
  3209. var e = a(arguments),
  3210. n = { type: i.EVENT, data: e };
  3211. return (
  3212. (n.options = {}),
  3213. (n.options.compress = !this.flags || !1 !== this.flags.compress),
  3214. "function" == typeof e[e.length - 1] &&
  3215. (u("emitting packet with ack id %d", this.ids),
  3216. (this.acks[this.ids] = e.pop()),
  3217. (n.id = this.ids++)),
  3218. this.connected ? this.packet(n) : this.sendBuffer.push(n),
  3219. delete this.flags,
  3220. this
  3221. );
  3222. }),
  3223. (r.prototype.packet = function (t) {
  3224. (t.nsp = this.nsp), this.io.packet(t);
  3225. }),
  3226. (r.prototype.onopen = function () {
  3227. if ((u("transport is open - connecting"), "/" !== this.nsp))
  3228. if (this.query) {
  3229. var t =
  3230. "object" === o(this.query) ? h.encode(this.query) : this.query;
  3231. u("sending connect packet with query %s", t),
  3232. this.packet({ type: i.CONNECT, query: t });
  3233. } else this.packet({ type: i.CONNECT });
  3234. }),
  3235. (r.prototype.onclose = function (t) {
  3236. u("close (%s)", t),
  3237. (this.connected = !1),
  3238. (this.disconnected = !0),
  3239. delete this.id,
  3240. this.emit("disconnect", t);
  3241. }),
  3242. (r.prototype.onpacket = function (t) {
  3243. if (t.nsp === this.nsp)
  3244. switch (t.type) {
  3245. case i.CONNECT:
  3246. this.onconnect();
  3247. break;
  3248. case i.EVENT:
  3249. this.onevent(t);
  3250. break;
  3251. case i.BINARY_EVENT:
  3252. this.onevent(t);
  3253. break;
  3254. case i.ACK:
  3255. this.onack(t);
  3256. break;
  3257. case i.BINARY_ACK:
  3258. this.onack(t);
  3259. break;
  3260. case i.DISCONNECT:
  3261. this.ondisconnect();
  3262. break;
  3263. case i.ERROR:
  3264. this.emit("error", t.data);
  3265. }
  3266. }),
  3267. (r.prototype.onevent = function (t) {
  3268. var e = t.data || [];
  3269. u("emitting event %j", e),
  3270. null != t.id &&
  3271. (u("attaching ack callback to event"), e.push(this.ack(t.id))),
  3272. this.connected ? l.apply(this, e) : this.receiveBuffer.push(e);
  3273. }),
  3274. (r.prototype.ack = function (t) {
  3275. var e = this,
  3276. n = !1;
  3277. return function () {
  3278. if (!n) {
  3279. n = !0;
  3280. var r = a(arguments);
  3281. u("sending ack %j", r), e.packet({ type: i.ACK, id: t, data: r });
  3282. }
  3283. };
  3284. }),
  3285. (r.prototype.onack = function (t) {
  3286. var e = this.acks[t.id];
  3287. "function" == typeof e
  3288. ? (u("calling ack %s with %j", t.id, t.data),
  3289. e.apply(this, t.data),
  3290. delete this.acks[t.id])
  3291. : u("bad ack %s", t.id);
  3292. }),
  3293. (r.prototype.onconnect = function () {
  3294. (this.connected = !0),
  3295. (this.disconnected = !1),
  3296. this.emit("connect"),
  3297. this.emitBuffered();
  3298. }),
  3299. (r.prototype.emitBuffered = function () {
  3300. var t;
  3301. for (t = 0; t < this.receiveBuffer.length; t++)
  3302. l.apply(this, this.receiveBuffer[t]);
  3303. for (this.receiveBuffer = [], t = 0; t < this.sendBuffer.length; t++)
  3304. this.packet(this.sendBuffer[t]);
  3305. this.sendBuffer = [];
  3306. }),
  3307. (r.prototype.ondisconnect = function () {
  3308. u("server disconnect (%s)", this.nsp),
  3309. this.destroy(),
  3310. this.onclose("io server disconnect");
  3311. }),
  3312. (r.prototype.destroy = function () {
  3313. if (this.subs) {
  3314. for (var t = 0; t < this.subs.length; t++) this.subs[t].destroy();
  3315. this.subs = null;
  3316. }
  3317. this.io.destroy(this);
  3318. }),
  3319. (r.prototype.close = r.prototype.disconnect =
  3320. function () {
  3321. return (
  3322. this.connected &&
  3323. (u("performing disconnect (%s)", this.nsp),
  3324. this.packet({ type: i.DISCONNECT })),
  3325. this.destroy(),
  3326. this.connected && this.onclose("io client disconnect"),
  3327. this
  3328. );
  3329. }),
  3330. (r.prototype.compress = function (t) {
  3331. return (
  3332. (this.flags = this.flags || {}), (this.flags.compress = t), this
  3333. );
  3334. });
  3335. },
  3336. function (t, e) {
  3337. function n(t, e) {
  3338. var n = [];
  3339. e = e || 0;
  3340. for (var r = e || 0; r < t.length; r++) n[r - e] = t[r];
  3341. return n;
  3342. }
  3343. t.exports = n;
  3344. },
  3345. function (t, e) {
  3346. "use strict";
  3347. function n(t, e, n) {
  3348. return (
  3349. t.on(e, n),
  3350. {
  3351. destroy: function () {
  3352. t.removeListener(e, n);
  3353. },
  3354. }
  3355. );
  3356. }
  3357. t.exports = n;
  3358. },
  3359. function (t, e) {
  3360. var n = [].slice;
  3361. t.exports = function (t, e) {
  3362. if (("string" == typeof e && (e = t[e]), "function" != typeof e))
  3363. throw new Error("bind() requires a function");
  3364. var r = n.call(arguments, 2);
  3365. return function () {
  3366. return e.apply(t, r.concat(n.call(arguments)));
  3367. };
  3368. };
  3369. },
  3370. function (t, e) {
  3371. function n(t) {
  3372. (t = t || {}),
  3373. (this.ms = t.min || 100),
  3374. (this.max = t.max || 1e4),
  3375. (this.factor = t.factor || 2),
  3376. (this.jitter = t.jitter > 0 && t.jitter <= 1 ? t.jitter : 0),
  3377. (this.attempts = 0);
  3378. }
  3379. (t.exports = n),
  3380. (n.prototype.duration = function () {
  3381. var t = this.ms * Math.pow(this.factor, this.attempts++);
  3382. if (this.jitter) {
  3383. var e = Math.random(),
  3384. n = Math.floor(e * this.jitter * t);
  3385. t = 0 == (1 & Math.floor(10 * e)) ? t - n : t + n;
  3386. }
  3387. return 0 | Math.min(t, this.max);
  3388. }),
  3389. (n.prototype.reset = function () {
  3390. this.attempts = 0;
  3391. }),
  3392. (n.prototype.setMin = function (t) {
  3393. this.ms = t;
  3394. }),
  3395. (n.prototype.setMax = function (t) {
  3396. this.max = t;
  3397. }),
  3398. (n.prototype.setJitter = function (t) {
  3399. this.jitter = t;
  3400. });
  3401. },
  3402. ]);
  3403. });
  3404. //# sourceMappingURL=socket.io.js.map