slack-blocks-to-jsx 0.2.2 → 0.3.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/index.js CHANGED
@@ -86,48 +86,696 @@ var parseEmojis = (text) => {
86
86
  return emojified;
87
87
  };
88
88
 
89
- // src/utils/slack_text_to_jsx.tsx
90
- var import_html_react_parser = __toESM(require("html-react-parser"));
91
- var import_slack_markdown = require("slack-markdown");
92
- var slack_text_to_jsx = (text, parse_options) => {
93
- const { users, channels } = parse_options;
94
- if (!text)
89
+ // src/utils/markdown_parser/parser.tsx
90
+ var import_parser = __toESM(require("@yozora/parser"));
91
+
92
+ // src/utils/markdown_parser/sub_elements/text.tsx
93
+ var import_jsx_runtime = require("react/jsx-runtime");
94
+ var Text = (props) => {
95
+ const { element } = props;
96
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: element.value.split("[[DOUBLE_LINE_BREAK]]").map((line, index) => {
97
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
98
+ index > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "slack_blocks_to_jsx__line_break_not_first" }),
99
+ line
100
+ ] }, index);
101
+ }) });
102
+ };
103
+
104
+ // src/utils/markdown_parser/sub_elements/delete.tsx
105
+ var import_jsx_runtime2 = require("react/jsx-runtime");
106
+ var Delete = (props) => {
107
+ const { element } = props;
108
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("s", { children: element.children.map((child, i) => {
109
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { element: child }, i);
110
+ }) });
111
+ };
112
+
113
+ // src/store/useGlobalData.ts
114
+ var import_zustand = require("zustand");
115
+ var useBearStore = (0, import_zustand.create)((set) => ({
116
+ users: [],
117
+ channels: [],
118
+ user_groups: [],
119
+ hooks: {},
120
+ setUsers: (users) => set({ users }),
121
+ setChannels: (channels) => set({ channels }),
122
+ setUserGroups: (user_groups) => set({ user_groups }),
123
+ setHooks: (hooks) => set({ hooks })
124
+ }));
125
+ var useGlobalData = () => {
126
+ const { users, channels, user_groups, hooks, setChannels, setUsers, setHooks, setUserGroups } = useBearStore();
127
+ return {
128
+ users,
129
+ channels,
130
+ user_groups,
131
+ hooks,
132
+ setChannels,
133
+ setUsers,
134
+ setHooks,
135
+ setUserGroups
136
+ };
137
+ };
138
+
139
+ // src/utils/markdown_parser/sub_elements/slack_broadcast.tsx
140
+ var import_jsx_runtime3 = require("react/jsx-runtime");
141
+ var SlackBroadcast = (props) => {
142
+ const { element } = props;
143
+ const { hooks } = useGlobalData();
144
+ if (element.value === "here" && hooks.atHere)
145
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: hooks.atHere() });
146
+ if (element.value === "everyone" && hooks.atEveryone)
147
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: hooks.atEveryone() });
148
+ if (element.value === "channel" && hooks.atChannel)
149
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: hooks.atChannel() });
150
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "slack_broadcast", children: [
151
+ "@",
152
+ element.value
153
+ ] });
154
+ };
155
+
156
+ // src/utils/markdown_parser/sub_elements/slack_channel_mention.tsx
157
+ var import_jsx_runtime4 = require("react/jsx-runtime");
158
+ var SlackChannelMention = (props) => {
159
+ const { element } = props;
160
+ const { hooks, channels } = useGlobalData();
161
+ const channel_id = element.value;
162
+ const channel = channels.find((u) => u.id === channel_id || u.name === channel_id);
163
+ const label = (channel == null ? void 0 : channel.name) || channel_id;
164
+ if (hooks.channel)
165
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: hooks.channel(channel || { id: channel_id, name: label }) });
166
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "slack_channel", "data-channel-id": (channel == null ? void 0 : channel.id) || channel_id, children: [
167
+ "#",
168
+ label
169
+ ] });
170
+ };
171
+
172
+ // src/utils/markdown_parser/sub_elements/slack_user_group_mention.tsx
173
+ var import_jsx_runtime5 = require("react/jsx-runtime");
174
+ var SlackUserGroupMention = (props) => {
175
+ const { element } = props;
176
+ const { hooks, user_groups } = useGlobalData();
177
+ const group_id = element.value;
178
+ const group = user_groups.find((u) => u.id === group_id || u.name === group_id);
179
+ const label = (group == null ? void 0 : group.name) || group_id;
180
+ if (hooks.usergroup)
181
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: hooks.usergroup(group || { id: group_id, name: label }) });
182
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { "data-usergroup-id": (group == null ? void 0 : group.id) || group_id, className: "slack_user_group", children: [
183
+ "@",
184
+ label
185
+ ] });
186
+ };
187
+
188
+ // src/utils/markdown_parser/sub_elements/slack_user_mention.tsx
189
+ var import_jsx_runtime6 = require("react/jsx-runtime");
190
+ var SlackUserMention = (props) => {
191
+ const { element } = props;
192
+ const { hooks, users } = useGlobalData();
193
+ const user_id = element.value;
194
+ const user = users.find((u) => u.id === user_id || u.name === user_id);
195
+ if (hooks.user)
196
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: hooks.user(user || { id: user_id, name: user_id }) });
197
+ const label = (user == null ? void 0 : user.name) || user_id;
198
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "slack_user", "data-user-id": (user == null ? void 0 : user.id) || user_id, children: [
199
+ "@",
200
+ label
201
+ ] });
202
+ };
203
+
204
+ // src/utils/markdown_parser/sub_elements/emphasis.tsx
205
+ var import_jsx_runtime7 = require("react/jsx-runtime");
206
+ var Emphasis = (props) => {
207
+ const { element } = props;
208
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("em", { children: element.children.map((child, i) => {
209
+ if (child.type === "delete")
210
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Delete, { element: child }, i);
211
+ if (child.type === "slack_user_mention")
212
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SlackUserMention, { element: child }, i);
213
+ if (child.type === "slack_channel_mention")
214
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SlackChannelMention, { element: child }, i);
215
+ if (child.type === "slack_user_group_mention")
216
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SlackUserGroupMention, { element: child }, i);
217
+ if (child.type === "slack_broadcast")
218
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SlackBroadcast, { element: child }, i);
219
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { element: child }, i);
220
+ }) });
221
+ };
222
+
223
+ // src/utils/markdown_parser/sub_elements/inline_code.tsx
224
+ var import_jsx_runtime8 = require("react/jsx-runtime");
225
+ var InlineCode = (props) => {
226
+ const { element } = props;
227
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { className: "slack_code_inline", children: element.value });
228
+ };
229
+
230
+ // src/utils/markdown_parser/sub_elements/strong.tsx
231
+ var import_jsx_runtime9 = require("react/jsx-runtime");
232
+ var Strong = (props) => {
233
+ const { element } = props;
234
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: element.children.map((child, i) => {
235
+ if (child.type === "delete")
236
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Delete, { element: child }, i);
237
+ if (child.type === "slack_user_mention")
238
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SlackUserMention, { element: child }, i);
239
+ if (child.type === "slack_channel_mention")
240
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SlackChannelMention, { element: child }, i);
241
+ if (child.type === "slack_user_group_mention")
242
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SlackUserGroupMention, { element: child }, i);
243
+ if (child.type === "slack_broadcast")
244
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SlackBroadcast, { element: child }, i);
245
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { element: child }, i);
246
+ }) });
247
+ };
248
+
249
+ // src/utils/markdown_parser/sub_elements/link.tsx
250
+ var import_jsx_runtime10 = require("react/jsx-runtime");
251
+ var Link = (props) => {
252
+ const { element } = props;
253
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("a", { href: element.url, className: "slack_link", children: element.children.map((child, i) => {
254
+ if (child.type === "delete")
255
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Delete, { element: child }, i);
256
+ if (child.type === "emphasis")
257
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Emphasis, { element: child }, i);
258
+ if (child.type === "strong")
259
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Strong, { element: child }, i);
260
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { element: child }, i);
261
+ }) });
262
+ };
263
+
264
+ // src/utils/markdown_parser/elements/paragraph.tsx
265
+ var import_jsx_runtime11 = require("react/jsx-runtime");
266
+ var Paragraph = (props) => {
267
+ const { element } = props;
268
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: element.children.map((subelement, i) => {
269
+ if (subelement.type === "text")
270
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { element: subelement }, i);
271
+ if (subelement.type === "emphasis")
272
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Emphasis, { element: subelement }, i);
273
+ if (subelement.type === "inlineCode")
274
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(InlineCode, { element: subelement }, i);
275
+ if (subelement.type === "delete")
276
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Delete, { element: subelement }, i);
277
+ if (subelement.type === "strong")
278
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Strong, { element: subelement }, i);
279
+ if (subelement.type === "link")
280
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Link, { element: subelement }, i);
281
+ if (subelement.type === "slack_user_mention")
282
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SlackUserMention, { element: subelement }, i);
283
+ if (subelement.type === "slack_channel_mention")
284
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SlackChannelMention, { element: subelement }, i);
285
+ if (subelement.type === "slack_user_group_mention")
286
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SlackUserGroupMention, { element: subelement }, i);
287
+ if (subelement.type === "slack_broadcast")
288
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SlackBroadcast, { element: subelement }, i);
95
289
  return null;
