@aswin.dev/editor 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.md +3 -3
  2. package/dist/{AccessibilityPanel-CvQGLdu6.js → AccessibilityPanel-COL6Wm7p.js} +37 -37
  3. package/dist/{AiChatSidebar-B3SJIKG_.js → AiChatSidebar-DWGPVtvC.js} +68 -68
  4. package/dist/{AiFeatureMenu-BLLKoOos.js → AiFeatureMenu-duUFSfDf.js} +22 -22
  5. package/dist/{BlockA11yBadge-CXDLqkcJ.js → BlockA11yBadge-Qs6HtXid.js} +12 -12
  6. package/dist/CloudEditor-CFldoCOb.js +1207 -0
  7. package/dist/{CollaboratorBar-DuPYW5iF.js → CollaboratorBar-Bw-lbt61.js} +21 -21
  8. package/dist/CommentsSidebar-BaD5F53-.js +436 -0
  9. package/dist/CountdownBlock-DaYGxKqo.js +92 -0
  10. package/dist/CountdownToolbar-Dg4F8MTk.js +210 -0
  11. package/dist/{DesignReferenceSidebar-B8V_F2yF.js → DesignReferenceSidebar-BSH7uNP_.js} +58 -58
  12. package/dist/{LoadingTrack-B0CWFHXQ.js → LoadingTrack-Ba2pfF57.js} +2 -2
  13. package/dist/{ModuleBrowserModal-DrUFMTDx.js → ModuleBrowserModal-6phxZSKI.js} +80 -80
  14. package/dist/ModulePreviewCanvas-BW8L3eQX.js +108 -0
  15. package/dist/{NumberWithSuffix-DkXUez9t.js → NumberWithSuffix-BpUzQOJt.js} +87 -87
  16. package/dist/{ParagraphEditor-D75wl3BX.js → ParagraphEditor-DNSzAB-I.js} +182 -182
  17. package/dist/{RichTextEditorContent-DYkIauIk.js → RichTextEditorContent-CrqPQdnk.js} +38 -38
  18. package/dist/{SaveModuleDialog-FZ9lxY7_.js → SaveModuleDialog-zMQTpez7.js} +28 -28
  19. package/dist/{SnapshotHistory-BR3eV120.js → SnapshotHistory-Do-A5rYU.js} +45 -50
  20. package/dist/{TemplateScoringPanel-4GTNHej5.js → TemplateScoringPanel-CS7o62zS.js} +75 -75
  21. package/dist/{TestEmailModal--ue5w9fT.js → TestEmailModal-DGj_9V1u.js} +28 -28
  22. package/dist/{TitleEditor-fStSADI-.js → TitleEditor-C7IDnAoS.js} +68 -68
  23. package/dist/{TplModal-BwSfxIHf.js → TplModal-BAsVzcTb.js} +14 -14
  24. package/dist/{accessibility-e8JYu_zd.js → accessibility-BU09xZrQ.js} +1 -1
  25. package/dist/{blockTypeIcons-BcTrDjmH.js → blockTypeIcons-C6LDKvmd.js} +19 -5
  26. package/dist/bundle-stats.json +7 -7
  27. package/dist/{check-Da05j8yl.js → check-DJrpDKO_.js} +1 -1
  28. package/dist/{chevron-down-R2uY34iD.js → chevron-down-C5oBUhT8.js} +1 -1
  29. package/dist/chevron-right-BqCptpdp.js +10 -0
  30. package/dist/{circle-alert-DZuGWPX-.js → circle-alert-ZQQc98HC.js} +1 -1
  31. package/dist/{clock-CRp2sIub.js → clock-ik2pRJKG.js} +1 -1
  32. package/dist/{cloud-DEk_b4CR.js → cloud-6ZmAvF0j.js} +485 -427
  33. package/dist/{createLucideIcon-C3pa2siy.js → createLucideIcon-ClREiSx3.js} +6 -6
  34. package/dist/{de-Brqvgr43.js → de-DWcgp-7T.js} +209 -1
  35. package/dist/{dist-BaQIYPsn.js → dist-BUzw1buG.js} +1 -1
  36. package/dist/{dist-DjviJBCi.js → dist-BZyY-SS4.js} +1 -1
  37. package/dist/{dist-D6uC2xhi.js → dist-BadNx4qo.js} +1 -1
  38. package/dist/{dist-aRzjfSRN.js → dist-BesOh2mk.js} +1 -1
  39. package/dist/{dist-D90y8dvT.js → dist-Bz3M4RXG.js} +3 -3
  40. package/dist/dist-C04s_fLA.js +563 -0
  41. package/dist/{dist-DDJIWTRY.js → dist-C3T2AKtB.js} +1 -1
  42. package/dist/{dist-BFawx6IS.js → dist-C9ckKEZL.js} +51 -51
  43. package/dist/{dist-us-RpCWN.js → dist-CBItRG-Z.js} +1 -1
  44. package/dist/{dist-wzMIGj-D.js → dist-COSzWQUs.js} +1 -1
  45. package/dist/dist-CivF9P8b.js +382 -0
  46. package/dist/{dist-Cp0zXPAD.js → dist-DtiDUrX-.js} +1 -1
  47. package/dist/{dist-KoBJjK1G.js → dist-Dzt5foyL.js} +1 -1
  48. package/dist/{en-WDVp87TE.js → en-Cxd4fhNm.js} +209 -1
  49. package/dist/{extensions-CUcl9Ok4.js → extensions-D__hOlV1.js} +106 -106
  50. package/dist/{image-up-MBZKKg9p.js → image-up-DT7gcJLN.js} +1 -1
  51. package/dist/index.d.ts +88 -11
  52. package/dist/{info-CJEC7piy.js → info-BSPGcsSM.js} +1 -1
  53. package/dist/keys-CvX8D-8C.js +10 -0
  54. package/dist/{loader-circle-DsY5Yg33.js → loader-circle-Balo8p3d.js} +1 -1
  55. package/dist/{message-circle-yElBbR2C.js → message-circle-B39qAHxs.js} +1 -1
  56. package/dist/pencil-BZJPNYWR.js +10 -0
  57. package/dist/{refresh-cw-CE_AGtn8.js → refresh-cw-DwDqGUM0.js} +1 -1
  58. package/dist/{scan-line-D0vcUekt.js → scan-line-CzfFJO1o.js} +1 -1
  59. package/dist/{send-DH4oDQqC.js → send-D2eSo4GH.js} +1 -1
  60. package/dist/{shield-check-CfJgs2Hd.js → shield-check-jkpgcC0-.js} +1 -1
  61. package/dist/{sparkles-CvRXGqFs.js → sparkles-Chm5CZfb.js} +1 -1
  62. package/dist/style.css +1 -1
  63. package/dist/styleConstants-34eUKPOZ.js +55 -0
  64. package/dist/styles-B4tjX5SP.js +5224 -0
  65. package/dist/templatical-editor.js +189 -126
  66. package/dist/{text-align-start-BT9VUDxK.js → text-align-start-CzBnJsW8.js} +1 -1
  67. package/dist/{trash-2-DbP2Y6t2.js → trash-2-CtK2apEH.js} +1 -1
  68. package/dist/{triangle-alert-aOXceTSe.js → triangle-alert-KpDVNbpn.js} +1 -1
  69. package/dist/{useCloudI18n-BuIwR6OE.js → useCloudI18n-DOKSZql1.js} +2 -2
  70. package/dist/{useEditorCore-C6ost42Q.js → useEditorCore-wslttMH-.js} +2425 -2250
  71. package/dist/{useI18n-lb2DHDiu.js → useI18n-C2xQZ6K9.js} +2 -2
  72. package/dist/{useMergeTag-CBwKnnNB.js → useMergeTag-DX0XG5V9.js} +5 -5
  73. package/dist/{vue.runtime.esm-bundler-DpvJL-nX.js → vue.runtime.esm-bundler-CjauPXjj.js} +1 -1
  74. package/dist/{x-u2oVmjN_.js → x-BkaOMosX.js} +1 -1
  75. package/package.json +10 -10
  76. package/dist/CloudEditor-BCz1ZTYC.js +0 -1172
  77. package/dist/CommentsSidebar-B1pvJdqF.js +0 -441
  78. package/dist/CountdownBlock-BNSj1jvJ.js +0 -92
  79. package/dist/CountdownToolbar-ClJr2GzL.js +0 -210
  80. package/dist/ModulePreviewCanvas-CHdOwV_4.js +0 -106
  81. package/dist/cdn/chunks/AccessibilityPanel-B6DOjojm.js +0 -97
  82. package/dist/cdn/chunks/AccessibilityPanel-B6DOjojm.js.map +0 -1
  83. package/dist/cdn/chunks/AiFeatureMenu-qEdB2fZJ.js +0 -59
  84. package/dist/cdn/chunks/AiFeatureMenu-qEdB2fZJ.js.map +0 -1
  85. package/dist/cdn/chunks/BlockA11yBadge-DcEZftf6.js +0 -33
  86. package/dist/cdn/chunks/BlockA11yBadge-DcEZftf6.js.map +0 -1
  87. package/dist/cdn/chunks/CloudEditor-D2GsEC_n.js +0 -1143
  88. package/dist/cdn/chunks/CloudEditor-D2GsEC_n.js.map +0 -1
  89. package/dist/cdn/chunks/CollaboratorBar--nO7TX6b.js +0 -51
  90. package/dist/cdn/chunks/CollaboratorBar--nO7TX6b.js.map +0 -1
  91. package/dist/cdn/chunks/CountdownBlock-5YdT1uUu.js +0 -93
  92. package/dist/cdn/chunks/CountdownBlock-5YdT1uUu.js.map +0 -1
  93. package/dist/cdn/chunks/CountdownToolbar-DXPXrbAA.js +0 -212
  94. package/dist/cdn/chunks/CountdownToolbar-DXPXrbAA.js.map +0 -1
  95. package/dist/cdn/chunks/ModuleBrowserModal-DxoPp81s.js +0 -195
  96. package/dist/cdn/chunks/ModuleBrowserModal-DxoPp81s.js.map +0 -1
  97. package/dist/cdn/chunks/ModulePreviewCanvas-CoLdb4ar.js +0 -107
  98. package/dist/cdn/chunks/ModulePreviewCanvas-CoLdb4ar.js.map +0 -1
  99. package/dist/cdn/chunks/NumberWithSuffix-CE3NrZhH.js +0 -423
  100. package/dist/cdn/chunks/NumberWithSuffix-CE3NrZhH.js.map +0 -1
  101. package/dist/cdn/chunks/ParagraphEditor-B6Ygu-Mq.js +0 -544
  102. package/dist/cdn/chunks/ParagraphEditor-B6Ygu-Mq.js.map +0 -1
  103. package/dist/cdn/chunks/RichTextEditorContent-DL_y2SrR.js +0 -106
  104. package/dist/cdn/chunks/RichTextEditorContent-DL_y2SrR.js.map +0 -1
  105. package/dist/cdn/chunks/SaveModuleDialog-B0TnO_o9.js +0 -119
  106. package/dist/cdn/chunks/SaveModuleDialog-B0TnO_o9.js.map +0 -1
  107. package/dist/cdn/chunks/TitleEditor-BHpfxvwy.js +0 -171
  108. package/dist/cdn/chunks/TitleEditor-BHpfxvwy.js.map +0 -1
  109. package/dist/cdn/chunks/blockTypeIcons-BzzY9_kA.js +0 -22
  110. package/dist/cdn/chunks/blockTypeIcons-BzzY9_kA.js.map +0 -1
  111. package/dist/cdn/chunks/de-Ce-LbJ2J.js +0 -89
  112. package/dist/cdn/chunks/de-Ce-LbJ2J.js.map +0 -1
  113. package/dist/cdn/chunks/de-D8CnZxV9.js +0 -523
  114. package/dist/cdn/chunks/de-D8CnZxV9.js.map +0 -1
  115. package/dist/cdn/chunks/de-RQrZR56a.js +0 -209
  116. package/dist/cdn/chunks/de-RQrZR56a.js.map +0 -1
  117. package/dist/cdn/chunks/draggable-Bcb86AsV.js +0 -11572
  118. package/dist/cdn/chunks/draggable-Bcb86AsV.js.map +0 -1
  119. package/dist/cdn/chunks/emojiData-EMFlj6FJ.js +0 -19
  120. package/dist/cdn/chunks/emojiData-EMFlj6FJ.js.map +0 -1
  121. package/dist/cdn/chunks/en-8FHaQv4V.js +0 -523
  122. package/dist/cdn/chunks/en-8FHaQv4V.js.map +0 -1
  123. package/dist/cdn/chunks/en-Bl1ecfRF.js +0 -209
  124. package/dist/cdn/chunks/en-Bl1ecfRF.js.map +0 -1
  125. package/dist/cdn/chunks/en-DiCWK5fG.js +0 -89
  126. package/dist/cdn/chunks/en-DiCWK5fG.js.map +0 -1
  127. package/dist/cdn/chunks/extensions-DIxF31tA.js +0 -598
  128. package/dist/cdn/chunks/extensions-DIxF31tA.js.map +0 -1
  129. package/dist/cdn/chunks/features-DEMb13KS.js +0 -6814
  130. package/dist/cdn/chunks/features-DEMb13KS.js.map +0 -1
  131. package/dist/cdn/chunks/icons-CsLTcirh.js +0 -700
  132. package/dist/cdn/chunks/icons-CsLTcirh.js.map +0 -1
  133. package/dist/cdn/chunks/liquid.browser-lQbkge2E.js +0 -3279
  134. package/dist/cdn/chunks/liquid.browser-lQbkge2E.js.map +0 -1
  135. package/dist/cdn/chunks/media-library-CVaNvhpM.js +0 -6014
  136. package/dist/cdn/chunks/media-library-CVaNvhpM.js.map +0 -1
  137. package/dist/cdn/chunks/pusher-CDbNlZBE.js +0 -2508
  138. package/dist/cdn/chunks/pusher-CDbNlZBE.js.map +0 -1
  139. package/dist/cdn/chunks/quality-BaBfc54_.js +0 -1456
  140. package/dist/cdn/chunks/quality-BaBfc54_.js.map +0 -1
  141. package/dist/cdn/chunks/readableTextColor-DhoK4XiZ.js +0 -32
  142. package/dist/cdn/chunks/readableTextColor-DhoK4XiZ.js.map +0 -1
  143. package/dist/cdn/chunks/renderer-CUxvx7ro.js +0 -548
  144. package/dist/cdn/chunks/renderer-CUxvx7ro.js.map +0 -1
  145. package/dist/cdn/chunks/rolldown-runtime-BNuo_Jkg.js +0 -20
  146. package/dist/cdn/chunks/src-CRaqN-p8.js +0 -497
  147. package/dist/cdn/chunks/src-CRaqN-p8.js.map +0 -1
  148. package/dist/cdn/chunks/styleConstants-DP1VOca8.js +0 -57
  149. package/dist/cdn/chunks/styleConstants-DP1VOca8.js.map +0 -1
  150. package/dist/cdn/chunks/styles-BHJULjNR.js +0 -2947
  151. package/dist/cdn/chunks/styles-BHJULjNR.js.map +0 -1
  152. package/dist/cdn/chunks/tiptap-ZhwKyFp7.js +0 -14654
  153. package/dist/cdn/chunks/tiptap-ZhwKyFp7.js.map +0 -1
  154. package/dist/cdn/editor.css +0 -2
  155. package/dist/cdn/editor.js +0 -250
  156. package/dist/cdn/editor.js.map +0 -1
  157. package/dist/dist-B1IR0bpH.js +0 -326
  158. package/dist/dist-DJmnUmW9.js +0 -362
  159. package/dist/keys-ciNfSSGj.js +0 -10
  160. package/dist/styleConstants-fWzlIIwN.js +0 -55
  161. package/dist/styles-DEXEkBvg.js +0 -3176
  162. /package/dist/{_plugin-vue_export-helper-B0hnzhyu.js → _plugin-vue_export-helper-BVAJ4lgT.js} +0 -0
  163. /package/dist/{de-DCaaCE5s.js → de-GOtR9DwW.js} +0 -0
  164. /package/dist/{dist-iLBdeBDR.js → dist-DXa1uAMh.js} +0 -0
  165. /package/dist/{emojiData-PQyVa4bU.js → emojiData-DrBuvEoP.js} +0 -0
  166. /package/dist/{en-DXCyK4-X.js → en-dFFQVzNn.js} +0 -0
  167. /package/dist/{formatRelativeTime-BOEf47hq.js → formatRelativeTime-BhhO8yCl.js} +0 -0
  168. /package/dist/{liquid.browser-CdMv1BTn.js → liquid.browser-BvCyLQII.js} +0 -0
  169. /package/dist/{readableTextColor-CY3SiRnt.js → readableTextColor-DVuzNX1y.js} +0 -0
