@allior/wmake-streamelements-events 3.1.0 → 3.1.2

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.
@@ -1,4 +1,6 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "../root-DJod-F4M.js";
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "../root-CowOS1ts.js";
2
+ import { testAlerts as f } from "../root/sources/alerts.js";
3
+ import { testMessages as p } from "../root/sources/messages.js";
2
4
  import { useEffect as m, useRef as h } from "react";
3
5
  //#region src/react/hooks/use-event-listener.ts
4
6
  function g(e, t, n = []) {
@@ -21,13 +23,13 @@ function k(e) {
21
23
  return e ? Array.isArray(e) ? { deps: e } : e : {};
22
24
  }
23
25
  function A(e, t, n) {
24
- let { classified: i, deps: a = [] } = n;
26
+ let { classified: r, deps: i = [] } = n;
25
27
  g("onEventReceived", (n) => {
26
- if (e(n.detail)) if (i) {
27
- let e = r(n.detail);
28
+ if (e(n.detail)) if (r) {
29
+ let e = d(n.detail);
28
30
  e && t(e);
29
31
  } else t(n);
30
- }, a);
32
+ }, i);
31
33
  }
32
34
  function j(e) {
33
35
  return (t, n) => A(e, t, k(n));
@@ -58,12 +60,12 @@ var N = j(y), P = N, F = j(w), I = j(T), L = j(O), R = j(b), z = j(S), B = j(C),
58
60
  classified: !0,
59
61
  deps: t
60
62
  });