96
- let text_string = text;
97
- text_string = text_string.replace(/(\n)+/g, (match) => {
98
- return match.replace(/\n/g, (newline, index) => {
99
- return index === 0 ? "<span class='slack_blocks_to_jsx__line_break'></span>" : "<span class='slack_blocks_to_jsx__line_break_not_first'></span>";
290
+ }) });
291
+ };
292
+
293
+ // src/utils/markdown_parser/elements/blockquote.tsx
294
+ var import_jsx_runtime12 = require("react/jsx-runtime");
295
+ var Blockquote = (props) => {
296
+ const { element } = props;
297
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: element.children.map((para) => {
298
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Paragraph, { element: para });
299
+ }) });
300
+ };
301
+
302
+ // src/utils/markdown_parser/elements/code.tsx
303
+ var import_jsx_runtime13 = require("react/jsx-runtime");
304
+ var Code = (props) => {
305
+ const { element } = props;
306
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { className: "slack_code", children: element.value });
307
+ };
308
+
309
+ // src/utils/markdown_parser/tokenizers/slack_user_mention/tokenizer.ts
310
+ var import_core_tokenizer2 = require("@yozora/core-tokenizer");
311
+
312
+ // src/utils/markdown_parser/tokenizers/slack_user_mention/match.ts
313
+ var import_character = require("@yozora/character");
314
+ var import_core_tokenizer = require("@yozora/core-tokenizer");
315
+
316
+ // src/utils/markdown_parser/tokenizers/slack_user_mention/types.ts
317
+ var SlackUserMentionType = "slack_user_mention";
318
+
319
+ // src/utils/markdown_parser/tokenizers/slack_user_mention/match.ts
320
+ var match = function(api) {
321
+ return { findDelimiter, processSingleDelimiter };
322
+ function* findDelimiter() {
323
+ var _a, _b;
324
+ const nodePoints = api.getNodePoints();
325
+ const blockStartIndex = api.getBlockStartIndex();
326
+ const blockEndIndex = api.getBlockEndIndex();
327
+ const potentialDelimiters = [];
328
+ for (let i = blockStartIndex; i < blockEndIndex; ++i) {
329
+ const c = (_a = nodePoints[i]) == null ? void 0 : _a.codePoint;
330
+ if (c === import_character.AsciiCodePoint.OPEN_ANGLE && ((_b = nodePoints[i + 1]) == null ? void 0 : _b.codePoint) === import_character.AsciiCodePoint.AT_SIGN) {
331
+ const j = (0, import_core_tokenizer.eatOptionalCharacters)(nodePoints, i + 2, blockEndIndex, import_character.AsciiCodePoint.AT_SIGN);
332
+ if (j < blockEndIndex) {
333
+ potentialDelimiters.push({
334
+ type: "opener",
335
+ startIndex: i,
336
+ endIndex: j
337
+ });
338
+ }
339
+ } else if (c === import_character.AsciiCodePoint.CLOSE_ANGLE) {
340
+ potentialDelimiters.push({
341
+ type: "closer",
342
+ startIndex: i,
343
+ endIndex: i + 1
344
+ });
345
+ }
346
+ }
347
+ let pIndex = 0;
348
+ let lastEndIndex = -1;
349
+ let delimiter = null;
350
+ while (pIndex < potentialDelimiters.length) {
351
+ const [startIndex, endIndex] = yield delimiter;
352
+ if (lastEndIndex === endIndex) {
353
+ if (delimiter == null || delimiter.startIndex >= startIndex)
354
+ continue;
355
+ }
356
+ lastEndIndex = endIndex;
357
+ let openerDelimiter = null;
358
+ let closerDelimiter = null;
359
+ for (; pIndex < potentialDelimiters.length; ++pIndex) {
360
+ const delimiter2 = potentialDelimiters[pIndex];
361
+ if (delimiter2.startIndex >= startIndex && delimiter2.type !== "closer") {
362
+ openerDelimiter = delimiter2;
363
+ break;
364
+ }
365
+ }
366
+ for (let i = pIndex + 1; i < potentialDelimiters.length; ++i) {
367
+ const delimiter2 = potentialDelimiters[i];
368
+ if (delimiter2.type === "closer") {
369
+ closerDelimiter = delimiter2;
370
+ break;
371
+ }
372
+ }
373
+ if (closerDelimiter == null)
374
+ return;
375
+ delimiter = {
376
+ type: "full",
377
+ startIndex: openerDelimiter.startIndex,
378
+ endIndex: closerDelimiter.endIndex,
379
+ thickness: closerDelimiter.endIndex - closerDelimiter.startIndex
380
+ };
381
+ }
382
+ }
383
+ function processSingleDelimiter(delimiter) {
384
+ const token = {
385
+ nodeType: SlackUserMentionType,
386
+ startIndex: delimiter.startIndex,
387
+ endIndex: delimiter.endIndex,
388
+ thickness: delimiter.thickness
389
+ };
390
+ return [token];
391
+ }
392
+ };
393
+
394
+ // src/utils/markdown_parser/tokenizers/slack_user_mention/parse.ts
395
+ var import_character2 = require("@yozora/character");
396
+ var parse = function(api) {
397
+ return {
398
+ parse: (tokens) => tokens.map((token) => {
399
+ const nodePoints = api.getNodePoints();
400
+ let startIndex = token.startIndex + 2;
401
+ let endIndex = token.endIndex - 1;
402
+ const value = (0, import_character2.calcStringFromNodePoints)(nodePoints, startIndex, endIndex);
403
+ const node = api.shouldReservePosition ? { type: SlackUserMentionType, position: api.calcPosition(token), value } : { type: SlackUserMentionType, value };
404
+ return node;
405
+ })
406
+ };
407
+ };
408
+
409
+ // src/utils/markdown_parser/tokenizers/slack_user_mention/tokenizer.ts
410
+ var SlackUserMentionTokenizer = class extends import_core_tokenizer2.BaseInlineTokenizer {
411
+ constructor(props = {}) {
412
+ super({
413
+ name: SlackUserMentionType,
414
+ priority: props.priority || import_core_tokenizer2.TokenizerPriority.ATOMIC
100
415
  });
101
- });
102
- text_string = (0, import_slack_markdown.toHTML)(text_string, {
103
- escapeHTML: false,
104
- slackCallbacks: {
105
- user(data) {
106
- const user = users.find((u) => u.id === data.id || u.name === data.name);
107
- const label = (user == null ? void 0 : user.name) || data.id || data.name;
108
- return `<span class="slack_user" data-user-id="${(user == null ? void 0 : user.id) || data.id}">@${label}</span>`;
109
- },
110
- channel(data) {
111
- const channel = channels.find((c) => c.id === data.id || c.name === data.name);
112
- const label = (channel == null ? void 0 : channel.name) || data.id || data.name;
113
- return `<span class="slack_channel" data-channel-id="${(channel == null ? void 0 : channel.id) || data.id}">#${label}</span>`;
114
- },
115
- atChannel(data) {
116
- const channel = channels.find((c) => c.name === data.name);
117
- const label = (channel == null ? void 0 : channel.name) || data.name;
118
- return `<span class="slack_channel" data-channel-id="${channel == null ? void 0 : channel.id}">#${label}</span>`;
119
- },
120
- atEveryone() {
121
- return `<span class="slack_broadcast">@everyone</span>`;
122
- },
123
- atHere() {
124
- return `<span class="slack_broadcast">@everyone</span>`;
416
+ this.match = match;
417
+ this.parse = parse;
418
+ }
419
+ };
420
+
421
+ // src/utils/markdown_parser/tokenizers/slack_channel_mention/tokenizer.ts
422
+ var import_core_tokenizer4 = require("@yozora/core-tokenizer");
423
+
424
+ // src/utils/markdown_parser/tokenizers/slack_channel_mention/match.ts
425
+ var import_character3 = require("@yozora/character");
426
+ var import_core_tokenizer3 = require("@yozora/core-tokenizer");
427
+
428
+ // src/utils/markdown_parser/tokenizers/slack_channel_mention/types.ts
429
+ var SlackChannelMentionType = "slack_channel_mention";
430
+
431
+ // src/utils/markdown_parser/tokenizers/slack_channel_mention/match.ts
432
+ var match2 = function(api) {
433
+ return { findDelimiter, processSingleDelimiter };
434
+ function* findDelimiter() {
435
+ var _a, _b;
436
+ const nodePoints = api.getNodePoints();
437
+ const blockStartIndex = api.getBlockStartIndex();
438
+ const blockEndIndex = api.getBlockEndIndex();
439
+ const potentialDelimiters = [];
440
+ for (let i = blockStartIndex; i < blockEndIndex; ++i) {
441
+ const c = (_a = nodePoints[i]) == null ? void 0 : _a.codePoint;
442
+ if (c === import_character3.AsciiCodePoint.OPEN_ANGLE && ((_b = nodePoints[i + 1]) == null ? void 0 : _b.codePoint) === import_character3.AsciiCodePoint.NUMBER_SIGN) {
443
+ const j = (0, import_core_tokenizer3.eatOptionalCharacters)(nodePoints, i + 2, blockEndIndex, import_character3.AsciiCodePoint.AT_SIGN);
444
+ if (j < blockEndIndex) {
445
+ potentialDelimiters.push({
446
+ type: "opener",
447
+ startIndex: i,
448
+ endIndex: j
449
+ });
450
+ }
451
+ } else if (c === import_character3.AsciiCodePoint.CLOSE_ANGLE) {
452
+ potentialDelimiters.push({
453
+ type: "closer",
454
+ startIndex: i,
455
+ endIndex: i + 1
456
+ });
457
+ }
458
+ }
459
+ let pIndex = 0;
460
+ let lastEndIndex = -1;
461
+ let delimiter = null;
462
+ while (pIndex < potentialDelimiters.length) {
463
+ const [startIndex, endIndex] = yield delimiter;
464
+ if (lastEndIndex === endIndex) {
465
+ if (delimiter == null || delimiter.startIndex >= startIndex)
466
+ continue;
467
+ }
468
+ lastEndIndex = endIndex;
469
+ let openerDelimiter = null;
470
+ let closerDelimiter = null;
471
+ for (; pIndex < potentialDelimiters.length; ++pIndex) {
472
+ const delimiter2 = potentialDelimiters[pIndex];
473
+ if (delimiter2.startIndex >= startIndex && delimiter2.type !== "closer") {
474
+ openerDelimiter = delimiter2;
475
+ break;
476
+ }
477
+ }
478
+ for (let i = pIndex + 1; i < potentialDelimiters.length; ++i) {
479
+ const delimiter2 = potentialDelimiters[i];
480
+ if (delimiter2.type === "closer") {
481
+ closerDelimiter = delimiter2;
482
+ break;
483
+ }
125
484
  }
126
- // ...(hooks.date && { date: hooks.date }),
127
- // ...(hooks.usergroup && { usergroup: hooks.usergroup }),
485
+ if (closerDelimiter == null)
486
+ return;
487
+ delimiter = {
488
+ type: "full",
489
+ startIndex: openerDelimiter.startIndex,
490
+ endIndex: closerDelimiter.endIndex,
491
+ thickness: closerDelimiter.endIndex - closerDelimiter.startIndex
492
+ };
128
493
  }
129
- });
130
- return (0, import_html_react_parser.default)(text_string, { trim: false });
494
+ }
495
+ function processSingleDelimiter(delimiter) {
496
+ const token = {
497
+ nodeType: SlackChannelMentionType,
498
+ startIndex: delimiter.startIndex,
499
+ endIndex: delimiter.endIndex,
500
+ thickness: delimiter.thickness
501
+ };
502
+ return [token];
503
+ }
504
+ };
505
+
506
+ // src/utils/markdown_parser/tokenizers/slack_channel_mention/parse.ts
507
+ var import_character4 = require("@yozora/character");
508
+ var parse2 = function(api) {
509
+ return {
510
+ parse: (tokens) => tokens.map((token) => {
511
+ const nodePoints = api.getNodePoints();
512
+ let startIndex = token.startIndex + 2;
513
+ let endIndex = token.endIndex - 1;
514
+ const value = (0, import_character4.calcStringFromNodePoints)(nodePoints, startIndex, endIndex);
515
+ const node = api.shouldReservePosition ? { type: SlackChannelMentionType, position: api.calcPosition(token), value } : { type: SlackChannelMentionType, value };
516
+ return node;
517
+ })
518
+ };
519
+ };
520
+
521
+ // src/utils/markdown_parser/tokenizers/slack_channel_mention/tokenizer.ts
522
+ var SlackChannelMentionTokenizer = class extends import_core_tokenizer4.BaseInlineTokenizer {
523
+ constructor(props = {}) {
524
+ super({
525
+ name: SlackChannelMentionType,
526
+ priority: props.priority || import_core_tokenizer4.TokenizerPriority.ATOMIC
527
+ });
528
+ this.match = match2;
529
+ this.parse = parse2;
530
+ }
531
+ };
532
+
533
+ // src/utils/markdown_parser/tokenizers/slack_user_group_mention/tokenizer.ts
534
+ var import_core_tokenizer6 = require("@yozora/core-tokenizer");
535
+
536
+ // src/utils/markdown_parser/tokenizers/slack_user_group_mention/match.ts
537
+ var import_character5 = require("@yozora/character");
538
+ var import_core_tokenizer5 = require("@yozora/core-tokenizer");
539
+
540
+ // src/utils/markdown_parser/tokenizers/slack_user_group_mention/types.ts
541
+ var SlackUserGroupMentionType = "slack_user_group_mention";
542
+
543
+ // src/utils/markdown_parser/tokenizers/slack_user_group_mention/match.ts
544
+ var match3 = function(api) {
545
+ return { findDelimiter, processSingleDelimiter };
546
+ function* findDelimiter() {
547
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
548
+ const nodePoints = api.getNodePoints();
549
+ const blockStartIndex = api.getBlockStartIndex();
550
+ const blockEndIndex = api.getBlockEndIndex();
551
+ const potentialDelimiters = [];
552
+ for (let i = blockStartIndex; i < blockEndIndex; ++i) {
553
+ const c = (_a = nodePoints[i]) == null ? void 0 : _a.codePoint;
554
+ if (c === import_character5.AsciiCodePoint.OPEN_ANGLE && ((_b = nodePoints[i + 1]) == null ? void 0 : _b.codePoint) === import_character5.AsciiCodePoint.EXCLAMATION_MARK && ((_c = nodePoints[i + 2]) == null ? void 0 : _c.codePoint) === import_character5.AsciiCodePoint.LOWERCASE_S && ((_d = nodePoints[i + 3]) == null ? void 0 : _d.codePoint) === import_character5.AsciiCodePoint.LOWERCASE_U && ((_e = nodePoints[i + 4]) == null ? void 0 : _e.codePoint) === import_character5.AsciiCodePoint.LOWERCASE_B && ((_f = nodePoints[i + 5]) == null ? void 0 : _f.codePoint) === import_character5.AsciiCodePoint.LOWERCASE_T && ((_g = nodePoints[i + 6]) == null ? void 0 : _g.codePoint) === import_character5.AsciiCodePoint.LOWERCASE_E && ((_h = nodePoints[i + 7]) == null ? void 0 : _h.codePoint) === import_character5.AsciiCodePoint.LOWERCASE_A && ((_i = nodePoints[i + 8]) == null ? void 0 : _i.codePoint) === import_character5.AsciiCodePoint.LOWERCASE_M && ((_j = nodePoints[i + 9]) == null ? void 0 : _j.codePoint) === import_character5.AsciiCodePoint.CARET) {
555
+ const j = (0, import_core_tokenizer5.eatOptionalCharacters)(nodePoints, i + 10, blockEndIndex, import_character5.AsciiCodePoint.CARET);
556
+ if (j < blockEndIndex) {
557
+ potentialDelimiters.push({
558
+ type: "opener",
559
+ startIndex: i,
560
+ endIndex: j
561
+ });
562
+ }
563
+ } else if (c === import_character5.AsciiCodePoint.CLOSE_ANGLE) {
564
+ potentialDelimiters.push({
565
+ type: "closer",
566
+ startIndex: i,
567
+ endIndex: i + 1
568
+ });
569
+ }
570
+ }
571
+ let pIndex = 0;
572
+ let lastEndIndex = -1;
573
+ let delimiter = null;
574
+ while (pIndex < potentialDelimiters.length) {
575
+ const [startIndex, endIndex] = yield delimiter;
576
+ if (lastEndIndex === endIndex) {
577
+ if (delimiter == null || delimiter.startIndex >= startIndex)
578
+ continue;
579
+ }
580
+ lastEndIndex = endIndex;
581
+ let openerDelimiter = null;
582
+ let closerDelimiter = null;
583
+ for (; pIndex < potentialDelimiters.length; ++pIndex) {
584
+ const delimiter2 = potentialDelimiters[pIndex];
585
+ if (delimiter2.startIndex >= startIndex && delimiter2.type !== "closer") {
586
+ openerDelimiter = delimiter2;
587
+ break;
588
+ }
589
+ }
590
+ for (let i = pIndex + 1; i < potentialDelimiters.length; ++i) {
591
+ const delimiter2 = potentialDelimiters[i];
592
+ if (delimiter2.type === "closer") {
593
+ closerDelimiter = delimiter2;
594
+ break;
595
+ }
596
+ }
597
+ if (closerDelimiter == null)
598
+ return;
599
+ delimiter = {
600
+ type: "full",
601
+ startIndex: openerDelimiter.startIndex,
602
+ endIndex: closerDelimiter.endIndex,
603
+ thickness: closerDelimiter.endIndex - closerDelimiter.startIndex
604
+ };
605
+ }
606
+ }
607
+ function processSingleDelimiter(delimiter) {
608
+ const token = {
609
+ nodeType: SlackUserGroupMentionType,
610
+ startIndex: delimiter.startIndex,
611
+ endIndex: delimiter.endIndex,
612
+ thickness: delimiter.thickness
613
+ };
614
+ return [token];
615
+ }
616
+ };
617
+
618
+ // src/utils/markdown_parser/tokenizers/slack_user_group_mention/parse.ts
619
+ var import_character6 = require("@yozora/character");
620
+ var parse3 = function(api) {
621
+ return {
622
+ parse: (tokens) => tokens.map((token) => {
623
+ const nodePoints = api.getNodePoints();
624
+ let startIndex = token.startIndex + 10;
625
+ let endIndex = token.endIndex - 1;
626
+ const value = (0, import_character6.calcStringFromNodePoints)(nodePoints, startIndex, endIndex);
627
+ const node = api.shouldReservePosition ? { type: SlackUserGroupMentionType, position: api.calcPosition(token), value } : { type: SlackUserGroupMentionType, value };
628
+ return node;
629
+ })
630
+ };
631
+ };
632
+
633
+ // src/utils/markdown_parser/tokenizers/slack_user_group_mention/tokenizer.ts
634
+ var SlackUserGroupMentionTokenizer = class extends import_core_tokenizer6.BaseInlineTokenizer {
635
+ constructor(props = {}) {
636
+ super({
637
+ name: SlackUserGroupMentionType,
638
+ priority: props.priority || import_core_tokenizer6.TokenizerPriority.ATOMIC
639
+ });
640
+ this.match = match3;
641
+ this.parse = parse3;
642
+ }
643
+ };
644
+
645
+ // src/utils/markdown_parser/tokenizers/slack_broadcast/tokenizer.ts
646
+ var import_core_tokenizer7 = require("@yozora/core-tokenizer");
647
+
648
+ // src/utils/markdown_parser/tokenizers/slack_broadcast/match.ts
649
+ var import_character7 = require("@yozora/character");
650
+
651
+ // src/utils/markdown_parser/tokenizers/slack_broadcast/types.ts
652
+ var SlackBroadcastType = "slack_broadcast";
653
+
654
+ // src/utils/markdown_parser/tokenizers/slack_broadcast/match.ts
655
+ var match4 = function(api) {
656
+ return { findDelimiter, processSingleDelimiter };
657
+ function* findDelimiter() {
658
+ var _a;
659
+ const nodePoints = api.getNodePoints();
660
+ const blockStartIndex = api.getBlockStartIndex();
661
+ const blockEndIndex = api.getBlockEndIndex();
662
+ const targets = ["@everyone", "@here", "@channel"];
663
+ const potentialDelimiters = [];
664
+ for (let i = blockStartIndex; i < blockEndIndex; ++i) {
665
+ if (((_a = nodePoints[i]) == null ? void 0 : _a.codePoint) === import_character7.AsciiCodePoint.AT_SIGN) {
666
+ for (const target of targets) {
667
+ if (matchTarget(nodePoints, i, target)) {
668
+ potentialDelimiters.push({
669
+ type: "full",
670
+ startIndex: i,
671
+ endIndex: i + target.length,
672
+ thickness: target.length
673
+ });
674
+ i += target.length - 1;
675
+ break;
676
+ }
677
+ }
678
+ }
679
+ }
680
+ let pIndex = 0;
681
+ let lastEndIndex = -1;
682
+ let currentDelimiter = null;
683
+ while (pIndex < potentialDelimiters.length) {
684
+ const [startIndex, endIndex] = yield currentDelimiter;
685
+ if (lastEndIndex === endIndex) {
686
+ if (currentDelimiter == null || currentDelimiter.startIndex >= startIndex)
687
+ continue;
688
+ }
689
+ lastEndIndex = endIndex;
690
+ for (; pIndex < potentialDelimiters.length; ++pIndex) {
691
+ const delimiter = potentialDelimiters[pIndex];
692
+ if (delimiter.startIndex >= startIndex) {
693
+ currentDelimiter = {
694
+ type: "full",
695
+ startIndex: delimiter.startIndex,
696
+ endIndex: delimiter.endIndex,
697
+ thickness: delimiter.thickness
698
+ };
699
+ break;
700
+ }
701
+ }
702
+ }
703
+ }
704
+ function matchTarget(nodePoints, startIndex, target) {
705
+ var _a;
706
+ for (let j = 0; j < target.length; ++j) {
707
+ if (((_a = nodePoints[startIndex + j]) == null ? void 0 : _a.codePoint) !== target.charCodeAt(j)) {
708
+ return false;
709
+ }
710
+ }
711
+ return true;
712
+ }
713
+ function processSingleDelimiter(delimiter) {
714
+ const token = {
715
+ nodeType: SlackBroadcastType,
716
+ startIndex: delimiter.startIndex,
717
+ endIndex: delimiter.endIndex,
718
+ thickness: delimiter.thickness
719
+ };
720
+ return [token];
721
+ }
722
+ };
723
+
724
+ // src/utils/markdown_parser/tokenizers/slack_broadcast/parse.ts
725
+ var import_character8 = require("@yozora/character");
726
+ var parse4 = function(api) {
727
+ return {
728
+ parse: (tokens) => tokens.map((token) => {
729
+ const nodePoints = api.getNodePoints();
730
+ let startIndex = token.startIndex + 1;
731
+ let endIndex = token.endIndex;
732
+ const value = (0, import_character8.calcStringFromNodePoints)(nodePoints, startIndex, endIndex);
733
+ const node = api.shouldReservePosition ? { type: SlackBroadcastType, position: api.calcPosition(token), value } : { type: SlackBroadcastType, value };
734
+ return node;
735
+ })
736
+ };
737
+ };
738
+
739
+ // src/utils/markdown_parser/tokenizers/slack_broadcast/tokenizer.ts
740
+ var SlackBroadcastTokenizer = class extends import_core_tokenizer7.BaseInlineTokenizer {
741
+ constructor(props = {}) {
742
+ super({
743
+ name: SlackBroadcastType,
744
+ priority: props.priority || import_core_tokenizer7.TokenizerPriority.ATOMIC
745
+ });
746
+ this.match = match4;
747
+ this.parse = parse4;
748
+ }
749
+ };
750
+
751
+ // src/utils/markdown_parser/parser.tsx
752
+ var import_jsx_runtime14 = require("react/jsx-runtime");
753
+ var parser = new import_parser.default().unmountTokenizer("@yozora/tokenizer-list").useTokenizer(new SlackUserMentionTokenizer()).useTokenizer(new SlackChannelMentionTokenizer()).useTokenizer(new SlackUserGroupMentionTokenizer()).useTokenizer(new SlackBroadcastTokenizer());
754
+ var markdown_parser = (markdown, options) => {
755
+ if (!markdown)
756
+ return null;
757
+ let text_string = markdown;
758
+ text_string = text_string.replace(/```/g, `
759
+ \`\`\`
760
+ `);
761
+ text_string = text_string.replace(new RegExp("(?<!\\*)\\*(?!\\*)([^*]+)\\*(?!\\*)", "g"), "**$1**");
762
+ text_string = text_string.replace(new RegExp("(?<!~)~(?!~)([^~]+)~(?!~)", "g"), "~~$1~~");
763
+ text_string = text_string.replace(/<([^|>]+)\|([^>]+)>/g, "[$2]($1)");
764
+ text_string = text_string.replace(/\n\n/g, "[[DOUBLE_LINE_BREAK]]");
765
+ text_string = text_string.replace(/<!here>/g, "@here");
766
+ text_string = text_string.replace(/<!everyone>/g, "@everyone");
767
+ text_string = text_string.replace(/<!channel>/g, "@channel");
768
+ const parsed_data = parser.parse(text_string);
769
+ const elements = parsed_data.children;
770
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: elements.map((element, i) => {
771
+ if (element.type === "paragraph")
772
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Paragraph, { element }, i);
773
+ if (element.type === "blockquote")
774
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blockquote, { element }, i);
775
+ if (element.type === "code")
776
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Code, { element }, i);
777
+ return null;
778
+ }) });
131
779
  };
