django-cfg 1.4.84__py3-none-any.whl → 1.4.85__py3-none-any.whl
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.
Potentially problematic release.
This version of django-cfg might be problematic. Click here for more details.
- django_cfg/__init__.py +1 -1
- django_cfg/apps/dashboard/serializers/__init__.py +55 -0
- django_cfg/apps/dashboard/serializers/activity.py +38 -0
- django_cfg/apps/dashboard/serializers/apizones.py +26 -0
- django_cfg/apps/dashboard/serializers/base.py +16 -0
- django_cfg/apps/dashboard/serializers/charts.py +44 -0
- django_cfg/apps/dashboard/serializers/commands.py +26 -0
- django_cfg/apps/dashboard/serializers/overview.py +34 -0
- django_cfg/apps/dashboard/serializers/statistics.py +46 -0
- django_cfg/apps/dashboard/serializers/system.py +58 -0
- django_cfg/apps/dashboard/services/__init__.py +10 -1
- django_cfg/apps/dashboard/services/apizones_service.py +119 -0
- django_cfg/apps/dashboard/services/charts_service.py +266 -0
- django_cfg/apps/dashboard/services/commands_service.py +142 -0
- django_cfg/apps/dashboard/services/statistics_service.py +262 -104
- django_cfg/apps/dashboard/urls.py +25 -6
- django_cfg/apps/dashboard/views/__init__.py +23 -0
- django_cfg/apps/dashboard/views/activity_views.py +83 -0
- django_cfg/apps/dashboard/views/apizones_views.py +73 -0
- django_cfg/apps/dashboard/views/charts_views.py +159 -0
- django_cfg/apps/dashboard/views/commands_views.py +73 -0
- django_cfg/apps/dashboard/views/overview_views.py +92 -0
- django_cfg/apps/dashboard/views/statistics_views.py +105 -0
- django_cfg/apps/dashboard/views/system_views.py +73 -0
- django_cfg/modules/django_unfold/callbacks/main.py +7 -6
- django_cfg/modules/django_unfold/dashboard.py +1 -36
- django_cfg/modules/django_unfold/models/config.py +102 -73
- django_cfg/modules/django_unfold/tailwind.py +31 -79
- django_cfg/pyproject.toml +1 -1
- django_cfg/static/frontend/admin/404.html +1 -1
- django_cfg/static/frontend/admin/500.html +1 -1
- django_cfg/static/frontend/admin/_next/static/BembwiEtlu4eFl3OX7n1k/_buildManifest.js +1 -0
- django_cfg/static/frontend/admin/_next/static/chunks/23004-faae121bbfecc163.js +1 -0
- django_cfg/static/frontend/admin/_next/static/chunks/{20695.a7d37b6c40ad3f58.js → 43076.55dd23b6cd68edb0.js} +1 -1
- django_cfg/static/frontend/admin/_next/static/chunks/50314-3b9d15242191c8bc.js +1 -0
- django_cfg/static/frontend/admin/_next/static/chunks/{64330.2ef79bccd7d4e363.js → 64330.41858e98c0e5173b.js} +1 -1
- django_cfg/static/frontend/admin/_next/static/chunks/6766.8d01e44e83070e83.js +1 -0
- django_cfg/static/frontend/admin/_next/static/chunks/{96168.eb7fdb721b9cdb00.js → 96168.b7197f890097df6e.js} +1 -1
- django_cfg/static/frontend/admin/_next/static/chunks/pages/{404-c283223d1afd02a2.js → 404-cf71cd7b3cb005e5.js} +1 -1
- django_cfg/static/frontend/admin/_next/static/chunks/pages/{500-389d6d3e1f2f7fda.js → 500-ff19c7842e3df415.js} +1 -1
- django_cfg/static/frontend/admin/_next/static/chunks/pages/_app-f62e5528fbcbb6b3.js +272 -0
- django_cfg/static/frontend/admin/_next/static/chunks/pages/{_error-5291033275c26d09.js → _error-87f3fdc2aa131e77.js} +1 -1
- django_cfg/static/frontend/admin/_next/static/chunks/pages/{index-d7bc30185f52cbca.js → index-69f737d4802cc5b7.js} +1 -1
- django_cfg/static/frontend/admin/_next/static/chunks/pages/private/centrifugo-f24beb6ed3955aa8.js +1 -0
- django_cfg/static/frontend/admin/_next/static/chunks/pages/private/{profile-e93a65e8e7d9022b.js → profile-b8045f993287f1a7.js} +1 -1
- django_cfg/static/frontend/admin/_next/static/chunks/pages/private/{ui-669e8f2a785beba2.js → ui-373fff8b42878e64.js} +1 -1
- django_cfg/static/frontend/admin/_next/static/chunks/pages/private-fe9faa86ecdb0ce6.js +1 -0
- django_cfg/static/frontend/admin/_next/static/chunks/{webpack-92add5f95c66e349.js → webpack-7c456a65e96eb97e.js} +1 -1
- django_cfg/static/frontend/admin/_next/static/css/5f9a37b6e6a72303.css +3 -0
- django_cfg/static/frontend/admin/auth.html +1 -1
- django_cfg/static/frontend/admin/index.html +1 -1
- django_cfg/static/frontend/admin/legal/cookies.html +1 -1
- django_cfg/static/frontend/admin/legal/privacy.html +1 -1
- django_cfg/static/frontend/admin/legal/security.html +1 -1
- django_cfg/static/frontend/admin/legal/terms.html +1 -1
- django_cfg/static/frontend/admin/private/centrifugo.html +1 -1
- django_cfg/static/frontend/admin/private/profile.html +1 -1
- django_cfg/static/frontend/admin/private/ui.html +1 -1
- django_cfg/static/frontend/admin/private.html +1 -1
- django_cfg/templates/admin/index.html +237 -5
- django_cfg/templates/admin/sections/commands_section.html +5 -0
- django_cfg/templates/admin/sections/documentation_section.html +5 -0
- django_cfg/templates/admin/sections/overview_section.html +5 -0
- django_cfg/templates/admin/sections/stats_section.html +5 -0
- django_cfg/templates/admin/sections/system_section.html +5 -0
- django_cfg/templates/admin/sections/widgets_section.html +11 -0
- django_cfg/templates/unfold/layouts/skeleton.html +27 -0
- django_cfg/templatetags/django_cfg.py +53 -0
- {django_cfg-1.4.84.dist-info → django_cfg-1.4.85.dist-info}/METADATA +1 -1
- {django_cfg-1.4.84.dist-info → django_cfg-1.4.85.dist-info}/RECORD +74 -51
- django_cfg/apps/dashboard/api/__init__.py +0 -27
- django_cfg/apps/dashboard/api/serializers.py +0 -165
- django_cfg/apps/dashboard/api/viewsets.py +0 -257
- django_cfg/static/frontend/admin/_next/static/-Zk0eDB7OJOEFrFyR5BwZ/_buildManifest.js +0 -1
- django_cfg/static/frontend/admin/_next/static/chunks/43076-4be6a9794e9c3e8b.js +0 -1
- django_cfg/static/frontend/admin/_next/static/chunks/50314-79c02212788f1ec7.js +0 -1
- django_cfg/static/frontend/admin/_next/static/chunks/6766.d62fed7cd4761148.js +0 -1
- django_cfg/static/frontend/admin/_next/static/chunks/82296-a2c8d38f62224be5.js +0 -1
- django_cfg/static/frontend/admin/_next/static/chunks/pages/_app-f25bec36bbdc9625.js +0 -272
- django_cfg/static/frontend/admin/_next/static/chunks/pages/private/centrifugo-22532c65971225eb.js +0 -1
- django_cfg/static/frontend/admin/_next/static/chunks/pages/private-a8a9ba76f2c75354.js +0 -1
- django_cfg/static/frontend/admin/_next/static/css/78d677ac1677c210.css +0 -3
- /django_cfg/static/frontend/admin/_next/static/{-Zk0eDB7OJOEFrFyR5BwZ → BembwiEtlu4eFl3OX7n1k}/_ssgManifest.js +0 -0
- {django_cfg-1.4.84.dist-info → django_cfg-1.4.85.dist-info}/WHEEL +0 -0
- {django_cfg-1.4.84.dist-info → django_cfg-1.4.85.dist-info}/entry_points.txt +0 -0
- {django_cfg-1.4.84.dist-info → django_cfg-1.4.85.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Dashboard API ViewSets
|
|
3
|
-
|
|
4
|
-
Provides RESTful endpoints for dashboard data.
|
|
5
|
-
No ORM dependencies - uses services for data collection.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import logging
|
|
9
|
-
from datetime import datetime
|
|
10
|
-
from typing import Any, Dict
|
|
11
|
-
|
|
12
|
-
from drf_spectacular.utils import OpenApiParameter, OpenApiResponse, extend_schema, inline_serializer
|
|
13
|
-
from drf_spectacular.types import OpenApiTypes
|
|
14
|
-
from rest_framework import serializers, status, viewsets
|
|
15
|
-
from rest_framework.authentication import BasicAuthentication, SessionAuthentication
|
|
16
|
-
from rest_framework.decorators import action
|
|
17
|
-
from rest_framework.permissions import IsAdminUser
|
|
18
|
-
from rest_framework.response import Response
|
|
19
|
-
|
|
20
|
-
from ..services import StatisticsService, SystemHealthService
|
|
21
|
-
from .serializers import (
|
|
22
|
-
ActivityEntrySerializer,
|
|
23
|
-
APIResponseSerializer,
|
|
24
|
-
AppStatisticsSerializer,
|
|
25
|
-
DashboardOverviewSerializer,
|
|
26
|
-
QuickActionSerializer,
|
|
27
|
-
StatCardSerializer,
|
|
28
|
-
SystemHealthItemSerializer,
|
|
29
|
-
SystemHealthSerializer,
|
|
30
|
-
SystemMetricsSerializer,
|
|
31
|
-
UserStatisticsSerializer,
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
logger = logging.getLogger(__name__)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class DashboardViewSet(viewsets.GenericViewSet):
|
|
38
|
-
"""
|
|
39
|
-
Dashboard Data ViewSet
|
|
40
|
-
|
|
41
|
-
Provides comprehensive dashboard endpoints for Next.js frontend.
|
|
42
|
-
All data is collected via services without ORM dependencies.
|
|
43
|
-
|
|
44
|
-
%%PRIORITY:HIGH%%
|
|
45
|
-
%%AI_HINT: Main entry point for dashboard API%%
|
|
46
|
-
|
|
47
|
-
TAGS: dashboard, api, viewset
|
|
48
|
-
USED_BY: Next.js admin panel
|
|
49
|
-
"""
|
|
50
|
-
|
|
51
|
-
authentication_classes = [SessionAuthentication, BasicAuthentication]
|
|
52
|
-
permission_classes = [IsAdminUser]
|
|
53
|
-
serializer_class = DashboardOverviewSerializer
|
|
54
|
-
|
|
55
|
-
@action(detail=False, methods=['get'], url_path='overview')
|
|
56
|
-
@extend_schema(
|
|
57
|
-
summary="Get dashboard overview",
|
|
58
|
-
description="Retrieve complete dashboard data including stats, health, actions, and metrics",
|
|
59
|
-
responses={200: DashboardOverviewSerializer},
|
|
60
|
-
tags=["Dashboard"]
|
|
61
|
-
)
|
|
62
|
-
def overview(self, request):
|
|
63
|
-
"""
|
|
64
|
-
Get complete dashboard overview.
|
|
65
|
-
|
|
66
|
-
Returns all dashboard data in a single request:
|
|
67
|
-
- Statistics cards
|
|
68
|
-
- System health status
|
|
69
|
-
- Quick actions
|
|
70
|
-
- Recent activity
|
|
71
|
-
- System metrics
|
|
72
|
-
- User statistics
|
|
73
|
-
"""
|
|
74
|
-
try:
|
|
75
|
-
stats_service = StatisticsService()
|
|
76
|
-
health_service = SystemHealthService()
|
|
77
|
-
|
|
78
|
-
data = {
|
|
79
|
-
'stat_cards': stats_service.get_stat_cards(),
|
|
80
|
-
'system_health': health_service.get_all_health_checks(),
|
|
81
|
-
'quick_actions': health_service.get_quick_actions(),
|
|
82
|
-
'recent_activity': stats_service.get_recent_activity(limit=10),
|
|
83
|
-
'system_metrics': stats_service.get_system_metrics(),
|
|
84
|
-
'user_statistics': stats_service.get_user_statistics(),
|
|
85
|
-
'timestamp': datetime.now().isoformat(),
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return Response(data)
|
|
89
|
-
|
|
90
|
-
except Exception as e:
|
|
91
|
-
logger.error(f"Dashboard overview API error: {e}", exc_info=True)
|
|
92
|
-
return Response({
|
|
93
|
-
'error': str(e)
|
|
94
|
-
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
95
|
-
|
|
96
|
-
@extend_schema(
|
|
97
|
-
summary="Get statistics cards",
|
|
98
|
-
description="Retrieve dashboard statistics cards with key metrics",
|
|
99
|
-
responses=StatCardSerializer(many=True),
|
|
100
|
-
tags=["dashboard"]
|
|
101
|
-
)
|
|
102
|
-
@action(detail=False, methods=['get'], url_path='stats/cards', pagination_class=None, serializer_class=StatCardSerializer)
|
|
103
|
-
def stat_cards(self, request):
|
|
104
|
-
"""Get dashboard statistics cards."""
|
|
105
|
-
try:
|
|
106
|
-
stats_service = StatisticsService()
|
|
107
|
-
cards = stats_service.get_stat_cards()
|
|
108
|
-
|
|
109
|
-
return Response(cards)
|
|
110
|
-
|
|
111
|
-
except Exception as e:
|
|
112
|
-
logger.error(f"Stat cards API error: {e}")
|
|
113
|
-
return Response({
|
|
114
|
-
'error': str(e)
|
|
115
|
-
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
116
|
-
|
|
117
|
-
@extend_schema(
|
|
118
|
-
summary="Get system health status",
|
|
119
|
-
description="Retrieve overall system health including all component checks",
|
|
120
|
-
responses={200: SystemHealthSerializer},
|
|
121
|
-
tags=["dashboard"]
|
|
122
|
-
)
|
|
123
|
-
@action(detail=False, methods=['get'], url_path='health', serializer_class=SystemHealthSerializer)
|
|
124
|
-
def system_health(self, request):
|
|
125
|
-
"""Get overall system health status."""
|
|
126
|
-
try:
|
|
127
|
-
health_service = SystemHealthService()
|
|
128
|
-
health_data = health_service.get_overall_health_status()
|
|
129
|
-
|
|
130
|
-
return Response(health_data)
|
|
131
|
-
|
|
132
|
-
except Exception as e:
|
|
133
|
-
logger.error(f"System health API error: {e}")
|
|
134
|
-
return Response({
|
|
135
|
-
'error': str(e)
|
|
136
|
-
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
137
|
-
|
|
138
|
-
@extend_schema(
|
|
139
|
-
summary="Get quick actions",
|
|
140
|
-
description="Retrieve quick action buttons for dashboard",
|
|
141
|
-
responses=QuickActionSerializer(many=True),
|
|
142
|
-
tags=["Dashboard"]
|
|
143
|
-
)
|
|
144
|
-
@action(detail=False, methods=['get'], url_path='actions', pagination_class=None, serializer_class=QuickActionSerializer)
|
|
145
|
-
def quick_actions(self, request):
|
|
146
|
-
"""Get quick action buttons."""
|
|
147
|
-
try:
|
|
148
|
-
health_service = SystemHealthService()
|
|
149
|
-
actions = health_service.get_quick_actions()
|
|
150
|
-
|
|
151
|
-
return Response(actions)
|
|
152
|
-
|
|
153
|
-
except Exception as e:
|
|
154
|
-
logger.error(f"Quick actions API error: {e}")
|
|
155
|
-
return Response({
|
|
156
|
-
'error': str(e)
|
|
157
|
-
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
158
|
-
|
|
159
|
-
@extend_schema(
|
|
160
|
-
summary="Get recent activity",
|
|
161
|
-
description="Retrieve recent system activity entries",
|
|
162
|
-
parameters=[
|
|
163
|
-
OpenApiParameter(
|
|
164
|
-
name='limit',
|
|
165
|
-
description='Maximum number of entries to return',
|
|
166
|
-
required=False,
|
|
167
|
-
type=int,
|
|
168
|
-
default=10
|
|
169
|
-
),
|
|
170
|
-
],
|
|
171
|
-
responses=ActivityEntrySerializer(many=True),
|
|
172
|
-
tags=["dashboard"]
|
|
173
|
-
)
|
|
174
|
-
@action(detail=False, methods=['get'], url_path='activity', pagination_class=None, serializer_class=ActivityEntrySerializer)
|
|
175
|
-
def recent_activity(self, request):
|
|
176
|
-
"""Get recent activity entries."""
|
|
177
|
-
try:
|
|
178
|
-
limit = int(request.query_params.get('limit', 10))
|
|
179
|
-
stats_service = StatisticsService()
|
|
180
|
-
activity = stats_service.get_recent_activity(limit=limit)
|
|
181
|
-
|
|
182
|
-
return Response(activity)
|
|
183
|
-
|
|
184
|
-
except Exception as e:
|
|
185
|
-
logger.error(f"Recent activity API error: {e}")
|
|
186
|
-
return Response({
|
|
187
|
-
'error': str(e)
|
|
188
|
-
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
189
|
-
|
|
190
|
-
@extend_schema(
|
|
191
|
-
summary="Get system metrics",
|
|
192
|
-
description="Retrieve system performance metrics (CPU, memory, disk, etc.)",
|
|
193
|
-
responses={200: SystemMetricsSerializer},
|
|
194
|
-
tags=["dashboard"]
|
|
195
|
-
)
|
|
196
|
-
@action(detail=False, methods=['get'], url_path='metrics', serializer_class=SystemMetricsSerializer)
|
|
197
|
-
def system_metrics(self, request):
|
|
198
|
-
"""Get system performance metrics."""
|
|
199
|
-
try:
|
|
200
|
-
stats_service = StatisticsService()
|
|
201
|
-
metrics = stats_service.get_system_metrics()
|
|
202
|
-
|
|
203
|
-
return Response(metrics)
|
|
204
|
-
|
|
205
|
-
except Exception as e:
|
|
206
|
-
logger.error(f"System metrics API error: {e}")
|
|
207
|
-
return Response({
|
|
208
|
-
'error': str(e)
|
|
209
|
-
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
210
|
-
|
|
211
|
-
@extend_schema(
|
|
212
|
-
summary="Get user statistics",
|
|
213
|
-
description="Retrieve user-related statistics",
|
|
214
|
-
responses={200: UserStatisticsSerializer},
|
|
215
|
-
tags=["dashboard"]
|
|
216
|
-
)
|
|
217
|
-
@action(detail=False, methods=['get'], url_path='stats/users', serializer_class=UserStatisticsSerializer)
|
|
218
|
-
def user_statistics(self, request):
|
|
219
|
-
"""Get user statistics."""
|
|
220
|
-
try:
|
|
221
|
-
stats_service = StatisticsService()
|
|
222
|
-
user_stats = stats_service.get_user_statistics()
|
|
223
|
-
|
|
224
|
-
return Response(user_stats)
|
|
225
|
-
|
|
226
|
-
except Exception as e:
|
|
227
|
-
logger.error(f"User statistics API error: {e}")
|
|
228
|
-
return Response({
|
|
229
|
-
'error': str(e)
|
|
230
|
-
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
231
|
-
|
|
232
|
-
@extend_schema(
|
|
233
|
-
summary="Get application statistics",
|
|
234
|
-
description="Retrieve statistics for all enabled django-cfg applications",
|
|
235
|
-
responses=AppStatisticsSerializer(many=True),
|
|
236
|
-
tags=["dashboard"]
|
|
237
|
-
)
|
|
238
|
-
@action(detail=False, methods=['get'], url_path='stats/apps', pagination_class=None, serializer_class=AppStatisticsSerializer)
|
|
239
|
-
def app_statistics(self, request):
|
|
240
|
-
"""Get application-specific statistics."""
|
|
241
|
-
try:
|
|
242
|
-
stats_service = StatisticsService()
|
|
243
|
-
app_stats = stats_service.get_app_statistics()
|
|
244
|
-
|
|
245
|
-
# Convert dict to list of {app_name, statistics} objects
|
|
246
|
-
data = [
|
|
247
|
-
{'app_name': app_name, 'statistics': stats}
|
|
248
|
-
for app_name, stats in app_stats.items()
|
|
249
|
-
]
|
|
250
|
-
|
|
251
|
-
return Response(data)
|
|
252
|
-
|
|
253
|
-
except Exception as e:
|
|
254
|
-
logger.error(f"App statistics API error: {e}")
|
|
255
|
-
return Response({
|
|
256
|
-
'error': str(e)
|
|
257
|
-
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(e,a,s,t){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:s,bitArray:[]},__routerFilterDynamic:{numItems:e,errorRate:1e-4,numBits:e,numHashes:s,bitArray:[]},"/":["static/chunks/pages/index-d7bc30185f52cbca.js"],"/404":["static/chunks/pages/404-c283223d1afd02a2.js"],"/500":["static/chunks/pages/500-389d6d3e1f2f7fda.js"],"/_error":["static/chunks/pages/_error-5291033275c26d09.js"],"/auth":["static/chunks/pages/auth-a872607f98742e5a.js"],"/legal/cookies":["static/chunks/pages/legal/cookies-b39c7f22c066e2c6.js"],"/legal/privacy":["static/chunks/pages/legal/privacy-5aedad0cf3a4f80f.js"],"/legal/security":["static/chunks/pages/legal/security-dbd854d0d5d483e2.js"],"/legal/terms":["static/chunks/pages/legal/terms-f3e1d2b9e5edf12f.js"],"/private":["static/chunks/82296-a2c8d38f62224be5.js",t,"static/chunks/pages/private-a8a9ba76f2c75354.js"],"/private/centrifugo":["static/chunks/43076-4be6a9794e9c3e8b.js",t,"static/chunks/pages/private/centrifugo-22532c65971225eb.js"],"/private/profile":["static/chunks/pages/private/profile-e93a65e8e7d9022b.js"],"/private/ui":["static/chunks/pages/private/ui-669e8f2a785beba2.js"],sortedPages:["/","/404","/500","/_app","/_error","/auth","/legal/cookies","/legal/privacy","/legal/security","/legal/terms","/private","/private/centrifugo","/private/profile","/private/ui"]}}(0,1e-4,NaN,"static/chunks/50314-79c02212788f1ec7.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[43076],{3032:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7737:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},13121:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},13330:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},21936:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]])},26457:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("test-tube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]])},35685:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]])},47019:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},47857:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},51352:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},53765:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},55833:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},57147:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},58526:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]])},68332:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]])},69489:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]])},69673:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},71964:(e,t,s)=>{function i(e,t,s,i){return new(s||(s=Promise))(function(n,r){function o(e){try{c(i.next(e))}catch(e){r(e)}}function a(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())})}s.d(t,{Ft:()=>B}),"function"==typeof SuppressedError&&SuppressedError;var n,r,o,a,c,h,l,u,d,_={exports:{}},p="object"==typeof Reflect?Reflect:null,f=p&&"function"==typeof p.apply?p.apply:function(e,t,s){return Function.prototype.apply.call(e,t,s)};n=p&&"function"==typeof p.ownKeys?p.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var b=Number.isNaN||function(e){return e!=e};function g(){g.init.call(this)}_.exports=g,_.exports.once=function(e,t){return new Promise(function(s,i){var n,r,o;function a(s){e.removeListener(t,c),i(s)}function c(){"function"==typeof e.removeListener&&e.removeListener("error",a),s([].slice.call(arguments))}x(e,t,c,{once:!0}),"error"!==t&&(n=e,r=a,o={once:!0},"function"==typeof n.on&&x(n,"error",r,o))})},g.EventEmitter=g,g.prototype._events=void 0,g.prototype._eventsCount=0,g.prototype._maxListeners=void 0;var m=10;function v(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function y(e){return void 0===e._maxListeners?g.defaultMaxListeners:e._maxListeners}function k(e,t,s,i){if(v(s),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,s.listener?s.listener:s),r=e._events),o=r[t]),void 0===o)o=r[t]=s,++e._eventsCount;else if("function"==typeof o?o=r[t]=i?[s,o]:[o,s]:i?o.unshift(s):o.push(s),(n=y(e))>0&&o.length>n&&!o.warned){o.warned=!0;var n,r,o,a=Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,console&&console.warn&&console.warn(a)}return e}function T(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S(e,t,s){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:s},n=T.bind(i);return n.listener=s,i.wrapFn=n,n}function w(e,t,s){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?s?[n.listener||n]:[n]:s?function(e){for(var t=Array(e.length),s=0;s<t.length;++s)t[s]=e[s].listener||e[s];return t}(n):E(n,n.length)}function C(e){var t=this._events;if(void 0!==t){var s=t[e];if("function"==typeof s)return 1;if(void 0!==s)return s.length}return 0}function E(e,t){for(var s=Array(t),i=0;i<t;++i)s[i]=e[i];return s}function x(e,t,s,i){if("function"==typeof e.on)i.once?e.once(t,s):e.on(t,s);else if("function"==typeof e.addEventListener)e.addEventListener(t,function n(r){i.once&&e.removeEventListener(t,n),s(r)});else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}Object.defineProperty(g,"defaultMaxListeners",{enumerable:!0,get:function(){return m},set:function(e){if("number"!=typeof e||e<0||b(e))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");m=e}}),g.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},g.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||b(e))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},g.prototype.getMaxListeners=function(){return y(this)},g.prototype.emit=function(e){for(var t=[],s=1;s<arguments.length;s++)t.push(arguments[s]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){if(t.length>0&&(r=t[0]),r instanceof Error)throw r;var r,o=Error("Unhandled error."+(r?" ("+r.message+")":""));throw o.context=r,o}var a=n[e];if(void 0===a)return!1;if("function"==typeof a)f(a,this,t);else for(var c=a.length,h=E(a,c),s=0;s<c;++s)f(h[s],this,t);return!0},g.prototype.addListener=function(e,t){return k(this,e,t,!1)},g.prototype.on=g.prototype.addListener,g.prototype.prependListener=function(e,t){return k(this,e,t,!0)},g.prototype.once=function(e,t){return v(t),this.on(e,S(this,e,t)),this},g.prototype.prependOnceListener=function(e,t){return v(t),this.prependListener(e,S(this,e,t)),this},g.prototype.removeListener=function(e,t){var s,i,n,r,o;if(v(t),void 0===(i=this._events)||void 0===(s=i[e]))return this;if(s===t||s.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,s.listener||t));else if("function"!=typeof s){for(n=-1,r=s.length-1;r>=0;r--)if(s[r]===t||s[r].listener===t){o=s[r].listener,n=r;break}if(n<0)return this;0===n?s.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(s,n),1===s.length&&(i[e]=s[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},g.prototype.off=g.prototype.removeListener,g.prototype.removeAllListeners=function(e){var t,s,i;if(void 0===(s=this._events))return this;if(void 0===s.removeListener)return 0==arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==s[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete s[e]),this;if(0==arguments.length){var n,r=Object.keys(s);for(i=0;i<r.length;++i)"removeListener"!==(n=r[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=s[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},g.prototype.listeners=function(e){return w(this,e,!0)},g.prototype.rawListeners=function(e){return w(this,e,!1)},g.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):C.call(e,t)},g.prototype.listenerCount=C,g.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};var P=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(_.exports);function R(e){return null!=e&&"function"==typeof e}function O(e,t,s){e>31&&(e=31);let i=Math.floor(Math.random()*(Math.min(s,t*Math.pow(2,e))-0+1)+0);return Math.min(s,t+i)}function A(e){return Math.min(1e3*e,0x7fffffff)}!function(e){e[e.timeout=1]="timeout",e[e.transportClosed=2]="transportClosed",e[e.clientDisconnected=3]="clientDisconnected",e[e.clientClosed=4]="clientClosed",e[e.clientConnectToken=5]="clientConnectToken",e[e.clientRefreshToken=6]="clientRefreshToken",e[e.subscriptionUnsubscribed=7]="subscriptionUnsubscribed",e[e.subscriptionSubscribeToken=8]="subscriptionSubscribeToken",e[e.subscriptionRefreshToken=9]="subscriptionRefreshToken",e[e.transportWriteError=10]="transportWriteError",e[e.connectionClosed=11]="connectionClosed",e[e.badConfiguration=12]="badConfiguration"}(r||(r={})),function(e){e[e.connectCalled=0]="connectCalled",e[e.transportClosed=1]="transportClosed",e[e.noPing=2]="noPing",e[e.subscribeTimeout=3]="subscribeTimeout",e[e.unsubscribeError=4]="unsubscribeError"}(o||(o={})),function(e){e[e.disconnectCalled=0]="disconnectCalled",e[e.unauthorized=1]="unauthorized",e[e.badProtocol=2]="badProtocol",e[e.messageSizeLimit=3]="messageSizeLimit"}(a||(a={})),function(e){e[e.subscribeCalled=0]="subscribeCalled",e[e.transportClosed=1]="transportClosed"}(c||(c={})),function(e){e[e.unsubscribeCalled=0]="unsubscribeCalled",e[e.unauthorized=1]="unauthorized",e[e.clientClosed=2]="clientClosed"}(h||(h={})),function(e){e[e.channelCompaction=1]="channelCompaction"}(l||(l={})),function(e){e.Disconnected="disconnected",e.Connecting="connecting",e.Connected="connected"}(u||(u={})),function(e){e.Unsubscribed="unsubscribed",e.Subscribing="subscribing",e.Subscribed="subscribed"}(d||(d={}));class j extends P{constructor(e,t,s){super(),this._resubscribeTimeout=null,this._refreshTimeout=null,this.channel=t,this.state=d.Unsubscribed,this._centrifuge=e,this._token="",this._getToken=null,this._data=null,this._getData=null,this._recover=!1,this._offset=null,this._epoch=null,this._id=0,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,this._minResubscribeDelay=500,this._maxResubscribeDelay=2e4,this._resubscribeTimeout=null,this._resubscribeAttempts=0,this._promises={},this._promiseId=0,this._inflight=!1,this._refreshTimeout=null,this._delta="",this._delta_negotiated=!1,this._tagsFilter=null,this._prevValue=null,this._unsubPromise=Promise.resolve(),this._setOptions(s),this._centrifuge._debugEnabled?(this.on("state",e=>{this._debug("subscription state",t,e.oldState,"->",e.newState)}),this.on("error",e=>{this._debug("subscription error",t,e)})):this.on("error",function(){Function.prototype()})}ready(e){return this.state===d.Unsubscribed?Promise.reject({code:r.subscriptionUnsubscribed,message:this.state}):this.state===d.Subscribed?Promise.resolve():new Promise((t,s)=>{let i={resolve:t,reject:s};e&&(i.timeout=setTimeout(function(){s({code:r.timeout,message:"timeout"})},e)),this._promises[this._nextPromiseId()]=i})}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(c.subscribeCalled,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(h.unsubscribeCalled,"unsubscribe called",!0)}publish(e){return i(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.publish(this.channel,e)})}presence(){return i(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presence(this.channel)})}presenceStats(){return i(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presenceStats(this.channel)})}history(e){return i(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.history(this.channel,e)})}setTagsFilter(e){if(e&&this._delta)throw Error("cannot use delta and tagsFilter together");this._tagsFilter=e}setData(e){this._data=e}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:r.subscriptionUnsubscribed,message:this.state}):new Promise((e,t)=>{let s=setTimeout(()=>{t({code:r.timeout,message:"timeout"})},this._centrifuge._config.timeout);this._promises[this._nextPromiseId()]={timeout:s,resolve:e,reject:t}})}_nextPromiseId(){return++this._promiseId}_needRecover(){return!0===this._recover}_isUnsubscribed(){return this.state===d.Unsubscribed}_isSubscribing(){return this.state===d.Subscribing}_isSubscribed(){return this.state===d.Subscribed}_setState(e){if(this.state!==e){let t=this.state;return this.state=e,this.emit("state",{newState:e,oldState:t,channel:this.channel}),!0}return!1}_usesToken(){return""!==this._token||null!==this._getToken}_clearSubscribingState(){this._resubscribeAttempts=0,this._clearResubscribeTimeout()}_clearSubscribedState(){this._clearRefreshTimeout()}_setSubscribed(e){if(!this._isSubscribing())return;this._clearSubscribingState(),e.id&&(this._id=e.id),e.recoverable&&(this._recover=!0,this._offset=e.offset||0,this._epoch=e.epoch||""),e.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,this._setState(d.Subscribed);let t=this._centrifuge._getSubscribeContext(this.channel,e);this.emit("subscribed",t),this._resolvePromises();let s=e.publications;if(s&&s.length>0)for(let e in s)s.hasOwnProperty(e)&&this._handlePublication(s[e]);!0===e.expires&&(this._refreshTimeout=setTimeout(()=>this._refresh(),A(e.ttl)))}_setSubscribing(e,t){return i(this,void 0,void 0,function*(){!this._isSubscribing()&&(this._isSubscribed()&&this._clearSubscribedState(),this._setState(d.Subscribing)&&this.emit("subscribing",{channel:this.channel,code:e,reason:t}),this._centrifuge._transport&&this._centrifuge._transport.emulation()&&(yield this._unsubPromise),this._isSubscribing()&&this._subscribe())})}_subscribe(){return(this._debug("subscribing on",this.channel),this._isTransportOpen())?this._inflight?null:(this._inflight=!0,this._canSubscribeWithoutGettingToken())?this._subscribeWithoutToken():(this._getSubscriptionToken().then(e=>this._handleTokenResponse(e)).catch(e=>this._handleTokenError(e)),null):(this._debug("delay subscribe on",this.channel,"till connected"),null)}_isTransportOpen(){return this._centrifuge._transportIsOpen}_canSubscribeWithoutGettingToken(){return!this._usesToken()||!!this._token}_subscribeWithoutToken(){return this._getData?(this._getDataAndSubscribe(this._token),null):this._sendSubscribe(this._token)}_getDataAndSubscribe(e){if(!this._getData){this._inflight=!1;return}this._getData({channel:this.channel}).then(t=>{if(!this._isSubscribing()){this._inflight=!1;return}this._data=t,this._sendSubscribe(e)}).catch(e=>this._handleGetDataError(e))}_handleGetDataError(e){if(!this._isSubscribing()){this._inflight=!1;return}if(e instanceof q){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:r.badConfiguration,message:(null==e?void 0:e.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}_handleTokenResponse(e){if(!this._isSubscribing()){this._inflight=!1;return}if(!e){this._inflight=!1,this._failUnauthorized();return}this._token=e,this._getData?this._getDataAndSubscribe(e):this._sendSubscribe(e)}_handleTokenError(e){if(!this._isSubscribing()){this._inflight=!1;return}if(e instanceof q){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:r.subscriptionSubscribeToken,message:(null==e?void 0:e.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}_sendSubscribe(e){if(!this._isTransportOpen())return this._inflight=!1,null;let t=this._buildSubscribeCommand(e);return this._centrifuge._call(t).then(e=>{this._inflight=!1;let t=e.reply.subscribe;this._handleSubscribeResponse(t),e.next&&e.next()},e=>{this._inflight=!1,this._handleSubscribeError(e.error),e.next&&e.next()}),t}_buildSubscribeCommand(e){let t={channel:this.channel};if(e&&(t.token=e),this._data&&(t.data=this._data),this._positioned&&(t.positioned=!0),this._recoverable&&(t.recoverable=!0),this._joinLeave&&(t.join_leave=!0),t.flag=l.channelCompaction,this._needRecover()){t.recover=!0;let e=this._getOffset();e&&(t.offset=e);let s=this._getEpoch();s&&(t.epoch=s)}return this._delta&&(t.delta=this._delta),this._tagsFilter&&(t.tf=this._tagsFilter),{subscribe:t}}_debug(...e){this._centrifuge._debug(...e)}_handleSubscribeError(e){if(this._isSubscribing()){if(e.code===r.timeout)return void this._centrifuge._disconnect(o.subscribeTimeout,"subscribe timeout",!0);this._subscribeError(e)}}_handleSubscribeResponse(e){this._isSubscribing()&&this._setSubscribed(e)}_setUnsubscribed(e,t,s){if(this._isUnsubscribed())return Promise.resolve();let i=Promise.resolve();return this._isSubscribed()?(s&&(i=this._centrifuge._unsubscribe(this)),this._clearSubscribedState()):this._isSubscribing()&&(this._inflight&&s&&(i=this._centrifuge._unsubscribe(this)),this._clearSubscribingState()),this._inflight=!1,this._setState(d.Unsubscribed)&&this.emit("unsubscribed",{channel:this.channel,code:e,reason:t}),this._rejectPromises({code:r.subscriptionUnsubscribed,message:this.state}),i}_handlePublication(e){if(this._delta&&this._delta_negotiated){let{newData:t,newPrevValue:s}=this._centrifuge._codec.applyDeltaIfNeeded(e,this._prevValue);e.data=t,this._prevValue=s}let t=this._centrifuge._getPublicationContext(this.channel,e);this.emit("publication",t),e.offset&&(this._offset=e.offset)}_handleJoin(e){let t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("join",{channel:this.channel,info:t})}_handleLeave(e){let t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("leave",{channel:this.channel,info:t})}_resolvePromises(){for(let e in this._promises)this._promises.hasOwnProperty(e)&&(this._promises[e].timeout&&clearTimeout(this._promises[e].timeout),this._promises[e].resolve(),delete this._promises[e])}_rejectPromises(e){for(let t in this._promises)this._promises.hasOwnProperty(t)&&(this._promises[t].timeout&&clearTimeout(this._promises[t].timeout),this._promises[t].reject(e),delete this._promises[t])}_scheduleResubscribe(){if(!this._isSubscribing())return void this._debug("not in subscribing state, skip resubscribe scheduling",this.channel);let e=this,t=this._getResubscribeDelay();this._resubscribeTimeout=setTimeout(function(){e._isSubscribing()&&e._subscribe()},t),this._debug("resubscribe scheduled after "+t,this.channel)}_subscribeError(e){if(this._isSubscribing())if(e.code<100||109===e.code||!0===e.temporary){109===e.code&&(this._token="");let t={channel:this.channel,type:"subscribe",error:e};this._centrifuge.state===u.Connected&&this.emit("error",t),this._scheduleResubscribe()}else this._setUnsubscribed(e.code,e.message,!1)}_getResubscribeDelay(){let e=O(this._resubscribeAttempts,this._minResubscribeDelay,this._maxResubscribeDelay);return this._resubscribeAttempts++,e}_setOptions(e){if(e){if(e.since&&(this._offset=e.since.offset||0,this._epoch=e.since.epoch||"",this._recover=!0),e.data&&(this._data=e.data),e.getData&&(this._getData=e.getData),void 0!==e.minResubscribeDelay&&(this._minResubscribeDelay=e.minResubscribeDelay),void 0!==e.maxResubscribeDelay&&(this._maxResubscribeDelay=e.maxResubscribeDelay),e.token&&(this._token=e.token),e.getToken&&(this._getToken=e.getToken),!0===e.positioned&&(this._positioned=!0),!0===e.recoverable&&(this._recoverable=!0),!0===e.joinLeave&&(this._joinLeave=!0),e.delta){if("fossil"!==e.delta)throw Error("unsupported delta format");this._delta=e.delta}if(e.tagsFilter&&(this._tagsFilter=e.tagsFilter),this._tagsFilter&&this._delta)throw Error("cannot use delta and tagsFilter together")}}_getOffset(){let e=this._offset;return null!==e?e:0}_getEpoch(){let e=this._epoch;return null!==e?e:""}_clearRefreshTimeout(){null!==this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearResubscribeTimeout(){null!==this._resubscribeTimeout&&(clearTimeout(this._resubscribeTimeout),this._resubscribeTimeout=null)}_getSubscriptionToken(){this._debug("get subscription token for channel",this.channel);let e={channel:this.channel},t=this._getToken;return null===t?(this.emit("error",{type:"configuration",channel:this.channel,error:{code:r.badConfiguration,message:"provide a function to get channel subscription token"}}),Promise.reject(new q(""))):t(e)}_refresh(){this._clearRefreshTimeout();let e=this;this._getSubscriptionToken().then(function(t){if(!e._isSubscribed())return;if(!t)return void e._failUnauthorized();e._token=t;let s={channel:e.channel,token:t};e._centrifuge._call({sub_refresh:s}).then(t=>{let s=t.reply.sub_refresh;e._refreshResponse(s),t.next&&t.next()},t=>{e._refreshError(t.error),t.next&&t.next()})}).catch(function(t){if(t instanceof q)return void e._failUnauthorized();e.emit("error",{type:"refreshToken",channel:e.channel,error:{code:r.subscriptionRefreshToken,message:void 0!==t?t.toString():""}}),e._refreshTimeout=setTimeout(()=>e._refresh(),e._getRefreshRetryDelay())})}_refreshResponse(e){this._isSubscribed()&&(this._debug("subscription token refreshed, channel",this.channel),this._clearRefreshTimeout(),!0===e.expires&&(this._refreshTimeout=setTimeout(()=>this._refresh(),A(e.ttl))))}_refreshError(e){this._isSubscribed()&&(e.code<100||!0===e.temporary?(this.emit("error",{type:"refresh",channel:this.channel,error:e}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._setUnsubscribed(e.code,e.message,!0))}_getRefreshRetryDelay(){return O(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(h.unauthorized,"unauthorized",!0)}}class L{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"sockjs"}subName(){return"sockjs-"+this._transport.transport}emulation(){return!1}supported(){return null!==this.options.sockjs}initialize(e,t){this._transport=new this.options.sockjs(this.endpoint,null,this.options.sockjsOptions),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=e=>{t.onError(e)},this._transport.onclose=e=>{t.onClose(e)},this._transport.onmessage=e=>{t.onMessage(e.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class M{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"websocket"}subName(){return"websocket"}emulation(){return!1}supported(){return void 0!==this.options.websocket&&null!==this.options.websocket}initialize(e,t){let s="";"protobuf"===e&&(s="centrifuge-protobuf"),""!==s?this._transport=new this.options.websocket(this.endpoint,s):this._transport=new this.options.websocket(this.endpoint),"protobuf"===e&&(this._transport.binaryType="arraybuffer"),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=e=>{t.onError(e)},this._transport.onclose=e=>{t.onClose(e)},this._transport.onmessage=e=>{t.onMessage(e.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class D{constructor(e,t){this.endpoint=e,this.options=t,this._abortController=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"http_stream"}subName(){return"http_stream"}emulation(){return!0}_handleErrors(e){if(!e.ok)throw Error(e.status);return e}_fetchEventTarget(e,t,s){let i=new EventTarget;return(0,e.options.fetch)(t,s).then(e._handleErrors).then(t=>{i.dispatchEvent(new Event("open"));let s="",n=0,r=new Uint8Array,o=t.body.getReader();return new e.options.readableStream({start:t=>(function a(){return o.read().then(({done:o,value:c})=>{if(o){i.dispatchEvent(new Event("close")),t.close();return}try{if("json"===e._protocol)for(s+=e._utf8decoder.decode(c);n<s.length;)if("\n"===s[n]){let e=s.substring(0,n);i.dispatchEvent(new MessageEvent("message",{data:e})),s=s.substring(n+1),n=0}else++n;else{let t=new Uint8Array(r.length+c.length);for(t.set(r),t.set(c,r.length),r=t;;){let t=e.options.decoder.decodeReply(r);if(t.ok){let e=r.slice(0,t.pos);i.dispatchEvent(new MessageEvent("message",{data:e})),r=r.slice(t.pos);continue}break}}}catch(e){i.dispatchEvent(new Event("error",{detail:e})),i.dispatchEvent(new Event("close")),t.close();return}a()}).catch(function(e){i.dispatchEvent(new Event("error",{detail:e})),i.dispatchEvent(new Event("close")),t.close()})})()})}).catch(e=>{i.dispatchEvent(new Event("error",{detail:e})),i.dispatchEvent(new Event("close"))}),i}supported(){return null!==this.options.fetch&&null!==this.options.readableStream&&"undefined"!=typeof TextDecoder&&"undefined"!=typeof AbortController&&"undefined"!=typeof EventTarget&&"undefined"!=typeof Event&&"undefined"!=typeof MessageEvent&&"undefined"!=typeof Error}initialize(e,t,s){let i;this._protocol=e,this._abortController=new AbortController;let n={method:"POST",headers:i="json"===e?{Accept:"application/json","Content-Type":"application/json"}:{Accept:"application/octet-stream","Content-Type":"application/octet-stream"},body:s,mode:"cors",credentials:"same-origin",signal:this._abortController.signal},r=this._fetchEventTarget(this,this.endpoint,n);r.addEventListener("open",()=>{t.onOpen()}),r.addEventListener("error",e=>{this._abortController.abort(),t.onError(e)}),r.addEventListener("close",()=>{this._abortController.abort(),t.onClose({code:4,reason:"connection closed"})}),r.addEventListener("message",e=>{t.onMessage(e.data)})}close(){this._abortController.abort()}send(e,t,s){let i,n,r={session:t,node:s,data:e};"json"===this._protocol?(i={"Content-Type":"application/json"},n=JSON.stringify(r)):(i={"Content-Type":"application/octet-stream"},n=this.options.encoder.encodeEmulationRequest(r));let o=this.options.fetch,a={method:"POST",headers:i,body:n,mode:"cors",credentials:"same-origin"};o(this.options.emulationEndpoint,a)}}class z{constructor(e,t){this.endpoint=e,this.options=t,this._protocol="json",this._transport=null,this._onClose=null}name(){return"sse"}subName(){return"sse"}emulation(){return!0}supported(){return null!==this.options.eventsource&&null!==this.options.fetch}initialize(e,t,s){let i;(i=globalThis&&globalThis.document&&globalThis.document.baseURI?new URL(this.endpoint,globalThis.document.baseURI):new URL(this.endpoint)).searchParams.append("cf_connect",s);let n=new this.options.eventsource(i.toString(),{});this._transport=n,n.onopen=function(){t.onOpen()},n.onerror=function(e){n.close(),t.onError(e),t.onClose({code:4,reason:"connection closed"})},n.onmessage=function(e){t.onMessage(e.data)},this._onClose=function(){t.onClose({code:4,reason:"connection closed"})}}close(){this._transport.close(),null!==this._onClose&&this._onClose()}send(e,t,s){let i=JSON.stringify({session:t,node:s,data:e});(0,this.options.fetch)(this.options.emulationEndpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:i,mode:"cors",credentials:"same-origin"})}}class I{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null,this._stream=null,this._writer=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"webtransport"}subName(){return"webtransport"}emulation(){return!1}supported(){return void 0!==this.options.webtransport&&null!==this.options.webtransport}initialize(e,t){return i(this,void 0,void 0,function*(){let s,i;s=globalThis&&globalThis.document&&globalThis.document.baseURI?new URL(this.endpoint,globalThis.document.baseURI):new URL(this.endpoint),"protobuf"===e&&s.searchParams.append("cf_protocol","protobuf"),this._protocol=e;let n=new EventTarget;this._transport=new this.options.webtransport(s.toString()),this._transport.closed.then(()=>{t.onClose({code:4,reason:"connection closed"})}).catch(()=>{t.onClose({code:4,reason:"connection closed"})});try{yield this._transport.ready}catch(e){this.close();return}try{i=yield this._transport.createBidirectionalStream()}catch(e){this.close();return}this._stream=i,this._writer=this._stream.writable.getWriter(),n.addEventListener("close",()=>{t.onClose({code:4,reason:"connection closed"})}),n.addEventListener("message",e=>{t.onMessage(e.data)}),this._startReading(n),t.onOpen()})}_startReading(e){return i(this,void 0,void 0,function*(){let t=this._stream.readable.getReader(),s="",i=0,n=new Uint8Array;try{for(;;){let{done:r,value:o}=yield t.read();if(o.length>0)if("json"===this._protocol)for(s+=this._utf8decoder.decode(o);i<s.length;)if("\n"===s[i]){let t=s.substring(0,i);e.dispatchEvent(new MessageEvent("message",{data:t})),s=s.substring(i+1),i=0}else++i;else{let t=new Uint8Array(n.length+o.length);for(t.set(n),t.set(o,n.length),n=t;;){let t=this.options.decoder.decodeReply(n);if(t.ok){let s=n.slice(0,t.pos);e.dispatchEvent(new MessageEvent("message",{data:s})),n=n.slice(t.pos);continue}break}}if(r)break}}catch(t){e.dispatchEvent(new Event("close"))}})}close(){return i(this,void 0,void 0,function*(){try{this._writer&&(yield this._writer.close()),this._transport.close()}catch(e){}})}send(e){return i(this,void 0,void 0,function*(){let t;t="json"===this._protocol?new TextEncoder().encode(e+"\n"):e;try{yield this._writer.write(t)}catch(e){this.close()}})}}let U=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,36,-1,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,-1,-1,-1,63,-1];class N{constructor(e){this.a=e,this.pos=0}haveBytes(){return this.pos<this.a.length}getByte(){let e=this.a[this.pos];if(this.pos++,this.pos>this.a.length)throw RangeError("out of bounds");return e}getChar(){return String.fromCharCode(this.getByte())}getInt(){let e,t=0;for(;this.haveBytes()&&(e=U[127&this.getByte()])>=0;)t=(t<<6)+e;return this.pos--,t>>>0}}class W{constructor(){this.a=[]}toByteArray(e){return Array.isArray(e)?this.a:new Uint8Array(this.a)}putArray(e,t,s){for(let i=t;i<s;i++)this.a.push(e[i])}}class F{name(){return"json"}encodeCommands(e){return e.map(e=>JSON.stringify(e)).join("\n")}decodeReplies(e){return e.trim().split("\n").map(e=>JSON.parse(e))}applyDeltaIfNeeded(e,t){let s,i;if(e.delta){let n=function(e,t){let s=0,i=new N(t),n=e.length,r=t.length,o=i.getInt();if("\n"!==i.getChar())throw Error("size integer not terminated by '\\n'");let a=new W;for(;i.haveBytes();){let t,c=i.getInt();switch(i.getChar()){case"@":if(t=i.getInt(),i.haveBytes()&&","!==i.getChar())throw Error("copy command not terminated by ','");if((s+=c)>o)throw Error("copy exceeds output file size");if(t+c>n)throw Error("copy extends past end of input");a.putArray(e,t,t+c);break;case":":if((s+=c)>o)throw Error("insert command gives an output larger than predicted");if(c>r)throw Error("insert count exceeds size of delta");a.putArray(i.a,i.pos,i.pos+c),i.pos+=c;break;case";":{let t=a.toByteArray(e);if(c!==function(e){let t=0,s=0,i=0,n=0,r=0,o=e.length;for(;o>=16;)t=t+e[r+0]|0,s=s+e[r+1]|0,i=i+e[r+2]|0,n=n+e[r+3]|0,t=t+e[r+4]|0,s=s+e[r+5]|0,i=i+e[r+6]|0,n=n+e[r+7]|0,t=t+e[r+8]|0,s=s+e[r+9]|0,i=i+e[r+10]|0,n=n+e[r+11]|0,t=t+e[r+12]|0,s=s+e[r+13]|0,i=i+e[r+14]|0,n=n+e[r+15]|0,r+=16,o-=16;for(;o>=4;)t=t+e[r+0]|0,s=s+e[r+1]|0,i=i+e[r+2]|0,n=n+e[r+3]|0,r+=4,o-=4;switch(n=((n+(i<<8)|0)+(s<<16)|0)+(t<<24)|0,o){case 3:n=n+(e[r+2]<<8)|0;case 2:n=n+(e[r+1]<<16)|0;case 1:n=n+(e[r+0]<<24)|0}return n>>>0}(t))throw Error("bad checksum");if(s!==o)throw Error("generated size does not match predicted size");return t}default:throw Error("unknown delta operator")}}throw Error("unterminated delta")}(t,new TextEncoder().encode(e.data));s=JSON.parse(new TextDecoder().decode(n)),i=n}else s=JSON.parse(e.data),i=new TextEncoder().encode(e.data);return{newData:s,newPrevValue:i}}}let J={headers:{},token:"",getToken:null,data:null,getData:null,debug:!1,name:"js",version:"",fetch:null,readableStream:null,websocket:null,eventsource:null,sockjs:null,sockjsOptions:{},emulationEndpoint:"/emulation",minReconnectDelay:500,maxReconnectDelay:2e4,timeout:5e3,maxServerPingDelay:1e4,networkEventTarget:null};class q extends Error{constructor(e){super(e),this.name=this.constructor.name}}class B extends P{constructor(e,t){super(),this._reconnectTimeout=null,this._refreshTimeout=null,this._serverPingTimeout=null,this.state=u.Disconnected,this._transportIsOpen=!1,this._endpoint=e,this._emulation=!1,this._transports=[],this._currentTransportIndex=0,this._triedAllTransports=!1,this._transportWasOpen=!1,this._transport=null,this._transportId=0,this._deviceWentOffline=!1,this._transportClosed=!0,this._codec=new F,this._reconnecting=!1,this._reconnectTimeout=null,this._reconnectAttempts=0,this._client=null,this._session="",this._node="",this._subs={},this._serverSubs={},this._commandId=0,this._commands=[],this._batching=!1,this._refreshRequired=!1,this._refreshTimeout=null,this._callbacks={},this._token="",this._data=null,this._dispatchPromise=Promise.resolve(),this._serverPing=0,this._serverPingTimeout=null,this._sendPong=!1,this._promises={},this._promiseId=0,this._debugEnabled=!1,this._networkEventsSet=!1,this._config=Object.assign(Object.assign({},J),t),this._configure(),this._debugEnabled?(this.on("state",e=>{this._debug("client state",e.oldState,"->",e.newState)}),this.on("error",e=>{this._debug("client error",e)})):this.on("error",function(){Function.prototype()})}newSubscription(e,t){if(null!==this.getSubscription(e))throw Error("Subscription to the channel "+e+" already exists");let s=new j(this,e,t);return this._subs[e]=s,s}getSubscription(e){return this._getSub(e)}removeSubscription(e){e&&(e.state!==d.Unsubscribed&&e.unsubscribe(),this._removeSubscription(e))}subscriptions(){return this._subs}ready(e){return i(this,void 0,void 0,function*(){switch(this.state){case u.Disconnected:throw{code:r.clientDisconnected,message:"client disconnected"};case u.Connected:return;default:return new Promise((t,s)=>{let i={resolve:t,reject:s};e&&(i.timeout=setTimeout(()=>{s({code:r.timeout,message:"timeout"})},e)),this._promises[this._nextPromiseId()]=i})}})}connect(){return this._isConnected()?void this._debug("connect called when already connected"):this._isConnecting()?void this._debug("connect called when already connecting"):void(this._debug("connect called"),this._reconnectAttempts=0,this._startConnecting())}disconnect(){this._disconnect(a.disconnectCalled,"disconnect called",!1)}setToken(e){this._token=e}setData(e){this._data=e}setHeaders(e){this._config.headers=e}send(e){return i(this,void 0,void 0,function*(){if(yield this._methodCall(),!this._transportSendCommands([{send:{data:e}}]))throw this._createErrorObject(r.transportWriteError,"transport write error")})}rpc(e,t){return i(this,void 0,void 0,function*(){return yield this._methodCall(),{data:(yield this._callPromise({rpc:{method:e,data:t}},e=>e.rpc)).data}})}publish(e,t){return i(this,void 0,void 0,function*(){return yield this._methodCall(),yield this._callPromise({publish:{channel:e,data:t}},()=>({})),{}})}history(e,t){return i(this,void 0,void 0,function*(){let s={history:this._getHistoryRequest(e,t)};yield this._methodCall();let i=yield this._callPromise(s,e=>e.history),n=[];if(i.publications)for(let t=0;t<i.publications.length;t++)n.push(this._getPublicationContext(e,i.publications[t]));return{publications:n,epoch:i.epoch||"",offset:i.offset||0}})}presence(e){return i(this,void 0,void 0,function*(){yield this._methodCall();let t=(yield this._callPromise({presence:{channel:e}},e=>e.presence)).presence;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let s=t[e],i=s.conn_info,n=s.chan_info;i&&(s.connInfo=i),n&&(s.chanInfo=n)}return{clients:t}})}presenceStats(e){return i(this,void 0,void 0,function*(){yield this._methodCall();let t=yield this._callPromise({presence_stats:{channel:e}},e=>e.presence_stats);return{numUsers:t.num_users,numClients:t.num_clients}})}startBatching(){this._batching=!0}stopBatching(){let e=this;Promise.resolve().then(function(){Promise.resolve().then(function(){e._batching=!1,e._flush()})})}_debug(...e){if(this._debugEnabled&&globalThis.console){let t=globalThis.console.debug;R(t)&&t.apply(globalThis.console,e)}}_codecName(){return this._codec.name()}_formatOverride(){}_configure(){if(!("Promise"in globalThis))throw Error("Promise polyfill required");if(!this._endpoint)throw Error("endpoint configuration required");if(null!==this._config.token&&(this._token=this._config.token),null!==this._config.data&&(this._data=this._config.data),this._codec=new F,this._formatOverride(),(!0===this._config.debug||"undefined"!=typeof localStorage&&"function"==typeof localStorage.getItem&&localStorage.getItem("centrifuge.debug"))&&(this._debugEnabled=!0),this._debug("config",this._config),"string"==typeof this._endpoint);else if(Array.isArray(this._endpoint)){for(let e in this._transports=this._endpoint,this._emulation=!0,this._transports)if(this._transports.hasOwnProperty(e)){let t=this._transports[e];if(!t.endpoint||!t.transport)throw Error("malformed transport configuration");let s=t.transport;if(0>["websocket","http_stream","sse","sockjs","webtransport"].indexOf(s))throw Error("unsupported transport name: "+s)}}else throw Error("unsupported url configuration type: only string or array of objects are supported")}_setState(e){if(this.state!==e){this._reconnecting=!1;let t=this.state;return this.state=e,this.emit("state",{newState:e,oldState:t}),!0}return!1}_isDisconnected(){return this.state===u.Disconnected}_isConnecting(){return this.state===u.Connecting}_isConnected(){return this.state===u.Connected}_nextCommandId(){return++this._commandId}_setNetworkEvents(){if(this._networkEventsSet)return;let e=null;null!==this._config.networkEventTarget?e=this._config.networkEventTarget:void 0!==globalThis.addEventListener&&(e=globalThis),e&&(e.addEventListener("offline",()=>{this._debug("offline event triggered"),(this.state===u.Connected||this.state===u.Connecting)&&(this._disconnect(o.transportClosed,"transport closed",!0),this._deviceWentOffline=!0)}),e.addEventListener("online",()=>{this._debug("online event triggered"),this.state===u.Connecting&&(this._deviceWentOffline&&!this._transportClosed&&(this._deviceWentOffline=!1,this._transportClosed=!0),this._clearReconnectTimeout(),this._startReconnecting())}),this._networkEventsSet=!0)}_getReconnectDelay(){let e=O(this._reconnectAttempts,this._config.minReconnectDelay,this._config.maxReconnectDelay);return this._reconnectAttempts+=1,e}_clearOutgoingRequests(){for(let e in this._callbacks)if(this._callbacks.hasOwnProperty(e)){let t=this._callbacks[e];clearTimeout(t.timeout);let s=t.errback;if(!s)continue;s({error:this._createErrorObject(r.connectionClosed,"connection closed")})}this._callbacks={}}_clearConnectedState(){for(let e in this._client=null,this._clearServerPingTimeout(),this._clearRefreshTimeout(),this._subs){if(!this._subs.hasOwnProperty(e))continue;let t=this._subs[e];t.state===d.Subscribed&&t._setSubscribing(c.transportClosed,"transport closed")}for(let e in this._serverSubs)this._serverSubs.hasOwnProperty(e)&&this.emit("subscribing",{channel:e})}_handleWriteError(e){for(let t of e){let e=t.id;if(!(e in this._callbacks))continue;let s=this._callbacks[e];clearTimeout(this._callbacks[e].timeout),delete this._callbacks[e],(0,s.errback)({error:this._createErrorObject(r.transportWriteError,"transport write error")})}}_transportSendCommands(e){if(!e.length)return!0;if(!this._transport)return!1;try{this._transport.send(this._codec.encodeCommands(e),this._session,this._node)}catch(t){return this._debug("error writing commands",t),this._handleWriteError(e),!1}return!0}_initializeTransport(){let e,t;null!==this._config.websocket?e=this._config.websocket:("function"==typeof globalThis.WebSocket||"object"==typeof globalThis.WebSocket)&&(e=globalThis.WebSocket);let s=null;null!==this._config.sockjs?s=this._config.sockjs:void 0!==globalThis.SockJS&&(s=globalThis.SockJS);let i=null;null!==this._config.eventsource?i=this._config.eventsource:void 0!==globalThis.EventSource&&(i=globalThis.EventSource);let n=null;null!==this._config.fetch?n=this._config.fetch:void 0!==globalThis.fetch&&(n=globalThis.fetch);let c=null;if(null!==this._config.readableStream?c=this._config.readableStream:void 0!==globalThis.ReadableStream&&(c=globalThis.ReadableStream),this._emulation){this._currentTransportIndex>=this._transports.length&&(this._triedAllTransports=!0,this._currentTransportIndex=0);let t=0;for(;;){if(t>=this._transports.length)throw Error("no supported transport found");let r=this._transports[this._currentTransportIndex],o=r.transport,a=r.endpoint;if("websocket"===o){if(this._debug("trying websocket transport"),this._transport=new M(a,{websocket:e}),!this._transport.supported()){this._debug("websocket transport not available"),this._currentTransportIndex++,t++;continue}}else if("webtransport"===o){if(this._debug("trying webtransport transport"),this._transport=new I(a,{webtransport:globalThis.WebTransport,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("webtransport transport not available"),this._currentTransportIndex++,t++;continue}}else if("http_stream"===o){if(this._debug("trying http_stream transport"),this._transport=new D(a,{fetch:n,readableStream:c,emulationEndpoint:this._config.emulationEndpoint,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("http_stream transport not available"),this._currentTransportIndex++,t++;continue}}else if("sse"===o){if(this._debug("trying sse transport"),this._transport=new z(a,{eventsource:i,fetch:n,emulationEndpoint:this._config.emulationEndpoint}),!this._transport.supported()){this._debug("sse transport not available"),this._currentTransportIndex++,t++;continue}}else if("sockjs"===o){if(this._debug("trying sockjs"),this._transport=new L(a,{sockjs:s,sockjsOptions:this._config.sockjsOptions}),!this._transport.supported()){this._debug("sockjs transport not available"),this._currentTransportIndex++,t++;continue}}else throw Error("unknown transport "+o);break}}else{var h;if(h=this._endpoint,0===h.lastIndexOf("http",0))throw Error("Provide explicit transport endpoints configuration in case of using HTTP (i.e. using array of TransportEndpoint instead of a single string), or use ws(s):// scheme in an endpoint if you aimed using WebSocket transport");if(this._debug("client will use websocket"),this._transport=new M(this._endpoint,{websocket:e}),!this._transport.supported())throw Error("WebSocket constructor not found, make sure it is available globally or passed as a dependency in Centrifuge options")}let l=this,u=this._transport,d=this._nextTransportId();l._debug("id of transport",d);let _=!1,p=[];if(this._transport.emulation()){let e=l._sendConnect(!0);p.push(e)}this._setNetworkEvents();let f=this._codec.encodeCommands(p);this._transportClosed=!1,t=setTimeout(function(){u.close()},this._config.timeout),this._transport.initialize(this._codecName(),{onOpen:function(){if(t&&(clearTimeout(t),t=null),l._transportId!=d){l._debug("open callback from non-actual transport"),u.close();return}_=!0,l._debug(u.subName(),"transport open"),u.emulation()||(l._transportIsOpen=!0,l._transportWasOpen=!0,l.startBatching(),l._sendConnect(!1),l._sendSubscribeCommands(),l.stopBatching(),l.emit("__centrifuge_debug:connect_frame_sent",{}))},onError:function(e){if(l._transportId!=d)return void l._debug("error callback from non-actual transport");l._debug("transport level error",e)},onClose:function(e){if(t&&(clearTimeout(t),t=null),l._transportId!=d)return void l._debug("close callback from non-actual transport");l._debug(u.subName(),"transport closed"),l._transportClosed=!0,l._transportIsOpen=!1;let s="connection closed",i=!0,n=0;if(e&&"code"in e&&e.code&&(n=e.code),e&&e.reason)try{let t=JSON.parse(e.reason);s=t.reason,i=t.reconnect}catch(t){s=e.reason,(n>=3500&&n<4e3||n>=4500&&n<5e3)&&(i=!1)}n<3e3?(1009===n?(n=a.messageSizeLimit,s="message size limit exceeded",i=!1):(n=o.transportClosed,s="transport closed"),l._emulation&&!l._transportWasOpen&&(l._currentTransportIndex++,l._currentTransportIndex>=l._transports.length&&(l._triedAllTransports=!0,l._currentTransportIndex=0))):l._transportWasOpen=!0,l._isConnecting()&&!_&&l.emit("error",{type:"transport",error:{code:r.transportClosed,message:"transport closed"},transport:u.name()}),l._reconnecting=!1,l._disconnect(n,s,i)},onMessage:function(e){l._dataReceived(e)}},f),l.emit("__centrifuge_debug:transport_initialized",{})}_sendConnect(e){let t=this._constructConnectCommand(),s=this;return this._call(t,e).then(e=>{let t=e.reply.connect;s._connectResponse(t),e.next&&e.next()},e=>{s._connectError(e.error),e.next&&e.next()}),t}_startReconnecting(){if(this._debug("start reconnecting"),!this._isConnecting())return void this._debug("stop reconnecting: client not in connecting state");if(this._reconnecting)return void this._debug("reconnect already in progress, return from reconnect routine");if(!1===this._transportClosed)return void this._debug("waiting for transport close");this._reconnecting=!0;let e=""===this._token;if(!(this._refreshRequired||e&&null!==this._config.getToken))return void(this._config.getData?this._config.getData().then(e=>{this._isConnecting()&&(this._data=e,this._initializeTransport())}).catch(e=>this._handleGetDataError(e)):this._initializeTransport());let t=this;this._getToken().then(function(e){if(t._isConnecting()){if(null==e||void 0==e)return void t._failUnauthorized();t._token=e,t._debug("connection token refreshed"),t._config.getData?t._config.getData().then(function(e){t._isConnecting()&&(t._data=e,t._initializeTransport())}).catch(e=>t._handleGetDataError(e)):t._initializeTransport()}}).catch(function(e){if(!t._isConnecting())return;if(e instanceof q)return void t._failUnauthorized();t.emit("error",{type:"connectToken",error:{code:r.clientConnectToken,message:void 0!==e?e.toString():""}});let s=t._getReconnectDelay();t._debug("error on getting connection token, reconnect after "+s+" milliseconds",e),t._reconnecting=!1,t._reconnectTimeout=setTimeout(()=>{t._startReconnecting()},s)})}_handleGetDataError(e){if(e instanceof q)return void this._failUnauthorized();this.emit("error",{type:"connectData",error:{code:r.badConfiguration,message:(null==e?void 0:e.toString())||""}});let t=this._getReconnectDelay();this._debug("error on getting connect data, reconnect after "+t+" milliseconds",e),this._reconnecting=!1,this._reconnectTimeout=setTimeout(()=>{this._startReconnecting()},t)}_connectError(e){this.state===u.Connecting&&(109===e.code&&(this._refreshRequired=!0),e.code<100||!0===e.temporary||109===e.code?(this.emit("error",{type:"connect",error:e}),this._debug("closing transport due to connect error"),this._disconnect(e.code,e.message,!0)):this._disconnect(e.code,e.message,!1))}_scheduleReconnect(){if(!this._isConnecting())return;let e=!1;!this._emulation||this._transportWasOpen||this._triedAllTransports||(e=!0);let t=this._getReconnectDelay();e&&(t=0),this._debug("reconnect after "+t+" milliseconds"),this._clearReconnectTimeout(),this._reconnectTimeout=setTimeout(()=>{this._startReconnecting()},t)}_constructConnectCommand(){let e={};this._token&&(e.token=this._token),this._data&&(e.data=this._data),this._config.name&&(e.name=this._config.name),this._config.version&&(e.version=this._config.version),Object.keys(this._config.headers).length>0&&(e.headers=this._config.headers);let t={},s=!1;for(let e in this._serverSubs)if(this._serverSubs.hasOwnProperty(e)&&this._serverSubs[e].recoverable){s=!0;let i={recover:!0};this._serverSubs[e].offset&&(i.offset=this._serverSubs[e].offset),this._serverSubs[e].epoch&&(i.epoch=this._serverSubs[e].epoch),t[e]=i}return s&&(e.subs=t),{connect:e}}_getHistoryRequest(e,t){let s={channel:e};return void 0!==t&&(t.since&&(s.since={offset:t.since.offset},t.since.epoch&&(s.since.epoch=t.since.epoch)),void 0!==t.limit&&(s.limit=t.limit),!0===t.reverse&&(s.reverse=!0)),s}_methodCall(){return this._isConnected()?Promise.resolve():new Promise((e,t)=>{let s=setTimeout(function(){t({code:r.timeout,message:"timeout"})},this._config.timeout);this._promises[this._nextPromiseId()]={timeout:s,resolve:e,reject:t}})}_callPromise(e,t){return new Promise((s,i)=>{this._call(e,!1).then(e=>{var i;s(t(e.reply)),null==(i=e.next)||i.call(e)},e=>{var t;i(e.error),null==(t=e.next)||t.call(e)})})}_dataReceived(e){this._serverPing>0&&this._waitServerPing();let t=this._codec.decodeReplies(e);this._dispatchPromise=this._dispatchPromise.then(()=>{let e;this._dispatchPromise=new Promise(t=>{e=t}),this._dispatchSynchronized(t,e)})}_dispatchSynchronized(e,t){let s=Promise.resolve();for(let t in e)e.hasOwnProperty(t)&&(s=s.then(()=>this._dispatchReply(e[t])));s.then(()=>{t()})}_dispatchReply(e){let t,s=new Promise(e=>{t=e});if(null==e)return this._debug("dispatch: got undefined or null reply"),t(),s;let i=e.id;return i&&i>0?this._handleReply(e,t):e.push?this._handlePush(e.push,t):this._handleServerPing(t),s}_call(e,t){return new Promise((s,i)=>{e.id=this._nextCommandId(),this._registerCall(e.id,s,i),t||this._addCommand(e)})}_startConnecting(){this._debug("start connecting"),this._setState(u.Connecting)&&this.emit("connecting",{code:o.connectCalled,reason:"connect called"}),this._client=null,this._startReconnecting()}_disconnect(e,t,s){if(this._isDisconnected())return;this._transportIsOpen=!1;let i=this.state;this._reconnecting=!1;let n={code:e,reason:t},o=!1;if(s?o=this._setState(u.Connecting):(o=this._setState(u.Disconnected),this._rejectPromises({code:r.clientDisconnected,message:"disconnected"})),this._clearOutgoingRequests(),i===u.Connecting&&this._clearReconnectTimeout(),i===u.Connected&&this._clearConnectedState(),o&&(this._isConnecting()?this.emit("connecting",n):this.emit("disconnected",n)),this._transport){this._debug("closing existing transport");let e=this._transport;this._transport=null,e.close(),this._transportClosed=!0,this._nextTransportId()}else this._debug("no transport to close");this._scheduleReconnect()}_failUnauthorized(){this._disconnect(a.unauthorized,"unauthorized",!1)}_getToken(){return(this._debug("get connection token"),this._config.getToken)?this._config.getToken({}):(this.emit("error",{type:"configuration",error:{code:r.badConfiguration,message:"token expired but no getToken function set in the configuration"}}),Promise.reject(new q("")))}_refresh(){let e=this._client,t=this;this._getToken().then(function(s){if(e!==t._client)return;if(!s)return void t._failUnauthorized();if(t._token=s,t._debug("connection token refreshed"),!t._isConnected())return;let i={refresh:{token:t._token}};t._call(i,!1).then(e=>{let s=e.reply.refresh;t._refreshResponse(s),e.next&&e.next()},e=>{t._refreshError(e.error),e.next&&e.next()})}).catch(function(e){if(t._isConnected()){if(e instanceof q)return void t._failUnauthorized();t.emit("error",{type:"refreshToken",error:{code:r.clientRefreshToken,message:void 0!==e?e.toString():""}}),t._refreshTimeout=setTimeout(()=>t._refresh(),t._getRefreshRetryDelay())}})}_refreshError(e){e.code<100||!0===e.temporary?(this.emit("error",{type:"refresh",error:e}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._disconnect(e.code,e.message,!1)}_getRefreshRetryDelay(){return O(0,5e3,1e4)}_refreshResponse(e){this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null),e.expires&&(this._client=e.client,this._refreshTimeout=setTimeout(()=>this._refresh(),A(e.ttl)))}_removeSubscription(e){null!==e&&delete this._subs[e.channel]}_unsubscribe(e){if(!this._transportIsOpen)return Promise.resolve();let t={unsubscribe:{channel:e.channel}},s=this;return new Promise((e,i)=>{this._call(t,!1).then(t=>{e(),t.next&&t.next()},t=>{e(),t.next&&t.next(),s._disconnect(o.unsubscribeError,"unsubscribe error",!0)})})}_getSub(e,t){if(t&&t>0){for(let e in this._subs)if(this._subs.hasOwnProperty(e)){let s=this._subs[e];if(s._id===t)return s}return null}let s=this._subs[e];return s||null}_isServerSub(e){return void 0!==this._serverSubs[e]}_sendSubscribeCommands(){let e=[];for(let t in this._subs){if(!this._subs.hasOwnProperty(t))continue;let s=this._subs[t];if(!0!==s._inflight&&s.state===d.Subscribing){let t=s._subscribe();t&&e.push(t)}}return e}_connectResponse(e){if(this._transportIsOpen=!0,this._transportWasOpen=!0,this._reconnectAttempts=0,this._refreshRequired=!1,this._isConnected())return;this._client=e.client,this._setState(u.Connected),this._refreshTimeout&&clearTimeout(this._refreshTimeout),e.expires&&(this._refreshTimeout=setTimeout(()=>this._refresh(),A(e.ttl))),this._session=e.session,this._node=e.node,this.startBatching(),this._sendSubscribeCommands(),this.stopBatching();let t={client:e.client,transport:this._transport.subName()};e.data&&(t.data=e.data),this.emit("connected",t),this._resolvePromises(),this._processServerSubs(e.subs||{}),e.ping&&e.ping>0?(this._serverPing=1e3*e.ping,this._sendPong=!0===e.pong,this._waitServerPing()):this._serverPing=0}_processServerSubs(e){for(let t in e){if(!e.hasOwnProperty(t))continue;let s=e[t];this._serverSubs[t]={offset:s.offset,epoch:s.epoch,recoverable:s.recoverable||!1};let i=this._getSubscribeContext(t,s);this.emit("subscribed",i)}for(let t in e){if(!e.hasOwnProperty(t))continue;let s=e[t];if(s.recovered){let e=s.publications;if(e&&e.length>0)for(let s in e)e.hasOwnProperty(s)&&this._handlePublication(t,e[s])}}for(let t in this._serverSubs)this._serverSubs.hasOwnProperty(t)&&(e[t]||(this.emit("unsubscribed",{channel:t}),delete this._serverSubs[t]))}_clearRefreshTimeout(){null!==this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearReconnectTimeout(){null!==this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null)}_clearServerPingTimeout(){null!==this._serverPingTimeout&&(clearTimeout(this._serverPingTimeout),this._serverPingTimeout=null)}_waitServerPing(){0!==this._config.maxServerPingDelay&&this._isConnected()&&(this._clearServerPingTimeout(),this._serverPingTimeout=setTimeout(()=>{this._isConnected()&&this._disconnect(o.noPing,"no ping",!0)},this._serverPing+this._config.maxServerPingDelay))}_getSubscribeContext(e,t){let s={channel:e,positioned:!1,recoverable:!1,wasRecovering:!1,recovered:!1,hasRecoveredPublications:!1};t.recovered&&(s.recovered=!0),t.positioned&&(s.positioned=!0),t.recoverable&&(s.recoverable=!0),t.was_recovering&&(s.wasRecovering=!0);let i="";"epoch"in t&&(i=t.epoch);let n=0;return"offset"in t&&(n=t.offset),(s.positioned||s.recoverable)&&(s.streamPosition={offset:n,epoch:i}),Array.isArray(t.publications)&&t.publications.length>0&&(s.hasRecoveredPublications=!0),t.data&&(s.data=t.data),s}_handleReply(e,t){let s=e.id;if(!(s in this._callbacks))return void t();let i=this._callbacks[s];if(clearTimeout(this._callbacks[s].timeout),delete this._callbacks[s],"error"in e&&null!==e.error){let s=i.errback;if(!s)return void t();s({error:{code:e.error.code,message:e.error.message||"",temporary:e.error.temporary||!1},next:t})}else{let s=i.callback;if(!s)return;s({reply:e,next:t})}}_handleJoin(e,t,s){let i=this._getSub(e,s);if(!i&&e){if(this._isServerSub(e)){let s={channel:e,info:this._getJoinLeaveContext(t.info)};this.emit("join",s)}return}i._handleJoin(t)}_handleLeave(e,t,s){let i=this._getSub(e,s);if(!i&&e){if(this._isServerSub(e)){let s={channel:e,info:this._getJoinLeaveContext(t.info)};this.emit("leave",s)}return}i._handleLeave(t)}_handleUnsubscribe(e,t){let s=this._getSub(e,0);if(!s&&e){this._isServerSub(e)&&(delete this._serverSubs[e],this.emit("unsubscribed",{channel:e}));return}t.code<2500?s._setUnsubscribed(t.code,t.reason,!1):s._setSubscribing(t.code,t.reason)}_handleSubscribe(e,t){this._serverSubs[e]={offset:t.offset,epoch:t.epoch,recoverable:t.recoverable||!1},this.emit("subscribed",this._getSubscribeContext(e,t))}_handleDisconnect(e){let t=e.code,s=!0;(t>=3500&&t<4e3||t>=4500&&t<5e3)&&(s=!1),this._disconnect(t,e.reason,s)}_getPublicationContext(e,t){let s={channel:e,data:t.data};return t.offset&&(s.offset=t.offset),t.info&&(s.info=this._getJoinLeaveContext(t.info)),t.tags&&(s.tags=t.tags),s}_getJoinLeaveContext(e){let t={client:e.client,user:e.user},s=e.conn_info;s&&(t.connInfo=s);let i=e.chan_info;return i&&(t.chanInfo=i),t}_handlePublication(e,t,s){let i=this._getSub(e,s);if(!i&&e){if(this._isServerSub(e)){let s=this._getPublicationContext(e,t);this.emit("publication",s),void 0!==t.offset&&(this._serverSubs[e].offset=t.offset)}return}i._handlePublication(t)}_handleMessage(e){this.emit("message",{data:e.data})}_handleServerPing(e){this._sendPong&&this._transportSendCommands([{}]),e()}_handlePush(e,t){let s=e.channel,i=e.id;e.pub?this._handlePublication(s,e.pub,i):e.message?this._handleMessage(e.message):e.join?this._handleJoin(s,e.join,i):e.leave?this._handleLeave(s,e.leave,i):e.unsubscribe?this._handleUnsubscribe(s,e.unsubscribe):e.subscribe?this._handleSubscribe(s,e.subscribe):e.disconnect&&this._handleDisconnect(e.disconnect),t()}_flush(){let e=this._commands.slice(0);this._commands=[],this._transportSendCommands(e)}_createErrorObject(e,t,s){let i={code:e,message:t};return s&&(i.temporary=!0),i}_registerCall(e,t,s){this._callbacks[e]={callback:t,errback:s,timeout:null},this._callbacks[e].timeout=setTimeout(()=>{delete this._callbacks[e],R(s)&&s({error:this._createErrorObject(r.timeout,"timeout")})},this._config.timeout)}_addCommand(e){this._batching?this._commands.push(e):this._transportSendCommands([e])}_nextPromiseId(){return++this._promiseId}_nextTransportId(){return++this._transportId}_resolvePromises(){for(let e in this._promises)this._promises.hasOwnProperty(e)&&(this._promises[e].timeout&&clearTimeout(this._promises[e].timeout),this._promises[e].resolve(),delete this._promises[e])}_rejectPromises(e){for(let t in this._promises)this._promises.hasOwnProperty(t)&&(this._promises[t].timeout&&clearTimeout(this._promises[t].timeout),this._promises[t].reject(e),delete this._promises[t])}}B.SubscriptionState=d,B.State=u,B.UnauthorizedError=q},73548:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},79145:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]])},80574:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},83322:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},83708:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},84963:(e,t,s)=>{s.d(t,{A:()=>i});let i=(0,s(25365).A)("chart-pie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]])}}]);
|