@streamplace/components 0.8.17 → 0.9.0
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/components/chat/chat-box.d.ts +1 -1
- package/dist/components/chat/chat-box.d.ts.map +1 -1
- package/dist/components/chat/chat-box.js +3 -0
- package/dist/components/chat/chat-box.js.map +1 -1
- package/dist/components/chat/mod-view.d.ts +4 -2
- package/dist/components/chat/mod-view.d.ts.map +1 -1
- package/dist/components/chat/mod-view.js +142 -42
- package/dist/components/chat/mod-view.js.map +1 -1
- package/dist/components/dashboard/chat-panel.d.ts +2 -1
- package/dist/components/dashboard/chat-panel.d.ts.map +1 -1
- package/dist/components/dashboard/chat-panel.js +2 -3
- package/dist/components/dashboard/chat-panel.js.map +1 -1
- package/dist/components/dashboard/index.d.ts +1 -0
- package/dist/components/dashboard/index.d.ts.map +1 -1
- package/dist/components/dashboard/index.js +3 -1
- package/dist/components/dashboard/index.js.map +1 -1
- package/dist/components/dashboard/moderator-panel.d.ts +7 -0
- package/dist/components/dashboard/moderator-panel.d.ts.map +1 -0
- package/dist/components/dashboard/moderator-panel.js +256 -0
- package/dist/components/dashboard/moderator-panel.js.map +1 -0
- package/dist/components/mobile-player/video-async.native.d.ts.map +1 -1
- package/dist/components/mobile-player/video-async.native.js +1 -1
- package/dist/components/mobile-player/video-async.native.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/menu.d.ts +14 -0
- package/dist/components/ui/menu.d.ts.map +1 -1
- package/dist/components/ui/menu.js +83 -4
- package/dist/components/ui/menu.js.map +1 -1
- package/dist/components/ui/text.d.ts +1 -1
- package/dist/crypto-polyfill.native.js +7 -1
- package/dist/crypto-polyfill.native.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useDocumentTitle.d.ts +6 -0
- package/dist/hooks/useDocumentTitle.d.ts.map +1 -0
- package/dist/hooks/useDocumentTitle.js +40 -0
- package/dist/hooks/useDocumentTitle.js.map +1 -0
- package/dist/lib/theme/atoms.d.ts +145 -145
- package/dist/lib/theme/branded-theme-provider.d.ts +13 -0
- package/dist/lib/theme/branded-theme-provider.d.ts.map +1 -0
- package/dist/lib/theme/branded-theme-provider.js +34 -0
- package/dist/lib/theme/branded-theme-provider.js.map +1 -0
- package/dist/lib/theme/index.d.ts +1 -0
- package/dist/lib/theme/index.d.ts.map +1 -1
- package/dist/lib/theme/index.js +4 -1
- package/dist/lib/theme/index.js.map +1 -1
- package/dist/lib/theme/theme.d.ts +1 -1
- package/dist/lib/theme/tokens.d.ts +1 -1
- package/dist/lib/theme/tokens.js +1 -1
- package/dist/livestream-provider/index.d.ts +2 -1
- package/dist/livestream-provider/index.d.ts.map +1 -1
- package/dist/livestream-provider/index.js +4 -2
- package/dist/livestream-provider/index.js.map +1 -1
- package/dist/livestream-provider/websocket.d.ts.map +1 -1
- package/dist/livestream-provider/websocket.js +15 -1
- package/dist/livestream-provider/websocket.js.map +1 -1
- package/dist/livestream-store/chat.d.ts +1 -1
- package/dist/livestream-store/chat.d.ts.map +1 -1
- package/dist/livestream-store/chat.js +1 -3
- package/dist/livestream-store/chat.js.map +1 -1
- package/dist/livestream-store/livestream-state.d.ts +5 -1
- package/dist/livestream-store/livestream-state.d.ts.map +1 -1
- package/dist/livestream-store/livestream-store.d.ts +1 -0
- package/dist/livestream-store/livestream-store.d.ts.map +1 -1
- package/dist/livestream-store/livestream-store.js +7 -1
- package/dist/livestream-store/livestream-store.js.map +1 -1
- package/dist/livestream-store/stream-key.d.ts +1 -0
- package/dist/livestream-store/stream-key.d.ts.map +1 -1
- package/dist/livestream-store/stream-key.js +2 -0
- package/dist/livestream-store/stream-key.js.map +1 -1
- package/dist/livestream-store/websocket-consumer.d.ts.map +1 -1
- package/dist/livestream-store/websocket-consumer.js +145 -75
- package/dist/livestream-store/websocket-consumer.js.map +1 -1
- package/dist/streamplace-provider/index.d.ts +3 -0
- package/dist/streamplace-provider/index.d.ts.map +1 -1
- package/dist/streamplace-provider/index.js +12 -1
- package/dist/streamplace-provider/index.js.map +1 -1
- package/dist/streamplace-store/block.d.ts +36 -2
- package/dist/streamplace-store/block.d.ts.map +1 -1
- package/dist/streamplace-store/block.js +121 -18
- package/dist/streamplace-store/block.js.map +1 -1
- package/dist/streamplace-store/branding.d.ts +27 -0
- package/dist/streamplace-store/branding.d.ts.map +1 -0
- package/dist/streamplace-store/branding.js +195 -0
- package/dist/streamplace-store/branding.js.map +1 -0
- package/dist/streamplace-store/index.d.ts +4 -0
- package/dist/streamplace-store/index.d.ts.map +1 -1
- package/dist/streamplace-store/index.js +4 -0
- package/dist/streamplace-store/index.js.map +1 -1
- package/dist/streamplace-store/moderation.d.ts +16 -0
- package/dist/streamplace-store/moderation.d.ts.map +1 -0
- package/dist/streamplace-store/moderation.js +141 -0
- package/dist/streamplace-store/moderation.js.map +1 -0
- package/dist/streamplace-store/moderator-management.d.ts +44 -0
- package/dist/streamplace-store/moderator-management.d.ts.map +1 -0
- package/dist/streamplace-store/moderator-management.js +136 -0
- package/dist/streamplace-store/moderator-management.js.map +1 -0
- package/dist/streamplace-store/streamplace-store.d.ts +6 -0
- package/dist/streamplace-store/streamplace-store.d.ts.map +1 -1
- package/dist/streamplace-store/streamplace-store.js +6 -0
- package/dist/streamplace-store/streamplace-store.js.map +1 -1
- package/dist/streamplace-store/xrpc.d.ts +1 -0
- package/dist/streamplace-store/xrpc.d.ts.map +1 -1
- package/dist/streamplace-store/xrpc.js +16 -0
- package/dist/streamplace-store/xrpc.js.map +1 -1
- package/locales/en-US/common.ftl +16 -0
- package/locales/en-US/settings.ftl +104 -0
- package/locales/es-ES/common.ftl +16 -0
- package/locales/es-ES/settings.ftl +1 -1
- package/locales/fr-FR/common.ftl +16 -0
- package/locales/pt-BR/common.ftl +16 -0
- package/locales/pt-BR/settings.ftl +1 -1
- package/locales/zh-Hant/common.ftl +16 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
- package/package.json +3 -3
- package/src/components/chat/chat-box.tsx +3 -1
- package/src/components/chat/mod-view.tsx +431 -121
- package/src/components/dashboard/chat-panel.tsx +2 -1
- package/src/components/dashboard/index.tsx +1 -0
- package/src/components/dashboard/moderator-panel.tsx +632 -0
- package/src/components/mobile-player/video-async.native.tsx +2 -1
- package/src/components/ui/menu.tsx +181 -5
- package/src/crypto-polyfill.native.tsx +8 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDocumentTitle.tsx +45 -0
- package/src/lib/theme/branded-theme-provider.tsx +58 -0
- package/src/lib/theme/index.ts +3 -0
- package/src/lib/theme/tokens.ts +1 -1
- package/src/livestream-provider/index.tsx +5 -1
- package/src/livestream-provider/websocket.tsx +15 -1
- package/src/livestream-store/chat.tsx +0 -2
- package/src/livestream-store/livestream-state.tsx +7 -0
- package/src/livestream-store/livestream-store.tsx +7 -0
- package/src/livestream-store/stream-key.tsx +3 -0
- package/src/livestream-store/websocket-consumer.tsx +155 -73
- package/src/streamplace-provider/index.tsx +23 -4
- package/src/streamplace-store/block.tsx +139 -19
- package/src/streamplace-store/branding.tsx +216 -0
- package/src/streamplace-store/index.tsx +4 -0
- package/src/streamplace-store/moderation.tsx +185 -0
- package/src/streamplace-store/moderator-management.tsx +175 -0
- package/src/streamplace-store/streamplace-store.tsx +15 -0
- package/src/streamplace-store/xrpc.tsx +18 -1
- package/dist/assets/emoji-data.json +0 -19371
- package/src/assets/emoji-data.json +0 -19371
|
@@ -9,87 +9,157 @@ const problems_1 = require("./problems");
|
|
|
9
9
|
const MAX_RECENT_SEGMENTS = 10;
|
|
10
10
|
const handleWebSocketMessages = (state, messages) => {
|
|
11
11
|
for (let message of messages) {
|
|
12
|
-
if (
|
|
13
|
-
const newLivestream = message;
|
|
14
|
-
const oldLivestream = state.livestream;
|
|
15
|
-
// check if this is actually new
|
|
16
|
-
if (!oldLivestream || oldLivestream.uri !== newLivestream.uri) {
|
|
17
|
-
const streamTitle = newLivestream.record.title || "something cool!";
|
|
18
|
-
const systemMessage = system_messages_1.SystemMessages.streamStart(streamTitle);
|
|
19
|
-
// set proper times
|
|
20
|
-
systemMessage.indexedAt = newLivestream.indexedAt;
|
|
21
|
-
systemMessage.record.createdAt = newLivestream.record.createdAt;
|
|
22
|
-
state = (0, chat_1.reduceChat)(state, [systemMessage], []);
|
|
23
|
-
}
|
|
24
|
-
state = {
|
|
25
|
-
...state,
|
|
26
|
-
livestream: newLivestream,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
else if (streamplace_1.PlaceStreamLivestream.isViewerCount(message)) {
|
|
30
|
-
message = message;
|
|
12
|
+
if (message.$type === "place.stream.error") {
|
|
31
13
|
state = {
|
|
32
14
|
...state,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
cid: message.cid,
|
|
42
|
-
author: message.author,
|
|
43
|
-
record: message.record,
|
|
44
|
-
indexedAt: message.indexedAt,
|
|
45
|
-
chatProfile: message.chatProfile,
|
|
46
|
-
replyTo: message.replyTo,
|
|
47
|
-
deleted: message.deleted,
|
|
15
|
+
problems: [
|
|
16
|
+
...state.problems,
|
|
17
|
+
{
|
|
18
|
+
code: message.code,
|
|
19
|
+
message: message.message,
|
|
20
|
+
severity: "error",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
48
23
|
};
|
|
49
|
-
state = (0, chat_1.reduceChat)(state, [hydrated], [], []);
|
|
50
24
|
}
|
|
51
|
-
else
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
25
|
+
else {
|
|
26
|
+
if (!state.websocketConnected) {
|
|
27
|
+
state = {
|
|
28
|
+
...state,
|
|
29
|
+
websocketConnected: true,
|
|
30
|
+
};
|
|
56
31
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
32
|
+
if (streamplace_1.PlaceStreamLivestream.isLivestreamView(message)) {
|
|
33
|
+
const newLivestream = message;
|
|
34
|
+
const oldLivestream = state.livestream;
|
|
35
|
+
// check if this is actually new
|
|
36
|
+
if (!oldLivestream || oldLivestream.uri !== newLivestream.uri) {
|
|
37
|
+
const streamTitle = newLivestream.record.title || "something cool!";
|
|
38
|
+
const systemMessage = system_messages_1.SystemMessages.streamStart(streamTitle);
|
|
39
|
+
// set proper times
|
|
40
|
+
systemMessage.indexedAt = newLivestream.indexedAt;
|
|
41
|
+
systemMessage.record.createdAt = newLivestream.record.createdAt;
|
|
42
|
+
state = (0, chat_1.reduceChat)(state, [systemMessage], []);
|
|
43
|
+
}
|
|
44
|
+
state = {
|
|
45
|
+
...state,
|
|
46
|
+
livestream: newLivestream,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
else if (streamplace_1.PlaceStreamLivestream.isViewerCount(message)) {
|
|
50
|
+
message = message;
|
|
51
|
+
state = {
|
|
52
|
+
...state,
|
|
53
|
+
viewers: message.count,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
else if (streamplace_1.PlaceStreamChatDefs.isMessageView(message)) {
|
|
57
|
+
message = message;
|
|
58
|
+
// Explicitly map MessageView to MessageViewHydrated
|
|
59
|
+
const hydrated = {
|
|
60
|
+
uri: message.uri,
|
|
61
|
+
cid: message.cid,
|
|
62
|
+
author: message.author,
|
|
63
|
+
record: message.record,
|
|
64
|
+
indexedAt: message.indexedAt,
|
|
65
|
+
chatProfile: message.chatProfile,
|
|
66
|
+
replyTo: message.replyTo,
|
|
67
|
+
deleted: message.deleted,
|
|
68
|
+
};
|
|
69
|
+
state = (0, chat_1.reduceChat)(state, [hydrated], [], []);
|
|
70
|
+
}
|
|
71
|
+
else if (streamplace_1.PlaceStreamSegment.isRecord(message)) {
|
|
72
|
+
const newRecentSegments = [...state.recentSegments];
|
|
73
|
+
newRecentSegments.unshift(message);
|
|
74
|
+
if (newRecentSegments.length > MAX_RECENT_SEGMENTS) {
|
|
75
|
+
newRecentSegments.pop();
|
|
76
|
+
}
|
|
77
|
+
state = {
|
|
78
|
+
...state,
|
|
79
|
+
segment: message,
|
|
80
|
+
recentSegments: newRecentSegments,
|
|
81
|
+
problems: (0, problems_1.findProblems)(newRecentSegments),
|
|
82
|
+
hasReceivedSegment: true,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
else if (streamplace_1.PlaceStreamDefs.isBlockView(message)) {
|
|
86
|
+
const block = message;
|
|
87
|
+
state = (0, chat_1.reduceChat)(state, [], [block], []);
|
|
88
|
+
}
|
|
89
|
+
else if (streamplace_1.PlaceStreamDefs.isRenditions(message)) {
|
|
90
|
+
message = message;
|
|
91
|
+
state = {
|
|
92
|
+
...state,
|
|
93
|
+
renditions: message.renditions,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
else if (api_1.AppBskyActorDefs.isProfileViewBasic(message)) {
|
|
97
|
+
state = {
|
|
98
|
+
...state,
|
|
99
|
+
profile: message,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
else if (streamplace_1.PlaceStreamChatGate.isRecord(message)) {
|
|
103
|
+
const hideRecord = message;
|
|
104
|
+
const hiddenMessageUri = hideRecord.hiddenMessage;
|
|
105
|
+
const newPendingHides = [...state.pendingHides];
|
|
106
|
+
if (!newPendingHides.includes(hiddenMessageUri)) {
|
|
107
|
+
newPendingHides.push(hiddenMessageUri);
|
|
108
|
+
}
|
|
109
|
+
state = {
|
|
110
|
+
...state,
|
|
111
|
+
pendingHides: newPendingHides,
|
|
112
|
+
};
|
|
113
|
+
state = (0, chat_1.reduceChat)(state, [], [], [hiddenMessageUri]);
|
|
114
|
+
}
|
|
115
|
+
else if (streamplace_1.PlaceStreamModerationPermission.isRecord(message) ||
|
|
116
|
+
(message &&
|
|
117
|
+
typeof message === "object" &&
|
|
118
|
+
"$type" in message &&
|
|
119
|
+
message.$type ===
|
|
120
|
+
"place.stream.moderation.permission")) {
|
|
121
|
+
// Handle moderation permission record updates
|
|
122
|
+
// This can be a new permission or a deletion marker
|
|
123
|
+
const permRecord = message;
|
|
124
|
+
if (permRecord.deleted) {
|
|
125
|
+
// Handle deletion: clear permissions to trigger refetch
|
|
126
|
+
// The useCanModerate hook will refetch and repopulate
|
|
127
|
+
state = {
|
|
128
|
+
...state,
|
|
129
|
+
moderationPermissions: [],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// Handle new/updated permission: add or update in the list
|
|
134
|
+
// Use createdAt as a unique identifier since multiple records can exist for the same moderator
|
|
135
|
+
// (e.g., one record with "ban" permission, another with "hide" permission)
|
|
136
|
+
// Note: rkey would be ideal but isn't always present in the WebSocket message
|
|
137
|
+
const newPerm = permRecord;
|
|
138
|
+
const existingIndex = state.moderationPermissions.findIndex((p) => {
|
|
139
|
+
const pWithRkey = p;
|
|
140
|
+
// Prefer matching by rkey if available, fall back to createdAt
|
|
141
|
+
if (newPerm.rkey && pWithRkey.rkey) {
|
|
142
|
+
return pWithRkey.rkey === newPerm.rkey;
|
|
143
|
+
}
|
|
144
|
+
return (p.moderator === newPerm.moderator &&
|
|
145
|
+
p.createdAt === newPerm.createdAt);
|
|
146
|
+
});
|
|
147
|
+
let newPermissions;
|
|
148
|
+
if (existingIndex >= 0) {
|
|
149
|
+
// Update existing record with same moderator AND createdAt
|
|
150
|
+
newPermissions = [...state.moderationPermissions];
|
|
151
|
+
newPermissions[existingIndex] = newPerm;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// Add new record (could be a new record for an existing moderator with different permissions)
|
|
155
|
+
newPermissions = [...state.moderationPermissions, newPerm];
|
|
156
|
+
}
|
|
157
|
+
state = {
|
|
158
|
+
...state,
|
|
159
|
+
moderationPermissions: newPermissions,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
87
162
|
}
|
|
88
|
-
state = {
|
|
89
|
-
...state,
|
|
90
|
-
pendingHides: newPendingHides,
|
|
91
|
-
};
|
|
92
|
-
state = (0, chat_1.reduceChat)(state, [], [], [hiddenMessageUri]);
|
|
93
163
|
}
|
|
94
164
|
}
|
|
95
165
|
return (0, chat_1.reduceChat)(state, [], [], []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket-consumer.js","sourceRoot":"","sources":["../../src/livestream-store/websocket-consumer.tsx"],"names":[],"mappings":";;;AAAA,sCAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"websocket-consumer.js","sourceRoot":"","sources":["../../src/livestream-store/websocket-consumer.tsx"],"names":[],"mappings":";;;AAAA,sCAAgD;AAChD,6CAUqB;AACrB,4DAAwD;AACxD,iCAAoC;AAEpC,yCAA0C;AAE1C,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAExB,MAAM,uBAAuB,GAAG,CACrC,KAAsB,EACtB,QAAe,EACE,EAAE;IACnB,KAAK,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,OAAO,CAAC,KAAK,KAAK,oBAAoB,EAAE,CAAC;YAC3C,KAAK,GAAG;gBACN,GAAG,KAAK;gBACR,QAAQ,EAAE;oBACR,GAAG,KAAK,CAAC,QAAQ;oBACjB;wBACE,IAAI,EAAE,OAAO,CAAC,IAAI;wBAClB,OAAO,EAAE,OAAO,CAAC,OAAO;wBACxB,QAAQ,EAAE,OAAO;qBAClB;iBACF;aACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC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
6
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function BrandingFetcher({ children }: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
10
|
export declare function ChatProfileCreator({ oauthSession, children, }: {
|
|
8
11
|
oauthSession?: SessionManager | null;
|
|
9
12
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/streamplace-provider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/streamplace-provider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAYnE,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,GAAG,EACH,YAAY,GACb,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;CACtC,2CAqBA;AAED,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAU1E;AAED,wBAAgB,kBAAkB,CAAC,EACjC,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,YAAY,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAQA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StreamplaceProvider = StreamplaceProvider;
|
|
4
|
+
exports.BrandingFetcher = BrandingFetcher;
|
|
4
5
|
exports.ChatProfileCreator = ChatProfileCreator;
|
|
5
6
|
const tslib_1 = require("tslib");
|
|
6
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
8
|
const react_1 = require("react");
|
|
9
|
+
const hooks_1 = require("../hooks");
|
|
8
10
|
const streamplace_store_1 = require("../streamplace-store");
|
|
9
11
|
const streamplace_store_2 = require("../streamplace-store/streamplace-store");
|
|
10
12
|
const context_1 = require("./context");
|
|
@@ -18,7 +20,16 @@ function StreamplaceProvider({ children, url, oauthSession, }) {
|
|
|
18
20
|
(0, react_1.useEffect)(() => {
|
|
19
21
|
store.setState({ oauthSession });
|
|
20
22
|
}, [oauthSession]);
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(context_1.StreamplaceContext.Provider, { value: { store: store }, children: (0, jsx_runtime_1.jsx)(ChatProfileCreator, { oauthSession: oauthSession, children: (0, jsx_runtime_1.jsx)(poller_1.default, { children: children }) }) }));
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(context_1.StreamplaceContext.Provider, { value: { store: store }, children: (0, jsx_runtime_1.jsx)(BrandingFetcher, { children: (0, jsx_runtime_1.jsx)(ChatProfileCreator, { oauthSession: oauthSession, children: (0, jsx_runtime_1.jsx)(poller_1.default, { children: children }) }) }) }));
|
|
24
|
+
}
|
|
25
|
+
function BrandingFetcher({ children }) {
|
|
26
|
+
const fetchBroadcasterDID = (0, streamplace_store_1.useFetchBroadcasterDID)();
|
|
27
|
+
(0, streamplace_store_1.useBrandingAutoFetch)();
|
|
28
|
+
(0, hooks_1.useDocumentTitle)();
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
fetchBroadcasterDID();
|
|
31
|
+
}, [fetchBroadcasterDID]);
|
|
32
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
22
33
|
}
|
|
23
34
|
function ChatProfileCreator({ oauthSession, children, }) {
|
|
24
35
|
const getChatProfile = (0, streamplace_store_1.useGetChatProfile)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/streamplace-provider/index.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/streamplace-provider/index.tsx"],"names":[],"mappings":";;AAYA,kDA6BC;AAED,0CAUC;AAED,gDAcC;;;AApED,iCAA0C;AAC1C,oCAA4C;AAC5C,4DAI8B;AAC9B,8EAA8E;AAC9E,uCAA+C;AAC/C,8DAA8B;AAE9B,SAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,GAAG,EACH,YAAY,GAKb;IACC,4BAA4B;IAC5B,MAAM,KAAK,GAAG,IAAA,cAAM,EAAC,IAAA,wCAAoB,EAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IAE5D,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,KAAK,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1B,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,KAAK,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,uBAAC,4BAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAClD,uBAAC,eAAe,cACd,uBAAC,kBAAkB,IAAC,YAAY,EAAE,YAAY,YAC5C,uBAAC,gBAAM,cAAE,QAAQ,GAAU,GACR,GACL,GACU,CAC/B,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe,CAAC,EAAE,QAAQ,EAAiC;IACzE,MAAM,mBAAmB,GAAG,IAAA,0CAAsB,GAAE,CAAC;IACrD,IAAA,wCAAoB,GAAE,CAAC;IACvB,IAAA,wBAAgB,GAAE,CAAC;IAEnB,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,mBAAmB,EAAE,CAAC;IACxB,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAE1B,OAAO,2DAAG,QAAQ,GAAI,CAAC;AACzB,CAAC;AAED,SAAgB,kBAAkB,CAAC,EACjC,YAAY,EACZ,QAAQ,GAIT;IACC,MAAM,cAAc,GAAG,IAAA,qCAAiB,GAAE,CAAC;IAC3C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,YAAY,EAAE,CAAC;YACjB,cAAc,EAAE,CAAC;QACnB,CAAC;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IACnB,OAAO,2DAAG,QAAQ,GAAI,CAAC;AACzB,CAAC"}
|
|
@@ -1,9 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to create a block record (ban user from chat).
|
|
3
|
+
*
|
|
4
|
+
* When the caller is the stream owner (agent.did === streamerDID), creates the
|
|
5
|
+
* block record directly via ATProto writes to their repo.
|
|
6
|
+
*
|
|
7
|
+
* When the caller is a delegated moderator, uses the place.stream.moderation.createBlock
|
|
8
|
+
* XRPC endpoint which validates permissions and creates the record using the
|
|
9
|
+
* streamer's OAuth session.
|
|
10
|
+
*/
|
|
1
11
|
export declare function useCreateBlockRecord(): {
|
|
2
|
-
createBlock: (subjectDID: string) => Promise<import("
|
|
12
|
+
createBlock: (subjectDID: string, streamerDID?: string) => Promise<import("streamplace/src/lexicons/types/place/stream/moderation/createBlock").Response>;
|
|
3
13
|
isLoading: boolean;
|
|
4
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Hook to create a gate record (hide a chat message).
|
|
17
|
+
*
|
|
18
|
+
* When the caller is the stream owner (agent.did === streamerDID), creates the
|
|
19
|
+
* gate record directly via ATProto writes to their repo.
|
|
20
|
+
*
|
|
21
|
+
* When the caller is a delegated moderator, uses the place.stream.moderation.createGate
|
|
22
|
+
* XRPC endpoint which validates permissions and creates the record using the
|
|
23
|
+
* streamer's OAuth session.
|
|
24
|
+
*/
|
|
5
25
|
export declare function useCreateHideChatRecord(): {
|
|
6
|
-
createHideChat: (chatMessageUri: string) => Promise<import("
|
|
26
|
+
createHideChat: (chatMessageUri: string, streamerDID?: string) => Promise<import("streamplace/src/lexicons/types/place/stream/moderation/createGate").Response>;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Hook to update a livestream record (update stream title).
|
|
31
|
+
*
|
|
32
|
+
* When the caller is the stream owner (agent.did === streamerDID), updates the
|
|
33
|
+
* livestream record directly via ATProto writes to their repo.
|
|
34
|
+
*
|
|
35
|
+
* When the caller is a delegated moderator, uses the place.stream.moderation.updateLivestream
|
|
36
|
+
* XRPC endpoint which validates permissions and updates the record using the
|
|
37
|
+
* streamer's OAuth session.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useUpdateLivestreamRecord(): {
|
|
40
|
+
updateLivestream: (livestreamUri: string, title: string, streamerDID?: string) => Promise<import("streamplace/src/lexicons/types/place/stream/moderation/updateLivestream").Response>;
|
|
7
41
|
isLoading: boolean;
|
|
8
42
|
};
|
|
9
43
|
//# sourceMappingURL=block.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/streamplace-store/block.tsx"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB;8BAIK,MAAM;;
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/streamplace-store/block.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB;8BAIK,MAAM,gBAAgB,MAAM;;EAsCpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB;qCAKnB,MAAM,gBACR,MAAM;;EAuCvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB;sCAKtB,MAAM,SACd,MAAM,gBACC,MAAM;;EA0DvB"}
|
|
@@ -2,12 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCreateBlockRecord = useCreateBlockRecord;
|
|
4
4
|
exports.useCreateHideChatRecord = useCreateHideChatRecord;
|
|
5
|
+
exports.useUpdateLivestreamRecord = useUpdateLivestreamRecord;
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const xrpc_1 = require("./xrpc");
|
|
8
|
+
/**
|
|
9
|
+
* Hook to create a block record (ban user from chat).
|
|
10
|
+
*
|
|
11
|
+
* When the caller is the stream owner (agent.did === streamerDID), creates the
|
|
12
|
+
* block record directly via ATProto writes to their repo.
|
|
13
|
+
*
|
|
14
|
+
* When the caller is a delegated moderator, uses the place.stream.moderation.createBlock
|
|
15
|
+
* XRPC endpoint which validates permissions and creates the record using the
|
|
16
|
+
* streamer's OAuth session.
|
|
17
|
+
*/
|
|
7
18
|
function useCreateBlockRecord() {
|
|
8
19
|
let agent = (0, xrpc_1.usePDSAgent)();
|
|
9
20
|
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
10
|
-
const createBlock = async (subjectDID) => {
|
|
21
|
+
const createBlock = async (subjectDID, streamerDID) => {
|
|
11
22
|
if (!agent) {
|
|
12
23
|
throw new Error("No PDS agent found");
|
|
13
24
|
}
|
|
@@ -16,15 +27,24 @@ function useCreateBlockRecord() {
|
|
|
16
27
|
}
|
|
17
28
|
setIsLoading(true);
|
|
18
29
|
try {
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
// If no streamerDID provided or caller is the streamer, use direct ATProto write
|
|
31
|
+
if (!streamerDID || agent.did === streamerDID) {
|
|
32
|
+
const record = {
|
|
33
|
+
$type: "app.bsky.graph.block",
|
|
34
|
+
subject: subjectDID,
|
|
35
|
+
createdAt: new Date().toISOString(),
|
|
36
|
+
};
|
|
37
|
+
const result = await agent.com.atproto.repo.createRecord({
|
|
38
|
+
repo: agent.did,
|
|
39
|
+
collection: "app.bsky.graph.block",
|
|
40
|
+
record,
|
|
41
|
+
});
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
// Otherwise, use delegated moderation endpoint
|
|
45
|
+
const result = await agent.place.stream.moderation.createBlock({
|
|
46
|
+
streamer: streamerDID,
|
|
21
47
|
subject: subjectDID,
|
|
22
|
-
createdAt: new Date().toISOString(),
|
|
23
|
-
};
|
|
24
|
-
const result = await agent.com.atproto.repo.createRecord({
|
|
25
|
-
repo: agent.did,
|
|
26
|
-
collection: "app.bsky.graph.block",
|
|
27
|
-
record,
|
|
28
48
|
});
|
|
29
49
|
return result;
|
|
30
50
|
}
|
|
@@ -34,10 +54,20 @@ function useCreateBlockRecord() {
|
|
|
34
54
|
};
|
|
35
55
|
return { createBlock, isLoading };
|
|
36
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Hook to create a gate record (hide a chat message).
|
|
59
|
+
*
|
|
60
|
+
* When the caller is the stream owner (agent.did === streamerDID), creates the
|
|
61
|
+
* gate record directly via ATProto writes to their repo.
|
|
62
|
+
*
|
|
63
|
+
* When the caller is a delegated moderator, uses the place.stream.moderation.createGate
|
|
64
|
+
* XRPC endpoint which validates permissions and creates the record using the
|
|
65
|
+
* streamer's OAuth session.
|
|
66
|
+
*/
|
|
37
67
|
function useCreateHideChatRecord() {
|
|
38
68
|
let agent = (0, xrpc_1.usePDSAgent)();
|
|
39
69
|
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
40
|
-
const createHideChat = async (chatMessageUri) => {
|
|
70
|
+
const createHideChat = async (chatMessageUri, streamerDID) => {
|
|
41
71
|
if (!agent) {
|
|
42
72
|
throw new Error("No PDS agent found");
|
|
43
73
|
}
|
|
@@ -46,14 +76,23 @@ function useCreateHideChatRecord() {
|
|
|
46
76
|
}
|
|
47
77
|
setIsLoading(true);
|
|
48
78
|
try {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
79
|
+
// If no streamerDID provided or caller is the streamer, use direct ATProto write
|
|
80
|
+
if (!streamerDID || agent.did === streamerDID) {
|
|
81
|
+
const record = {
|
|
82
|
+
$type: "place.stream.chat.gate",
|
|
83
|
+
hiddenMessage: chatMessageUri,
|
|
84
|
+
};
|
|
85
|
+
const result = await agent.com.atproto.repo.createRecord({
|
|
86
|
+
repo: agent.did,
|
|
87
|
+
collection: "place.stream.chat.gate",
|
|
88
|
+
record,
|
|
89
|
+
});
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
// Otherwise, use delegated moderation endpoint
|
|
93
|
+
const result = await agent.place.stream.moderation.createGate({
|
|
94
|
+
streamer: streamerDID,
|
|
95
|
+
messageUri: chatMessageUri,
|
|
57
96
|
});
|
|
58
97
|
return result;
|
|
59
98
|
}
|
|
@@ -63,4 +102,68 @@ function useCreateHideChatRecord() {
|
|
|
63
102
|
};
|
|
64
103
|
return { createHideChat, isLoading };
|
|
65
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Hook to update a livestream record (update stream title).
|
|
107
|
+
*
|
|
108
|
+
* When the caller is the stream owner (agent.did === streamerDID), updates the
|
|
109
|
+
* livestream record directly via ATProto writes to their repo.
|
|
110
|
+
*
|
|
111
|
+
* When the caller is a delegated moderator, uses the place.stream.moderation.updateLivestream
|
|
112
|
+
* XRPC endpoint which validates permissions and updates the record using the
|
|
113
|
+
* streamer's OAuth session.
|
|
114
|
+
*/
|
|
115
|
+
function useUpdateLivestreamRecord() {
|
|
116
|
+
let agent = (0, xrpc_1.usePDSAgent)();
|
|
117
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
118
|
+
const updateLivestream = async (livestreamUri, title, streamerDID) => {
|
|
119
|
+
if (!agent) {
|
|
120
|
+
throw new Error("No PDS agent found");
|
|
121
|
+
}
|
|
122
|
+
if (!agent.did) {
|
|
123
|
+
throw new Error("No user DID found, assuming not logged in");
|
|
124
|
+
}
|
|
125
|
+
setIsLoading(true);
|
|
126
|
+
try {
|
|
127
|
+
// If no streamerDID provided or caller is the streamer, use direct ATProto write
|
|
128
|
+
if (!streamerDID || agent.did === streamerDID) {
|
|
129
|
+
// Extract rkey from URI
|
|
130
|
+
const rkey = livestreamUri.split("/").pop();
|
|
131
|
+
if (!rkey) {
|
|
132
|
+
throw new Error("Invalid livestream URI");
|
|
133
|
+
}
|
|
134
|
+
// Get existing record to copy fields
|
|
135
|
+
const getResult = await agent.com.atproto.repo.getRecord({
|
|
136
|
+
repo: agent.did,
|
|
137
|
+
collection: "place.stream.livestream",
|
|
138
|
+
rkey,
|
|
139
|
+
});
|
|
140
|
+
const oldRecord = getResult.data.value;
|
|
141
|
+
// Create new record (don't edit - old records are "chapter markers")
|
|
142
|
+
// Spread entire record to preserve all fields (agent, canonicalUrl, notificationSettings, etc.)
|
|
143
|
+
const record = {
|
|
144
|
+
...oldRecord,
|
|
145
|
+
title: title, // Override title
|
|
146
|
+
createdAt: new Date().toISOString(), // Override timestamp for new chapter marker
|
|
147
|
+
};
|
|
148
|
+
const result = await agent.com.atproto.repo.createRecord({
|
|
149
|
+
repo: agent.did,
|
|
150
|
+
collection: "place.stream.livestream",
|
|
151
|
+
record,
|
|
152
|
+
});
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
// Otherwise, use delegated moderation endpoint
|
|
156
|
+
const result = await agent.place.stream.moderation.updateLivestream({
|
|
157
|
+
streamer: streamerDID,
|
|
158
|
+
livestreamUri: livestreamUri,
|
|
159
|
+
title: title,
|
|
160
|
+
});
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
finally {
|
|
164
|
+
setIsLoading(false);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
return { updateLivestream, isLoading };
|
|
168
|
+
}
|
|
66
169
|
//# sourceMappingURL=block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.js","sourceRoot":"","sources":["../../src/streamplace-store/block.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"block.js","sourceRoot":"","sources":["../../src/streamplace-store/block.tsx"],"names":[],"mappings":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,CAAC,KAAY,CAAC;gBAE9C,qEAAqE;gBACrE,gGAAgG;gBAChG,MAAM,MAAM,GAAG;oBACb,GAAG,SAAS;oBACZ,KAAK,EAAE,KAAK,EAAE,iBAAiB;oBAC/B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,4CAA4C;iBAClF,CAAC;gBAEF,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;oBACvD,IAAI,EAAE,KAAK,CAAC,GAAG;oBACf,UAAU,EAAE,yBAAyB;oBACrC,MAAM;iBACP,CAAC,CAAC;gBACH,OAAO,MAAM,CAAC;YAChB,CAAC;YAED,+CAA+C;YAC/C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC;gBAClE,QAAQ,EAAE,WAAW;gBACrB,aAAa,EAAE,aAAa;gBAC5B,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAChB,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface BrandingAsset {
|
|
2
|
+
key: string;
|
|
3
|
+
mimeType: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
data?: string;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function useFetchBroadcasterDID(): () => Promise<void>;
|
|
10
|
+
export declare function useFetchBranding(): ({ force }?: {
|
|
11
|
+
force?: boolean | undefined;
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
export declare function useBrandingAsset(key: string): BrandingAsset | undefined;
|
|
14
|
+
export declare function useMainLogo(): string | undefined;
|
|
15
|
+
export declare function useFavicon(): string | undefined;
|
|
16
|
+
export declare function useSiteTitle(): string;
|
|
17
|
+
export declare function useSiteDescription(): string;
|
|
18
|
+
export declare function usePrimaryColor(): string;
|
|
19
|
+
export declare function useAccentColor(): string;
|
|
20
|
+
export declare function useDefaultStreamer(): string | undefined;
|
|
21
|
+
export declare function useSidebarBackgroundImage(): BrandingAsset | undefined;
|
|
22
|
+
export declare function useLegalLinks(): {
|
|
23
|
+
text: string;
|
|
24
|
+
url: string;
|
|
25
|
+
}[];
|
|
26
|
+
export declare function useBrandingAutoFetch(): void;
|
|
27
|
+
//# sourceMappingURL=branding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../../src/streamplace-store/branding.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAaD,wBAAgB,sBAAsB,wBAsBrC;AAGD,wBAAgB,gBAAgB;;oBAqF/B;AAGD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEvE;AAGD,wBAAgB,WAAW,IAAI,MAAM,GAAG,SAAS,CAGhD;AAGD,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAG/C;AAGD,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAGD,wBAAgB,kBAAkB,IAAI,MAAM,CAG3C;AAGD,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAGD,wBAAgB,cAAc,IAAI,MAAM,CAGvC;AAGD,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAGvD;AAGD,wBAAgB,yBAAyB,IAAI,aAAa,GAAG,SAAS,CAErE;AAGD,wBAAgB,aAAa,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAU/D;AAGD,wBAAgB,oBAAoB,SASnC"}
|