132
780
 
133
781
  // src/utils/is_accessory_stacked.ts
@@ -180,21 +828,21 @@ var is_accessory_stacked = (element) => {
180
828
  };
181
829
 
182
830
  // src/header.tsx
183
- var import_jsx_runtime = require("react/jsx-runtime");
831
+ var import_jsx_runtime15 = require("react/jsx-runtime");
184
832
  var Header = (props) => {
185
833
  const { name, time } = props;
186
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-[5px] items-center w-full slack_blocks_to_jsx--header", children: [
187
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "font-black text-[15px]", children: name }),
188
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-[14px] w-[27px] leading-[12.5px] py-[1px] px-[3px] uppercase text-[10px] text-black-primary/[0.7] bg-black-primary/[0.13] font-semibold rounded-[2px] text-center", children: "APP" }),
189
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-xs text-black-secondary uppercase leading-[17.6px]", children: dateToTime(time) })
834
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-[5px] items-center w-full slack_blocks_to_jsx--header", children: [
835
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h3", { className: "font-black text-[15px]", children: name }),
836
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-[14px] w-[27px] leading-[12.5px] py-[1px] px-[3px] uppercase text-[10px] text-black-primary/[0.7] bg-black-primary/[0.13] font-semibold rounded-[2px] text-center", children: "APP" }),
837
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "text-xs text-black-secondary uppercase leading-[17.6px]", children: dateToTime(time) })
190
838
  ] });
