@novu/js 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{chunk-PMLVIUWC.cjs → chunk-D7P7KCZI.js} +342 -255
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/index.js +58 -0
- package/dist/cjs/novu-04KlkBy4.d.ts +528 -0
- package/dist/cjs/ui/index.d.ts +145 -0
- package/dist/cjs/ui/{index.cjs → index.js} +218 -141
- package/dist/esm/{chunk-LDGUT6MH.mjs → chunk-APRCCICD.mjs} +342 -256
- package/dist/esm/index.d.mts +8 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/novu-04KlkBy4.d.mts +528 -0
- package/dist/esm/ui/index.d.mts +145 -0
- package/dist/esm/ui/index.mjs +131 -54
- package/dist/novu.min.js +10 -10
- package/dist/novu.min.js.gz +0 -0
- package/package.json +24 -16
- package/ui/package.json +5 -0
- package/dist/cjs/index.cjs +0 -50
- package/dist/types/api/inbox-service.d.ts +0 -65
- package/dist/types/api/inbox-service.d.ts.map +0 -1
- package/dist/types/api/index.d.ts +0 -2
- package/dist/types/api/index.d.ts.map +0 -1
- package/dist/types/base-module.d.ts +0 -13
- package/dist/types/base-module.d.ts.map +0 -1
- package/dist/types/cache/in-memory-cache.d.ts +0 -13
- package/dist/types/cache/in-memory-cache.d.ts.map +0 -1
- package/dist/types/cache/index.d.ts +0 -2
- package/dist/types/cache/index.d.ts.map +0 -1
- package/dist/types/cache/notifications-cache.d.ts +0 -22
- package/dist/types/cache/notifications-cache.d.ts.map +0 -1
- package/dist/types/cache/preferences-cache.d.ts +0 -11
- package/dist/types/cache/preferences-cache.d.ts.map +0 -1
- package/dist/types/cache/types.d.ts +0 -10
- package/dist/types/cache/types.d.ts.map +0 -1
- package/dist/types/event-emitter/index.d.ts +0 -3
- package/dist/types/event-emitter/index.d.ts.map +0 -1
- package/dist/types/event-emitter/novu-event-emitter.d.ts +0 -14
- package/dist/types/event-emitter/novu-event-emitter.d.ts.map +0 -1
- package/dist/types/event-emitter/types.d.ts +0 -85
- package/dist/types/event-emitter/types.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/notifications/helpers.d.ts +0 -57
- package/dist/types/notifications/helpers.d.ts.map +0 -1
- package/dist/types/notifications/index.d.ts +0 -4
- package/dist/types/notifications/index.d.ts.map +0 -1
- package/dist/types/notifications/notification.d.ts +0 -33
- package/dist/types/notifications/notification.d.ts.map +0 -1
- package/dist/types/notifications/notifications.d.ts +0 -44
- package/dist/types/notifications/notifications.d.ts.map +0 -1
- package/dist/types/notifications/types.d.ts +0 -55
- package/dist/types/notifications/types.d.ts.map +0 -1
- package/dist/types/novu.d.ts +0 -14
- package/dist/types/novu.d.ts.map +0 -1
- package/dist/types/preferences/helpers.d.ts +0 -11
- package/dist/types/preferences/helpers.d.ts.map +0 -1
- package/dist/types/preferences/index.d.ts +0 -2
- package/dist/types/preferences/index.d.ts.map +0 -1
- package/dist/types/preferences/preference.d.ts +0 -15
- package/dist/types/preferences/preference.d.ts.map +0 -1
- package/dist/types/preferences/preferences.d.ts +0 -15
- package/dist/types/preferences/preferences.d.ts.map +0 -1
- package/dist/types/preferences/types.d.ts +0 -15
- package/dist/types/preferences/types.d.ts.map +0 -1
- package/dist/types/session/index.d.ts +0 -3
- package/dist/types/session/index.d.ts.map +0 -1
- package/dist/types/session/session.d.ts +0 -7
- package/dist/types/session/session.d.ts.map +0 -1
- package/dist/types/session/types.d.ts +0 -6
- package/dist/types/session/types.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -150
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/index.d.ts +0 -6
- package/dist/types/ui/api/hooks/index.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/useArchiveAll.d.ts +0 -10
- package/dist/types/ui/api/hooks/useArchiveAll.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/useArchiveAllRead.d.ts +0 -10
- package/dist/types/ui/api/hooks/useArchiveAllRead.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/useNotifications.d.ts +0 -17
- package/dist/types/ui/api/hooks/useNotifications.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/usePreferences.d.ts +0 -9
- package/dist/types/ui/api/hooks/usePreferences.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/useReadAll.d.ts +0 -10
- package/dist/types/ui/api/hooks/useReadAll.d.ts.map +0 -1
- package/dist/types/ui/api/index.d.ts +0 -2
- package/dist/types/ui/api/index.d.ts.map +0 -1
- package/dist/types/ui/components/ExternalElementRenderer.d.ts +0 -7
- package/dist/types/ui/components/ExternalElementRenderer.d.ts.map +0 -1
- package/dist/types/ui/components/Inbox.d.ts +0 -24
- package/dist/types/ui/components/Inbox.d.ts.map +0 -1
- package/dist/types/ui/components/InboxTabs/InboxTab.d.ts +0 -16
- package/dist/types/ui/components/InboxTabs/InboxTab.d.ts.map +0 -1
- package/dist/types/ui/components/InboxTabs/InboxTabs.d.ts +0 -11
- package/dist/types/ui/components/InboxTabs/InboxTabs.d.ts.map +0 -1
- package/dist/types/ui/components/InboxTabs/index.d.ts +0 -2
- package/dist/types/ui/components/InboxTabs/index.d.ts.map +0 -1
- package/dist/types/ui/components/InboxTabs/useTabsDropdown.d.ts +0 -11
- package/dist/types/ui/components/InboxTabs/useTabsDropdown.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/DefaultNotification.d.ts +0 -12
- package/dist/types/ui/components/Notification/DefaultNotification.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/NewMessagesCta.d.ts +0 -6
- package/dist/types/ui/components/Notification/NewMessagesCta.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/Notification.d.ts +0 -12
- package/dist/types/ui/components/Notification/Notification.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/NotificationList.d.ts +0 -14
- package/dist/types/ui/components/Notification/NotificationList.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/NotificationListSkeleton.d.ts +0 -7
- package/dist/types/ui/components/Notification/NotificationListSkeleton.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/index.d.ts +0 -3
- package/dist/types/ui/components/Notification/index.d.ts.map +0 -1
- package/dist/types/ui/components/Renderer.d.ts +0 -44
- package/dist/types/ui/components/Renderer.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Bell/Bell.d.ts +0 -8
- package/dist/types/ui/components/elements/Bell/Bell.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Bell/DefaultBellContainer.d.ts +0 -6
- package/dist/types/ui/components/elements/Bell/DefaultBellContainer.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Bell/index.d.ts +0 -2
- package/dist/types/ui/components/elements/Bell/index.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Footer.d.ts +0 -2
- package/dist/types/ui/components/elements/Footer.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/ActionsContainer.d.ts +0 -6
- package/dist/types/ui/components/elements/Header/ActionsContainer.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/Header.d.ts +0 -6
- package/dist/types/ui/components/elements/Header/Header.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/MoreActionsDropdown.d.ts +0 -2
- package/dist/types/ui/components/elements/Header/MoreActionsDropdown.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/MoreActionsOptions.d.ts +0 -9
- package/dist/types/ui/components/elements/Header/MoreActionsOptions.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/PreferencesHeader.d.ts +0 -6
- package/dist/types/ui/components/elements/Header/PreferencesHeader.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/index.d.ts +0 -3
- package/dist/types/ui/components/elements/Header/index.d.ts.map +0 -1
- package/dist/types/ui/components/elements/InboxStatus/InboxStatusDropdown.d.ts +0 -2
- package/dist/types/ui/components/elements/InboxStatus/InboxStatusDropdown.d.ts.map +0 -1
- package/dist/types/ui/components/elements/InboxStatus/InboxStatusOptions.d.ts +0 -14
- package/dist/types/ui/components/elements/InboxStatus/InboxStatusOptions.d.ts.map +0 -1
- package/dist/types/ui/components/elements/InboxStatus/constants.d.ts +0 -11
- package/dist/types/ui/components/elements/InboxStatus/constants.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Preferences/ChannelRow.d.ts +0 -18
- package/dist/types/ui/components/elements/Preferences/ChannelRow.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Preferences/LoadingScreen.d.ts +0 -2
- package/dist/types/ui/components/elements/Preferences/LoadingScreen.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Preferences/Preferences.d.ts +0 -2
- package/dist/types/ui/components/elements/Preferences/Preferences.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Preferences/Switch.d.ts +0 -8
- package/dist/types/ui/components/elements/Preferences/Switch.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Preferences/index.d.ts +0 -2
- package/dist/types/ui/components/elements/Preferences/index.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Root.d.ts +0 -3
- package/dist/types/ui/components/elements/Root.d.ts.map +0 -1
- package/dist/types/ui/components/elements/index.d.ts +0 -6
- package/dist/types/ui/components/elements/index.d.ts.map +0 -1
- package/dist/types/ui/components/index.d.ts +0 -4
- package/dist/types/ui/components/index.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Button.d.ts +0 -13
- package/dist/types/ui/components/primitives/Button.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Dropdown/DropdownContent.d.ts +0 -8
- package/dist/types/ui/components/primitives/Dropdown/DropdownContent.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Dropdown/DropdownItem.d.ts +0 -9
- package/dist/types/ui/components/primitives/Dropdown/DropdownItem.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Dropdown/DropdownRoot.d.ts +0 -4
- package/dist/types/ui/components/primitives/Dropdown/DropdownRoot.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Dropdown/DropdownTrigger.d.ts +0 -8
- package/dist/types/ui/components/primitives/Dropdown/DropdownTrigger.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Dropdown/index.d.ts +0 -44
- package/dist/types/ui/components/primitives/Dropdown/index.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Popover/PopoverClose.d.ts +0 -7
- package/dist/types/ui/components/primitives/Popover/PopoverClose.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Popover/PopoverContent.d.ts +0 -9
- package/dist/types/ui/components/primitives/Popover/PopoverContent.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Popover/PopoverRoot.d.ts +0 -23
- package/dist/types/ui/components/primitives/Popover/PopoverRoot.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Popover/PopoverTrigger.d.ts +0 -9
- package/dist/types/ui/components/primitives/Popover/PopoverTrigger.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Popover/index.d.ts +0 -28
- package/dist/types/ui/components/primitives/Popover/index.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Skeleton.d.ts +0 -14
- package/dist/types/ui/components/primitives/Skeleton.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/TabsContent.d.ts +0 -10
- package/dist/types/ui/components/primitives/Tabs/TabsContent.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/TabsList.d.ts +0 -11
- package/dist/types/ui/components/primitives/Tabs/TabsList.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/TabsRoot.d.ts +0 -20
- package/dist/types/ui/components/primitives/Tabs/TabsRoot.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/TabsTrigger.d.ts +0 -13
- package/dist/types/ui/components/primitives/Tabs/TabsTrigger.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/index.d.ts +0 -35
- package/dist/types/ui/components/primitives/Tabs/index.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/useKeyboardNavigation.d.ts +0 -7
- package/dist/types/ui/components/primitives/Tabs/useKeyboardNavigation.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tooltip/TooltipContent.d.ts +0 -9
- package/dist/types/ui/components/primitives/Tooltip/TooltipContent.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tooltip/TooltipRoot.d.ts +0 -21
- package/dist/types/ui/components/primitives/Tooltip/TooltipRoot.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tooltip/TooltipTrigger.d.ts +0 -9
- package/dist/types/ui/components/primitives/Tooltip/TooltipTrigger.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tooltip/index.d.ts +0 -21
- package/dist/types/ui/components/primitives/Tooltip/index.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/index.d.ts +0 -5
- package/dist/types/ui/components/primitives/index.d.ts.map +0 -1
- package/dist/types/ui/config/appearanceKeys.d.ts +0 -2
- package/dist/types/ui/config/appearanceKeys.d.ts.map +0 -1
- package/dist/types/ui/config/defaultLocalization.d.ts +0 -26
- package/dist/types/ui/config/defaultLocalization.d.ts.map +0 -1
- package/dist/types/ui/config/defaultVariables.d.ts +0 -3
- package/dist/types/ui/config/defaultVariables.d.ts.map +0 -1
- package/dist/types/ui/config/index.d.ts +0 -4
- package/dist/types/ui/config/index.d.ts.map +0 -1
- package/dist/types/ui/context/AppearanceContext.d.ts +0 -17
- package/dist/types/ui/context/AppearanceContext.d.ts.map +0 -1
- package/dist/types/ui/context/CountContext.d.ts +0 -23
- package/dist/types/ui/context/CountContext.d.ts.map +0 -1
- package/dist/types/ui/context/FocusManagerContext.d.ts +0 -12
- package/dist/types/ui/context/FocusManagerContext.d.ts.map +0 -1
- package/dist/types/ui/context/InboxContext.d.ts +0 -25
- package/dist/types/ui/context/InboxContext.d.ts.map +0 -1
- package/dist/types/ui/context/LocalizationContext.d.ts +0 -24
- package/dist/types/ui/context/LocalizationContext.d.ts.map +0 -1
- package/dist/types/ui/context/NovuContext.d.ts +0 -11
- package/dist/types/ui/context/NovuContext.d.ts.map +0 -1
- package/dist/types/ui/context/index.d.ts +0 -7
- package/dist/types/ui/context/index.d.ts.map +0 -1
- package/dist/types/ui/helpers/browser.d.ts +0 -2
- package/dist/types/ui/helpers/browser.d.ts.map +0 -1
- package/dist/types/ui/helpers/constants.d.ts +0 -5
- package/dist/types/ui/helpers/constants.d.ts.map +0 -1
- package/dist/types/ui/helpers/createDelayedLoading.d.ts +0 -3
- package/dist/types/ui/helpers/createDelayedLoading.d.ts.map +0 -1
- package/dist/types/ui/helpers/createInfiniteScroll.d.ts +0 -19
- package/dist/types/ui/helpers/createInfiniteScroll.d.ts.map +0 -1
- package/dist/types/ui/helpers/formatToRelativeTime.d.ts +0 -6
- package/dist/types/ui/helpers/formatToRelativeTime.d.ts.map +0 -1
- package/dist/types/ui/helpers/index.d.ts +0 -7
- package/dist/types/ui/helpers/index.d.ts.map +0 -1
- package/dist/types/ui/helpers/types.d.ts +0 -4
- package/dist/types/ui/helpers/types.d.ts.map +0 -1
- package/dist/types/ui/helpers/useBrowserTabsChannel.d.ts +0 -7
- package/dist/types/ui/helpers/useBrowserTabsChannel.d.ts.map +0 -1
- package/dist/types/ui/helpers/useFocusTrap.d.ts +0 -7
- package/dist/types/ui/helpers/useFocusTrap.d.ts.map +0 -1
- package/dist/types/ui/helpers/useNovuEvent.d.ts +0 -6
- package/dist/types/ui/helpers/useNovuEvent.d.ts.map +0 -1
- package/dist/types/ui/helpers/useStyle.d.ts +0 -3
- package/dist/types/ui/helpers/useStyle.d.ts.map +0 -1
- package/dist/types/ui/helpers/useUncontrolledState.d.ts +0 -9
- package/dist/types/ui/helpers/useUncontrolledState.d.ts.map +0 -1
- package/dist/types/ui/helpers/useWebSocketEvent.d.ts +0 -6
- package/dist/types/ui/helpers/useWebSocketEvent.d.ts.map +0 -1
- package/dist/types/ui/helpers/utils.d.ts +0 -33
- package/dist/types/ui/helpers/utils.d.ts.map +0 -1
- package/dist/types/ui/icons/Archive.d.ts +0 -3
- package/dist/types/ui/icons/Archive.d.ts.map +0 -1
- package/dist/types/ui/icons/ArchiveRead.d.ts +0 -3
- package/dist/types/ui/icons/ArchiveRead.d.ts.map +0 -1
- package/dist/types/ui/icons/ArrowDropDown.d.ts +0 -3
- package/dist/types/ui/icons/ArrowDropDown.d.ts.map +0 -1
- package/dist/types/ui/icons/ArrowLeft.d.ts +0 -3
- package/dist/types/ui/icons/ArrowLeft.d.ts.map +0 -1
- package/dist/types/ui/icons/BellIcon.d.ts +0 -3
- package/dist/types/ui/icons/BellIcon.d.ts.map +0 -1
- package/dist/types/ui/icons/Chat.d.ts +0 -3
- package/dist/types/ui/icons/Chat.d.ts.map +0 -1
- package/dist/types/ui/icons/Check.d.ts +0 -3
- package/dist/types/ui/icons/Check.d.ts.map +0 -1
- package/dist/types/ui/icons/Dots.d.ts +0 -3
- package/dist/types/ui/icons/Dots.d.ts.map +0 -1
- package/dist/types/ui/icons/Email.d.ts +0 -3
- package/dist/types/ui/icons/Email.d.ts.map +0 -1
- package/dist/types/ui/icons/EmptyIcon.d.ts +0 -3
- package/dist/types/ui/icons/EmptyIcon.d.ts.map +0 -1
- package/dist/types/ui/icons/InApp.d.ts +0 -3
- package/dist/types/ui/icons/InApp.d.ts.map +0 -1
- package/dist/types/ui/icons/Inbox.d.ts +0 -3
- package/dist/types/ui/icons/Inbox.d.ts.map +0 -1
- package/dist/types/ui/icons/Lock.d.ts +0 -2
- package/dist/types/ui/icons/Lock.d.ts.map +0 -1
- package/dist/types/ui/icons/Novu.d.ts +0 -3
- package/dist/types/ui/icons/Novu.d.ts.map +0 -1
- package/dist/types/ui/icons/Push.d.ts +0 -3
- package/dist/types/ui/icons/Push.d.ts.map +0 -1
- package/dist/types/ui/icons/ReadAll.d.ts +0 -3
- package/dist/types/ui/icons/ReadAll.d.ts.map +0 -1
- package/dist/types/ui/icons/Settings.d.ts +0 -3
- package/dist/types/ui/icons/Settings.d.ts.map +0 -1
- package/dist/types/ui/icons/Sms.d.ts +0 -3
- package/dist/types/ui/icons/Sms.d.ts.map +0 -1
- package/dist/types/ui/icons/Unarchive.d.ts +0 -3
- package/dist/types/ui/icons/Unarchive.d.ts.map +0 -1
- package/dist/types/ui/icons/Unread.d.ts +0 -3
- package/dist/types/ui/icons/Unread.d.ts.map +0 -1
- package/dist/types/ui/icons/index.d.ts +0 -20
- package/dist/types/ui/icons/index.d.ts.map +0 -1
- package/dist/types/ui/index.d.ts +0 -6
- package/dist/types/ui/index.d.ts.map +0 -1
- package/dist/types/ui/novuUI.d.ts +0 -25
- package/dist/types/ui/novuUI.d.ts.map +0 -1
- package/dist/types/ui/themes/dark.d.ts +0 -3
- package/dist/types/ui/themes/dark.d.ts.map +0 -1
- package/dist/types/ui/themes/index.d.ts +0 -2
- package/dist/types/ui/themes/index.d.ts.map +0 -1
- package/dist/types/ui/types.d.ts +0 -57
- package/dist/types/ui/types.d.ts.map +0 -1
- package/dist/types/umd.d.ts +0 -2
- package/dist/types/umd.d.ts.map +0 -1
- package/dist/types/utils/arrays.d.ts +0 -2
- package/dist/types/utils/arrays.d.ts.map +0 -1
- package/dist/types/utils/config.d.ts +0 -2
- package/dist/types/utils/config.d.ts.map +0 -1
- package/dist/types/utils/errors.d.ts +0 -5
- package/dist/types/utils/errors.d.ts.map +0 -1
- package/dist/types/utils/inbox-service-singleton.d.ts +0 -6
- package/dist/types/utils/inbox-service-singleton.d.ts.map +0 -1
- package/dist/types/utils/notification-utils.d.ts +0 -6
- package/dist/types/utils/notification-utils.d.ts.map +0 -1
- package/dist/types/ws/index.d.ts +0 -2
- package/dist/types/ws/index.d.ts.map +0 -1
- package/dist/types/ws/socket.d.ts +0 -13
- package/dist/types/ws/socket.d.ts.map +0 -1
package/dist/novu.min.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";(()=>{var go=Object.create;var ri=Object.defineProperty,yo=Object.defineProperties,vo=Object.getOwnPropertyDescriptor,_o=Object.getOwnPropertyDescriptors,Eo=Object.getOwnPropertyNames,ii=Object.getOwnPropertySymbols,bo=Object.getPrototypeOf,Hi=Object.prototype.hasOwnProperty,Gr=Object.prototype.propertyIsEnumerable;var zr=i=>{throw TypeError(i)};var Hr=(i,e,t)=>e in i?ri(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,b=(i,e)=>{for(var t in e||(e={}))Hi.call(e,t)&&Hr(i,t,e[t]);if(ii)for(var t of ii(e))Gr.call(e,t)&&Hr(i,t,e[t]);return i},I=(i,e)=>yo(i,_o(e));var x=(i=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(i,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):i)(function(i){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Kr=(i,e)=>{var t={};for(var r in i)Hi.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&ii)for(var r of ii(i))e.indexOf(r)<0&&Gr.call(i,r)&&(t[r]=i[r]);return t};var O=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),Co=(i,e)=>{for(var t in e)ri(i,t,{get:e[t],enumerable:!0})},So=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Eo(e))!Hi.call(i,s)&&s!==t&&ri(i,s,{get:()=>e[s],enumerable:!(r=vo(e,s))||r.enumerable});return i};var Y=(i,e,t)=>(t=i!=null?go(bo(i)):{},So(e||!i||!i.__esModule?ri(t,"default",{value:i,enumerable:!0}):t,i));var Gi=(i,e,t)=>e.has(i)||zr("Cannot "+t);var h=(i,e,t)=>(Gi(i,e,"read from private field"),t?t.call(i):e.get(i)),_=(i,e,t)=>e.has(i)?zr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),E=(i,e,t,r)=>(Gi(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),zi=(i,e,t)=>(Gi(i,e,"access private method"),t);var g=(i,e,t)=>new Promise((r,s)=>{var n=c=>{try{a(t.next(c))}catch(u){s(u)}},o=c=>{try{a(t.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(n,o);a((t=t.apply(i,e)).next())});var er=O((Qf,hs)=>{"use strict";var nt=1e3,ot=nt*60,at=ot*60,De=at*24,Mo=De*7,qo=De*365.25;hs.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return $o(i);if(t==="number"&&isFinite(i))return e.long?Vo(i):Wo(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function $o(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*qo;case"weeks":case"week":case"w":return t*Mo;case"days":case"day":case"d":return t*De;case"hours":case"hour":case"hrs":case"hr":case"h":return t*at;case"minutes":case"minute":case"mins":case"min":case"m":return t*ot;case"seconds":case"second":case"secs":case"sec":case"s":return t*nt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Wo(i){var e=Math.abs(i);return e>=De?Math.round(i/De)+"d":e>=at?Math.round(i/at)+"h":e>=ot?Math.round(i/ot)+"m":e>=nt?Math.round(i/nt)+"s":i+"ms"}function Vo(i){var e=Math.abs(i);return e>=De?yi(i,e,De,"day"):e>=at?yi(i,e,at,"hour"):e>=ot?yi(i,e,ot,"minute"):e>=nt?yi(i,e,nt,"second"):i+" ms"}function yi(i,e,t,r){var s=e>=t*1.5;return Math.round(i/t)+" "+r+(s?"s":"")}});var tr=O((Zf,us)=>{"use strict";function jo(i){t.debug=t,t.default=t,t.coerce=c,t.disable=n,t.enable=s,t.enabled=o,t.humanize=er(),t.destroy=u,Object.keys(i).forEach(l=>{t[l]=i[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let f=0;for(let d=0;d<l.length;d++)f=(f<<5)-f+l.charCodeAt(d),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(l){let f,d=null,S,w;function p(...v){if(!p.enabled)return;let N=p,A=Number(new Date),m=A-(f||A);N.diff=m,N.prev=f,N.curr=A,f=A,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let y=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(R,H)=>{if(R==="%%")return"%";y++;let K=t.formatters[H];if(typeof K=="function"){let me=v[y];R=K.call(N,me),v.splice(y,1),y--}return R}),t.formatArgs.call(N,v),(N.log||t.log).apply(N,v)}return p.namespace=l,p.useColors=t.useColors(),p.color=t.selectColor(l),p.extend=r,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(S!==t.namespaces&&(S=t.namespaces,w=t.enabled(l)),w),set:v=>{d=v}}),typeof t.init=="function"&&t.init(p),p}function r(l,f){let d=t(this.namespace+(typeof f=="undefined"?":":f)+l);return d.log=this.log,d}function s(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let f,d=(typeof l=="string"?l:"").split(/[\s,]+/),S=d.length;for(f=0;f<S;f++)d[f]&&(l=d[f].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.slice(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function n(){let l=[...t.names.map(a),...t.skips.map(a).map(f=>"-"+f)].join(",");return t.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let f,d;for(f=0,d=t.skips.length;f<d;f++)if(t.skips[f].test(l))return!1;for(f=0,d=t.names.length;f<d;f++)if(t.names[f].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}us.exports=jo});var ds=O((Z,vi)=>{"use strict";Z.formatArgs=Go;Z.save=zo;Z.load=Ko;Z.useColors=Ho;Z.storage=Yo();Z.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Z.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ho(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Go(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+vi.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),i.splice(r,0,e)}Z.log=console.debug||console.log||(()=>{});function zo(i){try{i?Z.storage.setItem("debug",i):Z.storage.removeItem("debug")}catch(e){}}function Ko(){let i;try{i=Z.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Yo(){try{return localStorage}catch(i){}}vi.exports=tr()(Z);var{formatters:Jo}=vi.exports;Jo.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var ir=O((eh,ps)=>{"use strict";ps.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),s=e.indexOf("--");return r!==-1&&(s===-1||r<s)}});var ys=O((th,gs)=>{"use strict";var Xo=x("os"),ms=x("tty"),ae=ir(),{env:q}=process,_i;ae("no-color")||ae("no-colors")||ae("color=false")||ae("color=never")?_i=0:(ae("color")||ae("colors")||ae("color=true")||ae("color=always"))&&(_i=1);function Qo(){if("FORCE_COLOR"in q)return q.FORCE_COLOR==="true"?1:q.FORCE_COLOR==="false"?0:q.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(q.FORCE_COLOR,10),3)}function Zo(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function ea(i,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=Qo();r!==void 0&&(_i=r);let s=t?_i:r;if(s===0)return 0;if(t){if(ae("color=16m")||ae("color=full")||ae("color=truecolor"))return 3;if(ae("color=256"))return 2}if(i&&!e&&s===void 0)return 0;let n=s||0;if(q.TERM==="dumb")return n;if(process.platform==="win32"){let o=Xo.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in q)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in q)||q.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in q)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(q.TEAMCITY_VERSION)?1:0;if(q.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in q){let o=Number.parseInt((q.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(q.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(q.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(q.TERM)||"COLORTERM"in q?1:n}function rr(i,e={}){let t=ea(i,b({streamIsTTY:i&&i.isTTY},e));return Zo(t)}gs.exports={supportsColor:rr,stdout:rr({isTTY:ms.isatty(1)}),stderr:rr({isTTY:ms.isatty(2)})}});var _s=O(($,bi)=>{"use strict";var ta=x("tty"),Ei=x("util");$.init=ca;$.log=na;$.formatArgs=ra;$.save=oa;$.load=aa;$.useColors=ia;$.destroy=Ei.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");$.colors=[6,2,3,4,5,1];try{let i=ys();i&&(i.stderr||i).level>=2&&($.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(i){}$.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,n)=>n.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function ia(){return"colors"in $.inspectOpts?!!$.inspectOpts.colors:ta.isatty(process.stderr.fd)}function ra(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),n=` ${s};1m${e} \x1B[0m`;i[0]=n+i[0].split(`
|
|
1
|
+
"use strict";(()=>{var ho=Object.create;var Qt=Object.defineProperty,uo=Object.defineProperties,po=Object.getOwnPropertyDescriptor,mo=Object.getOwnPropertyDescriptors,go=Object.getOwnPropertyNames,Xt=Object.getOwnPropertySymbols,yo=Object.getPrototypeOf,$i=Object.prototype.hasOwnProperty,Wr=Object.prototype.propertyIsEnumerable;var Vr=i=>{throw TypeError(i)};var $r=(i,e,t)=>e in i?Qt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,b=(i,e)=>{for(var t in e||(e={}))$i.call(e,t)&&$r(i,t,e[t]);if(Xt)for(var t of Xt(e))Wr.call(e,t)&&$r(i,t,e[t]);return i},I=(i,e)=>uo(i,mo(e));var S=(i=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(i,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):i)(function(i){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var jr=(i,e)=>{var t={};for(var r in i)$i.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&Xt)for(var r of Xt(i))e.indexOf(r)<0&&Wr.call(i,r)&&(t[r]=i[r]);return t};var k=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),vo=(i,e)=>{for(var t in e)Qt(i,t,{get:e[t],enumerable:!0})},_o=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of go(e))!$i.call(i,s)&&s!==t&&Qt(i,s,{get:()=>e[s],enumerable:!(r=po(e,s))||r.enumerable});return i};var K=(i,e,t)=>(t=i!=null?ho(yo(i)):{},_o(e||!i||!i.__esModule?Qt(t,"default",{value:i,enumerable:!0}):t,i));var Wi=(i,e,t)=>e.has(i)||Vr("Cannot "+t);var f=(i,e,t)=>(Wi(i,e,"read from private field"),t?t.call(i):e.get(i)),_=(i,e,t)=>e.has(i)?Vr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),E=(i,e,t,r)=>(Wi(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Vi=(i,e,t)=>(Wi(i,e,"access private method"),t);var g=(i,e,t)=>new Promise((r,s)=>{var n=c=>{try{a(t.next(c))}catch(u){s(u)}},o=c=>{try{a(t.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(n,o);a((t=t.apply(i,e)).next())});var Ji=k((gf,as)=>{"use strict";var rt=1e3,st=rt*60,nt=st*60,Ue=nt*24,ko=Ue*7,Oo=Ue*365.25;as.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return To(i);if(t==="number"&&isFinite(i))return e.long?Po(i):Io(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function To(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*Oo;case"weeks":case"week":case"w":return t*ko;case"days":case"day":case"d":return t*Ue;case"hours":case"hour":case"hrs":case"hr":case"h":return t*nt;case"minutes":case"minute":case"mins":case"min":case"m":return t*st;case"seconds":case"second":case"secs":case"sec":case"s":return t*rt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Io(i){var e=Math.abs(i);return e>=Ue?Math.round(i/Ue)+"d":e>=nt?Math.round(i/nt)+"h":e>=st?Math.round(i/st)+"m":e>=rt?Math.round(i/rt)+"s":i+"ms"}function Po(i){var e=Math.abs(i);return e>=Ue?ui(i,e,Ue,"day"):e>=nt?ui(i,e,nt,"hour"):e>=st?ui(i,e,st,"minute"):e>=rt?ui(i,e,rt,"second"):i+" ms"}function ui(i,e,t,r){var s=e>=t*1.5;return Math.round(i/t)+" "+r+(s?"s":"")}});var Xi=k((yf,cs)=>{"use strict";function Fo(i){t.debug=t,t.default=t,t.coerce=c,t.disable=n,t.enable=s,t.enabled=o,t.humanize=Ji(),t.destroy=u,Object.keys(i).forEach(l=>{t[l]=i[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(l){let h,d=null,x,w;function p(...v){if(!p.enabled)return;let N=p,A=Number(new Date),m=A-(h||A);N.diff=m,N.prev=h,N.curr=A,h=A,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let y=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(R,j)=>{if(R==="%%")return"%";y++;let z=t.formatters[j];if(typeof z=="function"){let pe=v[y];R=z.call(N,pe),v.splice(y,1),y--}return R}),t.formatArgs.call(N,v),(N.log||t.log).apply(N,v)}return p.namespace=l,p.useColors=t.useColors(),p.color=t.selectColor(l),p.extend=r,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(x!==t.namespaces&&(x=t.namespaces,w=t.enabled(l)),w),set:v=>{d=v}}),typeof t.init=="function"&&t.init(p),p}function r(l,h){let d=t(this.namespace+(typeof h=="undefined"?":":h)+l);return d.log=this.log,d}function s(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let h,d=(typeof l=="string"?l:"").split(/[\s,]+/),x=d.length;for(h=0;h<x;h++)d[h]&&(l=d[h].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.slice(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function n(){let l=[...t.names.map(a),...t.skips.map(a).map(h=>"-"+h)].join(",");return t.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let h,d;for(h=0,d=t.skips.length;h<d;h++)if(t.skips[h].test(l))return!1;for(h=0,d=t.names.length;h<d;h++)if(t.names[h].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}cs.exports=Fo});var ls=k((Q,di)=>{"use strict";Q.formatArgs=Bo;Q.save=Uo;Q.load=Do;Q.useColors=Lo;Q.storage=Mo();Q.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Q.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Lo(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Bo(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+di.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),i.splice(r,0,e)}Q.log=console.debug||console.log||(()=>{});function Uo(i){try{i?Q.storage.setItem("debug",i):Q.storage.removeItem("debug")}catch(e){}}function Do(){let i;try{i=Q.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Mo(){try{return localStorage}catch(i){}}di.exports=Xi()(Q);var{formatters:qo}=di.exports;qo.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Qi=k((vf,fs)=>{"use strict";fs.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),s=e.indexOf("--");return r!==-1&&(s===-1||r<s)}});var ds=k((_f,us)=>{"use strict";var $o=S("os"),hs=S("tty"),ne=Qi(),{env:M}=process,pi;ne("no-color")||ne("no-colors")||ne("color=false")||ne("color=never")?pi=0:(ne("color")||ne("colors")||ne("color=true")||ne("color=always"))&&(pi=1);function Wo(){if("FORCE_COLOR"in M)return M.FORCE_COLOR==="true"?1:M.FORCE_COLOR==="false"?0:M.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(M.FORCE_COLOR,10),3)}function Vo(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function jo(i,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=Wo();r!==void 0&&(pi=r);let s=t?pi:r;if(s===0)return 0;if(t){if(ne("color=16m")||ne("color=full")||ne("color=truecolor"))return 3;if(ne("color=256"))return 2}if(i&&!e&&s===void 0)return 0;let n=s||0;if(M.TERM==="dumb")return n;if(process.platform==="win32"){let o=$o.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in M)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in M)||M.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in M)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(M.TEAMCITY_VERSION)?1:0;if(M.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in M){let o=Number.parseInt((M.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(M.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(M.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(M.TERM)||"COLORTERM"in M?1:n}function Zi(i,e={}){let t=jo(i,b({streamIsTTY:i&&i.isTTY},e));return Vo(t)}us.exports={supportsColor:Zi,stdout:Zi({isTTY:hs.isatty(1)}),stderr:Zi({isTTY:hs.isatty(2)})}});var ms=k((q,gi)=>{"use strict";var Ho=S("tty"),mi=S("util");q.init=Qo;q.log=Yo;q.formatArgs=zo;q.save=Jo;q.load=Xo;q.useColors=Go;q.destroy=mi.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");q.colors=[6,2,3,4,5,1];try{let i=ds();i&&(i.stderr||i).level>=2&&(q.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(i){}q.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,n)=>n.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function Go(){return"colors"in q.inspectOpts?!!q.inspectOpts.colors:Ho.isatty(process.stderr.fd)}function zo(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),n=` ${s};1m${e} \x1B[0m`;i[0]=n+i[0].split(`
|
|
2
2
|
`).join(`
|
|
3
|
-
`+n),i.push(s+"m+"+
|
|
4
|
-
`)}function
|
|
5
|
-
`).map(e=>e.trim()).join(" ")};
|
|
6
|
-
`);return m.substr(0,m.length-2)},this.getRequestHeader=function(m){return typeof m=="string"&&u[m]?u[m]:""},this.send=function(m){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(d)throw new Error("INVALID_STATE_ERR: send has already been called");var y=!1,j=!1,R=As.parse(o.url),H;switch(R.protocol){case"https:":y=!0;case"http:":H=R.hostname;break;case"file:":j=!0;break;case void 0:case"":H="localhost";break;default:throw new Error("Protocol not supported.")}if(j){if(o.method!=="GET")throw new Error("XMLHttpRequest: Only GET method is supported");if(o.async)ct.readFile(unescape(R.pathname),"utf8",function(se,ze){se?e.handleError(se,se.errno||-1):(e.status=200,e.responseText=ze,A(e.DONE))});else try{this.responseText=ct.readFileSync(unescape(R.pathname),"utf8"),this.status=200,A(e.DONE)}catch(se){this.handleError(se,se.errno||-1)}return}var K=R.port||(y?443:80),me=R.pathname+(R.search?R.search:"");if(u.Host=H,y&&K===443||K===80||(u.Host+=":"+R.port),o.user){typeof o.password=="undefined"&&(o.password="");var Zt=new Buffer(o.user+":"+o.password);u.Authorization="Basic "+Zt.toString("base64")}o.method==="GET"||o.method==="HEAD"?m=null:m?(u["Content-Length"]=Buffer.isBuffer(m)?m.length:Buffer.byteLength(m),u["Content-Type"]||(u["Content-Type"]="text/plain;charset=UTF-8")):o.method==="POST"&&(u["Content-Length"]=0);var ei=i.agent||!1,re={host:H,port:K,path:me,method:o.method,headers:u,agent:ei};if(y&&(re.pfx=i.pfx,re.key=i.key,re.passphrase=i.passphrase,re.cert=i.cert,re.ca=i.ca,re.ciphers=i.ciphers,re.rejectUnauthorized=i.rejectUnauthorized!==!1),S=!1,o.async){var Ge=y?r.request:t.request;d=!0,e.dispatchEvent("readystatechange");var Vr=function(se){if(n=se,n.statusCode===302||n.statusCode===303||n.statusCode===307){o.url=n.headers.location;var ze=As.parse(o.url);H=ze.hostname;var xe={hostname:ze.hostname,port:ze.port,path:ze.path,method:n.statusCode===303?"GET":o.method,headers:u};y&&(xe.pfx=i.pfx,xe.key=i.key,xe.passphrase=i.passphrase,xe.cert=i.cert,xe.ca=i.ca,xe.ciphers=i.ciphers,xe.rejectUnauthorized=i.rejectUnauthorized!==!1),s=Ge(xe,Vr).on("error",jr),s.end();return}n&&n.setEncoding&&n.setEncoding("utf8"),A(e.HEADERS_RECEIVED),e.status=n.statusCode,n.on("data",function(ti){ti&&(e.responseText+=ti),d&&A(e.LOADING)}),n.on("end",function(){d&&(d=!1,A(e.DONE))}),n.on("error",function(ti){e.handleError(ti)})},jr=function(se){e.handleError(se)};s=Ge(re,Vr).on("error",jr),i.autoUnref&&s.on("socket",se=>{se.unref()}),m&&s.write(m),s.end(),e.dispatchEvent("loadstart")}else{var _t=".node-xmlhttprequest-content-"+process.pid,Et=".node-xmlhttprequest-sync-"+process.pid;ct.writeFileSync(Et,"","utf8");for(var uo="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(y?"s":"")+".request;var options = "+JSON.stringify(re)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+_t+"', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');fs.unlinkSync('"+Et+"');});response.on('error', function(error) {fs.writeFileSync('"+_t+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+Et+"');});}).on('error', function(error) {fs.writeFileSync('"+_t+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+Et+"');});"+(m?"req.write('"+JSON.stringify(m).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",po=ha(process.argv[0],["-e",uo]),sl;ct.existsSync(Et););if(e.responseText=ct.readFileSync(_t,"utf8"),po.stdin.end(),ct.unlinkSync(_t),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var mo=e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,"");e.handleError(mo,503)}else e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1"),e.responseText=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"),A(e.DONE)}},this.handleError=function(m,y){this.status=y||0,this.statusText=m,this.responseText=m.stack,S=!0,A(this.DONE)},this.abort=function(){s&&(s.abort(),s=null),u=Object.assign({},c),this.responseText="",this.responseXML="",S=w=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||d)&&this.readyState!==this.DONE&&(d=!1,A(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(m,y){m in p||(p[m]=[]),p[m].push(y)},this.removeEventListener=function(m,y){m in p&&(p[m]=p[m].filter(function(j){return j!==y}))},this.dispatchEvent=function(m){if(typeof e["on"+m]=="function"&&(this.readyState===this.DONE?setImmediate(function(){e["on"+m]()}):e["on"+m]()),m in p)for(let y=0,j=p[m].length;y<j;y++)this.readyState===this.DONE?setImmediate(function(){p[m][y].call(e)}):p[m][y].call(e)};var A=function(m){if(!(e.readyState===m||e.readyState===e.UNSENT&&w)&&(e.readyState=m,(o.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let y;w?y="abort":S?y="error":y="load",e.dispatchEvent(y),e.dispatchEvent("loadend")}}}});var Bs=O((bh,Ls)=>{"use strict";var{Duplex:ma}=x("stream");function Ps(i){i.emit("close")}function ga(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Fs(i){this.removeListener("error",Fs),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function ya(i,e){let t=!0,r=new ma(I(b({},e),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return i.on("message",function(n,o){let a=!o&&r._readableState.objectMode?n.toString():n;r.push(a)||i.pause()}),i.once("error",function(n){r.destroyed||(t=!1,r.destroy(n))}),i.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(s,n){if(i.readyState===i.CLOSED){n(s),process.nextTick(Ps,r);return}let o=!1;i.once("error",function(c){o=!0,n(c)}),i.once("close",function(){o||n(s),process.nextTick(Ps,r)}),t&&i.terminate()},r._final=function(s){if(i.readyState===i.CONNECTING){i.once("open",function(){r._final(s)});return}i._socket!==null&&(i._socket._writableState.finished?(s(),r._readableState.endEmitted&&r.destroy()):(i._socket.once("finish",function(){s()}),i.close()))},r._read=function(){i.isPaused&&i.resume()},r._write=function(s,n,o){if(i.readyState===i.CONNECTING){i.once("open",function(){r._write(s,n,o)});return}i.send(s,o)},r.on("end",ga),r.on("error",Fs),r}Ls.exports=ya});var ke=O((Sh,Us)=>{"use strict";Us.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Pt=O((xh,wi)=>{"use strict";var{EMPTY_BUFFER:va}=ke();function _a(i,e){if(i.length===0)return va;if(i.length===1)return i[0];let t=Buffer.allocUnsafe(e),r=0;for(let s=0;s<i.length;s++){let n=i[s];t.set(n,r),r+=n.length}return r<e?t.slice(0,r):t}function Ds(i,e,t,r,s){for(let n=0;n<s;n++)t[r+n]=i[n]^e[n&3]}function Ms(i,e){for(let t=0;t<i.length;t++)i[t]^=e[t&3]}function Ea(i){return i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}function hr(i){if(hr.readOnly=!0,Buffer.isBuffer(i))return i;let e;return i instanceof ArrayBuffer?e=Buffer.from(i):ArrayBuffer.isView(i)?e=Buffer.from(i.buffer,i.byteOffset,i.byteLength):(e=Buffer.from(i),hr.readOnly=!1),e}wi.exports={concat:_a,mask:Ds,toArrayBuffer:Ea,toBuffer:hr,unmask:Ms};if(!process.env.WS_NO_BUFFER_UTIL)try{let i=x("bufferutil");wi.exports.mask=function(e,t,r,s,n){n<48?Ds(e,t,r,s,n):i.mask(e,t,r,s,n)},wi.exports.unmask=function(e,t){e.length<32?Ms(e,t):i.unmask(e,t)}}catch(i){}});var Ws=O((wh,$s)=>{"use strict";var qs=Symbol("kDone"),ur=Symbol("kRun"),dr=class{constructor(e){this[qs]=()=>{this.pending--,this[ur]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ur]()}[ur](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[qs])}}};$s.exports=dr});var Bt=O((Nh,Gs)=>{"use strict";var Ft=x("zlib"),Vs=Pt(),ba=Ws(),{kStatusCode:js}=ke(),Ca=Buffer.from([0,0,255,255]),Ri=Symbol("permessage-deflate"),be=Symbol("total-length"),Lt=Symbol("callback"),Te=Symbol("buffers"),Ai=Symbol("error"),Ni,pr=class{constructor(e,t,r){if(this._maxPayload=r|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!Ni){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Ni=new ba(s)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Lt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,r=e.find(s=>!(t.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>s.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(r.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?r.client_max_window_bits=t.clientMaxWindowBits:(r.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(r=>{let s=t[r];if(s.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(s=s[0],r==="client_max_window_bits"){if(s!==!0){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else if(r==="server_max_window_bits"){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=s})}),e}decompress(e,t,r){Ni.add(s=>{this._decompress(e,t,(n,o)=>{s(),r(n,o)})})}compress(e,t,r){Ni.add(s=>{this._compress(e,t,(n,o)=>{s(),r(n,o)})})}_decompress(e,t,r){let s=this._isServer?"client":"server";if(!this._inflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?Ft.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=Ft.createInflateRaw(I(b({},this._options.zlibInflateOptions),{windowBits:o})),this._inflate[Ri]=this,this._inflate[be]=0,this._inflate[Te]=[],this._inflate.on("error",xa),this._inflate.on("data",Hs)}this._inflate[Lt]=r,this._inflate.write(e),t&&this._inflate.write(Ca),this._inflate.flush(()=>{let n=this._inflate[Ai];if(n){this._inflate.close(),this._inflate=null,r(n);return}let o=Vs.concat(this._inflate[Te],this._inflate[be]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[be]=0,this._inflate[Te]=[],t&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){let s=this._isServer?"server":"client";if(!this._deflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?Ft.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=Ft.createDeflateRaw(I(b({},this._options.zlibDeflateOptions),{windowBits:o})),this._deflate[be]=0,this._deflate[Te]=[],this._deflate.on("data",Sa)}this._deflate[Lt]=r,this._deflate.write(e),this._deflate.flush(Ft.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Vs.concat(this._deflate[Te],this._deflate[be]);t&&(n=n.slice(0,n.length-4)),this._deflate[Lt]=null,this._deflate[be]=0,this._deflate[Te]=[],t&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),r(null,n)})}};Gs.exports=pr;function Sa(i){this[Te].push(i),this[be]+=i.length}function Hs(i){if(this[be]+=i.length,this[Ri]._maxPayload<1||this[be]<=this[Ri]._maxPayload){this[Te].push(i);return}this[Ai]=new RangeError("Max payload size exceeded"),this[Ai].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Ai][js]=1009,this.removeListener("data",Hs),this.reset()}function xa(i){this[Ri]._inflate=null,i[js]=1007,this[Lt](i)}});var Ut=O((Rh,mr)=>{"use strict";var wa=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,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,0,0,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,0,1,0];function Na(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function zs(i){let e=i.length,t=0;for(;t<e;)if(!(i[t]&128))t++;else if((i[t]&224)===192){if(t+1===e||(i[t+1]&192)!==128||(i[t]&254)===192)return!1;t+=2}else if((i[t]&240)===224){if(t+2>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||i[t]===224&&(i[t+1]&224)===128||i[t]===237&&(i[t+1]&224)===160)return!1;t+=3}else if((i[t]&248)===240){if(t+3>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||(i[t+3]&192)!==128||i[t]===240&&(i[t+1]&240)===128||i[t]===244&&i[t+1]>143||i[t]>244)return!1;t+=4}else return!1;return!0}mr.exports={isValidStatusCode:Na,isValidUTF8:zs,tokenChars:wa};if(!process.env.WS_NO_UTF_8_VALIDATE)try{let i=x("utf-8-validate");mr.exports.isValidUTF8=function(e){return e.length<150?zs(e):i(e)}}catch(i){}});var _r=O((Oh,en)=>{"use strict";var{Writable:Aa}=x("stream"),Ks=Bt(),{BINARY_TYPES:Ra,EMPTY_BUFFER:Ys,kStatusCode:Oa,kWebSocket:ka}=ke(),{concat:gr,toArrayBuffer:Ta,unmask:Ia}=Pt(),{isValidStatusCode:Pa,isValidUTF8:Js}=Ut(),Dt=0,Xs=1,Qs=2,Zs=3,yr=4,Fa=5,vr=class extends Aa{constructor(e={}){super(),this._binaryType=e.binaryType||Ra[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[ka]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=Dt,this._loop=!1}_write(e,t,r){if(this._opcode===8&&this._state==Dt)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=r.slice(e),r.slice(0,e)}let t=Buffer.allocUnsafe(e);do{let r=this._buffers[0],s=t.length-e;e>=r.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),s),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do switch(this._state){case Dt:t=this.getInfo();break;case Xs:t=this.getPayloadLength16();break;case Qs:t=this.getPayloadLength64();break;case Zs:this.getMask();break;case yr:t=this.getData(e);break;default:this._loop=!1;return}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}let e=this.consume(2);if(e[0]&48)return this._loop=!1,B(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");let t=(e[0]&64)===64;if(t&&!this._extensions[Ks.extensionName])return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,B(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,B(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,B(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}else return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._isServer){if(!this._masked)return this._loop=!1,B(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,B(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(this._payloadLength===126)this._state=Xs;else if(this._payloadLength===127)this._state=Qs;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}let e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,B(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=Zs:this._state=yr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=yr}getData(e){let t=Ys;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&Ia(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=Fa,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[Ks.extensionName].decompress(e,this._fin,(s,n)=>{if(s)return t(s);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}let o=this.dataMessage();if(o)return t(o);this.startLoop(t)})}dataMessage(){if(this._fin){let e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=gr(t,e):this._binaryType==="arraybuffer"?r=Ta(gr(t,e)):r=t,this.emit("message",r,!0)}else{let r=gr(t,e);if(!this._skipUTF8Validation&&!Js(r))return this._loop=!1,B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=Dt}controlMessage(e){if(this._opcode===8)if(this._loop=!1,e.length===0)this.emit("conclude",1005,Ys),this.end();else{if(e.length===1)return B(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{let t=e.readUInt16BE(0);if(!Pa(t))return B(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");let r=e.slice(2);if(!this._skipUTF8Validation&&!Js(r))return B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r),this.end()}}else this._opcode===9?this.emit("ping",e):this.emit("pong",e);this._state=Dt}};en.exports=vr;function B(i,e,t,r,s){let n=new i(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(n,B),n.code=s,n[Oa]=r,n}});var br=O((Ih,sn)=>{"use strict";var kh=x("net"),Th=x("tls"),{randomFillSync:La}=x("crypto"),tn=Bt(),{EMPTY_BUFFER:Ba}=ke(),{isValidStatusCode:Ua}=Ut(),{mask:rn,toBuffer:lt}=Pt(),pe=Symbol("kByteLength"),Da=Buffer.alloc(4),Er=class i{constructor(e,t,r){this._extensions=t||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let r,s=!1,n=2,o=!1;t.mask&&(r=t.maskBuffer||Da,t.generateMask?t.generateMask(r):La(r,0,4),o=(r[0]|r[1]|r[2]|r[3])===0,n=6);let a;typeof e=="string"?(!t.mask||o)&&t[pe]!==void 0?a=t[pe]:(e=Buffer.from(e),a=e.length):(a=e.length,s=t.mask&&t.readOnly&&!o);let c=a;a>=65536?(n+=8,c=127):a>125&&(n+=2,c=126);let u=Buffer.allocUnsafe(s?a+n:n);return u[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(u[0]|=64),u[1]=c,c===126?u.writeUInt16BE(a,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),t.mask?(u[1]|=128,u[n-4]=r[0],u[n-3]=r[1],u[n-2]=r[2],u[n-1]=r[3],o?[u,e]:s?(rn(e,r,u,n,a),[u]):(rn(e,r,e,0,a),[u,e])):[u,e]}close(e,t,r,s){let n;if(e===void 0)n=Ba;else{if(typeof e!="number"||!Ua(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let a=Buffer.byteLength(t);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+a),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}let o={[pe]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,s]):this.sendFrame(i.frame(n,o),s)}ping(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=lt(e),s=e.length,n=lt.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[pe]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}pong(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=lt(e),s=e.length,n=lt.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[pe]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}send(e,t,r){let s=this._extensions[tn.extensionName],n=t.binary?2:1,o=t.compress,a,c;if(typeof e=="string"?(a=Buffer.byteLength(e),c=!1):(e=lt(e),a=e.length,c=lt.readOnly),this._firstFragment?(this._firstFragment=!1,o&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=a>=s._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),s){let u={[pe]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,u,r]):this.dispatch(e,this._compress,u,r)}else this.sendFrame(i.frame(e,{[pe]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:!1}),r)}dispatch(e,t,r,s){if(!t){this.sendFrame(i.frame(e,r),s);return}let n=this._extensions[tn.extensionName];this._bufferedBytes+=r[pe],this._deflating=!0,n.compress(e,r.fin,(o,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");typeof s=="function"&&s(c);for(let u=0;u<this._queue.length;u++){let l=this._queue[u],f=l[l.length-1];typeof f=="function"&&f(c)}return}this._bufferedBytes-=r[pe],this._deflating=!1,r.readOnly=!1,this.sendFrame(i.frame(a,r),s),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][pe],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][pe],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};sn.exports=Er});var dn=O((Ph,un)=>{"use strict";var{kForOnEventAttribute:Mt,kListener:Cr}=ke(),nn=Symbol("kCode"),on=Symbol("kData"),an=Symbol("kError"),cn=Symbol("kMessage"),ln=Symbol("kReason"),ft=Symbol("kTarget"),fn=Symbol("kType"),hn=Symbol("kWasClean"),Ce=class{constructor(e){this[ft]=null,this[fn]=e}get target(){return this[ft]}get type(){return this[fn]}};Object.defineProperty(Ce.prototype,"target",{enumerable:!0});Object.defineProperty(Ce.prototype,"type",{enumerable:!0});var qe=class extends Ce{constructor(e,t={}){super(e),this[nn]=t.code===void 0?0:t.code,this[ln]=t.reason===void 0?"":t.reason,this[hn]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[nn]}get reason(){return this[ln]}get wasClean(){return this[hn]}};Object.defineProperty(qe.prototype,"code",{enumerable:!0});Object.defineProperty(qe.prototype,"reason",{enumerable:!0});Object.defineProperty(qe.prototype,"wasClean",{enumerable:!0});var ht=class extends Ce{constructor(e,t={}){super(e),this[an]=t.error===void 0?null:t.error,this[cn]=t.message===void 0?"":t.message}get error(){return this[an]}get message(){return this[cn]}};Object.defineProperty(ht.prototype,"error",{enumerable:!0});Object.defineProperty(ht.prototype,"message",{enumerable:!0});var qt=class extends Ce{constructor(e,t={}){super(e),this[on]=t.data===void 0?null:t.data}get data(){return this[on]}};Object.defineProperty(qt.prototype,"data",{enumerable:!0});var Ma={addEventListener(i,e,t={}){for(let s of this.listeners(i))if(!t[Mt]&&s[Cr]===e&&!s[Mt])return;let r;if(i==="message")r=function(n,o){let a=new qt("message",{data:o?n:n.toString()});a[ft]=this,Oi(e,this,a)};else if(i==="close")r=function(n,o){let a=new qe("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[ft]=this,Oi(e,this,a)};else if(i==="error")r=function(n){let o=new ht("error",{error:n,message:n.message});o[ft]=this,Oi(e,this,o)};else if(i==="open")r=function(){let n=new Ce("open");n[ft]=this,Oi(e,this,n)};else return;r[Mt]=!!t[Mt],r[Cr]=e,t.once?this.once(i,r):this.on(i,r)},removeEventListener(i,e){for(let t of this.listeners(i))if(t[Cr]===e&&!t[Mt]){this.removeListener(i,t);break}}};un.exports={CloseEvent:qe,ErrorEvent:ht,Event:Ce,EventTarget:Ma,MessageEvent:qt};function Oi(i,e,t){typeof i=="object"&&i.handleEvent?i.handleEvent.call(i,t):i.call(e,t)}});var Sr=O((Fh,pn)=>{"use strict";var{tokenChars:$t}=Ut();function ge(i,e,t){i[e]===void 0?i[e]=[t]:i[e].push(t)}function qa(i){let e=Object.create(null),t=Object.create(null),r=!1,s=!1,n=!1,o,a,c=-1,u=-1,l=-1,f=0;for(;f<i.length;f++)if(u=i.charCodeAt(f),o===void 0)if(l===-1&&$t[u]===1)c===-1&&(c=f);else if(f!==0&&(u===32||u===9))l===-1&&c!==-1&&(l=f);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${f}`);l===-1&&(l=f);let S=i.slice(c,l);u===44?(ge(e,S,t),t=Object.create(null)):o=S,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${f}`);else if(a===void 0)if(l===-1&&$t[u]===1)c===-1&&(c=f);else if(u===32||u===9)l===-1&&c!==-1&&(l=f);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${f}`);l===-1&&(l=f),ge(t,i.slice(c,l),!0),u===44&&(ge(e,o,t),t=Object.create(null),o=void 0),c=l=-1}else if(u===61&&c!==-1&&l===-1)a=i.slice(c,f),c=l=-1;else throw new SyntaxError(`Unexpected character at index ${f}`);else if(s){if($t[u]!==1)throw new SyntaxError(`Unexpected character at index ${f}`);c===-1?c=f:r||(r=!0),s=!1}else if(n)if($t[u]===1)c===-1&&(c=f);else if(u===34&&c!==-1)n=!1,l=f;else if(u===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${f}`);else if(u===34&&i.charCodeAt(f-1)===61)n=!0;else if(l===-1&&$t[u]===1)c===-1&&(c=f);else if(c!==-1&&(u===32||u===9))l===-1&&(l=f);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${f}`);l===-1&&(l=f);let S=i.slice(c,l);r&&(S=S.replace(/\\/g,""),r=!1),ge(t,a,S),u===44&&(ge(e,o,t),t=Object.create(null),o=void 0),a=void 0,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${f}`);if(c===-1||n||u===32||u===9)throw new SyntaxError("Unexpected end of input");l===-1&&(l=f);let d=i.slice(c,l);return o===void 0?ge(e,d,t):(a===void 0?ge(t,d,!0):r?ge(t,a,d.replace(/\\/g,"")):ge(t,a,d),ge(e,o,t)),e}function $a(i){return Object.keys(i).map(e=>{let t=i[e];return Array.isArray(t)||(t=[t]),t.map(r=>[e].concat(Object.keys(r).map(s=>{let n=r[s];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?s:`${s}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}pn.exports={format:$a,parse:qa}});var Rr=O((Bh,wn)=>{"use strict";var Wa=x("events"),Va=x("https"),ja=x("http"),yn=x("net"),Ha=x("tls"),{randomBytes:Ga,createHash:za}=x("crypto"),{Readable:Lh}=x("stream"),{URL:xr}=x("url"),Ie=Bt(),Ka=_r(),Ya=br(),{BINARY_TYPES:mn,EMPTY_BUFFER:ki,GUID:Ja,kForOnEventAttribute:wr,kListener:Xa,kStatusCode:Qa,kWebSocket:J,NOOP:vn}=ke(),{EventTarget:{addEventListener:Za,removeEventListener:ec}}=dn(),{format:tc,parse:ic}=Sr(),{toBuffer:rc}=Pt(),sc=30*1e3,_n=Symbol("kAborted"),Nr=[8,13],Se=["CONNECTING","OPEN","CLOSING","CLOSED"],nc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,F=class i extends Wa{constructor(e,t,r){super(),this._binaryType=mn[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ki,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=i.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(r=t,t=[]):t=[t]),En(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){mn.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){let s=new Ka({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new Ya(e,this._extensions,r.generateMask),this._receiver=s,this._socket=e,s[J]=this,e[J]=this,s.on("conclude",cc),s.on("drain",lc),s.on("error",fc),s.on("message",hc),s.on("ping",uc),s.on("pong",dc),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Cn),e.on("data",Ii),e.on("end",Sn),e.on("error",xn),this._readyState=i.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ie.extensionName]&&this._extensions[Ie.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return ee(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===i.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=i.CLOSING,this._sender.close(e,t,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),sc)}}pause(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){Ar(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||ki,t,r)}pong(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){Ar(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||ki,t,r)}resume(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(r=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){Ar(this,e,r);return}let s=b({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},t);this._extensions[Ie.extensionName]||(s.compress=!1),this._sender.send(e||ki,s,r)}terminate(){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return ee(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=i.CLOSING,this._socket.destroy())}}};Object.defineProperty(F,"CONNECTING",{enumerable:!0,value:Se.indexOf("CONNECTING")});Object.defineProperty(F.prototype,"CONNECTING",{enumerable:!0,value:Se.indexOf("CONNECTING")});Object.defineProperty(F,"OPEN",{enumerable:!0,value:Se.indexOf("OPEN")});Object.defineProperty(F.prototype,"OPEN",{enumerable:!0,value:Se.indexOf("OPEN")});Object.defineProperty(F,"CLOSING",{enumerable:!0,value:Se.indexOf("CLOSING")});Object.defineProperty(F.prototype,"CLOSING",{enumerable:!0,value:Se.indexOf("CLOSING")});Object.defineProperty(F,"CLOSED",{enumerable:!0,value:Se.indexOf("CLOSED")});Object.defineProperty(F.prototype,"CLOSED",{enumerable:!0,value:Se.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(i=>{Object.defineProperty(F.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(F.prototype,`on${i}`,{enumerable:!0,get(){for(let e of this.listeners(i))if(e[wr])return e[Xa];return null},set(e){for(let t of this.listeners(i))if(t[wr]){this.removeListener(i,t);break}typeof e=="function"&&this.addEventListener(i,e,{[wr]:!0})}})});F.prototype.addEventListener=Za;F.prototype.removeEventListener=ec;wn.exports=F;function En(i,e,t,r){let s=I(b({protocolVersion:Nr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10},r),{createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0});if(!Nr.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${Nr.join(", ")})`);let n;if(e instanceof xr)n=e,i._url=e.href;else{try{n=new xr(e)}catch(p){throw new SyntaxError(`Invalid URL: ${e}`)}i._url=e}let o=n.protocol==="wss:",a=n.protocol==="ws+unix:",c;if(n.protocol!=="ws:"&&!o&&!a?c=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`:a&&!n.pathname?c="The URL's pathname is empty":n.hash&&(c="The URL contains a fragment identifier"),c){let p=new SyntaxError(c);if(i._redirects===0)throw p;Ti(i,p);return}let u=o?443:80,l=Ga(16).toString("base64"),f=o?Va.request:ja.request,d=new Set,S;if(s.createConnection=o?ac:oc,s.defaultPort=s.defaultPort||u,s.port=n.port||u,s.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,s.headers=I(b({},s.headers),{"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket"}),s.path=n.pathname+n.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(S=new Ie(s.perMessageDeflate!==!0?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=tc({[Ie.extensionName]:S.offer()})),t.length){for(let p of t){if(typeof p!="string"||!nc.test(p)||d.has(p))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(p)}s.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(n.username||n.password)&&(s.auth=`${n.username}:${n.password}`),a){let p=s.path.split(":");s.socketPath=p[0],s.path=p[1]}let w;if(s.followRedirects){if(i._redirects===0){i._originalIpc=a,i._originalSecure=o,i._originalHostOrSocketPath=a?s.socketPath:n.host;let p=r&&r.headers;if(r=I(b({},r),{headers:{}}),p)for(let[v,N]of Object.entries(p))r.headers[v.toLowerCase()]=N}else if(i.listenerCount("redirect")===0){let p=a?i._originalIpc?s.socketPath===i._originalHostOrSocketPath:!1:i._originalIpc?!1:n.host===i._originalHostOrSocketPath;(!p||i._originalSecure&&!o)&&(delete s.headers.authorization,delete s.headers.cookie,p||delete s.headers.host,s.auth=void 0)}s.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),w=i._req=f(s),i._redirects&&i.emit("redirect",i.url,w)}else w=i._req=f(s);s.timeout&&w.on("timeout",()=>{ee(i,w,"Opening handshake has timed out")}),w.on("error",p=>{w===null||w[_n]||(w=i._req=null,Ti(i,p))}),w.on("response",p=>{let v=p.headers.location,N=p.statusCode;if(v&&s.followRedirects&&N>=300&&N<400){if(++i._redirects>s.maxRedirects){ee(i,w,"Maximum redirects exceeded");return}w.abort();let A;try{A=new xr(v,e)}catch(m){let y=new SyntaxError(`Invalid URL: ${v}`);Ti(i,y);return}En(i,A,t,r)}else i.emit("unexpected-response",w,p)||ee(i,w,`Unexpected server response: ${p.statusCode}`)}),w.on("upgrade",(p,v,N)=>{if(i.emit("upgrade",p),i.readyState!==F.CONNECTING)return;if(w=i._req=null,p.headers.upgrade.toLowerCase()!=="websocket"){ee(i,v,"Invalid Upgrade header");return}let A=za("sha1").update(l+Ja).digest("base64");if(p.headers["sec-websocket-accept"]!==A){ee(i,v,"Invalid Sec-WebSocket-Accept header");return}let m=p.headers["sec-websocket-protocol"],y;if(m!==void 0?d.size?d.has(m)||(y="Server sent an invalid subprotocol"):y="Server sent a subprotocol but none was requested":d.size&&(y="Server sent no subprotocol"),y){ee(i,v,y);return}m&&(i._protocol=m);let j=p.headers["sec-websocket-extensions"];if(j!==void 0){if(!S){ee(i,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let R;try{R=ic(j)}catch(K){ee(i,v,"Invalid Sec-WebSocket-Extensions header");return}let H=Object.keys(R);if(H.length!==1||H[0]!==Ie.extensionName){ee(i,v,"Server indicated an extension that was not requested");return}try{S.accept(R[Ie.extensionName])}catch(K){ee(i,v,"Invalid Sec-WebSocket-Extensions header");return}i._extensions[Ie.extensionName]=S}i.setSocket(v,N,{generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),w.end()}function Ti(i,e){i._readyState=F.CLOSING,i.emit("error",e),i.emitClose()}function oc(i){return i.path=i.socketPath,yn.connect(i)}function ac(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=yn.isIP(i.host)?"":i.host),Ha.connect(i)}function ee(i,e,t){i._readyState=F.CLOSING;let r=new Error(t);Error.captureStackTrace(r,ee),e.setHeader?(e[_n]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Ti,i,r)):(e.destroy(r),e.once("error",i.emit.bind(i,"error")),e.once("close",i.emitClose.bind(i)))}function Ar(i,e,t){if(e){let r=rc(e).length;i._socket?i._sender._bufferedBytes+=r:i._bufferedAmount+=r}if(t){let r=new Error(`WebSocket is not open: readyState ${i.readyState} (${Se[i.readyState]})`);t(r)}}function cc(i,e){let t=this[J];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=i,t._socket[J]!==void 0&&(t._socket.removeListener("data",Ii),process.nextTick(bn,t._socket),i===1005?t.close():t.close(i,e))}function lc(){let i=this[J];i.isPaused||i._socket.resume()}function fc(i){let e=this[J];e._socket[J]!==void 0&&(e._socket.removeListener("data",Ii),process.nextTick(bn,e._socket),e.close(i[Qa])),e.emit("error",i)}function gn(){this[J].emitClose()}function hc(i,e){this[J].emit("message",i,e)}function uc(i){let e=this[J];e.pong(i,!e._isServer,vn),e.emit("ping",i)}function dc(i){this[J].emit("pong",i)}function bn(i){i.resume()}function Cn(){let i=this[J];this.removeListener("close",Cn),this.removeListener("data",Ii),this.removeListener("end",Sn),i._readyState=F.CLOSING;let e;!this._readableState.endEmitted&&!i._closeFrameReceived&&!i._receiver._writableState.errorEmitted&&(e=i._socket.read())!==null&&i._receiver.write(e),i._receiver.end(),this[J]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",gn),i._receiver.on("finish",gn))}function Ii(i){this[J]._receiver.write(i)||this.pause()}function Sn(){let i=this[J];i._readyState=F.CLOSING,i._receiver.end(),this.end()}function xn(){let i=this[J];this.removeListener("error",xn),this.on("error",vn),i&&(i._readyState=F.CLOSING,this.destroy())}});var An=O((Dh,Nn)=>{"use strict";var{tokenChars:pc}=Ut();function mc(i){let e=new Set,t=-1,r=-1,s=0;for(s;s<i.length;s++){let o=i.charCodeAt(s);if(r===-1&&pc[o]===1)t===-1&&(t=s);else if(s!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=s);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${s}`);r===-1&&(r=s);let a=i.slice(t,r);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);e.add(a),t=r=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let n=i.slice(t,s);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}Nn.exports={parse:mc}});var Fn=O((Wh,Pn)=>{"use strict";var gc=x("events"),Pi=x("http"),Mh=x("https"),qh=x("net"),$h=x("tls"),{createHash:yc}=x("crypto"),Rn=Sr(),$e=Bt(),vc=An(),_c=Rr(),{GUID:Ec,kWebSocket:bc}=ke(),Cc=/^[+/0-9A-Za-z]{22}==$/,On=0,kn=1,In=2,Or=class extends gc{constructor(e,t){if(super(),e=b({maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:_c},e),e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Pi.createServer((r,s)=>{let n=Pi.STATUS_CODES[426];s.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),s.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=Sc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,n,o)=>{this.handleUpgrade(s,n,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=On}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===In){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Wt,this);return}if(e&&this.once("close",e),this._state!==kn)if(this._state=kn,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Wt,this):process.nextTick(Wt,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Wt(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,s){t.on("error",Tn);let n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){We(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){We(this,e,t,400,"Invalid Upgrade header");return}if(!n||!Cc.test(n)){We(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){We(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){Vt(t,400);return}let a=e.headers["sec-websocket-protocol"],c=new Set;if(a!==void 0)try{c=vc.parse(a)}catch(f){We(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let u=e.headers["sec-websocket-extensions"],l={};if(this.options.perMessageDeflate&&u!==void 0){let f=new $e(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let d=Rn.parse(u);d[$e.extensionName]&&(f.accept(d[$e.extensionName]),l[$e.extensionName]=f)}catch(d){We(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(f,(d,S,w,p)=>{if(!d)return Vt(t,S||401,w,p);this.completeUpgrade(l,n,c,e,t,r,s)});return}if(!this.options.verifyClient(f))return Vt(t,401)}this.completeUpgrade(l,n,c,e,t,r,s)}completeUpgrade(e,t,r,s,n,o,a){if(!n.readable||!n.writable)return n.destroy();if(n[bc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>On)return Vt(n,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${yc("sha1").update(t+Ec).digest("base64")}`],l=new this.options.WebSocket(null);if(r.size){let f=this.options.handleProtocols?this.options.handleProtocols(r,s):r.values().next().value;f&&(u.push(`Sec-WebSocket-Protocol: ${f}`),l._protocol=f)}if(e[$e.extensionName]){let f=e[$e.extensionName].params,d=Rn.format({[$e.extensionName]:[f]});u.push(`Sec-WebSocket-Extensions: ${d}`),l._extensions=e}this.emit("headers",u,s),n.write(u.concat(`\r
|
|
3
|
+
`+n),i.push(s+"m+"+gi.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Ko()+e+" "+i[0]}function Ko(){return q.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Yo(...i){return process.stderr.write(mi.formatWithOptions(q.inspectOpts,...i)+`
|
|
4
|
+
`)}function Jo(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Xo(){return process.env.DEBUG}function Qo(i){i.inspectOpts={};let e=Object.keys(q.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=q.inspectOpts[e[t]]}gi.exports=Xi()(q);var{formatters:ps}=gi.exports;ps.o=function(i){return this.inspectOpts.colors=this.useColors,mi.inspect(i,this.inspectOpts).split(`
|
|
5
|
+
`).map(e=>e.trim()).join(" ")};ps.O=function(i){return this.inspectOpts.colors=this.useColors,mi.inspect(i,this.inspectOpts)}});var De=k((bf,er)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?er.exports=ls():er.exports=ms()});var ws=k((kf,Ss)=>{"use strict";var ot=S("fs"),xs=S("url"),ta=S("child_process").spawn;Ss.exports=rr;rr.XMLHttpRequest=rr;function rr(i){"use strict";i=i||{};var e=this,t=S("http"),r=S("https"),s,n,o={},a=!1,c={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},u=Object.assign({},c),l=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],h=["TRACE","TRACK","CONNECT"],d=!1,x=!1,w=!1,p={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.status=null,this.statusText=null;var v=function(m){return a||m&&l.indexOf(m.toLowerCase())===-1},N=function(m){return m&&h.indexOf(m)===-1};this.open=function(m,y,V,R,j){if(this.abort(),x=!1,w=!1,!N(m))throw new Error("SecurityError: Request method not allowed");o={method:m,url:y.toString(),async:typeof V!="boolean"?!0:V,user:R||null,password:j||null},A(this.OPENED)},this.setDisableHeaderCheck=function(m){a=m},this.setRequestHeader=function(m,y){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(!v(m))return console.warn('Refused to set unsafe header "'+m+'"'),!1;if(d)throw new Error("INVALID_STATE_ERR: send flag is true");return u[m]=y,!0},this.getResponseHeader=function(m){return typeof m=="string"&&this.readyState>this.OPENED&&n.headers[m.toLowerCase()]&&!x?n.headers[m.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||x)return"";var m="";for(var y in n.headers)y!=="set-cookie"&&y!=="set-cookie2"&&(m+=y+": "+n.headers[y]+`\r
|
|
6
|
+
`);return m.substr(0,m.length-2)},this.getRequestHeader=function(m){return typeof m=="string"&&u[m]?u[m]:""},this.send=function(m){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(d)throw new Error("INVALID_STATE_ERR: send has already been called");var y=!1,V=!1,R=xs.parse(o.url),j;switch(R.protocol){case"https:":y=!0;case"http:":j=R.hostname;break;case"file:":V=!0;break;case void 0:case"":j="localhost";break;default:throw new Error("Protocol not supported.")}if(V){if(o.method!=="GET")throw new Error("XMLHttpRequest: Only GET method is supported");if(o.async)ot.readFile(unescape(R.pathname),"utf8",function(re,ze){re?e.handleError(re,re.errno||-1):(e.status=200,e.responseText=ze,A(e.DONE))});else try{this.responseText=ot.readFileSync(unescape(R.pathname),"utf8"),this.status=200,A(e.DONE)}catch(re){this.handleError(re,re.errno||-1)}return}var z=R.port||(y?443:80),pe=R.pathname+(R.search?R.search:"");if(u.Host=j,y&&z===443||z===80||(u.Host+=":"+R.port),o.user){typeof o.password=="undefined"&&(o.password="");var Kt=new Buffer(o.user+":"+o.password);u.Authorization="Basic "+Kt.toString("base64")}o.method==="GET"||o.method==="HEAD"?m=null:m?(u["Content-Length"]=Buffer.isBuffer(m)?m.length:Buffer.byteLength(m),u["Content-Type"]||(u["Content-Type"]="text/plain;charset=UTF-8")):o.method==="POST"&&(u["Content-Length"]=0);var Yt=i.agent||!1,ie={host:j,port:z,path:pe,method:o.method,headers:u,agent:Yt};if(y&&(ie.pfx=i.pfx,ie.key=i.key,ie.passphrase=i.passphrase,ie.cert=i.cert,ie.ca=i.ca,ie.ciphers=i.ciphers,ie.rejectUnauthorized=i.rejectUnauthorized!==!1),x=!1,o.async){var Ge=y?r.request:t.request;d=!0,e.dispatchEvent("readystatechange");var Mr=function(re){if(n=re,n.statusCode===302||n.statusCode===303||n.statusCode===307){o.url=n.headers.location;var ze=xs.parse(o.url);j=ze.hostname;var xe={hostname:ze.hostname,port:ze.port,path:ze.path,method:n.statusCode===303?"GET":o.method,headers:u};y&&(xe.pfx=i.pfx,xe.key=i.key,xe.passphrase=i.passphrase,xe.cert=i.cert,xe.ca=i.ca,xe.ciphers=i.ciphers,xe.rejectUnauthorized=i.rejectUnauthorized!==!1),s=Ge(xe,Mr).on("error",qr),s.end();return}n&&n.setEncoding&&n.setEncoding("utf8"),A(e.HEADERS_RECEIVED),e.status=n.statusCode,n.on("data",function(Jt){Jt&&(e.responseText+=Jt),d&&A(e.LOADING)}),n.on("end",function(){d&&(d=!1,A(e.DONE))}),n.on("error",function(Jt){e.handleError(Jt)})},qr=function(re){e.handleError(re)};s=Ge(ie,Mr).on("error",qr),i.autoUnref&&s.on("socket",re=>{re.unref()}),m&&s.write(m),s.end(),e.dispatchEvent("loadstart")}else{var yt=".node-xmlhttprequest-content-"+process.pid,vt=".node-xmlhttprequest-sync-"+process.pid;ot.writeFileSync(vt,"","utf8");for(var co="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(y?"s":"")+".request;var options = "+JSON.stringify(ie)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+yt+"', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');fs.unlinkSync('"+vt+"');});response.on('error', function(error) {fs.writeFileSync('"+yt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+vt+"');});}).on('error', function(error) {fs.writeFileSync('"+yt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+vt+"');});"+(m?"req.write('"+JSON.stringify(m).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",lo=ta(process.argv[0],["-e",co]),el;ot.existsSync(vt););if(e.responseText=ot.readFileSync(yt,"utf8"),lo.stdin.end(),ot.unlinkSync(yt),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var fo=e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,"");e.handleError(fo,503)}else e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1"),e.responseText=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"),A(e.DONE)}},this.handleError=function(m,y){this.status=y||0,this.statusText=m,this.responseText=m.stack,x=!0,A(this.DONE)},this.abort=function(){s&&(s.abort(),s=null),u=Object.assign({},c),this.responseText="",this.responseXML="",x=w=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||d)&&this.readyState!==this.DONE&&(d=!1,A(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(m,y){m in p||(p[m]=[]),p[m].push(y)},this.removeEventListener=function(m,y){m in p&&(p[m]=p[m].filter(function(V){return V!==y}))},this.dispatchEvent=function(m){if(typeof e["on"+m]=="function"&&(this.readyState===this.DONE?setImmediate(function(){e["on"+m]()}):e["on"+m]()),m in p)for(let y=0,V=p[m].length;y<V;y++)this.readyState===this.DONE?setImmediate(function(){p[m][y].call(e)}):p[m][y].call(e)};var A=function(m){if(!(e.readyState===m||e.readyState===e.UNSENT&&w)&&(e.readyState=m,(o.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let y;w?y="abort":x?y="error":y="load",e.dispatchEvent(y),e.dispatchEvent("loadend")}}}});var Is=k((Mf,Ts)=>{"use strict";var{Duplex:na}=S("stream");function ks(i){i.emit("close")}function oa(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Os(i){this.removeListener("error",Os),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function aa(i,e){let t=!0,r=new na(I(b({},e),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return i.on("message",function(n,o){let a=!o&&r._readableState.objectMode?n.toString():n;r.push(a)||i.pause()}),i.once("error",function(n){r.destroyed||(t=!1,r.destroy(n))}),i.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(s,n){if(i.readyState===i.CLOSED){n(s),process.nextTick(ks,r);return}let o=!1;i.once("error",function(c){o=!0,n(c)}),i.once("close",function(){o||n(s),process.nextTick(ks,r)}),t&&i.terminate()},r._final=function(s){if(i.readyState===i.CONNECTING){i.once("open",function(){r._final(s)});return}i._socket!==null&&(i._socket._writableState.finished?(s(),r._readableState.endEmitted&&r.destroy()):(i._socket.once("finish",function(){s()}),i.close()))},r._read=function(){i.isPaused&&i.resume()},r._write=function(s,n,o){if(i.readyState===i.CONNECTING){i.once("open",function(){r._write(s,n,o)});return}i.send(s,o)},r.on("end",oa),r.on("error",Os),r}Ts.exports=aa});var ke=k(($f,Ps)=>{"use strict";Ps.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var At=k((Wf,Ei)=>{"use strict";var{EMPTY_BUFFER:ca}=ke();function la(i,e){if(i.length===0)return ca;if(i.length===1)return i[0];let t=Buffer.allocUnsafe(e),r=0;for(let s=0;s<i.length;s++){let n=i[s];t.set(n,r),r+=n.length}return r<e?t.slice(0,r):t}function Fs(i,e,t,r,s){for(let n=0;n<s;n++)t[r+n]=i[n]^e[n&3]}function Ls(i,e){for(let t=0;t<i.length;t++)i[t]^=e[t&3]}function fa(i){return i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}function ar(i){if(ar.readOnly=!0,Buffer.isBuffer(i))return i;let e;return i instanceof ArrayBuffer?e=Buffer.from(i):ArrayBuffer.isView(i)?e=Buffer.from(i.buffer,i.byteOffset,i.byteLength):(e=Buffer.from(i),ar.readOnly=!1),e}Ei.exports={concat:la,mask:Fs,toArrayBuffer:fa,toBuffer:ar,unmask:Ls};if(!process.env.WS_NO_BUFFER_UTIL)try{let i=S("bufferutil");Ei.exports.mask=function(e,t,r,s,n){n<48?Fs(e,t,r,s,n):i.mask(e,t,r,s,n)},Ei.exports.unmask=function(e,t){e.length<32?Ls(e,t):i.unmask(e,t)}}catch(i){}});var Ds=k((Vf,Us)=>{"use strict";var Bs=Symbol("kDone"),cr=Symbol("kRun"),lr=class{constructor(e){this[Bs]=()=>{this.pending--,this[cr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[cr]()}[cr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Bs])}}};Us.exports=lr});var Ot=k((jf,Ws)=>{"use strict";var Rt=S("zlib"),Ms=At(),ha=Ds(),{kStatusCode:qs}=ke(),ua=Buffer.from([0,0,255,255]),xi=Symbol("permessage-deflate"),Ee=Symbol("total-length"),kt=Symbol("callback"),Oe=Symbol("buffers"),Ci=Symbol("error"),bi,fr=class{constructor(e,t,r){if(this._maxPayload=r|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!bi){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;bi=new ha(s)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[kt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,r=e.find(s=>!(t.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>s.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(r.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?r.client_max_window_bits=t.clientMaxWindowBits:(r.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(r=>{let s=t[r];if(s.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(s=s[0],r==="client_max_window_bits"){if(s!==!0){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else if(r==="server_max_window_bits"){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=s})}),e}decompress(e,t,r){bi.add(s=>{this._decompress(e,t,(n,o)=>{s(),r(n,o)})})}compress(e,t,r){bi.add(s=>{this._compress(e,t,(n,o)=>{s(),r(n,o)})})}_decompress(e,t,r){let s=this._isServer?"client":"server";if(!this._inflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?Rt.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=Rt.createInflateRaw(I(b({},this._options.zlibInflateOptions),{windowBits:o})),this._inflate[xi]=this,this._inflate[Ee]=0,this._inflate[Oe]=[],this._inflate.on("error",pa),this._inflate.on("data",$s)}this._inflate[kt]=r,this._inflate.write(e),t&&this._inflate.write(ua),this._inflate.flush(()=>{let n=this._inflate[Ci];if(n){this._inflate.close(),this._inflate=null,r(n);return}let o=Ms.concat(this._inflate[Oe],this._inflate[Ee]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ee]=0,this._inflate[Oe]=[],t&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){let s=this._isServer?"server":"client";if(!this._deflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?Rt.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=Rt.createDeflateRaw(I(b({},this._options.zlibDeflateOptions),{windowBits:o})),this._deflate[Ee]=0,this._deflate[Oe]=[],this._deflate.on("data",da)}this._deflate[kt]=r,this._deflate.write(e),this._deflate.flush(Rt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Ms.concat(this._deflate[Oe],this._deflate[Ee]);t&&(n=n.slice(0,n.length-4)),this._deflate[kt]=null,this._deflate[Ee]=0,this._deflate[Oe]=[],t&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),r(null,n)})}};Ws.exports=fr;function da(i){this[Oe].push(i),this[Ee]+=i.length}function $s(i){if(this[Ee]+=i.length,this[xi]._maxPayload<1||this[Ee]<=this[xi]._maxPayload){this[Oe].push(i);return}this[Ci]=new RangeError("Max payload size exceeded"),this[Ci].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Ci][qs]=1009,this.removeListener("data",$s),this.reset()}function pa(i){this[xi]._inflate=null,i[qs]=1007,this[kt](i)}});var Tt=k((Gf,hr)=>{"use strict";var ma=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,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,0,0,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,0,1,0];function ga(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function Vs(i){let e=i.length,t=0;for(;t<e;)if(!(i[t]&128))t++;else if((i[t]&224)===192){if(t+1===e||(i[t+1]&192)!==128||(i[t]&254)===192)return!1;t+=2}else if((i[t]&240)===224){if(t+2>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||i[t]===224&&(i[t+1]&224)===128||i[t]===237&&(i[t+1]&224)===160)return!1;t+=3}else if((i[t]&248)===240){if(t+3>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||(i[t+3]&192)!==128||i[t]===240&&(i[t+1]&240)===128||i[t]===244&&i[t+1]>143||i[t]>244)return!1;t+=4}else return!1;return!0}hr.exports={isValidStatusCode:ga,isValidUTF8:Vs,tokenChars:ma};if(!process.env.WS_NO_UTF_8_VALIDATE)try{let i=S("utf-8-validate");hr.exports.isValidUTF8=function(e){return e.length<150?Vs(e):i(e)}}catch(i){}});var mr=k((zf,Js)=>{"use strict";var{Writable:ya}=S("stream"),js=Ot(),{BINARY_TYPES:va,EMPTY_BUFFER:Hs,kStatusCode:_a,kWebSocket:Ea}=ke(),{concat:ur,toArrayBuffer:ba,unmask:Ca}=At(),{isValidStatusCode:xa,isValidUTF8:Gs}=Tt(),It=0,zs=1,Ks=2,Ys=3,dr=4,Sa=5,pr=class extends ya{constructor(e={}){super(),this._binaryType=e.binaryType||va[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ea]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=It,this._loop=!1}_write(e,t,r){if(this._opcode===8&&this._state==It)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=r.slice(e),r.slice(0,e)}let t=Buffer.allocUnsafe(e);do{let r=this._buffers[0],s=t.length-e;e>=r.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),s),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do switch(this._state){case It:t=this.getInfo();break;case zs:t=this.getPayloadLength16();break;case Ks:t=this.getPayloadLength64();break;case Ys:this.getMask();break;case dr:t=this.getData(e);break;default:this._loop=!1;return}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}let e=this.consume(2);if(e[0]&48)return this._loop=!1,B(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");let t=(e[0]&64)===64;if(t&&!this._extensions[js.extensionName])return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,B(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,B(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,B(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}else return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._isServer){if(!this._masked)return this._loop=!1,B(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,B(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(this._payloadLength===126)this._state=zs;else if(this._payloadLength===127)this._state=Ks;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}let e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,B(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=Ys:this._state=dr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=dr}getData(e){let t=Hs;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&Ca(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=Sa,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[js.extensionName].decompress(e,this._fin,(s,n)=>{if(s)return t(s);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}let o=this.dataMessage();if(o)return t(o);this.startLoop(t)})}dataMessage(){if(this._fin){let e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=ur(t,e):this._binaryType==="arraybuffer"?r=ba(ur(t,e)):r=t,this.emit("message",r,!0)}else{let r=ur(t,e);if(!this._skipUTF8Validation&&!Gs(r))return this._loop=!1,B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=It}controlMessage(e){if(this._opcode===8)if(this._loop=!1,e.length===0)this.emit("conclude",1005,Hs),this.end();else{if(e.length===1)return B(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{let t=e.readUInt16BE(0);if(!xa(t))return B(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");let r=e.slice(2);if(!this._skipUTF8Validation&&!Gs(r))return B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r),this.end()}}else this._opcode===9?this.emit("ping",e):this.emit("pong",e);this._state=It}};Js.exports=pr;function B(i,e,t,r,s){let n=new i(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(n,B),n.code=s,n[_a]=r,n}});var yr=k((Jf,Zs)=>{"use strict";var Kf=S("net"),Yf=S("tls"),{randomFillSync:wa}=S("crypto"),Xs=Ot(),{EMPTY_BUFFER:Na}=ke(),{isValidStatusCode:Aa}=Tt(),{mask:Qs,toBuffer:at}=At(),he=Symbol("kByteLength"),Ra=Buffer.alloc(4),gr=class i{constructor(e,t,r){this._extensions=t||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let r,s=!1,n=2,o=!1;t.mask&&(r=t.maskBuffer||Ra,t.generateMask?t.generateMask(r):wa(r,0,4),o=(r[0]|r[1]|r[2]|r[3])===0,n=6);let a;typeof e=="string"?(!t.mask||o)&&t[he]!==void 0?a=t[he]:(e=Buffer.from(e),a=e.length):(a=e.length,s=t.mask&&t.readOnly&&!o);let c=a;a>=65536?(n+=8,c=127):a>125&&(n+=2,c=126);let u=Buffer.allocUnsafe(s?a+n:n);return u[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(u[0]|=64),u[1]=c,c===126?u.writeUInt16BE(a,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),t.mask?(u[1]|=128,u[n-4]=r[0],u[n-3]=r[1],u[n-2]=r[2],u[n-1]=r[3],o?[u,e]:s?(Qs(e,r,u,n,a),[u]):(Qs(e,r,e,0,a),[u,e])):[u,e]}close(e,t,r,s){let n;if(e===void 0)n=Na;else{if(typeof e!="number"||!Aa(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let a=Buffer.byteLength(t);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+a),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}let o={[he]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,s]):this.sendFrame(i.frame(n,o),s)}ping(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=at(e),s=e.length,n=at.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}pong(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=at(e),s=e.length,n=at.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}send(e,t,r){let s=this._extensions[Xs.extensionName],n=t.binary?2:1,o=t.compress,a,c;if(typeof e=="string"?(a=Buffer.byteLength(e),c=!1):(e=at(e),a=e.length,c=at.readOnly),this._firstFragment?(this._firstFragment=!1,o&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=a>=s._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),s){let u={[he]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,u,r]):this.dispatch(e,this._compress,u,r)}else this.sendFrame(i.frame(e,{[he]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:!1}),r)}dispatch(e,t,r,s){if(!t){this.sendFrame(i.frame(e,r),s);return}let n=this._extensions[Xs.extensionName];this._bufferedBytes+=r[he],this._deflating=!0,n.compress(e,r.fin,(o,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");typeof s=="function"&&s(c);for(let u=0;u<this._queue.length;u++){let l=this._queue[u],h=l[l.length-1];typeof h=="function"&&h(c)}return}this._bufferedBytes-=r[he],this._deflating=!1,r.readOnly=!1,this.sendFrame(i.frame(a,r),s),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};Zs.exports=gr});var ln=k((Xf,cn)=>{"use strict";var{kForOnEventAttribute:Pt,kListener:vr}=ke(),en=Symbol("kCode"),tn=Symbol("kData"),rn=Symbol("kError"),sn=Symbol("kMessage"),nn=Symbol("kReason"),ct=Symbol("kTarget"),on=Symbol("kType"),an=Symbol("kWasClean"),be=class{constructor(e){this[ct]=null,this[on]=e}get target(){return this[ct]}get type(){return this[on]}};Object.defineProperty(be.prototype,"target",{enumerable:!0});Object.defineProperty(be.prototype,"type",{enumerable:!0});var Me=class extends be{constructor(e,t={}){super(e),this[en]=t.code===void 0?0:t.code,this[nn]=t.reason===void 0?"":t.reason,this[an]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[en]}get reason(){return this[nn]}get wasClean(){return this[an]}};Object.defineProperty(Me.prototype,"code",{enumerable:!0});Object.defineProperty(Me.prototype,"reason",{enumerable:!0});Object.defineProperty(Me.prototype,"wasClean",{enumerable:!0});var lt=class extends be{constructor(e,t={}){super(e),this[rn]=t.error===void 0?null:t.error,this[sn]=t.message===void 0?"":t.message}get error(){return this[rn]}get message(){return this[sn]}};Object.defineProperty(lt.prototype,"error",{enumerable:!0});Object.defineProperty(lt.prototype,"message",{enumerable:!0});var Ft=class extends be{constructor(e,t={}){super(e),this[tn]=t.data===void 0?null:t.data}get data(){return this[tn]}};Object.defineProperty(Ft.prototype,"data",{enumerable:!0});var ka={addEventListener(i,e,t={}){for(let s of this.listeners(i))if(!t[Pt]&&s[vr]===e&&!s[Pt])return;let r;if(i==="message")r=function(n,o){let a=new Ft("message",{data:o?n:n.toString()});a[ct]=this,Si(e,this,a)};else if(i==="close")r=function(n,o){let a=new Me("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[ct]=this,Si(e,this,a)};else if(i==="error")r=function(n){let o=new lt("error",{error:n,message:n.message});o[ct]=this,Si(e,this,o)};else if(i==="open")r=function(){let n=new be("open");n[ct]=this,Si(e,this,n)};else return;r[Pt]=!!t[Pt],r[vr]=e,t.once?this.once(i,r):this.on(i,r)},removeEventListener(i,e){for(let t of this.listeners(i))if(t[vr]===e&&!t[Pt]){this.removeListener(i,t);break}}};cn.exports={CloseEvent:Me,ErrorEvent:lt,Event:be,EventTarget:ka,MessageEvent:Ft};function Si(i,e,t){typeof i=="object"&&i.handleEvent?i.handleEvent.call(i,t):i.call(e,t)}});var _r=k((Qf,fn)=>{"use strict";var{tokenChars:Lt}=Tt();function me(i,e,t){i[e]===void 0?i[e]=[t]:i[e].push(t)}function Oa(i){let e=Object.create(null),t=Object.create(null),r=!1,s=!1,n=!1,o,a,c=-1,u=-1,l=-1,h=0;for(;h<i.length;h++)if(u=i.charCodeAt(h),o===void 0)if(l===-1&&Lt[u]===1)c===-1&&(c=h);else if(h!==0&&(u===32||u===9))l===-1&&c!==-1&&(l=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1&&(l=h);let x=i.slice(c,l);u===44?(me(e,x,t),t=Object.create(null)):o=x,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===void 0)if(l===-1&&Lt[u]===1)c===-1&&(c=h);else if(u===32||u===9)l===-1&&c!==-1&&(l=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1&&(l=h),me(t,i.slice(c,l),!0),u===44&&(me(e,o,t),t=Object.create(null),o=void 0),c=l=-1}else if(u===61&&c!==-1&&l===-1)a=i.slice(c,h),c=l=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(s){if(Lt[u]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1?c=h:r||(r=!0),s=!1}else if(n)if(Lt[u]===1)c===-1&&(c=h);else if(u===34&&c!==-1)n=!1,l=h;else if(u===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(u===34&&i.charCodeAt(h-1)===61)n=!0;else if(l===-1&&Lt[u]===1)c===-1&&(c=h);else if(c!==-1&&(u===32||u===9))l===-1&&(l=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1&&(l=h);let x=i.slice(c,l);r&&(x=x.replace(/\\/g,""),r=!1),me(t,a,x),u===44&&(me(e,o,t),t=Object.create(null),o=void 0),a=void 0,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(c===-1||n||u===32||u===9)throw new SyntaxError("Unexpected end of input");l===-1&&(l=h);let d=i.slice(c,l);return o===void 0?me(e,d,t):(a===void 0?me(t,d,!0):r?me(t,a,d.replace(/\\/g,"")):me(t,a,d),me(e,o,t)),e}function Ta(i){return Object.keys(i).map(e=>{let t=i[e];return Array.isArray(t)||(t=[t]),t.map(r=>[e].concat(Object.keys(r).map(s=>{let n=r[s];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?s:`${s}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}fn.exports={format:Ta,parse:Oa}});var Sr=k((eh,bn)=>{"use strict";var Ia=S("events"),Pa=S("https"),Fa=S("http"),dn=S("net"),La=S("tls"),{randomBytes:Ba,createHash:Ua}=S("crypto"),{Readable:Zf}=S("stream"),{URL:Er}=S("url"),Te=Ot(),Da=mr(),Ma=yr(),{BINARY_TYPES:hn,EMPTY_BUFFER:wi,GUID:qa,kForOnEventAttribute:br,kListener:$a,kStatusCode:Wa,kWebSocket:Y,NOOP:pn}=ke(),{EventTarget:{addEventListener:Va,removeEventListener:ja}}=ln(),{format:Ha,parse:Ga}=_r(),{toBuffer:za}=At(),Ka=30*1e3,mn=Symbol("kAborted"),Cr=[8,13],Ce=["CONNECTING","OPEN","CLOSING","CLOSED"],Ya=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,P=class i extends Ia{constructor(e,t,r){super(),this._binaryType=hn[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=wi,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=i.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(r=t,t=[]):t=[t]),gn(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){hn.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){let s=new Da({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new Ma(e,this._extensions,r.generateMask),this._receiver=s,this._socket=e,s[Y]=this,e[Y]=this,s.on("conclude",Qa),s.on("drain",Za),s.on("error",ec),s.on("message",tc),s.on("ping",ic),s.on("pong",rc),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",vn),e.on("data",Ai),e.on("end",_n),e.on("error",En),this._readyState=i.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Te.extensionName]&&this._extensions[Te.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return Z(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===i.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=i.CLOSING,this._sender.close(e,t,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Ka)}}pause(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){xr(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||wi,t,r)}pong(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){xr(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||wi,t,r)}resume(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(r=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){xr(this,e,r);return}let s=b({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},t);this._extensions[Te.extensionName]||(s.compress=!1),this._sender.send(e||wi,s,r)}terminate(){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return Z(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=i.CLOSING,this._socket.destroy())}}};Object.defineProperty(P,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(P.prototype,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(P,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(P.prototype,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(P,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(P.prototype,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(P,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});Object.defineProperty(P.prototype,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(i=>{Object.defineProperty(P.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(P.prototype,`on${i}`,{enumerable:!0,get(){for(let e of this.listeners(i))if(e[br])return e[$a];return null},set(e){for(let t of this.listeners(i))if(t[br]){this.removeListener(i,t);break}typeof e=="function"&&this.addEventListener(i,e,{[br]:!0})}})});P.prototype.addEventListener=Va;P.prototype.removeEventListener=ja;bn.exports=P;function gn(i,e,t,r){let s=I(b({protocolVersion:Cr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10},r),{createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0});if(!Cr.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${Cr.join(", ")})`);let n;if(e instanceof Er)n=e,i._url=e.href;else{try{n=new Er(e)}catch(p){throw new SyntaxError(`Invalid URL: ${e}`)}i._url=e}let o=n.protocol==="wss:",a=n.protocol==="ws+unix:",c;if(n.protocol!=="ws:"&&!o&&!a?c=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`:a&&!n.pathname?c="The URL's pathname is empty":n.hash&&(c="The URL contains a fragment identifier"),c){let p=new SyntaxError(c);if(i._redirects===0)throw p;Ni(i,p);return}let u=o?443:80,l=Ba(16).toString("base64"),h=o?Pa.request:Fa.request,d=new Set,x;if(s.createConnection=o?Xa:Ja,s.defaultPort=s.defaultPort||u,s.port=n.port||u,s.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,s.headers=I(b({},s.headers),{"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket"}),s.path=n.pathname+n.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(x=new Te(s.perMessageDeflate!==!0?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=Ha({[Te.extensionName]:x.offer()})),t.length){for(let p of t){if(typeof p!="string"||!Ya.test(p)||d.has(p))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(p)}s.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(n.username||n.password)&&(s.auth=`${n.username}:${n.password}`),a){let p=s.path.split(":");s.socketPath=p[0],s.path=p[1]}let w;if(s.followRedirects){if(i._redirects===0){i._originalIpc=a,i._originalSecure=o,i._originalHostOrSocketPath=a?s.socketPath:n.host;let p=r&&r.headers;if(r=I(b({},r),{headers:{}}),p)for(let[v,N]of Object.entries(p))r.headers[v.toLowerCase()]=N}else if(i.listenerCount("redirect")===0){let p=a?i._originalIpc?s.socketPath===i._originalHostOrSocketPath:!1:i._originalIpc?!1:n.host===i._originalHostOrSocketPath;(!p||i._originalSecure&&!o)&&(delete s.headers.authorization,delete s.headers.cookie,p||delete s.headers.host,s.auth=void 0)}s.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),w=i._req=h(s),i._redirects&&i.emit("redirect",i.url,w)}else w=i._req=h(s);s.timeout&&w.on("timeout",()=>{Z(i,w,"Opening handshake has timed out")}),w.on("error",p=>{w===null||w[mn]||(w=i._req=null,Ni(i,p))}),w.on("response",p=>{let v=p.headers.location,N=p.statusCode;if(v&&s.followRedirects&&N>=300&&N<400){if(++i._redirects>s.maxRedirects){Z(i,w,"Maximum redirects exceeded");return}w.abort();let A;try{A=new Er(v,e)}catch(m){let y=new SyntaxError(`Invalid URL: ${v}`);Ni(i,y);return}gn(i,A,t,r)}else i.emit("unexpected-response",w,p)||Z(i,w,`Unexpected server response: ${p.statusCode}`)}),w.on("upgrade",(p,v,N)=>{if(i.emit("upgrade",p),i.readyState!==P.CONNECTING)return;if(w=i._req=null,p.headers.upgrade.toLowerCase()!=="websocket"){Z(i,v,"Invalid Upgrade header");return}let A=Ua("sha1").update(l+qa).digest("base64");if(p.headers["sec-websocket-accept"]!==A){Z(i,v,"Invalid Sec-WebSocket-Accept header");return}let m=p.headers["sec-websocket-protocol"],y;if(m!==void 0?d.size?d.has(m)||(y="Server sent an invalid subprotocol"):y="Server sent a subprotocol but none was requested":d.size&&(y="Server sent no subprotocol"),y){Z(i,v,y);return}m&&(i._protocol=m);let V=p.headers["sec-websocket-extensions"];if(V!==void 0){if(!x){Z(i,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let R;try{R=Ga(V)}catch(z){Z(i,v,"Invalid Sec-WebSocket-Extensions header");return}let j=Object.keys(R);if(j.length!==1||j[0]!==Te.extensionName){Z(i,v,"Server indicated an extension that was not requested");return}try{x.accept(R[Te.extensionName])}catch(z){Z(i,v,"Invalid Sec-WebSocket-Extensions header");return}i._extensions[Te.extensionName]=x}i.setSocket(v,N,{generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),w.end()}function Ni(i,e){i._readyState=P.CLOSING,i.emit("error",e),i.emitClose()}function Ja(i){return i.path=i.socketPath,dn.connect(i)}function Xa(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=dn.isIP(i.host)?"":i.host),La.connect(i)}function Z(i,e,t){i._readyState=P.CLOSING;let r=new Error(t);Error.captureStackTrace(r,Z),e.setHeader?(e[mn]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Ni,i,r)):(e.destroy(r),e.once("error",i.emit.bind(i,"error")),e.once("close",i.emitClose.bind(i)))}function xr(i,e,t){if(e){let r=za(e).length;i._socket?i._sender._bufferedBytes+=r:i._bufferedAmount+=r}if(t){let r=new Error(`WebSocket is not open: readyState ${i.readyState} (${Ce[i.readyState]})`);t(r)}}function Qa(i,e){let t=this[Y];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=i,t._socket[Y]!==void 0&&(t._socket.removeListener("data",Ai),process.nextTick(yn,t._socket),i===1005?t.close():t.close(i,e))}function Za(){let i=this[Y];i.isPaused||i._socket.resume()}function ec(i){let e=this[Y];e._socket[Y]!==void 0&&(e._socket.removeListener("data",Ai),process.nextTick(yn,e._socket),e.close(i[Wa])),e.emit("error",i)}function un(){this[Y].emitClose()}function tc(i,e){this[Y].emit("message",i,e)}function ic(i){let e=this[Y];e.pong(i,!e._isServer,pn),e.emit("ping",i)}function rc(i){this[Y].emit("pong",i)}function yn(i){i.resume()}function vn(){let i=this[Y];this.removeListener("close",vn),this.removeListener("data",Ai),this.removeListener("end",_n),i._readyState=P.CLOSING;let e;!this._readableState.endEmitted&&!i._closeFrameReceived&&!i._receiver._writableState.errorEmitted&&(e=i._socket.read())!==null&&i._receiver.write(e),i._receiver.end(),this[Y]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",un),i._receiver.on("finish",un))}function Ai(i){this[Y]._receiver.write(i)||this.pause()}function _n(){let i=this[Y];i._readyState=P.CLOSING,i._receiver.end(),this.end()}function En(){let i=this[Y];this.removeListener("error",En),this.on("error",pn),i&&(i._readyState=P.CLOSING,this.destroy())}});var xn=k((ih,Cn)=>{"use strict";var{tokenChars:sc}=Tt();function nc(i){let e=new Set,t=-1,r=-1,s=0;for(s;s<i.length;s++){let o=i.charCodeAt(s);if(r===-1&&sc[o]===1)t===-1&&(t=s);else if(s!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=s);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${s}`);r===-1&&(r=s);let a=i.slice(t,r);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);e.add(a),t=r=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let n=i.slice(t,s);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}Cn.exports={parse:nc}});var On=k((oh,kn)=>{"use strict";var oc=S("events"),Ri=S("http"),rh=S("https"),sh=S("net"),nh=S("tls"),{createHash:ac}=S("crypto"),Sn=_r(),qe=Ot(),cc=xn(),lc=Sr(),{GUID:fc,kWebSocket:hc}=ke(),uc=/^[+/0-9A-Za-z]{22}==$/,wn=0,Nn=1,Rn=2,wr=class extends oc{constructor(e,t){if(super(),e=b({maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:lc},e),e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Ri.createServer((r,s)=>{let n=Ri.STATUS_CODES[426];s.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),s.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=dc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,n,o)=>{this.handleUpgrade(s,n,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=wn}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Rn){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Bt,this);return}if(e&&this.once("close",e),this._state!==Nn)if(this._state=Nn,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Bt,this):process.nextTick(Bt,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Bt(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,s){t.on("error",An);let n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){$e(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){$e(this,e,t,400,"Invalid Upgrade header");return}if(!n||!uc.test(n)){$e(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){$e(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){Ut(t,400);return}let a=e.headers["sec-websocket-protocol"],c=new Set;if(a!==void 0)try{c=cc.parse(a)}catch(h){$e(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let u=e.headers["sec-websocket-extensions"],l={};if(this.options.perMessageDeflate&&u!==void 0){let h=new qe(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let d=Sn.parse(u);d[qe.extensionName]&&(h.accept(d[qe.extensionName]),l[qe.extensionName]=h)}catch(d){$e(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(d,x,w,p)=>{if(!d)return Ut(t,x||401,w,p);this.completeUpgrade(l,n,c,e,t,r,s)});return}if(!this.options.verifyClient(h))return Ut(t,401)}this.completeUpgrade(l,n,c,e,t,r,s)}completeUpgrade(e,t,r,s,n,o,a){if(!n.readable||!n.writable)return n.destroy();if(n[hc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>wn)return Ut(n,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${ac("sha1").update(t+fc).digest("base64")}`],l=new this.options.WebSocket(null);if(r.size){let h=this.options.handleProtocols?this.options.handleProtocols(r,s):r.values().next().value;h&&(u.push(`Sec-WebSocket-Protocol: ${h}`),l._protocol=h)}if(e[qe.extensionName]){let h=e[qe.extensionName].params,d=Sn.format({[qe.extensionName]:[h]});u.push(`Sec-WebSocket-Extensions: ${d}`),l._extensions=e}this.emit("headers",u,s),n.write(u.concat(`\r
|
|
7
7
|
`).join(`\r
|
|
8
|
-
`)),n.removeListener("error",
|
|
8
|
+
`)),n.removeListener("error",An),l.setSocket(n,o,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(l),l.on("close",()=>{this.clients.delete(l),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Bt,this)})),a(l,s)}};kn.exports=wr;function dc(i,e){for(let t of Object.keys(e))i.on(t,e[t]);return function(){for(let r of Object.keys(e))i.removeListener(r,e[r])}}function Bt(i){i._state=Rn,i.emit("close")}function An(){this.destroy()}function Ut(i,e,t,r){t=t||Ri.STATUS_CODES[e],r=b({Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(t)},r),i.once("finish",i.destroy),i.end(`HTTP/1.1 ${e} ${Ri.STATUS_CODES[e]}\r
|
|
9
9
|
`+Object.keys(r).map(s=>`${s}: ${r[s]}`).join(`\r
|
|
10
10
|
`)+`\r
|
|
11
11
|
\r
|
|
12
|
-
`+t)}function
|
|
12
|
+
`+t)}function $e(i,e,t,r,s){if(i.listenerCount("wsClientError")){let n=new Error(s);Error.captureStackTrace(n,$e),i.emit("wsClientError",n,t,e)}else Ut(t,r,s)}});var Ar=k((Wh,Dn)=>{"use strict";function xc(i){t.debug=t,t.default=t,t.coerce=c,t.disable=n,t.enable=s,t.enabled=o,t.humanize=Ji(),t.destroy=u,Object.keys(i).forEach(l=>{t[l]=i[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(l){let h,d=null,x,w;function p(...v){if(!p.enabled)return;let N=p,A=Number(new Date),m=A-(h||A);N.diff=m,N.prev=h,N.curr=A,h=A,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let y=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(R,j)=>{if(R==="%%")return"%";y++;let z=t.formatters[j];if(typeof z=="function"){let pe=v[y];R=z.call(N,pe),v.splice(y,1),y--}return R}),t.formatArgs.call(N,v),(N.log||t.log).apply(N,v)}return p.namespace=l,p.useColors=t.useColors(),p.color=t.selectColor(l),p.extend=r,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(x!==t.namespaces&&(x=t.namespaces,w=t.enabled(l)),w),set:v=>{d=v}}),typeof t.init=="function"&&t.init(p),p}function r(l,h){let d=t(this.namespace+(typeof h=="undefined"?":":h)+l);return d.log=this.log,d}function s(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let h,d=(typeof l=="string"?l:"").split(/[\s,]+/),x=d.length;for(h=0;h<x;h++)d[h]&&(l=d[h].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.slice(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function n(){let l=[...t.names.map(a),...t.skips.map(a).map(h=>"-"+h)].join(",");return t.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let h,d;for(h=0,d=t.skips.length;h<d;h++)if(t.skips[h].test(l))return!1;for(h=0,d=t.names.length;h<d;h++)if(t.names[h].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Dn.exports=xc});var Mn=k((ee,Ii)=>{"use strict";ee.formatArgs=wc;ee.save=Nc;ee.load=Ac;ee.useColors=Sc;ee.storage=Rc();ee.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();ee.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Sc(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function wc(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+Ii.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),i.splice(r,0,e)}ee.log=console.debug||console.log||(()=>{});function Nc(i){try{i?ee.storage.setItem("debug",i):ee.storage.removeItem("debug")}catch(e){}}function Ac(){let i;try{i=ee.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Rc(){try{return localStorage}catch(i){}}Ii.exports=Ar()(ee);var{formatters:kc}=Ii.exports;kc.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Wn=k((Vh,$n)=>{"use strict";var Oc=S("os"),qn=S("tty"),oe=Qi(),{env:$}=process,Ie;oe("no-color")||oe("no-colors")||oe("color=false")||oe("color=never")?Ie=0:(oe("color")||oe("colors")||oe("color=true")||oe("color=always"))&&(Ie=1);"FORCE_COLOR"in $&&($.FORCE_COLOR==="true"?Ie=1:$.FORCE_COLOR==="false"?Ie=0:Ie=$.FORCE_COLOR.length===0?1:Math.min(parseInt($.FORCE_COLOR,10),3));function Rr(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function kr(i,e){if(Ie===0)return 0;if(oe("color=16m")||oe("color=full")||oe("color=truecolor"))return 3;if(oe("color=256"))return 2;if(i&&!e&&Ie===void 0)return 0;let t=Ie||0;if($.TERM==="dumb")return t;if(process.platform==="win32"){let r=Oc.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in $)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in $)||$.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in $)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test($.TEAMCITY_VERSION)?1:0;if($.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in $){let r=parseInt(($.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch($.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test($.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test($.TERM)||"COLORTERM"in $?1:t}function Tc(i){let e=kr(i,i&&i.isTTY);return Rr(e)}$n.exports={supportsColor:Tc,stdout:Rr(kr(!0,qn.isatty(1))),stderr:Rr(kr(!0,qn.isatty(2)))}});var jn=k((W,Fi)=>{"use strict";var Ic=S("tty"),Pi=S("util");W.init=Mc;W.log=Bc;W.formatArgs=Fc;W.save=Uc;W.load=Dc;W.useColors=Pc;W.destroy=Pi.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");W.colors=[6,2,3,4,5,1];try{let i=Wn();i&&(i.stderr||i).level>=2&&(W.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(i){}W.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,n)=>n.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function Pc(){return"colors"in W.inspectOpts?!!W.inspectOpts.colors:Ic.isatty(process.stderr.fd)}function Fc(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),n=` ${s};1m${e} \x1B[0m`;i[0]=n+i[0].split(`
|
|
13
13
|
`).join(`
|
|
14
|
-
`+n),i.push(s+"m+"+
|
|
15
|
-
`)}function
|
|
16
|
-
`).map(e=>e.trim()).join(" ")};zn.O=function(i){return this.inspectOpts.colors=this.useColors,Di.inspect(i,this.inspectOpts)}});var Gt=O((Nu,Fr)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Fr.exports=Vn():Fr.exports=Kn()});function Yr(i){return{all:i=i||new Map,on:function(e,t){var r=i.get(e);r?r.push(t):i.set(e,[t])},off:function(e,t){var r=i.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):i.set(e,[]))},emit:function(e,t){var r=i.get(e);r&&r.slice().map(function(s){s(t)}),(r=i.get("*"))&&r.slice().map(function(s){s(e,t)})}}}var bt,Fe,Ke=class Ke{constructor(){_(this,Fe);E(this,Fe,Yr())}static getInstance(e){return e!=null&&e.recreate&&E(Ke,bt,new Ke),h(Ke,bt)}on(e,t){h(this,Fe).on(e,t)}off(e,t){h(this,Fe).off(e,t)}emit(e,t){h(this,Fe).emit(e,t)}};bt=new WeakMap,Fe=new WeakMap,_(Ke,bt);var D=Ke;var L=class extends Error{constructor(e,t){super(e),this.originalError=t}};var Le=function(i,e,t,r){function s(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function a(l){try{u(r.next(l))}catch(f){o(f)}}function c(l){try{u(r.throw(l))}catch(f){o(f)}}function u(l){l.done?n(l.value):s(l.value).then(a,c)}u((r=r.apply(i,e||[])).next())})},xo="v1",wo="https://api.novu.co",No="@novu/client",Ao="2.0.0-canary.0",Ro=`${No}-${Ao}`,Ye=class{constructor({apiVersion:e=xo,backendUrl:t=wo,userAgent:r=Ro}={}){this.apiVersion=e,this.backendUrl=`${t}/${this.apiVersion}`,this.headers={"Content-Type":"application/json","User-Agent":r}}setAuthorizationToken(e){this.headers.Authorization=`Bearer ${e}`}disposeAuthorizationToken(){delete this.headers.Authorization}updateHeaders(e){this.headers=Object.assign(Object.assign({},this.headers),e)}getFullResponse(e,t){return Le(this,void 0,void 0,function*(){return yield(yield this.doFetch(e+this.getQueryString(t))).json()})}get(e,t){return Le(this,void 0,void 0,function*(){return(yield(yield this.doFetch(e+this.getQueryString(t))).json()).data})}post(e,t={}){return Le(this,void 0,void 0,function*(){return(yield(yield this.doFetch(e,{method:"POST",body:JSON.stringify(t)})).json()).data})}patch(e,t={}){return Le(this,void 0,void 0,function*(){return(yield(yield this.doFetch(e,{method:"PATCH",body:JSON.stringify(t)})).json()).data})}delete(e,t={}){return Le(this,void 0,void 0,function*(){return(yield(yield this.doFetch(e,{method:"DELETE",body:JSON.stringify(t)})).json()).data})}getQueryString(e){return e?"?"+new URLSearchParams(e).toString():""}doFetch(e,t={}){return Le(this,void 0,void 0,function*(){try{let r=yield fetch(this.backendUrl+e,Object.assign(Object.assign({},t),{headers:this.headers}));return yield this.checkResponseStatus(r),r}catch(r){throw r}})}checkResponseStatus(e){return Le(this,void 0,void 0,function*(){if(!e.ok){let t=yield e.json();throw new Error(`HTTP error! Status: ${e.status}, Message: ${t.message}`)}})}};var Oo="2024-06-26",Ct="/inbox",le=`${Ct}/notifications`,P,si=class{constructor(e={}){this.isSessionInitialized=!1;_(this,P);E(this,P,new Ye(e)),h(this,P).updateHeaders({"Novu-API-Version":Oo})}initializeSession(s){return g(this,arguments,function*({applicationIdentifier:e,subscriberId:t,subscriberHash:r}){let n=yield h(this,P).post(`${Ct}/session`,{applicationIdentifier:e,subscriberId:t,subscriberHash:r});return h(this,P).setAuthorizationToken(n.token),this.isSessionInitialized=!0,n})}fetchNotifications({after:e,archived:t,limit:r=10,offset:s,read:n,tags:o}){let a=new URLSearchParams(`limit=${r}`);return e&&a.append("after",e),s&&a.append("offset",`${s}`),o&&o.forEach(c=>a.append("tags[]",c)),n!==void 0&&a.append("read",`${n}`),t!==void 0&&a.append("archived",`${t}`),h(this,P).getFullResponse(`${le}?${a.toString()}`)}count({filters:e}){return h(this,P).getFullResponse(`${le}/count?filters=${JSON.stringify(e)}`)}read(e){return h(this,P).patch(`${le}/${e}/read`)}unread(e){return h(this,P).patch(`${le}/${e}/unread`)}archive(e){return h(this,P).patch(`${le}/${e}/archive`)}unarchive(e){return h(this,P).patch(`${le}/${e}/unarchive`)}readAll({tags:e}){return h(this,P).post(`${le}/read`,{tags:e})}archiveAll({tags:e}){return h(this,P).post(`${le}/archive`,{tags:e})}archiveAllRead({tags:e}){return h(this,P).post(`${le}/read-archive`,{tags:e})}completeAction({actionType:e,notificationId:t}){return h(this,P).patch(`${le}/${t}/complete`,{actionType:e})}revertAction({actionType:e,notificationId:t}){return h(this,P).patch(`${le}/${t}/revert`,{actionType:e})}fetchPreferences(){return h(this,P).get(`${Ct}/preferences`)}updateGlobalPreferences(e){return h(this,P).patch(`${Ct}/preferences`,e)}updateWorkflowPreferences({workflowId:e,channelPreferences:t}){return h(this,P).patch(`${Ct}/preferences/${e}`,t)}};P=new WeakMap;var xt,St=class St{static getInstance(e){return!!e&&E(St,xt,new si(e)),h(St,xt)}};xt=new WeakMap,_(St,xt);var ne=St;var we,Je,Ne=class{constructor(){_(this,we,[]);_(this,Je);this._emitter=D.getInstance(),this._inboxService=ne.getInstance(),this._emitter.on("session.initialize.resolved",({error:e,data:t})=>{t?(this.onSessionSuccess(t),h(this,we).forEach(n=>g(this,[n],function*({fn:r,resolve:s}){s(yield r())})),E(this,we,[])):e&&(this.onSessionError(e),E(this,Je,e),h(this,we).forEach(({resolve:r})=>{r({error:new L("Failed to initialize session, please contact the support",e)})}),E(this,we,[]))})}onSessionSuccess(e){}onSessionError(e){}callWithSession(e){return g(this,null,function*(){return this._inboxService.isSessionInitialized?e():h(this,Je)?Promise.resolve({error:new L("Failed to initialize session, please contact the support",h(this,Je))}):new Promise((t,r)=>{h(this,we).push({fn:e,resolve:t,reject:r})})})}};we=new WeakMap,Je=new WeakMap;var X,oe,G=class{constructor(e){_(this,X);_(this,oe);E(this,X,D.getInstance()),E(this,oe,ne.getInstance()),this.id=e.id,this.subject=e.subject,this.body=e.body,this.to=e.to,this.isRead=e.isRead,this.isArchived=e.isArchived,this.createdAt=e.createdAt,this.readAt=e.readAt,this.archivedAt=e.archivedAt,this.avatar=e.avatar,this.primaryAction=e.primaryAction,this.secondaryAction=e.secondaryAction,this.channelType=e.channelType,this.tags=e.tags,this.redirect=e.redirect,this.data=e.data}read(){return ni({emitter:h(this,X),apiService:h(this,oe),args:{notification:this}})}unread(){return oi({emitter:h(this,X),apiService:h(this,oe),args:{notification:this}})}archive(){return ai({emitter:h(this,X),apiService:h(this,oe),args:{notification:this}})}unarchive(){return ci({emitter:h(this,X),apiService:h(this,oe),args:{notification:this}})}completePrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Xe({emitter:h(this,X),apiService:h(this,oe),args:{notification:this},actionType:"primary"})}completeSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Xe({emitter:h(this,X),apiService:h(this,oe),args:{notification:this},actionType:"secondary"})}revertPrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Qe({emitter:h(this,X),apiService:h(this,oe),args:{notification:this},actionType:"primary"})}revertSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Qe({emitter:h(this,X),apiService:h(this,oe),args:{notification:this},actionType:"secondary"})}on(e,t){h(this,X).on(e,t)}off(e,t){h(this,X).off(e,t)}};X=new WeakMap,oe=new WeakMap;var ni=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Ze(t,{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0});try{i.emit("notification.read.pending",{args:t,data:n});let o=yield e.read(s),a=new G(o);return i.emit("notification.read.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.read.resolved",{args:t,error:o}),{error:new L("Failed to read notification",o)}}}),oi=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Ze(t,{isRead:!1,readAt:null,isArchived:!1,archivedAt:void 0});try{i.emit("notification.unread.pending",{args:t,data:n});let o=yield e.unread(s),a=new G(o);return i.emit("notification.unread.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unread.resolved",{args:t,error:o}),{error:new L("Failed to unread notification",o)}}}),ai=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Ze(t,{isArchived:!0,archivedAt:new Date().toISOString(),isRead:!0,readAt:new Date().toISOString()});try{i.emit("notification.archive.pending",{args:t,data:n});let o=yield e.archive(s),a=new G(o);return i.emit("notification.archive.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.archive.resolved",{args:t,error:o}),{error:new L("Failed to archive notification",o)}}}),ci=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Ze(t,{isArchived:!1,archivedAt:null,isRead:!0,readAt:new Date().toISOString()});try{i.emit("notification.unarchive.pending",{args:t,data:n});let o=yield e.unarchive(s),a=new G(o);return i.emit("notification.unarchive.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unarchive.resolved",{args:t,error:o}),{error:new L("Failed to unarchive notification",o)}}}),Xe=s=>g(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:I(b({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!0})}:{secondaryAction:I(b({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!0})},{notificationId:o,optimisticValue:a}=Ze(t,n);try{i.emit("notification.complete_action.pending",{args:t,data:a});let c=yield e.completeAction({actionType:r,notificationId:o}),u=new G(c);return i.emit("notification.complete_action.resolved",{args:t,data:u}),{data:u}}catch(c){return i.emit("notification.complete_action.resolved",{args:t,error:c}),{error:new L(`Failed to complete ${r} action on the notification`,c)}}}),Qe=s=>g(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:I(b({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!1})}:{secondaryAction:I(b({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!1})},{notificationId:o,optimisticValue:a}=Ze(t,n);try{i.emit("notification.revert_action.pending",{args:t,data:a});let c=yield e.revertAction({actionType:r,notificationId:o}),u=new G(c);return i.emit("notification.revert_action.resolved",{args:t,data:u}),{data:u}}catch(c){return i.emit("notification.revert_action.resolved",{args:t,error:c}),{error:new L("Failed to fetch notifications",c)}}}),Ze=(i,e)=>"notification"in i?{notificationId:i.notification.id,optimisticValue:new G(b(b({},i.notification),e))}:{notificationId:i.notificationId},Jr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(a=>new G(I(b({},a),{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0})));return i.emit("notifications.read_all.pending",{args:{tags:r},data:o}),yield e.readAll({tags:r}),i.emit("notifications.read_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.read_all.resolved",{args:{tags:r},error:n}),{error:new L("Failed to read all notifications",n)}}}),Xr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(a=>new G(I(b({},a),{isRead:!0,readAt:new Date().toISOString(),isArchived:!0,archivedAt:new Date().toISOString()})));return i.emit("notifications.archive_all.pending",{args:{tags:r},data:o}),yield e.archiveAll({tags:r}),i.emit("notifications.archive_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all.resolved",{args:{tags:r},error:n}),{error:new L("Failed to archive all notifications",n)}}}),Qr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r,read:!0}).map(a=>new G(I(b({},a),{isArchived:!0,archivedAt:new Date().toISOString()})));return i.emit("notifications.archive_all_read.pending",{args:{tags:r},data:o}),yield e.archiveAllRead({tags:r}),i.emit("notifications.archive_all_read.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all_read.resolved",{args:{tags:r},error:n}),{error:new L("Failed to archive all read notifications",n)}}});var fe,et=class{constructor(){_(this,fe);E(this,fe,new Map)}get(e){return h(this,fe).get(e)}getValues(){return Array.from(h(this,fe).values())}entries(){return Array.from(h(this,fe).entries())}keys(){return Array.from(h(this,fe).keys())}set(e,t){h(this,fe).set(e,t)}remove(e){h(this,fe).delete(e)}clear(){h(this,fe).clear()}};fe=new WeakMap;var Zr=(i,e)=>i===e?!0:!i||!e||i.length!==e.length?!1:i.every((t,r)=>t===e[r]);var Jl=["seen","unseen"],Xl=["read","unread"],Ki=(i,e)=>Zr(i,e)||!i&&(e==null?void 0:e.length)===0||(i==null?void 0:i.length)===0&&!e,Yi=(i,e)=>Ki(i.tags,e.tags)&&i.read===e.read&&i.archived===e.archived;var es=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>Object.entries({tags:i,read:e,archived:t,limit:r,offset:s,after:n}).filter(([o,a])=>a!=null&&!(Array.isArray(a)&&a.length===0)).reduce((o,[a,c])=>(o[a]=c,o),{}),Ji=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>JSON.stringify(es({tags:i,read:e,archived:t,limit:r,offset:s,after:n})),ko=({tags:i,read:e,archived:t})=>JSON.stringify(es({tags:i,read:e,archived:t})),tt=i=>JSON.parse(i),To=["notification.read.pending","notification.read.resolved","notification.unread.pending","notification.unread.resolved","notification.complete_action.pending","notification.complete_action.resolved","notification.revert_action.pending","notification.revert_action.resolved","notifications.read_all.pending","notifications.read_all.resolved"],Io=["notification.archive.pending","notification.unarchive.pending","notifications.archive_all.pending","notifications.archive_all_read.pending"],Ae,M,wt=class{constructor(){_(this,Ae);_(this,M);this.updateNotification=(e,t)=>{let r=h(this,M).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n[s]=t,h(this,M).set(e,I(b({},r),{notifications:n})),!0};this.removeNotification=(e,t)=>{let r=h(this,M).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n.splice(s,1),h(this,M).set(e,I(b({},r),{notifications:n})),!0};this.handleNotificationEvent=({remove:e}={remove:!1})=>({data:t})=>{if(!t)return;let r=Array.isArray(t)?t:[t],s=new Set;h(this,M).keys().forEach(n=>{r.forEach(o=>{let a=!1;e?a=this.removeNotification(n,o):a=this.updateNotification(n,o),a&&s.add(ko(tt(n)))})}),s.forEach(n=>{let o=this.getAggregated(tt(n));h(this,Ae).emit("notifications.list.updated",{data:o})})};E(this,Ae,D.getInstance()),To.forEach(e=>{h(this,Ae).on(e,this.handleNotificationEvent())}),Io.forEach(e=>{h(this,Ae).on(e,this.handleNotificationEvent({remove:!0}))}),E(this,M,new et)}getAggregated(e){return h(this,M).keys().filter(r=>{let s=tt(r);return Yi(s,e)}).map(r=>h(this,M).get(r)).reduce((r,s)=>s?{hasMore:s.hasMore,filter:s.filter,notifications:[...r.notifications,...s.notifications]}:r,{hasMore:!1,filter:{},notifications:[]})}has(e){return h(this,M).get(Ji(e))!==void 0}set(e,t){h(this,M).set(Ji(e),t)}update(e,t){this.set(e,t);let r=this.getAggregated(tt(Ji(e)));h(this,Ae).emit("notifications.list.updated",{data:r})}getAll(e){if(this.has(e))return this.getAggregated({tags:e.tags,read:e.read,archived:e.archived})}getUniqueNotifications({tags:e,read:t}){let r=h(this,M).keys(),s=new Map;return r.forEach(n=>{let o=tt(n);if(Ki(e,o.tags)){let a=h(this,M).get(n);if(!a)return;a.notifications.filter(c=>typeof t=="undefined"||t===c.isRead).forEach(c=>s.set(c.id,c))}}),Array.from(s.values())}clear(e){h(this,M).keys().forEach(r=>{Yi(tt(r),e)&&h(this,M).remove(r)})}clearAll(){h(this,M).clear()}};Ae=new WeakMap,M=new WeakMap;var it,li=class extends Ne{constructor({useCache:t}){super();_(this,it);this.cache=new wt,E(this,it,t)}list(){return g(this,arguments,function*(s={}){var n=s,{limit:t=10}=n,r=Kr(n,["limit"]);return this.callWithSession(()=>g(this,null,function*(){let o=b({limit:t},r);try{let a=h(this,it)?this.cache.getAll(o):void 0;if(this._emitter.emit("notifications.list.pending",{args:o,data:a}),!a){let c=yield this._inboxService.fetchNotifications(b({limit:t},r));a={hasMore:c.hasMore,filter:c.filter,notifications:c.data.map(u=>new G(u))},h(this,it)&&(this.cache.set(o,a),a=this.cache.getAll(o))}return this._emitter.emit("notifications.list.resolved",{args:o,data:a}),{data:a}}catch(a){return this._emitter.emit("notifications.list.resolved",{args:o,error:a}),{error:new L("Failed to fetch notifications",a)}}}))})}count(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){let r=t&&"filters"in t?t.filters:[b({},t)];try{this._emitter.emit("notifications.count.pending",{args:t});let s=yield this._inboxService.count({filters:r}),n=t&&"filters"in t?{counts:s.data}:s.data[0];return this._emitter.emit("notifications.count.resolved",{args:t,data:n}),{data:n}}catch(s){return this._emitter.emit("notifications.count.resolved",{args:t,error:s}),{error:new L("Failed to count notifications",s)}}}))})}read(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ni({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unread(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return oi({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}archive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ai({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unarchive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ci({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}completePrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Xe({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}completeSecondary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Xe({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}revertPrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Qe({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}revertSecondary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Qe({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}readAll(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Jr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAll(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Xr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAllRead(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Qr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}clearCache({filter:t}={}){return t?this.cache.clear(t!=null?t:{}):this.cache.clearAll()}};it=new WeakMap;var Be,Nt,Re,fi=class{constructor(e){_(this,Be);_(this,Nt);_(this,Re);E(this,Be,D.getInstance()),E(this,Nt,ne.getInstance()),E(this,Re,e)}initialize(){return g(this,null,function*(){try{let{applicationIdentifier:e,subscriberId:t,subscriberHash:r}=h(this,Re);h(this,Be).emit("session.initialize.pending",{args:h(this,Re)});let s=yield h(this,Nt).initializeSession({applicationIdentifier:e,subscriberId:t,subscriberHash:r});h(this,Be).emit("session.initialize.resolved",{args:h(this,Re),data:s})}catch(e){h(this,Be).emit("session.initialize.resolved",{args:h(this,Re),error:e})}})}};Be=new WeakMap,Nt=new WeakMap,Re=new WeakMap;var At,Rt,Ue=class{constructor(e){_(this,At);_(this,Rt);E(this,At,D.getInstance()),E(this,Rt,ne.getInstance()),this.level=e.level,this.enabled=e.enabled,this.channels=e.channels,this.workflow=e.workflow}update({channelPreferences:e}){var t;return hi({emitter:h(this,At),apiService:h(this,Rt),args:{workflowId:(t=this.workflow)==null?void 0:t.id,channelPreferences:e,preference:{level:this.level,enabled:this.enabled,channels:this.channels,workflow:this.workflow}}})}};At=new WeakMap,Rt=new WeakMap;var hi=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{workflowId:s,channelPreferences:n}=t;try{i.emit("preference.update.pending",{args:t,data:t.preference?new Ue(I(b({},t.preference),{channels:b(b({},t.preference.channels),n)})):void 0});let o;s?o=yield e.updateWorkflowPreferences({workflowId:s,channelPreferences:n}):o=yield e.updateGlobalPreferences(n);let a=new Ue(o);return i.emit("preference.update.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("preference.update.resolved",{args:t,error:o}),{error:new L("Failed to fetch notifications",o)}}});var Po=["preference.update.pending","preference.update.resolved"],ts="default",rt,he,ui=class{constructor(){_(this,rt);_(this,he);this.updatePreference=(e,t)=>{let r=h(this,he).get(e);if(!r)return!1;let s=r.findIndex(o=>{var a,c;return((a=o.workflow)==null?void 0:a.id)===((c=t.workflow)==null?void 0:c.id)||o.level===t.level&&t.level==="global"});if(s===-1)return!1;let n=[...r];return n[s]=t,h(this,he).set(e,n),!0};this.handlePreferenceEvent=({data:e})=>{e&&h(this,he).keys().forEach(t=>{let r=this.updatePreference(t,e),s=h(this,he).get(t);!r||!s||h(this,rt).emit("preferences.list.updated",{data:s})})};E(this,rt,D.getInstance()),Po.forEach(e=>{h(this,rt).on(e,this.handlePreferenceEvent)}),E(this,he,new et)}set(e){h(this,he).set(ts,e)}getAll(){return h(this,he).get(ts)}clearAll(){h(this,he).clear()}};rt=new WeakMap,he=new WeakMap;var st,di=class extends Ne{constructor({useCache:t}){super();_(this,st);this.cache=new ui,E(this,st,t)}list(){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){try{let t=h(this,st)?this.cache.getAll():void 0;return this._emitter.emit("preferences.list.pending",{args:void 0,data:t}),t||(t=(yield this._inboxService.fetchPreferences()).map(s=>new Ue(s)),h(this,st)&&this.cache.set(t)),this._emitter.emit("preferences.list.resolved",{args:void 0,data:t}),{data:t}}catch(t){throw this._emitter.emit("preferences.list.resolved",{args:void 0,error:t}),t}}))})}update(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return hi({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}};st=new WeakMap;var ue=Object.create(null);ue.open="0";ue.close="1";ue.ping="2";ue.pong="3";ue.message="4";ue.upgrade="5";ue.noop="6";var Ot=Object.create(null);Object.keys(ue).forEach(i=>{Ot[ue[i]]=i});var kt={type:"error",data:"parser error"};var Tt=({type:i,data:e},t,r)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?r(t?e:"b"+is(e,!0).toString("base64")):r(ue[i]+(e||"")),is=(i,e)=>Buffer.isBuffer(i)||i instanceof Uint8Array&&!e?i:i instanceof ArrayBuffer?Buffer.from(i):Buffer.from(i.buffer,i.byteOffset,i.byteLength),Xi;function rs(i,e){if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return e(is(i.data,!1));Tt(i,!0,t=>{Xi||(Xi=new TextEncoder),e(Xi.encode(t))})}var It=(i,e)=>{if(typeof i!="string")return{type:"message",data:ss(i,e)};let t=i.charAt(0);if(t==="b"){let r=Buffer.from(i.substring(1),"base64");return{type:"message",data:ss(r,e)}}return Ot[t]?i.length>1?{type:Ot[t],data:i.substring(1)}:{type:Ot[t]}:kt},ss=(i,e)=>{switch(e){case"arraybuffer":return i instanceof ArrayBuffer?i:Buffer.isBuffer(i)?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer;case"nodebuffer":default:return Buffer.isBuffer(i)?i:Buffer.from(i)}};var ns="",os=(i,e)=>{let t=i.length,r=new Array(t),s=0;i.forEach((n,o)=>{Tt(n,!1,a=>{r[o]=a,++s===t&&e(r.join(ns))})})},as=(i,e)=>{let t=i.split(ns),r=[];for(let s=0;s<t.length;s++){let n=It(t[s],e);if(r.push(n),n.type==="error")break}return r};function cs(){return new TransformStream({transform(i,e){rs(i,t=>{let r=t.length,s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,r)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(r))}i.data&&typeof i.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}var Qi;function pi(i){return i.reduce((e,t)=>e+t.length,0)}function mi(i,e){if(i[0].length===e)return i.shift();let t=new Uint8Array(e),r=0;for(let s=0;s<e;s++)t[s]=i[0][r++],r===i[0].length&&(i.shift(),r=0);return i.length&&r<i[0].length&&(i[0]=i[0].slice(r)),t}function ls(i,e){Qi||(Qi=new TextDecoder);let t=[],r=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(r===0){if(pi(t)<1)break;let c=mi(t,1);n=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(pi(t)<2)break;let c=mi(t,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(pi(t)<8)break;let c=mi(t,8),u=new DataView(c.buffer,c.byteOffset,c.length),l=u.getUint32(0);if(l>Math.pow(2,21)-1){a.enqueue(kt);break}s=l*Math.pow(2,32)+u.getUint32(4),r=3}else{if(pi(t)<s)break;let c=mi(t,s);a.enqueue(It(n?c:Qi.decode(c),e)),r=0}if(s===0||s>i){a.enqueue(kt);break}}}})}var Zi=4;function k(i){if(i)return Fo(i)}function Fo(i){for(var e in k.prototype)i[e]=k.prototype[e];return i}k.prototype.on=k.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this};k.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this};k.prototype.off=k.prototype.removeListener=k.prototype.removeAllListeners=k.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+i],this};k.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this};k.prototype.emitReserved=k.prototype.emit;k.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};k.prototype.hasListeners=function(i){return!!this.listeners(i).length};var de=global;function gi(i,...e){return e.reduce((t,r)=>(i.hasOwnProperty(r)&&(t[r]=i[r]),t),{})}var Lo=de.setTimeout,Bo=de.clearTimeout;function _e(i,e){e.useNativeTimers?(i.setTimeoutFn=Lo.bind(de),i.clearTimeoutFn=Bo.bind(de)):(i.setTimeoutFn=de.setTimeout.bind(de),i.clearTimeoutFn=de.clearTimeout.bind(de))}var Uo=1.33;function fs(i){return typeof i=="string"?Do(i):Math.ceil((i.byteLength||i.size)*Uo)}function Do(i){let e=0,t=0;for(let r=0,s=i.length;r<s;r++)e=i.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}var Cs=Y(Me(),1);function Es(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function bs(i){let e={},t=i.split("&");for(let r=0,s=t.length;r<s;r++){let n=t[r].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var la=(0,Cs.default)("engine.io-client:transport"),nr=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},Ee=class extends k{constructor(e){super(),this.writable=!1,_e(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new nr(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):la("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=It(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Es(e);return t.length?"?"+t:""}};var Is=Y(Me(),1);var Ns="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),or=64,fa={},Ss=0,Ci=0,xs;function ws(i){let e="";do e=Ns[i%or]+e,i=Math.floor(i/or);while(i>0);return e}function Si(){let i=ws(+new Date);return i!==xs?(Ss=0,xs=i):i+"."+ws(Ss++)}for(;Ci<or;Ci++)fa[Ns[Ci]]=Ci;var lr=Y(Os(),1),fr=lr.default||lr;function ks(){return new cr}function ua(i){let e=i.split("; "),t=e[0].indexOf("=");if(t===-1)return;let r=e[0].substring(0,t).trim();if(!r.length)return;let s=e[0].substring(t+1).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));let n={name:r,value:s};for(let o=1;o<e.length;o++){let a=e[o].split("=");if(a.length!==2)continue;let c=a[0].trim(),u=a[1].trim();switch(c){case"Expires":n.expires=new Date(u);break;case"Max-Age":let l=new Date;l.setUTCSeconds(l.getUTCSeconds()+parseInt(u,10)),n.expires=l;break;default:}}return n}var cr=class{constructor(){this.cookies=new Map}parseCookies(e){let t=e.getResponseHeader("set-cookie");t&&t.forEach(r=>{let s=ua(r);s&&this.cookies.set(s.name,s)})}addCookies(e){let t=[];this.cookies.forEach((r,s)=>{var n;((n=r.expires)===null||n===void 0?void 0:n.getTime())<Date.now()?this.cookies.delete(s):t.push(`${s}=${r.value}`)}),t.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",t.join("; ")))}};var Q=(0,Is.default)("engine.io-client:polling");function da(){}var pa=function(){return new fr({xdomain:!1}).responseType!=null}(),xi=class extends Ee{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){let r=location.protocol==="https:",s=location.port;s||(s=r?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||s!==e.port}let t=e&&e.forceBase64;this.supportsBinary=pa&&!t,this.opts.withCredentials&&(this.cookieJar=ks())}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{Q("paused"),this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(Q("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){Q("pre-pause polling complete"),--r||t()})),this.writable||(Q("we are currently writing - waiting to pause"),r++,this.once("drain",function(){Q("pre-pause writing complete"),--r||t()}))}else t()}poll(){Q("polling"),this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){Q("polling got data %s",e);let t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};as(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this.poll():Q('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{Q("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(Q("transport open - closing"),e()):(Q("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,os(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Si()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Oe(this.uri(),e)}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){Q("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}},Oe=class i extends k{constructor(e,t){super(),_e(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;let t=gi(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let r=this.xhr=new fr(t);try{Q("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this.opts.extraHeaders[s])}}catch(s){}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{r.setRequestHeader("Accept","*/*")}catch(s){}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this.opts.cookieJar)===null||s===void 0||s.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},Q("xhr data %s",this.data),r.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document!="undefined"&&(this.index=i.requestsCount++,i.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.xhr.onreadystatechange=da,e)try{this.xhr.abort()}catch(t){}typeof document!="undefined"&&delete i.requests[this.index],this.xhr=null}}onLoad(){let e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Oe.requestsCount=0;Oe.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",Ts);else if(typeof addEventListener=="function"){let i="onpagehide"in de?"pagehide":"unload";addEventListener(i,Ts,!1)}}function Ts(){for(let i in Oe.requests)Oe.requests.hasOwnProperty(i)&&Oe.requests[i].abort()}var xc=Y(Bs(),1),wc=Y(_r(),1),Nc=Y(br(),1),Ln=Y(Rr(),1),Ac=Y(Fn(),1);var Bn=Ln.default;var jt=Bn,Fi=!1,Un="nodebuffer",Ve=process.nextTick;var Mn=Y(Me(),1);var Rc=(0,Mn.default)("engine.io-client:websocket"),Dn=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Li=class extends Ee{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,r=Dn?{}:gi(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=Fi&&!Dn?t?new jt(e,t):new jt(e):new jt(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;Tt(r,this.supportsBinary,n=>{let o={};Fi||(r.options&&(o.compress=r.options.compress),this.opts.perMessageDeflate&&(typeof n=="string"?Buffer.byteLength(n):n.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{Fi?this.ws.send(n):this.ws.send(n,o)}catch(a){Rc("websocket closed before onclose event")}s&&Ve(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Si()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!jt}};var qn=Y(Me(),1),Ht=(0,qn.default)("engine.io-client:webtransport"),Bi=class extends Ee{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{Ht("transport closed gracefully"),this.onClose()}).catch(e=>{Ht("transport closed due to %s",e),this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{let t=ls(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=cs();s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();let n=()=>{r.read().then(({done:a,value:c})=>{if(a){Ht("session is closed");return}Ht("received chunk: %o",c),this.onPacket(c),n()}).catch(a=>{Ht("an error occurred while reading: %s",a)})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;this.writer.write(r).then(()=>{s&&Ve(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}};var kr={websocket:Li,webtransport:Bi,polling:xi};var Oc=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,kc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ut(i){let e=i,t=i.indexOf("["),r=i.indexOf("]");t!=-1&&r!=-1&&(i=i.substring(0,t)+i.substring(t,r).replace(/:/g,";")+i.substring(r,i.length));let s=Oc.exec(i||""),n={},o=14;for(;o--;)n[kc[o]]=s[o]||"";return t!=-1&&r!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=Tc(n,n.path),n.queryKey=Ic(n,n.query),n}function Tc(i,e){let t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Ic(i,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,n){s&&(t[s]=n)}),t}var $n=Y(Me(),1);var T=(0,$n.default)("engine.io-client:socket"),je=class i extends k{constructor(e,t={}){super(),this.binaryType=Un,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=ut(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ut(t.host).host),_e(this,t),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=bs(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){T('creating transport "%s"',e);let t=Object.assign({},this.opts.query);t.EIO=Zi,t.transport=e,this.id&&(t.sid=this.id);let r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return T("options: %j",r),new kr[e](r)}open(){let e;if(this.opts.rememberUpgrade&&i.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(t){T("error while creating transport: %s",t),this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){T("setting transport %s",e.name),this.transport&&(T("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){T('probing transport "%s"',e);let t=this.createTransport(e),r=!1;i.priorWebsocketSuccess=!1;let s=()=>{r||(T('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(T('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;i.priorWebsocketSuccess=t.name==="websocket",T('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{r||this.readyState!=="closed"&&(T("changing transport and sending upgrade packet"),l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{T('probe transport "%s" failed',e);let d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function n(){r||(r=!0,l(),t.close(),t=null)}let o=f=>{let d=new Error("probe error: "+f);d.transport=t.name,n(),T('probe transport "%s" failed because of error: %s',e,f),this.emitReserved("upgradeError",d)};function a(){o("transport closed")}function c(){o("socket closed")}function u(f){t&&f.name!==t.name&&(T('"%s" works - aborting "%s"',f.name,t.name),n())}let l=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",u)};t.once("open",s),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onOpen(){if(T("socket open"),this.readyState="open",i.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){T("starting upgrade probes");let e=0,t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(T('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":let t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else T('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this.getWritablePackets();T("flushing %d packets in socket",e.length),this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){let s=this.writeBuffer[r].data;if(s&&(t+=fs(s)),r>0&&t>this.maxPayload)return T("only send %d out of %d packets",r,this.writeBuffer.length),this.writeBuffer.slice(0,r);t+=2}return T("payload size is %d (max: %d)",t,this.maxPayload),this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let n={type:e,data:t,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),s&&this.once("flush",s),this.flush()}close(){let e=()=>{this.onClose("forced close"),T("socket closing - telling transport to close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){T("socket error %j",e),i.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(T('socket close with reason: "%s"',e),this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],r=0,s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}};je.protocol=Zi;var yu=je.protocol;var Jn=Y(Gt(),1),Yn=(0,Jn.default)("socket.io-client:url");function Xn(i,e="",t){let r=i;t=t||typeof location!="undefined"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(Yn("protocol-less url %s",i),typeof t!="undefined"?i=t.protocol+"//"+i:i="https://"+i),Yn("parse %s",i),r=ut(i)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let n=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+n+":"+r.port+e,r.href=r.protocol+"://"+n+(t&&t.port===r.port?"":":"+r.port),r}var $r={};Co($r,{Decoder:()=>Mr,Encoder:()=>Dr,PacketType:()=>C,protocol:()=>ro});var Jc=typeof ArrayBuffer=="function",Xc=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Qn=Object.prototype.toString,Qc=typeof Blob=="function"||typeof Blob!="undefined"&&Qn.call(Blob)==="[object BlobConstructor]",Zc=typeof File=="function"||typeof File!="undefined"&&Qn.call(File)==="[object FileConstructor]";function Kt(i){return Jc&&(i instanceof ArrayBuffer||Xc(i))||Qc&&i instanceof Blob||Zc&&i instanceof File}function zt(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,r=i.length;t<r;t++)if(zt(i[t]))return!0;return!1}if(Kt(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return zt(i.toJSON(),!0);for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&zt(i[t]))return!0;return!1}function Zn(i){let e=[],t=i.data,r=i;return r.data=Lr(t,e),r.attachments=e.length,{packet:r,buffers:e}}function Lr(i,e){if(!i)return i;if(Kt(i)){let t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){let t=new Array(i.length);for(let r=0;r<i.length;r++)t[r]=Lr(i[r],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){let t={};for(let r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=Lr(i[r],e));return t}return i}function eo(i,e){return i.data=Br(i.data,e),delete i.attachments,i}function Br(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=Br(i[t],e);else if(typeof i=="object")for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Br(i[t],e));return i}var io=Y(Me(),1),Ur=(0,io.default)("socket.io-parser"),el=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ro=5,C;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(C||(C={}));var Dr=class{constructor(e){this.replacer=e}encode(e){return Ur("encoding packet %j",e),(e.type===C.EVENT||e.type===C.ACK)&&zt(e)?this.encodeAsBinary({type:e.type===C.EVENT?C.BINARY_EVENT:C.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===C.BINARY_EVENT||e.type===C.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),Ur("encoded %j as %s",e,t),t}encodeAsBinary(e){let t=Zn(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}};function to(i){return Object.prototype.toString.call(i)==="[object Object]"}var Mr=class i extends k{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let r=t.type===C.BINARY_EVENT;r||t.type===C.BINARY_ACK?(t.type=r?C.EVENT:C.ACK,this.reconstructor=new qr(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Kt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,r={type:Number(e.charAt(0))};if(C[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===C.BINARY_EVENT||r.type===C.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(n,t)}else r.nsp="/";let s=e.charAt(t+1);if(s!==""&&Number(s)==s){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(i.isPayloadValid(r.type,n))r.data=n;else throw new Error("invalid payload")}return Ur("decoded %s as %j",e,r),r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case C.CONNECT:return to(t);case C.DISCONNECT:return t===void 0;case C.CONNECT_ERROR:return typeof t=="string"||to(t);case C.EVENT:case C.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&el.indexOf(t[0])===-1);case C.ACK:case C.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},qr=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=eo(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function ie(i,e,t){return i.on(e,t),function(){i.off(e,t)}}var so=Y(Gt(),1),U=(0,so.default)("socket.io-client:socket"),tl=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),dt=class extends k{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[ie(e,"open",this.onopen.bind(this)),ie(e,"packet",this.onpacket.bind(this)),ie(e,"error",this.onerror.bind(this)),ie(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(tl.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let r={type:C.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let o=this.ids++;U("emitting packet with ack id %d",o);let a=t.pop();this._registerAckCallback(o,a),r.id=o}let s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)?U("discard packet as the transport is not currently writable"):this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r),this.flags={},this}_registerAckCallback(e,t){var r;let s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(U("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));U("event with ack id %d has timed out after %d ms",e,s),t.call(this,new Error("operation has timed out"))},s);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,[null,...o])}}emitWithAck(e,...t){let r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((s,n)=>{t.push((o,a)=>r?o?n(o):s(a):s(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...n)=>r!==this._queue[0]?void 0:(s!==null?r.tryCount>this._opts.retries&&(U("packet [%d] is discarded after %d tries",r.id,r.tryCount),this._queue.shift(),t&&t(s)):(U("packet [%d] was successfully sent",r.id),this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(U("draining queue"),!this.connected||this._queue.length===0)return;let t=this._queue[0];if(t.pending&&!e){U("packet [%d] has already been sent and is waiting for an ack",t.id);return}t.pending=!0,t.tryCount++,U("sending packet [%d] (try n\xB0%d)",t.id,t.tryCount),this.flags=t.flags,this.emit.apply(this,t.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){U("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:C.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){U("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case C.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case C.EVENT:case C.BINARY_EVENT:this.onevent(e);break;case C.ACK:case C.BINARY_ACK:this.onack(e);break;case C.DISCONNECT:this.ondisconnect();break;case C.CONNECT_ERROR:this.destroy();let r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){let t=e.data||[];U("emitting event %j",t),e.id!=null&&(U("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,r=!1;return function(...s){r||(r=!0,U("sending ack %j",s),t.packet({type:C.ACK,id:e,data:s}))}}onack(e){let t=this.acks[e.id];typeof t=="function"?(U("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):U("bad ack %s",e.id)}onconnect(e,t){U("socket connected with id %s",e),this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){U("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(U("performing disconnect (%s)",this.nsp),this.packet({type:C.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let r of t)r.apply(this,e.data)}}};function He(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}He.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=Math.floor(e*10)&1?i+t:i-t}return Math.min(i,this.max)|0};He.prototype.reset=function(){this.attempts=0};He.prototype.setMin=function(i){this.ms=i};He.prototype.setMax=function(i){this.max=i};He.prototype.setJitter=function(i){this.jitter=i};var no=Y(Gt(),1),z=(0,no.default)("socket.io-client:manager"),pt=class extends k{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,_e(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new He({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let s=t.parser||$r;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(z("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;z("opening %s",this.uri),this.engine=new je(this.uri,this.opts);let t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let s=ie(t,"open",function(){r.onopen(),e&&e()}),n=a=>{z("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=ie(t,"error",n);if(this._timeout!==!1){let a=this._timeout;z("connect attempt will timeout after %d",a);let c=this.setTimeoutFn(()=>{z("connect attempt timed out after %d",a),s(),n(new Error("timeout")),t.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){z("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(ie(e,"ping",this.onping.bind(this)),ie(e,"data",this.ondata.bind(this)),ie(e,"error",this.onerror.bind(this)),ie(e,"close",this.onclose.bind(this)),ie(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Ve(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){z("error",e),this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new dt(this,e,t),this.nsps[e]=r),r}_destroy(e){let t=Object.keys(this.nsps);for(let r of t)if(this.nsps[r].active){z("socket %s is still active, skipping close",r);return}this._close()}_packet(e){z("writing packet %j",e);let t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){z("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){z("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){z("closed due to %s",e),this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)z("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();z("will wait %dms before reconnect attempt",t),this._reconnecting=!0;let r=this.setTimeoutFn(()=>{e.skipReconnect||(z("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(z("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):(z("reconnect success"),e.onreconnect())}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var ao=Y(Gt(),1),oo=(0,ao.default)("socket.io-client"),Yt={};function Jt(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};let t=Xn(i,e.path||"/socket.io"),r=t.source,s=t.id,n=t.path,o=Yt[s]&&n in Yt[s].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o,c;return a?(oo("ignoring socket cache for %s",r),c=new pt(r,e)):(Yt[s]||(oo("new io instance for %s",r),Yt[s]=new pt(r,e)),c=Yt[s]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(Jt,{Manager:pt,Socket:dt,io:Jt,connect:Jt});var il="https://ws.novu.co",co="notifications.notification_received",lo="notifications.unseen_count_changed",fo="notifications.unread_count_changed",rl=({_id:i,content:e,read:t,archived:r,createdAt:s,lastReadDate:n,archivedAt:o,channel:a,subscriber:c,subject:u,avatar:l,cta:f,tags:d,data:S})=>{var m,y,j,R,H,K,me,Zt,ei,re;let w={id:(m=c==null?void 0:c._id)!=null?m:"",firstName:c==null?void 0:c.firstName,lastName:c==null?void 0:c.lastName,avatar:c==null?void 0:c.avatar,subscriberId:(y=c==null?void 0:c.subscriberId)!=null?y:""},p=(R=(j=f.action)==null?void 0:j.buttons)==null?void 0:R.find(Ge=>Ge.type==="primary"),v=(K=(H=f.action)==null?void 0:H.buttons)==null?void 0:K.find(Ge=>Ge.type==="secondary"),N=(Zt=(me=f.action)==null?void 0:me.result)==null?void 0:Zt.type,A=(ei=f.action)==null?void 0:ei.status;return{id:i,subject:u,body:e,to:w,isRead:t,isArchived:r,createdAt:s,readAt:n,archivedAt:o,avatar:l,primaryAction:p&&{label:p.content,isCompleted:N==="primary"&&A==="done",redirect:p.url?{target:p.target,url:p.url}:void 0},secondaryAction:v&&{label:v.content,isCompleted:N==="secondary"&&A==="done",redirect:v.url?{target:v.target,url:v.url}:void 0},channelType:a,tags:d,redirect:(re=f.data)!=null&&re.url?{url:f.data.url,target:f.data.target}:void 0,data:S}},mt,ye,ve,gt,$i,Wi,Vi,Xt,Wr,qi=class extends Ne{constructor({socketUrl:t}){super();_(this,Xt);_(this,mt);_(this,ye);_(this,ve);_(this,gt);_(this,$i,({message:t})=>{h(this,ye).emit(co,{result:new G(rl(t))})});_(this,Wi,({unseenCount:t})=>{h(this,ye).emit(lo,{result:t})});_(this,Vi,({unreadCount:t})=>{h(this,ye).emit(fo,{result:t})});E(this,ye,D.getInstance()),E(this,gt,t!=null?t:il)}onSessionSuccess({token:t}){E(this,mt,t)}isSocketEvent(t){return t===co||t===lo||t===fo}initialize(){if(h(this,mt)){zi(this,Xt,Wr).call(this).catch(t=>{console.error(t)});return}this.callWithSession(()=>g(this,null,function*(){return zi(this,Xt,Wr).call(this).catch(t=>{console.error(t)}),{}}))}};mt=new WeakMap,ye=new WeakMap,ve=new WeakMap,gt=new WeakMap,$i=new WeakMap,Wi=new WeakMap,Vi=new WeakMap,Xt=new WeakSet,Wr=function(){return g(this,null,function*(){var r,s,n;if(h(this,ve))return;let t={socketUrl:h(this,gt)};h(this,ye).emit("socket.connect.pending",{args:t}),E(this,ve,Jt(h(this,gt),{reconnectionDelayMax:1e4,transports:["websocket"],query:{token:`${h(this,mt)}`}})),h(this,ve).on("connect",()=>{h(this,ye).emit("socket.connect.resolved",{args:t})}),h(this,ve).on("connect_error",o=>{h(this,ye).emit("socket.connect.resolved",{args:t,error:o})}),(r=h(this,ve))==null||r.on("notification_received",h(this,$i)),(s=h(this,ve))==null||s.on("unseen_count_changed",h(this,Wi)),(n=h(this,ve))==null||n.on("unread_count_changed",h(this,Vi))})};var ho="https://api.novu.co";var yt,Qt,vt,ji=class{constructor(e){_(this,yt);_(this,Qt);_(this,vt);var t,r,s;ne.getInstance({backendUrl:(t=e.backendUrl)!=null?t:ho}),E(this,yt,D.getInstance({recreate:!0})),E(this,Qt,new fi({applicationIdentifier:e.applicationIdentifier,subscriberId:e.subscriberId,subscriberHash:e.subscriberHash})),h(this,Qt).initialize(),this.notifications=new li({useCache:(r=e.useCache)!=null?r:!0}),this.preferences=new di({useCache:(s=e.useCache)!=null?s:!0}),E(this,vt,new qi({socketUrl:e.socketUrl}))}on(e,t){h(this,vt).isSocketEvent(e)&&h(this,vt).initialize(),h(this,yt).on(e,t)}off(e,t){h(this,yt).off(e,t)}};yt=new WeakMap,Qt=new WeakMap,vt=new WeakMap;window.Novu=ji;})();
|
|
14
|
+
`+n),i.push(s+"m+"+Fi.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Lc()+e+" "+i[0]}function Lc(){return W.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Bc(...i){return process.stderr.write(Pi.formatWithOptions(W.inspectOpts,...i)+`
|
|
15
|
+
`)}function Uc(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Dc(){return process.env.DEBUG}function Mc(i){i.inspectOpts={};let e=Object.keys(W.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=W.inspectOpts[e[t]]}Fi.exports=Ar()(W);var{formatters:Vn}=Fi.exports;Vn.o=function(i){return this.inspectOpts.colors=this.useColors,Pi.inspect(i,this.inspectOpts).split(`
|
|
16
|
+
`).map(e=>e.trim()).join(" ")};Vn.O=function(i){return this.inspectOpts.colors=this.useColors,Pi.inspect(i,this.inspectOpts)}});var qt=k((jh,Or)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Or.exports=Mn():Or.exports=jn()});function Hr(i){return{all:i=i||new Map,on:function(e,t){var r=i.get(e);r?r.push(t):i.set(e,[t])},off:function(e,t){var r=i.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):i.set(e,[]))},emit:function(e,t){var r=i.get(e);r&&r.slice().map(function(s){s(t)}),(r=i.get("*"))&&r.slice().map(function(s){s(e,t)})}}}var Fe,Zt=class{constructor(){_(this,Fe);E(this,Fe,Hr())}on(e,t){f(this,Fe).on(e,t)}off(e,t){f(this,Fe).off(e,t)}emit(e,t){f(this,Fe).emit(e,t)}};Fe=new WeakMap;var L=class extends Error{constructor(e,t){super(e),this.originalError=t}};var Se,Ke,we=class{constructor({inboxServiceInstance:e,eventEmitterInstance:t}){_(this,Se,[]);_(this,Ke);this._emitter=t,this._inboxService=e,this._emitter.on("session.initialize.resolved",({error:r,data:s})=>{s?(this.onSessionSuccess(s),f(this,Se).forEach(a=>g(this,[a],function*({fn:n,resolve:o}){o(yield n())})),E(this,Se,[])):r&&(this.onSessionError(r),E(this,Ke,r),f(this,Se).forEach(({resolve:n})=>{n({error:new L("Failed to initialize session, please contact the support",r)})}),E(this,Se,[]))})}onSessionSuccess(e){}onSessionError(e){}callWithSession(e){return g(this,null,function*(){return this._inboxService.isSessionInitialized?e():f(this,Ke)?Promise.resolve({error:new L("Failed to initialize session, please contact the support",f(this,Ke))}):new Promise((t,r)=>{f(this,Se).push({fn:e,resolve:t,reject:r})})})}};Se=new WeakMap,Ke=new WeakMap;var J,se,H=class{constructor(e,t,r){_(this,J);_(this,se);E(this,J,t),E(this,se,r),this.id=e.id,this.subject=e.subject,this.body=e.body,this.to=e.to,this.isRead=e.isRead,this.isArchived=e.isArchived,this.createdAt=e.createdAt,this.readAt=e.readAt,this.archivedAt=e.archivedAt,this.avatar=e.avatar,this.primaryAction=e.primaryAction,this.secondaryAction=e.secondaryAction,this.channelType=e.channelType,this.tags=e.tags,this.redirect=e.redirect,this.data=e.data}read(){return ei({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}unread(){return ti({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}archive(){return ii({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}unarchive(){return ri({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}completePrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Ye({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"primary"})}completeSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Ye({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"secondary"})}revertPrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Je({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"primary"})}revertSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Je({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"secondary"})}on(e,t){f(this,J).on(e,t)}off(e,t){f(this,J).off(e,t)}};J=new WeakMap,se=new WeakMap;var ei=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Xe(t,{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.read.pending",{args:t,data:n});let o=yield e.read(s),a=new H(o,i,e);return i.emit("notification.read.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.read.resolved",{args:t,error:o}),{error:new L("Failed to read notification",o)}}}),ti=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Xe(t,{isRead:!1,readAt:null,isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.unread.pending",{args:t,data:n});let o=yield e.unread(s),a=new H(o,i,e);return i.emit("notification.unread.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unread.resolved",{args:t,error:o}),{error:new L("Failed to unread notification",o)}}}),ii=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Xe(t,{isArchived:!0,archivedAt:new Date().toISOString(),isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.archive.pending",{args:t,data:n});let o=yield e.archive(s),a=new H(o,i,e);return i.emit("notification.archive.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.archive.resolved",{args:t,error:o}),{error:new L("Failed to archive notification",o)}}}),ri=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Xe(t,{isArchived:!1,archivedAt:null,isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.unarchive.pending",{args:t,data:n});let o=yield e.unarchive(s),a=new H(o,i,e);return i.emit("notification.unarchive.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unarchive.resolved",{args:t,error:o}),{error:new L("Failed to unarchive notification",o)}}}),Ye=s=>g(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:I(b({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!0})}:{secondaryAction:I(b({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!0})},{notificationId:o,optimisticValue:a}=Xe(t,n,{emitter:i,apiService:e});try{i.emit("notification.complete_action.pending",{args:t,data:a});let c=yield e.completeAction({actionType:r,notificationId:o}),u=new H(c,i,e);return i.emit("notification.complete_action.resolved",{args:t,data:u}),{data:u}}catch(c){return i.emit("notification.complete_action.resolved",{args:t,error:c}),{error:new L(`Failed to complete ${r} action on the notification`,c)}}}),Je=s=>g(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:I(b({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!1})}:{secondaryAction:I(b({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!1})},{notificationId:o,optimisticValue:a}=Xe(t,n,{emitter:i,apiService:e});try{i.emit("notification.revert_action.pending",{args:t,data:a});let c=yield e.revertAction({actionType:r,notificationId:o}),u=new H(c,i,e);return i.emit("notification.revert_action.resolved",{args:t,data:u}),{data:u}}catch(c){return i.emit("notification.revert_action.resolved",{args:t,error:c}),{error:new L("Failed to fetch notifications",c)}}}),Xe=(i,e,t)=>"notification"in i?{notificationId:i.notification.id,optimisticValue:new H(b(b({},i.notification),e),t.emitter,t.apiService)}:{notificationId:i.notificationId},Gr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(a=>new H(I(b({},a),{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0}),i,e));return i.emit("notifications.read_all.pending",{args:{tags:r},data:o}),yield e.readAll({tags:r}),i.emit("notifications.read_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.read_all.resolved",{args:{tags:r},error:n}),{error:new L("Failed to read all notifications",n)}}}),zr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(a=>new H(I(b({},a),{isRead:!0,readAt:new Date().toISOString(),isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all.pending",{args:{tags:r},data:o}),yield e.archiveAll({tags:r}),i.emit("notifications.archive_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all.resolved",{args:{tags:r},error:n}),{error:new L("Failed to archive all notifications",n)}}}),Kr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r,read:!0}).map(a=>new H(I(b({},a),{isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all_read.pending",{args:{tags:r},data:o}),yield e.archiveAllRead({tags:r}),i.emit("notifications.archive_all_read.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all_read.resolved",{args:{tags:r},error:n}),{error:new L("Failed to archive all read notifications",n)}}});var Yr=(i,e)=>i===e?!0:!i||!e||i.length!==e.length?!1:i.every((t,r)=>t===e[r]);var El=["seen","unseen"],bl=["read","unread"],ji=(i,e)=>Yr(i,e)||!i&&(e==null?void 0:e.length)===0||(i==null?void 0:i.length)===0&&!e,Hi=(i,e)=>ji(i.tags,e.tags)&&i.read===e.read&&i.archived===e.archived;var ae,Qe=class{constructor(){_(this,ae);E(this,ae,new Map)}get(e){return f(this,ae).get(e)}getValues(){return Array.from(f(this,ae).values())}entries(){return Array.from(f(this,ae).entries())}keys(){return Array.from(f(this,ae).keys())}set(e,t){f(this,ae).set(e,t)}remove(e){f(this,ae).delete(e)}clear(){f(this,ae).clear()}};ae=new WeakMap;var Jr=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>Object.entries({tags:i,read:e,archived:t,limit:r,offset:s,after:n}).filter(([o,a])=>a!=null&&!(Array.isArray(a)&&a.length===0)).reduce((o,[a,c])=>(o[a]=c,o),{}),Gi=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>JSON.stringify(Jr({tags:i,read:e,archived:t,limit:r,offset:s,after:n})),Eo=({tags:i,read:e,archived:t})=>JSON.stringify(Jr({tags:i,read:e,archived:t})),Ze=i=>JSON.parse(i),bo=["notification.read.pending","notification.read.resolved","notification.unread.pending","notification.unread.resolved","notification.complete_action.pending","notification.complete_action.resolved","notification.revert_action.pending","notification.revert_action.resolved","notifications.read_all.pending","notifications.read_all.resolved"],Co=["notification.archive.pending","notification.unarchive.pending","notifications.archive_all.pending","notifications.archive_all_read.pending"],Ne,D,_t=class{constructor({emitter:e}){_(this,Ne);_(this,D);this.updateNotification=(e,t)=>{let r=f(this,D).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n[s]=t,f(this,D).set(e,I(b({},r),{notifications:n})),!0};this.removeNotification=(e,t)=>{let r=f(this,D).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n.splice(s,1),f(this,D).set(e,I(b({},r),{notifications:n})),!0};this.handleNotificationEvent=({remove:e}={remove:!1})=>({data:t})=>{if(!t)return;let r=Array.isArray(t)?t:[t],s=new Set;f(this,D).keys().forEach(n=>{r.forEach(o=>{let a=!1;e?a=this.removeNotification(n,o):a=this.updateNotification(n,o),a&&s.add(Eo(Ze(n)))})}),s.forEach(n=>{let o=this.getAggregated(Ze(n));f(this,Ne).emit("notifications.list.updated",{data:o})})};E(this,Ne,e),bo.forEach(t=>{f(this,Ne).on(t,this.handleNotificationEvent())}),Co.forEach(t=>{f(this,Ne).on(t,this.handleNotificationEvent({remove:!0}))}),E(this,D,new Qe)}getAggregated(e){return f(this,D).keys().filter(r=>{let s=Ze(r);return Hi(s,e)}).map(r=>f(this,D).get(r)).reduce((r,s)=>s?{hasMore:s.hasMore,filter:s.filter,notifications:[...r.notifications,...s.notifications]}:r,{hasMore:!1,filter:{},notifications:[]})}has(e){return f(this,D).get(Gi(e))!==void 0}set(e,t){f(this,D).set(Gi(e),t)}update(e,t){this.set(e,t);let r=this.getAggregated(Ze(Gi(e)));f(this,Ne).emit("notifications.list.updated",{data:r})}getAll(e){if(this.has(e))return this.getAggregated({tags:e.tags,read:e.read,archived:e.archived})}getUniqueNotifications({tags:e,read:t}){let r=f(this,D).keys(),s=new Map;return r.forEach(n=>{let o=Ze(n);if(ji(e,o.tags)){let a=f(this,D).get(n);if(!a)return;a.notifications.filter(c=>typeof t=="undefined"||t===c.isRead).forEach(c=>s.set(c.id,c))}}),Array.from(s.values())}clear(e){f(this,D).keys().forEach(r=>{Hi(Ze(r),e)&&f(this,D).remove(r)})}clearAll(){f(this,D).clear()}};Ne=new WeakMap,D=new WeakMap;var et,si=class extends we{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,et);this.cache=new _t({emitter:s}),E(this,et,t)}list(){return g(this,arguments,function*(s={}){var n=s,{limit:t=10}=n,r=jr(n,["limit"]);return this.callWithSession(()=>g(this,null,function*(){let o=b({limit:t},r);try{let a=f(this,et)?this.cache.getAll(o):void 0;if(this._emitter.emit("notifications.list.pending",{args:o,data:a}),!a){let c=yield this._inboxService.fetchNotifications(b({limit:t},r));a={hasMore:c.hasMore,filter:c.filter,notifications:c.data.map(u=>new H(u,this._emitter,this._inboxService))},f(this,et)&&(this.cache.set(o,a),a=this.cache.getAll(o))}return this._emitter.emit("notifications.list.resolved",{args:o,data:a}),{data:a}}catch(a){return this._emitter.emit("notifications.list.resolved",{args:o,error:a}),{error:new L("Failed to fetch notifications",a)}}}))})}count(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){let r=t&&"filters"in t?t.filters:[b({},t)];try{this._emitter.emit("notifications.count.pending",{args:t});let s=yield this._inboxService.count({filters:r}),n=t&&"filters"in t?{counts:s.data}:s.data[0];return this._emitter.emit("notifications.count.resolved",{args:t,data:n}),{data:n}}catch(s){return this._emitter.emit("notifications.count.resolved",{args:t,error:s}),{error:new L("Failed to count notifications",s)}}}))})}read(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ei({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unread(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ti({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}archive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ii({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unarchive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ri({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}completePrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Ye({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}completeSecondary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Ye({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}revertPrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Je({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}revertSecondary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Je({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}readAll(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Gr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAll(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return zr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAllRead(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Kr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}clearCache({filter:t}={}){return t?this.cache.clear(t!=null?t:{}):this.cache.clearAll()}};et=new WeakMap;var Le,Et,Ae,ni=class{constructor(e,t,r){_(this,Le);_(this,Et);_(this,Ae);E(this,Le,r),E(this,Et,t),E(this,Ae,e)}initialize(){return g(this,null,function*(){try{let{applicationIdentifier:e,subscriberId:t,subscriberHash:r}=f(this,Ae);f(this,Le).emit("session.initialize.pending",{args:f(this,Ae)});let s=yield f(this,Et).initializeSession({applicationIdentifier:e,subscriberId:t,subscriberHash:r});f(this,Le).emit("session.initialize.resolved",{args:f(this,Ae),data:s})}catch(e){f(this,Le).emit("session.initialize.resolved",{args:f(this,Ae),error:e})}})}};Le=new WeakMap,Et=new WeakMap,Ae=new WeakMap;var bt,Ct,Be=class{constructor(e,{emitterInstance:t,inboxServiceInstance:r}){_(this,bt);_(this,Ct);E(this,bt,t),E(this,Ct,r),this.level=e.level,this.enabled=e.enabled,this.channels=e.channels,this.workflow=e.workflow}update({channelPreferences:e}){var t;return oi({emitter:f(this,bt),apiService:f(this,Ct),args:{workflowId:(t=this.workflow)==null?void 0:t.id,channelPreferences:e,preference:{level:this.level,enabled:this.enabled,channels:this.channels,workflow:this.workflow}}})}};bt=new WeakMap,Ct=new WeakMap;var oi=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{workflowId:s,channelPreferences:n}=t;try{i.emit("preference.update.pending",{args:t,data:t.preference?new Be(I(b({},t.preference),{channels:b(b({},t.preference.channels),n)}),{emitterInstance:i,inboxServiceInstance:e}):void 0});let o;s?o=yield e.updateWorkflowPreferences({workflowId:s,channelPreferences:n}):o=yield e.updateGlobalPreferences(n);let a=new Be(o,{emitterInstance:i,inboxServiceInstance:e});return i.emit("preference.update.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("preference.update.resolved",{args:t,error:o}),{error:new L("Failed to fetch notifications",o)}}});var xo=["preference.update.pending","preference.update.resolved"],Xr="default",tt,ce,ai=class{constructor({emitterInstance:e}){_(this,tt);_(this,ce);this.updatePreference=(e,t)=>{let r=f(this,ce).get(e);if(!r)return!1;let s=r.findIndex(o=>{var a,c;return((a=o.workflow)==null?void 0:a.id)===((c=t.workflow)==null?void 0:c.id)||o.level===t.level&&t.level==="global"});if(s===-1)return!1;let n=[...r];return n[s]=t,f(this,ce).set(e,n),!0};this.handlePreferenceEvent=({data:e})=>{e&&f(this,ce).keys().forEach(t=>{let r=this.updatePreference(t,e),s=f(this,ce).get(t);!r||!s||f(this,tt).emit("preferences.list.updated",{data:s})})};E(this,tt,e),xo.forEach(t=>{f(this,tt).on(t,this.handlePreferenceEvent)}),E(this,ce,new Qe)}set(e){f(this,ce).set(Xr,e)}getAll(){return f(this,ce).get(Xr)}clearAll(){f(this,ce).clear()}};tt=new WeakMap,ce=new WeakMap;var it,ci=class extends we{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,it);this.cache=new ai({emitterInstance:this._emitter}),E(this,it,t)}list(){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){try{let t=f(this,it)?this.cache.getAll():void 0;return this._emitter.emit("preferences.list.pending",{args:void 0,data:t}),t||(t=(yield this._inboxService.fetchPreferences()).map(s=>new Be(s,{emitterInstance:this._emitter,inboxServiceInstance:this._inboxService})),f(this,it)&&this.cache.set(t)),this._emitter.emit("preferences.list.resolved",{args:void 0,data:t}),{data:t}}catch(t){throw this._emitter.emit("preferences.list.resolved",{args:void 0,error:t}),t}}))})}update(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return oi({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}};it=new WeakMap;var le=Object.create(null);le.open="0";le.close="1";le.ping="2";le.pong="3";le.message="4";le.upgrade="5";le.noop="6";var xt=Object.create(null);Object.keys(le).forEach(i=>{xt[le[i]]=i});var St={type:"error",data:"parser error"};var wt=({type:i,data:e},t,r)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?r(t?e:"b"+Qr(e,!0).toString("base64")):r(le[i]+(e||"")),Qr=(i,e)=>Buffer.isBuffer(i)||i instanceof Uint8Array&&!e?i:i instanceof ArrayBuffer?Buffer.from(i):Buffer.from(i.buffer,i.byteOffset,i.byteLength),zi;function Zr(i,e){if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return e(Qr(i.data,!1));wt(i,!0,t=>{zi||(zi=new TextEncoder),e(zi.encode(t))})}var Nt=(i,e)=>{if(typeof i!="string")return{type:"message",data:es(i,e)};let t=i.charAt(0);if(t==="b"){let r=Buffer.from(i.substring(1),"base64");return{type:"message",data:es(r,e)}}return xt[t]?i.length>1?{type:xt[t],data:i.substring(1)}:{type:xt[t]}:St},es=(i,e)=>{switch(e){case"arraybuffer":return i instanceof ArrayBuffer?i:Buffer.isBuffer(i)?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer;case"nodebuffer":default:return Buffer.isBuffer(i)?i:Buffer.from(i)}};var ts="",is=(i,e)=>{let t=i.length,r=new Array(t),s=0;i.forEach((n,o)=>{wt(n,!1,a=>{r[o]=a,++s===t&&e(r.join(ts))})})},rs=(i,e)=>{let t=i.split(ts),r=[];for(let s=0;s<t.length;s++){let n=Nt(t[s],e);if(r.push(n),n.type==="error")break}return r};function ss(){return new TransformStream({transform(i,e){Zr(i,t=>{let r=t.length,s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,r)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(r))}i.data&&typeof i.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}var Ki;function li(i){return i.reduce((e,t)=>e+t.length,0)}function fi(i,e){if(i[0].length===e)return i.shift();let t=new Uint8Array(e),r=0;for(let s=0;s<e;s++)t[s]=i[0][r++],r===i[0].length&&(i.shift(),r=0);return i.length&&r<i[0].length&&(i[0]=i[0].slice(r)),t}function ns(i,e){Ki||(Ki=new TextDecoder);let t=[],r=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(r===0){if(li(t)<1)break;let c=fi(t,1);n=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(li(t)<2)break;let c=fi(t,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(li(t)<8)break;let c=fi(t,8),u=new DataView(c.buffer,c.byteOffset,c.length),l=u.getUint32(0);if(l>Math.pow(2,21)-1){a.enqueue(St);break}s=l*Math.pow(2,32)+u.getUint32(4),r=3}else{if(li(t)<s)break;let c=fi(t,s);a.enqueue(Nt(n?c:Ki.decode(c),e)),r=0}if(s===0||s>i){a.enqueue(St);break}}}})}var Yi=4;function O(i){if(i)return So(i)}function So(i){for(var e in O.prototype)i[e]=O.prototype[e];return i}O.prototype.on=O.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this};O.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this};O.prototype.off=O.prototype.removeListener=O.prototype.removeAllListeners=O.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+i],this};O.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this};O.prototype.emitReserved=O.prototype.emit;O.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};O.prototype.hasListeners=function(i){return!!this.listeners(i).length};var fe=global;function hi(i,...e){return e.reduce((t,r)=>(i.hasOwnProperty(r)&&(t[r]=i[r]),t),{})}var wo=fe.setTimeout,No=fe.clearTimeout;function ve(i,e){e.useNativeTimers?(i.setTimeoutFn=wo.bind(fe),i.clearTimeoutFn=No.bind(fe)):(i.setTimeoutFn=fe.setTimeout.bind(fe),i.clearTimeoutFn=fe.clearTimeout.bind(fe))}var Ao=1.33;function os(i){return typeof i=="string"?Ro(i):Math.ceil((i.byteLength||i.size)*Ao)}function Ro(i){let e=0,t=0;for(let r=0,s=i.length;r<s;r++)e=i.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}var vs=K(De(),1);function gs(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function ys(i){let e={},t=i.split("&");for(let r=0,s=t.length;r<s;r++){let n=t[r].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var Zo=(0,vs.default)("engine.io-client:transport"),tr=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},_e=class extends O{constructor(e){super(),this.writable=!1,ve(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new tr(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):Zo("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=Nt(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=gs(e);return t.length?"?"+t:""}};var Rs=K(De(),1);var Cs="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),ir=64,ea={},_s=0,yi=0,Es;function bs(i){let e="";do e=Cs[i%ir]+e,i=Math.floor(i/ir);while(i>0);return e}function vi(){let i=bs(+new Date);return i!==Es?(_s=0,Es=i):i+"."+bs(_s++)}for(;yi<ir;yi++)ea[Cs[yi]]=yi;var nr=K(ws(),1),or=nr.default||nr;function Ns(){return new sr}function ia(i){let e=i.split("; "),t=e[0].indexOf("=");if(t===-1)return;let r=e[0].substring(0,t).trim();if(!r.length)return;let s=e[0].substring(t+1).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));let n={name:r,value:s};for(let o=1;o<e.length;o++){let a=e[o].split("=");if(a.length!==2)continue;let c=a[0].trim(),u=a[1].trim();switch(c){case"Expires":n.expires=new Date(u);break;case"Max-Age":let l=new Date;l.setUTCSeconds(l.getUTCSeconds()+parseInt(u,10)),n.expires=l;break;default:}}return n}var sr=class{constructor(){this.cookies=new Map}parseCookies(e){let t=e.getResponseHeader("set-cookie");t&&t.forEach(r=>{let s=ia(r);s&&this.cookies.set(s.name,s)})}addCookies(e){let t=[];this.cookies.forEach((r,s)=>{var n;((n=r.expires)===null||n===void 0?void 0:n.getTime())<Date.now()?this.cookies.delete(s):t.push(`${s}=${r.value}`)}),t.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",t.join("; ")))}};var X=(0,Rs.default)("engine.io-client:polling");function ra(){}var sa=function(){return new or({xdomain:!1}).responseType!=null}(),_i=class extends _e{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){let r=location.protocol==="https:",s=location.port;s||(s=r?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||s!==e.port}let t=e&&e.forceBase64;this.supportsBinary=sa&&!t,this.opts.withCredentials&&(this.cookieJar=Ns())}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{X("paused"),this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(X("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){X("pre-pause polling complete"),--r||t()})),this.writable||(X("we are currently writing - waiting to pause"),r++,this.once("drain",function(){X("pre-pause writing complete"),--r||t()}))}else t()}poll(){X("polling"),this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){X("polling got data %s",e);let t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};rs(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this.poll():X('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{X("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(X("transport open - closing"),e()):(X("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,is(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=vi()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Re(this.uri(),e)}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){X("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}},Re=class i extends O{constructor(e,t){super(),ve(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;let t=hi(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let r=this.xhr=new or(t);try{X("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this.opts.extraHeaders[s])}}catch(s){}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{r.setRequestHeader("Accept","*/*")}catch(s){}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this.opts.cookieJar)===null||s===void 0||s.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},X("xhr data %s",this.data),r.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document!="undefined"&&(this.index=i.requestsCount++,i.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.xhr.onreadystatechange=ra,e)try{this.xhr.abort()}catch(t){}typeof document!="undefined"&&delete i.requests[this.index],this.xhr=null}}onLoad(){let e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Re.requestsCount=0;Re.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",As);else if(typeof addEventListener=="function"){let i="onpagehide"in fe?"pagehide":"unload";addEventListener(i,As,!1)}}function As(){for(let i in Re.requests)Re.requests.hasOwnProperty(i)&&Re.requests[i].abort()}var pc=K(Is(),1),mc=K(mr(),1),gc=K(yr(),1),Tn=K(Sr(),1),yc=K(On(),1);var In=Tn.default;var Dt=In,ki=!1,Pn="nodebuffer",We=process.nextTick;var Ln=K(De(),1);var vc=(0,Ln.default)("engine.io-client:websocket"),Fn=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Oi=class extends _e{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,r=Fn?{}:hi(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=ki&&!Fn?t?new Dt(e,t):new Dt(e):new Dt(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;wt(r,this.supportsBinary,n=>{let o={};ki||(r.options&&(o.compress=r.options.compress),this.opts.perMessageDeflate&&(typeof n=="string"?Buffer.byteLength(n):n.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{ki?this.ws.send(n):this.ws.send(n,o)}catch(a){vc("websocket closed before onclose event")}s&&We(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=vi()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Dt}};var Bn=K(De(),1),Mt=(0,Bn.default)("engine.io-client:webtransport"),Ti=class extends _e{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{Mt("transport closed gracefully"),this.onClose()}).catch(e=>{Mt("transport closed due to %s",e),this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{let t=ns(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=ss();s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();let n=()=>{r.read().then(({done:a,value:c})=>{if(a){Mt("session is closed");return}Mt("received chunk: %o",c),this.onPacket(c),n()}).catch(a=>{Mt("an error occurred while reading: %s",a)})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;this.writer.write(r).then(()=>{s&&We(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}};var Nr={websocket:Oi,webtransport:Ti,polling:_i};var _c=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Ec=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ft(i){let e=i,t=i.indexOf("["),r=i.indexOf("]");t!=-1&&r!=-1&&(i=i.substring(0,t)+i.substring(t,r).replace(/:/g,";")+i.substring(r,i.length));let s=_c.exec(i||""),n={},o=14;for(;o--;)n[Ec[o]]=s[o]||"";return t!=-1&&r!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=bc(n,n.path),n.queryKey=Cc(n,n.query),n}function bc(i,e){let t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Cc(i,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,n){s&&(t[s]=n)}),t}var Un=K(De(),1);var T=(0,Un.default)("engine.io-client:socket"),Ve=class i extends O{constructor(e,t={}){super(),this.binaryType=Pn,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=ft(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ft(t.host).host),ve(this,t),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ys(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){T('creating transport "%s"',e);let t=Object.assign({},this.opts.query);t.EIO=Yi,t.transport=e,this.id&&(t.sid=this.id);let r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return T("options: %j",r),new Nr[e](r)}open(){let e;if(this.opts.rememberUpgrade&&i.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(t){T("error while creating transport: %s",t),this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){T("setting transport %s",e.name),this.transport&&(T("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){T('probing transport "%s"',e);let t=this.createTransport(e),r=!1;i.priorWebsocketSuccess=!1;let s=()=>{r||(T('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(T('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;i.priorWebsocketSuccess=t.name==="websocket",T('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{r||this.readyState!=="closed"&&(T("changing transport and sending upgrade packet"),l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{T('probe transport "%s" failed',e);let d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function n(){r||(r=!0,l(),t.close(),t=null)}let o=h=>{let d=new Error("probe error: "+h);d.transport=t.name,n(),T('probe transport "%s" failed because of error: %s',e,h),this.emitReserved("upgradeError",d)};function a(){o("transport closed")}function c(){o("socket closed")}function u(h){t&&h.name!==t.name&&(T('"%s" works - aborting "%s"',h.name,t.name),n())}let l=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",u)};t.once("open",s),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onOpen(){if(T("socket open"),this.readyState="open",i.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){T("starting upgrade probes");let e=0,t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(T('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":let t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else T('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this.getWritablePackets();T("flushing %d packets in socket",e.length),this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){let s=this.writeBuffer[r].data;if(s&&(t+=os(s)),r>0&&t>this.maxPayload)return T("only send %d out of %d packets",r,this.writeBuffer.length),this.writeBuffer.slice(0,r);t+=2}return T("payload size is %d (max: %d)",t,this.maxPayload),this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let n={type:e,data:t,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),s&&this.once("flush",s),this.flush()}close(){let e=()=>{this.onClose("forced close"),T("socket closing - telling transport to close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){T("socket error %j",e),i.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(T('socket close with reason: "%s"',e),this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],r=0,s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}};Ve.protocol=Yi;var Lh=Ve.protocol;var Gn=K(qt(),1),Hn=(0,Gn.default)("socket.io-client:url");function zn(i,e="",t){let r=i;t=t||typeof location!="undefined"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(Hn("protocol-less url %s",i),typeof t!="undefined"?i=t.protocol+"//"+i:i="https://"+i),Hn("parse %s",i),r=ft(i)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let n=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+n+":"+r.port+e,r.href=r.protocol+"://"+n+(t&&t.port===r.port?"":":"+r.port),r}var Ur={};vo(Ur,{Decoder:()=>Lr,Encoder:()=>Fr,PacketType:()=>C,protocol:()=>Zn});var qc=typeof ArrayBuffer=="function",$c=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Kn=Object.prototype.toString,Wc=typeof Blob=="function"||typeof Blob!="undefined"&&Kn.call(Blob)==="[object BlobConstructor]",Vc=typeof File=="function"||typeof File!="undefined"&&Kn.call(File)==="[object FileConstructor]";function Wt(i){return qc&&(i instanceof ArrayBuffer||$c(i))||Wc&&i instanceof Blob||Vc&&i instanceof File}function $t(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,r=i.length;t<r;t++)if($t(i[t]))return!0;return!1}if(Wt(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return $t(i.toJSON(),!0);for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&$t(i[t]))return!0;return!1}function Yn(i){let e=[],t=i.data,r=i;return r.data=Tr(t,e),r.attachments=e.length,{packet:r,buffers:e}}function Tr(i,e){if(!i)return i;if(Wt(i)){let t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){let t=new Array(i.length);for(let r=0;r<i.length;r++)t[r]=Tr(i[r],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){let t={};for(let r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=Tr(i[r],e));return t}return i}function Jn(i,e){return i.data=Ir(i.data,e),delete i.attachments,i}function Ir(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=Ir(i[t],e);else if(typeof i=="object")for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Ir(i[t],e));return i}var Qn=K(De(),1),Pr=(0,Qn.default)("socket.io-parser"),jc=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Zn=5,C;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(C||(C={}));var Fr=class{constructor(e){this.replacer=e}encode(e){return Pr("encoding packet %j",e),(e.type===C.EVENT||e.type===C.ACK)&&$t(e)?this.encodeAsBinary({type:e.type===C.EVENT?C.BINARY_EVENT:C.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===C.BINARY_EVENT||e.type===C.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),Pr("encoded %j as %s",e,t),t}encodeAsBinary(e){let t=Yn(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}};function Xn(i){return Object.prototype.toString.call(i)==="[object Object]"}var Lr=class i extends O{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let r=t.type===C.BINARY_EVENT;r||t.type===C.BINARY_ACK?(t.type=r?C.EVENT:C.ACK,this.reconstructor=new Br(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Wt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,r={type:Number(e.charAt(0))};if(C[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===C.BINARY_EVENT||r.type===C.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(n,t)}else r.nsp="/";let s=e.charAt(t+1);if(s!==""&&Number(s)==s){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(i.isPayloadValid(r.type,n))r.data=n;else throw new Error("invalid payload")}return Pr("decoded %s as %j",e,r),r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case C.CONNECT:return Xn(t);case C.DISCONNECT:return t===void 0;case C.CONNECT_ERROR:return typeof t=="string"||Xn(t);case C.EVENT:case C.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&jc.indexOf(t[0])===-1);case C.ACK:case C.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Br=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Jn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function te(i,e,t){return i.on(e,t),function(){i.off(e,t)}}var eo=K(qt(),1),U=(0,eo.default)("socket.io-client:socket"),Hc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ht=class extends O{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[te(e,"open",this.onopen.bind(this)),te(e,"packet",this.onpacket.bind(this)),te(e,"error",this.onerror.bind(this)),te(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Hc.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let r={type:C.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let o=this.ids++;U("emitting packet with ack id %d",o);let a=t.pop();this._registerAckCallback(o,a),r.id=o}let s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)?U("discard packet as the transport is not currently writable"):this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r),this.flags={},this}_registerAckCallback(e,t){var r;let s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(U("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));U("event with ack id %d has timed out after %d ms",e,s),t.call(this,new Error("operation has timed out"))},s);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,[null,...o])}}emitWithAck(e,...t){let r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((s,n)=>{t.push((o,a)=>r?o?n(o):s(a):s(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...n)=>r!==this._queue[0]?void 0:(s!==null?r.tryCount>this._opts.retries&&(U("packet [%d] is discarded after %d tries",r.id,r.tryCount),this._queue.shift(),t&&t(s)):(U("packet [%d] was successfully sent",r.id),this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(U("draining queue"),!this.connected||this._queue.length===0)return;let t=this._queue[0];if(t.pending&&!e){U("packet [%d] has already been sent and is waiting for an ack",t.id);return}t.pending=!0,t.tryCount++,U("sending packet [%d] (try n\xB0%d)",t.id,t.tryCount),this.flags=t.flags,this.emit.apply(this,t.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){U("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:C.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){U("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case C.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case C.EVENT:case C.BINARY_EVENT:this.onevent(e);break;case C.ACK:case C.BINARY_ACK:this.onack(e);break;case C.DISCONNECT:this.ondisconnect();break;case C.CONNECT_ERROR:this.destroy();let r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){let t=e.data||[];U("emitting event %j",t),e.id!=null&&(U("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,r=!1;return function(...s){r||(r=!0,U("sending ack %j",s),t.packet({type:C.ACK,id:e,data:s}))}}onack(e){let t=this.acks[e.id];typeof t=="function"?(U("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):U("bad ack %s",e.id)}onconnect(e,t){U("socket connected with id %s",e),this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){U("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(U("performing disconnect (%s)",this.nsp),this.packet({type:C.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let r of t)r.apply(this,e.data)}}};function je(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}je.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=Math.floor(e*10)&1?i+t:i-t}return Math.min(i,this.max)|0};je.prototype.reset=function(){this.attempts=0};je.prototype.setMin=function(i){this.ms=i};je.prototype.setMax=function(i){this.max=i};je.prototype.setJitter=function(i){this.jitter=i};var to=K(qt(),1),G=(0,to.default)("socket.io-client:manager"),ut=class extends O{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,ve(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new je({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let s=t.parser||Ur;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(G("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;G("opening %s",this.uri),this.engine=new Ve(this.uri,this.opts);let t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let s=te(t,"open",function(){r.onopen(),e&&e()}),n=a=>{G("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=te(t,"error",n);if(this._timeout!==!1){let a=this._timeout;G("connect attempt will timeout after %d",a);let c=this.setTimeoutFn(()=>{G("connect attempt timed out after %d",a),s(),n(new Error("timeout")),t.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){G("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(te(e,"ping",this.onping.bind(this)),te(e,"data",this.ondata.bind(this)),te(e,"error",this.onerror.bind(this)),te(e,"close",this.onclose.bind(this)),te(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){We(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){G("error",e),this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new ht(this,e,t),this.nsps[e]=r),r}_destroy(e){let t=Object.keys(this.nsps);for(let r of t)if(this.nsps[r].active){G("socket %s is still active, skipping close",r);return}this._close()}_packet(e){G("writing packet %j",e);let t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){G("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){G("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){G("closed due to %s",e),this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)G("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();G("will wait %dms before reconnect attempt",t),this._reconnecting=!0;let r=this.setTimeoutFn(()=>{e.skipReconnect||(G("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(G("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):(G("reconnect success"),e.onreconnect())}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var ro=K(qt(),1),io=(0,ro.default)("socket.io-client"),Vt={};function jt(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};let t=zn(i,e.path||"/socket.io"),r=t.source,s=t.id,n=t.path,o=Vt[s]&&n in Vt[s].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o,c;return a?(io("ignoring socket cache for %s",r),c=new ut(r,e)):(Vt[s]||(io("new io instance for %s",r),Vt[s]=new ut(r,e)),c=Vt[s]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(jt,{Manager:ut,Socket:ht,io:jt,connect:jt});var Gc="https://ws.novu.co",so="notifications.notification_received",no="notifications.unseen_count_changed",oo="notifications.unread_count_changed",zc=({_id:i,content:e,read:t,archived:r,createdAt:s,lastReadDate:n,archivedAt:o,channel:a,subscriber:c,subject:u,avatar:l,cta:h,tags:d,data:x})=>{var m,y,V,R,j,z,pe,Kt,Yt,ie;let w={id:(m=c==null?void 0:c._id)!=null?m:"",firstName:c==null?void 0:c.firstName,lastName:c==null?void 0:c.lastName,avatar:c==null?void 0:c.avatar,subscriberId:(y=c==null?void 0:c.subscriberId)!=null?y:""},p=(R=(V=h.action)==null?void 0:V.buttons)==null?void 0:R.find(Ge=>Ge.type==="primary"),v=(z=(j=h.action)==null?void 0:j.buttons)==null?void 0:z.find(Ge=>Ge.type==="secondary"),N=(Kt=(pe=h.action)==null?void 0:pe.result)==null?void 0:Kt.type,A=(Yt=h.action)==null?void 0:Yt.status;return{id:i,subject:u,body:e,to:w,isRead:t,isArchived:r,createdAt:s,readAt:n,archivedAt:o,avatar:l,primaryAction:p&&{label:p.content,isCompleted:N==="primary"&&A==="done",redirect:p.url?{target:p.target,url:p.url}:void 0},secondaryAction:v&&{label:v.content,isCompleted:N==="secondary"&&A==="done",redirect:v.url?{target:v.target,url:v.url}:void 0},channelType:a,tags:d,redirect:(ie=h.data)!=null&&ie.url?{url:h.data.url,target:h.data.target}:void 0,data:x}},dt,ue,ge,pt,Bi,Ui,Di,Ht,Dr,Li=class extends we{constructor({socketUrl:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,Ht);_(this,dt);_(this,ue);_(this,ge);_(this,pt);_(this,Bi,({message:t})=>{f(this,ue).emit(so,{result:new H(zc(t),f(this,ue),this._inboxService)})});_(this,Ui,({unseenCount:t})=>{f(this,ue).emit(no,{result:t})});_(this,Di,({unreadCount:t})=>{f(this,ue).emit(oo,{result:t})});E(this,ue,s),E(this,pt,t!=null?t:Gc)}onSessionSuccess({token:t}){E(this,dt,t)}isSocketEvent(t){return t===so||t===no||t===oo}initialize(){if(f(this,dt)){Vi(this,Ht,Dr).call(this).catch(t=>{console.error(t)});return}this.callWithSession(()=>g(this,null,function*(){return Vi(this,Ht,Dr).call(this).catch(t=>{console.error(t)}),{}}))}};dt=new WeakMap,ue=new WeakMap,ge=new WeakMap,pt=new WeakMap,Bi=new WeakMap,Ui=new WeakMap,Di=new WeakMap,Ht=new WeakSet,Dr=function(){return g(this,null,function*(){var r,s,n;if(f(this,ge))return;let t={socketUrl:f(this,pt)};f(this,ue).emit("socket.connect.pending",{args:t}),E(this,ge,jt(f(this,pt),{reconnectionDelayMax:1e4,transports:["websocket"],query:{token:`${f(this,dt)}`}})),f(this,ge).on("connect",()=>{f(this,ue).emit("socket.connect.resolved",{args:t})}),f(this,ge).on("connect_error",o=>{f(this,ue).emit("socket.connect.resolved",{args:t,error:o})}),(r=f(this,ge))==null||r.on("notification_received",f(this,Bi)),(s=f(this,ge))==null||s.on("unseen_count_changed",f(this,Ui)),(n=f(this,ge))==null||n.on("unread_count_changed",f(this,Di))})};var ao="https://api.novu.co";var He=function(i,e,t,r){function s(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function a(l){try{u(r.next(l))}catch(h){o(h)}}function c(l){try{u(r.throw(l))}catch(h){o(h)}}function u(l){l.done?n(l.value):s(l.value).then(a,c)}u((r=r.apply(i,e||[])).next())})},Kc="v1",Yc="https://api.novu.co",Jc="@novu/client",Xc="2.0.0-canary.0",Qc=`${Jc}-${Xc}`,mt=class{constructor({apiVersion:e=Kc,backendUrl:t=Yc,userAgent:r=Qc}={}){this.apiVersion=e,this.backendUrl=`${t}/${this.apiVersion}`,this.headers={"Content-Type":"application/json","User-Agent":r}}setAuthorizationToken(e){this.headers.Authorization=`Bearer ${e}`}disposeAuthorizationToken(){delete this.headers.Authorization}updateHeaders(e){this.headers=Object.assign(Object.assign({},this.headers),e)}getFullResponse(e,t){return He(this,void 0,void 0,function*(){return yield(yield this.doFetch(e+this.getQueryString(t))).json()})}get(e,t){return He(this,void 0,void 0,function*(){return(yield(yield this.doFetch(e+this.getQueryString(t))).json()).data})}post(e,t={}){return He(this,void 0,void 0,function*(){return(yield(yield this.doFetch(e,{method:"POST",body:JSON.stringify(t)})).json()).data})}patch(e,t={}){return He(this,void 0,void 0,function*(){return(yield(yield this.doFetch(e,{method:"PATCH",body:JSON.stringify(t)})).json()).data})}delete(e,t={}){return He(this,void 0,void 0,function*(){return(yield(yield this.doFetch(e,{method:"DELETE",body:JSON.stringify(t)})).json()).data})}getQueryString(e){return e?`?${new URLSearchParams(e).toString()}`:""}doFetch(e,t={}){return He(this,void 0,void 0,function*(){let r=yield fetch(this.backendUrl+e,Object.assign(Object.assign({},t),{headers:this.headers}));return yield this.checkResponseStatus(r),r})}checkResponseStatus(e){return He(this,void 0,void 0,function*(){if(!e.ok){let t=yield e.json();throw new Error(`HTTP error! Status: ${e.status}, Message: ${t.message}`)}})}};var Zc="2024-06-26",Gt="/inbox",de=`${Gt}/notifications`,F,Mi=class{constructor(e={}){this.isSessionInitialized=!1;_(this,F);E(this,F,new mt(e)),f(this,F).updateHeaders({"Novu-API-Version":Zc})}initializeSession(s){return g(this,arguments,function*({applicationIdentifier:e,subscriberId:t,subscriberHash:r}){let n=yield f(this,F).post(`${Gt}/session`,{applicationIdentifier:e,subscriberId:t,subscriberHash:r});return f(this,F).setAuthorizationToken(n.token),this.isSessionInitialized=!0,n})}fetchNotifications({after:e,archived:t,limit:r=10,offset:s,read:n,tags:o}){let a=new URLSearchParams(`limit=${r}`);return e&&a.append("after",e),s&&a.append("offset",`${s}`),o&&o.forEach(c=>a.append("tags[]",c)),n!==void 0&&a.append("read",`${n}`),t!==void 0&&a.append("archived",`${t}`),f(this,F).getFullResponse(`${de}?${a.toString()}`)}count({filters:e}){return f(this,F).getFullResponse(`${de}/count?filters=${JSON.stringify(e)}`)}read(e){return f(this,F).patch(`${de}/${e}/read`)}unread(e){return f(this,F).patch(`${de}/${e}/unread`)}archive(e){return f(this,F).patch(`${de}/${e}/archive`)}unarchive(e){return f(this,F).patch(`${de}/${e}/unarchive`)}readAll({tags:e}){return f(this,F).post(`${de}/read`,{tags:e})}archiveAll({tags:e}){return f(this,F).post(`${de}/archive`,{tags:e})}archiveAllRead({tags:e}){return f(this,F).post(`${de}/read-archive`,{tags:e})}completeAction({actionType:e,notificationId:t}){return f(this,F).patch(`${de}/${t}/complete`,{actionType:e})}revertAction({actionType:e,notificationId:t}){return f(this,F).patch(`${de}/${t}/revert`,{actionType:e})}fetchPreferences(){return f(this,F).get(`${Gt}/preferences`)}updateGlobalPreferences(e){return f(this,F).patch(`${Gt}/preferences`,e)}updateWorkflowPreferences({workflowId:e,channelPreferences:t}){return f(this,F).patch(`${Gt}/preferences/${e}`,t)}};F=new WeakMap;var ye,zt,gt,Pe,qi=class{constructor(e){_(this,ye);_(this,zt);_(this,gt);_(this,Pe);var t,r,s;E(this,Pe,new Mi({backendUrl:(t=e.backendUrl)!=null?t:ao})),E(this,ye,new Zt),E(this,zt,new ni({applicationIdentifier:e.applicationIdentifier,subscriberId:e.subscriberId,subscriberHash:e.subscriberHash},f(this,Pe),f(this,ye))),f(this,zt).initialize(),this.notifications=new si({useCache:(r=e.useCache)!=null?r:!0,inboxServiceInstance:f(this,Pe),eventEmitterInstance:f(this,ye)}),this.preferences=new ci({useCache:(s=e.useCache)!=null?s:!0,inboxServiceInstance:f(this,Pe),eventEmitterInstance:f(this,ye)}),E(this,gt,new Li({socketUrl:e.socketUrl,eventEmitterInstance:f(this,ye),inboxServiceInstance:f(this,Pe)})),this.on=(n,o)=>{f(this,gt).isSocketEvent(n)&&f(this,gt).initialize(),f(this,ye).on(n,o)},this.off=(n,o)=>{f(this,ye).off(n,o)}}};ye=new WeakMap,zt=new WeakMap,gt=new WeakMap,Pe=new WeakMap;window.Novu=qi;})();
|
|
17
17
|
/*! Bundled license information:
|
|
18
18
|
|
|
19
19
|
xmlhttprequest-ssl/lib/XMLHttpRequest.js:
|