61
- }, G = j(x), K = j(E), q = (e, t, r = []) => {
62
- M((r) => {
63
- n(r.detail, t, (t) => {
63
+ }, G = j(x), K = j(E), q = (e, t, n = []) => {
64
+ M((n) => {
65
+ a(n.detail, t, (t) => {
64
66
  t && e(t);
65
67
  });
66
- }, r);
68
+ }, n);
67
69
  };
68
70
  //#endregion
69
71
  //#region src/react/hooks/use-on-widget-load.ts
@@ -71,6 +73,6 @@ function J(e, t = []) {
71
73
  g("onWidgetLoad", e, t);
72
74
  }
73
75
  //#endregion
74
- export { f as AlertQueue, s as TwitchUserMessageData, u as UserRole, n as aggregateIncomingEvent, r as classifyEvent, l as getCacheKey, i as getTestAlertKey, e as getTestMessageKey, o as parseTier, c as testAlert, a as testAlerts, d as testMessage, t as testMessages, p as testOnWidgetLoadDetail, g as useEventListener, q as useOnAggregatedCommunityGift, z as useOnCheerReceived, K as useOnCommunityGiftPurchaseReceived, F as useOnDeleteMessage, I as useOnDeleteMessages, M as useOnEventReceived, R as useOnFollowerReceived, P as useOnMessageReceived, B as useOnRaidReceived, H as useOnSelfSubReceived, W as useOnSoloGiftReceived, U as useOnSubRenewalReceived, G as useOnSubscriberLatestReceived, V as useOnSubscriberReceived, N as useOnTwitchMessageReceived, L as useOnWidgetButtonReceived, J as useOnWidgetLoad };
76
+ export { u as AlertQueue, o as TwitchUserMessageData, c as UserRole, a as aggregateIncomingEvent, d as classifyEvent, n as getCacheKey, i as getTestAlertKey, e as getTestMessageKey, r as parseTier, s as testAlert, f as testAlerts, l as testMessage, p as testMessages, t as testOnWidgetLoadDetail, g as useEventListener, q as useOnAggregatedCommunityGift, z as useOnCheerReceived, K as useOnCommunityGiftPurchaseReceived, F as useOnDeleteMessage, I as useOnDeleteMessages, M as useOnEventReceived, R as useOnFollowerReceived, P as useOnMessageReceived, B as useOnRaidReceived, H as useOnSelfSubReceived, W as useOnSoloGiftReceived, U as useOnSubRenewalReceived, G as useOnSubscriberLatestReceived, V as useOnSubscriberReceived, N as useOnTwitchMessageReceived, L as useOnWidgetButtonReceived, J as useOnWidgetLoad };
75
77
 
76
78
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/react/hooks/use-event-listener.ts","../../src/root/guards/on-event-received.ts","../../src/react/hooks/factory.ts","../../src/react/hooks/use-on-event-received.ts","../../src/react/hooks/use-on-widget-load.ts"],"sourcesContent":["import { type DependencyList, useEffect, useRef } from \"react\";\nimport type {\n\tWindowEventKey,\n\tWindowEventListener,\n} from \"../types/window-events.js\";\n\nexport function useEventListener<K extends WindowEventKey>(\n\teventName: K,\n\thandler: WindowEventListener<K>,\n\tdeps: DependencyList = [],\n): void {\n\tconst callbackRef = useRef<WindowEventListener<K>>(handler);\n\tcallbackRef.current = handler;\n\n\tuseEffect(() => {\n\t\tconst fn = (ev: WindowEventMap[K]) => callbackRef.current.call(window, ev);\n\t\twindow.addEventListener(eventName, fn);\n\t\treturn () => window.removeEventListener(eventName, fn);\n\t}, [eventName, ...deps]);\n}\n","import type {\n\tCheerDetail,\n\tCommunityGiftPurchaseDetail,\n\tDeleteMessageDetail,\n\tDeleteMessagesDetail,\n\tFollowerDetail,\n\tMinimalEvent,\n\tRaidDetail,\n\tSubscriberDetail,\n\tSubscriberLatestDetail,\n\tTestButtonDetail,\n\tTwitchMessageDetail,\n} from \"@/root/types/on-event-received\";\n\nexport const isDetail = (d: unknown): d is MinimalEvent =>\n\ttypeof d === \"object\" && d !== null && \"listener\" in d;\n\nexport function createGuard<T extends MinimalEvent>(\n\tpredicate: (d: MinimalEvent) => boolean,\n) {\n\treturn (d: unknown): d is T => isDetail(d) && predicate(d);\n}\n\nexport const isTwitchMessageEvent = createGuard<TwitchMessageDetail>(\n\t(d) => d.listener === \"message\",\n);\nexport const isFollowerDetail = createGuard<FollowerDetail>(\n\t(d) => d.listener === \"follower-latest\",\n);\nexport const isSubscriberLatestDetail = createGuard<SubscriberLatestDetail>(\n\t(d) => d.listener === \"subscriber-latest\",\n);\nexport const isCheerDetail = createGuard<CheerDetail>(\n\t(d) => d.listener === \"cheer-latest\",\n);\nexport const isRaidDetail = createGuard<RaidDetail>(\n\t(d) => d.listener === \"raid-latest\",\n);\nexport const isDeleteMessageDetail = createGuard<DeleteMessageDetail>(\n\t(d) => d.listener === \"delete-message\",\n);\nexport const isDeleteMessagesDetail = createGuard<DeleteMessagesDetail>(\n\t(d) => d.listener === \"delete-messages\",\n);\nexport const isCommunityGiftPurchaseDetail =\n\tcreateGuard<CommunityGiftPurchaseDetail>(\n\t\t(d) => d.listener === \"event\" && d.event?.type === \"communityGiftPurchase\",\n\t);\nexport const isSubscriberDetail = createGuard<SubscriberDetail>(\n\t(d) => d.listener === \"event\" && d.event?.type === \"subscriber\",\n);\nexport const isWidgetButtonDetail = createGuard<TestButtonDetail>(\n\t(d) => d.listener === \"event:test\" && d.event?.listener === \"widget-button\",\n);\n","import type { DependencyList } from \"react\";\nimport { classifyEvent } from \"@/root/classifier\";\nimport type {\n\tClassifiedEvent,\n\tIncomingDetail,\n\tMinimalEvent,\n} from \"@/root/types/on-event-received\";\nimport { useEventListener } from \"./use-event-listener\";\n\n/**\n * Configuration options for StreamElements event hooks.\n */\nexport interface HookOptions<C extends boolean = boolean> {\n\t/**\n\t * If true, the hook will return a classified/normalized event object\n\t * instead of the raw StreamElements CustomEvent.\n\t *\n\t * Note: Only supported for alert-related hooks.\n\t */\n\tclassified?: C;\n\t/**\n\t * React dependency list to control hook re-subscription.\n\t */\n\tdeps?: DependencyList;\n}\n\nexport type HookHandler<T, C, R extends boolean> = (\n\tdata: R extends true ? C : CustomEvent<T>,\n) => void;\n\nexport function parseDepsOrOptions<C extends boolean>(\n\tdepsOrOptions?: DependencyList | HookOptions<C>,\n): HookOptions<C> {\n\tif (!depsOrOptions) return {} as HookOptions<C>;\n\tif (Array.isArray(depsOrOptions))\n\t\treturn { deps: depsOrOptions } as HookOptions<C>;\n\treturn depsOrOptions as HookOptions<C>;\n}\n\n/**\n * Base internal engine for event-guarded listeners.\n */\nexport function useOnEvent<\n\tT extends MinimalEvent,\n\tC = never,\n\tR extends boolean = boolean,\n>(\n\tguard: (d: unknown) => d is T,\n\thandler: HookHandler<T, C, R>,\n\toptions: HookOptions<R>,\n) {\n\tconst { classified, deps = [] } = options;\n\tuseEventListener(\n\t\t\"onEventReceived\",\n\t\t(ev) => {\n\t\t\tif (guard(ev.detail)) {\n\t\t\t\tif (classified) {\n\t\t\t\t\tconst data = classifyEvent(ev.detail as unknown as IncomingDetail);\n\t\t\t\t\tif (data) (handler as (d: C) => void)(data as C);\n\t\t\t\t} else {\n\t\t\t\t\t(handler as (d: CustomEvent<T>) => void)(ev as CustomEvent<T>);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tdeps,\n\t);\n}\n\n/**\n * Hook Factory to reduce boilerplate.\n * If C is not provided, classification mode is disabled for the hook.\n */\nexport function createEventHook<T extends MinimalEvent>(\n\tguard: (d: unknown) => d is T,\n): (\n\thandler: (ev: CustomEvent<T>) => void,\n\tdepsOrOptions?: DependencyList | HookOptions<false>,\n) => void;\n\nexport function createEventHook<T extends MinimalEvent, C>(\n\tguard: (d: unknown) => d is T,\n): <R extends boolean = false>(\n\thandler: HookHandler<T, C, R>,\n\tdepsOrOptions?: DependencyList | HookOptions<R>,\n) => void;\n\nexport function createEventHook(guard: (d: unknown) => d is MinimalEvent) {\n\treturn <R extends boolean>(\n\t\thandler: HookHandler<MinimalEvent, ClassifiedEvent, R>,\n\t\tdepsOrOptions?: DependencyList | HookOptions<R>,\n\t) => {\n\t\tconst options = parseDepsOrOptions(depsOrOptions);\n\t\treturn useOnEvent(guard, handler, options);\n\t};\n}\n","import type { DependencyList } from \"react\";\nimport { aggregateIncomingEvent, type AggregatorOptions } from \"@/root/aggregator\";\nimport {\n\tisCheerDetail,\n\tisCommunityGiftPurchaseDetail,\n\tisDeleteMessageDetail,\n\tisDeleteMessagesDetail,\n\tisFollowerDetail,\n\tisRaidDetail,\n\tisSubscriberDetail,\n\tisSubscriberLatestDetail,\n\tisTwitchMessageEvent,\n\tisWidgetButtonDetail,\n} from \"@/root/guards\";\nimport type {\n\tAggregatedCommunityGift,\n\tCheerDetail,\n\tClassifiedButtonClick,\n\tClassifiedCheer,\n\tClassifiedDeleteMessage,\n\tClassifiedDeleteMessages,\n\tClassifiedEvent,\n\tClassifiedFollower,\n\tClassifiedRaid,\n\tClassifiedSelfSub,\n\tClassifiedSoloSub,\n\tClassifiedSubRenewal,\n\tCommunityGiftPurchaseDetail,\n\tDeleteMessageDetail,\n\tDeleteMessagesDetail,\n\tFollowerDetail,\n\tIncomingDetail,\n\tRaidDetail,\n\tSubscriberDetail,\n\tSubscriberLatestDetail,\n\tTestButtonDetail,\n\tTwitchMessageDetail,\n} from \"@/root/types/on-event-received\";\nimport type { WindowEventListener } from \"../types/window-events\";\nimport { createEventHook } from \"./factory\";\nimport { useEventListener } from \"./use-event-listener\";\n\n/**\n * Low-level hook to subscribe to the generic 'onEventReceived' from StreamElements.\n *\n * @param handler Generic event listener for all StreamElements events.\n * @param deps React dependency list.\n */\nexport function useOnEventReceived(\n\thandler: WindowEventListener<\"onEventReceived\">,\n\tdeps: DependencyList = [],\n): void {\n\tuseEventListener(\"onEventReceived\", handler, deps);\n}\n\n/**\n * Listens for Twitch chat messages received.\n * Classification is not supported for this hook.\n */\nexport const useOnTwitchMessageReceived =\n\tcreateEventHook<TwitchMessageDetail>(isTwitchMessageEvent);\n\n/** Alias for useOnTwitchMessageReceived */\nexport const useOnMessageReceived = useOnTwitchMessageReceived;\n\n/**\n * Listens for single message deletion events in Twitch chat.\n * Calls on deleting certain user message.\n * Supports classification into ClassifiedDeleteMessage.\n */\nexport const useOnDeleteMessage = createEventHook<\n\tDeleteMessageDetail,\n\tClassifiedDeleteMessage\n>(isDeleteMessageDetail);\n\n/**\n * Listens for multiple message deletion (clear chat/timeout) events in Twitch chat.\n * Calls on user ban or timeout.\n * Supports classification into ClassifiedDeleteMessages.\n */\nexport const useOnDeleteMessages = createEventHook<\n\tDeleteMessagesDetail,\n\tClassifiedDeleteMessages\n>(isDeleteMessagesDetail);\n\n/**\n * Listens for Widget Button clicks configured in the StreamElements Overlay Editor.\n * Supports classification into ClassifiedButtonClick.\n */\nexport const useOnWidgetButtonReceived = createEventHook<\n\tTestButtonDetail,\n\tClassifiedButtonClick\n>(isWidgetButtonDetail);\n\n/**\n * Listens for new Follower events.\n * Supports classification into ClassifiedFollower.\n */\nexport const useOnFollowerReceived = createEventHook<\n\tFollowerDetail,\n\tClassifiedFollower\n>(isFollowerDetail);\n\n/**\n * Listens for Cheer (bits) events.\n * Supports classification into ClassifiedCheer.\n */\nexport const useOnCheerReceived = createEventHook<CheerDetail, ClassifiedCheer>(\n\tisCheerDetail,\n);\n\n/**\n * Listens for Raid events.\n * Supports classification into ClassifiedRaid.\n */\nexport const useOnRaidReceived = createEventHook<RaidDetail, ClassifiedRaid>(\n\tisRaidDetail,\n);\n\n/**\n * Listens for general Subscriber events.\n * Supports classification into ClassifiedEvent union.\n */\nexport const useOnSubscriberReceived = createEventHook<\n\tSubscriberDetail,\n\tClassifiedEvent\n>(isSubscriberDetail);\n\n/**\n * Listens for personal subscription events where a user subscribes for the first time.\n */\nexport const useOnSelfSubReceived = (\n\thandler: (event: ClassifiedSelfSub) => void,\n\tdeps: DependencyList = [],\n) => {\n\tuseOnSubscriberReceived(\n\t\t(sub) => {\n\t\t\tif (sub.type === \"self-sub\") handler(sub as ClassifiedSelfSub);\n\t\t},\n\t\t{ classified: true, deps },\n\t);\n};\n\n/**\n * Listens for subscription renewal events (resubs) with month count.\n */\nexport const useOnSubRenewalReceived = (\n\thandler: (event: ClassifiedSubRenewal) => void,\n\tdeps: DependencyList = [],\n) => {\n\tuseOnSubscriberReceived(\n\t\t(sub) => {\n\t\t\tif (sub.type === \"sub-renewal\") handler(sub as ClassifiedSubRenewal);\n\t\t},\n\t\t{ classified: true, deps },\n\t);\n};\n\n/**\n * Listens for solo gift subscription events (one user gifting to another specific user).\n */\nexport const useOnSoloGiftReceived = (\n\thandler: (event: ClassifiedSoloSub) => void,\n\tdeps: DependencyList = [],\n) => {\n\tuseOnSubscriberReceived(\n\t\t(sub) => {\n\t\t\tif (sub.type === \"solo-sub-to-someone\") handler(sub as ClassifiedSoloSub);\n\t\t},\n\t\t{ classified: true, deps },\n\t);\n};\n\n/**\n * Listens for the latest Subscriber status updates.\n * Supports classification into ClassifiedEvent union.\n */\nexport const useOnSubscriberLatestReceived = createEventHook<\n\tSubscriberLatestDetail,\n\tClassifiedEvent\n>(isSubscriberLatestDetail);\n\n/**\n * Listens for Community Gift Purchase (bulk gifts) events.\n */\nexport const useOnCommunityGiftPurchaseReceived = createEventHook<\n\tCommunityGiftPurchaseDetail,\n\tClassifiedEvent\n>(isCommunityGiftPurchaseDetail);\n\n/**\n * Specialized hook for handling aggregated mass-gift subscriptions.\n *\n * Normalizes Multiple subscriber events into a single sender event with a list of recipients.\n * Essential for \"Community Gift\" alerts to avoid spamming multiple notifications.\n *\n * @param handler Receives the aggregated community gift object.\n * @param options Aggregator options (broadcasterLogin, cache, etc).\n * @param deps React dependency list.\n */\nexport const useOnAggregatedCommunityGift = (\n\thandler: (event: AggregatedCommunityGift) => void,\n\toptions?: AggregatorOptions,\n\tdeps: DependencyList = [],\n) => {\n\tuseOnEventReceived((ev) => {\n\t\taggregateIncomingEvent(\n\t\t\tev.detail as unknown as IncomingDetail,\n\t\t\toptions,\n\t\t\t(normalized) => {\n\t\t\t\tif (normalized) handler(normalized as AggregatedCommunityGift);\n\t\t\t},\n\t\t);\n\t}, deps);\n};\n\nexport type { HookOptions } from \"./factory\";\n","import type { DependencyList } from \"react\";\nimport type { WindowEventListener } from \"@/react/types/window-events.js\";\nimport type { OnWidgetLoadEventDetails } from \"@/root/types/on-widget-load\";\nimport { useEventListener } from \"./use-event-listener.js\";\n\nexport function useOnWidgetLoad<FieldData = unknown>(\n\thandler: (ev: CustomEvent<OnWidgetLoadEventDetails<FieldData>>) => void,\n\tdeps: DependencyList = [],\n): void {\n\tuseEventListener(\n\t\t\"onWidgetLoad\",\n\t\thandler as WindowEventListener<\"onWidgetLoad\">,\n\t\tdeps,\n\t);\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/react/hooks/use-event-listener.ts","../../src/root/guards/on-event-received.ts","../../src/react/hooks/factory.ts","../../src/react/hooks/use-on-event-received.ts","../../src/react/hooks/use-on-widget-load.ts"],"sourcesContent":["import { type DependencyList, useEffect, useRef } from \"react\";\nimport type {\n\tWindowEventKey,\n\tWindowEventListener,\n} from \"../types/window-events.js\";\n\nexport function useEventListener<K extends WindowEventKey>(\n\teventName: K,\n\thandler: WindowEventListener<K>,\n\tdeps: DependencyList = [],\n): void {\n\tconst callbackRef = useRef<WindowEventListener<K>>(handler);\n\tcallbackRef.current = handler;\n\n\tuseEffect(() => {\n\t\tconst fn = (ev: WindowEventMap[K]) => callbackRef.current.call(window, ev);\n\t\twindow.addEventListener(eventName, fn);\n\t\treturn () => window.removeEventListener(eventName, fn);\n\t}, [eventName, ...deps]);\n}\n","import type {\n\tCheerDetail,\n\tCommunityGiftPurchaseDetail,\n\tDeleteMessageDetail,\n\tDeleteMessagesDetail,\n\tFollowerDetail,\n\tMinimalEvent,\n\tRaidDetail,\n\tSubscriberDetail,\n\tSubscriberLatestDetail,\n\tTestButtonDetail,\n\tTwitchMessageDetail,\n} from \"@/root/types/on-event-received\";\n\nexport const isDetail = (d: unknown): d is MinimalEvent =>\n\ttypeof d === \"object\" && d !== null && \"listener\" in d;\n\nexport function createGuard<T extends MinimalEvent>(\n\tpredicate: (d: MinimalEvent) => boolean,\n) {\n\treturn (d: unknown): d is T => isDetail(d) && predicate(d);\n}\n\nexport const isTwitchMessageEvent = createGuard<TwitchMessageDetail>(\n\t(d) => d.listener === \"message\",\n);\nexport const isFollowerDetail = createGuard<FollowerDetail>(\n\t(d) => d.listener === \"follower-latest\",\n);\nexport const isSubscriberLatestDetail = createGuard<SubscriberLatestDetail>(\n\t(d) => d.listener === \"subscriber-latest\",\n);\nexport const isCheerDetail = createGuard<CheerDetail>(\n\t(d) => d.listener === \"cheer-latest\",\n);\nexport const isRaidDetail = createGuard<RaidDetail>(\n\t(d) => d.listener === \"raid-latest\",\n);\nexport const isDeleteMessageDetail = createGuard<DeleteMessageDetail>(\n\t(d) => d.listener === \"delete-message\",\n);\nexport const isDeleteMessagesDetail = createGuard<DeleteMessagesDetail>(\n\t(d) => d.listener === \"delete-messages\",\n);\nexport const isCommunityGiftPurchaseDetail =\n\tcreateGuard<CommunityGiftPurchaseDetail>(\n\t\t(d) => d.listener === \"event\" && d.event?.type === \"communityGiftPurchase\",\n\t);\nexport const isSubscriberDetail = createGuard<SubscriberDetail>(\n\t(d) => d.listener === \"event\" && d.event?.type === \"subscriber\",\n);\nexport const isWidgetButtonDetail = createGuard<TestButtonDetail>(\n\t(d) => d.listener === \"event:test\" && d.event?.listener === \"widget-button\",\n);\n","import type { DependencyList } from \"react\";\nimport { classifyEvent } from \"@/root/classifier\";\nimport type {\n\tClassifiedEvent,\n\tIncomingDetail,\n\tMinimalEvent,\n} from \"@/root/types/on-event-received\";\nimport { useEventListener } from \"./use-event-listener\";\n\n/**\n * Configuration options for StreamElements event hooks.\n */\nexport interface HookOptions<C extends boolean = boolean> {\n\t/**\n\t * If true, the hook will return a classified/normalized event object\n\t * instead of the raw StreamElements CustomEvent.\n\t *\n\t * Note: Only supported for alert-related hooks.\n\t */\n\tclassified?: C;\n\t/**\n\t * React dependency list to control hook re-subscription.\n\t */\n\tdeps?: DependencyList;\n}\n\nexport type HookHandler<T, C, R extends boolean> = (\n\tdata: R extends true ? C : CustomEvent<T>,\n) => void;\n\nexport function parseDepsOrOptions<C extends boolean>(\n\tdepsOrOptions?: DependencyList | HookOptions<C>,\n): HookOptions<C> {\n\tif (!depsOrOptions) return {} as HookOptions<C>;\n\tif (Array.isArray(depsOrOptions))\n\t\treturn { deps: depsOrOptions } as HookOptions<C>;\n\treturn depsOrOptions as HookOptions<C>;\n}\n\n/**\n * Base internal engine for event-guarded listeners.\n */\nexport function useOnEvent<\n\tT extends MinimalEvent,\n\tC = never,\n\tR extends boolean = boolean,\n>(\n\tguard: (d: unknown) => d is T,\n\thandler: HookHandler<T, C, R>,\n\toptions: HookOptions<R>,\n) {\n\tconst { classified, deps = [] } = options;\n\tuseEventListener(\n\t\t\"onEventReceived\",\n\t\t(ev) => {\n\t\t\tif (guard(ev.detail)) {\n\t\t\t\tif (classified) {\n\t\t\t\t\tconst data = classifyEvent(ev.detail as unknown as IncomingDetail);\n\t\t\t\t\tif (data) (handler as (d: C) => void)(data as C);\n\t\t\t\t} else {\n\t\t\t\t\t(handler as (d: CustomEvent<T>) => void)(ev as CustomEvent<T>);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tdeps,\n\t);\n}\n\n/**\n * Hook Factory to reduce boilerplate.\n * If C is not provided, classification mode is disabled for the hook.\n */\nexport function createEventHook<T extends MinimalEvent>(\n\tguard: (d: unknown) => d is T,\n): (\n\thandler: (ev: CustomEvent<T>) => void,\n\tdepsOrOptions?: DependencyList | HookOptions<false>,\n) => void;\n\nexport function createEventHook<T extends MinimalEvent, C>(\n\tguard: (d: unknown) => d is T,\n): <R extends boolean = false>(\n\thandler: HookHandler<T, C, R>,\n\tdepsOrOptions?: DependencyList | HookOptions<R>,\n) => void;\n\nexport function createEventHook(guard: (d: unknown) => d is MinimalEvent) {\n\treturn <R extends boolean>(\n\t\thandler: HookHandler<MinimalEvent, ClassifiedEvent, R>,\n\t\tdepsOrOptions?: DependencyList | HookOptions<R>,\n\t) => {\n\t\tconst options = parseDepsOrOptions(depsOrOptions);\n\t\treturn useOnEvent(guard, handler, options);\n\t};\n}\n","import type { DependencyList } from \"react\";\nimport { aggregateIncomingEvent, type AggregatorOptions } from \"@/root/aggregator\";\nimport {\n\tisCheerDetail,\n\tisCommunityGiftPurchaseDetail,\n\tisDeleteMessageDetail,\n\tisDeleteMessagesDetail,\n\tisFollowerDetail,\n\tisRaidDetail,\n\tisSubscriberDetail,\n\tisSubscriberLatestDetail,\n\tisTwitchMessageEvent,\n\tisWidgetButtonDetail,\n} from \"@/root/guards\";\nimport type {\n\tAggregatedCommunityGift,\n\tCheerDetail,\n\tClassifiedButtonClick,\n\tClassifiedCheer,\n\tClassifiedDeleteMessage,\n\tClassifiedDeleteMessages,\n\tClassifiedEvent,\n\tClassifiedFollower,\n\tClassifiedRaid,\n\tClassifiedSelfSub,\n\tClassifiedSoloSub,\n\tClassifiedSubRenewal,\n\tCommunityGiftPurchaseDetail,\n\tDeleteMessageDetail,\n\tDeleteMessagesDetail,\n\tFollowerDetail,\n\tIncomingDetail,\n\tRaidDetail,\n\tSubscriberDetail,\n\tSubscriberLatestDetail,\n\tTestButtonDetail,\n\tTwitchMessageDetail,\n} from \"@/root/types/on-event-received\";\nimport type { WindowEventListener } from \"../types/window-events\";\nimport { createEventHook } from \"./factory\";\nimport { useEventListener } from \"./use-event-listener\";\n\n/**\n * Low-level hook to subscribe to the generic 'onEventReceived' from StreamElements.\n *\n * @param handler Generic event listener for all StreamElements events.\n * @param deps React dependency list.\n */\nexport function useOnEventReceived(\n\thandler: WindowEventListener<\"onEventReceived\">,\n\tdeps: DependencyList = [],\n): void {\n\tuseEventListener(\"onEventReceived\", handler, deps);\n}\n\n/**\n * Listens for Twitch chat messages received.\n * Classification is not supported for this hook.\n */\nexport const useOnTwitchMessageReceived =\n\tcreateEventHook<TwitchMessageDetail>(isTwitchMessageEvent);\n\n/** Alias for useOnTwitchMessageReceived */\nexport const useOnMessageReceived = useOnTwitchMessageReceived;\n\n/**\n * Listens for single message deletion events in Twitch chat.\n * Calls on deleting certain user message.\n * Supports classification into ClassifiedDeleteMessage.\n */\nexport const useOnDeleteMessage = createEventHook<\n\tDeleteMessageDetail,\n\tClassifiedDeleteMessage\n>(isDeleteMessageDetail);\n\n/**\n * Listens for multiple message deletion (clear chat/timeout) events in Twitch chat.\n * Calls on user ban or timeout.\n * Supports classification into ClassifiedDeleteMessages.\n */\nexport const useOnDeleteMessages = createEventHook<\n\tDeleteMessagesDetail,\n\tClassifiedDeleteMessages\n>(isDeleteMessagesDetail);\n\n/**\n * Listens for Widget Button clicks configured in the StreamElements Overlay Editor.\n * Supports classification into ClassifiedButtonClick.\n */\nexport const useOnWidgetButtonReceived = createEventHook<\n\tTestButtonDetail,\n\tClassifiedButtonClick\n>(isWidgetButtonDetail);\n\n/**\n * Listens for new Follower events.\n * Supports classification into ClassifiedFollower.\n */\nexport const useOnFollowerReceived = createEventHook<\n\tFollowerDetail,\n\tClassifiedFollower\n>(isFollowerDetail);\n\n/**\n * Listens for Cheer (bits) events.\n * Supports classification into ClassifiedCheer.\n */\nexport const useOnCheerReceived = createEventHook<CheerDetail, ClassifiedCheer>(\n\tisCheerDetail,\n);\n\n/**\n * Listens for Raid events.\n * Supports classification into ClassifiedRaid.\n */\nexport const useOnRaidReceived = createEventHook<RaidDetail, ClassifiedRaid>(\n\tisRaidDetail,\n);\n\n/**\n * Listens for general Subscriber events.\n * Supports classification into ClassifiedEvent union.\n */\nexport const useOnSubscriberReceived = createEventHook<\n\tSubscriberDetail,\n\tClassifiedEvent\n>(isSubscriberDetail);\n\n/**\n * Listens for personal subscription events where a user subscribes for the first time.\n */\nexport const useOnSelfSubReceived = (\n\thandler: (event: ClassifiedSelfSub) => void,\n\tdeps: DependencyList = [],\n) => {\n\tuseOnSubscriberReceived(\n\t\t(sub) => {\n\t\t\tif (sub.type === \"self-sub\") handler(sub as ClassifiedSelfSub);\n\t\t},\n\t\t{ classified: true, deps },\n\t);\n};\n\n/**\n * Listens for subscription renewal events (resubs) with month count.\n */\nexport const useOnSubRenewalReceived = (\n\thandler: (event: ClassifiedSubRenewal) => void,\n\tdeps: DependencyList = [],\n) => {\n\tuseOnSubscriberReceived(\n\t\t(sub) => {\n\t\t\tif (sub.type === \"sub-renewal\") handler(sub as ClassifiedSubRenewal);\n\t\t},\n\t\t{ classified: true, deps },\n\t);\n};\n\n/**\n * Listens for solo gift subscription events (one user gifting to another specific user).\n */\nexport const useOnSoloGiftReceived = (\n\thandler: (event: ClassifiedSoloSub) => void,\n\tdeps: DependencyList = [],\n) => {\n\tuseOnSubscriberReceived(\n\t\t(sub) => {\n\t\t\tif (sub.type === \"solo-sub-to-someone\") handler(sub as ClassifiedSoloSub);\n\t\t},\n\t\t{ classified: true, deps },\n\t);\n};\n\n/**\n * Listens for the latest Subscriber status updates.\n * Supports classification into ClassifiedEvent union.\n */\nexport const useOnSubscriberLatestReceived = createEventHook<\n\tSubscriberLatestDetail,\n\tClassifiedEvent\n>(isSubscriberLatestDetail);\n\n/**\n * Listens for Community Gift Purchase (bulk gifts) events.\n */\nexport const useOnCommunityGiftPurchaseReceived = createEventHook<\n\tCommunityGiftPurchaseDetail,\n\tClassifiedEvent\n>(isCommunityGiftPurchaseDetail);\n\n/**\n * Specialized hook for handling aggregated mass-gift subscriptions.\n *\n * Normalizes Multiple subscriber events into a single sender event with a list of recipients.\n * Essential for \"Community Gift\" alerts to avoid spamming multiple notifications.\n *\n * @param handler Receives the aggregated community gift object.\n * @param options Aggregator options (broadcasterLogin, cache, etc).\n * @param deps React dependency list.\n */\nexport const useOnAggregatedCommunityGift = (\n\thandler: (event: AggregatedCommunityGift) => void,\n\toptions?: AggregatorOptions,\n\tdeps: DependencyList = [],\n) => {\n\tuseOnEventReceived((ev) => {\n\t\taggregateIncomingEvent(\n\t\t\tev.detail as unknown as IncomingDetail,\n\t\t\toptions,\n\t\t\t(normalized) => {\n\t\t\t\tif (normalized) handler(normalized as AggregatedCommunityGift);\n\t\t\t},\n\t\t);\n\t}, deps);\n};\n\nexport type { HookOptions } from \"./factory\";\n","import type { DependencyList } from \"react\";\nimport type { WindowEventListener } from \"@/react/types/window-events.js\";\nimport type { OnWidgetLoadEventDetails } from \"@/root/types/on-widget-load\";\nimport { useEventListener } from \"./use-event-listener.js\";\n\nexport function useOnWidgetLoad<FieldData = unknown>(\n\thandler: (ev: CustomEvent<OnWidgetLoadEventDetails<FieldData>>) => void,\n\tdeps: DependencyList = [],\n): void {\n\tuseEventListener(\n\t\t\"onWidgetLoad\",\n\t\thandler as WindowEventListener<\"onWidgetLoad\">,\n\t\tdeps,\n\t);\n}\n"],"mappings":";;;;;AAMA,SAAgB,EACf,GACA,GACA,IAAuB,EAAE,EAClB;CACP,IAAM,IAAc,EAA+B,EAAQ;AAG3D,CAFA,EAAY,UAAU,GAEtB,QAAgB;EACf,IAAM,KAAM,MAA0B,EAAY,QAAQ,KAAK,QAAQ,EAAG;AAE1E,SADA,OAAO,iBAAiB,GAAW,EAAG,QACzB,OAAO,oBAAoB,GAAW,EAAG;IACpD,CAAC,GAAW,GAAG,EAAK,CAAC;;;;ACJzB,IAAa,KAAY,MACxB,OAAO,KAAM,cAAY,KAAc,cAAc;AAEtD,SAAgB,EACf,GACC;AACD,SAAQ,MAAuB,EAAS,EAAE,IAAI,EAAU,EAAE;;AAG3D,IAAa,IAAuB,GAClC,MAAM,EAAE,aAAa,UACtB,EACY,IAAmB,GAC9B,MAAM,EAAE,aAAa,kBACtB,EACY,IAA2B,GACtC,MAAM,EAAE,aAAa,oBACtB,EACY,IAAgB,GAC3B,MAAM,EAAE,aAAa,eACtB,EACY,IAAe,GAC1B,MAAM,EAAE,aAAa,cACtB,EACY,IAAwB,GACnC,MAAM,EAAE,aAAa,iBACtB,EACY,IAAyB,GACpC,MAAM,EAAE,aAAa,kBACtB,EACY,IACZ,GACE,MAAM,EAAE,aAAa,WAAW,EAAE,OAAO,SAAS,wBACnD,EACW,IAAqB,GAChC,MAAM,EAAE,aAAa,WAAW,EAAE,OAAO,SAAS,aACnD,EACY,IAAuB,GAClC,MAAM,EAAE,aAAa,gBAAgB,EAAE,OAAO,aAAa,gBAC5D;;;ACvBD,SAAgB,EACf,GACiB;AAIjB,QAHK,IACD,MAAM,QAAQ,EAAc,GACxB,EAAE,MAAM,GAAe,GACxB,IAHoB,EAAE;;AAS9B,SAAgB,EAKf,GACA,GACA,GACC;CACD,IAAM,EAAE,eAAY,UAAO,EAAE,KAAK;AAClC,GACC,oBACC,MAAO;AACP,MAAI,EAAM,EAAG,OAAO,CACnB,KAAI,GAAY;GACf,IAAM,IAAO,EAAc,EAAG,OAAoC;AAClE,GAAI,KAAO,EAA2B,EAAU;QAE/C,GAAwC,EAAqB;IAIjE,EACA;;AAqBF,SAAgB,EAAgB,GAA0C;AACzE,SACC,GACA,MAGO,EAAW,GAAO,GADT,EAAmB,EAAc,CACP;;;;AC5C5C,SAAgB,EACf,GACA,IAAuB,EAAE,EAClB;AACP,GAAiB,mBAAmB,GAAS,EAAK;;AAOnD,IAAa,IACZ,EAAqC,EAAqB,EAG9C,IAAuB,GAOvB,IAAqB,EAGhC,EAAsB,EAOX,IAAsB,EAGjC,EAAuB,EAMZ,IAA4B,EAGvC,EAAqB,EAMV,IAAwB,EAGnC,EAAiB,EAMN,IAAqB,EACjC,EACA,EAMY,IAAoB,EAChC,EACA,EAMY,IAA0B,EAGrC,EAAmB,EAKR,KACZ,GACA,IAAuB,EAAE,KACrB;AACJ,IACE,MAAQ;AACR,EAAI,EAAI,SAAS,cAAY,EAAQ,EAAyB;IAE/D;EAAE,YAAY;EAAM;EAAM,CAC1B;GAMW,KACZ,GACA,IAAuB,EAAE,KACrB;AACJ,IACE,MAAQ;AACR,EAAI,EAAI,SAAS,iBAAe,EAAQ,EAA4B;IAErE;EAAE,YAAY;EAAM;EAAM,CAC1B;GAMW,KACZ,GACA,IAAuB,EAAE,KACrB;AACJ,IACE,MAAQ;AACR,EAAI,EAAI,SAAS,yBAAuB,EAAQ,EAAyB;IAE1E;EAAE,YAAY;EAAM;EAAM,CAC1B;GAOW,IAAgC,EAG3C,EAAyB,EAKd,IAAqC,EAGhD,EAA8B,EAYnB,KACZ,GACA,GACA,IAAuB,EAAE,KACrB;AACJ,IAAoB,MAAO;AAC1B,IACC,EAAG,QACH,IACC,MAAe;AACf,GAAI,KAAY,EAAQ,EAAsC;IAE/D;IACC,EAAK;;;;AChNT,SAAgB,EACf,GACA,IAAuB,EAAE,EAClB;AACP,GACC,gBACA,GACA,EACA"}
@@ -1,2 +1,4 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "../root-DJod-F4M.js";
2
- export { f as AlertQueue, s as TwitchUserMessageData, u as UserRole, n as aggregateIncomingEvent, r as classifyEvent, l as getCacheKey, i as getTestAlertKey, e as getTestMessageKey, o as parseTier, c as testAlert, a as testAlerts, d as testMessage, t as testMessages, p as testOnWidgetLoadDetail };
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "../root-CowOS1ts.js";
2
+ import { testAlerts as f } from "./sources/alerts.js";
3
+ import { testMessages as p } from "./sources/messages.js";
4
+ export { u as AlertQueue, o as TwitchUserMessageData, c as UserRole, a as aggregateIncomingEvent, d as classifyEvent, n as getCacheKey, i as getTestAlertKey, e as getTestMessageKey, r as parseTier, s as testAlert, f as testAlerts, l as testMessage, p as testMessages, t as testOnWidgetLoadDetail };
@@ -0,0 +1,158 @@
1
+ //#region src/root/sources/alerts.ts
2
+ var e = {
3
+ follower: {
4
+ listener: "follower-latest",
5
+ event: { name: "An1by" }
6
+ },
7
+ communityGiftAnonymous: {
8
+ listener: "event",
9
+ event: {
10
+ type: "communityGiftPurchase",
11
+ provider: "twitch",
12
+ channel: "663b10ba6cd449c4162a2230",
13
+ activityGroup: "41a50a915794e4ae7cf5e600fd3445d4",
14
+ data: {
15
+ amount: 2,
16
+ username: "anonymous",
17
+ displayName: "AnAnonymousGifter",
18
+ tier: "2000",
19
+ sender: "Anonymous"
20
+ },
21
+ _id: "699868d7df734989ec85d393",
22
+ activityId: "699868d7df734989ec85d393"
23
+ }
24
+ },
25
+ communityGift: {
26
+ listener: "event",
27
+ event: {
28
+ type: "communityGiftPurchase",
29
+ provider: "twitch",
30
+ channel: "663b10ba6cd449c4162a2230",
31
+ activityGroup: "841592c0bccbf3e1e7de71e1c8f4d9f0",
32
+ data: {
33
+ amount: 1,
34
+ username: "rishamon",
35
+ displayName: "rishamon",
36
+ tier: "1000",
37
+ sender: "rishamon"
38
+ },
39
+ _id: "699867c7fef23197a6a089f5",
40
+ activityId: "699867c7fef23197a6a089f5"
41
+ }
42
+ },
43
+ sub: {
44
+ listener: "subscriber-latest",
45
+ event: {
46
+ name: "An1by",
47
+ amount: 1
48
+ }
49
+ },
50
+ selfSub: {
51
+ listener: "event",
52
+ event: {
53
+ type: "subscriber",
54
+ provider: "twitch",
55
+ channel: "663b10ba6cd449c4162a2230",
56
+ data: {
57
+ amount: 1,
58
+ username: "rishamon",
59
+ displayName: "rishamon",
60
+ tier: "1000"
61
+ },
62
+ _id: "6998676317aed69e62b8f283",
63
+ activityId: "6998676317aed69e62b8f283"
64
+ }
65
+ },
66
+ soloSubToSomeone: {
67
+ listener: "event",
68
+ event: {
69
+ type: "subscriber",
70
+ provider: "twitch",
71
+ channel: "663b10ba6cd449c4162a2230",
72
+ data: {
73
+ amount: 1,
74
+ username: "encry_s",
75
+ displayName: "encry_s",
76
+ message: "rishamon gifted a Tier 1 sub to encry_s! This is their first Gift Sub in the channel!",
77
+ tier: "1000",
78
+ sender: "rishamon",
79
+ gifted: !0
80
+ },
81
+ _id: "699866e82d9cd9a70854baf2",
82
+ activityId: "699866e82d9cd9a70854baf2"
83
+ }
84
+ },
85
+ subRenewal: {
86
+ listener: "event",
87
+ event: {
88
+ type: "subscriber",
89
+ provider: "twitch",
90
+ channel: "663b10ba6cd449c4162a2230",
91
+ data: {
92
+ amount: 8,
93
+ username: "silgestian",
94
+ displayName: "SilgeStian",
95
+ tier: "1000"
96
+ },
97
+ _id: "69986dfaf25724ff4162bd1a",
98
+ activityId: "69986dfaf25724ff4162bd1a"
99
+ }
100
+ },
101
+ bits: {
102
+ listener: "cheer-latest",
103
+ event: {
104
+ name: "An1by",
105
+ amount: 30
106
+ }
107
+ },
108
+ raid: {
109
+ listener: "raid-latest",
110
+ event: {
111
+ name: "An1by",
112
+ amount: 50
113
+ }
114
+ },
115
+ donationShortText: {
116
+ listener: "donation",
117
+ event: { data: {
118
+ alert_type: "1",
119
+ currency: "RUB",
120
+ billing_system: "CARD",
121
+ id: 5,
122
+ amount_main: 500,
123
+ amount: 500,
124
+ username: "An1by",
125
+ message: "Simple message text"
126
+ } }
127
+ },
128
+ donationLongText: {
129
+ listener: "donation",
130
+ event: { data: {
131
+ alert_type: "1",
132
+ currency: "RUB",
133
+ billing_system: "CARD",
134
+ id: 5,
135
+ amount_main: 500,
136
+ amount: 500,
137
+ username: "An1by",
138
+ message: "A plain gray stone lay on the shore, basking in the sun's warmth. A shove broke its peace—a thoughtless toss sent it flying. The stone splashed into water. Ripples spread, yet none noticed. It sank to the bottom, heavy with loneliness. \"Didn't I deserve to stay where I was happy still?\" it wondered."
139
+ } }
140
+ },
141
+ donation: {
142
+ listener: "donation",
143
+ event: { data: {
144
+ alert_type: "1",
145
+ currency: "RUB",
146
+ billing_system: "CARD",
147
+ id: 5,
148
+ amount_main: 500,
149
+ amount: 500,
150
+ username: "An1by",
151
+ message: ""
152
+ } }
153
+ }
154
+ };
155
+ //#endregion
156
+ export { e as testAlerts };
157
+
158
+ //# sourceMappingURL=alerts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alerts.js","names":[],"sources":["../../../src/root/sources/alerts.ts"],"sourcesContent":["export const testAlerts = {\n\tfollower: {\n\t\tlistener: \"follower-latest\",\n\t\tevent: {\n\t\t\tname: \"An1by\",\n\t\t},\n\t},\n\tcommunityGiftAnonymous: {\n\t\tlistener: \"event\",\n\t\tevent: {\n\t\t\ttype: \"communityGiftPurchase\",\n\t\t\tprovider: \"twitch\",\n\t\t\tchannel: \"663b10ba6cd449c4162a2230\",\n\t\t\tactivityGroup: \"41a50a915794e4ae7cf5e600fd3445d4\",\n\t\t\tdata: {\n\t\t\t\tamount: 2,\n\t\t\t\tusername: \"anonymous\",\n\t\t\t\tdisplayName: \"AnAnonymousGifter\",\n\t\t\t\ttier: \"2000\",\n\t\t\t\tsender: \"Anonymous\",\n\t\t\t},\n\t\t\t_id: \"699868d7df734989ec85d393\",\n\t\t\tactivityId: \"699868d7df734989ec85d393\",\n\t\t},\n\t},\n\tcommunityGift: {\n\t\tlistener: \"event\",\n\t\tevent: {\n\t\t\ttype: \"communityGiftPurchase\",\n\t\t\tprovider: \"twitch\",\n\t\t\tchannel: \"663b10ba6cd449c4162a2230\",\n\t\t\tactivityGroup: \"841592c0bccbf3e1e7de71e1c8f4d9f0\",\n\t\t\tdata: {\n\t\t\t\tamount: 1,\n\t\t\t\tusername: \"rishamon\",\n\t\t\t\tdisplayName: \"rishamon\",\n\t\t\t\ttier: \"1000\",\n\t\t\t\tsender: \"rishamon\",\n\t\t\t},\n\t\t\t_id: \"699867c7fef23197a6a089f5\",\n\t\t\tactivityId: \"699867c7fef23197a6a089f5\",\n\t\t},\n\t},\n\tsub: {\n\t\tlistener: \"subscriber-latest\",\n\t\tevent: {\n\t\t\tname: \"An1by\",\n\t\t\tamount: 1,\n\t\t},\n\t},\n\tselfSub: {\n\t\tlistener: \"event\",\n\t\tevent: {\n\t\t\ttype: \"subscriber\",\n\t\t\tprovider: \"twitch\",\n\t\t\tchannel: \"663b10ba6cd449c4162a2230\",\n\t\t\tdata: {\n\t\t\t\tamount: 1,\n\t\t\t\tusername: \"rishamon\",\n\t\t\t\tdisplayName: \"rishamon\",\n\t\t\t\ttier: \"1000\",\n\t\t\t},\n\t\t\t_id: \"6998676317aed69e62b8f283\",\n\t\t\tactivityId: \"6998676317aed69e62b8f283\",\n\t\t},\n\t},\n\tsoloSubToSomeone: {\n\t\tlistener: \"event\",\n\t\tevent: {\n\t\t\ttype: \"subscriber\",\n\t\t\tprovider: \"twitch\",\n\t\t\tchannel: \"663b10ba6cd449c4162a2230\",\n\t\t\tdata: {\n\t\t\t\tamount: 1,\n\t\t\t\tusername: \"encry_s\",\n\t\t\t\tdisplayName: \"encry_s\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"rishamon gifted a Tier 1 sub to encry_s! This is their first Gift Sub in the channel!\",\n\t\t\t\ttier: \"1000\",\n\t\t\t\tsender: \"rishamon\",\n\t\t\t\tgifted: true,\n\t\t\t},\n\t\t\t_id: \"699866e82d9cd9a70854baf2\",\n\t\t\tactivityId: \"699866e82d9cd9a70854baf2\",\n\t\t},\n\t},\n\tsubRenewal: {\n\t\tlistener: \"event\",\n\t\tevent: {\n\t\t\ttype: \"subscriber\",\n\t\t\tprovider: \"twitch\",\n\t\t\tchannel: \"663b10ba6cd449c4162a2230\",\n\t\t\tdata: {\n\t\t\t\tamount: 8,\n\t\t\t\tusername: \"silgestian\",\n\t\t\t\tdisplayName: \"SilgeStian\",\n\t\t\t\ttier: \"1000\",\n\t\t\t},\n\t\t\t_id: \"69986dfaf25724ff4162bd1a\",\n\t\t\tactivityId: \"69986dfaf25724ff4162bd1a\",\n\t\t},\n\t},\n\tbits: {\n\t\tlistener: \"cheer-latest\",\n\t\tevent: {\n\t\t\tname: \"An1by\",\n\t\t\tamount: 30,\n\t\t},\n\t},\n\traid: {\n\t\tlistener: \"raid-latest\",\n\t\tevent: {\n\t\t\tname: \"An1by\",\n\t\t\tamount: 50,\n\t\t},\n\t},\n\tdonationShortText: {\n\t\tlistener: \"donation\",\n\t\tevent: {\n\t\t\tdata: {\n\t\t\t\talert_type: \"1\",\n\t\t\t\tcurrency: \"RUB\",\n\t\t\t\tbilling_system: \"CARD\",\n\t\t\t\tid: 5,\n\t\t\t\tamount_main: 500,\n\t\t\t\tamount: 500,\n\t\t\t\tusername: \"An1by\",\n\t\t\t\tmessage: \"Simple message text\",\n\t\t\t},\n\t\t},\n\t},\n\tdonationLongText: {\n\t\tlistener: \"donation\",\n\t\tevent: {\n\t\t\tdata: {\n\t\t\t\talert_type: \"1\",\n\t\t\t\tcurrency: \"RUB\",\n\t\t\t\tbilling_system: \"CARD\",\n\t\t\t\tid: 5,\n\t\t\t\tamount_main: 500,\n\t\t\t\tamount: 500,\n\t\t\t\tusername: \"An1by\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"A plain gray stone lay on the shore, basking in the sun's warmth. A shove broke its peace—a thoughtless toss sent it flying. The stone splashed into water. Ripples spread, yet none noticed. It sank to the bottom, heavy with loneliness. \\\"Didn't I deserve to stay where I was happy still?\\\" it wondered.\",\n\t\t\t},\n\t\t},\n\t},\n\tdonation: {\n\t\tlistener: \"donation\",\n\t\tevent: {\n\t\t\tdata: {\n\t\t\t\talert_type: \"1\",\n\t\t\t\tcurrency: \"RUB\",\n\t\t\t\tbilling_system: \"CARD\",\n\t\t\t\tid: 5,\n\t\t\t\tamount_main: 500,\n\t\t\t\tamount: 500,\n\t\t\t\tusername: \"An1by\",\n\t\t\t\tmessage: \"\",\n\t\t\t},\n\t\t},\n\t},\n};\n"],"mappings":";AAAA,IAAa,IAAa;CACzB,UAAU;EACT,UAAU;EACV,OAAO,EACN,MAAM,SACN;EACD;CACD,wBAAwB;EACvB,UAAU;EACV,OAAO;GACN,MAAM;GACN,UAAU;GACV,SAAS;GACT,eAAe;GACf,MAAM;IACL,QAAQ;IACR,UAAU;IACV,aAAa;IACb,MAAM;IACN,QAAQ;IACR;GACD,KAAK;GACL,YAAY;GACZ;EACD;CACD,eAAe;EACd,UAAU;EACV,OAAO;GACN,MAAM;GACN,UAAU;GACV,SAAS;GACT,eAAe;GACf,MAAM;IACL,QAAQ;IACR,UAAU;IACV,aAAa;IACb,MAAM;IACN,QAAQ;IACR;GACD,KAAK;GACL,YAAY;GACZ;EACD;CACD,KAAK;EACJ,UAAU;EACV,OAAO;GACN,MAAM;GACN,QAAQ;GACR;EACD;CACD,SAAS;EACR,UAAU;EACV,OAAO;GACN,MAAM;GACN,UAAU;GACV,SAAS;GACT,MAAM;IACL,QAAQ;IACR,UAAU;IACV,aAAa;IACb,MAAM;IACN;GACD,KAAK;GACL,YAAY;GACZ;EACD;CACD,kBAAkB;EACjB,UAAU;EACV,OAAO;GACN,MAAM;GACN,UAAU;GACV,SAAS;GACT,MAAM;IACL,QAAQ;IACR,UAAU;IACV,aAAa;IACb,SACC;IACD,MAAM;IACN,QAAQ;IACR,QAAQ;IACR;GACD,KAAK;GACL,YAAY;GACZ;EACD;CACD,YAAY;EACX,UAAU;EACV,OAAO;GACN,MAAM;GACN,UAAU;GACV,SAAS;GACT,MAAM;IACL,QAAQ;IACR,UAAU;IACV,aAAa;IACb,MAAM;IACN;GACD,KAAK;GACL,YAAY;GACZ;EACD;CACD,MAAM;EACL,UAAU;EACV,OAAO;GACN,MAAM;GACN,QAAQ;GACR;EACD;CACD,MAAM;EACL,UAAU;EACV,OAAO;GACN,MAAM;GACN,QAAQ;GACR;EACD;CACD,mBAAmB;EAClB,UAAU;EACV,OAAO,EACN,MAAM;GACL,YAAY;GACZ,UAAU;GACV,gBAAgB;GAChB,IAAI;GACJ,aAAa;GACb,QAAQ;GACR,UAAU;GACV,SAAS;GACT,EACD;EACD;CACD,kBAAkB;EACjB,UAAU;EACV,OAAO,EACN,MAAM;GACL,YAAY;GACZ,UAAU;GACV,gBAAgB;GAChB,IAAI;GACJ,aAAa;GACb,QAAQ;GACR,UAAU;GACV,SACC;GACD,EACD;EACD;CACD,UAAU;EACT,UAAU;EACV,OAAO,EACN,MAAM;GACL,YAAY;GACZ,UAAU;GACV,gBAAgB;GAChB,IAAI;GACJ,aAAa;GACb,QAAQ;GACR,UAAU;GACV,SAAS;GACT,EACD;EACD;CACD"}