191
839
  };
192
840
 
193
841
  // src/components/elements/image_element.tsx
194
- var import_jsx_runtime2 = require("react/jsx-runtime");
842
+ var import_jsx_runtime16 = require("react/jsx-runtime");
195
843
  var ImageElement = (props) => {
196
844
  const { alt_text, image_url } = props.data;
197
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
845
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
198
846
  "img",
199
847
  {
200
848
  src: image_url,
@@ -204,32 +852,8 @@ var ImageElement = (props) => {
204
852
  ) });
205
853
  };
206
854
 
207
- // src/store/useGlobalData.ts
208
- var import_zustand = require("zustand");
209
- var useBearStore = (0, import_zustand.create)((set) => ({
210
- users: [],
211
- channels: [],
212
- user_groups: [],
213
- hooks: {},
214
- setUsers: (users) => set({ users }),
215
- setChannels: (channels) => set({ channels }),
216
- setHooks: (hooks) => set({ hooks })
217
- }));
218
- var useGlobalData = () => {
219
- const { users, channels, user_groups, hooks, setChannels, setUsers, setHooks } = useBearStore();
220
- return {
221
- users,
222
- channels,
223
- user_groups,
224
- hooks,
225
- setChannels,
226
- setUsers,
227
- setHooks
228
- };
229
- };
230
-
231
855
  // src/components/composition_objects/text_object.tsx
232
- var import_jsx_runtime3 = require("react/jsx-runtime");
856
+ var import_jsx_runtime17 = require("react/jsx-runtime");
233
857
  var TextObject = (props) => {
234
858
  const { type, text, emoji, verbatim = false } = props.data;
235
859
  const { className = "" } = props;
@@ -237,15 +861,15 @@ var TextObject = (props) => {
237
861
  let emoji_parsed = type == "mrkdwn" ? parseEmojis(text) : emoji === false ? text : parseEmojis(text);
238
862
  emoji_parsed = emoji_parsed.replace(/&gt;/g, "> ").replace(/&lt;/g, "<");
239
863
  if (type === "plain_text")
240
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, children: slack_text_to_jsx(emoji_parsed, { markdown: false, users, channels, hooks }) });
241
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, children: slack_text_to_jsx(emoji_parsed, { markdown: true, users, channels, hooks }) });
864
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className, children: markdown_parser(emoji_parsed, { markdown: false, users, channels, hooks }) });
865
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className, children: markdown_parser(emoji_parsed, { markdown: true, users, channels, hooks }) });
242
866
  };
243
867
 
244
868
  // src/components/elements/button_element.tsx
245
- var import_jsx_runtime4 = require("react/jsx-runtime");
869
+ var import_jsx_runtime18 = require("react/jsx-runtime");
246
870
  var ButtonElement = (props) => {
247
871
  const { text, action_id, url, style, accessibility_label } = props.data;
248
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
872
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
249
873
  "button",
250
874
  {
251
875
  type: "button",
@@ -257,14 +881,14 @@ var ButtonElement = (props) => {
257
881
  window.open(url, "_blank");
258
882
  }
259
883
  },
260
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextObject, { data: text })
884
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TextObject, { data: text })
261
885
  }
262
886
  );
263
887
  };
264
888
 
265
889
  // src/components/elements/static_select_element.tsx
266
890
  var import_react = require("react");
267
- var import_jsx_runtime5 = require("react/jsx-runtime");
891
+ var import_jsx_runtime19 = require("react/jsx-runtime");
268
892
  var StaticSelectElement = (props) => {
269
893
  const {
270
894
  action_id,
@@ -299,20 +923,20 @@ var StaticSelectElement = (props) => {
299
923
  const results = option.text.text.toLowerCase().includes(search.toLowerCase());
300
924
  return results;
301
925
  }, []);
302
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
926
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
303
927
  "div",
304
928
  {
305
929
  id: action_id,
306
930
  className: "py-1 px-2 h-7 min-h-[28px] relative flex items-center justify-between rounded text-small w-[190px] border border-black-primary.3",
307
931
  tabIndex: 0,
308
932
  children: [
309
- visible && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
933
+ visible && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
310
934
  "div",
311
935
  {
312
936
  className: "absolute top-[24px] -left-3 bg-white-secondary border border-gray-primary rounded-[6px] shadow-custom_shadow-1 w-[322px] max-w-[322px] max-h-[240px] overflow-auto py-3 z-20",
313
937
  id: "static_select_popup",
314
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex flex-col", children: filteredOptions.map((option, i) => {
315
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
938
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-col", children: filteredOptions.map((option, i) => {
939
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
316
940
  "div",
317
941
  {
318
942
  className: "h-7 px-6 flex items-center select-none cursor-pointer hover:bg-blue-primary hover:text-white-primary",
@@ -321,14 +945,14 @@ var StaticSelectElement = (props) => {
321
945
  setVisible(false);
322
946
  setSelected(option.value);
323
947
  },
324
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TextObject, { data: option.text })
948
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TextObject, { data: option.text })
325
949
  },
326
950
  i
327
951
  );
328
952
  }) })
329
953
  }
330
954
  ),
331
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
955
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
332
956
  "input",
333
957
  {
334
958
  type: "text",
@@ -339,7 +963,7 @@ var StaticSelectElement = (props) => {
339
963
  "aria-label": "Select an item"
340
964
  }
341
965
  ),
342
- !search && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "absolute w-full h-full pointer-events-none flex items-center text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
966
+ !search && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "absolute w-full h-full pointer-events-none flex items-center text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
343
967
  TextObject,
344
968
  {
345
969
  data: placeholder != null ? placeholder : {
@@ -348,7 +972,7 @@ var StaticSelectElement = (props) => {
348
972
  }
349
973
  }
350
974
  ) }),
351
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
975
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
352
976
  "button",