@@ -1,2508 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-BNuo_Jkg.js";
2
- //#region ../../node_modules/.pnpm/pusher-js@8.5.0/node_modules/pusher-js/dist/web/pusher.js
3
- var t = /* @__PURE__ */ e(((e, t) => {
4
- (function(n, r) {
5
- typeof e == "object" && typeof t == "object" ? t.exports = r() : typeof define == "function" && define.amd ? define([], r) : typeof e == "object" ? e.Pusher = r() : n.Pusher = r();
6
- })(self, () => (() => {
7
- var e = {
8
- 594(e, t) {
9
- var n = this && this.__extends || (function() {
10
- var e = function(t, n) {
11
- return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
12
- e.__proto__ = t;
13
- } || function(e, t) {
14
- for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
15
- }, e(t, n);
16
- };
17
- return function(t, n) {
18
- e(t, n);
19
- function r() {
20
- this.constructor = t;
21
- }
22
- t.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
23
- };
24
- })();
25
- Object.defineProperty(t, "__esModule", { value: !0 });
26
- var r = 256, i = function() {
27
- function e(e) {
28
- e === void 0 && (e = "="), this._paddingCharacter = e;
29
- }
30
- return e.prototype.encodedLength = function(e) {
31
- return this._paddingCharacter ? (e + 2) / 3 * 4 | 0 : (e * 8 + 5) / 6 | 0;
32
- }, e.prototype.encode = function(e) {
33
- for (var t = "", n = 0; n < e.length - 2; n += 3) {
34
- var r = e[n] << 16 | e[n + 1] << 8 | e[n + 2];
35
- t += this._encodeByte(r >>> 18 & 63), t += this._encodeByte(r >>> 12 & 63), t += this._encodeByte(r >>> 6 & 63), t += this._encodeByte(r >>> 0 & 63);
36
- }
37
- var i = e.length - n;
38
- if (i > 0) {
39
- var r = e[n] << 16 | (i === 2 ? e[n + 1] << 8 : 0);
40
- t += this._encodeByte(r >>> 18 & 63), t += this._encodeByte(r >>> 12 & 63), i === 2 ? t += this._encodeByte(r >>> 6 & 63) : t += this._paddingCharacter || "", t += this._paddingCharacter || "";
41
- }
42
- return t;
43
- }, e.prototype.maxDecodedLength = function(e) {
44
- return this._paddingCharacter ? e / 4 * 3 | 0 : (e * 6 + 7) / 8 | 0;
45
- }, e.prototype.decodedLength = function(e) {
46
- return this.maxDecodedLength(e.length - this._getPaddingLength(e));
47
- }, e.prototype.decode = function(e) {
48
- if (e.length === 0) return new Uint8Array();
49
- for (var t = this._getPaddingLength(e), n = e.length - t, i = new Uint8Array(this.maxDecodedLength(n)), a = 0, o = 0, s = 0, c = 0, l = 0, u = 0, d = 0; o < n - 4; o += 4) c = this._decodeChar(e.charCodeAt(o + 0)), l = this._decodeChar(e.charCodeAt(o + 1)), u = this._decodeChar(e.charCodeAt(o + 2)), d = this._decodeChar(e.charCodeAt(o + 3)), i[a++] = c << 2 | l >>> 4, i[a++] = l << 4 | u >>> 2, i[a++] = u << 6 | d, s |= c & r, s |= l & r, s |= u & r, s |= d & r;
50
- if (o < n - 1 && (c = this._decodeChar(e.charCodeAt(o)), l = this._decodeChar(e.charCodeAt(o + 1)), i[a++] = c << 2 | l >>> 4, s |= c & r, s |= l & r), o < n - 2 && (u = this._decodeChar(e.charCodeAt(o + 2)), i[a++] = l << 4 | u >>> 2, s |= u & r), o < n - 3 && (d = this._decodeChar(e.charCodeAt(o + 3)), i[a++] = u << 6 | d, s |= d & r), s !== 0) throw Error("Base64Coder: incorrect characters for decoding");
51
- return i;
52
- }, e.prototype._encodeByte = function(e) {
53
- var t = e;
54
- return t += 65, t += 25 - e >>> 8 & 6, t += 51 - e >>> 8 & -75, t += 61 - e >>> 8 & -15, t += 62 - e >>> 8 & 3, String.fromCharCode(t);
55
- }, e.prototype._decodeChar = function(e) {
56
- var t = r;
57
- return t += (42 - e & e - 44) >>> 8 & -r + e - 43 + 62, t += (46 - e & e - 48) >>> 8 & -r + e - 47 + 63, t += (47 - e & e - 58) >>> 8 & -r + e - 48 + 52, t += (64 - e & e - 91) >>> 8 & -r + e - 65 + 0, t += (96 - e & e - 123) >>> 8 & -r + e - 97 + 26, t;
58
- }, e.prototype._getPaddingLength = function(e) {
59
- var t = 0;
60
- if (this._paddingCharacter) {
61
- for (var n = e.length - 1; n >= 0 && e[n] === this._paddingCharacter; n--) t++;
62
- if (e.length < 4 || t > 2) throw Error("Base64Coder: incorrect padding");
63
- }
64
- return t;
65
- }, e;
66
- }();
67
- t.Coder = i;
68
- var a = new i();
69
- function o(e) {
70
- return a.encode(e);
71
- }
72
- t.encode = o;
73
- function s(e) {
74
- return a.decode(e);
75
- }
76
- t.decode = s;
77
- var c = function(e) {
78
- n(t, e);
79
- function t() {
80
- return e !== null && e.apply(this, arguments) || this;
81
- }
82
- return t.prototype._encodeByte = function(e) {
83
- var t = e;
84
- return t += 65, t += 25 - e >>> 8 & 6, t += 51 - e >>> 8 & -75, t += 61 - e >>> 8 & -13, t += 62 - e >>> 8 & 49, String.fromCharCode(t);
85
- }, t.prototype._decodeChar = function(e) {
86
- var t = r;
87
- return t += (44 - e & e - 46) >>> 8 & -r + e - 45 + 62, t += (94 - e & e - 96) >>> 8 & -r + e - 95 + 63, t += (47 - e & e - 58) >>> 8 & -r + e - 48 + 52, t += (64 - e & e - 91) >>> 8 & -r + e - 65 + 0, t += (96 - e & e - 123) >>> 8 & -r + e - 97 + 26, t;
88
- }, t;
89
- }(i);
90
- t.URLSafeCoder = c;
91
- var l = new c();
92
- function u(e) {
93
- return l.encode(e);
94
- }
95
- t.encodeURLSafe = u;
96
- function d(e) {
97
- return l.decode(e);
98
- }
99
- t.decodeURLSafe = d, t.encodedLength = function(e) {
100
- return a.encodedLength(e);
101
- }, t.maxDecodedLength = function(e) {
102
- return a.maxDecodedLength(e);
103
- }, t.decodedLength = function(e) {
104
- return a.decodedLength(e);
105
- };
106
- },
107
- 978(e, t) {
108
- var n = "utf8: invalid source encoding";
109
- function r(e) {
110
- for (var t = [], r = 0; r < e.length; r++) {
111
- var i = e[r];
112
- if (i & 128) {
113
- var a = void 0;
114
- if (i < 224) {
115
- if (r >= e.length) throw Error(n);
116
- var o = e[++r];
117
- if ((o & 192) != 128) throw Error(n);
118
- i = (i & 31) << 6 | o & 63, a = 128;
119
- } else if (i < 240) {
120
- if (r >= e.length - 1) throw Error(n);
121
- var o = e[++r], s = e[++r];
122
- if ((o & 192) != 128 || (s & 192) != 128) throw Error(n);
123
- i = (i & 15) << 12 | (o & 63) << 6 | s & 63, a = 2048;
124
- } else if (i < 248) {
125
- if (r >= e.length - 2) throw Error(n);
126
- var o = e[++r], s = e[++r], c = e[++r];
127
- if ((o & 192) != 128 || (s & 192) != 128 || (c & 192) != 128) throw Error(n);
128
- i = (i & 15) << 18 | (o & 63) << 12 | (s & 63) << 6 | c & 63, a = 65536;
129
- } else throw Error(n);
130
- if (i < a || i >= 55296 && i <= 57343) throw Error(n);
131
- if (i >= 65536) {
132
- if (i > 1114111) throw Error(n);
133
- i -= 65536, t.push(String.fromCharCode(55296 | i >> 10)), i = 56320 | i & 1023;
134
- }
135
- }
136
- t.push(String.fromCharCode(i));
137
- }
138
- return t.join("");
139
- }
140
- t.D4 = r;
141
- },
142
- 721(e, t, n) {
143
- e.exports = n(207).default;
144
- },
145
- 207(e, t, n) {
146
- n.d(t, { default: () => $ });
147
- class r {
148
- constructor(e, t) {
149
- this.lastId = 0, this.prefix = e, this.name = t;
150
- }
151
- create(e) {
152
- this.lastId++;
153
- var t = this.lastId, n = this.prefix + t, r = this.name + "[" + t + "]", i = !1, a = function() {
154
- i ||= (e.apply(null, arguments), !0);
155
- };
156
- return this[t] = a, {
157
- number: t,
158
- id: n,
159
- name: r,
160
- callback: a
161
- };
162
- }
163
- remove(e) {
164
- delete this[e.number];
165
- }
166
- }
167
- var i = new r("_pusher_script_", "Pusher.ScriptReceivers");
168
- let a = {
169
- VERSION: "8.5.0",
170
- PROTOCOL: 7,
171
- wsPort: 80,
172
- wssPort: 443,
173
- wsPath: "",
174
- httpHost: "sockjs.pusher.com",
175
- httpPort: 80,
176
- httpsPort: 443,
177
- httpPath: "/pusher",
178
- stats_host: "stats.pusher.com",
179
- authEndpoint: "/pusher/auth",
180
- authTransport: "ajax",
181
- activityTimeout: 12e4,
182
- pongTimeout: 3e4,
183
- unavailableTimeout: 1e4,
184
- userAuthentication: {
185
- endpoint: "/pusher/user-auth",
186
- transport: "ajax"
187
- },
188
- channelAuthorization: {
189
- endpoint: "/pusher/auth",
190
- transport: "ajax"
191
- },
192
- cdn_http: "http://js.pusher.com",
193
- cdn_https: "https://js.pusher.com",
194
- dependency_suffix: ""
195
- };
196
- class o {
197
- constructor(e) {
198
- this.options = e, this.receivers = e.receivers || i, this.loading = {};
199
- }
200
- load(e, t, n) {
201
- var r = this;
202
- if (r.loading[e] && r.loading[e].length > 0) r.loading[e].push(n);
203
- else {
204
- r.loading[e] = [n];
205
- var i = Y.createScriptRequest(r.getPath(e, t)), a = r.receivers.create(function(t) {
206
- if (r.receivers.remove(a), r.loading[e]) {
207
- var n = r.loading[e];
208
- delete r.loading[e];
209
- for (var o = function(e) {
210
- e || i.cleanup();
211
- }, s = 0; s < n.length; s++) n[s](t, o);
212
- }
213
- });
214
- i.send(a);
215
- }
216
- }
217
- getRoot(e) {
218
- var t, n = Y.getDocument().location.protocol;
219
- return t = e && e.useTLS || n === "https:" ? this.options.cdn_https : this.options.cdn_http, t.replace(/\/*$/, "") + "/" + this.options.version;
220
- }
221
- getPath(e, t) {
222
- return this.getRoot(t) + "/" + e + this.options.suffix + ".js";
223
- }
224
- }
225
- var s = new r("_pusher_dependencies", "Pusher.DependenciesReceivers"), c = new o({
226
- cdn_http: a.cdn_http,
227
- cdn_https: a.cdn_https,
228
- version: a.VERSION,
229
- suffix: a.dependency_suffix,
230
- receivers: s
231
- });
232
- let l = {
233
- baseUrl: "https://pusher.com",
234
- urls: {
235
- authenticationEndpoint: { path: "/docs/channels/server_api/authenticating_users" },
236
- authorizationEndpoint: { path: "/docs/channels/server_api/authorizing-users/" },
237
- javascriptQuickStart: { path: "/docs/javascript_quick_start" },
238
- triggeringClientEvents: { path: "/docs/client_api_guide/client_events#trigger-events" },
239
- encryptedChannelSupport: { fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support" }
240
- }
241
- }, u = { buildLogSuffix: function(e) {
242
- let t = l.urls[e];
243
- if (!t) return "";
244
- let n;
245
- return t.fullUrl ? n = t.fullUrl : t.path && (n = l.baseUrl + t.path), n ? `See: ${n}` : "";
246
- } };
247
- var d;
248
- (function(e) {
249
- e.UserAuthentication = "user-authentication", e.ChannelAuthorization = "channel-authorization";
250
- })(d ||= {});
251
- class ee extends Error {
252
- constructor(e) {
253
- super(e), Object.setPrototypeOf(this, new.target.prototype);
254
- }
255
- }
256
- class te extends Error {
257
- constructor(e) {
258
- super(e), Object.setPrototypeOf(this, new.target.prototype);
259
- }
260
- }
261
- class f extends Error {
262
- constructor(e) {
263
- super(e), Object.setPrototypeOf(this, new.target.prototype);
264
- }
265
- }
266
- class ne extends Error {
267
- constructor(e) {
268
- super(e), Object.setPrototypeOf(this, new.target.prototype);
269
- }
270
- }
271
- class p extends Error {
272
- constructor(e) {
273
- super(e), Object.setPrototypeOf(this, new.target.prototype);
274
- }
275
- }
276
- class m extends Error {
277
- constructor(e) {
278
- super(e), Object.setPrototypeOf(this, new.target.prototype);
279
- }
280
- }
281
- class h extends Error {
282
- constructor(e) {
283
- super(e), Object.setPrototypeOf(this, new.target.prototype);
284
- }
285
- }
286
- class g extends Error {
287
- constructor(e) {
288
- super(e), Object.setPrototypeOf(this, new.target.prototype);
289
- }
290
- }
291
- class _ extends Error {
292
- constructor(e, t) {
293
- super(t), this.status = e, Object.setPrototypeOf(this, new.target.prototype);
294
- }
295
- }
296
- let v = function(e, t, n, r, i) {
297
- let a = Y.createXHR();
298
- for (var o in a.open("POST", n.endpoint, !0), a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), n.headers) a.setRequestHeader(o, n.headers[o]);
299
- if (n.headersProvider != null) {
300
- let e = n.headersProvider();
301
- for (var o in e) a.setRequestHeader(o, e[o]);
302
- }
303
- return a.onreadystatechange = function() {
304
- if (a.readyState === 4) if (a.status === 200) {
305
- let e, t = !1;
306
- try {
307
- e = JSON.parse(a.responseText), t = !0;
308
- } catch {
309
- i(new _(200, `JSON returned from ${r.toString()} endpoint was invalid, yet status code was 200. Data was: ${a.responseText}`), null);
310
- }
311
- t && i(null, e);
312
- } else {
313
- let e = "";
314
- switch (r) {
315
- case d.UserAuthentication:
316
- e = u.buildLogSuffix("authenticationEndpoint");
317
- break;
318
- case d.ChannelAuthorization:
319
- e = `Clients must be authorized to join private or presence channels. ${u.buildLogSuffix("authorizationEndpoint")}`;
320
- break;
321
- }
322
- i(new _(a.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${a.status} from ${n.endpoint}. ${e}`), null);
323
- }
324
- }, a.send(t), a;
325
- };
326
- function y(e) {
327
- return ce(oe(e));
328
- }
329
- for (var b = String.fromCharCode, x = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", re = {}, S = 0, ie = x.length; S < ie; S++) re[x.charAt(S)] = S;
330
- var ae = function(e) {
331
- var t = e.charCodeAt(0);
332
- return t < 128 ? e : t < 2048 ? b(192 | t >>> 6) + b(128 | t & 63) : b(224 | t >>> 12 & 15) + b(128 | t >>> 6 & 63) + b(128 | t & 63);
333
- }, oe = function(e) {
334
- return e.replace(/[^\x00-\x7F]/g, ae);
335
- }, se = function(e) {
336
- var t = [
337
- 0,
338
- 2,
339
- 1
340
- ][e.length % 3], n = e.charCodeAt(0) << 16 | (e.length > 1 ? e.charCodeAt(1) : 0) << 8 | (e.length > 2 ? e.charCodeAt(2) : 0);
341
- return [
342
- x.charAt(n >>> 18),
343
- x.charAt(n >>> 12 & 63),
344
- t >= 2 ? "=" : x.charAt(n >>> 6 & 63),
345
- t >= 1 ? "=" : x.charAt(n & 63)
346
- ].join("");
347
- }, ce = window.btoa || function(e) {
348
- return e.replace(/[\s\S]{1,3}/g, se);
349
- };
350
- class le {
351
- constructor(e, t, n, r) {
352
- this.clear = t, this.timer = e(() => {
353
- this.timer &&= r(this.timer);
354
- }, n);
355
- }
356
- isRunning() {
357
- return this.timer !== null;
358
- }
359
- ensureAborted() {
360
- this.timer &&= (this.clear(this.timer), null);
361
- }
362
- }
363
- let ue = le;
364
- function de(e) {
365
- window.clearTimeout(e);
366
- }
367
- function fe(e) {
368
- window.clearInterval(e);
369
- }
370
- class C extends ue {
371
- constructor(e, t) {
372
- super(setTimeout, de, e, function(e) {
373
- return t(), null;
374
- });
375
- }
376
- }
377
- class pe extends ue {
378
- constructor(e, t) {
379
- super(setInterval, fe, e, function(e) {
380
- return t(), e;
381
- });
382
- }
383
- }
384
- let w = {
385
- now() {
386
- return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
387
- },
388
- defer(e) {
389
- return new C(0, e);
390
- },
391
- method(e, ...t) {
392
- var n = Array.prototype.slice.call(arguments, 1);
393
- return function(t) {
394
- return t[e].apply(t, n.concat(arguments));
395
- };
396
- }
397
- };
398
- function T(e, ...t) {
399
- for (var n = 0; n < t.length; n++) {
400
- var r = t[n];
401
- for (var i in r) r[i] && r[i].constructor && r[i].constructor === Object ? e[i] = T(e[i] || {}, r[i]) : e[i] = r[i];
402
- }
403
- return e;
404
- }
405
- function me() {
406
- for (var e = ["Pusher"], t = 0; t < arguments.length; t++) typeof arguments[t] == "string" ? e.push(arguments[t]) : e.push(k(arguments[t]));
407
- return e.join(" : ");
408
- }
409
- function E(e, t) {
410
- var n = Array.prototype.indexOf;
411
- if (e === null) return -1;
412
- if (n && e.indexOf === n) return e.indexOf(t);
413
- for (var r = 0, i = e.length; r < i; r++) if (e[r] === t) return r;
414
- return -1;
415
- }
416
- function D(e, t) {
417
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t(e[n], n, e);
418
- }
419
- function he(e) {
420
- var t = [];
421
- return D(e, function(e, n) {
422
- t.push(n);
423
- }), t;
424
- }
425
- function ge(e) {
426
- var t = [];
427
- return D(e, function(e) {
428
- t.push(e);
429
- }), t;
430
- }
431
- function O(e, t, n) {
432
- for (var r = 0; r < e.length; r++) t.call(n || window, e[r], r, e);
433
- }
434
- function _e(e, t) {
435
- for (var n = [], r = 0; r < e.length; r++) n.push(t(e[r], r, e, n));
436
- return n;
437
- }
438
- function ve(e, t) {
439
- var n = {};
440
- return D(e, function(e, r) {
441
- n[r] = t(e);
442
- }), n;
443
- }
444
- function ye(e, t) {
445
- t ||= function(e) {
446
- return !!e;
447
- };
448
- for (var n = [], r = 0; r < e.length; r++) t(e[r], r, e, n) && n.push(e[r]);
449
- return n;
450
- }
451
- function be(e, t) {
452
- var n = {};
453
- return D(e, function(r, i) {
454
- (t && t(r, i, e, n) || r) && (n[i] = r);
455
- }), n;
456
- }
457
- function xe(e) {
458
- var t = [];
459
- return D(e, function(e, n) {
460
- t.push([n, e]);
461
- }), t;
462
- }
463
- function Se(e, t) {
464
- for (var n = 0; n < e.length; n++) if (t(e[n], n, e)) return !0;
465
- return !1;
466
- }
467
- function Ce(e, t) {
468
- for (var n = 0; n < e.length; n++) if (!t(e[n], n, e)) return !1;
469
- return !0;
470
- }
471
- function we(e) {
472
- return ve(e, function(e) {
473
- return typeof e == "object" && (e = k(e)), encodeURIComponent(y(e.toString()));
474
- });
475
- }
476
- function Te(e) {
477
- return _e(xe(we(be(e, function(e) {
478
- return e !== void 0;
479
- }))), w.method("join", "=")).join("&");
480
- }
481
- function Ee(e) {
482
- var t = [], n = [];
483
- return (function e(r, i) {
484
- var a, o, s;
485
- switch (typeof r) {
486
- case "object":
487
- if (!r) return null;
488
- for (a = 0; a < t.length; a += 1) if (t[a] === r) return { $ref: n[a] };
489
- if (t.push(r), n.push(i), Object.prototype.toString.apply(r) === "[object Array]") for (s = [], a = 0; a < r.length; a += 1) s[a] = e(r[a], i + "[" + a + "]");
490
- else for (o in s = {}, r) Object.prototype.hasOwnProperty.call(r, o) && (s[o] = e(r[o], i + "[" + JSON.stringify(o) + "]"));
491
- return s;
492
- case "number":
493
- case "string":
494
- case "boolean": return r;
495
- }
496
- })(e, "$");
497
- }
498
- function k(e) {
499
- try {
500
- return JSON.stringify(e);
501
- } catch {
502
- return JSON.stringify(Ee(e));
503
- }
504
- }
505
- class De {
506
- constructor() {
507
- this.globalLog = (e) => {
508
- window.console && window.console.log && window.console.log(e);
509
- };
510
- }
511
- debug(...e) {
512
- this.log(this.globalLog, e);
513
- }
514
- warn(...e) {
515
- this.log(this.globalLogWarn, e);
516
- }
517
- error(...e) {
518
- this.log(this.globalLogError, e);
519
- }
520
- globalLogWarn(e) {
521
- window.console && window.console.warn ? window.console.warn(e) : this.globalLog(e);
522
- }
523
- globalLogError(e) {
524
- window.console && window.console.error ? window.console.error(e) : this.globalLogWarn(e);
525
- }
526
- log(e, ...t) {
527
- var n = me.apply(this, arguments);
528
- $.log ? $.log(n) : $.logToConsole && e.bind(this)(n);
529
- }
530
- }
531
- let A = new De(), Oe = function(e, t, n, r, i) {
532
- (n.headers !== void 0 || n.headersProvider != null) && A.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);
533
- var a = e.nextAuthCallbackID.toString();
534
- e.nextAuthCallbackID++;
535
- var o = e.getDocument(), s = o.createElement("script");
536
- e.auth_callbacks[a] = function(e) {
537
- i(null, e);
538
- };
539
- var c = "Pusher.auth_callbacks['" + a + "']";
540
- s.src = n.endpoint + "?callback=" + encodeURIComponent(c) + "&" + t;
541
- var l = o.getElementsByTagName("head")[0] || o.documentElement;
542
- l.insertBefore(s, l.firstChild);
543
- };
544
- class ke {
545
- constructor(e) {
546
- this.src = e;
547
- }
548
- send(e) {
549
- var t = this, n = "Error loading " + t.src;
550
- t.script = document.createElement("script"), t.script.id = e.id, t.script.src = t.src, t.script.type = "text/javascript", t.script.charset = "UTF-8", t.script.addEventListener ? (t.script.onerror = function() {
551
- e.callback(n);
552
- }, t.script.onload = function() {
553
- e.callback(null);
554
- }) : t.script.onreadystatechange = function() {
555
- (t.script.readyState === "loaded" || t.script.readyState === "complete") && e.callback(null);
556
- }, t.script.async === void 0 && document.attachEvent && /opera/i.test(navigator.userAgent) ? (t.errorScript = document.createElement("script"), t.errorScript.id = e.id + "_error", t.errorScript.text = e.name + "('" + n + "');", t.script.async = t.errorScript.async = !1) : t.script.async = !0;
557
- var r = document.getElementsByTagName("head")[0];
558
- r.insertBefore(t.script, r.firstChild), t.errorScript && r.insertBefore(t.errorScript, t.script.nextSibling);
559
- }
560
- cleanup() {
561
- this.script && (this.script.onload = this.script.onerror = null, this.script.onreadystatechange = null), this.script && this.script.parentNode && this.script.parentNode.removeChild(this.script), this.errorScript && this.errorScript.parentNode && this.errorScript.parentNode.removeChild(this.errorScript), this.script = null, this.errorScript = null;
562
- }
563
- }
564
- class Ae {
565
- constructor(e, t) {
566
- this.url = e, this.data = t;
567
- }
568
- send(e) {
569
- if (!this.request) {
570
- var t = Te(this.data), n = this.url + "/" + e.number + "?" + t;
571
- this.request = Y.createScriptRequest(n), this.request.send(e);
572
- }
573
- }
574
- cleanup() {
575
- this.request && this.request.cleanup();
576
- }
577
- }
578
- let je = {
579
- name: "jsonp",
580
- getAgent: function(e, t) {
581
- return function(n, r) {
582
- var a = "http" + (t ? "s" : "") + "://" + (e.host || e.options.host) + e.options.path, o = Y.createJSONPRequest(a, n), s = Y.ScriptReceivers.create(function(t, n) {
583
- i.remove(s), o.cleanup(), n && n.host && (e.host = n.host), r && r(t, n);
584
- });
585
- o.send(s);
586
- };
587
- }
588
- };
589
- function j(e, t, n) {
590
- var r = e + (t.useTLS ? "s" : ""), i = t.useTLS ? t.hostTLS : t.hostNonTLS;
591
- return r + "://" + i + n;
592
- }
593
- function M(e, t) {
594
- return "/app/" + e + ("?protocol=" + a.PROTOCOL + "&client=js&version=" + a.VERSION + (t ? "&" + t : ""));
595
- }
596
- var Me = { getInitial: function(e, t) {
597
- return j("ws", t, (t.httpPath || "") + M(e, "flash=false"));
598
- } }, Ne = { getInitial: function(e, t) {
599
- return j("http", t, (t.httpPath || "/pusher") + M(e));
600
- } }, Pe = {
601
- getInitial: function(e, t) {
602
- return j("http", t, t.httpPath || "/pusher");
603
- },
604
- getPath: function(e, t) {
605
- return M(e);
606
- }
607
- };
608
- class Fe {
609
- constructor() {
610
- this._callbacks = {};
611
- }
612
- get(e) {
613
- return this._callbacks[N(e)];
614
- }
615
- add(e, t, n) {
616
- var r = N(e);
617
- this._callbacks[r] = this._callbacks[r] || [], this._callbacks[r].push({
618
- fn: t,
619
- context: n
620
- });
621
- }
622
- remove(e, t, n) {
623
- if (!e && !t && !n) {
624
- this._callbacks = {};
625
- return;
626
- }
627
- var r = e ? [N(e)] : he(this._callbacks);
628
- t || n ? this.removeCallback(r, t, n) : this.removeAllCallbacks(r);
629
- }
630
- removeCallback(e, t, n) {
631
- O(e, function(e) {
632
- this._callbacks[e] = ye(this._callbacks[e] || [], function(e) {
633
- return t && t !== e.fn || n && n !== e.context;
634
- }), this._callbacks[e].length === 0 && delete this._callbacks[e];
635
- }, this);
636
- }
637
- removeAllCallbacks(e) {
638
- O(e, function(e) {
639
- delete this._callbacks[e];
640
- }, this);
641
- }
642
- }
643
- function N(e) {
644
- return "_" + e;
645
- }
646
- class P {
647
- constructor(e) {
648
- this.callbacks = new Fe(), this.global_callbacks = [], this.failThrough = e;
649
- }
650
- bind(e, t, n) {
651
- return this.callbacks.add(e, t, n), this;
652
- }
653
- bind_global(e) {
654
- return this.global_callbacks.push(e), this;
655
- }
656
- unbind(e, t, n) {
657
- return this.callbacks.remove(e, t, n), this;
658
- }
659
- unbind_global(e) {
660
- return e ? (this.global_callbacks = ye(this.global_callbacks || [], (t) => t !== e), this) : (this.global_callbacks = [], this);
661
- }
662
- unbind_all() {
663
- return this.unbind(), this.unbind_global(), this;
664
- }
665
- emit(e, t, n) {
666
- for (var r = 0; r < this.global_callbacks.length; r++) this.global_callbacks[r](e, t);
667
- var i = this.callbacks.get(e), a = [];
668
- if (n ? a.push(t, n) : t && a.push(t), i && i.length > 0) for (var r = 0; r < i.length; r++) i[r].fn.apply(i[r].context || window, a);
669
- else this.failThrough && this.failThrough(e, t);
670
- return this;
671
- }
672
- }
673
- class Ie extends P {
674
- constructor(e, t, n, r, i) {
675
- super(), this.initialize = Y.transportConnectionInitializer, this.hooks = e, this.name = t, this.priority = n, this.key = r, this.options = i, this.state = "new", this.timeline = i.timeline, this.activityTimeout = i.activityTimeout, this.id = this.timeline.generateUniqueID();
676
- }
677
- handlesActivityChecks() {
678
- return !!this.hooks.handlesActivityChecks;
679
- }
680
- supportsPing() {
681
- return !!this.hooks.supportsPing;
682
- }
683
- connect() {
684
- if (this.socket || this.state !== "initialized") return !1;
685
- var e = this.hooks.urls.getInitial(this.key, this.options);
686
- try {
687
- this.socket = this.hooks.getSocket(e, this.options);
688
- } catch (e) {
689
- return w.defer(() => {
690
- this.onError(e), this.changeState("closed");
691
- }), !1;
692
- }
693
- return this.bindListeners(), A.debug("Connecting", {
694
- transport: this.name,
695
- url: e
696
- }), this.changeState("connecting"), !0;
697
- }
698
- close() {
699
- return this.socket ? (this.socket.close(), !0) : !1;
700
- }
701
- send(e) {
702
- return this.state === "open" ? (w.defer(() => {
703
- this.socket && this.socket.send(e);
704
- }), !0) : !1;
705
- }
706
- ping() {
707
- this.state === "open" && this.supportsPing() && this.socket.ping();
708
- }
709
- onOpen() {
710
- this.hooks.beforeOpen && this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options)), this.changeState("open"), this.socket.onopen = void 0;
711
- }
712
- onError(e) {
713
- this.emit("error", {
714
- type: "WebSocketError",
715
- error: e
716
- }), this.timeline.error(this.buildTimelineMessage({ error: e.toString() }));
717
- }
718
- onClose(e) {
719
- e ? this.changeState("closed", {
720
- code: e.code,
721
- reason: e.reason,
722
- wasClean: e.wasClean
723
- }) : this.changeState("closed"), this.unbindListeners(), this.socket = void 0;
724
- }
725
- onMessage(e) {
726
- this.emit("message", e);
727
- }
728
- onActivity() {
729
- this.emit("activity");
730
- }
731
- bindListeners() {
732
- this.socket.onopen = () => {
733
- this.onOpen();
734
- }, this.socket.onerror = (e) => {
735
- this.onError(e);
736
- }, this.socket.onclose = (e) => {
737
- this.onClose(e);
738
- }, this.socket.onmessage = (e) => {
739
- this.onMessage(e);
740
- }, this.supportsPing() && (this.socket.onactivity = () => {
741
- this.onActivity();
742
- });
743
- }
744
- unbindListeners() {
745
- this.socket && (this.socket.onopen = void 0, this.socket.onerror = void 0, this.socket.onclose = void 0, this.socket.onmessage = void 0, this.supportsPing() && (this.socket.onactivity = void 0));
746
- }
747
- changeState(e, t) {
748
- this.state = e, this.timeline.info(this.buildTimelineMessage({
749
- state: e,
750
- params: t
751
- })), this.emit(e, t);
752
- }
753
- buildTimelineMessage(e) {
754
- return T({ cid: this.id }, e);
755
- }
756
- }
757
- class F {
758
- constructor(e) {
759
- this.hooks = e;
760
- }
761
- isSupported(e) {
762
- return this.hooks.isSupported(e);
763
- }
764
- createConnection(e, t, n, r) {
765
- return new Ie(this.hooks, e, t, n, r);
766
- }
767
- }
768
- var Le = new F({
769
- urls: Me,
770
- handlesActivityChecks: !1,
771
- supportsPing: !1,
772
- isInitialized: function() {
773
- return !!Y.getWebSocketAPI();
774
- },
775
- isSupported: function() {
776
- return !!Y.getWebSocketAPI();
777
- },
778
- getSocket: function(e) {
779
- return Y.createWebSocket(e);
780
- }
781
- }), Re = {
782
- urls: Ne,
783
- handlesActivityChecks: !1,
784
- supportsPing: !0,
785
- isInitialized: function() {
786
- return !0;
787
- }
788
- }, ze = T({ getSocket: function(e) {
789
- return Y.HTTPFactory.createStreamingSocket(e);
790
- } }, Re), Be = T({ getSocket: function(e) {
791
- return Y.HTTPFactory.createPollingSocket(e);
792
- } }, Re), Ve = { isSupported: function() {
793
- return Y.isXHRSupported();
794
- } };
795
- let I = {
796
- ws: Le,
797
- xhr_streaming: new F(T({}, ze, Ve)),
798
- xhr_polling: new F(T({}, Be, Ve))
799
- };
800
- var He = new F({
801
- file: "sockjs",
802
- urls: Pe,
803
- handlesActivityChecks: !0,
804
- supportsPing: !1,
805
- isSupported: function() {
806
- return !0;
807
- },
808
- isInitialized: function() {
809
- return window.SockJS !== void 0;
810
- },
811
- getSocket: function(e, t) {
812
- return new window.SockJS(e, null, {
813
- js_path: c.getPath("sockjs", { useTLS: t.useTLS }),
814
- ignore_null_origin: t.ignoreNullOrigin
815
- });
816
- },
817
- beforeOpen: function(e, t) {
818
- e.send(JSON.stringify({ path: t }));
819
- }
820
- }), Ue = { isSupported: function(e) {
821
- return Y.isXDRSupported(e.useTLS);
822
- } }, We = new F(T({}, ze, Ue)), Ge = new F(T({}, Be, Ue));
823
- I.xdr_streaming = We, I.xdr_polling = Ge, I.sockjs = He;
824
- let Ke = I;
825
- class qe extends P {
826
- constructor() {
827
- super();
828
- var e = this;
829
- window.addEventListener !== void 0 && (window.addEventListener("online", function() {
830
- e.emit("online");
831
- }, !1), window.addEventListener("offline", function() {
832
- e.emit("offline");
833
- }, !1));
834
- }
835
- isOnline() {
836
- return window.navigator.onLine === void 0 ? !0 : window.navigator.onLine;
837
- }
838
- }
839
- var Je = new qe();
840
- class Ye {
841
- constructor(e, t, n) {
842
- this.manager = e, this.transport = t, this.minPingDelay = n.minPingDelay, this.maxPingDelay = n.maxPingDelay, this.pingDelay = void 0;
843
- }
844
- createConnection(e, t, n, r) {
845
- r = T({}, r, { activityTimeout: this.pingDelay });
846
- var i = this.transport.createConnection(e, t, n, r), a = null, o = function() {
847
- i.unbind("open", o), i.bind("closed", s), a = w.now();
848
- }, s = (e) => {
849
- if (i.unbind("closed", s), e.code === 1002 || e.code === 1003) this.manager.reportDeath();
850
- else if (!e.wasClean && a) {
851
- var t = w.now() - a;
852
- t < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(t / 2, this.minPingDelay));
853
- }
854
- };
855
- return i.bind("open", o), i;
856
- }
857
- isSupported(e) {
858
- return this.manager.isAlive() && this.transport.isSupported(e);
859
- }
860
- }
861
- let Xe = {
862
- decodeMessage: function(e) {
863
- try {
864
- var t = JSON.parse(e.data), n = t.data;
865
- if (typeof n == "string") try {
866
- n = JSON.parse(t.data);
867
- } catch {}
868
- var r = {
869
- event: t.event,
870
- channel: t.channel,
871
- data: n
872
- };
873
- return t.user_id && (r.user_id = t.user_id), r;
874
- } catch (t) {
875
- throw {
876
- type: "MessageParseError",
877
- error: t,
878
- data: e.data
879
- };
880
- }
881
- },
882
- encodeMessage: function(e) {
883
- return JSON.stringify(e);
884
- },
885
- processHandshake: function(e) {
886
- var t = Xe.decodeMessage(e);
887
- if (t.event === "pusher:connection_established") {
888
- if (!t.data.activity_timeout) throw "No activity timeout specified in handshake";
889
- return {
890
- action: "connected",
891
- id: t.data.socket_id,
892
- activityTimeout: t.data.activity_timeout * 1e3
893
- };
894
- } else if (t.event === "pusher:error") return {
895
- action: this.getCloseAction(t.data),
896
- error: this.getCloseError(t.data)
897
- };
898
- else throw "Invalid handshake";
899
- },
900
- getCloseAction: function(e) {
901
- return e.code < 4e3 ? e.code >= 1002 && e.code <= 1004 ? "backoff" : null : e.code === 4e3 ? "tls_only" : e.code < 4100 ? "refused" : e.code < 4200 ? "backoff" : e.code < 4300 ? "retry" : "refused";
902
- },
903
- getCloseError: function(e) {
904
- return e.code !== 1e3 && e.code !== 1001 ? {
905
- type: "PusherError",
906
- data: {
907
- code: e.code,
908
- message: e.reason || e.message
909
- }
910
- } : null;
911
- }
912
- }, L = Xe;
913
- class Ze extends P {
914
- constructor(e, t) {
915
- super(), this.id = e, this.transport = t, this.activityTimeout = t.activityTimeout, this.bindListeners();
916
- }
917
- handlesActivityChecks() {
918
- return this.transport.handlesActivityChecks();
919
- }
920
- send(e) {
921
- return this.transport.send(e);
922
- }
923
- send_event(e, t, n) {
924
- var r = {
925
- event: e,
926
- data: t
927
- };
928
- return n && (r.channel = n), A.debug("Event sent", r), this.send(L.encodeMessage(r));
929
- }
930
- ping() {
931
- this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
932
- }
933
- close() {
934
- this.transport.close();
935
- }
936
- bindListeners() {
937
- var e = {
938
- message: (e) => {
939
- var t;
940
- try {
941
- t = L.decodeMessage(e);
942
- } catch (t) {
943
- this.emit("error", {
944
- type: "MessageParseError",
945
- error: t,
946
- data: e.data
947
- });
948
- }
949
- if (t !== void 0) {
950
- switch (A.debug("Event recd", t), t.event) {
951
- case "pusher:error":
952
- this.emit("error", {
953
- type: "PusherError",
954
- data: t.data
955
- });
956
- break;
957
- case "pusher:ping":
958
- this.emit("ping");
959
- break;
960
- case "pusher:pong":
961
- this.emit("pong");
962
- break;
963
- }
964
- this.emit("message", t);
965
- }
966
- },
967
- activity: () => {
968
- this.emit("activity");
969
- },
970
- error: (e) => {
971
- this.emit("error", e);
972
- },
973
- closed: (e) => {
974
- t(), e && e.code && this.handleCloseEvent(e), this.transport = null, this.emit("closed");
975
- }
976
- }, t = () => {
977
- D(e, (e, t) => {
978
- this.transport.unbind(t, e);
979
- });
980
- };
981
- D(e, (e, t) => {
982
- this.transport.bind(t, e);
983
- });
984
- }
985
- handleCloseEvent(e) {
986
- var t = L.getCloseAction(e), n = L.getCloseError(e);
987
- n && this.emit("error", n), t && this.emit(t, {
988
- action: t,
989
- error: n
990
- });
991
- }
992
- }
993
- class Qe {
994
- constructor(e, t) {
995
- this.transport = e, this.callback = t, this.bindListeners();
996
- }
997
- close() {
998
- this.unbindListeners(), this.transport.close();
999
- }
1000
- bindListeners() {
1001
- this.onMessage = (e) => {
1002
- this.unbindListeners();
1003
- var t;
1004
- try {
1005
- t = L.processHandshake(e);
1006
- } catch (e) {
1007
- this.finish("error", { error: e }), this.transport.close();
1008
- return;
1009
- }
1010
- t.action === "connected" ? this.finish("connected", {
1011
- connection: new Ze(t.id, this.transport),
1012
- activityTimeout: t.activityTimeout
1013
- }) : (this.finish(t.action, { error: t.error }), this.transport.close());
1014
- }, this.onClosed = (e) => {
1015
- this.unbindListeners();
1016
- var t = L.getCloseAction(e) || "backoff", n = L.getCloseError(e);
1017
- this.finish(t, { error: n });
1018
- }, this.transport.bind("message", this.onMessage), this.transport.bind("closed", this.onClosed);
1019
- }
1020
- unbindListeners() {
1021
- this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
1022
- }
1023
- finish(e, t) {
1024
- this.callback(T({
1025
- transport: this.transport,
1026
- action: e
1027
- }, t));
1028
- }
1029
- }
1030
- class $e {
1031
- constructor(e, t) {
1032
- this.timeline = e, this.options = t || {};
1033
- }
1034
- send(e, t) {
1035
- this.timeline.isEmpty() || this.timeline.send(Y.TimelineTransport.getAgent(this, e), t);
1036
- }
1037
- }
1038
- class R extends P {
1039
- constructor(e, t) {
1040
- super(function(t, n) {
1041
- A.debug("No callbacks on " + e + " for " + t);
1042
- }), this.name = e, this.pusher = t, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
1043
- }
1044
- authorize(e, t) {
1045
- return t(null, { auth: "" });
1046
- }
1047
- trigger(e, t) {
1048
- if (e.indexOf("client-") !== 0) throw new ee("Event '" + e + "' does not start with 'client-'");
1049
- if (!this.subscribed) {
1050
- var n = u.buildLogSuffix("triggeringClientEvents");
1051
- A.warn(`Client event triggered before channel 'subscription_succeeded' event . ${n}`);
1052
- }
1053
- return this.pusher.send_event(e, t, this.name);
1054
- }
1055
- disconnect() {
1056
- this.subscribed = !1, this.subscriptionPending = !1;
1057
- }
1058
- handleEvent(e) {
1059
- var t = e.event, n = e.data;
1060
- t === "pusher_internal:subscription_succeeded" ? this.handleSubscriptionSucceededEvent(e) : t === "pusher_internal:subscription_count" ? this.handleSubscriptionCountEvent(e) : t.indexOf("pusher_internal:") !== 0 && this.emit(t, n, {});
1061
- }
1062
- handleSubscriptionSucceededEvent(e) {
1063
- this.subscriptionPending = !1, this.subscribed = !0, this.subscriptionCancelled ? this.pusher.unsubscribe(this.name) : this.emit("pusher:subscription_succeeded", e.data);
1064
- }
1065
- handleSubscriptionCountEvent(e) {
1066
- e.data.subscription_count && (this.subscriptionCount = e.data.subscription_count), this.emit("pusher:subscription_count", e.data);
1067
- }
1068
- subscribe() {
1069
- this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (e, t) => {
1070
- e ? (this.subscriptionPending = !1, A.error(e.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
1071
- type: "AuthError",
1072
- error: e.message
1073
- }, e instanceof _ ? { status: e.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
1074
- auth: t.auth,
1075
- channel_data: t.channel_data,
1076
- channel: this.name
1077
- });
1078
- }));
1079
- }
1080
- unsubscribe() {
1081
- this.subscribed = !1, this.pusher.send_event("pusher:unsubscribe", { channel: this.name });
1082
- }
1083
- cancelSubscription() {
1084
- this.subscriptionCancelled = !0;
1085
- }
1086
- reinstateSubscription() {
1087
- this.subscriptionCancelled = !1;
1088
- }
1089
- }
1090
- class z extends R {
1091
- authorize(e, t) {
1092
- return this.pusher.config.channelAuthorizer({
1093
- channelName: this.name,
1094
- socketId: e
1095
- }, t);
1096
- }
1097
- }
1098
- class et {
1099
- constructor() {
1100
- this.reset();
1101
- }
1102
- get(e) {
1103
- return Object.prototype.hasOwnProperty.call(this.members, e) ? {
1104
- id: e,
1105
- info: this.members[e]
1106
- } : null;
1107
- }
1108
- each(e) {
1109
- D(this.members, (t, n) => {
1110
- e(this.get(n));
1111
- });
1112
- }
1113
- setMyID(e) {
1114
- this.myID = e;
1115
- }
1116
- onSubscription(e) {
1117
- this.members = e.presence.hash, this.count = e.presence.count, this.me = this.get(this.myID);
1118
- }
1119
- addMember(e) {
1120
- return this.get(e.user_id) === null && this.count++, this.members[e.user_id] = e.user_info, this.get(e.user_id);
1121
- }
1122
- removeMember(e) {
1123
- var t = this.get(e.user_id);
1124
- return t && (delete this.members[e.user_id], this.count--), t;
1125
- }
1126
- reset() {
1127
- this.members = {}, this.count = 0, this.myID = null, this.me = null;
1128
- }
1129
- }
1130
- var tt = function(e, t, n, r) {
1131
- function i(e) {
1132
- return e instanceof n ? e : new n(function(t) {
1133
- t(e);
1134
- });
1135
- }
1136
- return new (n ||= Promise)(function(n, a) {
1137
- function o(e) {
1138
- try {
1139
- c(r.next(e));
1140
- } catch (e) {
1141
- a(e);
1142
- }
1143
- }
1144
- function s(e) {
1145
- try {
1146
- c(r.throw(e));
1147
- } catch (e) {
1148
- a(e);
1149
- }
1150
- }
1151
- function c(e) {
1152
- e.done ? n(e.value) : i(e.value).then(o, s);
1153
- }
1154
- c((r = r.apply(e, t || [])).next());
1155
- });
1156
- };
1157
- class nt extends z {
1158
- constructor(e, t) {
1159
- super(e, t), this.members = new et();
1160
- }
1161
- authorize(e, t) {
1162
- super.authorize(e, (e, n) => tt(this, void 0, void 0, function* () {
1163
- if (!e) if (n = n, n.channel_data != null) {
1164
- var r = JSON.parse(n.channel_data);
1165
- this.members.setMyID(r.user_id);
1166
- } else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null) this.members.setMyID(this.pusher.user.user_data.id);
1167
- else {
1168
- let e = u.buildLogSuffix("authorizationEndpoint");
1169
- A.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${e}, or the user should be signed in.`), t("Invalid auth response");
1170
- return;
1171
- }
1172
- t(e, n);
1173
- }));
1174
- }
1175
- handleEvent(e) {
1176
- var t = e.event;
1177
- if (t.indexOf("pusher_internal:") === 0) this.handleInternalEvent(e);
1178
- else {
1179
- var n = e.data, r = {};
1180
- e.user_id && (r.user_id = e.user_id), this.emit(t, n, r);
1181
- }
1182
- }
1183
- handleInternalEvent(e) {
1184
- var t = e.event, n = e.data;
1185
- switch (t) {
1186
- case "pusher_internal:subscription_succeeded":
1187
- this.handleSubscriptionSucceededEvent(e);
1188
- break;
1189
- case "pusher_internal:subscription_count":
1190
- this.handleSubscriptionCountEvent(e);
1191
- break;
1192
- case "pusher_internal:member_added":
1193
- var r = this.members.addMember(n);
1194
- this.emit("pusher:member_added", r);
1195
- break;
1196
- case "pusher_internal:member_removed":
1197
- var i = this.members.removeMember(n);
1198
- i && this.emit("pusher:member_removed", i);
1199
- break;
1200
- }
1201
- }
1202
- handleSubscriptionSucceededEvent(e) {
1203
- this.subscriptionPending = !1, this.subscribed = !0, this.subscriptionCancelled ? this.pusher.unsubscribe(this.name) : (this.members.onSubscription(e.data), this.emit("pusher:subscription_succeeded", this.members));
1204
- }
1205
- disconnect() {
1206
- this.members.reset(), super.disconnect();
1207
- }
1208
- }
1209
- var rt = n(978), B = n(594);
1210
- class it extends z {
1211
- constructor(e, t, n) {
1212
- super(e, t), this.key = null, this.nacl = n;
1213
- }
1214
- authorize(e, t) {
1215
- super.authorize(e, (e, n) => {
1216
- if (e) {
1217
- t(e, n);
1218
- return;
1219
- }
1220
- let r = n.shared_secret;
1221
- if (!r) {
1222
- t(/* @__PURE__ */ Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
1223
- return;
1224
- }
1225
- this.key = (0, B.decode)(r), delete n.shared_secret, t(null, n);
1226
- });
1227
- }
1228
- trigger(e, t) {
1229
- throw new m("Client events are not currently supported for encrypted channels");
1230
- }
1231
- handleEvent(e) {
1232
- var t = e.event, n = e.data;
1233
- if (t.indexOf("pusher_internal:") === 0 || t.indexOf("pusher:") === 0) {
1234
- super.handleEvent(e);
1235
- return;
1236
- }
1237
- this.handleEncryptedEvent(t, n);
1238
- }
1239
- handleEncryptedEvent(e, t) {
1240
- if (!this.key) {
1241
- A.debug("Received encrypted event before key has been retrieved from the authEndpoint");
1242
- return;
1243
- }
1244
- if (!t.ciphertext || !t.nonce) {
1245
- A.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + t);
1246
- return;
1247
- }
1248
- let n = (0, B.decode)(t.ciphertext);
1249
- if (n.length < this.nacl.secretbox.overheadLength) {
1250
- A.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${n.length}`);
1251
- return;
1252
- }
1253
- let r = (0, B.decode)(t.nonce);
1254
- if (r.length < this.nacl.secretbox.nonceLength) {
1255
- A.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${r.length}`);
1256
- return;
1257
- }
1258
- let i = this.nacl.secretbox.open(n, r, this.key);
1259
- if (i === null) {
1260
- A.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (t, a) => {
1261
- if (t) {
1262
- A.error(`Failed to make a request to the authEndpoint: ${a}. Unable to fetch new key, so dropping encrypted event`);
1263
- return;
1264
- }
1265
- if (i = this.nacl.secretbox.open(n, r, this.key), i === null) {
1266
- A.error("Failed to decrypt event with new key. Dropping encrypted event");
1267
- return;
1268
- }
1269
- this.emit(e, this.getDataToEmit(i));
1270
- });
1271
- return;
1272
- }
1273
- this.emit(e, this.getDataToEmit(i));
1274
- }
1275
- getDataToEmit(e) {
1276
- let t = (0, rt.D4)(e);
1277
- try {
1278
- return JSON.parse(t);
1279
- } catch {
1280
- return t;
1281
- }
1282
- }
1283
- }
1284
- class at extends P {
1285
- constructor(e, t) {
1286
- super(), this.state = "initialized", this.connection = null, this.key = e, this.options = t, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
1287
- var n = Y.getNetwork();
1288
- n.bind("online", () => {
1289
- this.timeline.info({ netinfo: "online" }), (this.state === "connecting" || this.state === "unavailable") && this.retryIn(0);
1290
- }), n.bind("offline", () => {
1291
- this.timeline.info({ netinfo: "offline" }), this.connection && this.sendActivityCheck();
1292
- }), this.updateStrategy();
1293
- }
1294
- switchCluster(e) {
1295
- this.key = e, this.updateStrategy(), this.retryIn(0);
1296
- }
1297
- connect() {
1298
- if (!(this.connection || this.runner)) {
1299
- if (!this.strategy.isSupported()) {
1300
- this.updateState("failed");
1301
- return;
1302
- }
1303
- this.updateState("connecting"), this.startConnecting(), this.setUnavailableTimer();
1304
- }
1305
- }
1306
- send(e) {
1307
- return this.connection ? this.connection.send(e) : !1;
1308
- }
1309
- send_event(e, t, n) {
1310
- return this.connection ? this.connection.send_event(e, t, n) : !1;
1311
- }
1312
- disconnect() {
1313
- this.disconnectInternally(), this.updateState("disconnected");
1314
- }
1315
- isUsingTLS() {
1316
- return this.usingTLS;
1317
- }
1318
- startConnecting() {
1319
- var e = (t, n) => {
1320
- t ? this.runner = this.strategy.connect(0, e) : n.action === "error" ? (this.emit("error", {
1321
- type: "HandshakeError",
1322
- error: n.error
1323
- }), this.timeline.error({ handshakeError: n.error })) : (this.abortConnecting(), this.handshakeCallbacks[n.action](n));
1324
- };
1325
- this.runner = this.strategy.connect(0, e);
1326
- }
1327
- abortConnecting() {
1328
- this.runner &&= (this.runner.abort(), null);
1329
- }
1330
- disconnectInternally() {
1331
- this.abortConnecting(), this.clearRetryTimer(), this.clearUnavailableTimer(), this.connection && this.abandonConnection().close();
1332
- }
1333
- updateStrategy() {
1334
- this.strategy = this.options.getStrategy({
1335
- key: this.key,
1336
- timeline: this.timeline,
1337
- useTLS: this.usingTLS
1338
- });
1339
- }
1340
- retryIn(e) {
1341
- this.timeline.info({
1342
- action: "retry",
1343
- delay: e
1344
- }), e > 0 && this.emit("connecting_in", Math.round(e / 1e3)), this.retryTimer = new C(e || 0, () => {
1345
- this.disconnectInternally(), this.connect();
1346
- });
1347
- }
1348
- clearRetryTimer() {
1349
- this.retryTimer &&= (this.retryTimer.ensureAborted(), null);
1350
- }
1351
- setUnavailableTimer() {
1352
- this.unavailableTimer = new C(this.options.unavailableTimeout, () => {
1353
- this.updateState("unavailable");
1354
- });
1355
- }
1356
- clearUnavailableTimer() {
1357
- this.unavailableTimer && this.unavailableTimer.ensureAborted();
1358
- }
1359
- sendActivityCheck() {
1360
- this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new C(this.options.pongTimeout, () => {
1361
- this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
1362
- });
1363
- }
1364
- resetActivityCheck() {
1365
- this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new C(this.activityTimeout, () => {
1366
- this.sendActivityCheck();
1367
- }));
1368
- }
1369
- stopActivityCheck() {
1370
- this.activityTimer && this.activityTimer.ensureAborted();
1371
- }
1372
- buildConnectionCallbacks(e) {
1373
- return T({}, e, {
1374
- message: (e) => {
1375
- this.resetActivityCheck(), this.emit("message", e);
1376
- },
1377
- ping: () => {
1378
- this.send_event("pusher:pong", {});
1379
- },
1380
- activity: () => {
1381
- this.resetActivityCheck();
1382
- },
1383
- error: (e) => {
1384
- this.emit("error", e);
1385
- },
1386
- closed: () => {
1387
- this.abandonConnection(), this.shouldRetry() && this.retryIn(1e3);
1388
- }
1389
- });
1390
- }
1391
- buildHandshakeCallbacks(e) {
1392
- return T({}, e, { connected: (e) => {
1393
- this.activityTimeout = Math.min(this.options.activityTimeout, e.activityTimeout, e.connection.activityTimeout || Infinity), this.clearUnavailableTimer(), this.setConnection(e.connection), this.socket_id = this.connection.id, this.updateState("connected", { socket_id: this.socket_id });
1394
- } });
1395
- }
1396
- buildErrorCallbacks() {
1397
- let e = (e) => (t) => {
1398
- t.error && this.emit("error", {
1399
- type: "WebSocketError",
1400
- error: t.error
1401
- }), e(t);
1402
- };
1403
- return {
1404
- tls_only: e(() => {
1405
- this.usingTLS = !0, this.updateStrategy(), this.retryIn(0);
1406
- }),
1407
- refused: e(() => {
1408
- this.disconnect();
1409
- }),
1410
- backoff: e(() => {
1411
- this.retryIn(1e3);
1412
- }),
1413
- retry: e(() => {
1414
- this.retryIn(0);
1415
- })
1416
- };
1417
- }
1418
- setConnection(e) {
1419
- for (var t in this.connection = e, this.connectionCallbacks) this.connection.bind(t, this.connectionCallbacks[t]);
1420
- this.resetActivityCheck();
1421
- }
1422
- abandonConnection() {
1423
- if (this.connection) {
1424
- for (var e in this.stopActivityCheck(), this.connectionCallbacks) this.connection.unbind(e, this.connectionCallbacks[e]);
1425
- var t = this.connection;
1426
- return this.connection = null, t;
1427
- }
1428
- }
1429
- updateState(e, t) {
1430
- var n = this.state;
1431
- if (this.state = e, n !== e) {
1432
- var r = e;
1433
- r === "connected" && (r += " with new socket ID " + t.socket_id), A.debug("State changed", n + " -> " + r), this.timeline.info({
1434
- state: e,
1435
- params: t
1436
- }), this.emit("state_change", {
1437
- previous: n,
1438
- current: e
1439
- }), this.emit(e, t);
1440
- }
1441
- }
1442
- shouldRetry() {
1443
- return this.state === "connecting" || this.state === "connected";
1444
- }
1445
- }
1446
- class ot {
1447
- constructor() {
1448
- this.channels = {};
1449
- }
1450
- add(e, t) {
1451
- return this.channels[e] || (this.channels[e] = st(e, t)), this.channels[e];
1452
- }
1453
- all() {
1454
- return ge(this.channels);
1455
- }
1456
- find(e) {
1457
- return this.channels[e];
1458
- }
1459
- remove(e) {
1460
- var t = this.channels[e];
1461
- return delete this.channels[e], t;
1462
- }
1463
- disconnect() {
1464
- D(this.channels, function(e) {
1465
- e.disconnect();
1466
- });
1467
- }
1468
- }
1469
- function st(e, t) {
1470
- if (e.indexOf("private-encrypted-") === 0) {
1471
- if (t.config.nacl) return V.createEncryptedChannel(e, t, t.config.nacl);
1472
- throw new m(`Tried to subscribe to a private-encrypted- channel but no nacl implementation available. ${u.buildLogSuffix("encryptedChannelSupport")}`);
1473
- } else if (e.indexOf("private-") === 0) return V.createPrivateChannel(e, t);
1474
- else if (e.indexOf("presence-") === 0) return V.createPresenceChannel(e, t);
1475
- else if (e.indexOf("#") === 0) throw new te("Cannot create a channel with name \"" + e + "\".");
1476
- else return V.createChannel(e, t);
1477
- }
1478
- let V = {
1479
- createChannels() {
1480
- return new ot();
1481
- },
1482
- createConnectionManager(e, t) {
1483
- return new at(e, t);
1484
- },
1485
- createChannel(e, t) {
1486
- return new R(e, t);
1487
- },
1488
- createPrivateChannel(e, t) {
1489
- return new z(e, t);
1490
- },
1491
- createPresenceChannel(e, t) {
1492
- return new nt(e, t);
1493
- },
1494
- createEncryptedChannel(e, t, n) {
1495
- return new it(e, t, n);
1496
- },
1497
- createTimelineSender(e, t) {
1498
- return new $e(e, t);
1499
- },
1500
- createHandshake(e, t) {
1501
- return new Qe(e, t);
1502
- },
1503
- createAssistantToTheTransportManager(e, t, n) {
1504
- return new Ye(e, t, n);
1505
- }
1506
- };
1507
- class ct {
1508
- constructor(e) {
1509
- this.options = e || {}, this.livesLeft = this.options.lives || Infinity;
1510
- }
1511
- getAssistant(e) {
1512
- return V.createAssistantToTheTransportManager(this, e, {
1513
- minPingDelay: this.options.minPingDelay,
1514
- maxPingDelay: this.options.maxPingDelay
1515
- });
1516
- }
1517
- isAlive() {
1518
- return this.livesLeft > 0;
1519
- }
1520
- reportDeath() {
1521
- --this.livesLeft;
1522
- }
1523
- }
1524
- class H {
1525
- constructor(e, t) {
1526
- this.strategies = e, this.loop = !!t.loop, this.failFast = !!t.failFast, this.timeout = t.timeout, this.timeoutLimit = t.timeoutLimit;
1527
- }
1528
- isSupported() {
1529
- return Se(this.strategies, w.method("isSupported"));
1530
- }
1531
- connect(e, t) {
1532
- var n = this.strategies, r = 0, i = this.timeout, a = null, o = (s, c) => {
1533
- c ? t(null, c) : (r += 1, this.loop && (r %= n.length), r < n.length ? (i && (i *= 2, this.timeoutLimit && (i = Math.min(i, this.timeoutLimit))), a = this.tryStrategy(n[r], e, {
1534
- timeout: i,
1535
- failFast: this.failFast
1536
- }, o)) : t(!0));
1537
- };
1538
- return a = this.tryStrategy(n[r], e, {
1539
- timeout: i,
1540
- failFast: this.failFast
1541
- }, o), {
1542
- abort: function() {
1543
- a.abort();
1544
- },
1545
- forceMinPriority: function(t) {
1546
- e = t, a && a.forceMinPriority(t);
1547
- }
1548
- };
1549
- }
1550
- tryStrategy(e, t, n, r) {
1551
- var i = null, a = null;
1552
- return n.timeout > 0 && (i = new C(n.timeout, function() {
1553
- a.abort(), r(!0);
1554
- })), a = e.connect(t, function(e, t) {
1555
- e && i && i.isRunning() && !n.failFast || (i && i.ensureAborted(), r(e, t));
1556
- }), {
1557
- abort: function() {
1558
- i && i.ensureAborted(), a.abort();
1559
- },
1560
- forceMinPriority: function(e) {
1561
- a.forceMinPriority(e);
1562
- }
1563
- };
1564
- }
1565
- }
1566
- class U {
1567
- constructor(e) {
1568
- this.strategies = e;
1569
- }
1570
- isSupported() {
1571
- return Se(this.strategies, w.method("isSupported"));
1572
- }
1573
- connect(e, t) {
1574
- return lt(this.strategies, e, function(e, n) {
1575
- return function(r, i) {
1576
- if (n[e].error = r, r) {
1577
- ut(n) && t(!0);
1578
- return;
1579
- }
1580
- O(n, function(e) {
1581
- e.forceMinPriority(i.transport.priority);
1582
- }), t(null, i);
1583
- };
1584
- });
1585
- }
1586
- }
1587
- function lt(e, t, n) {
1588
- var r = _e(e, function(e, r, i, a) {
1589
- return e.connect(t, n(r, a));
1590
- });
1591
- return {
1592
- abort: function() {
1593
- O(r, dt);
1594
- },
1595
- forceMinPriority: function(e) {
1596
- O(r, function(t) {
1597
- t.forceMinPriority(e);
1598
- });
1599
- }
1600
- };
1601
- }
1602
- function ut(e) {
1603
- return Ce(e, function(e) {
1604
- return !!e.error;
1605
- });
1606
- }
1607
- function dt(e) {
1608
- !e.error && !e.aborted && (e.abort(), e.aborted = !0);
1609
- }
1610
- class ft {
1611
- constructor(e, t, n) {
1612
- this.strategy = e, this.transports = t, this.ttl = n.ttl || 1800 * 1e3, this.usingTLS = n.useTLS, this.timeline = n.timeline;
1613
- }
1614
- isSupported() {
1615
- return this.strategy.isSupported();
1616
- }
1617
- connect(e, t) {
1618
- var n = this.usingTLS, r = pt(n), i = r && r.cacheSkipCount ? r.cacheSkipCount : 0, a = [this.strategy];
1619
- if (r && r.timestamp + this.ttl >= w.now()) {
1620
- var o = this.transports[r.transport];
1621
- o && (["ws", "wss"].includes(r.transport) || i > 3 ? (this.timeline.info({
1622
- cached: !0,
1623
- transport: r.transport,
1624
- latency: r.latency
1625
- }), a.push(new H([o], {
1626
- timeout: r.latency * 2 + 1e3,
1627
- failFast: !0
1628
- }))) : i++);
1629
- }
1630
- var s = w.now(), c = a.pop().connect(e, function r(o, l) {
1631
- o ? (ht(n), a.length > 0 ? (s = w.now(), c = a.pop().connect(e, r)) : t(o)) : (mt(n, l.transport.name, w.now() - s, i), t(null, l));
1632
- });
1633
- return {
1634
- abort: function() {
1635
- c.abort();
1636
- },
1637
- forceMinPriority: function(t) {
1638
- e = t, c && c.forceMinPriority(t);
1639
- }
1640
- };
1641
- }
1642
- }
1643
- function W(e) {
1644
- return "pusherTransport" + (e ? "TLS" : "NonTLS");
1645
- }
1646
- function pt(e) {
1647
- var t = Y.getLocalStorage();
1648
- if (t) try {
1649
- var n = t[W(e)];
1650
- if (n) return JSON.parse(n);
1651
- } catch {
1652
- ht(e);
1653
- }
1654
- return null;
1655
- }
1656
- function mt(e, t, n, r) {
1657
- var i = Y.getLocalStorage();
1658
- if (i) try {
1659
- i[W(e)] = k({
1660
- timestamp: w.now(),
1661
- transport: t,
1662
- latency: n,
1663
- cacheSkipCount: r
1664
- });
1665
- } catch {}
1666
- }
1667
- function ht(e) {
1668
- var t = Y.getLocalStorage();
1669
- if (t) try {
1670
- delete t[W(e)];
1671
- } catch {}
1672
- }
1673
- class G {
1674
- constructor(e, { delay: t }) {
1675
- this.strategy = e, this.options = { delay: t };
1676
- }
1677
- isSupported() {
1678
- return this.strategy.isSupported();
1679
- }
1680
- connect(e, t) {
1681
- var n = this.strategy, r, i = new C(this.options.delay, function() {
1682
- r = n.connect(e, t);
1683
- });
1684
- return {
1685
- abort: function() {
1686
- i.ensureAborted(), r && r.abort();
1687
- },
1688
- forceMinPriority: function(t) {
1689
- e = t, r && r.forceMinPriority(t);
1690
- }
1691
- };
1692
- }
1693
- }
1694
- class K {
1695
- constructor(e, t, n) {
1696
- this.test = e, this.trueBranch = t, this.falseBranch = n;
1697
- }
1698
- isSupported() {
1699
- return (this.test() ? this.trueBranch : this.falseBranch).isSupported();
1700
- }
1701
- connect(e, t) {
1702
- return (this.test() ? this.trueBranch : this.falseBranch).connect(e, t);
1703
- }
1704
- }
1705
- class gt {
1706
- constructor(e) {
1707
- this.strategy = e;
1708
- }
1709
- isSupported() {
1710
- return this.strategy.isSupported();
1711
- }
1712
- connect(e, t) {
1713
- var n = this.strategy.connect(e, function(e, r) {
1714
- r && n.abort(), t(e, r);
1715
- });
1716
- return n;
1717
- }
1718
- }
1719
- function q(e) {
1720
- return function() {
1721
- return e.isSupported();
1722
- };
1723
- }
1724
- let _t = function(e, t, n) {
1725
- var r = {};
1726
- function i(t, i, a, o, s) {
1727
- var c = n(e, t, i, a, o, s);
1728
- return r[t] = c, c;
1729
- }
1730
- var a = Object.assign({}, t, {
1731
- hostNonTLS: e.wsHost + ":" + e.wsPort,
1732
- hostTLS: e.wsHost + ":" + e.wssPort,
1733
- httpPath: e.wsPath
1734
- }), o = Object.assign({}, a, { useTLS: !0 }), s = Object.assign({}, t, {
1735
- hostNonTLS: e.httpHost + ":" + e.httpPort,
1736
- hostTLS: e.httpHost + ":" + e.httpsPort,
1737
- httpPath: e.httpPath
1738
- }), c = {
1739
- loop: !0,
1740
- timeout: 15e3,
1741
- timeoutLimit: 6e4
1742
- }, l = new ct({
1743
- minPingDelay: 1e4,
1744
- maxPingDelay: e.activityTimeout
1745
- }), u = new ct({
1746
- lives: 2,
1747
- minPingDelay: 1e4,
1748
- maxPingDelay: e.activityTimeout
1749
- }), d = i("ws", "ws", 3, a, l), ee = i("wss", "ws", 3, o, l), te = i("sockjs", "sockjs", 1, s), f = i("xhr_streaming", "xhr_streaming", 1, s, u), ne = i("xdr_streaming", "xdr_streaming", 1, s, u), p = i("xhr_polling", "xhr_polling", 1, s), m = i("xdr_polling", "xdr_polling", 1, s), h = new H([d], c), g = new H([ee], c), _ = new H([te], c), v = new H([new K(q(f), f, ne)], c), y = new H([new K(q(p), p, m)], c), b = new H([new K(q(v), new U([v, new G(y, { delay: 4e3 })]), y)], c), x = new K(q(b), b, _), re = t.useTLS ? new U([h, new G(x, { delay: 2e3 })]) : new U([
1750
- h,
1751
- new G(g, { delay: 2e3 }),
1752
- new G(x, { delay: 5e3 })
1753
- ]);
1754
- return new ft(new gt(new K(q(d), re, x)), r, {
1755
- ttl: 18e5,
1756
- timeline: t.timeline,
1757
- useTLS: t.useTLS
1758
- });
1759
- };
1760
- function vt() {
1761
- var e = this;
1762
- e.timeline.info(e.buildTimelineMessage({ transport: e.name + (e.options.useTLS ? "s" : "") })), e.hooks.isInitialized() ? e.changeState("initialized") : e.hooks.file ? (e.changeState("initializing"), c.load(e.hooks.file, { useTLS: e.options.useTLS }, function(t, n) {
1763
- e.hooks.isInitialized() ? (e.changeState("initialized"), n(!0)) : (t && e.onError(t), e.onClose(), n(!1));
1764
- })) : e.onClose();
1765
- }
1766
- let yt = {
1767
- getRequest: function(e) {
1768
- var t = new window.XDomainRequest();
1769
- return t.ontimeout = function() {
1770
- e.emit("error", new f()), e.close();
1771
- }, t.onerror = function(t) {
1772
- e.emit("error", t), e.close();
1773
- }, t.onprogress = function() {
1774
- t.responseText && t.responseText.length > 0 && e.onChunk(200, t.responseText);
1775
- }, t.onload = function() {
1776
- t.responseText && t.responseText.length > 0 && e.onChunk(200, t.responseText), e.emit("finished", 200), e.close();
1777
- }, t;
1778
- },
1779
- abortRequest: function(e) {
1780
- e.ontimeout = e.onerror = e.onprogress = e.onload = null, e.abort();
1781
- }
1782
- };
1783
- class bt extends P {
1784
- constructor(e, t, n) {
1785
- super(), this.hooks = e, this.method = t, this.url = n;
1786
- }
1787
- start(e) {
1788
- this.position = 0, this.xhr = this.hooks.getRequest(this), this.unloader = () => {
1789
- this.close();
1790
- }, Y.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(e);
1791
- }
1792
- close() {
1793
- this.unloader &&= (Y.removeUnloadListener(this.unloader), null), this.xhr &&= (this.hooks.abortRequest(this.xhr), null);
1794
- }
1795
- onChunk(e, t) {
1796
- for (;;) {
1797
- var n = this.advanceBuffer(t);
1798
- if (n) this.emit("chunk", {
1799
- status: e,
1800
- data: n
1801
- });
1802
- else break;
1803
- }
1804
- this.isBufferTooLong(t) && this.emit("buffer_too_long");
1805
- }
1806
- advanceBuffer(e) {
1807
- var t = e.slice(this.position), n = t.indexOf("\n");
1808
- return n === -1 ? null : (this.position += n + 1, t.slice(0, n));
1809
- }
1810
- isBufferTooLong(e) {
1811
- return this.position === e.length && e.length > 262144;
1812
- }
1813
- }
1814
- var xt;
1815
- (function(e) {
1816
- e[e.CONNECTING = 0] = "CONNECTING", e[e.OPEN = 1] = "OPEN", e[e.CLOSED = 3] = "CLOSED";
1817
- })(xt ||= {});
1818
- let J = xt;
1819
- var St = 1;
1820
- class Ct {
1821
- constructor(e, t) {
1822
- this.hooks = e, this.session = Ot(1e3) + "/" + kt(8), this.location = wt(t), this.readyState = J.CONNECTING, this.openStream();
1823
- }
1824
- send(e) {
1825
- return this.sendRaw(JSON.stringify([e]));
1826
- }
1827
- ping() {
1828
- this.hooks.sendHeartbeat(this);
1829
- }
1830
- close(e, t) {
1831
- this.onClose(e, t, !0);
1832
- }
1833
- sendRaw(e) {
1834
- if (this.readyState === J.OPEN) try {
1835
- return Y.createSocketRequest("POST", Et(Tt(this.location, this.session))).start(e), !0;
1836
- } catch {
1837
- return !1;
1838
- }
1839
- else return !1;
1840
- }
1841
- reconnect() {
1842
- this.closeStream(), this.openStream();
1843
- }
1844
- onClose(e, t, n) {
1845
- this.closeStream(), this.readyState = J.CLOSED, this.onclose && this.onclose({
1846
- code: e,
1847
- reason: t,
1848
- wasClean: n
1849
- });
1850
- }
1851
- onChunk(e) {
1852
- if (e.status === 200) {
1853
- this.readyState === J.OPEN && this.onActivity();
1854
- var t;
1855
- switch (e.data.slice(0, 1)) {
1856
- case "o":
1857
- t = JSON.parse(e.data.slice(1) || "{}"), this.onOpen(t);
1858
- break;
1859
- case "a":
1860
- t = JSON.parse(e.data.slice(1) || "[]");
1861
- for (var n = 0; n < t.length; n++) this.onEvent(t[n]);
1862
- break;
1863
- case "m":
1864
- t = JSON.parse(e.data.slice(1) || "null"), this.onEvent(t);
1865
- break;
1866
- case "h":
1867
- this.hooks.onHeartbeat(this);
1868
- break;
1869
- case "c":
1870
- t = JSON.parse(e.data.slice(1) || "[]"), this.onClose(t[0], t[1], !0);
1871
- break;
1872
- }
1873
- }
1874
- }
1875
- onOpen(e) {
1876
- this.readyState === J.CONNECTING ? (e && e.hostname && (this.location.base = Dt(this.location.base, e.hostname)), this.readyState = J.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
1877
- }
1878
- onEvent(e) {
1879
- this.readyState === J.OPEN && this.onmessage && this.onmessage({ data: e });
1880
- }
1881
- onActivity() {
1882
- this.onactivity && this.onactivity();
1883
- }
1884
- onError(e) {
1885
- this.onerror && this.onerror(e);
1886
- }
1887
- openStream() {
1888
- this.stream = Y.createSocketRequest("POST", Et(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (e) => {
1889
- this.onChunk(e);
1890
- }), this.stream.bind("finished", (e) => {
1891
- this.hooks.onFinished(this, e);
1892
- }), this.stream.bind("buffer_too_long", () => {
1893
- this.reconnect();
1894
- });
1895
- try {
1896
- this.stream.start();
1897
- } catch (e) {
1898
- w.defer(() => {
1899
- this.onError(e), this.onClose(1006, "Could not start streaming", !1);
1900
- });
1901
- }
1902
- }
1903
- closeStream() {
1904
- this.stream &&= (this.stream.unbind_all(), this.stream.close(), null);
1905
- }
1906
- }
1907
- function wt(e) {
1908
- var t = /([^\?]*)\/*(\??.*)/.exec(e);
1909
- return {
1910
- base: t[1],
1911
- queryString: t[2]
1912
- };
1913
- }
1914
- function Tt(e, t) {
1915
- return e.base + "/" + t + "/xhr_send";
1916
- }
1917
- function Et(e) {
1918
- return e + (e.indexOf("?") === -1 ? "?" : "&") + "t=" + +/* @__PURE__ */ new Date() + "&n=" + St++;
1919
- }
1920
- function Dt(e, t) {
1921
- var n = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(e);
1922
- return n[1] + t + n[3];
1923
- }
1924
- function Ot(e) {
1925
- return Y.randomInt(e);
1926
- }
1927
- function kt(e) {
1928
- for (var t = [], n = 0; n < e; n++) t.push(Ot(32).toString(32));
1929
- return t.join("");
1930
- }
1931
- let At = Ct, jt = {
1932
- getReceiveURL: function(e, t) {
1933
- return e.base + "/" + t + "/xhr_streaming" + e.queryString;
1934
- },
1935
- onHeartbeat: function(e) {
1936
- e.sendRaw("[]");
1937
- },
1938
- sendHeartbeat: function(e) {
1939
- e.sendRaw("[]");
1940
- },
1941
- onFinished: function(e, t) {
1942
- e.onClose(1006, "Connection interrupted (" + t + ")", !1);
1943
- }
1944
- }, Mt = {
1945
- getReceiveURL: function(e, t) {
1946
- return e.base + "/" + t + "/xhr" + e.queryString;
1947
- },
1948
- onHeartbeat: function() {},
1949
- sendHeartbeat: function(e) {
1950
- e.sendRaw("[]");
1951
- },
1952
- onFinished: function(e, t) {
1953
- t === 200 ? e.reconnect() : e.onClose(1006, "Connection interrupted (" + t + ")", !1);
1954
- }
1955
- }, Nt = {
1956
- getRequest: function(e) {
1957
- var t = new (Y.getXHRAPI())();
1958
- return t.onreadystatechange = t.onprogress = function() {
1959
- switch (t.readyState) {
1960
- case 3:
1961
- t.responseText && t.responseText.length > 0 && e.onChunk(t.status, t.responseText);
1962
- break;
1963
- case 4:
1964
- t.responseText && t.responseText.length > 0 && e.onChunk(t.status, t.responseText), e.emit("finished", t.status), e.close();
1965
- break;
1966
- }
1967
- }, t;
1968
- },
1969
- abortRequest: function(e) {
1970
- e.onreadystatechange = null, e.abort();
1971
- }
1972
- }, Pt = {
1973
- createStreamingSocket(e) {
1974
- return this.createSocket(jt, e);
1975
- },
1976
- createPollingSocket(e) {
1977
- return this.createSocket(Mt, e);
1978
- },
1979
- createSocket(e, t) {
1980
- return new At(e, t);
1981
- },
1982
- createXHR(e, t) {
1983
- return this.createRequest(Nt, e, t);
1984
- },
1985
- createRequest(e, t, n) {
1986
- return new bt(e, t, n);
1987
- }
1988
- };
1989
- Pt.createXDR = function(e, t) {
1990
- return this.createRequest(yt, e, t);
1991
- };
1992
- let Y = {
1993
- nextAuthCallbackID: 1,
1994
- auth_callbacks: {},
1995
- ScriptReceivers: i,
1996
- DependenciesReceivers: s,
1997
- getDefaultStrategy: _t,
1998
- Transports: Ke,
1999
- transportConnectionInitializer: vt,
2000
- HTTPFactory: Pt,
2001
- TimelineTransport: je,
2002
- getXHRAPI() {
2003
- return window.XMLHttpRequest;
2004
- },
2005
- getWebSocketAPI() {
2006
- return window.WebSocket || window.MozWebSocket;
2007
- },
2008
- setup(e) {
2009
- window.Pusher = e;
2010
- var t = () => {
2011
- this.onDocumentBody(e.ready);
2012
- };
2013
- window.JSON ? t() : c.load("json2", {}, t);
2014
- },
2015
- getDocument() {
2016
- return document;
2017
- },
2018
- getProtocol() {
2019
- return this.getDocument().location.protocol;
2020
- },
2021
- getAuthorizers() {
2022
- return {
2023
- ajax: v,
2024
- jsonp: Oe
2025
- };
2026
- },
2027
- onDocumentBody(e) {
2028
- document.body ? e() : setTimeout(() => {
2029
- this.onDocumentBody(e);
2030
- }, 0);
2031
- },
2032
- createJSONPRequest(e, t) {
2033
- return new Ae(e, t);
2034
- },
2035
- createScriptRequest(e) {
2036
- return new ke(e);
2037
- },
2038
- getLocalStorage() {
2039
- try {
2040
- return window.localStorage;
2041
- } catch {
2042
- return;
2043
- }
2044
- },
2045
- createXHR() {
2046
- return this.getXHRAPI() ? this.createXMLHttpRequest() : this.createMicrosoftXHR();
2047
- },
2048
- createXMLHttpRequest() {
2049
- return new (this.getXHRAPI())();
2050
- },
2051
- createMicrosoftXHR() {
2052
- return new ActiveXObject("Microsoft.XMLHTTP");
2053
- },
2054
- getNetwork() {
2055
- return Je;
2056
- },
2057
- createWebSocket(e) {
2058
- return new (this.getWebSocketAPI())(e);
2059
- },
2060
- createSocketRequest(e, t) {
2061
- if (this.isXHRSupported()) return this.HTTPFactory.createXHR(e, t);
2062
- if (this.isXDRSupported(t.indexOf("https:") === 0)) return this.HTTPFactory.createXDR(e, t);
2063
- throw "Cross-origin HTTP requests are not supported";
2064
- },
2065
- isXHRSupported() {
2066
- var e = this.getXHRAPI();
2067
- return !!e && new e().withCredentials !== void 0;
2068
- },
2069
- isXDRSupported(e) {
2070
- var t = e ? "https:" : "http:", n = this.getProtocol();
2071
- return !!window.XDomainRequest && n === t;
2072
- },
2073
- addUnloadListener(e) {
2074
- window.addEventListener === void 0 ? window.attachEvent !== void 0 && window.attachEvent("onunload", e) : window.addEventListener("unload", e, !1);
2075
- },
2076
- removeUnloadListener(e) {
2077
- window.addEventListener === void 0 ? window.detachEvent !== void 0 && window.detachEvent("onunload", e) : window.removeEventListener("unload", e, !1);
2078
- },
2079
- randomInt(e) {
2080
- return Math.floor(function() {
2081
- return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / 2 ** 32;
2082
- }() * e);
2083
- }
2084
- };
2085
- var X;
2086
- (function(e) {
2087
- e[e.ERROR = 3] = "ERROR", e[e.INFO = 6] = "INFO", e[e.DEBUG = 7] = "DEBUG";
2088
- })(X ||= {});
2089
- let Z = X;
2090
- class Ft {
2091
- constructor(e, t, n) {
2092
- this.key = e, this.session = t, this.events = [], this.options = n || {}, this.sent = 0, this.uniqueID = 0;
2093
- }
2094
- log(e, t) {
2095
- e <= this.options.level && (this.events.push(T({}, t, { timestamp: w.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
2096
- }
2097
- error(e) {
2098
- this.log(Z.ERROR, e);
2099
- }
2100
- info(e) {
2101
- this.log(Z.INFO, e);
2102
- }
2103
- debug(e) {
2104
- this.log(Z.DEBUG, e);
2105
- }
2106
- isEmpty() {
2107
- return this.events.length === 0;
2108
- }
2109
- send(e, t) {
2110
- var n = T({
2111
- session: this.session,
2112
- bundle: this.sent + 1,
2113
- key: this.key,
2114
- lib: "js",
2115
- version: this.options.version,
2116
- cluster: this.options.cluster,
2117
- features: this.options.features,
2118
- timeline: this.events
2119
- }, this.options.params);
2120
- return this.events = [], e(n, (e, n) => {
2121
- e || this.sent++, t && t(e, n);
2122
- }), !0;
2123
- }
2124
- generateUniqueID() {
2125
- return this.uniqueID++, this.uniqueID;
2126
- }
2127
- }
2128
- class It {
2129
- constructor(e, t, n, r) {
2130
- this.name = e, this.priority = t, this.transport = n, this.options = r || {};
2131
- }
2132
- isSupported() {
2133
- return this.transport.isSupported({ useTLS: this.options.useTLS });
2134
- }
2135
- connect(e, t) {
2136
- if (!this.isSupported()) return Lt(new g(), t);
2137
- if (this.priority < e) return Lt(new ne(), t);
2138
- var n = !1, r = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), i = null, a = function() {
2139
- r.unbind("initialized", a), r.connect();
2140
- }, o = function() {
2141
- i = V.createHandshake(r, function(e) {
2142
- n = !0, l(), t(null, e);
2143
- });
2144
- }, s = function(e) {
2145
- l(), t(e);
2146
- }, c = function() {
2147
- l(), t(new p(k(r)));
2148
- }, l = function() {
2149
- r.unbind("initialized", a), r.unbind("open", o), r.unbind("error", s), r.unbind("closed", c);
2150
- };
2151
- return r.bind("initialized", a), r.bind("open", o), r.bind("error", s), r.bind("closed", c), r.initialize(), {
2152
- abort: () => {
2153
- n || (l(), i ? i.close() : r.close());
2154
- },
2155
- forceMinPriority: (e) => {
2156
- n || this.priority < e && (i ? i.close() : r.close());
2157
- }
2158
- };
2159
- }
2160
- }
2161
- function Lt(e, t) {
2162
- return w.defer(function() {
2163
- t(e);
2164
- }), {
2165
- abort: function() {},
2166
- forceMinPriority: function() {}
2167
- };
2168
- }
2169
- let { Transports: Rt } = Y;
2170
- var zt = function(e, t, n, r, i, a) {
2171
- var o = Rt[n];
2172
- if (!o) throw new h(n);
2173
- var s = (!e.enabledTransports || E(e.enabledTransports, t) !== -1) && (!e.disabledTransports || E(e.disabledTransports, t) === -1), c;
2174
- return s ? (i = Object.assign({ ignoreNullOrigin: e.ignoreNullOrigin }, i), c = new It(t, r, a ? a.getAssistant(o) : o, i)) : c = Bt, c;
2175
- }, Bt = {
2176
- isSupported: function() {
2177
- return !1;
2178
- },
2179
- connect: function(e, t) {
2180
- var n = w.defer(function() {
2181
- t(new g());
2182
- });
2183
- return {
2184
- abort: function() {
2185
- n.ensureAborted();
2186
- },
2187
- forceMinPriority: function() {}
2188
- };
2189
- }
2190
- };
2191
- function Vt(e) {
2192
- if (e == null) throw "You must pass an options object";
2193
- if (e.cluster == null) throw "Options object must provide a cluster";
2194
- "disableStats" in e && A.warn("The disableStats option is deprecated in favor of enableStats");
2195
- }
2196
- let Ht = (e, t) => {
2197
- var n = "socket_id=" + encodeURIComponent(e.socketId);
2198
- for (var r in t.params) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(t.params[r]);
2199
- if (t.paramsProvider != null) {
2200
- let e = t.paramsProvider();
2201
- for (var r in e) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e[r]);
2202
- }
2203
- return n;
2204
- }, Ut = (e) => {
2205
- if (Y.getAuthorizers()[e.transport] === void 0) throw `'${e.transport}' is not a recognized auth transport`;
2206
- return (t, n) => {
2207
- let r = Ht(t, e);
2208
- Y.getAuthorizers()[e.transport](Y, r, e, d.UserAuthentication, n);
2209
- };
2210
- }, Wt = (e, t) => {
2211
- var n = "socket_id=" + encodeURIComponent(e.socketId);
2212
- for (var r in n += "&channel_name=" + encodeURIComponent(e.channelName), t.params) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(t.params[r]);
2213
- if (t.paramsProvider != null) {
2214
- let e = t.paramsProvider();
2215
- for (var r in e) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e[r]);
2216
- }
2217
- return n;
2218
- }, Gt = (e) => {
2219
- if (Y.getAuthorizers()[e.transport] === void 0) throw `'${e.transport}' is not a recognized auth transport`;
2220
- return (t, n) => {
2221
- let r = Wt(t, e);
2222
- Y.getAuthorizers()[e.transport](Y, r, e, d.ChannelAuthorization, n);
2223
- };
2224
- }, Kt = (e, t, n) => {
2225
- let r = {
2226
- authTransport: t.transport,
2227
- authEndpoint: t.endpoint,
2228
- auth: {
2229
- params: t.params,
2230
- headers: t.headers
2231
- }
2232
- };
2233
- return (t, i) => {
2234
- n(e.channel(t.channelName), r).authorize(t.socketId, i);
2235
- };
2236
- };
2237
- function qt(e, t) {
2238
- let n = {
2239
- activityTimeout: e.activityTimeout || a.activityTimeout,
2240
- cluster: e.cluster,
2241
- httpPath: e.httpPath || a.httpPath,
2242
- httpPort: e.httpPort || a.httpPort,
2243
- httpsPort: e.httpsPort || a.httpsPort,
2244
- pongTimeout: e.pongTimeout || a.pongTimeout,
2245
- statsHost: e.statsHost || a.stats_host,
2246
- unavailableTimeout: e.unavailableTimeout || a.unavailableTimeout,
2247
- wsPath: e.wsPath || a.wsPath,
2248
- wsPort: e.wsPort || a.wsPort,
2249
- wssPort: e.wssPort || a.wssPort,
2250
- enableStats: Qt(e),
2251
- httpHost: Jt(e),
2252
- useTLS: Zt(e),
2253
- wsHost: Yt(e),
2254
- userAuthenticator: en(e),
2255
- channelAuthorizer: nn(e, t)
2256
- };
2257
- return "disabledTransports" in e && (n.disabledTransports = e.disabledTransports), "enabledTransports" in e && (n.enabledTransports = e.enabledTransports), "ignoreNullOrigin" in e && (n.ignoreNullOrigin = e.ignoreNullOrigin), "timelineParams" in e && (n.timelineParams = e.timelineParams), "nacl" in e && (n.nacl = e.nacl), n;
2258
- }
2259
- function Jt(e) {
2260
- return e.httpHost ? e.httpHost : e.cluster ? `sockjs-${e.cluster}.pusher.com` : a.httpHost;
2261
- }
2262
- function Yt(e) {
2263
- return e.wsHost ? e.wsHost : Xt(e.cluster);
2264
- }
2265
- function Xt(e) {
2266
- return `ws-${e}.pusher.com`;
2267
- }
2268
- function Zt(e) {
2269
- return Y.getProtocol() === "https:" ? !0 : e.forceTLS !== !1;
2270
- }
2271
- function Qt(e) {
2272
- return "enableStats" in e ? e.enableStats : "disableStats" in e ? !e.disableStats : !1;
2273
- }
2274
- let $t = (e) => "customHandler" in e && e.customHandler != null;
2275
- function en(e) {
2276
- let t = Object.assign(Object.assign({}, a.userAuthentication), e.userAuthentication);
2277
- return $t(t) ? t.customHandler : Ut(t);
2278
- }
2279
- function tn(e, t) {
2280
- let n;
2281
- if ("channelAuthorization" in e) n = Object.assign(Object.assign({}, a.channelAuthorization), e.channelAuthorization);
2282
- else if (n = {
2283
- transport: e.authTransport || a.authTransport,
2284
- endpoint: e.authEndpoint || a.authEndpoint
2285
- }, "auth" in e && ("params" in e.auth && (n.params = e.auth.params), "headers" in e.auth && (n.headers = e.auth.headers)), "authorizer" in e) return { customHandler: Kt(t, n, e.authorizer) };
2286
- return n;
2287
- }
2288
- function nn(e, t) {
2289
- let n = tn(e, t);
2290
- return $t(n) ? n.customHandler : Gt(n);
2291
- }
2292
- class rn extends P {
2293
- constructor(e) {
2294
- super(function(e, t) {
2295
- A.debug(`No callbacks on watchlist events for ${e}`);
2296
- }), this.pusher = e, this.bindWatchlistInternalEvent();
2297
- }
2298
- handleEvent(e) {
2299
- e.data.events.forEach((e) => {
2300
- this.emit(e.name, e);
2301
- });
2302
- }
2303
- bindWatchlistInternalEvent() {
2304
- this.pusher.connection.bind("message", (e) => {
2305
- e.event === "pusher_internal:watchlist_events" && this.handleEvent(e);
2306
- });
2307
- }
2308
- }
2309
- function an() {
2310
- let e, t;
2311
- return {
2312
- promise: new Promise((n, r) => {
2313
- e = n, t = r;
2314
- }),
2315
- resolve: e,
2316
- reject: t
2317
- };
2318
- }
2319
- let on = an;
2320
- class sn extends P {
2321
- constructor(e) {
2322
- super(function(e, t) {
2323
- A.debug("No callbacks on user for " + e);
2324
- }), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (e, t) => {
2325
- if (e) {
2326
- A.warn(`Error during signin: ${e}`), this._cleanup();
2327
- return;
2328
- }
2329
- this.pusher.send_event("pusher:signin", {
2330
- auth: t.auth,
2331
- user_data: t.user_data
2332
- });
2333
- }, this.pusher = e, this.pusher.connection.bind("state_change", ({ previous: e, current: t }) => {
2334
- e !== "connected" && t === "connected" && this._signin(), e === "connected" && t !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
2335
- }), this.watchlist = new rn(e), this.pusher.connection.bind("message", (e) => {
2336
- e.event === "pusher:signin_success" && this._onSigninSuccess(e.data), this.serverToUserChannel && this.serverToUserChannel.name === e.channel && this.serverToUserChannel.handleEvent(e);
2337
- });
2338
- }
2339
- signin() {
2340
- this.signin_requested || (this.signin_requested = !0, this._signin());
2341
- }
2342
- _signin() {
2343
- this.signin_requested && (this._newSigninPromiseIfNeeded(), this.pusher.connection.state === "connected" && this.pusher.config.userAuthenticator({ socketId: this.pusher.connection.socket_id }, this._onAuthorize));
2344
- }
2345
- _onSigninSuccess(e) {
2346
- try {
2347
- this.user_data = JSON.parse(e.user_data);
2348
- } catch {
2349
- A.error(`Failed parsing user data after signin: ${e.user_data}`), this._cleanup();
2350
- return;
2351
- }
2352
- if (typeof this.user_data.id != "string" || this.user_data.id === "") {
2353
- A.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
2354
- return;
2355
- }
2356
- this._signinDoneResolve(), this._subscribeChannels();
2357
- }
2358
- _subscribeChannels() {
2359
- let e = (e) => {
2360
- e.subscriptionPending && e.subscriptionCancelled ? e.reinstateSubscription() : !e.subscriptionPending && this.pusher.connection.state === "connected" && e.subscribe();
2361
- };
2362
- this.serverToUserChannel = new R(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((e, t) => {
2363
- e.indexOf("pusher_internal:") === 0 || e.indexOf("pusher:") === 0 || this.emit(e, t);
2364
- }), e(this.serverToUserChannel);
2365
- }
2366
- _cleanup() {
2367
- this.user_data = null, this.serverToUserChannel &&= (this.serverToUserChannel.unbind_all(), this.serverToUserChannel.disconnect(), null), this.signin_requested && this._signinDoneResolve();
2368
- }
2369
- _newSigninPromiseIfNeeded() {
2370
- if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done) return;
2371
- let { promise: e, resolve: t, reject: n } = on();
2372
- e.done = !1;
2373
- let r = () => {
2374
- e.done = !0;
2375
- };
2376
- e.then(r).catch(r), this.signinDonePromise = e, this._signinDoneResolve = t;
2377
- }
2378
- }
2379
- class Q {
2380
- static ready() {
2381
- Q.isReady = !0;
2382
- for (var e = 0, t = Q.instances.length; e < t; e++) Q.instances[e].connect();
2383
- }
2384
- static getClientFeatures() {
2385
- return he(be({ ws: Y.Transports.ws }, function(e) {
2386
- return e.isSupported({});
2387
- }));
2388
- }
2389
- constructor(e, t) {
2390
- cn(e), Vt(t), this.key = e, this.options = t, this.config = qt(this.options, this), this.channels = V.createChannels(), this.global_emitter = new P(), this.sessionID = Y.randomInt(1e9), this.timeline = new Ft(this.key, this.sessionID, {
2391
- cluster: this.config.cluster,
2392
- features: Q.getClientFeatures(),
2393
- params: this.config.timelineParams || {},
2394
- limit: 50,
2395
- level: Z.INFO,
2396
- version: a.VERSION
2397
- }), this.config.enableStats && (this.timelineSender = V.createTimelineSender(this.timeline, {
2398
- host: this.config.statsHost,
2399
- path: "/timeline/v2/" + Y.TimelineTransport.name
2400
- }));
2401
- var n = (e) => Y.getDefaultStrategy(this.config, e, zt);
2402
- this.connection = V.createConnectionManager(this.key, {
2403
- getStrategy: n,
2404
- timeline: this.timeline,
2405
- activityTimeout: this.config.activityTimeout,
2406
- pongTimeout: this.config.pongTimeout,
2407
- unavailableTimeout: this.config.unavailableTimeout,
2408
- useTLS: !!this.config.useTLS
2409
- }), this.connection.bind("connected", () => {
2410
- this.subscribeAll(), this.timelineSender && this.timelineSender.send(this.connection.isUsingTLS());
2411
- }), this.connection.bind("message", (e) => {
2412
- var t = e.event.indexOf("pusher_internal:") === 0;
2413
- if (e.channel) {
2414
- var n = this.channel(e.channel);
2415
- n && n.handleEvent(e);
2416
- }
2417
- t || this.global_emitter.emit(e.event, e.data);
2418
- }), this.connection.bind("connecting", () => {
2419
- this.channels.disconnect();
2420
- }), this.connection.bind("disconnected", () => {
2421
- this.channels.disconnect();
2422
- }), this.connection.bind("error", (e) => {
2423
- A.warn(e);
2424
- }), Q.instances.push(this), this.timeline.info({ instances: Q.instances.length }), this.user = new sn(this), Q.isReady && this.connect();
2425
- }
2426
- switchCluster(e) {
2427
- let { appKey: t, cluster: n } = e;
2428
- this.key = t, this.options = Object.assign(Object.assign({}, this.options), { cluster: n }), this.config = qt(this.options, this), this.connection.switchCluster(this.key);
2429
- }
2430
- channel(e) {
2431
- return this.channels.find(e);
2432
- }
2433
- allChannels() {
2434
- return this.channels.all();
2435
- }
2436
- connect() {
2437
- if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
2438
- var e = this.connection.isUsingTLS(), t = this.timelineSender;
2439
- this.timelineSenderTimer = new pe(6e4, function() {
2440
- t.send(e);
2441
- });
2442
- }
2443
- }
2444
- disconnect() {
2445
- this.connection.disconnect(), this.timelineSenderTimer &&= (this.timelineSenderTimer.ensureAborted(), null);
2446
- }
2447
- bind(e, t, n) {
2448
- return this.global_emitter.bind(e, t, n), this;
2449
- }
2450
- unbind(e, t, n) {
2451
- return this.global_emitter.unbind(e, t, n), this;
2452
- }
2453
- bind_global(e) {
2454
- return this.global_emitter.bind_global(e), this;
2455
- }
2456
- unbind_global(e) {
2457
- return this.global_emitter.unbind_global(e), this;
2458
- }
2459
- unbind_all(e) {
2460
- return this.global_emitter.unbind_all(), this;
2461
- }
2462
- subscribeAll() {
2463
- for (var e in this.channels.channels) this.channels.channels.hasOwnProperty(e) && this.subscribe(e);
2464
- }
2465
- subscribe(e) {
2466
- var t = this.channels.add(e, this);
2467
- return t.subscriptionPending && t.subscriptionCancelled ? t.reinstateSubscription() : !t.subscriptionPending && this.connection.state === "connected" && t.subscribe(), t;
2468
- }
2469
- unsubscribe(e) {
2470
- var t = this.channels.find(e);
2471
- t && t.subscriptionPending ? t.cancelSubscription() : (t = this.channels.remove(e), t && t.subscribed && t.unsubscribe());
2472
- }
2473
- send_event(e, t, n) {
2474
- return this.connection.send_event(e, t, n);
2475
- }
2476
- shouldUseTLS() {
2477
- return this.config.useTLS;
2478
- }
2479
- signin() {
2480
- this.user.signin();
2481
- }
2482
- }
2483
- Q.instances = [], Q.isReady = !1, Q.logToConsole = !1, Q.Runtime = Y, Q.ScriptReceivers = Y.ScriptReceivers, Q.DependenciesReceivers = Y.DependenciesReceivers, Q.auth_callbacks = Y.auth_callbacks;
2484
- let $ = Q;
2485
- function cn(e) {
2486
- if (e == null) throw "You must pass your app key when you instantiate Pusher.";
2487
- }
2488
- Y.setup(Q);
2489
- }
2490
- }, t = {};
2491
- function n(r) {
2492
- var i = t[r];
2493
- if (i !== void 0) return i.exports;
2494
- var a = t[r] = { exports: {} };
2495
- return e[r].call(a.exports, a, a.exports, n), a.exports;
2496
- }
2497
- return n.d = (e, t) => {
2498
- for (var r in t) n.o(t, r) && !n.o(e, r) && Object.defineProperty(e, r, {
2499
- enumerable: !0,
2500
- get: t[r]
2501
- });
2502
- }, n.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t), n(721);
2503
- })());
2504
- }));
2505
- //#endregion
2506
- export { t };
2507
-
2508
- //# sourceMappingURL=pusher-CDbNlZBE.js.map