@commentkit/comment-kit 0.6.7 → 0.6.9

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