353
977
  {
354
978
  type: "button",
@@ -357,7 +981,7 @@ var StaticSelectElement = (props) => {
357
981
  onClick: () => {
358
982
  setVisible((prev) => !prev);
359
983
  },
360
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
984
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
361
985
  "svg",
362
986
  {
363
987
  xmlns: "http://www.w3.org/2000/svg",
@@ -366,7 +990,7 @@ var StaticSelectElement = (props) => {
366
990
  strokeWidth: "3",
367
991
  stroke: "currentColor",
368
992
  className: "w-3 h-3",
369
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
993
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
370
994
  }
371
995
  )
372
996
  }
@@ -378,7 +1002,7 @@ var StaticSelectElement = (props) => {
378
1002
 
379
1003
  // src/components/elements/checkboxes_element.tsx
380
1004
  var import_react2 = require("react");
381
- var import_jsx_runtime6 = require("react/jsx-runtime");
1005
+ var import_jsx_runtime20 = require("react/jsx-runtime");
382
1006
  var CheckboxesElement = (props) => {
383
1007
  const { action_id, options, focus_on_load, initial_options } = props.data;
384
1008
  const [selected, setSelected] = (0, import_react2.useState)(
@@ -392,15 +1016,15 @@ var CheckboxesElement = (props) => {
392
1016
  input_ref.current.focus();
393
1017
  }
394
1018
  }, [focus_on_load]);
395
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { id: action_id, className: "my-1 flex w-full slack_blocks_to_jsx__checkboxes_element", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("fieldset", { className: "flex flex-col gap-2", children: options.map((option, i) => {
1019
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { id: action_id, className: "my-1 flex w-full slack_blocks_to_jsx__checkboxes_element", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("fieldset", { className: "flex flex-col gap-2", children: options.map((option, i) => {
396
1020
  const { text, value, description } = option;
397
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1021
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
398
1022
  "label",
399
1023
  {
400
1024
  className: "flex cursor-pointer items-baseline gap-3 select-none",
401
1025
  htmlFor: `checkboxes-${action_id}-value-${value}-${i}`,
402
1026
  children: [
403
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1027
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
404
1028
  "input",
405
1029
  {
406
1030
  type: "checkbox",
@@ -416,9 +1040,9 @@ var CheckboxesElement = (props) => {
416
1040
  }
417
1041
  }
418
1042
  ) }),
419
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
420
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TextObject, { data: text }),
421
- description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TextObject, { className: "text-black-secondary", data: description })
1043
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
1044
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TextObject, { data: text }),
1045
+ description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TextObject, { className: "text-black-secondary", data: description })
422
1046
  ] })
423
1047
  ]
424
1048
  }
@@ -428,7 +1052,7 @@ var CheckboxesElement = (props) => {
428
1052
 
429
1053
  // src/components/elements/plain_text_input.tsx
430
1054
  var import_react3 = require("react");
431
- var import_jsx_runtime7 = require("react/jsx-runtime");
1055
+ var import_jsx_runtime21 = require("react/jsx-runtime");
432
1056
  var PlaintTextInput = (props) => {
433
1057
  const {
434
1058
  action_id,
@@ -456,15 +1080,15 @@ var PlaintTextInput = (props) => {
456
1080
  document.removeEventListener("mousedown", handleClickOutside);
457
1081
  };
458
1082
  }, []);
459
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1083
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
460
1084
  "div",
461
1085
  {
462
1086
  id: action_id,
463
1087
  className: "relative text-small w-full slack_blocks_to_jsx__plain_text_input_element",
464
1088
  tabIndex: 0,
465
1089
  children: [
466
- !value && placeholder && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute left-2 top-2 text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TextObject, { data: placeholder }) }),
467
- !value && !placeholder && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute left-2 top-2 text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1090
+ !value && placeholder && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "absolute left-2 top-2 text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TextObject, { data: placeholder }) }),
1091
+ !value && !placeholder && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "absolute left-2 top-2 text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
468
1092
  TextObject,
469
1093
  {
470
1094
  data: {
@@ -473,7 +1097,7 @@ var PlaintTextInput = (props) => {
473
1097
  }
474
1098
  }
475
1099
  ) }),
476
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1100
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
477
1101
  "textarea",
478
1102
  {
479
1103
  value,
@@ -496,7 +1120,7 @@ var PlaintTextInput = (props) => {
496
1120
 
497
1121
  // src/components/elements/users_select_element.tsx
498
1122
  var import_react4 = require("react");
499
- var import_jsx_runtime8 = require("react/jsx-runtime");
1123
+ var import_jsx_runtime22 = require("react/jsx-runtime");
500
1124
  var UsersSelectElement = (props) => {
501
1125
  const { action_id, focus_on_load, placeholder, type, confirm, initial_user, people } = props.data;
502
1126
  const [visible, setVisible] = (0, import_react4.useState)(focus_on_load || false);
@@ -521,20 +1145,20 @@ var UsersSelectElement = (props) => {
521
1145
  const name = person.name.toLowerCase();
522
1146
  return name.includes(search_query);
523
1147
  }, []);
524
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1148
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
525
1149
  "div",
526
1150
  {
527
1151
  id: action_id,
528
1152
  className: "py-1 px-2 h-7 min-h-[28px] relative flex items-center justify-between rounded text-small w-[190px] border border-black-primary.3 slack_blocks_to_jsx__users_select_element",
529
1153
  tabIndex: 0,
530
1154
  children: [
531
- visible && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1155
+ visible && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
532
1156
  "div",
533
1157
  {
534
1158
  className: "absolute top-[24px] -left-3 bg-white-secondary border border-gray-primary rounded-[6px] shadow-custom_shadow-1 w-[322px] max-w-[322px] max-h-[240px] overflow-auto py-3 z-20",
535
1159
  id: "static_select_popup",
536
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col", children: filteredOptions.map((option, i) => {
537
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1160
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-col", children: filteredOptions.map((option, i) => {
1161
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
538
1162
  "button",
539
1163
  {
540
1164
  className: "h-7 px-6 flex group items-center gap-2 select-none cursor-pointer hover:bg-blue-primary hover:text-white-primary",
@@ -545,7 +1169,7 @@ var UsersSelectElement = (props) => {
545
1169
  setSelected(option.id);
546
1170
  },
547
1171
  children: [
548
- option.image && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1172
+ option.image && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
549
1173
  "img",
550
1174
  {
551
1175
  src: option.image,
@@ -553,8 +1177,8 @@ var UsersSelectElement = (props) => {
553
1177
  className: "w-5 h-5 rounded-md overflow-hidden"
554
1178
  }
555
1179
  ),
556
- !option.image && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-5 h-5 rounded-md overflow-hidden bg-gray-300 text-black-primary font-semibold flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: option.name[0] || "" }) }),
557
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1180
+ !option.image && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-5 h-5 rounded-md overflow-hidden bg-gray-300 text-black-primary font-semibold flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: option.name[0] || "" }) }),
1181
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
558
1182
  TextObject,
559
1183
  {
560
1184
  data: {
@@ -563,17 +1187,17 @@ var UsersSelectElement = (props) => {
563
1187
  }
564
1188
  }
565
1189
  ),
566
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
567
- option.online && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1190
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
1191
+ option.online && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
568
1192
  "div",
569
1193
  {
570
1194
  className: `bg-green-secondary w-[9px] h-[9px] rounded-full shrink-0`
571
1195
  }
572
1196
  ),
573
- !option.online && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-[9px] h-[9px] rounded-full border-[1.5px] shrink-0 border-black-secondary group-hover:border-white-primary" }),
574
- option.sleeping && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute -top-[5px] -right-[5px] h-[10px] w-[10px] rounded-full bg-white-secondary flex justify-center z-[10] text-[8px] leading-[8px] font-semibold group-hover:bg-blue-primary", children: "z" })
1197
+ !option.online && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-[9px] h-[9px] rounded-full border-[1.5px] shrink-0 border-black-secondary group-hover:border-white-primary" }),
1198
+ option.sleeping && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "absolute -top-[5px] -right-[5px] h-[10px] w-[10px] rounded-full bg-white-secondary flex justify-center z-[10] text-[8px] leading-[8px] font-semibold group-hover:bg-blue-primary", children: "z" })
575
1199
  ] }),
576
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-black-primary group-hover:text-white-primary", children: option.name })
1200
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "text-black-primary group-hover:text-white-primary", children: option.name })
577
1201
  ]
578
1202
  },
579
1203
  i
@@ -581,7 +1205,7 @@ var UsersSelectElement = (props) => {
581
1205
  }) })
582
1206
  }
583
1207
  ),
584
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1208
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
585
1209
  "input",
586
1210
  {
587
1211
  type: "text",
@@ -593,7 +1217,7 @@ var UsersSelectElement = (props) => {
593
1217
  "aria-label": "Select an item"
594
1218
  }
595
1219
  ),
596
- !search && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute w-full h-full pointer-events-none flex items-center text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1220
+ !search && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "absolute w-full h-full pointer-events-none flex items-center text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
597
1221
  TextObject,
598
1222
  {
599
1223
  data: placeholder != null ? placeholder : {
@@ -602,7 +1226,7 @@ var UsersSelectElement = (props) => {
602
1226
  }
603
1227
  }
604
1228
  ) }),
605
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1229
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
606
1230
  "button",
607
1231
  {
608
1232
  type: "button",
@@ -611,7 +1235,7 @@ var UsersSelectElement = (props) => {
611
1235
  onClick: () => {
612
1236
  setVisible((prev) => !prev);
613
1237
  },
614
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1238
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
615
1239
  "svg",
616
1240
  {
617
1241
  xmlns: "http://www.w3.org/2000/svg",
@@ -620,7 +1244,7 @@ var UsersSelectElement = (props) => {
620
1244
  strokeWidth: "3",
621
1245
  stroke: "currentColor",
622
1246
  className: "w-3 h-3",
623
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
1247
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
624
1248
  }
625
1249
  )
626
1250
  }
@@ -631,52 +1255,52 @@ var UsersSelectElement = (props) => {
631
1255
  };
632
1256
 
633
1257
  // src/components/blocks/actions.tsx
634
- var import_jsx_runtime9 = require("react/jsx-runtime");
1258
+ var import_jsx_runtime23 = require("react/jsx-runtime");
635
1259
  var Actions = (props) => {
636
1260
  const { elements, block_id } = props.data;
637
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1261
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
638
1262
  "div",
639
1263
  {
640
1264
  id: block_id,
641
1265
  className: "mb-2 text-primary flex w-full text-black-primary items-center slack_blocks_to_jsx__actions",
642
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-wrap", children: elements.map((element, i) => {
1266
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-wrap", children: elements.map((element, i) => {
643
1267
  if (element.type === "button") {
644
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-2 mr-2", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ButtonElement, { data: element }) }, i);
1268
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-2 mr-2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ButtonElement, { data: element }) }, i);
645
1269
  }
646
1270
  if (element.type === "static_select") {
647
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-2 mr-2", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StaticSelectElement, { data: element }) }, i);
1271
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-2 mr-2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StaticSelectElement, { data: element }) }, i);
648
1272
  }
649
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-2 mr-2" }, i);
1273
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-2 mr-2" }, i);
650
1274
  }) })
651
1275
  }
652
1276
  );
653
1277
  };
654
1278
 
655
1279
  // src/components/blocks/context.tsx
656
- var import_jsx_runtime10 = require("react/jsx-runtime");
1280
+ var import_jsx_runtime24 = require("react/jsx-runtime");
657
1281
  var Context = (props) => {
658
1282
  const { elements, block_id } = props.data;
659
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1283
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
660
1284
  "div",
661
1285
  {
662
1286
  id: block_id,
663
1287
  className: "my-1 text-primary flex w-full text-black-primary flex-wrap items-center overflow-hidden slack_blocks_to_jsx__context",
664
1288
  children: elements.slice(0, 10).map((element, i) => {
665
1289
  if (element.type !== "image") {
666
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-black-secondary text-small pr-3 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TextObject, { data: element }) }, i);
1290
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-black-secondary text-small pr-3 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TextObject, { data: element }) }, i);
667
1291
  }
668
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageElement, { data: element }) }, i);
1292
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ImageElement, { data: element }) }, i);
669
1293
  })
670
1294
  }
671
1295
  );
672
1296
  };
673
1297
 
674
1298
  // src/components/blocks/divider.tsx
675
- var import_jsx_runtime11 = require("react/jsx-runtime");
1299
+ var import_jsx_runtime25 = require("react/jsx-runtime");
676
1300
  var Divider = (props) => {
677
1301
  const { data } = props;
678
1302
  const { block_id } = data;
679
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1303
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
680
1304
  "div",
681
1305
  {
682
1306
  id: block_id,
@@ -699,23 +1323,23 @@ var Header2 = (props) => {
699
1323
 
700
1324
  // src/components/blocks/image.tsx
701
1325
  var import_react5 = require("react");
702
- var import_jsx_runtime12 = require("react/jsx-runtime");
1326
+ var import_jsx_runtime26 = require("react/jsx-runtime");
703
1327
  var Image = (props) => {
704
1328
  const { block_id, alt_text, image_url, image_bytes, image_height, image_width } = props.data;
705
1329
  const [showImage, setShowImage] = (0, import_react5.useState)(true);
706
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { id: block_id, className: "my-2 flex flex-col gap-2 slack_blocks_to_jsx__image", children: [
707
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-black-secondary text-small flex gap-1 items-center", children: [
708
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
1330
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { id: block_id, className: "my-2 flex flex-col gap-2 slack_blocks_to_jsx__image", children: [
1331
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "text-black-secondary text-small flex gap-1 items-center", children: [
1332
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
709
1333
  alt_text,
710
1334
  image_bytes && ` (${Math.round(image_bytes / 1e3)} kB)`
711
1335
  ] }),
712
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1336
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
713
1337
  "button",
714
1338
  {
715
1339
  type: "button",
716
1340
  className: "w-[15px] h-[15px]",
717
1341
  onClick: () => setShowImage((prev) => !prev),
718
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1342
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
719
1343
  "svg",
720
1344
  {
721
1345
  xmlns: "http://www.w3.org/2000/svg",
@@ -731,7 +1355,7 @@ var Image = (props) => {
731
1355
  style: {
732
1356
  transform: showImage ? "rotate(0deg)" : "rotate(-90deg)"
733
1357
  },
734
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1358
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
735
1359
  "path",
736
1360
  {
737
1361
  fill: "currentColor",
@@ -744,7 +1368,7 @@ var Image = (props) => {
744
1368
  }
745
1369
  )
746
1370
  ] }),
747
- showImage && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "rounded-md overflow-hidden relative max-w-max", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1371
+ showImage && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "rounded-md overflow-hidden relative max-w-max", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
748
1372
  "img",
749
1373
  {
750
1374
  src: image_url,
@@ -759,17 +1383,17 @@ var Image = (props) => {
759
1383
  };
760
1384
 
761
1385
  // src/components/blocks/input.tsx
762
- var import_jsx_runtime13 = require("react/jsx-runtime");
1386
+ var import_jsx_runtime27 = require("react/jsx-runtime");
763
1387
  var Input = (props) => {
764
1388
  const { element: given_element, label, block_id, hint, optional, type } = props.data;
765
1389
  const element = given_element ? getElementComponent(given_element) : null;
766
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1390
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
767
1391
  "div",
768
1392
  {
769
1393
  id: block_id,
770
1394
  className: `mt-2 mb-1 text-primary slack_blocks_to_jsx__input flex w-full text-black-primary`,
771
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "grow", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-2", children: [
772
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1395
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grow", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2", children: [
1396
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
773
1397
  TextObject,
774
1398
  {
775
1399
  data: {
@@ -780,11 +1404,11 @@ var Input = (props) => {
780
1404
  }
781
1405
  }
782
1406
  ),
783
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mb-1 flex flex-col gap-1", children: [
784
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "relative shrink-0", children: element }),
785
- (hint || given_element.type === "plain_text_input") && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "text-black-secondary text-small flex gap-1", children: [
786
- hint && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "inline", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TextObject, { data: hint }) }),
787
- given_element.type === "plain_text_input" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: "\u21B5 Please 'enter' to submit" })
1407
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "mb-1 flex flex-col gap-1", children: [
1408
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "relative shrink-0", children: element }),
1409
+ (hint || given_element.type === "plain_text_input") && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "text-black-secondary text-small flex gap-1", children: [
1410
+ hint && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "inline", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TextObject, { data: hint }) }),
1411
+ given_element.type === "plain_text_input" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { children: "\u21B5 Please 'enter' to submit" })
788
1412
  ] })
789
1413
  ] })
790
1414
  ] }) })
@@ -793,25 +1417,30 @@ var Input = (props) => {
793
1417
  };
794
1418
 
795
1419
  // src/components/blocks/rich_text/rich_text_list_wrapper.tsx
796
- var import_jsx_runtime14 = require("react/jsx-runtime");
1420
+ var import_jsx_runtime28 = require("react/jsx-runtime");
797
1421
  var RichTextListWrapper = (props) => {
798
1422
  const _a = props, { element, children } = _a, rest = __objRest(_a, ["element", "children"]);
799
1423
  if (element.style === "bullet") {
800
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", __spreadProps(__spreadValues({}, rest), { children }));
1424
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", __spreadProps(__spreadValues({}, rest), { children }));
801
1425
  }
802
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ol", __spreadProps(__spreadValues({}, rest), { children }));
1426
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ol", __spreadProps(__spreadValues({}, rest), { children }));
803
1427
  };
804
1428
 
805
1429
  // src/components/blocks/rich_text/rich_text_section_broadcast.tsx
806
- var import_jsx_runtime15 = require("react/jsx-runtime");
1430
+ var import_jsx_runtime29 = require("react/jsx-runtime");
807
1431
  var RichTextSectionBroadcast = (props) => {
808
1432
  const { range, style } = props;
809
1433
  const { hooks } = useGlobalData();
810
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
811
- "div",
1434
+ if (range === "channel" && hooks.atChannel)
1435
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: hooks.atChannel() });
1436
+ if (range === "everyone" && hooks.atEveryone)
1437
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: hooks.atEveryone() });
1438
+ if (range === "here" && hooks.atHere)
1439
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: hooks.atHere() });
1440
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
1441
+ "span",
812
1442
  {
813
1443
  className: `
814
- inline-block
815
1444
  slack_broadcast
816
1445
  slack_blocks_to_jsx__rich_text_section_element_broadcast
817
1446
  ${(style == null ? void 0 : style.italic) ? "italic" : ""}
@@ -819,121 +1448,122 @@ var RichTextSectionBroadcast = (props) => {
819
1448
  ${(style == null ? void 0 : style.bold) ? "font-medium" : ""}
820
1449
  `,
821
1450
  children: [
822
- range === "channel" && (hooks.atChannel ? hooks.atChannel() : `@${range}`),
823
- range === "everyone" && (hooks.atEveryone ? hooks.atEveryone() : `@${range}`),
824
- range === "here" && (hooks.atHere ? hooks.atHere() : `@${range}`)
1451
+ "@",
1452
+ range
825
1453
  ]
826
1454
  }
827
1455
  );
828
1456
  };
829
1457
 
830
1458
  // src/components/blocks/rich_text/rich_text_section_channel.tsx
831
- var import_jsx_runtime16 = require("react/jsx-runtime");
1459
+ var import_jsx_runtime30 = require("react/jsx-runtime");
832
1460
  var RichTextSectionChannel = (props) => {
833
1461
  const { channel_id, style } = props;
834
1462
  const { channels, hooks } = useGlobalData();
835
- const channel = channels.find((u) => u.id === channel_id);
1463
+ const channel = channels.find((u) => u.id === channel_id || u.name === channel_id);
836
1464
  const label = (channel == null ? void 0 : channel.name) || channel_id;
837
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
838
- "div",
1465
+ if (hooks.channel)
1466
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: hooks.channel(channel || { id: channel_id, name: label }) });
1467
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
1468
+ "span",
839
1469
  {
840
- "data-channel-id": channel_id,
1470
+ "data-channel-id": (channel == null ? void 0 : channel.id) || channel_id,
841
1471
  className: `
842
- inline-block
843
1472
  slack_channel
844
1473
  slack_blocks_to_jsx__rich_text_section_element_channel
845
1474
  ${(style == null ? void 0 : style.italic) ? "italic" : ""}
846
1475
  ${(style == null ? void 0 : style.strike) ? "line-through" : ""}
847
1476
  ${(style == null ? void 0 : style.bold) ? "font-medium" : ""}
848
1477
  `,
849
- children: hooks.user ? hooks.user(
850
- channel || {
851
- id: channel_id,
852
- name: label
853
- }
854
- ) : `#${label}`
1478
+ children: [
1479
+ "#",
1480
+ label
1481
+ ]
855
1482
  }
856
1483
  );
857
1484
  };
858
1485
 
859
1486
  // src/components/blocks/rich_text/rich_text_section_emoji.tsx
860
- var import_jsx_runtime17 = require("react/jsx-runtime");
1487
+ var import_jsx_runtime31 = require("react/jsx-runtime");
861
1488
  var RichTextSectionEmoji = (props) => {
862
1489
  const { name } = props;
863
1490
  const { hooks } = useGlobalData();
864
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "slack_blocks_to_jsx__rich_text_section_element_emoji", children: hooks.emoji ? hooks.emoji(name) : parseEmojis(`:${name}:`) });
1491
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "slack_blocks_to_jsx__rich_text_section_element_emoji", children: hooks.emoji ? hooks.emoji(name) : parseEmojis(`:${name}:`) });
865
1492
  };
866
1493
 
867
1494
  // src/components/blocks/rich_text/rich_text_section_user.tsx
868
- var import_jsx_runtime18 = require("react/jsx-runtime");
1495
+ var import_jsx_runtime32 = require("react/jsx-runtime");
869
1496
  var RichTextSectionUser = (props) => {
870
1497
  const { user_id, style } = props;
871
1498
  const { users, hooks } = useGlobalData();
872
- const user = users.find((u) => u.id === user_id);
1499
+ const user = users.find((u) => u.id === user_id || u.name === user_id);
873
1500
  const label = (user == null ? void 0 : user.name) || user_id;
874
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
875
- "div",
1501
+ if (hooks.user)
1502
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: hooks.user(user || { id: user_id, name: label }) });
1503
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
1504
+ "span",
876
1505
  {
877
- "data-user-id": user_id,
1506
+ "data-user-id": (user == null ? void 0 : user.id) || user_id,
878
1507
  className: `
879
- inline-block
880
1508
  slack_user
881
1509
  slack_blocks_to_jsx__rich_text_section_element_user
882
1510
  ${(style == null ? void 0 : style.italic) ? "italic" : ""}
883
1511
  ${(style == null ? void 0 : style.strike) ? "line-through" : ""}
884
1512
  ${(style == null ? void 0 : style.bold) ? "font-medium" : ""}
885
1513
  `,
886
- children: hooks.user ? hooks.user(
887
- user || {
888
- id: user_id,
889
- name: label
890
- }
891
- ) : `@${label}`
1514
+ children: [
1515
+ "@",
1516
+ label
1517
+ ]
892
1518
  }
893
1519
  );
894
1520
  };
895
1521
 
896
1522
  // src/components/blocks/rich_text/rich_text_section_user_group.tsx
897
- var import_jsx_runtime19 = require("react/jsx-runtime");
1523
+ var import_jsx_runtime33 = require("react/jsx-runtime");
898
1524
  var RichTextSectionUserGroup = (props) => {
899
1525
  const { usergroup_id, style } = props;
900
1526
  const { user_groups, hooks } = useGlobalData();
901
- const group = user_groups.find((u) => u.id === usergroup_id);
1527
+ const group = user_groups.find((u) => u.id === usergroup_id || u.name === usergroup_id);
902
1528
  const label = (group == null ? void 0 : group.name) || usergroup_id;
903
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
904
- "div",
1529
+ if (hooks.usergroup)
1530
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: hooks.usergroup(group || { id: usergroup_id, name: label }) });
1531
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
1532
+ "span",
905
1533
  {
906
- "data-usergroup-id": usergroup_id,
1534
+ "data-usergroup-id": (group == null ? void 0 : group.id) || usergroup_id,
907
1535
  className: `
908
- inline-block
909
1536
  slack_user_group
910
1537
  slack_blocks_to_jsx__rich_text_section_element_user_group
911
1538
  ${(style == null ? void 0 : style.italic) ? "italic" : ""}
912
1539
  ${(style == null ? void 0 : style.strike) ? "line-through" : ""}
913
1540
  ${(style == null ? void 0 : style.bold) ? "font-medium" : ""}
914
1541
  `,
915
- children: hooks.usergroup ? hooks.usergroup(usergroup_id) : `@${label}`
1542
+ children: [
1543
+ "@",
1544
+ label
1545
+ ]
916
1546
  }
917
1547
  );
918
1548
  };
919
1549
 
920
1550
  // src/components/blocks/rich_text/rich_text_section.tsx
921
- var import_jsx_runtime20 = require("react/jsx-runtime");
1551
+ var import_jsx_runtime34 = require("react/jsx-runtime");
922
1552
  var RichTextSectionElement = (props) => {
923
1553
  const { element } = props;
924
1554
  if (element.type === "user")
925
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RichTextSectionUser, __spreadValues({}, element));
1555
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RichTextSectionUser, __spreadValues({}, element));
926
1556
  if (element.type === "channel")
927
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RichTextSectionChannel, __spreadValues({}, element));
1557
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RichTextSectionChannel, __spreadValues({}, element));
928
1558
  if (element.type === "broadcast")
929
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RichTextSectionBroadcast, __spreadValues({}, element));
1559
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RichTextSectionBroadcast, __spreadValues({}, element));
930
1560
  if (element.type === "emoji")
931
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RichTextSectionEmoji, __spreadValues({}, element));
1561
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RichTextSectionEmoji, __spreadValues({}, element));
932
1562
  if (element.type === "usergroup")
933
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RichTextSectionUserGroup, __spreadValues({}, element));
1563
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RichTextSectionUserGroup, __spreadValues({}, element));
934
1564
  if (element.type === "text") {
935
1565
  const { text, style } = element;
936
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1566
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
937
1567
  "span",
938
1568
  {
939
1569
  className: `
@@ -949,7 +1579,7 @@ var RichTextSectionElement = (props) => {
949
1579
  }
950
1580
  if (element.type === "link") {
951
1581
  const { url, style, text } = element;
952
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1582
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
953
1583
  "a",
954
1584
  {
955
1585
  target: "_blank",
@@ -971,21 +1601,21 @@ var RichTextSectionElement = (props) => {
971
1601
  };
972
1602
 
973
1603
  // src/components/blocks/rich_text/rich_text.tsx
974
- var import_jsx_runtime21 = require("react/jsx-runtime");
1604
+ var import_jsx_runtime35 = require("react/jsx-runtime");
975
1605
  var RichText = (props) => {
976
1606
  const { elements, block_id } = props.data;
977
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { id: block_id, className: "slack_blocks_to_jsx__rich_text", children: elements.map((element, i) => {
978
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Element, { element }, `${element.type}__${i}`);
1607
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { id: block_id, className: "slack_blocks_to_jsx__rich_text", children: elements.map((element, i) => {
1608
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Element, { element }, `${element.type}__${i}`);
979
1609
  }) });
980
1610
  };
981
1611
  var Element = (props) => {
982
1612
  const { element } = props;
983
1613
  if (element.type === "rich_text_list") {
984
1614
  const { elements, style, border = 0, indent, offset } = element;
985
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-2 slack_blocks_to_jsx__rich_text_list_element", children: [
986
- border === 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
987
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RichTextListWrapper, { element, className: `list-none`, children: elements.map((el, i) => {
988
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1615
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-2 slack_blocks_to_jsx__rich_text_list_element", children: [
1616
+ border === 1 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
1617
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RichTextListWrapper, { element, className: `list-none`, children: elements.map((el, i) => {
1618
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
989
1619
  "li",
990
1620
  {
991
1621
  className: "flex",
@@ -993,22 +1623,22 @@ var Element = (props) => {
993
1623
  marginLeft: indent ? indent > 5 ? 0 : indent * 28 + 6 + 28 : 0
994
1624
  },
995
1625
  children: [
996
- style === "ordered" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "w-[22px] h-[22px] shrink-0 flex items-center justify-center", children: [
1626
+ style === "ordered" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "w-[22px] h-[22px] shrink-0 flex items-center justify-center", children: [
997
1627
  i + 1,
998
1628
  "."
999
1629
  ] }),
1000
- style === "bullet" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "w-[22px] h-[22px] shrink-0 flex items-center justify-center", children: [
1001
- (indent === void 0 || indent === 0 || indent === 3 || indent === 6) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-1.5 h-1.5 rounded-full bg-current" }),
1002
- (indent === 1 || indent === 4 || indent === 7) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-1.5 h-1.5 rounded-full border border-current" }),
1003
- (indent === 2 || indent === 5 || indent === 8) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-1.5 h-1.5 rounded-[1.5px] bg-current" })
1630
+ style === "bullet" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "w-[22px] h-[22px] shrink-0 flex items-center justify-center", children: [
1631
+ (indent === void 0 || indent === 0 || indent === 3 || indent === 6) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-1.5 h-1.5 rounded-full bg-current" }),
1632
+ (indent === 1 || indent === 4 || indent === 7) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-1.5 h-1.5 rounded-full border border-current" }),
1633
+ (indent === 2 || indent === 5 || indent === 8) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-1.5 h-1.5 rounded-[1.5px] bg-current" })
1004
1634
  ] }),
1005
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1635
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
1006
1636
  "div",
1007
1637
  {
1008
1638
  style: {
1009
1639
  marginLeft: 6
1010
1640
  },
1011
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Element, { element: el }, `${element.type}__${i}`)
1641
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Element, { element: el }, `${element.type}__${i}`)
1012
1642
  }
1013
1643
  )
1014
1644
  ]
@@ -1020,9 +1650,9 @@ var Element = (props) => {
1020
1650
  }
1021
1651
  if (element.type === "rich_text_preformatted") {
1022
1652
  const { elements, border } = element;
1023
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("code", { className: "flex gap-2 w-full slack_blocks_to_jsx__rich_text_preformatted_element", children: [
1024
- border === 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
1025
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1653
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("code", { className: "flex gap-2 w-full slack_blocks_to_jsx__rich_text_preformatted_element", children: [
1654
+ border === 1 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
1655
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
1026
1656
  "pre",
1027
1657
  {
1028
1658
  className: "p-2 rounded my-1 whitespace-pre-wrap bg-gray-secondary text-xs leading-[1.50001] border grow",
@@ -1031,7 +1661,7 @@ var Element = (props) => {
1031
1661
  wordBreak: "normal"
1032
1662
  },
1033
1663
  children: elements.map((el, i) => {
1034
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
1664
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
1035
1665
  })
1036
1666
  }
1037
1667
  )
@@ -1039,88 +1669,152 @@ var Element = (props) => {
1039
1669
  }
1040
1670
  if (element.type === "rich_text_quote") {
1041
1671
  const { elements, border } = element;
1042
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("blockquote", { className: "flex gap-2 slack_blocks_to_jsx__rich_text_quote_element", children: [
1043
- border === 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
1672
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("blockquote", { className: "flex gap-2 slack_blocks_to_jsx__rich_text_quote_element", children: [
1673
+ border === 1 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
1044
1674
  elements.map((el, i) => {
1045
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
1675
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
1046
1676
  })
1047
1677
  ] });
1048
1678
  }
1049
1679
  if (element.type === "rich_text_section") {
1050
1680
  const { elements } = element;
1051
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "inline-block slack_blocks_to_jsx__rich_text_section_element", children: elements.map((el, i) => {
1052
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
1681
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "inline-block slack_blocks_to_jsx__rich_text_section_element", children: elements.map((el, i) => {
1682
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
1053
1683
  }) });
1054
1684
  }
1055
1685
  return null;
1056
1686
  };
1057
1687
 
1058
1688
  // src/components/blocks/section.tsx
1059
- var import_jsx_runtime22 = require("react/jsx-runtime");
1689
+ var import_jsx_runtime36 = require("react/jsx-runtime");
1060
1690
  var Section = (props) => {
1061
1691
  const { accessory, fields, text, block_id } = props.data;
1062
1692
  const element = accessory ? getElementComponent(accessory) : null;
1063
1693
  const is_stacked = accessory ? is_accessory_stacked(accessory) : false;
1064
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1694
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
1065
1695
  "div",
1066
1696
  {
1067
1697
  id: block_id,
1068
1698
  className: `mt-2 mb-1 text-primary slack_blocks_to_jsx__section flex w-full text-black-primary ${is_stacked ? "flex-col" : ""}`,
1069
1699
  children: [
1070
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grow", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-3", children: [
1071
- text && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TextObject, { data: text }),
1072
- fields && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grid grid-col-2 w-full", children: fields.map((field, i) => {
1073
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TextObject, { data: field }, i);
1700
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "grow", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3", children: [
1701
+ text && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TextObject, { data: text }),
1702
+ fields && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "grid grid-col-2 w-full", children: fields.map((field, i) => {
1703
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TextObject, { data: field }, i);
1074
1704
  }) })
1075
1705
  ] }) }),
1076
- element && is_stacked ? element : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "ml-2 mb-1 relative shrink-0", children: element })
1706
+ element && is_stacked ? element : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ml-2 mb-1 relative shrink-0", children: element })
1077
1707
  ]
1078
1708
  }
1079
1709
  );
1080
1710
  };
1081
1711
 
1082
1712
  // src/components/blocks/video.tsx
1713
+ var import_react6 = require("react");
1714
+ var import_jsx_runtime37 = require("react/jsx-runtime");
1083
1715
  var Video = (props) => {
1084
- const { type } = props.data;
1085
- return null;
1716
+ const {
1717
+ // thumbnail_url,
1718
+ // provider_icon_url,
1719
+ // provider_name,
1720
+ //
1721
+ alt_text,
1722
+ title,
1723
+ video_url,
1724
+ author_name,
1725
+ block_id,
1726
+ description,
1727
+ title_url,
1728
+ iframeProps = {}
1729
+ } = props.data;
1730
+ const [showVideo, setShowVideo] = (0, import_react6.useState)(true);
1731
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "py-2 slack_blocks_to_jsx__video", id: block_id, children: [
1732
+ author_name && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "slack_blocks_to_jsx__video_author", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "font-bold", children: "Manish Panwar" }) }),
1733
+ description && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "slack_blocks_to_jsx__video_description", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TextObject, { data: description }) }),
1734
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-1 slack_blocks_to_jsx__video_title", children: [
1735
+ title_url ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("a", { href: title_url, className: "text-blue-primary", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TextObject, { data: title }) }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TextObject, { data: title }) }),
1736
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1737
+ "button",
1738
+ {
1739
+ type: "button",
1740
+ className: "w-[15px] h-[15px]",
1741
+ onClick: () => setShowVideo((prev) => !prev),
1742
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1743
+ "svg",
1744
+ {
1745
+ xmlns: "http://www.w3.org/2000/svg",
1746
+ fillRule: "evenodd",
1747
+ clipRule: "evenodd",
1748
+ className: "text-blue-primary",
1749
+ imageRendering: "optimizeQuality",
1750
+ shapeRendering: "geometricPrecision",
1751
+ textRendering: "geometricPrecision",
1752
+ viewBox: "0 0 512 336.36",
1753
+ width: 6,
1754
+ height: 6,
1755
+ style: {
1756
+ transform: showVideo ? "rotate(0deg)" : "rotate(-90deg)"
1757
+ },
1758
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1759
+ "path",
1760
+ {
1761
+ fill: "currentColor",
1762
+ fillRule: "nonzero",
1763
+ d: "M42.47.01L469.5 0C492.96 0 512 19.04 512 42.5c0 11.07-4.23 21.15-11.17 28.72L294.18 320.97c-14.93 18.06-41.7 20.58-59.76 5.65-1.8-1.49-3.46-3.12-4.97-4.83L10.43 70.39C-4.97 52.71-3.1 25.86 14.58 10.47 22.63 3.46 32.57.02 42.47.01z"
1764
+ }
1765
+ )
1766
+ }
1767
+ )
1768
+ }
1769
+ )
1770
+ ] }),
1771
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "slack_blocks_to_jsx__video_container max-w-max", children: showVideo && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1772
+ "iframe",
1773
+ __spreadValues({
1774
+ title: alt_text,
1775
+ className: "max-w-[360px] bg-gray-100 w-full aspect-video",
1776
+ src: video_url
1777
+ }, iframeProps)
1778
+ ) })
1779
+ ] });
1086
1780
  };
1087
1781
 
1088
1782
  // src/components/index.tsx
1089
- var import_jsx_runtime23 = require("react/jsx-runtime");
1783
+ var import_jsx_runtime38 = require("react/jsx-runtime");
1090
1784
  var getBlockComponent = (block) => {
1091
1785
  if (block.type === "divider")
1092
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Divider, { data: block });
1786
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Divider, { data: block });
1093
1787
  if (block.type === "section")
1094
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Section, { data: block });
1788
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Section, { data: block });
1095
1789
  if (block.type === "image")
1096
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Image, { data: block });
1790
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Image, { data: block });
1097
1791
  if (block.type === "context")
1098
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Context, { data: block });
1792
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Context, { data: block });
1099
1793
  if (block.type === "actions")
1100
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Actions, { data: block });
1794
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Actions, { data: block });
1101
1795
  if (block.type === "file")
1102
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(File, { data: block });
1796
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(File, { data: block });
1103
1797
  if (block.type === "header")
1104
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Header2, { data: block });
1798
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Header2, { data: block });
1105
1799
  if (block.type === "input")
1106
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Input, { data: block });
1800
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Input, { data: block });
1107
1801
  if (block.type === "video")
1108
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Video, { data: block });
1802
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Video, { data: block });
1109
1803
  if (block.type === "rich_text")
1110
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RichText, { data: block });
1804
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(RichText, { data: block });
1111
1805
  return null;
1112
1806
  };
1113
1807
  var getElementComponent = (element) => {
1114
1808
  if (element.type === "button")
1115
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ButtonElement, { data: element });
1809
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ButtonElement, { data: element });
1116
1810
  if (element.type === "checkboxes")
1117
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CheckboxesElement, { data: element });
1811
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CheckboxesElement, { data: element });
1118
1812
  if (element.type === "image")
1119
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageElement, { data: element });
1813
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageElement, { data: element });
1120
1814
  if (element.type === "plain_text_input")
1121
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PlaintTextInput, { data: element });
1815
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PlaintTextInput, { data: element });
1122
1816
  if (element.type === "users_select")
1123
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UsersSelectElement, { data: element });
1817
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UsersSelectElement, { data: element });
1124
1818
  if (element.type === "datepicker")
1125
1819
  return null;
1126
1820
  if (element.type === "datetimepicker")
@@ -1159,15 +1853,15 @@ var getElementComponent = (element) => {
1159
1853
  };
1160
1854
 
1161
1855
  // src/block_wrapper.tsx
1162
- var import_jsx_runtime24 = require("react/jsx-runtime");
1856
+ var import_jsx_runtime39 = require("react/jsx-runtime");
1163
1857
  var BlockWrapper = (props) => {
1164
1858
  const { children } = props;
1165
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-base slack_blocks_to_jsx--block_wrapper break-words font-normal", children });
1859
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "text-base slack_blocks_to_jsx--block_wrapper break-words font-normal", children });
1166
1860
  };
1167
1861
 
1168
1862
  // src/message.tsx
1169
- var import_react6 = require("react");
1170
- var import_jsx_runtime25 = require("react/jsx-runtime");
1863
+ var import_react7 = require("react");
1864
+ var import_jsx_runtime40 = require("react/jsx-runtime");
1171
1865
  var Message = (props) => {
1172
1866
  const {
1173
1867
  blocks,
@@ -1182,17 +1876,19 @@ var Message = (props) => {
1182
1876
  hooks,
1183
1877
  withoutWrapper = false
1184
1878
  } = props;
1185
- const { setChannels, setUsers, setHooks } = useGlobalData();
1186
- (0, import_react6.useEffect)(() => {
1879
+ const { setChannels, setUsers, setHooks, setUserGroups } = useGlobalData();
1880
+ (0, import_react7.useEffect)(() => {
1187
1881
  if (data == null ? void 0 : data.users)
1188
1882
  setUsers(data.users);
1189
1883
  if (data == null ? void 0 : data.channels)
1190
1884
  setChannels(data.channels);
1885
+ if (data == null ? void 0 : data.user_groups)
1886
+ setUserGroups(data.user_groups);
1191
1887
  if (hooks)
1192
1888
  setHooks(hooks);
1193
1889
  }, [data, hooks]);
1194
1890
  if (withoutWrapper) {
1195
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1891
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
1196
1892
  "div",
1197
1893
  {
1198
1894
  id: "slack_blocks_to_jsx",
@@ -1202,18 +1898,18 @@ var Message = (props) => {
1202
1898
  const element = getBlockComponent(block);
1203
1899
  if (!element)
1204
1900
  return null;
1205
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BlockWrapper, { children: element }, i);
1901
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BlockWrapper, { children: element }, i);
1206
1902
  })
1207
1903
  }
1208
1904
  );
1209
1905
  }
1210
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { id: "slack_blocks_to_jsx", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1906
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { id: "slack_blocks_to_jsx", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
1211
1907
  "section",
1212
1908
  {
1213
1909
  className: `flex gap-2 w-full max-w-[600px] slack_blocks_to_jsx relative ${unstyled ? "styles_disabled" : "styles_enabled"} ${className}`,
1214
1910
  style,
1215
1911
  children: [
1216
- showBlockKitDebug && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1912
+ showBlockKitDebug && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
1217
1913
  "a",
1218
1914
  {
1219
1915
  target: "_blank",
@@ -1225,14 +1921,14 @@ var Message = (props) => {
1225
1921
  children: "Open in Slack Block Kit Builder"
1226
1922
  }
1227
1923
  ),
1228
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { src: logo, className: "w-9 h-9", alt: name }) }),
1229
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col w-full", children: [
1230
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Header, { name, time }),
1231
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "slack_blocks_to_jsx--blocks", children: blocks.map((block, i) => {
1924
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("img", { src: logo, className: "w-9 h-9", alt: name }) }),
1925
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col w-full", children: [
1926
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Header, { name, time }),
1927
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "slack_blocks_to_jsx--blocks", children: blocks.map((block, i) => {
1232
1928
  const element = getBlockComponent(block);
1233
1929
  if (!element)
1234
1930
  return null;
1235
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BlockWrapper, { children: element }, i);
1931
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BlockWrapper, { children: element }, i);
1236
1932
  }) })
1237
1933
  ] })
1238
1934
  ]