@ynput/ayon-frontend-shared 0.7.6 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/DetailsPanel.es.js +361 -355
  2. package/dist/Feed.es.js +1 -1
  3. package/dist/ListTable.es.js +18 -18
  4. package/dist/NewEntity.es.js +30 -30
  5. package/dist/ProjectTreeTable.es.js +984 -974
  6. package/dist/ProjectsTable.es.js +3 -3
  7. package/dist/Slicer.es.js +53 -50
  8. package/dist/Views.es.js +150 -151
  9. package/dist/api.es.js +166 -165
  10. package/dist/chunks/Actions.es.js +9 -10
  11. package/dist/chunks/ColumnDropIndicator.es.js +2 -2
  12. package/dist/chunks/ColumnHeaderMenuUI.es.js +3 -4
  13. package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +2 -2
  14. package/dist/chunks/DetailsDialog.es.js +3 -3
  15. package/dist/chunks/EmptyPlaceholder.es.js +7 -7
  16. package/dist/chunks/EntityPath.es.js +38 -39
  17. package/dist/chunks/EntityPickerDialog.es.js +65 -66
  18. package/dist/chunks/EntityTooltip.es.js +18 -19
  19. package/dist/chunks/Feed.es.js +1381 -1355
  20. package/dist/chunks/FilmstripEntityCard.es.js +5201 -0
  21. package/dist/chunks/FilterErrorActions.es.js +2 -3
  22. package/dist/chunks/GroupSettingsFallback.es.js +2 -2
  23. package/dist/chunks/Menu.es.js +52 -53
  24. package/dist/chunks/MetaWidget.es.js +1948 -1875
  25. package/dist/chunks/ProjectFoldersContext.es.js +40 -40
  26. package/dist/chunks/RepresentationsList.es.js +1 -1
  27. package/dist/chunks/ReviewablesSelector.es.js +759 -742
  28. package/dist/chunks/SimpleTable.es.js +2 -1
  29. package/dist/chunks/Slicer.es.js +49 -50
  30. package/dist/chunks/TableExportContextInstance.es.js +600 -402
  31. package/dist/chunks/TableSettingsFallback.es.js +3 -4
  32. package/dist/chunks/ThumbnailSimple.es.js +114 -99
  33. package/dist/chunks/VideoPlayer.es.js +8 -9
  34. package/dist/chunks/Watchers.es.js +928 -871
  35. package/dist/chunks/expandRelativeDates.es.js +1 -1
  36. package/dist/chunks/getThumbnailUrl.es.js +33 -21
  37. package/dist/chunks/getUris.es.js +1580 -1610
  38. package/dist/chunks/queryFilterToClientFilter.es.js +1 -1
  39. package/dist/chunks/realtimeUpdatesUtils.es.js +15 -15
  40. package/dist/chunks/searchTerms.es.js +773 -696
  41. package/dist/chunks/useAttributeEnums.es.js +22 -22
  42. package/dist/chunks/useDateRangeFilter.es.js +1 -1
  43. package/dist/chunks/useHierarchySelection.es.js +3 -4
  44. package/dist/chunks/useLoadModule.es.js +3 -4
  45. package/dist/components.es.js +475 -467
  46. package/dist/context.es.js +615 -540
  47. package/dist/hooks.es.js +193 -171
  48. package/dist/index.es.js +2 -2
  49. package/dist/types/Actions.d.ts +10 -8
  50. package/dist/types/DetailsPanel.d.ts +54 -76
  51. package/dist/types/EntityPickerDialog.d.ts +12 -6
  52. package/dist/types/Feed.d.ts +24 -24
  53. package/dist/types/ListTable.d.ts +33 -27
  54. package/dist/types/NewEntity.d.ts +26 -39
  55. package/dist/types/ProjectTreeTable.d.ts +199 -195
  56. package/dist/types/ProjectsTable.d.ts +6 -6
  57. package/dist/types/RepresentationsList.d.ts +4 -0
  58. package/dist/types/Slicer.d.ts +63 -246
  59. package/dist/types/Views.d.ts +71 -298
  60. package/dist/types/api.d.ts +3164 -2363
  61. package/dist/types/components.d.ts +327 -474
  62. package/dist/types/context.d.ts +285 -572
  63. package/dist/types/hooks.d.ts +76 -47
  64. package/dist/types/index.d.ts +6 -0
  65. package/dist/types/util.d.ts +141 -120
  66. package/dist/util.es.js +71 -68
  67. package/package.json +6 -6
  68. package/dist/chunks/EntityUpdatesContext.es.js +0 -61
  69. package/dist/chunks/PlayableIcon.es.js +0 -5020
  70. package/dist/chunks/viewUpdateHelper.es.js +0 -153
@@ -1,5020 +0,0 @@
1
- import { format as Bn, isValid as Ie, isSameMinute as Yt, isBefore as zn, formatDistanceToNow as Fn, subYears as Kn, endOfYear as kt, startOfYear as wt, subMonths as Un, endOfMonth as Ue, startOfMonth as He, addMonths as Hn, subWeeks as jn, endOfWeek as je, startOfWeek as Ge, addWeeks as Gn, setHours as _t, subDays as Wn, endOfDay as Et, startOfDay as Ct, parseISO as B, isSameDay as K } from "date-fns";
2
- import { matchSorter as Yn } from "match-sorter";
3
- import { bc as qn, bF as Qn } from "./searchTerms.es.js";
4
- import { isArray as Vn } from "lodash";
5
- import "primereact/confirmdialog";
6
- import "react-toastify";
7
- import { g as it } from "./getEntityTypeIcon.es.js";
8
- import "uuid";
9
- import qt, { useRef as O, useState as U, useLayoutEffect as oe, useCallback as H, useMemo as _e, useEffect as R, Fragment as Jn, useImperativeHandle as Xn, forwardRef as Qt, useContext as Zn } from "react";
10
- import "axios";
11
- import { jsx as l, jsxs as S, Fragment as me } from "react/jsx-runtime";
12
- import P from "clsx";
13
- import w, { css as Ee } from "styled-components";
14
- import { UserImage as Tt, Icon as J, Button as te, Dropdown as eo, InputText as to, getTextColor as no, theme as Oe } from "@ynput/ayon-react-components";
15
- import { TextNode as st, $applyNodeReplacement as at, createCommand as ge, LineBreakNode as oo, $isLineBreakNode as Vt, $createTextNode as Ce, $getEditor as ro, $getRoot as ie, $createParagraphNode as he, $getSelection as M, $isParagraphNode as Y, $isTextNode as X, $isRangeSelection as $, COMMAND_PRIORITY_EDITOR as Jt, COMMAND_PRIORITY_NORMAL as Z, $isRootOrShadowRoot as io, SELECTION_CHANGE_COMMAND as lt, COMMAND_PRIORITY_CRITICAL as Qe, BLUR_COMMAND as ct, COMMAND_PRIORITY_LOW as D, FORMAT_TEXT_COMMAND as dt, KEY_DOWN_COMMAND as Xt, KEY_ARROW_RIGHT_COMMAND as Zt, KEY_ARROW_LEFT_COMMAND as so, KEY_ARROW_DOWN_COMMAND as ao, KEY_ENTER_COMMAND as Ve, COMMAND_PRIORITY_HIGH as lo, INSERT_PARAGRAPH_COMMAND as en, KEY_ESCAPE_COMMAND as tn, COMMAND_PRIORITY_BEFORE_EDITOR as co, $isRootNode as ut, $getNearestNodeFromDOMNode as nn, PASTE_COMMAND as mt, $setSelection as We, $getNodeByKey as se, KEY_TAB_COMMAND as uo, COPY_COMMAND as mo, CUT_COMMAND as po, CLEAR_HISTORY_COMMAND as go, defineExtension as ho } from "lexical";
16
- import { LexicalExtensionComposer as fo } from "@lexical/react/LexicalExtensionComposer";
17
- import { useLexicalComposerContext as A } from "@lexical/react/LexicalComposerContext";
18
- import { ContentEditable as bo } from "@lexical/react/LexicalContentEditable";
19
- import { HistoryPlugin as yo } from "@lexical/react/LexicalHistoryPlugin";
20
- import { ListPlugin as vo } from "@lexical/react/LexicalListPlugin";
21
- import { CheckListPlugin as xo } from "@lexical/react/LexicalCheckListPlugin";
22
- import { LinkPlugin as ko } from "@lexical/react/LexicalLinkPlugin";
23
- import { createLinkMatcherWithRegExp as Lt, AutoLinkPlugin as wo } from "@lexical/react/LexicalAutoLinkPlugin";
24
- import { MarkdownShortcutPlugin as _o } from "@lexical/react/LexicalMarkdownShortcutPlugin";
25
- import { TabIndentationPlugin as Eo } from "@lexical/react/LexicalTabIndentationPlugin";
26
- import { AutoFocusPlugin as Co } from "@lexical/react/LexicalAutoFocusPlugin";
27
- import { $isHeadingNode as To, $isQuoteNode as on, $createHeadingNode as Lo, $createQuoteNode as Mo, DRAG_DROP_PASTE as rn, RichTextExtension as $o, HeadingNode as No, QuoteNode as So } from "@lexical/rich-text";
28
- import { $isListNode as sn, ListNode as an, REMOVE_LIST_COMMAND as Oo, INSERT_CHECK_LIST_COMMAND as Ro, INSERT_ORDERED_LIST_COMMAND as Io, INSERT_UNORDERED_LIST_COMMAND as Ao, $isListItemNode as ln, $createListNode as Do, ListItemNode as Po } from "@lexical/list";
29
- import { $isLinkNode as ne, $isAutoLinkNode as Je, $createLinkNode as cn, TOGGLE_LINK_COMMAND as Bo, LinkNode as dn, AutoLinkNode as un } from "@lexical/link";
30
- import { $isCodeNode as ee, $createCodeNode as Mt, CodeNode as zo, CodeHighlightNode as Fo } from "@lexical/code";
31
- import mn from "prismjs";
32
- import "prismjs/components/prism-clike";
33
- import "prismjs/components/prism-c";
34
- import "prismjs/components/prism-cpp";
35
- import "prismjs/components/prism-csharp";
36
- import "prismjs/components/prism-markup";
37
- import "prismjs/components/prism-css";
38
- import "prismjs/components/prism-javascript";
39
- import "prismjs/components/prism-typescript";
40
- import "prismjs/components/prism-json";
41
- import "prismjs/components/prism-bash";
42
- import "prismjs/components/prism-python";
43
- import "prismjs/components/prism-yaml";
44
- import "prismjs/components/prism-toml";
45
- import "prismjs/components/prism-ini";
46
- import "prismjs/components/prism-lua";
47
- import "prismjs/components/prism-glsl";
48
- import "prismjs/components/prism-hlsl";
49
- import "prismjs/components/prism-sql";
50
- import "prismjs/components/prism-go";
51
- import "prismjs/components/prism-rust";
52
- import "prismjs/components/prism-java";
53
- import "prismjs/components/prism-diff";
54
- import "prismjs/components/prism-markdown";
55
- import "prismjs/components/prism-powershell";
56
- import { BlockWithAlignableContents as pn } from "@lexical/react/LexicalBlockWithAlignableContents";
57
- import { DecoratorBlockNode as gn } from "@lexical/react/LexicalDecoratorBlockNode";
58
- import { HEADING as Ko, QUOTE as Uo, CHECK_LIST as Ho, UNORDERED_LIST as jo, ORDERED_LIST as Go, CODE as Wo, INLINE_CODE as Yo, BOLD_ITALIC_STAR as qo, BOLD_ITALIC_UNDERSCORE as Qo, BOLD_STAR as Vo, BOLD_UNDERSCORE as Jo, ITALIC_STAR as Xo, ITALIC_UNDERSCORE as Zo, STRIKETHROUGH as er, LINK as tr, $generateNodesFromMarkdownString as nr, $convertToMarkdownString as or, $convertSelectionToMarkdownString as rr } from "@lexical/markdown";
59
- import ir from "emojilib/emojis.json";
60
- import $t from "emojilib/ordered.json";
61
- import { LexicalTypeaheadMenuPlugin as pt, MenuOption as gt } from "@lexical/react/LexicalTypeaheadMenuPlugin";
62
- import { $findMatchingParent as W, mergeRegister as q, $getNearestNodeOfType as sr, $unwrapNode as ar } from "@lexical/utils";
63
- import { createPortal as fe } from "react-dom";
64
- import { bj as lr } from "./getUris.es.js";
65
- import "@module-federation/enhanced/runtime";
66
- import "@ynput/ayon-addon/host";
67
- import { d as cr, N as dr } from "./TableExportContextInstance.es.js";
68
- import "semver";
69
- import "./ContextMenuContextInstance.es.js";
70
- import "react-redux";
71
- import "react-router-dom";
72
- import { $setBlocksType as Me } from "@lexical/selection";
73
- import { PrismTokenizer as ur, registerCodeHighlighting as mr } from "@lexical/code-prism";
74
- import { $getClipboardDataFromSelection as pr, copyToClipboard as gr } from "@lexical/clipboard";
75
- import { entityUrl as hr } from "@ynput/ayon-addon";
76
- const fr = ({ name: t, fullName: e, imageKey: n, ...o }) => t ? /* @__PURE__ */ l(
77
- Tt,
78
- {
79
- name: t,
80
- fullName: e,
81
- src: `/api/users/${t}/avatar?key=${n || ""}`,
82
- ...o
83
- }
84
- ) : /* @__PURE__ */ l(Tt, { name: "", className: P(o.className, "loading"), ...o }), Kl = (t, e) => {
85
- const n = new Date(t.getTime() + t.getTimezoneOffset() * 6e4);
86
- return Bn(n, e);
87
- }, ae = "block-dialog-close", br = w.div`
88
- position: fixed;
89
- z-index: 310;
90
- overflow: hidden;
91
- display: flex;
92
- flex-direction: column;
93
- `, Ul = ({
94
- isEditing: t,
95
- anchorId: e,
96
- containerClassName: n = "table-container",
97
- onClose: o,
98
- children: r,
99
- matchAnchorWidth: i
100
- }) => {
101
- const s = O(null), [a, u] = U(null), [d, v] = U(void 0), [x, g] = U(void 0), h = document.getElementById(e), f = h?.closest(`.${n}`), c = () => {
102
- if (!t) return;
103
- if (!h || !f) {
104
- u({
105
- top: window.innerHeight / 2,
106
- left: window.innerWidth / 2,
107
- showAbove: !1
108
- }), v(void 0), g(void 0);
109
- return;
110
- }
111
- const _ = h.getBoundingClientRect(), T = f.getBoundingClientRect(), E = T.right, p = window.innerWidth - T.right, y = 24, k = 250, C = 400, b = 600, L = window.innerWidth, I = window.innerHeight, F = E - _.left;
112
- let N = {}, G = C;
113
- i ? (N.left = _.left, G = Math.max(C, _.width)) : F < C ? _.right - y >= C ? N.right = Math.max(
114
- L - _.right,
115
- y + p
116
- ) : (N.left = y, G = L - 2 * y) : (N.left = _.left, G = Math.max(C, F));
117
- const ce = T.left, xe = T.right;
118
- if (N.left !== void 0 && (N.left + G > xe && (N.left = Math.max(ce, xe - G)), N.left = Math.max(ce, N.left)), N.right !== void 0) {
119
- const Ke = L - xe;
120
- N.right + G > L - ce && (N.right = Math.max(Ke, L - ce - G)), N.right = Math.max(Ke, N.right);
121
- }
122
- v(G);
123
- const ke = I - _.bottom - y, Te = _.top - y;
124
- let we, Le = !1, Fe;
125
- ke < k && Te > ke ? (Le = !0, we = _.top - 4, Fe = Te - 4) : (we = _.bottom + 4, Fe = ke - 4), g(Math.min(Math.max(200, Fe), b)), u({
126
- top: we,
127
- ...N,
128
- showAbove: Le
129
- });
130
- };
131
- oe(() => {
132
- c();
133
- }, [t, h, i]), oe(() => {
134
- if (f) {
135
- const _ = new ResizeObserver(() => {
136
- c();
137
- });
138
- return _.observe(f), () => _.disconnect();
139
- }
140
- }, [f, h]), oe(() => {
141
- const _ = (T) => {
142
- const E = T.target;
143
- E.isConnected && s.current && !s.current.contains(E) && h && !h.contains(E) && // check we are not clicking inside the EntityPickerDialog
144
- !E.closest(".entity-picker-dialog") && // check we are not clicking on the dialog backdrop
145
- !E.querySelector(".entity-picker-dialog") && // check we are not clicking inside another dialog
146
- !E.closest("dialog") && // check we are not clicking inside a dropdown
147
- !E.closest(".dropdown") && !E.closest(".p-dialog-mask") && !E.closest(".p-datepicker") && !E.closest("." + ae) && (document.activeElement instanceof HTMLElement && document.activeElement.blur(), o?.());
148
- };
149
- return document.addEventListener("mousedown", _), () => {
150
- document.removeEventListener("mousedown", _);
151
- };
152
- }, [o, h]);
153
- const m = (_) => {
154
- const T = _.target;
155
- T.tagName === "INPUT" || T.tagName === "TEXTAREA" || T.isContentEditable || _.key === "Escape" && (_.stopPropagation(), o?.());
156
- };
157
- return t ? fe(
158
- /* @__PURE__ */ l(
159
- br,
160
- {
161
- ref: s,
162
- style: {
163
- top: a?.top,
164
- left: a?.left,
165
- right: a?.right,
166
- ...a?.showAbove && { transform: "translateY(-100%)" },
167
- visibility: a ? "visible" : "hidden",
168
- ...i && d ? { width: `${d}px` } : {},
169
- maxWidth: d ? `${d}px` : "none",
170
- maxHeight: x ? `${x}px` : "none"
171
- },
172
- className: "links-widget-popup block-shortcuts",
173
- onKeyDown: m,
174
- children: r
175
- }
176
- ),
177
- document.body
178
- ) : null;
179
- }, Re = [
180
- { value: "", label: "Plain text" },
181
- { value: "bash", label: "Bash" },
182
- { value: "c", label: "C" },
183
- { value: "cpp", label: "C++" },
184
- { value: "csharp", label: "C#" },
185
- { value: "css", label: "CSS" },
186
- { value: "diff", label: "Diff" },
187
- { value: "glsl", label: "GLSL" },
188
- { value: "go", label: "Go" },
189
- { value: "hlsl", label: "HLSL" },
190
- { value: "html", label: "HTML" },
191
- { value: "ini", label: "INI" },
192
- { value: "java", label: "Java" },
193
- { value: "javascript", label: "JavaScript" },
194
- { value: "json", label: "JSON" },
195
- { value: "lua", label: "Lua" },
196
- { value: "markdown", label: "Markdown" },
197
- { value: "mel", label: "MEL" },
198
- { value: "powershell", label: "PowerShell" },
199
- { value: "python", label: "Python" },
200
- { value: "rust", label: "Rust" },
201
- { value: "sql", label: "SQL" },
202
- { value: "toml", label: "TOML" },
203
- { value: "typescript", label: "TypeScript" },
204
- { value: "vex", label: "VEX" },
205
- { value: "xml", label: "XML" },
206
- { value: "yaml", label: "YAML" }
207
- ], yr = (t) => Re.find((e) => e.value === (t || ""))?.label || t || "", vr = (t) => {
208
- if (!t) return;
209
- const e = mn.languages[t.toLowerCase()];
210
- return typeof e == "object" ? e : void 0;
211
- }, xr = (t, e) => {
212
- const n = vr(e);
213
- return !n || !e ? null : mn.highlight(t, n, e.toLowerCase());
214
- }, kr = [
215
- "atrule",
216
- "attr",
217
- "attr-name",
218
- "attr-value",
219
- "boolean",
220
- "builtin",
221
- "cdata",
222
- "char",
223
- "class",
224
- "class-name",
225
- "comment",
226
- "constant",
227
- "deleted",
228
- "doctype",
229
- "entity",
230
- "function",
231
- "important",
232
- "inserted",
233
- "keyword",
234
- "namespace",
235
- "number",
236
- "operator",
237
- "prolog",
238
- "property",
239
- "punctuation",
240
- "regex",
241
- "selector",
242
- "string",
243
- "symbol",
244
- "tag",
245
- "url",
246
- "variable"
247
- ], wr = Object.fromEntries(
248
- kr.map((t) => [t, `token ${t}`])
249
- ), _r = {
250
- paragraph: "md-paragraph",
251
- heading: {
252
- h1: "md-heading md-h1",
253
- h2: "md-heading md-h2",
254
- h3: "md-heading md-h3",
255
- h4: "md-heading md-h4",
256
- h5: "md-heading md-h5",
257
- h6: "md-heading md-h6"
258
- },
259
- quote: "md-quote",
260
- // blocks like embedded videos
261
- embedBlock: { base: "md-embed", focus: "md-embed-focus" },
262
- link: "md-link",
263
- code: "md-code-block",
264
- // prism token types -> `token <type>` classes, coloured by codeTokenStyles
265
- codeHighlight: wr,
266
- list: {
267
- ul: "md-list md-list-ul",
268
- ol: "md-list md-list-ol",
269
- checklist: "md-list md-checklist",
270
- listitem: "md-list-item",
271
- listitemChecked: "md-list-item-checked",
272
- listitemUnchecked: "md-list-item-unchecked",
273
- nested: {
274
- listitem: "md-list-item-nested"
275
- }
276
- },
277
- text: {
278
- bold: "md-bold",
279
- italic: "md-italic",
280
- strikethrough: "md-strikethrough",
281
- underline: "md-underline",
282
- code: "md-code"
283
- }
284
- }, ht = [
285
- "user",
286
- "team",
287
- "task",
288
- "version",
289
- "folder",
290
- "representation",
291
- "workfile",
292
- "product"
293
- ], Er = {
294
- user: "@",
295
- team: "@",
296
- version: "@@",
297
- task: "@@@"
298
- }, Cr = (t) => Er[t] ?? "@", Tr = [
299
- "bold",
300
- "italic",
301
- "strikethrough",
302
- "link",
303
- "|",
304
- "quote",
305
- "|",
306
- "numberList",
307
- "bulletList",
308
- "checkList"
309
- ], Hl = [
310
- "h1",
311
- "h2",
312
- "h3",
313
- "|",
314
- "bold",
315
- "italic",
316
- "strikethrough",
317
- "link",
318
- "|",
319
- "codeBlock",
320
- "quote",
321
- "|",
322
- "numberList",
323
- "bulletList"
324
- ], Lr = [
325
- "bold",
326
- "italic",
327
- "strikethrough",
328
- "link",
329
- "|",
330
- "quote"
331
- ], ue = (t) => t.replace(/^@+/, ""), ft = (t) => {
332
- if (!t) return null;
333
- const e = t.replace(/^@/, ""), n = e.indexOf(":");
334
- if (n < 1) return null;
335
- const o = e.slice(0, n);
336
- let r = e.slice(n + 1);
337
- if (!r || !ht.includes(o)) return null;
338
- try {
339
- r = decodeURIComponent(r);
340
- } catch {
341
- }
342
- return { type: o, id: r };
343
- }, Mr = (t) => {
344
- const e = t.getAttribute("data-mention-value") || t.getAttribute("data-value") || t.getAttribute("href"), n = ft(e);
345
- if (!n) return null;
346
- const o = ue(
347
- t.getAttribute("data-mention-label") || t.textContent?.trim() || ""
348
- );
349
- return o ? { node: De(n.type, n.id, o) } : null;
350
- };
351
- class be extends st {
352
- __mentionType;
353
- __mentionId;
354
- static getType() {
355
- return "mention";
356
- }
357
- static clone(e) {
358
- return new be(e.__mentionType, e.__mentionId, e.__text, e.__key);
359
- }
360
- static importJSON(e) {
361
- return De(
362
- e.mentionType,
363
- e.mentionId,
364
- ue(e.text)
365
- ).updateFromJSON(e);
366
- }
367
- constructor(e, n, o, r) {
368
- super(o, r), this.__mentionType = e, this.__mentionId = n;
369
- }
370
- exportJSON() {
371
- return {
372
- ...super.exportJSON(),
373
- mentionType: this.__mentionType,
374
- mentionId: this.__mentionId
375
- };
376
- }
377
- getMentionType() {
378
- return this.getLatest().__mentionType;
379
- }
380
- getMentionId() {
381
- return this.getLatest().__mentionId;
382
- }
383
- // label without the @ trigger
384
- getLabel() {
385
- return ue(this.getTextContent());
386
- }
387
- getMentionValue() {
388
- return `${this.getMentionType()}:${this.getMentionId()}`;
389
- }
390
- createDOM(e) {
391
- const n = super.createDOM(e);
392
- return n.classList.add("mention", `mention-${this.__mentionType}`), n.setAttribute("data-mention-value", `${this.__mentionType}:${this.__mentionId}`), n.setAttribute("data-mention-label", ue(this.__text)), n.spellcheck = !1, n;
393
- }
394
- exportDOM() {
395
- const e = document.createElement("a");
396
- return e.setAttribute("href", `@${this.__mentionType}:${this.__mentionId}`), e.setAttribute("data-mention-value", `${this.__mentionType}:${this.__mentionId}`), e.setAttribute("data-mention-label", ue(this.__text)), e.textContent = this.__text, { element: e };
397
- }
398
- static importDOM() {
399
- const e = (o) => !!ft(
400
- o.getAttribute("data-mention-value") || o.getAttribute("data-value") || o.getAttribute("href")
401
- ), n = (o) => e(o) ? { conversion: Mr, priority: 2 } : null;
402
- return {
403
- a: n,
404
- span: n,
405
- // the legacy quill editor wraps mentions in a <mention> tag
406
- mention: n
407
- };
408
- }
409
- isTextEntity() {
410
- return !0;
411
- }
412
- canInsertTextBefore() {
413
- return !1;
414
- }
415
- canInsertTextAfter() {
416
- return !1;
417
- }
418
- }
419
- const De = (t, e, n) => {
420
- const o = new be(t, e, Cr(t) + ue(n));
421
- return o.setMode("token").toggleDirectionless(), at(o);
422
- }, hn = (t) => t instanceof be, $r = /^[\w-]{11}$/, Nr = (t) => {
423
- if (!t) return;
424
- if (/^\d+$/.test(t)) return Number(t);
425
- const e = t.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);
426
- if (!e || !e[0]) return;
427
- const [, n = "0", o = "0", r = "0"] = e;
428
- return Number(n) * 3600 + Number(o) * 60 + Number(r);
429
- }, re = (t) => {
430
- let e;
431
- try {
432
- e = new URL(t.trim());
433
- } catch {
434
- return null;
435
- }
436
- if (e.protocol !== "https:" && e.protocol !== "http:") return null;
437
- const n = e.hostname.replace(/^(www|m|music)\./, "");
438
- let o = null;
439
- if (n === "youtu.be")
440
- o = e.pathname.slice(1).split("/")[0];
441
- else if (n === "youtube.com" || n === "youtube-nocookie.com")
442
- if (e.pathname === "/watch") o = e.searchParams.get("v");
443
- else {
444
- const [, i, s] = e.pathname.split("/");
445
- ["shorts", "embed", "live", "v"].includes(i) && (o = s);
446
- }
447
- if (!o || !$r.test(o)) return null;
448
- const r = Nr(e.searchParams.get("t") ?? e.searchParams.get("start"));
449
- return r ? { id: o, start: r } : { id: o };
450
- }, fn = ({ id: t, start: e }) => `https://www.youtube-nocookie.com/embed/${t}${e ? `?start=${e}` : ""}`, Sr = w.div`
451
- width: 100%;
452
- max-width: 560px;
453
- aspect-ratio: 16 / 9;
454
- border-radius: var(--border-radius-m);
455
- overflow: hidden;
456
- background-color: var(--md-sys-color-surface-container-lowest);
457
-
458
- iframe {
459
- display: block;
460
- width: 100%;
461
- height: 100%;
462
- border: none;
463
- }
464
- `, Or = ({ video: t, className: e }) => /* @__PURE__ */ l(Sr, { className: e ? `youtube-embed ${e}` : "youtube-embed", children: /* @__PURE__ */ l(
465
- "iframe",
466
- {
467
- src: fn(t),
468
- title: "YouTube video",
469
- allow: "accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
470
- referrerPolicy: "strict-origin-when-cross-origin",
471
- allowFullScreen: !0,
472
- loading: "lazy"
473
- }
474
- ) });
475
- class ye extends gn {
476
- // the url as written, so its start time etc. survive saving
477
- __url;
478
- static getType() {
479
- return "youtube";
480
- }
481
- static clone(e) {
482
- return new ye(e.__url, e.__format, e.__key);
483
- }
484
- static importJSON(e) {
485
- return pe(e.url).updateFromJSON(e);
486
- }
487
- constructor(e, n, o) {
488
- super(n, o), this.__url = e;
489
- }
490
- exportJSON() {
491
- return { ...super.exportJSON(), url: this.__url };
492
- }
493
- exportDOM() {
494
- const e = re(this.__url);
495
- if (!e) return { element: document.createTextNode(this.__url) };
496
- const n = document.createElement("iframe");
497
- return n.setAttribute("data-lexical-youtube", this.__url), n.setAttribute("src", fn(e)), n.setAttribute("width", "560"), n.setAttribute("height", "315"), n.setAttribute("allowfullscreen", "true"), { element: n };
498
- }
499
- static importDOM() {
500
- return {
501
- iframe: (e) => {
502
- const n = e.getAttribute("data-lexical-youtube") || e.getAttribute("src");
503
- return !n || !re(n) ? null : { conversion: () => ({ node: pe(n) }), priority: 1 };
504
- }
505
- };
506
- }
507
- updateDOM() {
508
- return !1;
509
- }
510
- getUrl() {
511
- return this.getLatest().__url;
512
- }
513
- getTextContent() {
514
- return this.__url;
515
- }
516
- decorate(e, n) {
517
- const o = re(this.__url), r = n.theme.embedBlock || {};
518
- return /* @__PURE__ */ l(
519
- pn,
520
- {
521
- className: { base: r.base || "", focus: r.focus || "" },
522
- format: this.__format,
523
- nodeKey: this.getKey(),
524
- children: o ? /* @__PURE__ */ l(Or, { video: o }) : /* @__PURE__ */ l("span", { children: this.__url })
525
- }
526
- );
527
- }
528
- }
529
- const pe = (t) => at(new ye(t.trim())), Rr = (t) => t instanceof ye, bn = ["mp4", "mov", "webm", "mkv", "m4v", "ogv", "avi"], Ir = ["png", "jpg", "jpeg", "gif", "webp", "svg", "avif", "bmp"], yn = (t) => t?.split(/[?#]/)[0].split(".").pop()?.toLowerCase() || "", vn = (t, ...e) => t?.startsWith("video/") ? "video" : t?.startsWith("image/") ? "image" : e.some((n) => bn.includes(yn(n))) ? "video" : "image", Ar = (t) => t.type.startsWith("image/") || t.type.startsWith("video/") || [...Ir, ...bn].includes(yn(t.name)), Dr = /\/api\/projects\/[^/]+\/files\/([\w-]+)/, bt = (t) => t?.match(Dr)?.[1] ?? null, Pr = /^\s*!\[[^\]]*\]\(<?([^\s)>]+)>?(?:\s+"[^"]*")?\)\s*$/, Br = /^\s*(```|~~~)/, jl = (t) => {
530
- const e = /* @__PURE__ */ new Set();
531
- let n = !1;
532
- for (const o of String(t || "").split(`
533
- `)) {
534
- if (Br.test(o)) {
535
- n = !n;
536
- continue;
537
- }
538
- if (n) continue;
539
- const r = bt(o.match(Pr)?.[1]);
540
- r && e.add(r);
541
- }
542
- return e;
543
- }, zr = w.div`
544
- position: relative;
545
- display: inline-flex;
546
- max-width: 100%;
547
- border-radius: var(--border-radius-m);
548
- overflow: hidden;
549
- background-color: var(--md-sys-color-surface-container-lowest);
550
-
551
- img,
552
- video {
553
- display: block;
554
- max-width: 100%;
555
- max-height: 400px;
556
- object-fit: contain;
557
- }
558
-
559
- .md-media-open {
560
- all: unset;
561
- display: block;
562
- cursor: zoom-in;
563
- }
564
-
565
- .md-media-open,
566
- .md-media-play {
567
- &:focus-visible {
568
- outline: 2px solid var(--md-sys-color-primary);
569
- outline-offset: -2px;
570
- }
571
- }
572
-
573
- .md-media-play {
574
- all: unset;
575
- position: relative;
576
- display: block;
577
- cursor: pointer;
578
-
579
- img {
580
- cursor: pointer;
581
- }
582
- .md-media-no-poster {
583
- display: block;
584
- width: 320px;
585
- max-width: 100%;
586
- aspect-ratio: 16 / 9;
587
- }
588
- .play-icon {
589
- position: absolute;
590
- top: 50%;
591
- left: 50%;
592
- transform: translate(-50%, -50%);
593
- font-size: 48px;
594
- color: white;
595
- filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
596
- }
597
- &:hover .play-icon {
598
- transform: translate(-50%, -50%) scale(1.1);
599
- }
600
- }
601
-
602
- .uploading {
603
- position: absolute;
604
- inset: 0;
605
- display: flex;
606
- align-items: center;
607
- justify-content: center;
608
- gap: 8px;
609
- background-color: rgba(0, 0, 0, 0.5);
610
- color: white;
611
-
612
- /* css spinner, not an icon (the icon font may not have one) */
613
- .spinner {
614
- width: 16px;
615
- height: 16px;
616
- border: 2px solid rgba(255, 255, 255, 0.3);
617
- border-top-color: white;
618
- border-radius: 50%;
619
- animation: md-media-spin 0.8s linear infinite;
620
- }
621
- }
622
-
623
- @keyframes md-media-spin {
624
- to {
625
- transform: rotate(360deg);
626
- }
627
- }
628
- `, Fr = ({ src: t, alt: e, mime: n, uploading: o, onOpen: r, className: i }) => {
629
- const s = vn(n, e, t), a = s === "video" && bt(t) ? `${t}/thumbnail` : void 0;
630
- return /* @__PURE__ */ S(
631
- zr,
632
- {
633
- className: P("md-media", `md-media-${s}`, i, { clickable: !!r }),
634
- children: [
635
- s === "video" && r ? (
636
- // opens the video player, like a video attachment
637
- /* @__PURE__ */ S("button", { type: "button", className: "md-media-play", onClick: r, title: e, children: [
638
- a ? /* @__PURE__ */ l("img", { src: a, alt: e || "" }) : /* @__PURE__ */ l("span", { className: "md-media-no-poster" }),
639
- /* @__PURE__ */ l(J, { icon: "play_circle", className: "play-icon" })
640
- ] })
641
- ) : s === "video" ? /* @__PURE__ */ l("video", { src: t, poster: a, controls: !0, preload: "metadata", title: e }) : r ? (
642
- // opens the attachment preview
643
- /* @__PURE__ */ l("button", { type: "button", className: "md-media-open", onClick: r, title: e, children: /* @__PURE__ */ l("img", { src: t, alt: e || "", loading: "lazy" }) })
644
- ) : /* @__PURE__ */ l("img", { src: t, alt: e || "", title: e, loading: "lazy" }),
645
- o && /* @__PURE__ */ S("span", { className: "uploading", children: [
646
- /* @__PURE__ */ l("span", { className: "spinner" }),
647
- "Uploading..."
648
- ] })
649
- ]
650
- }
651
- );
652
- };
653
- class ve extends gn {
654
- __src;
655
- __alt;
656
- __mime;
657
- __uploading;
658
- static getType() {
659
- return "media";
660
- }
661
- static clone(e) {
662
- return new ve(
663
- { src: e.__src, alt: e.__alt, mime: e.__mime, uploading: e.__uploading },
664
- e.__format,
665
- e.__key
666
- );
667
- }
668
- static importJSON(e) {
669
- return Ae({
670
- src: e.src,
671
- alt: e.alt,
672
- mime: e.mime
673
- }).updateFromJSON(e);
674
- }
675
- constructor(e, n, o) {
676
- super(n, o), this.__src = e.src, this.__alt = e.alt || "", this.__mime = e.mime || null, this.__uploading = !!e.uploading;
677
- }
678
- exportJSON() {
679
- return { ...super.exportJSON(), src: this.__src, alt: this.__alt, mime: this.__mime };
680
- }
681
- exportDOM() {
682
- const e = vn(this.__mime, this.__alt, this.__src) === "video", n = document.createElement(e ? "video" : "img");
683
- return n.setAttribute("src", this.__src), n.setAttribute(e ? "title" : "alt", this.__alt), this.__mime && n.setAttribute("data-mime", this.__mime), { element: n };
684
- }
685
- static importDOM() {
686
- const e = (n) => {
687
- const o = n.getAttribute("src");
688
- if (!o || !bt(o)) return null;
689
- const r = n.getAttribute("alt") || n.getAttribute("title") || "", i = n.getAttribute("data-mime");
690
- return { node: Ae({ src: o, alt: r, mime: i }) };
691
- };
692
- return {
693
- img: () => ({ conversion: e, priority: 1 }),
694
- video: () => ({ conversion: e, priority: 1 })
695
- };
696
- }
697
- updateDOM() {
698
- return !1;
699
- }
700
- getSrc() {
701
- return this.getLatest().__src;
702
- }
703
- getAlt() {
704
- return this.getLatest().__alt;
705
- }
706
- getMime() {
707
- return this.getLatest().__mime;
708
- }
709
- isUploading() {
710
- return this.getLatest().__uploading;
711
- }
712
- // the upload finished, swap the local preview for the stored file
713
- setUploaded(e, { alt: n, mime: o } = {}) {
714
- const r = this.getWritable();
715
- return r.__src = e, r.__uploading = !1, n && (r.__alt = n), o && (r.__mime = o), r;
716
- }
717
- getTextContent() {
718
- return this.__alt;
719
- }
720
- decorate(e, n) {
721
- const o = n.theme.embedBlock || {};
722
- return /* @__PURE__ */ l(
723
- pn,
724
- {
725
- className: { base: o.base || "", focus: o.focus || "" },
726
- format: this.__format,
727
- nodeKey: this.getKey(),
728
- children: /* @__PURE__ */ l(
729
- Fr,
730
- {
731
- src: this.__src,
732
- alt: this.__alt,
733
- mime: this.__mime,
734
- uploading: this.__uploading
735
- }
736
- )
737
- }
738
- );
739
- }
740
- }
741
- const Ae = (t) => at(new ve(t)), Xe = (t) => t instanceof ve, Ze = ge("EMOJI_USED_COMMAND"), xn = ir, Kr = [
742
- ...$t,
743
- ...Object.keys(xn).filter((t) => !$t.includes(t))
744
- ], kn = Kr.flatMap((t) => {
745
- const e = xn[t];
746
- return e?.char ? [{ name: t, char: e.char, keywords: e.keywords }] : [];
747
- }), Ur = new Map(kn.map((t) => [t.name, t])), wn = (t) => Ur.get(t.toLowerCase()), Hr = (t, e) => {
748
- const { name: n, keywords: o } = t;
749
- if (n === e) return { score: 0 };
750
- if (n.startsWith(e)) return { score: 1 };
751
- const r = o.find((s) => s.toLowerCase() === e);
752
- if (r) return { score: 2, keyword: r };
753
- if (n.includes(`_${e}`)) return { score: 3 };
754
- const i = o.find((s) => s.toLowerCase().startsWith(e));
755
- return i ? { score: 4, keyword: i } : n.includes(e) ? { score: 5 } : null;
756
- }, jr = (t, e = 8, n = {}) => {
757
- const o = t.toLowerCase(), r = [];
758
- return kn.forEach((i, s) => {
759
- const a = Hr(i, o);
760
- a && r.push({
761
- emoji: { ...i, matchedKeyword: a.keyword },
762
- score: a.score,
763
- index: s
764
- });
765
- }), r.sort(
766
- (i, s) => i.score - s.score || (n[s.emoji.name] ?? 0) - (n[i.emoji.name] ?? 0) || i.index - s.index
767
- ).slice(0, e).map(({ emoji: i }) => i);
768
- }, Gr = [
769
- "+1",
770
- "heart",
771
- "joy",
772
- "tada",
773
- "smile",
774
- "pray",
775
- "fire",
776
- "eyes",
777
- "white_check_mark",
778
- "rocket",
779
- "thinking",
780
- "clap",
781
- "raised_hands",
782
- "sweat_smile",
783
- "100",
784
- "x"
785
- ], Wr = (t) => (e, n) => (t[n] ?? 0) - (t[e] ?? 0), Yr = (t, e = {}, n = 8) => {
786
- if (!t) {
787
- const o = Object.keys(e).filter((i) => e[i] > 0).sort(Wr(e));
788
- return [.../* @__PURE__ */ new Set([...o, ...Gr])].flatMap((i) => wn(i) ?? []).slice(0, n);
789
- }
790
- return jr(t, n, e);
791
- }, qr = (t) => t.replaceAll(" ", "%20"), Qr = (t) => {
792
- try {
793
- return decodeURIComponent(t);
794
- } catch {
795
- return t;
796
- }
797
- }, Vr = (t) => t.replace(/[[\]]/g, ""), Jr = ht.join("|"), Nt = `\\[([^\\]\\n]+)\\]\\(@?(${Jr}):([^)\\s]+)\\)`, Xr = {
798
- dependencies: [be],
799
- export: (t) => hn(t) ? `[${Vr(t.getLabel())}](${t.getMentionType()}:${qr(t.getMentionId())})` : null,
800
- importRegExp: new RegExp(Nt),
801
- regExp: new RegExp(Nt + "$"),
802
- replace: (t, e) => {
803
- const [, n, o, r] = e, i = De(o, Qr(r), n.replace(/^@+/, ""));
804
- return t.replace(i), i;
805
- },
806
- trigger: ")",
807
- type: "text-match"
808
- }, Zr = {
809
- dependencies: [oo],
810
- export: (t) => Vt(t) ? `\\
811
- ` : null,
812
- // never matches, line breaks are imported by the paragraph importer
813
- importRegExp: /(?!)/,
814
- regExp: /(?!)$/,
815
- replace: () => {
816
- },
817
- type: "text-match"
818
- }, ei = {
819
- dependencies: [st],
820
- export: () => null,
821
- importRegExp: /(?!)/,
822
- regExp: /:([a-z0-9_+-]+):$/i,
823
- replace: (t, e) => {
824
- if (t.hasFormat("code")) return;
825
- const n = wn(e[1]);
826
- if (!n) return;
827
- const o = Ce(n.char).setFormat(t.getFormat());
828
- return t.replace(o), ro().dispatchCommand(Ze, n.name), o;
829
- },
830
- trigger: ":",
831
- type: "text-match"
832
- }, ti = {
833
- dependencies: [ye],
834
- export: (t) => Rr(t) ? t.getUrl() : null,
835
- regExp: /^\s*(https?:\/\/\S+)\s*$/,
836
- replace: (t, e, n, o) => {
837
- if (!o || !re(n[1])) return !1;
838
- t.replace(pe(n[1]));
839
- },
840
- type: "element"
841
- }, ni = {
842
- dependencies: [ve],
843
- export: (t) => {
844
- if (!Xe(t)) return null;
845
- if (t.isUploading()) return "";
846
- const e = t.getAlt().replace(/[[\]]/g, ""), n = t.getMime();
847
- return `![${e}](${t.getSrc()}${n ? ` "${n.replace(/"/g, "")}"` : ""})`;
848
- },
849
- regExp: /^\s*!\[([^\]]*)\]\(<?([^\s)>]+)>?(?:\s+"([^"]*)")?\)\s*$/,
850
- replace: (t, e, n, o) => {
851
- if (!o) return !1;
852
- const [, r, i, s] = n;
853
- t.replace(Ae({ src: i, alt: r, mime: s || null }));
854
- },
855
- type: "element"
856
- }, Pe = [
857
- ti,
858
- ni,
859
- Ko,
860
- Uo,
861
- Ho,
862
- jo,
863
- Go,
864
- Wo,
865
- Yo,
866
- qo,
867
- Qo,
868
- Vo,
869
- Jo,
870
- Xo,
871
- Zo,
872
- er,
873
- Xr,
874
- Zr,
875
- ei,
876
- tr
877
- ], oi = /^\s*(`{3,}|~{3,})/, _n = (t) => {
878
- let e = null;
879
- return t.map((n) => {
880
- const o = n.match(oi);
881
- return e ? (o && o[1][0] === e[0] && o[1].length >= e.length && (e = null), !0) : (o && (e = o[1]), !!o);
882
- });
883
- }, ri = (t, e) => {
884
- const n = t.split(`
885
- `), o = _n(n), r = [];
886
- return n.forEach((i, s) => {
887
- if (o[s]) return r.push(i);
888
- const a = e(i, s, n);
889
- a !== null && r.push(a);
890
- }), r.join(`
891
- `);
892
- }, En = (t) => {
893
- const e = t.split(`
894
- `), n = _n(e), o = [];
895
- let r = null, i = 0;
896
- return e.forEach((s, a) => {
897
- if (!n[a] && s.trim() === "") {
898
- r && o.push(r), r = null, i++;
899
- return;
900
- }
901
- const u = n[a] && (a === 0 || !n[a - 1]);
902
- r && (u || r.isCode && !n[a]) && (o.push(r), r = null), r || (r = { lines: [], blanksBefore: i, isCode: n[a] }, i = 0), r.lines.push(s);
903
- }), r && o.push(r), o;
904
- }, ii = /^\s*([-*+]\s|\d+[.)]\s|#{1,6}\s|>|\||:::|<\/?[a-z])/i, St = (t) => !t.isCode && !ii.test(t.lines[0]), si = (t) => (t.match(/\\+$/)?.[0].length ?? 0) % 2 === 1, ai = (t) => {
905
- if (t.isCode) return t.lines.join(`
906
- `);
907
- const e = [...t.lines], n = e.length - 1;
908
- return si(e[n]) && (e[n] = e[n].slice(0, -1).trimEnd()), e.map((o) => o.replace(li, "$1* $2")).join(`
909
- `);
910
- }, li = /^(\s*)[-+] (\[[ xX]\]\s)/, Ot = (t) => /^\s*(&nbsp;|<br\s*\/?>)\s*$/i.test(t), ci = (t) => {
911
- const e = ri(
912
- t.replace(/\r\n?/g, `
913
- `),
914
- (a) => a.replace(/<\/?u>/gi, "")
915
- ), n = En(e);
916
- if (!n.some((a) => !a.isCode && a.lines.some(Ot))) return e;
917
- let r = "", i = null, s = !1;
918
- for (const a of n) {
919
- const u = a.isCode ? a.lines : a.lines.filter((x) => !Ot(x));
920
- if (!u.length) {
921
- s = !0;
922
- continue;
923
- }
924
- const d = { ...a, lines: u }, v = u.join(`
925
- `);
926
- i ? !s && St(i) && St(d) ? r += `\\
927
- ` + v : r += `
928
-
929
- ` + v : r = v, i = d, s = !1;
930
- }
931
- return r;
932
- }, di = (t) => {
933
- if (!Y(t)) return !1;
934
- const e = t.getFirstChild();
935
- return e === null || t.getChildrenSize() === 1 && X(e) && /^\s{0,3}$/.test(e.getTextContent());
936
- }, ui = (t, e) => {
937
- const n = En(t), o = [];
938
- let r = !1;
939
- for (const s of e.getChildren()) {
940
- if (di(s)) {
941
- r = !0;
942
- continue;
943
- }
944
- o.push({ isParagraph: Y(s), hasGapBefore: r }), r = !1;
945
- }
946
- const i = o.length === n.length;
947
- return n.map((s, a) => {
948
- const u = ai(s);
949
- return a === 0 ? u : ((i ? !o[a].hasGapBefore && o[a].isParagraph && o[a - 1].isParagraph : !1) ? `\\
950
- ` : `
951
-
952
- `) + u;
953
- }).join("").trim();
954
- }, mi = (t) => {
955
- const e = [t];
956
- let n = t;
957
- for (const o of t.getChildren())
958
- Vt(o) ? (n = he().setFormat(t.getFormatType()), e.push(n), o.remove()) : n !== t && n.append(o);
959
- return e;
960
- }, pi = (t) => {
961
- const e = [];
962
- return t.forEach((n, o) => {
963
- if (!Y(n)) {
964
- e.push(n);
965
- return;
966
- }
967
- o > 0 && Y(t[o - 1]) && e.push(he()), e.push(...mi(n));
968
- }), e;
969
- }, Cn = (t) => (
970
- // shouldMergeAdjacentLines: a soft line break renders as a space, so show it as one
971
- pi(
972
- nr(
973
- ci(t || ""),
974
- Pe,
975
- !1,
976
- !0
977
- )
978
- )
979
- ), et = (t) => {
980
- const e = ie(), n = Cn(t);
981
- e.clear(), e.append(...n.length ? n : [he()]), M() !== null && e.selectStart();
982
- }, Rt = (t = ie()) => ui(or(Pe, t, !1), t), gi = () => {
983
- const e = ie().getChildren();
984
- if (e.length === 0) return !0;
985
- if (e.length > 1) return !1;
986
- const n = e[0];
987
- return Y(n) && n.getTextContentSize() === 0;
988
- }, Tn = Ee`
989
- .token.comment,
990
- .token.prolog,
991
- .token.doctype,
992
- .token.cdata {
993
- color: #7f848e;
994
- font-style: italic;
995
- }
996
- .token.punctuation {
997
- color: #abb2bf;
998
- }
999
- .token.property,
1000
- .token.tag,
1001
- .token.symbol,
1002
- .token.deleted,
1003
- .token.variable {
1004
- color: #e06c75;
1005
- }
1006
- .token.boolean,
1007
- .token.number,
1008
- .token.constant,
1009
- .token.attr-name {
1010
- color: #d19a66;
1011
- }
1012
- .token.string,
1013
- .token.char,
1014
- .token.attr-value,
1015
- .token.inserted {
1016
- color: #98c379;
1017
- }
1018
- .token.selector,
1019
- .token.keyword,
1020
- .token.atrule,
1021
- .token.important {
1022
- color: #c678dd;
1023
- }
1024
- .token.function {
1025
- color: #61afef;
1026
- }
1027
- .token.class-name,
1028
- .token.namespace {
1029
- color: #e5c07b;
1030
- }
1031
- .token.operator,
1032
- .token.entity,
1033
- .token.url,
1034
- .token.regex,
1035
- .token.builtin {
1036
- color: #56b6c2;
1037
- }
1038
- `, hi = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='20' viewBox='0 -960 960 960' width='20' fill='%2323E0A9'%3E%3Cpath d='m427.462-343.692 233.846-232.846L620-617.846 427.462-426.308l-87-86L299.154-471l128.308 127.308ZM480.134-104q-77.313 0-145.89-29.359-68.577-29.36-120.025-80.762-51.447-51.402-80.833-119.917Q104-402.554 104-479.866q0-78.569 29.418-146.871 29.419-68.303 80.922-119.917 51.503-51.614 119.916-80.48Q402.67-856 479.866-856q78.559 0 146.853 28.839 68.294 28.84 119.922 80.422 51.627 51.582 80.493 119.841Q856-558.639 856-480.05q0 77.589-28.839 145.826-28.84 68.237-80.408 119.786-51.569 51.548-119.81 80.993Q558.702-104 480.134-104Z'/%3E%3C/svg%3E")`, fi = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='20' viewBox='0 -960 960 960' width='20' fill='%23C4C7C5'%3E%3Cpath d='M480.409-104q-77.588 0-146.165-29.359-68.577-29.360-120.025-80.762-51.447-51.402-80.833-119.876Q104-402.471 104-480.325q0-78.110 29.418-146.412 29.419-68.303 80.922-119.917 51.503-51.614 119.875-80.480Q402.587-856 480.325-856q78.100 0 146.394 28.839 68.294 28.840 119.922 80.422 51.627 51.582 80.493 120.065Q856-558.191 856-480.326q0 77.865-28.839 146.102-28.840 68.237-80.408 119.786-51.569 51.548-120.034 80.993Q558.253-104 480.409-104ZM480-162q132.513 0 225.256-92.744Q798-347.487 798-480t-92.744-225.256Q612.513-798 480-798t-225.256 92.744Q162-612.513 162-480t92.744 225.256Q347.487-162 480-162Zm0-318Z'/%3E%3C/svg%3E")`, bi = w.div`
1039
- position: relative;
1040
- display: flex;
1041
- flex-direction: column;
1042
- min-width: 0;
1043
- border-radius: var(--border-radius-m);
1044
- background-color: var(--md-sys-color-surface-container-lowest);
1045
- color: var(--md-sys-color-on-surface);
1046
-
1047
- &.bordered {
1048
- border: 1px solid var(--md-sys-color-outline-variant);
1049
- &:focus-within {
1050
- border-color: var(--md-sys-color-primary);
1051
- }
1052
- }
1053
- `, yi = w.div`
1054
- position: relative;
1055
- display: flex;
1056
- align-items: center;
1057
- gap: var(--base-gap-small);
1058
- padding: 4px;
1059
- border-bottom: 1px solid var(--md-sys-color-outline-variant);
1060
- min-height: 40px;
1061
-
1062
- /* also buttons passed in around the items (e.g. attach) */
1063
- .md-toolbar-button {
1064
- padding: 4px;
1065
- min-height: 0;
1066
- color: var(--md-sys-color-outline);
1067
-
1068
- &:hover {
1069
- color: var(--md-sys-color-on-surface);
1070
- }
1071
-
1072
- &.active {
1073
- background-color: var(--md-sys-color-primary-container);
1074
- color: var(--md-sys-color-on-primary-container);
1075
- }
1076
- }
1077
-
1078
- /* hide the less used buttons when there is no room (instead of wrapping), headings last */
1079
- container-type: inline-size;
1080
- @container (max-width: 440px) {
1081
- .md-toolbar-item-strikethrough,
1082
- .md-toolbar-item-quote {
1083
- display: none;
1084
- }
1085
- }
1086
- @container (max-width: 380px) {
1087
- .md-toolbar-item-numberList,
1088
- .md-toolbar-divider {
1089
- display: none;
1090
- }
1091
- }
1092
- @container (max-width: 320px) {
1093
- .md-toolbar-item-codeBlock,
1094
- .md-toolbar-item-link,
1095
- .md-toolbar-item-h3 {
1096
- display: none;
1097
- }
1098
- }
1099
- `, vi = w.div`
1100
- display: flex;
1101
- align-items: center;
1102
- gap: 2px;
1103
- flex: 1;
1104
- min-width: 0;
1105
- overflow: hidden;
1106
- justify-content: flex-end;
1107
- `, xi = w.span`
1108
- width: 1px;
1109
- height: 18px;
1110
- margin: 0 4px;
1111
- background-color: var(--md-sys-color-outline-variant);
1112
- `, ki = w.div`
1113
- position: fixed;
1114
- z-index: 1100;
1115
- display: flex;
1116
- align-items: center;
1117
- gap: var(--base-gap-small);
1118
- max-width: calc(100vw - 16px);
1119
- padding: 2px 2px 2px 8px;
1120
- border-radius: var(--border-radius-m);
1121
- background-color: var(--md-sys-color-surface-container-high);
1122
- box-shadow: 0 3px 15px 0 rgba(0, 0, 0, 0.4);
1123
-
1124
- .icon {
1125
- color: var(--md-sys-color-outline);
1126
- }
1127
-
1128
- input {
1129
- all: unset;
1130
- flex: 1;
1131
- min-width: 0;
1132
- height: 32px;
1133
- color: var(--md-sys-color-on-surface);
1134
- text-overflow: ellipsis;
1135
-
1136
- &.invalid {
1137
- color: var(--md-sys-color-error);
1138
- }
1139
- }
1140
-
1141
- button {
1142
- padding: 4px;
1143
- min-height: 0;
1144
- }
1145
- `, wi = w.button`
1146
- all: unset;
1147
- position: fixed;
1148
- z-index: 1100;
1149
- display: flex;
1150
- align-items: center;
1151
- gap: 6px;
1152
- padding: 4px 6px 4px 8px;
1153
- border-radius: var(--border-radius-m);
1154
- background-color: var(--md-sys-color-surface-container-high);
1155
- box-shadow: 0 3px 15px 0 rgba(0, 0, 0, 0.4);
1156
- color: var(--md-sys-color-on-surface);
1157
- font-size: 12px;
1158
- cursor: pointer;
1159
-
1160
- .icon {
1161
- font-size: 18px;
1162
- color: var(--md-sys-color-primary);
1163
- }
1164
-
1165
- kbd {
1166
- padding: 0 4px;
1167
- border-radius: 4px;
1168
- font-family: monospace;
1169
- font-size: 11px;
1170
- color: var(--md-sys-color-outline);
1171
- background-color: var(--md-sys-color-surface-container-highest);
1172
- }
1173
-
1174
- &:hover {
1175
- background-color: var(--md-sys-color-surface-container-high-hover);
1176
- }
1177
- `, _i = w.div`
1178
- position: fixed;
1179
- z-index: 1000;
1180
- transform: translateX(-100%);
1181
-
1182
- /* the dropdown button is replaced by a small pill (valueTemplate) */
1183
- & > div > button {
1184
- height: auto;
1185
- min-height: 0;
1186
- padding: 0;
1187
- border: none;
1188
- background: none;
1189
- & > .icon:last-child {
1190
- display: none;
1191
- }
1192
- }
1193
- `, Ei = w.span`
1194
- display: flex;
1195
- align-items: center;
1196
- gap: 2px;
1197
- height: 22px;
1198
- padding: 0 4px 0 8px;
1199
- border-radius: var(--border-radius-m);
1200
- font-size: 11px;
1201
- /* labels with a space (Plain text) stay on one line */
1202
- white-space: nowrap;
1203
- color: var(--md-sys-color-outline);
1204
- background-color: var(--md-sys-color-surface-container-highest);
1205
- cursor: pointer;
1206
-
1207
- .icon {
1208
- font-size: 16px;
1209
- }
1210
-
1211
- &:hover {
1212
- color: var(--md-sys-color-on-surface);
1213
- }
1214
- `, Ci = w.div`
1215
- display: flex;
1216
- align-items: flex-end;
1217
- min-width: 0;
1218
-
1219
- .md-actions {
1220
- display: flex;
1221
- align-items: center;
1222
- gap: 2px;
1223
- padding: 4px;
1224
- }
1225
- `, Ti = w.div`
1226
- position: fixed;
1227
- z-index: 1100;
1228
- transform: translate(-50%, calc(-100% - 8px));
1229
- display: flex;
1230
- align-items: center;
1231
- min-width: 200px;
1232
- padding: 2px;
1233
- border-radius: var(--border-radius-m);
1234
- background-color: var(--md-sys-color-surface-container-high);
1235
- box-shadow: 0 3px 15px 0 rgba(0, 0, 0, 0.4);
1236
-
1237
- .md-toolbar-button {
1238
- padding: 4px;
1239
- min-height: 0;
1240
- color: var(--md-sys-color-outline);
1241
- &:hover {
1242
- color: var(--md-sys-color-on-surface);
1243
- }
1244
- &.active {
1245
- background-color: var(--md-sys-color-primary-container);
1246
- color: var(--md-sys-color-on-primary-container);
1247
- }
1248
- }
1249
- `, Li = w.div`
1250
- position: relative;
1251
- overflow-y: auto;
1252
- flex: 1;
1253
- min-width: 0;
1254
- `, Mi = w.div`
1255
- position: absolute;
1256
- top: 8px;
1257
- left: 10px;
1258
- right: 10px;
1259
- color: var(--md-sys-color-outline);
1260
- pointer-events: none;
1261
- user-select: none;
1262
- overflow: hidden;
1263
- text-overflow: ellipsis;
1264
- white-space: nowrap;
1265
- `, $i = w.div`
1266
- .md-content {
1267
- outline: none;
1268
- padding: 8px 10px;
1269
- min-height: 100%;
1270
- word-break: break-word;
1271
- line-height: 20px;
1272
- caret-color: var(--md-sys-color-on-surface);
1273
-
1274
- /* text is rendered in spans, which have a fixed font size in the global styles */
1275
- :where(span) {
1276
- font: inherit;
1277
- }
1278
-
1279
- /* lines (paragraphs) sit tight, an empty line is a paragraph break, other blocks get a gap */
1280
- & > * {
1281
- margin: 0;
1282
- }
1283
- & > * + * {
1284
- margin-top: 8px;
1285
- }
1286
- & > .md-paragraph + .md-paragraph {
1287
- margin-top: 0;
1288
- }
1289
- /* lexical's invisible caret helper next to a block (e.g. a video) at the start */
1290
- & > [data-lexical-decorator-boundary] + * {
1291
- margin-top: 0;
1292
- }
1293
- }
1294
-
1295
- .md-heading {
1296
- font-weight: 600;
1297
- }
1298
- .md-h1 {
1299
- font-size: 24px;
1300
- line-height: 32px;
1301
- }
1302
- .md-h2 {
1303
- font-size: 20px;
1304
- line-height: 28px;
1305
- }
1306
- .md-h3,
1307
- .md-h4,
1308
- .md-h5,
1309
- .md-h6 {
1310
- font-size: 16px;
1311
- line-height: 24px;
1312
- }
1313
-
1314
- .md-bold {
1315
- font-weight: 700;
1316
- }
1317
- .md-italic {
1318
- font-style: italic;
1319
- }
1320
- .md-strikethrough {
1321
- text-decoration: line-through;
1322
- }
1323
- .md-underline {
1324
- text-decoration: underline;
1325
- }
1326
-
1327
- /* inline code */
1328
- .md-code {
1329
- font-family: monospace;
1330
- font-size: 0.9em;
1331
- padding: 1px 4px;
1332
- margin: 0 1px;
1333
- border-radius: 4px;
1334
- background-color: var(--md-sys-color-surface-container-highest);
1335
- color: var(--md-sys-color-tertiary);
1336
- white-space: pre-wrap;
1337
- }
1338
- /* formatted parts of the same code span join up */
1339
- .md-code + .md-code {
1340
- margin-left: -1px;
1341
- padding-left: 0;
1342
- border-top-left-radius: 0;
1343
- border-bottom-left-radius: 0;
1344
- }
1345
-
1346
- /* code block, read only editors show the language (editable ones have a control for it) */
1347
- .md-code-block {
1348
- position: relative;
1349
- }
1350
- .md-content[contenteditable='false'] .md-code-block[data-language]::after {
1351
- content: attr(data-language);
1352
- position: absolute;
1353
- top: 4px;
1354
- right: 6px;
1355
- font-size: 11px;
1356
- color: var(--md-sys-color-outline);
1357
- }
1358
- /* same size as inline code, and as code blocks in comments (ActivityComment BlockCode) */
1359
- .md-code-block {
1360
- display: block;
1361
- font-family: monospace;
1362
- font-size: 0.9em;
1363
- line-height: 18px;
1364
- padding: 8px 10px;
1365
- border-radius: var(--border-radius-m);
1366
- background-color: var(--md-sys-color-surface-container-high);
1367
- white-space: pre-wrap;
1368
- tab-size: 2;
1369
- overflow-x: auto;
1370
- * {
1371
- font-family: monospace;
1372
- font-size: inherit;
1373
- }
1374
- }
1375
-
1376
- .md-quote {
1377
- padding: 2px 0 2px 10px;
1378
- border-left: 3px solid var(--md-sys-color-outline-variant);
1379
- color: var(--md-sys-color-outline);
1380
- }
1381
-
1382
- .md-link {
1383
- color: var(--md-sys-color-primary);
1384
- text-decoration: underline;
1385
- cursor: text;
1386
- }
1387
-
1388
- /* lists */
1389
- .md-list {
1390
- padding-left: 22px;
1391
- }
1392
- .md-list-ul {
1393
- list-style-type: disc;
1394
- }
1395
- .md-list-ol {
1396
- list-style-type: decimal;
1397
- }
1398
- .md-list-item {
1399
- margin: 2px 0;
1400
- }
1401
- .md-list-item-nested {
1402
- list-style-type: none;
1403
- &::before,
1404
- &::after {
1405
- display: none;
1406
- }
1407
- }
1408
- .md-list .md-list {
1409
- padding-left: 18px;
1410
- }
1411
- .md-list-ul .md-list-ul {
1412
- list-style-type: circle;
1413
- }
1414
-
1415
- /* checklists, the ::before is the clickable checkbox (see CheckListPlugin) */
1416
- .md-checklist {
1417
- padding-left: 0;
1418
- }
1419
- .md-list-item-checked,
1420
- .md-list-item-unchecked {
1421
- position: relative;
1422
- list-style-type: none;
1423
- padding-left: 26px;
1424
- min-height: 20px;
1425
- outline: none;
1426
-
1427
- &::before {
1428
- content: '';
1429
- position: absolute;
1430
- left: 0;
1431
- top: 0;
1432
- width: 20px;
1433
- height: 20px;
1434
- cursor: pointer;
1435
- background-size: 20px 20px;
1436
- background-repeat: no-repeat;
1437
- }
1438
- }
1439
- .md-list-item-unchecked::before {
1440
- background-image: ${fi};
1441
- }
1442
- .md-list-item-checked {
1443
- color: var(--md-sys-color-outline);
1444
- &::before {
1445
- background-image: ${hi};
1446
- }
1447
- }
1448
-
1449
- /* syntax highlighting (prism tokens) */
1450
- .md-code-block {
1451
- ${Tn}
1452
- }
1453
-
1454
- /* embedded blocks (videos), selected by clicking their frame */
1455
- .md-embed {
1456
- display: flex;
1457
- padding: 2px;
1458
- border-radius: var(--border-radius-m);
1459
- user-select: none;
1460
- }
1461
- .md-embed-focus {
1462
- outline: 2px solid var(--md-sys-color-primary);
1463
- }
1464
-
1465
- /* mentions, and links to comments (ActivityLinkPlugin) */
1466
- .mention,
1467
- .md-activity-link {
1468
- display: inline;
1469
- padding: 1px 4px;
1470
- border-radius: var(--border-radius-m);
1471
- background-color: var(--md-sys-color-surface-container-high);
1472
- color: var(--md-sys-color-primary);
1473
- white-space: nowrap;
1474
- cursor: pointer;
1475
-
1476
- &:hover {
1477
- background-color: var(--md-sys-color-surface-container-high-hover);
1478
- }
1479
- }
1480
- .mention-user,
1481
- .mention-team {
1482
- cursor: default;
1483
- }
1484
- .md-activity-link {
1485
- text-decoration: none;
1486
- }
1487
- `, Ni = w.div`
1488
- position: absolute;
1489
- top: 4px;
1490
- left: 0;
1491
- z-index: 1100;
1492
- width: 320px;
1493
- max-width: calc(100vw - 16px);
1494
- padding: 0 0 4px;
1495
- border-radius: var(--border-radius-m);
1496
- background-color: var(--md-sys-color-surface-container-high);
1497
- box-shadow: 0 3px 15px 0 rgba(0, 0, 0, 0.4);
1498
- overflow: hidden;
1499
-
1500
- &.above {
1501
- top: auto;
1502
- /* the anchor sits just below the caret line */
1503
- bottom: calc(100% + 26px);
1504
- }
1505
-
1506
- /* fixed across the top of the editor, like a chat app */
1507
- &.top {
1508
- top: auto;
1509
- left: 0;
1510
- right: 0;
1511
- bottom: calc(100% + 6px);
1512
- width: auto;
1513
- max-width: none;
1514
- }
1515
-
1516
- ul {
1517
- /* the offset parent of its options, for scrolling the highlighted one into view */
1518
- position: relative;
1519
- margin: 0;
1520
- padding: 0 4px;
1521
- max-height: 360px;
1522
- overflow-y: auto;
1523
-
1524
- &.untitled {
1525
- padding-top: 4px;
1526
- }
1527
- }
1528
- `, Si = w.li`
1529
- list-style: none;
1530
- height: 1px;
1531
- margin: 4px 4px;
1532
- background-color: var(--md-sys-color-outline-variant);
1533
- `, Oi = w.div`
1534
- display: flex;
1535
- align-items: center;
1536
- justify-content: space-between;
1537
- padding: 6px 8px;
1538
- margin-bottom: 4px;
1539
- background-color: var(--md-sys-color-surface-container-lowest);
1540
- color: var(--md-sys-color-outline);
1541
- `, Ri = w.span`
1542
- display: flex;
1543
- gap: 2px;
1544
- `, Ii = w.button`
1545
- all: unset;
1546
- display: flex;
1547
- align-items: center;
1548
- justify-content: center;
1549
- width: 24px;
1550
- height: 24px;
1551
- border-radius: var(--border-radius-m);
1552
- cursor: pointer;
1553
- color: var(--md-sys-color-outline);
1554
-
1555
- .icon {
1556
- font-size: 16px;
1557
- }
1558
-
1559
- &:hover {
1560
- background-color: var(--md-sys-color-surface-container-high-hover);
1561
- color: var(--md-sys-color-on-surface);
1562
- }
1563
-
1564
- &.active {
1565
- background-color: var(--md-sys-color-primary-container);
1566
- color: var(--md-sys-color-on-primary-container);
1567
- }
1568
- `, It = w.li`
1569
- list-style: none;
1570
- margin: 0;
1571
- padding: 6px 8px;
1572
- border-radius: var(--border-radius-m);
1573
- display: flex;
1574
- gap: var(--base-gap-large);
1575
- align-items: center;
1576
- user-select: none;
1577
- cursor: pointer;
1578
- white-space: nowrap;
1579
- overflow: hidden;
1580
-
1581
- &:hover,
1582
- &.selected {
1583
- background-color: var(--md-sys-color-surface-container-high-hover);
1584
- }
1585
-
1586
- &.empty {
1587
- cursor: default;
1588
- color: var(--md-sys-color-outline);
1589
- &:hover {
1590
- background-color: unset;
1591
- }
1592
- }
1593
-
1594
- .context {
1595
- margin-right: -4px;
1596
- }
1597
- .emoji {
1598
- width: 20px;
1599
- font-size: 18px;
1600
- line-height: 20px;
1601
- text-align: center;
1602
- }
1603
- .label {
1604
- font-weight: 500;
1605
- overflow: hidden;
1606
- text-overflow: ellipsis;
1607
- }
1608
- .suffix {
1609
- color: var(--md-sys-color-outline);
1610
- margin-left: auto;
1611
- }
1612
- .hint {
1613
- font-family: monospace;
1614
- font-size: 11px;
1615
- }
1616
- `, Ai = 4, Di = 26, yt = ({
1617
- editor: t,
1618
- anchor: e,
1619
- placement: n,
1620
- title: o,
1621
- titleActions: r,
1622
- options: i,
1623
- selectedIndex: s,
1624
- onSelect: a,
1625
- onHighlight: u,
1626
- renderOption: d,
1627
- optionClassName: v,
1628
- emptyMessage: x,
1629
- className: g,
1630
- getGroup: h
1631
- }) => {
1632
- const f = O(null), c = O(null), [m, _] = U(!1);
1633
- oe(() => {
1634
- const k = f.current, C = k?.querySelector('[aria-selected="true"]');
1635
- if (!k || !C) return;
1636
- const b = C.offsetTop, L = b + C.offsetHeight;
1637
- b < k.scrollTop ? k.scrollTop = b - 4 : L > k.scrollTop + k.clientHeight && (k.scrollTop = L - k.clientHeight + 4);
1638
- }, [s]);
1639
- const T = n === "top", E = t.getRootElement(), p = E?.closest(".md-mention-anchor") || E?.closest(".md-editor"), y = T && p ? p : e;
1640
- return oe(() => {
1641
- const k = c.current;
1642
- if (T || !k) return;
1643
- const C = e.getBoundingClientRect(), b = k.offsetHeight, L = window.innerHeight - C.top - Ai, I = C.top - Di;
1644
- _(b > L && I > L);
1645
- }, [T, e, i.length, o, x]), fe(
1646
- /* @__PURE__ */ S(
1647
- Ni,
1648
- {
1649
- ref: c,
1650
- className: P("mention-menu md-popover", ae, g, {
1651
- above: m,
1652
- top: T
1653
- }),
1654
- onMouseDown: (k) => k.preventDefault(),
1655
- children: [
1656
- (o || r) && /* @__PURE__ */ S(Oi, { children: [
1657
- /* @__PURE__ */ l("span", { children: o }),
1658
- r
1659
- ] }),
1660
- /* @__PURE__ */ S("ul", { ref: f, role: "listbox", className: P({ untitled: !o && !r }), children: [
1661
- i.map((k, C) => [
1662
- C > 0 && h && h(k) !== h(i[C - 1]) && /* @__PURE__ */ l(Si, { role: "separator" }, `divider-${k.key}`),
1663
- /* @__PURE__ */ l(
1664
- It,
1665
- {
1666
- ref: (b) => k.setRefElement(b),
1667
- role: "option",
1668
- "aria-selected": s === C,
1669
- className: P(v?.(k), { selected: s === C }),
1670
- onMouseEnter: () => u(C),
1671
- onClick: () => {
1672
- u(C), a(k);
1673
- },
1674
- children: d(k)
1675
- },
1676
- k.key
1677
- )
1678
- ]),
1679
- !i.length && x && /* @__PURE__ */ l(It, { className: "empty", children: x })
1680
- ] })
1681
- ]
1682
- }
1683
- ),
1684
- y
1685
- );
1686
- }, Be = () => {
1687
- const t = M();
1688
- if (!$(t)) return !1;
1689
- if (t.hasFormat("code")) return !0;
1690
- const e = t.anchor.getNode();
1691
- return X(e) && e.hasFormat("code") ? !0 : !!W(e, ee);
1692
- }, vt = ge(
1693
- "INSERT_MENTION_TRIGGER_COMMAND"
1694
- ), Pi = ["@", "@@", "@@@"], Bi = {
1695
- "@": {
1696
- title: "@ Users & Teams",
1697
- noun: "user",
1698
- isCircle: !0,
1699
- filters: [
1700
- { id: "user", icon: "person", tooltip: "Filter users" },
1701
- { id: "team", icon: "group", tooltip: "Filter teams" }
1702
- ]
1703
- },
1704
- "@@": { title: "@@ Versions", noun: "version" },
1705
- "@@@": { title: "@@@ Tasks", noun: "task" }
1706
- }, At = /(^|[\s([{"'])(@{1,3})([^\s@]{0,75})$/;
1707
- class zi extends gt {
1708
- item;
1709
- constructor(e, n) {
1710
- super(`${e.type}:${e.id}:${n}`), this.item = e;
1711
- }
1712
- }
1713
- const Fi = ({ source: t, menuParent: e, placement: n = "inline" }) => {
1714
- const [o] = A(), [r, i] = U(null), [s, a] = U(null), u = O("@"), [d, v] = U("@"), x = t.triggers ?? Pi, g = t.limit ?? (n === "top" ? 8 : 5), h = H(
1715
- (E) => {
1716
- if (Be()) return null;
1717
- const p = At.exec(E);
1718
- if (!p) return null;
1719
- const y = p[2];
1720
- return x.includes(y) ? (u.current = y, {
1721
- leadOffset: p.index + p[1].length,
1722
- matchingString: p[3],
1723
- replaceableString: p[2] + p[3]
1724
- }) : null;
1725
- },
1726
- [x.join()]
1727
- ), f = H((E) => {
1728
- if (i(E), E === null) {
1729
- a(null);
1730
- return;
1731
- }
1732
- v((p) => (p !== u.current && a(null), u.current));
1733
- }, []), c = { ...Bi[d], ...t.config?.[d] }, m = r !== null ? t.getError?.(d) : null, _ = _e(() => r === null || m ? [] : t.getOptions({ trigger: d, search: r.toLowerCase(), filter: s }).slice(0, g).map((E, p) => new zi(E, p)), [r, d, s, t, g, m]), T = H(
1734
- (E, p, y) => {
1735
- o.update(() => {
1736
- const { type: k, id: C, label: b } = E.item, L = De(k, C, b);
1737
- if (p)
1738
- p.replace(L);
1739
- else {
1740
- const F = M();
1741
- $(F) && F.insertNodes([L]);
1742
- }
1743
- const I = L.getNextSibling();
1744
- if (X(I) && I.getTextContent().startsWith(" "))
1745
- I.select(1, 1);
1746
- else {
1747
- const F = Ce(" ");
1748
- L.insertAfter(F), F.select(1, 1);
1749
- }
1750
- y();
1751
- });
1752
- },
1753
- [o]
1754
- );
1755
- return oe(
1756
- () => q(
1757
- o.registerCommand(
1758
- vt,
1759
- (E) => {
1760
- const p = M();
1761
- if (!$(p)) return !1;
1762
- if (r !== null && p.isCollapsed()) {
1763
- const L = p.anchor, I = L.getNode();
1764
- if (X(I)) {
1765
- const F = I.getTextContent().slice(0, L.offset), N = At.exec(F);
1766
- if (N) {
1767
- const G = N.index + N[1].length;
1768
- I.spliceText(G, L.offset - G, "", !0);
1769
- }
1770
- }
1771
- }
1772
- const y = M();
1773
- if (!$(y)) return !1;
1774
- const k = y.anchor, C = k.type === "text" ? k.getNode().getTextContent().slice(0, k.offset) : "", b = C.length > 0 && !/\s$/.test(C);
1775
- return y.insertText((b ? " " : "") + E), !0;
1776
- },
1777
- Jt
1778
- )
1779
- ),
1780
- [o, r]
1781
- ), /* @__PURE__ */ l(
1782
- pt,
1783
- {
1784
- onQueryChange: f,
1785
- onSelectOption: T,
1786
- triggerFn: h,
1787
- options: _,
1788
- parent: e,
1789
- commandPriority: Z,
1790
- menuRenderFn: (E, { selectedIndex: p, selectOptionAndCleanUp: y, setHighlightedIndex: k }) => {
1791
- const C = E.current;
1792
- return !C || !_.length && !m && (r || s) ? null : /* @__PURE__ */ l(
1793
- yt,
1794
- {
1795
- editor: o,
1796
- anchor: C,
1797
- placement: n,
1798
- title: c.title,
1799
- titleActions: !!c.filters?.length && /* @__PURE__ */ l(Ri, { children: c.filters.map((b) => /* @__PURE__ */ l(
1800
- Ii,
1801
- {
1802
- className: P({ active: s === b.id }),
1803
- onClick: () => a((L) => L === b.id ? null : b.id),
1804
- "data-tooltip": b.tooltip,
1805
- "aria-label": b.tooltip,
1806
- "data-tooltip-delay": 0,
1807
- type: "button",
1808
- children: /* @__PURE__ */ l(J, { icon: b.icon })
1809
- },
1810
- b.id
1811
- )) }),
1812
- options: _,
1813
- selectedIndex: p,
1814
- onSelect: y,
1815
- onHighlight: k,
1816
- optionClassName: () => c.isCircle ? void 0 : "square",
1817
- emptyMessage: m || `No ${c.noun}s found`,
1818
- renderOption: ({ item: b }) => /* @__PURE__ */ S(me, { children: [
1819
- t.renderOptionImage ? t.renderOptionImage(b) : b.type === "user" ? /* @__PURE__ */ l(fr, { size: 20, name: b.id, className: "image" }) : b.icon && /* @__PURE__ */ l(J, { icon: b.icon, className: "image", style: { color: b.color } }),
1820
- b.context && /* @__PURE__ */ S("span", { className: "context", children: [
1821
- b.context,
1822
- " - "
1823
- ] }),
1824
- /* @__PURE__ */ l("span", { className: "label", children: b.label }),
1825
- b.suffix && /* @__PURE__ */ l("span", { className: "suffix", children: b.suffix })
1826
- ] })
1827
- }
1828
- );
1829
- }
1830
- }
1831
- );
1832
- }, Dt = "emojiUsage", Ki = 40, Ui = () => {
1833
- const { user: t } = cr(), e = t?.data?.frontendPreferences?.[Dt] ?? {}, n = O(e);
1834
- n.current = e;
1835
- const [o] = qn(), r = H(
1836
- (i) => {
1837
- if (!t?.name) return;
1838
- const s = { ...n.current, [i]: (n.current[i] ?? 0) + 1 }, a = Object.fromEntries(
1839
- Object.entries(s).sort(([, u], [, d]) => d - u).slice(0, Ki)
1840
- );
1841
- n.current = a, o({
1842
- userName: t.name,
1843
- patchData: { [Dt]: a },
1844
- // @ts-expect-error - disableInvalidations is not in the api
1845
- disableInvalidations: !0
1846
- }).unwrap().catch(() => {
1847
- });
1848
- },
1849
- [t?.name, o]
1850
- );
1851
- return { usage: e, recordUse: r };
1852
- }, Hi = /(^|[\s([{"'])(:)([a-z0-9_+-]{0,40})$/i;
1853
- class ji extends gt {
1854
- emoji;
1855
- constructor(e) {
1856
- super(e.name), this.emoji = e;
1857
- }
1858
- }
1859
- const Gi = ({ placement: t = "inline", menuParent: e }) => {
1860
- const [n] = A(), [o, r] = U(null), i = t === "top" ? 8 : 5, { usage: s, recordUse: a } = Ui(), u = _e(
1861
- () => o === null ? [] : Yr(o, s, i).map((x) => new ji(x)),
1862
- [o, i, s]
1863
- );
1864
- R(
1865
- () => n.registerCommand(
1866
- Ze,
1867
- (x) => (a(x), !1),
1868
- Jt
1869
- ),
1870
- [n, a]
1871
- );
1872
- const d = H((x) => {
1873
- if (Be()) return null;
1874
- const g = Hi.exec(x);
1875
- return g ? {
1876
- leadOffset: g.index + g[1].length,
1877
- matchingString: g[3],
1878
- replaceableString: g[2] + g[3]
1879
- } : null;
1880
- }, []), v = H(
1881
- (x, g, h) => {
1882
- n.update(() => {
1883
- if (!g) return;
1884
- const f = Ce(x.emoji.char).setFormat(g.getFormat());
1885
- g.replace(f);
1886
- const c = f.getNextSibling();
1887
- if (X(c) && c.getTextContent().startsWith(" "))
1888
- c.select(1, 1);
1889
- else {
1890
- const m = Ce(" ");
1891
- f.insertAfter(m), m.select(1, 1);
1892
- }
1893
- h();
1894
- }), n.dispatchCommand(Ze, x.emoji.name);
1895
- },
1896
- [n]
1897
- );
1898
- return /* @__PURE__ */ l(
1899
- pt,
1900
- {
1901
- onQueryChange: r,
1902
- onSelectOption: v,
1903
- triggerFn: d,
1904
- options: u,
1905
- parent: e,
1906
- commandPriority: Z,
1907
- preselectFirstItem: !!o,
1908
- menuRenderFn: (x, { selectedIndex: g, selectOptionAndCleanUp: h, setHighlightedIndex: f }) => {
1909
- const c = x.current;
1910
- return !c || !u.length ? null : /* @__PURE__ */ l(
1911
- yt,
1912
- {
1913
- editor: n,
1914
- anchor: c,
1915
- placement: t,
1916
- className: "emoji-menu",
1917
- title: o ? `Emoji matching :${o}` : Object.keys(s).length ? "Frequently used" : "Popular emoji",
1918
- options: u,
1919
- selectedIndex: g,
1920
- onSelect: h,
1921
- onHighlight: f,
1922
- renderOption: ({ emoji: m }) => /* @__PURE__ */ S(me, { children: [
1923
- /* @__PURE__ */ l("span", { className: "image emoji", "aria-hidden": !0, children: m.char }),
1924
- /* @__PURE__ */ S("span", { className: "label", children: [
1925
- ":",
1926
- m.name,
1927
- ":"
1928
- ] }),
1929
- m.matchedKeyword && /* @__PURE__ */ l("span", { className: "suffix", children: m.matchedKeyword })
1930
- ] })
1931
- }
1932
- );
1933
- }
1934
- }
1935
- );
1936
- }, Pt = (t) => {
1937
- const e = t.target?.closest?.(
1938
- "[data-mention-value]"
1939
- );
1940
- if (!e) return null;
1941
- const n = ft(e.getAttribute("data-mention-value"));
1942
- return n ? { target: e, mention: { ...n, label: e.getAttribute("data-mention-label") || "" } } : null;
1943
- }, Wi = ({ onMentionClick: t, onMentionHover: e }) => {
1944
- const [n] = A(), o = O({ onMentionClick: t, onMentionHover: e });
1945
- return o.current = { onMentionClick: t, onMentionHover: e }, R(() => {
1946
- const r = (u) => {
1947
- const d = Pt(u);
1948
- d && o.current.onMentionClick?.(d.mention, u);
1949
- }, i = (u) => {
1950
- const d = Pt(u);
1951
- !d || d.target.contains(u.relatedTarget) || o.current.onMentionHover?.(d.mention, d.target);
1952
- };
1953
- let s = null;
1954
- const a = n.registerRootListener((u, d) => {
1955
- d?.removeEventListener("click", r), d?.removeEventListener("mouseover", i), u?.addEventListener("click", r), u?.addEventListener("mouseover", i), s = u;
1956
- });
1957
- return () => {
1958
- a(), s?.removeEventListener("click", r), s?.removeEventListener("mouseover", i);
1959
- };
1960
- }, [n]), null;
1961
- }, tt = (t) => {
1962
- let e = t.getKey() === "root" ? t : W(t, (n) => {
1963
- const o = n.getParent();
1964
- return o !== null && io(o);
1965
- });
1966
- if (e === null && (e = t.getTopLevelElementOrThrow()), sn(e))
1967
- return (sr(t, an) ?? e).getListType();
1968
- if (To(e)) {
1969
- const n = e.getTag();
1970
- return n === "h1" || n === "h2" || n === "h3" ? n : "heading";
1971
- }
1972
- return on(e) ? "quote" : ee(e) ? "code" : "paragraph";
1973
- }, Yi = {
1974
- bullet: Ao,
1975
- number: Io,
1976
- check: Ro
1977
- }, j = (t, e, n = "toggle") => {
1978
- const o = t.getEditorState().read(() => {
1979
- const r = M();
1980
- return $(r) ? tt(r.anchor.getNode()) : null;
1981
- });
1982
- if (o !== null && !(n === "set" && o === e)) {
1983
- if (e === "bullet" || e === "number" || e === "check") {
1984
- o === e ? t.dispatchCommand(Oo, void 0) : t.dispatchCommand(Yi[e], void 0);
1985
- return;
1986
- }
1987
- t.update(() => {
1988
- const r = M();
1989
- if ($(r)) {
1990
- if (o === e) {
1991
- Me(r, () => he());
1992
- return;
1993
- }
1994
- if (e === "h1" || e === "h2" || e === "h3")
1995
- Me(r, () => Lo(e));
1996
- else if (e === "quote") Me(r, () => Mo());
1997
- else if (r.isCollapsed()) Me(r, () => Mt());
1998
- else {
1999
- const i = r.getTextContent(), s = Mt();
2000
- r.insertNodes([s]);
2001
- const a = M();
2002
- $(a) && a.insertRawText(i);
2003
- }
2004
- }
2005
- });
2006
- }
2007
- }, Ln = ge(
2008
- "OPEN_LINK_EDITOR_COMMAND"
2009
- ), Mn = ge(
2010
- "OPEN_VIDEO_PROMPT_COMMAND"
2011
- ), Bt = (t) => {
2012
- const e = t.trim();
2013
- return e ? /^(https?:|mailto:|\/|#)/i.test(e) ? e : `https://${e}` : "";
2014
- }, qi = {
2015
- blockType: "paragraph",
2016
- formats: {},
2017
- isLink: !1
2018
- }, Qi = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform), $e = Qi ? "⌘" : "Ctrl+", Ye = {
2019
- h1: { icon: "format_h1", tooltip: "Heading 1", shortcut: "#" },
2020
- h2: { icon: "format_h2", tooltip: "Heading 2", shortcut: "##" },
2021
- h3: { icon: "format_h3", tooltip: "Heading 3", shortcut: "###" },
2022
- bold: { icon: "format_bold", tooltip: "Bold", shortcut: `${$e}B` },
2023
- italic: { icon: "format_italic", tooltip: "Italic", shortcut: `${$e}I` },
2024
- strikethrough: { icon: "strikethrough_s", tooltip: "Strikethrough" },
2025
- code: { icon: "code", tooltip: "Inline code", shortcut: `${$e}E` },
2026
- link: { icon: "link", tooltip: "Link", shortcut: `${$e}K` },
2027
- codeBlock: { icon: "data_object", tooltip: "Code block", shortcut: "```" },
2028
- quote: { icon: "format_quote", tooltip: "Quote", shortcut: ">" },
2029
- numberList: { icon: "format_list_numbered", tooltip: "Numbered list", shortcut: "1." },
2030
- bulletList: { icon: "format_list_bulleted", tooltip: "Bullet list", shortcut: "-" },
2031
- checkList: { icon: "check_circle", tooltip: "Checklist", shortcut: "[]" }
2032
- }, zt = ({ layout: t = Tr, start: e, end: n, floating: o }) => {
2033
- const [r] = A(), [i, s] = U(qi), [a, u] = U(null), d = H(() => {
2034
- const c = r.getRootElement(), m = window.getSelection();
2035
- if (!c || !m || m.isCollapsed || !m.rangeCount) {
2036
- u(null);
2037
- return;
2038
- }
2039
- if (!c.contains(m.anchorNode)) return;
2040
- const _ = m.getRangeAt(0).getBoundingClientRect();
2041
- u({ top: _.top, left: _.left + _.width / 2 });
2042
- }, [r]), v = H(() => {
2043
- const c = M();
2044
- if (!$(c)) return;
2045
- const m = c.anchor.getNode(), _ = {};
2046
- for (const T of ["bold", "italic", "strikethrough", "code"])
2047
- _[T] = c.hasFormat(T);
2048
- o && (c.isCollapsed() || tt(m) === "code" ? u(null) : requestAnimationFrame(() => d())), s({
2049
- blockType: tt(m),
2050
- formats: _,
2051
- isLink: !!W(m, ne)
2052
- });
2053
- }, [o, d]);
2054
- R(
2055
- () => q(
2056
- r.registerUpdateListener(({ editorState: c }) => {
2057
- c.read(v);
2058
- }),
2059
- r.registerCommand(
2060
- lt,
2061
- () => (v(), !1),
2062
- Qe
2063
- ),
2064
- r.registerCommand(
2065
- ct,
2066
- () => (u(null), !1),
2067
- D
2068
- )
2069
- ),
2070
- [r, v]
2071
- ), R(() => {
2072
- if (!(!o || !a))
2073
- return window.addEventListener("scroll", d, !0), window.addEventListener("resize", d), () => {
2074
- window.removeEventListener("scroll", d, !0), window.removeEventListener("resize", d);
2075
- };
2076
- }, [o, !!a, d]);
2077
- const x = (c) => {
2078
- switch (c) {
2079
- case "bold":
2080
- case "italic":
2081
- case "strikethrough":
2082
- case "code":
2083
- r.dispatchCommand(dt, c);
2084
- break;
2085
- case "h1":
2086
- case "h2":
2087
- case "h3":
2088
- j(r, c);
2089
- break;
2090
- case "quote":
2091
- j(r, "quote");
2092
- break;
2093
- case "codeBlock":
2094
- j(r, "code");
2095
- break;
2096
- case "link":
2097
- u(null), r.dispatchCommand(Ln, void 0);
2098
- break;
2099
- case "bulletList":
2100
- j(r, "bullet");
2101
- break;
2102
- case "numberList":
2103
- j(r, "number");
2104
- break;
2105
- case "checkList":
2106
- j(r, "check");
2107
- break;
2108
- }
2109
- }, g = (c) => {
2110
- switch (c) {
2111
- case "bold":
2112
- case "italic":
2113
- case "strikethrough":
2114
- case "code":
2115
- return !!i.formats[c];
2116
- case "h1":
2117
- case "h2":
2118
- case "h3":
2119
- return i.blockType === c;
2120
- case "quote":
2121
- return i.blockType === "quote";
2122
- case "codeBlock":
2123
- return i.blockType === "code";
2124
- case "link":
2125
- return i.isLink;
2126
- case "bulletList":
2127
- return i.blockType === "bullet";
2128
- case "numberList":
2129
- return i.blockType === "number";
2130
- case "checkList":
2131
- return i.blockType === "check";
2132
- }
2133
- }, h = (c) => i.blockType === "code" && ["bold", "italic", "strikethrough", "code", "link"].includes(c), f = /* @__PURE__ */ l(vi, { children: t.map(
2134
- (c, m) => c === "|" ? /* @__PURE__ */ l(xi, { className: "md-toolbar-divider" }, `divider-${m}`) : /* @__PURE__ */ l(Jn, { children: /* @__PURE__ */ l(
2135
- te,
2136
- {
2137
- icon: Ye[c].icon,
2138
- variant: "text",
2139
- className: P("md-toolbar-button", `md-toolbar-item-${c}`, {
2140
- active: g(c)
2141
- }),
2142
- disabled: h(c),
2143
- "data-tooltip": Ye[c].tooltip,
2144
- "data-shortcut": Ye[c].shortcut,
2145
- "aria-pressed": g(c),
2146
- onMouseDown: (_) => _.preventDefault(),
2147
- onClick: () => x(c),
2148
- type: "button"
2149
- }
2150
- ) }, c)
2151
- ) });
2152
- return o ? a ? fe(
2153
- /* @__PURE__ */ l(
2154
- Ti,
2155
- {
2156
- className: P("md-toolbar md-floating-toolbar md-popover", ae),
2157
- style: { top: a.top, left: a.left },
2158
- children: f
2159
- }
2160
- ),
2161
- document.body
2162
- ) : null : /* @__PURE__ */ S(yi, { className: "md-toolbar", children: [
2163
- e,
2164
- f,
2165
- n
2166
- ] });
2167
- }, Vi = (t) => t.metaKey || t.ctrlKey, Ji = () => {
2168
- const [t] = A();
2169
- return R(
2170
- () => q(
2171
- t.registerCommand(
2172
- Xt,
2173
- (e) => Vi(e) && !e.shiftKey && !e.altKey && e.key.toLowerCase() === "e" ? (e.preventDefault(), t.dispatchCommand(dt, "code"), !0) : !1,
2174
- D
2175
- ),
2176
- t.registerCommand(
2177
- Zt,
2178
- (e) => {
2179
- if (e?.shiftKey) return !1;
2180
- const n = M();
2181
- if (!$(n) || !n.isCollapsed() || !n.hasFormat("code")) return !1;
2182
- const o = n.anchor.getNode();
2183
- if (!X(o) || !o.hasFormat("code") || n.anchor.offset !== o.getTextContentSize()) return !1;
2184
- e?.preventDefault();
2185
- const r = o.getNextSibling();
2186
- return X(r) && !r.hasFormat("code") && r.isSimpleText() ? r.select(0, 0) : n.toggleFormat("code"), !0;
2187
- },
2188
- D
2189
- ),
2190
- t.registerCommand(
2191
- so,
2192
- (e) => {
2193
- if (e?.shiftKey) return !1;
2194
- const n = M();
2195
- if (!$(n) || !n.isCollapsed() || !n.hasFormat("code")) return !1;
2196
- const o = n.anchor.getNode();
2197
- if (!X(o) || !o.hasFormat("code") || n.anchor.offset !== 0) return !1;
2198
- e?.preventDefault();
2199
- const r = o.getPreviousSibling();
2200
- if (X(r) && !r.hasFormat("code") && r.isSimpleText()) {
2201
- const i = r.getTextContentSize();
2202
- r.select(i, i);
2203
- } else
2204
- n.toggleFormat("code");
2205
- return !0;
2206
- },
2207
- D
2208
- )
2209
- ),
2210
- [t]
2211
- ), null;
2212
- }, Xi = () => {
2213
- const [t] = A();
2214
- return R(() => {
2215
- const e = (n) => {
2216
- if (n?.shiftKey) return !1;
2217
- const o = M();
2218
- if (!$(o) || !o.isCollapsed()) return !1;
2219
- const r = ie().getLastChild();
2220
- if (!r || !(ee(r) || on(r))) return !1;
2221
- const i = o.anchor.getNode(), s = i.getTopLevelElement();
2222
- if (!s || !s.is(r)) return !1;
2223
- const a = r.getLastDescendant();
2224
- if (!(i.is(r) && o.anchor.offset === r.getChildrenSize() || a !== null && i.is(a) && o.anchor.offset === a.getTextContentSize()) && r.getChildrenSize() > 0) return !1;
2225
- n?.preventDefault();
2226
- const d = he();
2227
- return r.insertAfter(d), d.select(), !0;
2228
- };
2229
- return q(
2230
- t.registerCommand(ao, e, D),
2231
- t.registerCommand(Zt, e, D)
2232
- );
2233
- }, [t]), null;
2234
- }, Zi = /^\[([ xX]?)\]\s/, es = () => {
2235
- const [t] = A();
2236
- return R(
2237
- () => t.registerNodeTransform(st, (e) => {
2238
- if (!e.isSimpleText()) return;
2239
- const n = e.getTextContent().match(Zi);
2240
- if (!n) return;
2241
- const o = e.getParent();
2242
- if (!ln(o) || !e.is(o.getFirstChild())) return;
2243
- const r = o.getParent();
2244
- if (!sn(r) || r.getListType() !== "bullet") return;
2245
- if (r.getChildrenSize() === 1)
2246
- r.setListType("check");
2247
- else if (o.is(r.getLastChild())) {
2248
- const s = Do("check");
2249
- r.insertAfter(s), s.append(o);
2250
- } else
2251
- return;
2252
- const i = n[0].length;
2253
- e.spliceText(0, i, "", !0), o.setChecked(n[1].toLowerCase() === "x");
2254
- }),
2255
- [t]
2256
- ), null;
2257
- }, ts = ({ onSubmit: t, onEscape: e, submitOnEnter: n }) => {
2258
- const [o] = A(), r = O({ onSubmit: t, onEscape: e, submitOnEnter: n });
2259
- return r.current = { onSubmit: t, onEscape: e, submitOnEnter: n }, R(() => {
2260
- const i = () => {
2261
- const s = M();
2262
- if (!$(s)) return null;
2263
- const a = s.anchor.getNode();
2264
- return {
2265
- isInList: !!W(a, ln),
2266
- isInCode: !!W(a, ee),
2267
- isInParagraph: !!W(
2268
- a,
2269
- (u) => Y(u) && ut(u.getParent())
2270
- )
2271
- };
2272
- };
2273
- return q(
2274
- o.registerCommand(
2275
- Ve,
2276
- (s) => !s || !(s.metaKey || s.ctrlKey) || !r.current.onSubmit ? !1 : (s.preventDefault(), r.current.onSubmit(), !0),
2277
- lo
2278
- ),
2279
- // below the mention menu (which selects an option on enter), above the rich text plugin
2280
- o.registerCommand(
2281
- Ve,
2282
- (s) => {
2283
- if (!s || s.isComposing || s.metaKey || s.ctrlKey || s.altKey) return !1;
2284
- const a = i();
2285
- if (!a) return !1;
2286
- if (s.shiftKey)
2287
- return a.isInParagraph ? (s.preventDefault(), o.dispatchCommand(en, void 0)) : !1;
2288
- const { submitOnEnter: u, onSubmit: d } = r.current;
2289
- return !u || !d || a.isInList || a.isInCode ? !1 : (s.preventDefault(), d(), !0);
2290
- },
2291
- D
2292
- ),
2293
- // after the menus (low priority) so they close first, before the rich text extension,
2294
- // which blurs the editor on escape
2295
- o.registerCommand(
2296
- tn,
2297
- () => r.current.onEscape ? (r.current.onEscape(), !0) : !1,
2298
- co
2299
- )
2300
- );
2301
- }, [o]), null;
2302
- }, qe = (t) => Y(t) && t.getChildrenSize() === 0, ns = () => {
2303
- const [t] = A();
2304
- return R(
2305
- () => t.registerCommand(
2306
- en,
2307
- () => {
2308
- const e = M();
2309
- if (!$(e) || !e.isCollapsed()) return !1;
2310
- const n = e.anchor.getNode().getTopLevelElement();
2311
- if (!Y(n) || !ut(n.getParent())) return !1;
2312
- const o = e.anchor.getNode();
2313
- return !!((n.getChildrenSize() === 0 || e.anchor.offset === 0 && (o.is(n) || !!n.getFirstDescendant()?.is(o))) && qe(n.getPreviousSibling()) || qe(n) && qe(n.getNextSibling()));
2314
- },
2315
- D
2316
- ),
2317
- [t]
2318
- ), null;
2319
- }, Ft = /^[0-9a-f]{32}$/, Gl = (t, e) => `source:${t}` + (e ? `?${new URLSearchParams({ type: e.type, id: e.id })}` : ""), ze = (t) => {
2320
- if (!t) return null;
2321
- const e = t.match(/^source:([0-9a-f]{32})(?:\?(.*))?$/);
2322
- if (e) {
2323
- const s = new URLSearchParams(e[2] ?? ""), a = s.get("id"), u = s.get("type");
2324
- return {
2325
- activityId: e[1],
2326
- entity: a && u && Ft.test(a) ? { id: a, type: u } : null,
2327
- isSource: !0
2328
- };
2329
- }
2330
- if (t.startsWith("source:") || typeof window > "u") return null;
2331
- let n;
2332
- try {
2333
- n = new URL(t, window.location.origin);
2334
- } catch {
2335
- return null;
2336
- }
2337
- if (n.origin !== window.location.origin) return null;
2338
- const o = n.pathname.match(/^\/projects\/([^/]+)/)?.[1], r = n.searchParams.get("activity");
2339
- if (!o || !r || !Ft.test(r)) return null;
2340
- const i = {
2341
- activityId: r,
2342
- entityId: n.searchParams.get("id"),
2343
- isSource: !1,
2344
- url: n.toString()
2345
- };
2346
- try {
2347
- return { projectName: decodeURIComponent(o), ...i };
2348
- } catch {
2349
- return { projectName: o, ...i };
2350
- }
2351
- }, $n = "Comment", os = () => {
2352
- const [t] = A();
2353
- return R(() => {
2354
- const e = (r) => {
2355
- const i = r.target?.closest?.(
2356
- "a[href]"
2357
- );
2358
- if (!i || i.hasAttribute("data-mention-value") || t.isEditable() && !(r.metaKey || r.ctrlKey)) return;
2359
- r.preventDefault(), r.stopPropagation();
2360
- const a = t.read(() => {
2361
- const d = nn(i);
2362
- return ne(d) ? d.getURL() : null;
2363
- }), u = ze(a ?? i.getAttribute("href"));
2364
- u?.isSource || window.open(u?.url ?? i.href, "_blank", "noopener,noreferrer");
2365
- };
2366
- let n = null;
2367
- const o = t.registerRootListener((r, i) => {
2368
- i?.removeEventListener("click", e), r?.addEventListener("click", e), n = r;
2369
- });
2370
- return () => {
2371
- o(), n?.removeEventListener("click", e);
2372
- };
2373
- }, [t]), null;
2374
- }, nt = () => {
2375
- const t = M();
2376
- if (!$(t) || !t.isCollapsed()) return null;
2377
- const e = t.anchor.getNode().getTopLevelElement();
2378
- return Y(e) && ut(e.getParent()) ? e : null;
2379
- }, Nn = (t) => {
2380
- const e = t.getNextSibling();
2381
- if (Y(e) && e.getChildrenSize() === 0)
2382
- e.select();
2383
- else {
2384
- const n = he();
2385
- t.insertAfter(n), n.select();
2386
- }
2387
- }, ot = (t, e) => {
2388
- t.replace(e), Nn(e);
2389
- }, Sn = (t) => {
2390
- const e = nt();
2391
- if (e && e.getTextContent().trim() === "") {
2392
- ot(e, t);
2393
- return;
2394
- }
2395
- const n = M(), o = $(n) ? n.anchor.getNode().getTopLevelElement() : ie().getLastChild();
2396
- o ? o.insertAfter(t) : ie().append(t), Nn(t);
2397
- }, rs = (t) => Sn(pe(t)), is = () => {
2398
- const [t] = A();
2399
- return R(
2400
- () => q(
2401
- t.registerCommand(
2402
- mt,
2403
- (e) => {
2404
- if (!(e instanceof ClipboardEvent) || !e.clipboardData) return !1;
2405
- const n = e.clipboardData.getData("text/plain").trim();
2406
- if (!n || /\s/.test(n) || !re(n)) return !1;
2407
- const o = nt();
2408
- return !o || o.getTextContent().trim() !== "" ? !1 : (e.preventDefault(), ot(o, pe(n)), !0);
2409
- },
2410
- // before the rich text paste (and the markdown paste of mentions)
2411
- Z
2412
- ),
2413
- t.registerCommand(
2414
- Ve,
2415
- (e) => {
2416
- if (e?.shiftKey || e?.metaKey || e?.ctrlKey) return !1;
2417
- const n = nt();
2418
- if (!n) return !1;
2419
- const o = n.getTextContent().trim();
2420
- if (!o || /\s/.test(o) || !re(o)) return !1;
2421
- const r = M();
2422
- if (!$(r)) return !1;
2423
- const i = r.anchor.getNode();
2424
- return !!n.getLastDescendant()?.is(i) && r.anchor.offset === i.getTextContentSize() ? (e?.preventDefault(), ot(n, pe(o)), !0) : !1;
2425
- },
2426
- // before enter to send in chat inputs
2427
- Z
2428
- )
2429
- ),
2430
- [t]
2431
- ), null;
2432
- }, Kt = 320, Ne = (t) => ({ top: t.top, bottom: t.bottom, left: t.left }), Ut = () => {
2433
- const t = M();
2434
- if (!$(t)) return null;
2435
- const e = W(t.anchor.getNode(), ne);
2436
- if (!e || Je(e) && e.getIsUnlinked()) return null;
2437
- const n = W(t.focus.getNode(), ne);
2438
- return n && n.is(e) ? e : null;
2439
- }, ss = () => {
2440
- const [t] = A(), [e, n] = U(null), [o, r] = U(""), [i, s] = U(!1), a = O(null), u = O(null), d = O(null), v = O(e);
2441
- v.current = e;
2442
- const x = () => !!u.current && document.activeElement === u.current, g = H(
2443
- (p = !1) => {
2444
- n(null), d.current = null, p && t.focus();
2445
- },
2446
- [t]
2447
- ), h = H(() => {
2448
- if (x()) return;
2449
- const p = Ut();
2450
- if (!p) {
2451
- v.current?.mode === "link" && n(null);
2452
- return;
2453
- }
2454
- const y = t.getElementByKey(p.getKey());
2455
- if (!y) return;
2456
- const k = p.getURL();
2457
- n({
2458
- mode: "link",
2459
- key: p.getKey(),
2460
- url: k,
2461
- rect: Ne(y.getBoundingClientRect())
2462
- }), r(k);
2463
- }, [t]), f = () => requestAnimationFrame(() => {
2464
- u.current?.focus(), u.current?.select();
2465
- }), c = H(
2466
- (p = "link") => {
2467
- let y = !1;
2468
- return s(!1), t.getEditorState().read(() => {
2469
- const k = p === "link" ? Ut() : null;
2470
- if (k) {
2471
- const F = t.getElementByKey(k.getKey());
2472
- if (!F) return;
2473
- const N = k.getURL();
2474
- n({
2475
- mode: "link",
2476
- key: k.getKey(),
2477
- url: N,
2478
- rect: Ne(F.getBoundingClientRect())
2479
- }), r(N), y = !0;
2480
- return;
2481
- }
2482
- const C = M();
2483
- if (!$(C)) return;
2484
- d.current = C.clone();
2485
- const b = window.getSelection();
2486
- let I = (b?.rangeCount ? b.getRangeAt(0) : null)?.getBoundingClientRect();
2487
- (!I || !I.width && !I.height) && (I = t.getElementByKey(C.anchor.key)?.getBoundingClientRect()), I && (n({ mode: p === "video" ? "video" : "create", url: "", rect: Ne(I) }), r(""), y = !0);
2488
- }), y && f(), y;
2489
- },
2490
- [t]
2491
- );
2492
- R(
2493
- () => q(
2494
- t.registerUpdateListener(({ editorState: p }) => {
2495
- p.read(h);
2496
- }),
2497
- t.registerCommand(
2498
- lt,
2499
- () => (h(), !1),
2500
- D
2501
- ),
2502
- t.registerCommand(
2503
- Ln,
2504
- () => (c(), !0),
2505
- D
2506
- ),
2507
- t.registerCommand(
2508
- Mn,
2509
- () => (c("video"), !0),
2510
- D
2511
- ),
2512
- t.registerCommand(
2513
- Xt,
2514
- (p) => (p.metaKey || p.ctrlKey) && !p.shiftKey && p.key.toLowerCase() === "k" ? (p.preventDefault(), c()) : !1,
2515
- D
2516
- ),
2517
- // leaving the editor hides the link, unless moving into the link editor
2518
- t.registerCommand(
2519
- ct,
2520
- (p) => {
2521
- const y = p.relatedTarget;
2522
- return y && a.current?.contains(y) || n(null), !1;
2523
- },
2524
- D
2525
- )
2526
- ),
2527
- [t, h, c]
2528
- ), oe(() => {
2529
- if (!e) return;
2530
- const p = () => {
2531
- const y = v.current;
2532
- if (y?.mode !== "link") return;
2533
- const k = t.getElementByKey(y.key);
2534
- k && n({ ...y, rect: Ne(k.getBoundingClientRect()) });
2535
- };
2536
- return window.addEventListener("scroll", p, !0), window.addEventListener("resize", p), () => {
2537
- window.removeEventListener("scroll", p, !0), window.removeEventListener("resize", p);
2538
- };
2539
- }, [t, !!e]);
2540
- const m = () => {
2541
- const p = v.current;
2542
- p?.mode === "link" && (t.update(() => {
2543
- const y = se(p.key);
2544
- Je(y) ? (y.setIsUnlinked(!0), y.markDirty()) : ne(y) && ar(y);
2545
- }), g(!0));
2546
- }, _ = () => {
2547
- const p = v.current;
2548
- if (!p) return;
2549
- const y = Bt(o);
2550
- if (p.mode === "link") {
2551
- if (!y) {
2552
- m();
2553
- return;
2554
- }
2555
- t.update(() => {
2556
- const k = se(p.key);
2557
- if (Je(k)) {
2558
- const C = cn(y);
2559
- C.append(...k.getChildren()), k.replace(C);
2560
- } else ne(k) && k.setURL(y);
2561
- }), g(!0);
2562
- return;
2563
- }
2564
- if (p.mode === "video") {
2565
- if (!o.trim()) {
2566
- g(!0);
2567
- return;
2568
- }
2569
- if (!re(y)) {
2570
- s(!0);
2571
- return;
2572
- }
2573
- t.update(() => {
2574
- d.current && We(d.current.clone()), rs(y);
2575
- }), g(!0);
2576
- return;
2577
- }
2578
- if (!y) {
2579
- g(!0);
2580
- return;
2581
- }
2582
- t.update(() => {
2583
- d.current && We(d.current.clone());
2584
- const k = M();
2585
- if (!$(k)) return;
2586
- if (k.isCollapsed()) {
2587
- k.insertText(y);
2588
- const b = M();
2589
- if ($(b)) {
2590
- const L = b.focus;
2591
- b.anchor.set(L.key, L.offset - y.length, "text");
2592
- }
2593
- }
2594
- t.dispatchCommand(Bo, y);
2595
- const C = M();
2596
- if ($(C)) {
2597
- const b = C.isBackward() ? C.anchor : C.focus;
2598
- C.anchor.set(b.key, b.offset, b.type), C.focus.set(b.key, b.offset, b.type);
2599
- }
2600
- }), g(!0);
2601
- };
2602
- if (!e) return null;
2603
- const T = Math.max(8, Math.min(e.rect.left, window.innerWidth - Kt - 8)), E = Bt(o) !== e.url;
2604
- return fe(
2605
- /* @__PURE__ */ S(
2606
- ki,
2607
- {
2608
- ref: a,
2609
- className: P("md-popover md-link-popover", ae),
2610
- style: { top: e.rect.bottom + 6, left: T, width: Kt },
2611
- onMouseDown: (p) => {
2612
- p.target !== u.current && p.preventDefault();
2613
- },
2614
- children: [
2615
- /* @__PURE__ */ l(J, { icon: e.mode === "video" ? "smart_display" : "link" }),
2616
- /* @__PURE__ */ l(
2617
- "input",
2618
- {
2619
- ref: u,
2620
- value: o,
2621
- placeholder: e.mode === "video" ? "Paste a YouTube link" : "Paste or type a link",
2622
- className: P({ invalid: i }),
2623
- title: i ? "Not a YouTube video link" : void 0,
2624
- onChange: (p) => {
2625
- r(p.target.value), s(!1);
2626
- },
2627
- onFocus: (p) => p.target.select(),
2628
- onKeyDown: (p) => {
2629
- if (p.stopPropagation(), p.key === "Enter" && (p.preventDefault(), _()), p.key === "Escape") {
2630
- if (p.preventDefault(), d.current) {
2631
- const y = d.current.clone();
2632
- t.update(() => We(y));
2633
- }
2634
- g(!0);
2635
- }
2636
- },
2637
- onBlur: (p) => {
2638
- const y = p.relatedTarget, k = t.getRootElement();
2639
- y && (a.current?.contains(y) || k?.contains(y)) || g();
2640
- },
2641
- spellCheck: !1
2642
- }
2643
- ),
2644
- (e.mode !== "link" || E) && /* @__PURE__ */ l(
2645
- te,
2646
- {
2647
- icon: "check",
2648
- variant: "text",
2649
- onClick: _,
2650
- "data-tooltip": e.mode === "video" ? "Embed video" : e.mode === "create" ? "Add link" : "Update link",
2651
- type: "button"
2652
- }
2653
- ),
2654
- e.mode === "link" && /* @__PURE__ */ S(me, { children: [
2655
- /* @__PURE__ */ l(
2656
- te,
2657
- {
2658
- icon: "open_in_new",
2659
- variant: "text",
2660
- onClick: () => window.open(e.url, "_blank", "noopener,noreferrer"),
2661
- "data-tooltip": "Open link",
2662
- type: "button"
2663
- }
2664
- ),
2665
- /* @__PURE__ */ l(
2666
- te,
2667
- {
2668
- icon: "link_off",
2669
- variant: "text",
2670
- onClick: m,
2671
- "data-tooltip": "Remove link",
2672
- type: "button"
2673
- }
2674
- )
2675
- ] })
2676
- ]
2677
- }
2678
- ),
2679
- document.body
2680
- );
2681
- }, as = () => {
2682
- const [t] = A(), [e, n] = U(null), o = O(null), r = O(null), i = O(!1), s = H(() => {
2683
- i.current || t.getEditorState().read(() => {
2684
- let d = null;
2685
- if (o.current) {
2686
- const g = se(o.current);
2687
- ee(g) && (d = g);
2688
- }
2689
- if (!d) {
2690
- const g = M();
2691
- $(g) && (d = W(g.anchor.getNode(), ee));
2692
- }
2693
- const v = d && t.getElementByKey(d.getKey());
2694
- if (!d || !v) {
2695
- n(null);
2696
- return;
2697
- }
2698
- const x = v.getBoundingClientRect();
2699
- n({
2700
- key: d.getKey(),
2701
- language: d.getLanguage() || "",
2702
- rect: { top: x.top, right: x.right }
2703
- });
2704
- });
2705
- }, [t]);
2706
- R(() => {
2707
- const d = (g) => {
2708
- const h = g.target?.closest?.("code");
2709
- let f = null;
2710
- h && t.getEditorState().read(() => {
2711
- const c = nn(h), m = c && W(c, ee);
2712
- f = m ? m.getKey() : null;
2713
- }), f !== o.current && (o.current = f, s());
2714
- }, v = (g) => {
2715
- i.current || r.current?.contains(g.relatedTarget) || (o.current = null, s());
2716
- };
2717
- let x = null;
2718
- return q(
2719
- t.registerRootListener((g, h) => {
2720
- h?.removeEventListener("mousemove", d), h?.removeEventListener("mouseleave", v), g?.addEventListener("mousemove", d), g?.addEventListener("mouseleave", v), x = g;
2721
- }),
2722
- t.registerUpdateListener(() => s()),
2723
- () => {
2724
- x?.removeEventListener("mousemove", d), x?.removeEventListener("mouseleave", v);
2725
- }
2726
- );
2727
- }, [t, s]), R(() => {
2728
- if (e)
2729
- return window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
2730
- window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
2731
- };
2732
- }, [!!e, s]);
2733
- const a = (d) => {
2734
- const v = e;
2735
- v && (t.update(() => {
2736
- const x = se(v.key);
2737
- ee(x) && (x.setLanguage(d || null), x.selectEnd());
2738
- }), t.focus());
2739
- };
2740
- if (!e) return null;
2741
- const u = Re.some((d) => d.value === e.language) ? Re : [...Re, { value: e.language, label: e.language }];
2742
- return fe(
2743
- /* @__PURE__ */ l(
2744
- _i,
2745
- {
2746
- ref: r,
2747
- className: P("md-popover md-code-language", ae),
2748
- style: { top: e.rect.top + 4, left: e.rect.right - 4 },
2749
- onMouseLeave: (d) => {
2750
- i.current || t.getRootElement()?.contains(d.relatedTarget) || (o.current = null, s());
2751
- },
2752
- children: /* @__PURE__ */ l(
2753
- eo,
2754
- {
2755
- options: u,
2756
- value: [e.language],
2757
- dataKey: "value",
2758
- labelKey: "label",
2759
- search: !0,
2760
- searchFields: ["label", "value"],
2761
- align: "right",
2762
- widthExpand: !0,
2763
- onOpen: () => {
2764
- i.current = !0;
2765
- },
2766
- onClose: () => {
2767
- i.current = !1;
2768
- },
2769
- onChange: (d) => {
2770
- i.current = !1, a(d[0] ?? "");
2771
- },
2772
- listClassName: P("md-code-language-list", ae),
2773
- valueTemplate: () => /* @__PURE__ */ S(Ei, { className: "md-code-language-button", children: [
2774
- /* @__PURE__ */ l("span", { children: yr(e.language) || "Plain text" }),
2775
- /* @__PURE__ */ l(J, { icon: "expand_more" })
2776
- ] })
2777
- }
2778
- )
2779
- }
2780
- ),
2781
- document.body
2782
- );
2783
- }, ls = { ...ur, defaultLanguage: null }, cs = () => {
2784
- const [t] = A();
2785
- return R(() => mr(t, ls), [t]), null;
2786
- }, Ht = ge(
2787
- "INSERT_MEDIA_FILES_COMMAND"
2788
- ), On = ge(
2789
- "OPEN_MEDIA_PICKER_COMMAND"
2790
- ), ds = /(^|\s)(\/)([\w-]{0,30})$/;
2791
- class us extends gt {
2792
- command;
2793
- constructor(e) {
2794
- super(e.id), this.command = e;
2795
- }
2796
- }
2797
- const ms = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform), ps = ms ? "⌘" : "Ctrl+", gs = ({
2798
- placement: t = "inline",
2799
- menuParent: e,
2800
- mentionTriggers: n = [],
2801
- onFiles: o,
2802
- canInsertMedia: r,
2803
- customCommands: i = []
2804
- }) => {
2805
- const [s] = A(), [a, u] = U(null), d = O(null), v = _e(() => {
2806
- const f = [
2807
- ...i.map(({ icon: m, keywords: _ = [], run: T, ...E }) => ({
2808
- ...E,
2809
- icon: m,
2810
- group: "custom",
2811
- keywords: _,
2812
- run: () => T()
2813
- })),
2814
- {
2815
- id: "h1",
2816
- label: "Heading 1",
2817
- icon: "format_h1",
2818
- group: "headings",
2819
- keywords: ["h1", "title", "heading"],
2820
- hint: "#",
2821
- run: (m) => j(m, "h1", "set")
2822
- },
2823
- {
2824
- id: "h2",
2825
- label: "Heading 2",
2826
- icon: "format_h2",
2827
- group: "headings",
2828
- keywords: ["h2", "heading", "subtitle"],
2829
- hint: "##",
2830
- run: (m) => j(m, "h2", "set")
2831
- },
2832
- {
2833
- id: "h3",
2834
- label: "Heading 3",
2835
- icon: "format_h3",
2836
- group: "headings",
2837
- keywords: ["h3", "heading"],
2838
- hint: "###",
2839
- run: (m) => j(m, "h3", "set")
2840
- },
2841
- {
2842
- id: "bullet",
2843
- label: "Bullet list",
2844
- icon: "format_list_bulleted",
2845
- group: "lists",
2846
- keywords: ["list", "bullet", "unordered", "ul"],
2847
- hint: "-",
2848
- run: (m) => j(m, "bullet", "set")
2849
- },
2850
- {
2851
- id: "number",
2852
- label: "Numbered list",
2853
- icon: "format_list_numbered",
2854
- group: "lists",
2855
- keywords: ["list", "numbered", "ordered", "ol"],
2856
- hint: "1.",
2857
- run: (m) => j(m, "number", "set")
2858
- },
2859
- {
2860
- id: "check",
2861
- label: "Checklist",
2862
- icon: "check_circle",
2863
- group: "lists",
2864
- keywords: ["list", "check", "task", "todo"],
2865
- hint: "[]",
2866
- run: (m) => j(m, "check", "set")
2867
- },
2868
- {
2869
- id: "quote",
2870
- label: "Quote",
2871
- icon: "format_quote",
2872
- group: "blocks",
2873
- keywords: ["quote", "blockquote"],
2874
- hint: ">",
2875
- run: (m) => j(m, "quote", "set")
2876
- },
2877
- {
2878
- id: "codeBlock",
2879
- label: "Code block",
2880
- icon: "data_object",
2881
- group: "blocks",
2882
- keywords: ["code", "block", "snippet", "pre"],
2883
- hint: "```",
2884
- run: (m) => j(m, "code", "set")
2885
- },
2886
- {
2887
- id: "code",
2888
- label: "Inline code",
2889
- icon: "code",
2890
- group: "blocks",
2891
- keywords: ["code", "inline", "monospace"],
2892
- hint: `${ps}E`,
2893
- run: (m) => m.dispatchCommand(dt, "code")
2894
- },
2895
- {
2896
- id: "youtube",
2897
- label: "YouTube video",
2898
- icon: "smart_display",
2899
- group: "insert",
2900
- keywords: ["youtube", "video", "embed"],
2901
- run: (m) => m.dispatchCommand(Mn, void 0)
2902
- }
2903
- ];
2904
- return r && f.push({
2905
- id: "media",
2906
- label: "Image or video",
2907
- icon: "image",
2908
- group: "insert",
2909
- keywords: ["image", "picture", "photo", "video", "movie", "media", "screenshot"],
2910
- run: (m) => m.dispatchCommand(On, void 0)
2911
- }), o && f.push({
2912
- id: "attachment",
2913
- label: "Attachment",
2914
- icon: "attach_file",
2915
- group: "insert",
2916
- keywords: ["attach", "attachment", "file", "upload"],
2917
- run: () => d.current?.click()
2918
- }), [
2919
- { trigger: "@", label: "Mention user", icon: "person", words: ["user", "team", "person"] },
2920
- { trigger: "@@", label: "Mention version", icon: "layers", words: ["version"] },
2921
- { trigger: "@@@", label: "Mention task", icon: "check_circle", words: ["task"] }
2922
- ].filter(({ trigger: m }) => n.includes(m)).forEach(
2923
- ({ trigger: m, label: _, icon: T, words: E }) => f.push({
2924
- id: `mention-${m}`,
2925
- label: _,
2926
- icon: T,
2927
- group: "mentions",
2928
- keywords: ["mention", ...E],
2929
- hint: m,
2930
- run: (p) => p.dispatchCommand(vt, m)
2931
- })
2932
- ), f;
2933
- }, [n.join(), !!o, r, i]), x = _e(() => {
2934
- if (a === null) return [];
2935
- const f = a.toLowerCase();
2936
- return v.filter(
2937
- (c) => !f || c.label.toLowerCase().startsWith(f) || [...c.label.toLowerCase().split(/\s+/), ...c.keywords].some(
2938
- (m) => m.startsWith(f)
2939
- )
2940
- ).map((c) => new us(c));
2941
- }, [v, a]), g = H((f) => {
2942
- if (Be()) return null;
2943
- const c = ds.exec(f);
2944
- return c ? {
2945
- leadOffset: c.index + c[1].length,
2946
- matchingString: c[3],
2947
- replaceableString: c[2] + c[3]
2948
- } : null;
2949
- }, []), h = H(
2950
- (f, c, m) => {
2951
- m(), s.update(
2952
- () => {
2953
- c?.remove();
2954
- },
2955
- { onUpdate: () => f.command.run(s) }
2956
- );
2957
- },
2958
- [s]
2959
- );
2960
- return /* @__PURE__ */ S(me, { children: [
2961
- /* @__PURE__ */ l(
2962
- pt,
2963
- {
2964
- onQueryChange: u,
2965
- onSelectOption: h,
2966
- triggerFn: g,
2967
- options: x,
2968
- parent: e,
2969
- commandPriority: Z,
2970
- preselectFirstItem: !!a,
2971
- menuRenderFn: (f, { selectedIndex: c, selectOptionAndCleanUp: m, setHighlightedIndex: _ }) => {
2972
- const T = f.current;
2973
- return !T || !x.length ? null : /* @__PURE__ */ l(
2974
- yt,
2975
- {
2976
- editor: s,
2977
- anchor: T,
2978
- placement: t,
2979
- className: "slash-menu",
2980
- options: x,
2981
- selectedIndex: c,
2982
- onSelect: m,
2983
- onHighlight: _,
2984
- getGroup: (E) => E.command.group,
2985
- renderOption: ({ command: E }) => /* @__PURE__ */ S(me, { children: [
2986
- /* @__PURE__ */ l(J, { icon: E.icon, className: "image" }),
2987
- /* @__PURE__ */ l("span", { className: "label", children: E.label }),
2988
- E.hint && /* @__PURE__ */ l("span", { className: "suffix hint", children: E.hint })
2989
- ] })
2990
- }
2991
- );
2992
- }
2993
- }
2994
- ),
2995
- o && /* @__PURE__ */ l(
2996
- "input",
2997
- {
2998
- ref: d,
2999
- type: "file",
3000
- multiple: !0,
3001
- hidden: !0,
3002
- onChange: (f) => {
3003
- const c = Array.from(f.target.files || []);
3004
- c.length && o(c), f.target.value = "";
3005
- }
3006
- }
3007
- )
3008
- ] });
3009
- }, V = (t) => {
3010
- try {
3011
- return decodeURIComponent(t.replace(/\+/g, " "));
3012
- } catch {
3013
- return t;
3014
- }
3015
- }, le = (t) => {
3016
- const e = V(t || "").replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim();
3017
- return e ? e.charAt(0).toUpperCase() + e.slice(1) : "";
3018
- }, xt = (t) => t.slice(0, 7), Rn = (t) => {
3019
- const e = t.match(/^#L(\d+)(?:C\d+)?(?:-L(\d+))?/);
3020
- return e ? e[2] ? `:${e[1]}-${e[2]}` : `:${e[1]}` : "";
3021
- }, In = (t) => V(t[t.length - 1] || ""), hs = /* @__PURE__ */ new Set([
3022
- "about",
3023
- "apps",
3024
- "collections",
3025
- "enterprise",
3026
- "explore",
3027
- "features",
3028
- "issues",
3029
- "login",
3030
- "marketplace",
3031
- "new",
3032
- "notifications",
3033
- "orgs",
3034
- "organizations",
3035
- "pricing",
3036
- "pulls",
3037
- "search",
3038
- "settings",
3039
- "sponsors",
3040
- "topics",
3041
- "trending"
3042
- ]), fs = (t, e) => {
3043
- const [n, o, r, ...i] = e;
3044
- if (!n || hs.has(n)) return null;
3045
- if (!o) return n;
3046
- switch (r) {
3047
- case void 0:
3048
- return `${n}/${o}`;
3049
- case "issues":
3050
- case "pull":
3051
- case "discussions":
3052
- return /^\d+$/.test(i[0] || "") ? `${o} #${i[0]}` : `${o} ${r}`;
3053
- case "commit":
3054
- return i[0] ? `${o}@${xt(i[0])}` : null;
3055
- case "compare":
3056
- return i.length ? `${o} ${V(i.join("/"))}` : null;
3057
- case "releases":
3058
- return i[0] === "tag" && i[1] ? `${o} ${V(i[1])}` : `${o} releases`;
3059
- case "tree":
3060
- case "blob": {
3061
- const s = i.slice(1);
3062
- return s.length ? `${o}/${In(s)}${Rn(t.hash)}` : i[0] ? `${o}@${V(i[0])}` : null;
3063
- }
3064
- case "actions":
3065
- return i[0] === "runs" && i[1] ? `${o} run ${i[1]}` : `${o} actions`;
3066
- case "wiki":
3067
- return i[0] ? `${o} wiki: ${le(i[0])}` : `${o} wiki`;
3068
- default:
3069
- return null;
3070
- }
3071
- }, bs = (t, e) => {
3072
- const n = e.indexOf("-");
3073
- if (n < 2) return e.length >= 2 ? e[e.length - 1] : null;
3074
- const o = e[n - 1], [r, i, ...s] = e.slice(n + 1);
3075
- switch (r) {
3076
- case "issues":
3077
- return i ? `${o} #${i}` : `${o} issues`;
3078
- case "merge_requests":
3079
- return i ? `${o} !${i}` : `${o} merge requests`;
3080
- case "commit":
3081
- return i ? `${o}@${xt(i)}` : null;
3082
- case "tags":
3083
- case "releases":
3084
- return i ? `${o} ${V(i)}` : null;
3085
- case "blob":
3086
- case "tree":
3087
- return s.length ? `${o}/${In(s)}${Rn(t.hash)}` : null;
3088
- case "pipelines":
3089
- return i ? `${o} pipeline ${i}` : null;
3090
- default:
3091
- return null;
3092
- }
3093
- }, ys = (t, e) => {
3094
- const [, n, o, r] = e;
3095
- return n ? o === "pull-requests" && r ? `${n} #${r}` : o === "issues" && r ? `${n} #${r}` : o === "commits" && r ? `${n}@${xt(r)}` : o ? null : n : null;
3096
- }, jt = /^[A-Z][A-Z0-9_]+-\d+$/, vs = (t, e) => {
3097
- const n = e.find((o) => jt.test(o)) || t.searchParams.get("selectedIssue");
3098
- if (n && jt.test(n)) return n;
3099
- if (e[0] === "wiki") {
3100
- const o = e.indexOf("pages"), r = o >= 0 ? e[o + 2] : void 0;
3101
- if (r) return V(r);
3102
- if (e[1] === "spaces" && e[2]) return `${e[2]} space`;
3103
- }
3104
- return null;
3105
- }, xs = (t, e) => {
3106
- const [, n, o, r] = e;
3107
- return n === "issue" && o ? r ? `${o} ${le(r)}` : o : n === "project" && o ? le(o.replace(/-[0-9a-f]{8,}$/, "")) : null;
3108
- }, ks = (t, e) => {
3109
- const o = e[e.length - 1]?.replace(/-?[0-9a-f]{32}$/i, "");
3110
- return o ? le(o) : null;
3111
- }, ws = (t, e) => {
3112
- const [n, , o] = e;
3113
- return ["file", "design", "proto", "board", "slides"].includes(n || "") && o ? `${V(o).replace(/-/g, " ")} (Figma)` : null;
3114
- }, _s = (t, e) => {
3115
- const [n, , o] = e;
3116
- return !o || !["c", "b"].includes(n || "") ? null : le(n === "c" ? o.replace(/^\d+-/, "") : o);
3117
- }, Es = (t, e) => {
3118
- const n = e.indexOf("detail");
3119
- if (n >= 0 && e[n + 1] && /^\d+$/.test(e[n + 2] || ""))
3120
- return `${V(e[n + 1]).replace(/_/g, " ")} ${e[n + 2]}`;
3121
- const o = t.hash.match(/^#([A-Za-z]+(?:_[A-Za-z]+)*)_(\d+)/);
3122
- return o ? `${o[1].replace(/_/g, " ")} ${o[2]}` : null;
3123
- }, Cs = (t, e) => e[0] === "questions" && e[2] ? le(e[2]) : null, Ts = (t, e) => e[0] === "t" && e[1] && !/^\d+$/.test(e[1]) ? le(e[1]) : null, Ls = {
3124
- document: "Google Doc",
3125
- spreadsheets: "Google Sheet",
3126
- presentation: "Google Slides",
3127
- forms: "Google Form",
3128
- drawings: "Google Drawing"
3129
- }, Ms = (t, e) => t.hostname === "docs.google.com" ? Ls[e[0]] ?? null : e.includes("folders") ? "Google Drive folder" : e[0] === "file" ? "Google Drive file" : null, $s = (t, e) => {
3130
- const n = e[e.length - 1];
3131
- return e.length >= 3 && n?.includes(".") ? V(n) : null;
3132
- }, Ns = [
3133
- [/^(www\.)?github\.com$/, fs],
3134
- [/^(www\.)?gitlab\.com$|^gitlab\./, bs],
3135
- [/^(www\.)?bitbucket\.org$/, ys],
3136
- [/\.atlassian\.net$/, vs],
3137
- [/^(www\.)?linear\.app$/, xs],
3138
- [/^(www\.)?notion\.so$|\.notion\.site$/, ks],
3139
- [/^(www\.)?figma\.com$/, ws],
3140
- [/^(www\.)?trello\.com$/, _s],
3141
- [/\.shotgrid\.autodesk\.com$|\.shotgunstudio\.com$/, Es],
3142
- [/^(www\.)?stackoverflow\.com$/, Cs],
3143
- [/^community\.ynput\.io$|^(forum|forums|community|discourse)\./, Ts],
3144
- [/^(docs|drive)\.google\.com$/, Ms],
3145
- [/^(www\.)?dropbox\.com$/, $s]
3146
- ], Ss = (t) => {
3147
- if (ze(t)) return $n;
3148
- let e;
3149
- try {
3150
- e = new URL(t.trim());
3151
- } catch {
3152
- return null;
3153
- }
3154
- if (e.protocol !== "https:" && e.protocol !== "http:") return null;
3155
- const n = e.hostname.toLowerCase(), o = Ns.find(([s]) => s.test(n))?.[1];
3156
- if (!o) return null;
3157
- const r = e.pathname.split("/").filter(Boolean);
3158
- return o(e, r)?.replace(/[[\]]/g, "").trim() || null;
3159
- }, Os = () => {
3160
- const [t] = A();
3161
- return R(
3162
- () => t.registerCommand(
3163
- mt,
3164
- (e) => {
3165
- if (!(e instanceof ClipboardEvent) || !e.clipboardData) return !1;
3166
- const n = e.clipboardData.getData("text/plain").trim();
3167
- if (!n || /\s/.test(n)) return !1;
3168
- const o = Ss(n);
3169
- if (!o) return !1;
3170
- const r = M();
3171
- return !$(r) || !r.isCollapsed() || Be() || W(r.anchor.getNode(), ne) ? !1 : (e.preventDefault(), r.insertNodes([cn(n).append(Ce(o))]), !0);
3172
- },
3173
- // after the youtube embed paste (registered first), before the rich text paste
3174
- Z
3175
- ),
3176
- [t]
3177
- ), null;
3178
- }, Rs = () => {
3179
- const [t] = A();
3180
- return R(() => {
3181
- const e = (n) => {
3182
- t.getEditorState().read(() => {
3183
- for (const [o, r] of n) {
3184
- if (r === "destroyed") continue;
3185
- const i = se(o), s = t.getElementByKey(o);
3186
- if (!s || !ne(i)) continue;
3187
- const a = ze(i.getURL());
3188
- s.classList.toggle("md-activity-link", !!a);
3189
- }
3190
- });
3191
- };
3192
- return q(
3193
- t.registerMutationListener(dn, e, { skipInitialization: !1 }),
3194
- t.registerMutationListener(un, e, { skipInitialization: !1 })
3195
- );
3196
- }, [t]), null;
3197
- }, Is = (t) => {
3198
- const e = window.getSelection(), n = e?.rangeCount ? e.getRangeAt(0) : null;
3199
- let o = n?.getBoundingClientRect();
3200
- if (!o || !o.width && !o.height) {
3201
- const r = n?.startContainer, i = r instanceof HTMLElement ? r : r?.parentElement;
3202
- o = (i && t?.contains(i) ? i : t)?.getBoundingClientRect();
3203
- }
3204
- return o ? { top: o.bottom + 6, left: o.left } : null;
3205
- }, As = ({ onUploadMedia: t, onFiles: e }) => {
3206
- const [n] = A(), o = O(null), r = O({ onUploadMedia: t, onFiles: e });
3207
- r.current = { onUploadMedia: t, onFiles: e };
3208
- const [i, s] = U(null), a = O(i);
3209
- a.current = i;
3210
- const u = H(
3211
- (g) => {
3212
- for (const h of g) {
3213
- const f = URL.createObjectURL(h);
3214
- let c = null;
3215
- n.update(() => {
3216
- const m = Ae({
3217
- src: f,
3218
- alt: h.name,
3219
- mime: h.type || null,
3220
- uploading: !0
3221
- });
3222
- Sn(m), c = m.getKey();
3223
- }), r.current.onUploadMedia(h).then(({ src: m, name: _, mime: T }) => {
3224
- n.update(() => {
3225
- const E = c ? se(c) : null;
3226
- Xe(E) && E.setUploaded(m, { alt: _, mime: T });
3227
- });
3228
- }).catch((m) => {
3229
- console.warn("Media upload failed", m), n.update(() => {
3230
- const _ = c ? se(c) : null;
3231
- Xe(_) && _.remove();
3232
- });
3233
- }).finally(() => URL.revokeObjectURL(f));
3234
- }
3235
- },
3236
- [n]
3237
- ), d = H(() => {
3238
- const g = a.current;
3239
- g && (s(null), u(g.files), n.focus());
3240
- }, [n, u]);
3241
- R(() => {
3242
- const g = () => (a.current && s(null), !1);
3243
- return q(
3244
- n.registerCommand(
3245
- Ht,
3246
- (h) => (u(h), !0),
3247
- Z
3248
- ),
3249
- n.registerCommand(
3250
- On,
3251
- () => (o.current?.click(), !0),
3252
- Z
3253
- ),
3254
- // before the attachments handler: everything stays an attachment, media gets the prompt
3255
- n.registerCommand(
3256
- rn,
3257
- (h) => {
3258
- const f = h.filter(Ar);
3259
- if (!f.length || !r.current.onFiles) return !1;
3260
- r.current.onFiles(h);
3261
- const c = Is(n.getRootElement());
3262
- return c && s({ files: f, rect: c }), !0;
3263
- },
3264
- Z
3265
- ),
3266
- // tab switches the pasted media to inline (before list indenting and menus)
3267
- n.registerCommand(
3268
- uo,
3269
- (h) => !a.current || h.shiftKey ? !1 : (h.preventDefault(), d(), !0),
3270
- Qe
3271
- ),
3272
- n.registerCommand(
3273
- tn,
3274
- () => a.current ? (s(null), !0) : !1,
3275
- Qe
3276
- ),
3277
- n.registerTextContentListener(g),
3278
- n.registerCommand(lt, g, D),
3279
- n.registerCommand(ct, g, D)
3280
- );
3281
- }, [n, u, d]);
3282
- const v = i?.files.length ?? 0, x = !!i?.files.every((g) => g.type.startsWith("video/"));
3283
- return /* @__PURE__ */ S(me, { children: [
3284
- i && fe(
3285
- /* @__PURE__ */ S(
3286
- wi,
3287
- {
3288
- className: P("md-popover md-inline-prompt", ae),
3289
- style: { top: i.rect.top, left: i.rect.left },
3290
- type: "button",
3291
- onMouseDown: (g) => g.preventDefault(),
3292
- onClick: d,
3293
- children: [
3294
- /* @__PURE__ */ l(J, { icon: x ? "movie" : "image" }),
3295
- /* @__PURE__ */ S("span", { children: [
3296
- "Show ",
3297
- v > 1 ? `${v} files` : x ? "video" : "image",
3298
- " inline"
3299
- ] }),
3300
- /* @__PURE__ */ l("kbd", { children: "Tab" })
3301
- ]
3302
- }
3303
- ),
3304
- document.body
3305
- ),
3306
- /* @__PURE__ */ l(
3307
- "input",
3308
- {
3309
- ref: o,
3310
- type: "file",
3311
- accept: "image/*,video/*",
3312
- multiple: !0,
3313
- hidden: !0,
3314
- onChange: (g) => {
3315
- const h = Array.from(g.target.files || []);
3316
- h.length && n.dispatchCommand(Ht, h), g.target.value = "";
3317
- }
3318
- }
3319
- )
3320
- ] });
3321
- }, Ds = new RegExp(
3322
- `\\[[^\\]\\n]+\\]\\(@?(${ht.join("|")}):[^)\\s]+\\)`
3323
- ), Ps = ({ onFiles: t }) => {
3324
- const [e] = A(), n = O(t);
3325
- return n.current = t, R(() => {
3326
- const o = (r) => {
3327
- if (!(r instanceof ClipboardEvent)) return !1;
3328
- const i = M();
3329
- if (!$(i) || i.isCollapsed() || !i.getNodes().some(hn)) return !1;
3330
- const s = pr(i);
3331
- return s["text/plain"] = rr(Pe, i), gr(e, r, s), !0;
3332
- };
3333
- return q(
3334
- e.registerCommand(mo, o, D),
3335
- e.registerCommand(
3336
- po,
3337
- (r) => {
3338
- if (!o(r)) return !1;
3339
- const i = M();
3340
- return $(i) && i.removeText(), !0;
3341
- },
3342
- D
3343
- ),
3344
- e.registerCommand(
3345
- mt,
3346
- (r) => {
3347
- if (!(r instanceof ClipboardEvent) || !r.clipboardData) return !1;
3348
- const { clipboardData: i } = r;
3349
- if (i.types.includes("application/x-lexical-editor") || i.types.includes("text/html")) return !1;
3350
- const s = i.getData("text/plain");
3351
- if (!s || !Ds.test(s)) return !1;
3352
- const a = M();
3353
- if (!$(a)) return !1;
3354
- r.preventDefault();
3355
- const u = Cn(s), d = u.length === 1 && Y(u[0]) ? u[0].getChildren() : u;
3356
- return a.insertNodes(d), !0;
3357
- },
3358
- D
3359
- ),
3360
- e.registerCommand(
3361
- rn,
3362
- (r) => !n.current || !r.length ? !1 : (n.current(r), !0),
3363
- D
3364
- )
3365
- );
3366
- }, [e]), null;
3367
- }, Bs = ({ value: t, onChange: e, handleRef: n }) => {
3368
- const [o] = A(), r = O(t), i = O(e);
3369
- return i.current = e, R(
3370
- () => o.registerUpdateListener(({ editorState: s, dirtyElements: a, dirtyLeaves: u, tags: d }) => {
3371
- if (d.has("markdown-value") || a.size === 0 && u.size === 0) return;
3372
- const v = s.read(() => Rt());
3373
- v !== r.current && (r.current = v, i.current?.(v));
3374
- }),
3375
- [o]
3376
- ), R(() => {
3377
- t === void 0 || t === r.current || (r.current = t, o.update(() => et(t), { tag: "markdown-value" }), o.dispatchCommand(go, void 0));
3378
- }, [o, t]), Xn(
3379
- n,
3380
- () => ({
3381
- getEditor: () => o,
3382
- focus: () => o.focus(),
3383
- blur: () => o.blur(),
3384
- getMarkdown: () => o.getEditorState().read(() => Rt()),
3385
- setMarkdown: (s) => {
3386
- o.update(() => et(s));
3387
- },
3388
- clear: () => {
3389
- o.update(() => ie().clear());
3390
- },
3391
- isEmpty: () => o.getEditorState().read(() => gi()),
3392
- insertMentionTrigger: (s) => {
3393
- o.focus(() => o.dispatchCommand(vt, s));
3394
- }
3395
- }),
3396
- [o]
3397
- ), null;
3398
- }, zs = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/, Fs = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/, Ks = [
3399
- Lt(
3400
- zs,
3401
- (t) => t.startsWith("http") ? t : `https://${t}`
3402
- ),
3403
- Lt(Fs, (t) => `mailto:${t}`)
3404
- ], Us = (t) => /^(https?:|mailto:|\/|#)/i.test(t), Hs = [
3405
- No,
3406
- So,
3407
- an,
3408
- Po,
3409
- dn,
3410
- un,
3411
- zo,
3412
- Fo,
3413
- be,
3414
- ye,
3415
- ve
3416
- ], js = ({ editable: t }) => {
3417
- const [e] = A();
3418
- return R(() => e.setEditable(t), [e, t]), null;
3419
- }, de = {
3420
- // descriptions, articles: toolbar at the top, enter adds a line
3421
- document: {
3422
- toolbar: !0,
3423
- floatingToolbar: !1,
3424
- submitOnEnter: !1,
3425
- mentionPlacement: "inline",
3426
- minHeight: 80,
3427
- maxHeight: void 0
3428
- },
3429
- // chat / comment input at the bottom of a feed: grows with the content, enter sends, formatting
3430
- // from a toolbar over the selected text, mentions open above the input
3431
- message: {
3432
- toolbar: !1,
3433
- floatingToolbar: !0,
3434
- submitOnEnter: !0,
3435
- mentionPlacement: "top",
3436
- minHeight: 20,
3437
- maxHeight: 400
3438
- }
3439
- }, Gs = Qt(
3440
- ({
3441
- variant: t = "document",
3442
- value: e,
3443
- onChange: n,
3444
- placeholder: o = "Write something...",
3445
- onSubmit: r,
3446
- submitOnEnter: i = de[t].submitOnEnter,
3447
- onEscape: s,
3448
- onFiles: a,
3449
- onUploadMedia: u,
3450
- mentions: d,
3451
- mentionMenuParent: v,
3452
- mentionPlacement: x = de[t].mentionPlacement,
3453
- emoji: g = !0,
3454
- slashCommands: h = !0,
3455
- commands: f,
3456
- onMentionClick: c,
3457
- onMentionHover: m,
3458
- toolbar: _ = de[t].toolbar,
3459
- floatingToolbar: T = de[t].floatingToolbar,
3460
- toolbarStart: E,
3461
- toolbarEnd: p,
3462
- footer: y,
3463
- actions: k,
3464
- autoFocus: C,
3465
- readOnly: b,
3466
- bordered: L = !0,
3467
- minHeight: I = de[t].minHeight,
3468
- maxHeight: F = de[t].maxHeight,
3469
- namespace: N = "ayon-markdown-editor",
3470
- className: G,
3471
- style: ce,
3472
- contentClassName: xe,
3473
- children: ke
3474
- }, Te) => {
3475
- const we = _e(
3476
- () => ho({
3477
- name: N,
3478
- namespace: N,
3479
- theme: _r,
3480
- nodes: Hs,
3481
- editable: !b,
3482
- $initialEditorState: () => et(e || ""),
3483
- // the react extension renders the decorator nodes (media, youtube)
3484
- dependencies: [$o],
3485
- onError: (Le) => {
3486
- console.error("[MarkdownEditor]", Le);
3487
- }
3488
- }),
3489
- // eslint-disable-next-line react-hooks/exhaustive-deps
3490
- []
3491
- );
3492
- return (
3493
- // the content editable is rendered below, inside the editor layout
3494
- /* @__PURE__ */ S(fo, { extension: we, contentEditable: null, children: [
3495
- /* @__PURE__ */ S(
3496
- bi,
3497
- {
3498
- className: P("md-editor", "block-shortcuts", `md-editor-${t}`, G, {
3499
- bordered: L,
3500
- readOnly: b
3501
- }),
3502
- style: ce,
3503
- children: [
3504
- _ && !b && /* @__PURE__ */ l(
3505
- zt,
3506
- {
3507
- layout: Array.isArray(_) ? _ : void 0,
3508
- start: E,
3509
- end: p
3510
- }
3511
- ),
3512
- /* @__PURE__ */ S(Ci, { children: [
3513
- /* @__PURE__ */ l(Li, { style: { minHeight: I, maxHeight: F }, children: /* @__PURE__ */ l($i, { children: /* @__PURE__ */ l(
3514
- bo,
3515
- {
3516
- className: P("md-content", xe),
3517
- style: { minHeight: I },
3518
- "aria-placeholder": o,
3519
- placeholder: /* @__PURE__ */ l(Mi, { className: "md-placeholder", children: o })
3520
- }
3521
- ) }) }),
3522
- k && /* @__PURE__ */ l("div", { className: "md-actions", children: k })
3523
- ] }),
3524
- y
3525
- ]
3526
- }
3527
- ),
3528
- /* @__PURE__ */ l(js, { editable: !b }),
3529
- /* @__PURE__ */ l(yo, {}),
3530
- /* @__PURE__ */ l(vo, {}),
3531
- /* @__PURE__ */ l(xo, {}),
3532
- /* @__PURE__ */ l(Eo, { maxIndent: 5 }),
3533
- /* @__PURE__ */ l(ko, { validateUrl: Us }),
3534
- /* @__PURE__ */ l(wo, { matchers: Ks }),
3535
- /* @__PURE__ */ l(os, {}),
3536
- /* @__PURE__ */ l(Rs, {}),
3537
- !b && /* @__PURE__ */ l(ss, {}),
3538
- !b && /* @__PURE__ */ l(as, {}),
3539
- /* @__PURE__ */ l(cs, {}),
3540
- !b && /* @__PURE__ */ l(is, {}),
3541
- !b && /* @__PURE__ */ l(Os, {}),
3542
- u && !b && /* @__PURE__ */ l(As, { onUploadMedia: u, onFiles: a }),
3543
- /* @__PURE__ */ l(_o, { transformers: Pe }),
3544
- /* @__PURE__ */ l(es, {}),
3545
- /* @__PURE__ */ l(Ji, {}),
3546
- /* @__PURE__ */ l(Xi, {}),
3547
- /* @__PURE__ */ l(ns, {}),
3548
- /* @__PURE__ */ l(ts, { onSubmit: r, onEscape: s, submitOnEnter: i }),
3549
- T && !b && /* @__PURE__ */ l(
3550
- zt,
3551
- {
3552
- floating: !0,
3553
- layout: Array.isArray(T) ? T : Lr
3554
- }
3555
- ),
3556
- /* @__PURE__ */ l(Ps, { onFiles: a }),
3557
- /* @__PURE__ */ l(Bs, { value: e, onChange: n, handleRef: Te }),
3558
- h && !b && /* @__PURE__ */ l(
3559
- gs,
3560
- {
3561
- placement: x,
3562
- menuParent: v,
3563
- mentionTriggers: d ? d.triggers ?? ["@", "@@", "@@@"] : [],
3564
- onFiles: a,
3565
- canInsertMedia: !!u,
3566
- customCommands: f
3567
- }
3568
- ),
3569
- g && !b && /* @__PURE__ */ l(Gi, { placement: x, menuParent: v }),
3570
- d && /* @__PURE__ */ l(
3571
- Fi,
3572
- {
3573
- source: d,
3574
- menuParent: v,
3575
- placement: x
3576
- }
3577
- ),
3578
- (c || m) && /* @__PURE__ */ l(Wi, { onMentionClick: c, onMentionHover: m }),
3579
- C && /* @__PURE__ */ l(Co, { defaultSelection: "rootEnd" }),
3580
- ke
3581
- ] })
3582
- );
3583
- }
3584
- );
3585
- Gs.displayName = "MarkdownEditor";
3586
- const Ws = (t, e) => {
3587
- const n = t.item || t, o = e.item || e, r = new Date(n.createdAt), i = new Date(o.createdAt), s = Ie(r) && Ie(i), a = s && Yt(r, i);
3588
- return !s || a ? n.relevance > o.relevance ? -1 : n.relevance < o.relevance ? 1 : String(o.label).localeCompare(String(n.label)) : zn(i, r) ? -1 : 1;
3589
- }, Ys = (t, e) => t.relevance > e.relevance ? -1 : t.relevance < e.relevance ? 1 : t.label?.localeCompare(e.label), qs = ["team:", "user:"], Qs = (t) => {
3590
- if (!t) return { typeFilter: null, search: void 0 };
3591
- for (const e of qs)
3592
- if (t.startsWith(e))
3593
- return {
3594
- typeFilter: e.slice(0, -1),
3595
- // 'team:' -> 'team'
3596
- search: t.slice(e.length) || void 0
3597
- };
3598
- return { typeFilter: null, search: t };
3599
- }, Vs = (t, e = {}, n) => {
3600
- if (!(t in e)) return [];
3601
- const o = e[t]() || [];
3602
- let r = Ys;
3603
- t === "@@" && (r = Ws);
3604
- const { typeFilter: i, search: s } = Qs(n), a = i ? o.filter((h) => h.type === i) : o, u = Qn(s || "");
3605
- if (!u.length) return a.sort(r);
3606
- const d = (h, f) => Yn(h, f, {
3607
- keys: ["label", "context", "keywords"],
3608
- baseSort: r
3609
- }), v = u.map((h) => h.reduce(d, a)), x = /* @__PURE__ */ new Set(), g = Math.max(...v.map((h) => h.length));
3610
- for (let h = 0; h < g; h++)
3611
- v.forEach((f) => f[h] && x.add(f[h]));
3612
- return [...x];
3613
- }, Js = (t = [], e = []) => {
3614
- const n = t.map((r) => ({
3615
- type: "user",
3616
- id: r.name,
3617
- label: r.fullName || r.name,
3618
- keywords: [r.name, r.fullName],
3619
- relevance: r.relevance
3620
- })), o = e.map((r) => ({
3621
- type: "team",
3622
- id: r.name,
3623
- label: r.name,
3624
- keywords: [r.name],
3625
- relevance: r.relevance,
3626
- icon: "group",
3627
- suffix: "Team"
3628
- }));
3629
- return [...n, ...o];
3630
- }, Xs = (t = [], e = []) => t.map((n) => {
3631
- const o = e.find((x) => x.name === n.taskType), r = o?.icon || it("task"), i = o?.color, s = n.label || n.name, a = n.parent?.name, d = `${a} ${s} ${n.taskType}`, v = [n.name, n.taskType, n.label, n.parent?.name, d];
3632
- return {
3633
- type: "task",
3634
- id: n.id,
3635
- label: s,
3636
- context: a,
3637
- icon: r,
3638
- color: i,
3639
- keywords: v,
3640
- relevance: n.relevance
3641
- };
3642
- }), Zs = (t) => {
3643
- let e = Fn(t, { addSuffix: !0 });
3644
- return e = e.replace("about", ""), e = e.replace("minutes", "mins"), e = e.replace("minute", "min"), e = e.replace(" ago", ""), Yt(t, /* @__PURE__ */ new Date()) && (e = "Just now"), e;
3645
- }, ea = (t = [], e) => t?.map((n) => {
3646
- if (!n.parent)
3647
- return null;
3648
- const r = e.productTypes?.find((v) => v.name === n.parent?.productType)?.icon || it("version"), i = n.parent?.name, s = n.name || n.version, a = n.createdAt && Zs(new Date(n.createdAt)), u = `${i} ${s} ${a}`, d = [n.name, n.version, n.parent?.name, u];
3649
- return {
3650
- type: "version",
3651
- id: n.id,
3652
- createdAt: n.createdAt,
3653
- label: s,
3654
- icon: r,
3655
- context: i,
3656
- suffix: a,
3657
- keywords: d,
3658
- relevance: n.relevance
3659
- };
3660
- }), Wl = ({
3661
- suggestions: t = {},
3662
- // version options read the product types
3663
- project: e = { productTypes: [] },
3664
- taskTypes: n = [],
3665
- entityType: o
3666
- }) => ({
3667
- getOptions: ({ trigger: r, search: i, filter: s }) => Vs(
3668
- r,
3669
- {
3670
- "@": () => Js(t.users, t.teams),
3671
- "@@": () => ea(t.versions, e),
3672
- "@@@": () => Xs(t.tasks, n)
3673
- },
3674
- // the helper understands `team:` / `user:` prefixes
3675
- (s ? `${s}:` : "") + i || void 0
3676
- ).filter((u) => !!u),
3677
- getError: (r) => r === "@@" && o === "folder" ? "Version mentions are disabled for folders" : null
3678
- }), ta = w.span`
3679
- gap: 2px;
3680
- display: inline-flex;
3681
- border-radius: var(--border-radius-m);
3682
- width: min-content;
3683
- position: relative;
3684
- user-select: none;
3685
- padding: 0;
3686
- padding-right: 4px;
3687
- white-space: nowrap;
3688
- cursor: pointer;
3689
-
3690
- align-items: center;
3691
-
3692
- &,
3693
- .icon {
3694
- color: ${({ $categoryPrimary: t }) => t || "var(--md-sys-color-primary)"};
3695
- }
3696
-
3697
- .icon {
3698
- font-size: 20px;
3699
- }
3700
-
3701
- background-color: ${({ $categorySecondary: t }) => t || "var(--md-sys-color-surface-container-high)"};
3702
-
3703
- &:hover {
3704
- background-color: ${({ $categorySecondary: t }) => t ? `color-mix(in srgb, ${t} 85%, white)` : "var(--md-sys-color-surface-container-high-hover)"};
3705
- }
3706
- &:active {
3707
- background-color: ${({ $categorySecondary: t }) => t ? `color-mix(in srgb, ${t} 70%, white)` : "var(--md-sys-color-surface-container-high-active)"};
3708
- }
3709
-
3710
- ${({ $variant: t }) => t === "text" && Ee`
3711
- background-color: unset;
3712
- `}
3713
-
3714
- ${({ $variant: t, $categoryPrimary: e }) => t === "filled" && Ee`
3715
- background-color: ${e || "var(--md-sys-color-primary)"};
3716
-
3717
- &,
3718
- .icon {
3719
- color: ${e ? "white" : "var(--md-sys-color-on-primary)"};
3720
- }
3721
-
3722
- &:hover {
3723
- background-color: ${e ? `color-mix(in srgb, ${e} 85%, white)` : "var(--md-sys-color-primary-hover)"};
3724
- }
3725
-
3726
- &:active {
3727
- background-color: ${e ? `color-mix(in srgb, ${e} 70%, white)` : "var(--md-sys-color-primary-active)"};
3728
- }
3729
- `}
3730
-
3731
- /* remove background colour and hover on disabled */
3732
- &.disabled {
3733
- background-color: unset;
3734
- }
3735
- `, rt = ({
3736
- id: t,
3737
- type: e,
3738
- variant: n = "surface",
3739
- isEntity: o,
3740
- icon: r,
3741
- disabled: i,
3742
- onMouseEnter: s,
3743
- categoryPrimary: a,
3744
- categorySecondary: u,
3745
- children: d,
3746
- ...v
3747
- }) => {
3748
- const x = r || (e === "user" ? "alternate_email" : e === "team" ? "group" : it(e, "link")), g = O(null);
3749
- return /* @__PURE__ */ S(
3750
- ta,
3751
- {
3752
- ...v,
3753
- $variant: n,
3754
- $categoryPrimary: a,
3755
- $categorySecondary: u,
3756
- ref: g,
3757
- onMouseEnter: (f) => {
3758
- const c = g.current?.getBoundingClientRect();
3759
- if (!c) return;
3760
- const m = { left: c.x + c.width / 2, top: c.y };
3761
- s?.(f, m);
3762
- },
3763
- className: P({ disabled: i, isEntity: o }, "reference"),
3764
- id: `ref-${t}`,
3765
- children: [
3766
- /* @__PURE__ */ l(J, { icon: x }),
3767
- d
3768
- ]
3769
- }
3770
- );
3771
- }, na = w(J)`
3772
- cursor: pointer;
3773
- user-select: none;
3774
- font-size: 24px;
3775
-
3776
- &.checked {
3777
- color: var(--md-sys-color-tertiary);
3778
- /* fill icon */
3779
- font-variation-settings: 'FILL' 1;
3780
- }
3781
-
3782
- &:not(.readOnly):hover {
3783
- color: var(--md-sys-color-tertiary-hover);
3784
- }
3785
-
3786
- &.readOnly {
3787
- cursor: default;
3788
- }
3789
- `, oa = ({ checked: t, isReadOnly: e, ...n }) => /* @__PURE__ */ l(
3790
- na,
3791
- {
3792
- ...n,
3793
- icon: t ? "check_circle" : "radio_button_unchecked",
3794
- className: P(n.className, { checked: t, readOnly: e })
3795
- }
3796
- ), Se = "no-date", Q = (t, e, n, o) => [
3797
- { label: n, id: t.toISOString() },
3798
- { label: o, id: e.toISOString() }
3799
- ], z = {
3800
- today: () => {
3801
- const t = /* @__PURE__ */ new Date();
3802
- return Q(Ct(t), Et(t), "Start of day", "End of day");
3803
- },
3804
- yesterday: () => {
3805
- const t = Wn(/* @__PURE__ */ new Date(), 1);
3806
- return Q(
3807
- Ct(t),
3808
- Et(t),
3809
- "Start of yesterday",
3810
- "End of yesterday"
3811
- );
3812
- },
3813
- "after-now": () => [
3814
- { label: "After today", id: _t(/* @__PURE__ */ new Date(), 24).toISOString() },
3815
- { id: Se, label: Se }
3816
- ],
3817
- "before-now": () => [
3818
- { id: Se, label: Se },
3819
- { label: "Before today", id: _t(/* @__PURE__ */ new Date(), 0).toISOString() }
3820
- ],
3821
- "this-week": () => {
3822
- const t = /* @__PURE__ */ new Date();
3823
- return Q(
3824
- Ge(t, { weekStartsOn: 0 }),
3825
- je(t, { weekStartsOn: 0 }),
3826
- "Start of week",
3827
- "End of week"
3828
- );
3829
- },
3830
- "next-week": () => {
3831
- const t = Gn(/* @__PURE__ */ new Date(), 1);
3832
- return Q(
3833
- Ge(t, { weekStartsOn: 0 }),
3834
- je(t, { weekStartsOn: 0 }),
3835
- "Start of next week",
3836
- "End of next week"
3837
- );
3838
- },
3839
- "last-week": () => {
3840
- const t = jn(/* @__PURE__ */ new Date(), 1);
3841
- return Q(
3842
- Ge(t, { weekStartsOn: 0 }),
3843
- je(t, { weekStartsOn: 0 }),
3844
- "Start of last week",
3845
- "End of last week"
3846
- );
3847
- },
3848
- "this-month": () => {
3849
- const t = /* @__PURE__ */ new Date();
3850
- return Q(He(t), Ue(t), "Start of month", "End of month");
3851
- },
3852
- "next-month": () => {
3853
- const t = Hn(/* @__PURE__ */ new Date(), 1);
3854
- return Q(
3855
- He(t),
3856
- Ue(t),
3857
- "Start of next month",
3858
- "End of next month"
3859
- );
3860
- },
3861
- "last-month": () => {
3862
- const t = Un(/* @__PURE__ */ new Date(), 1);
3863
- return Q(
3864
- He(t),
3865
- Ue(t),
3866
- "Start of last month",
3867
- "End of last month"
3868
- );
3869
- },
3870
- "this-year": () => {
3871
- const t = /* @__PURE__ */ new Date();
3872
- return Q(wt(t), kt(t), "Start of year", "End of year");
3873
- },
3874
- "last-year": () => {
3875
- const t = Kn(/* @__PURE__ */ new Date(), 1);
3876
- return Q(
3877
- wt(t),
3878
- kt(t),
3879
- "Start of last year",
3880
- "End of last year"
3881
- );
3882
- }
3883
- }, ra = "custom-range", ia = "tune", sa = {
3884
- id: ra,
3885
- label: "Custom range...",
3886
- values: [],
3887
- icon: ia
3888
- }, An = () => [
3889
- {
3890
- id: "today",
3891
- label: "Today",
3892
- values: z.today(),
3893
- icon: "today"
3894
- },
3895
- {
3896
- id: "yesterday",
3897
- label: "Yesterday",
3898
- values: z.yesterday(),
3899
- icon: "date_range"
3900
- },
3901
- {
3902
- id: "after-now",
3903
- label: "After today",
3904
- values: z["after-now"](),
3905
- icon: "event_upcoming"
3906
- },
3907
- {
3908
- id: "before-now",
3909
- label: "Before today",
3910
- values: z["before-now"](),
3911
- icon: "event_busy"
3912
- },
3913
- {
3914
- id: "this-week",
3915
- label: "This week",
3916
- values: z["this-week"](),
3917
- icon: "date_range"
3918
- },
3919
- {
3920
- id: "last-week",
3921
- label: "Last week",
3922
- values: z["last-week"](),
3923
- icon: "date_range"
3924
- },
3925
- {
3926
- id: "this-month",
3927
- label: "This month",
3928
- values: z["this-month"](),
3929
- icon: "calendar_month"
3930
- },
3931
- {
3932
- id: "last-month",
3933
- label: "Last month",
3934
- values: z["last-month"](),
3935
- icon: "calendar_month"
3936
- },
3937
- {
3938
- id: "this-year",
3939
- label: "This year",
3940
- values: z["this-year"](),
3941
- icon: "calendar_month"
3942
- },
3943
- {
3944
- id: "last-year",
3945
- label: "Last year",
3946
- values: z["last-year"](),
3947
- icon: "calendar_month"
3948
- }
3949
- ], Yl = An(), aa = () => [
3950
- sa,
3951
- ...An()
3952
- ], ql = aa(), Ql = (t, e) => {
3953
- if (!t || !e) return null;
3954
- try {
3955
- const n = B(t), o = B(e);
3956
- if (!Ie(n) || !Ie(o)) return null;
3957
- const r = [
3958
- {
3959
- id: "today",
3960
- label: "Today",
3961
- check: () => {
3962
- const i = z.today();
3963
- return K(n, B(i[0].id)) && K(o, B(i[1].id));
3964
- }
3965
- },
3966
- {
3967
- id: "yesterday",
3968
- label: "Yesterday",
3969
- check: () => {
3970
- const i = z.yesterday();
3971
- return K(n, B(i[0].id)) && K(o, B(i[1].id));
3972
- }
3973
- },
3974
- {
3975
- id: "this-week",
3976
- label: "This week",
3977
- check: () => {
3978
- const i = z["this-week"]();
3979
- return K(n, B(i[0].id)) && K(o, B(i[1].id));
3980
- }
3981
- },
3982
- {
3983
- id: "last-week",
3984
- label: "Last week",
3985
- check: () => {
3986
- const i = z["last-week"]();
3987
- return K(n, B(i[0].id)) && K(o, B(i[1].id));
3988
- }
3989
- },
3990
- {
3991
- id: "this-month",
3992
- label: "This month",
3993
- check: () => {
3994
- const i = z["this-month"]();
3995
- return K(n, B(i[0].id)) && K(o, B(i[1].id));
3996
- }
3997
- },
3998
- {
3999
- id: "last-month",
4000
- label: "Last month",
4001
- check: () => {
4002
- const i = z["last-month"]();
4003
- return K(n, B(i[0].id)) && K(o, B(i[1].id));
4004
- }
4005
- },
4006
- {
4007
- id: "this-year",
4008
- label: "This year",
4009
- check: () => {
4010
- const i = z["this-year"]();
4011
- return K(n, B(i[0].id)) && K(o, B(i[1].id));
4012
- }
4013
- },
4014
- {
4015
- id: "last-year",
4016
- label: "Last year",
4017
- check: () => {
4018
- const i = z["last-year"]();
4019
- return K(n, B(i[0].id)) && K(o, B(i[1].id));
4020
- }
4021
- }
4022
- ];
4023
- for (const i of r)
4024
- if (i.check())
4025
- return { label: i.label, id: i.id };
4026
- return null;
4027
- } catch {
4028
- return null;
4029
- }
4030
- }, la = w.label`
4031
- cursor: pointer;
4032
- position: relative;
4033
- right: 2rem;
4034
-
4035
- input {
4036
- opacity: 0;
4037
- width: 0;
4038
- height: 0;
4039
- position: absolute;
4040
- }
4041
-
4042
- .icon {
4043
- user-select: none;
4044
- font-size: 24px;
4045
- position: relative;
4046
- top: -3px;
4047
- position: absolute;
4048
- }
4049
-
4050
- &.checked {
4051
- .icon {
4052
- color: var(--md-sys-color-tertiary);
4053
- /* fill icon */
4054
- font-variation-settings: 'FILL' 1;
4055
- }
4056
- }
4057
- `, ca = ({ checked: t, onChange: e }) => /* @__PURE__ */ S(la, { className: P({ checked: t }), children: [
4058
- /* @__PURE__ */ l("input", { checked: t, disabled: !1, onChange: e, type: "checkbox" }),
4059
- /* @__PURE__ */ l(oa, { checked: t })
4060
- ] }), da = ({
4061
- projectName: t,
4062
- activityId: e,
4063
- entityId: n,
4064
- onClick: o,
4065
- categoryPrimary: r,
4066
- categorySecondary: i
4067
- }) => {
4068
- const { data: s, isError: a } = lr({
4069
- projectName: t,
4070
- entityIds: [n],
4071
- activityIds: [e]
4072
- });
4073
- return a || !s?.activities.some((u) => u.activityId === e) ? null : /* @__PURE__ */ l(
4074
- rt,
4075
- {
4076
- type: "activity",
4077
- id: `source-${e}`,
4078
- icon: "chat_paste_go",
4079
- onClick: o,
4080
- categoryPrimary: r,
4081
- categorySecondary: i,
4082
- "data-tooltip": "Go to source comment",
4083
- children: "Source"
4084
- }
4085
- );
4086
- }, ua = ({ to: t, useNavigate: e, children: n }) => {
4087
- const o = e();
4088
- return /* @__PURE__ */ l("a", { href: t, onClick: (i) => {
4089
- i.button !== 0 || i.metaKey || i.ctrlKey || i.shiftKey || i.altKey || (i.preventDefault(), o(t));
4090
- }, children: n });
4091
- }, ma = ({ to: t, children: e }) => {
4092
- const n = Zn(dr)?.useNavigate;
4093
- return n ? /* @__PURE__ */ l(ua, { to: t, useNavigate: n, children: e }) : /* @__PURE__ */ l("a", { href: t, children: e });
4094
- }, pa = (t, e, n) => {
4095
- const o = new URLSearchParams(window.location.search), r = n?.type ?? o.get("type"), i = n?.id ?? o.get("id"), s = r && i && hr({ projectName: t, entityType: r, id: i }, { activity: e });
4096
- if (s) return `${window.location.origin}${s}`;
4097
- o.set("activity", e);
4098
- const a = new URL(`${window.location.origin}/projects/${t}/overview`);
4099
- return a.search = o.toString(), a.toString();
4100
- }, Vl = w.div`
4101
- /* use grid tick for auto height transition */
4102
- display: grid;
4103
- height: 100%;
4104
- /* transition: translate 0.1s, margin-top 0.1s; */
4105
- position: relative;
4106
-
4107
- /* when closed default */
4108
- translate: 0 50px;
4109
- margin-top: -50px;
4110
-
4111
- /* when open */
4112
- &.isOpen {
4113
- translate: 0 0;
4114
- margin-top: 0;
4115
- }
4116
-
4117
- padding: 0 4px 4px 4px;
4118
- /* when editing */
4119
- &.isEditing {
4120
- padding: 0;
4121
- }
4122
- `, Dn = (t, e, n) => t && Ee`
4123
- --background-color: ${n};
4124
- --button-color: ${t};
4125
- --button-color-secondary: ${e};
4126
- --button-text-color: ${no(t)};
4127
- --border-color: ${t};
4128
- `, Jl = w.div`
4129
- /* VARS */
4130
- --background-color: var(--md-sys-color-surface-container);
4131
- --button-color: var(--md-sys-color-primary);
4132
- --button-color-secondary: var(--md-sys-color-surface-container-highest);
4133
- --button-text-color: var(--md-sys-color-on-primary);
4134
- --border-color: var(--md-sys-color-outline-variant);
4135
-
4136
- &.category {
4137
- /* CATEGORY */
4138
- ${({ $categoryPrimary: t, $categorySecondary: e, $categoryTertiary: n }) => Dn(t, e, n)}
4139
- button.comment {
4140
- &:hover {
4141
- background-color: var(--button-color);
4142
- filter: brightness(1.2);
4143
- }
4144
- }
4145
- }
4146
-
4147
- display: flex;
4148
- flex-direction: column;
4149
- position: relative;
4150
-
4151
- background-color: var(--background-color);
4152
- border: 1px solid var(--border-color);
4153
- &.isDropping.isOpen {
4154
- border-color: var(--md-sys-color-primary);
4155
- }
4156
-
4157
- border-radius: var(--border-radius-l);
4158
- overflow: hidden;
4159
- transition: opacity 250ms 250ms, background-color 250ms, border-color 250ms;
4160
-
4161
- &.isOpen {
4162
- /* box shadow */
4163
- box-shadow: 0 -3px 10px 0 rgba(0, 0, 0, 0.2);
4164
- }
4165
-
4166
- /* the markdown editor inherits the comment (and category) colours */
4167
- .comment-editor {
4168
- background-color: var(--background-color);
4169
- border-radius: 0;
4170
-
4171
- .md-toolbar {
4172
- border-bottom: 1px solid var(--md-sys-color-surface-container-hover);
4173
- background-color: var(--background-color);
4174
- }
4175
-
4176
- .md-toolbar-button {
4177
- &:hover {
4178
- background-color: var(--button-color-secondary);
4179
- }
4180
- &.active {
4181
- background-color: var(--button-color-secondary);
4182
- color: var(--button-color);
4183
- }
4184
- }
4185
-
4186
- .mention {
4187
- color: var(--button-color);
4188
- background-color: var(--button-color-secondary);
4189
-
4190
- &:hover {
4191
- background-color: color-mix(in srgb, var(--button-color-secondary) 85%, white);
4192
- }
4193
- }
4194
- }
4195
-
4196
- /* CLOSED */
4197
- &.isClosed {
4198
- cursor: pointer;
4199
- &:hover:not(.disabled) {
4200
- background-color: var(--md-sys-color-surface-container-high);
4201
- }
4202
- }
4203
-
4204
- &.disabled {
4205
- cursor: default;
4206
- pointer-events: none;
4207
- user-select: none;
4208
- border-color: var(--md-sys-color-surface-container-lowest);
4209
- background-color: var(--md-sys-color-surface-container-lowest);
4210
- }
4211
-
4212
- &.isLoading,
4213
- &.isSubmitting {
4214
- cursor: default;
4215
- pointer-events: none;
4216
- user-select: none;
4217
- }
4218
-
4219
- /* EDITING */
4220
- &.isEditing {
4221
- /* remove box shadow */
4222
- box-shadow: none;
4223
- /* remove outline */
4224
- outline: none;
4225
- }
4226
- `, Xl = w.div`
4227
- padding: 4px 4px 0;
4228
- `, Zl = w.span`
4229
- width: 1px;
4230
- height: 18px;
4231
- margin: 0 4px;
4232
- background-color: var(--md-sys-color-surface-container-hover);
4233
- `, ec = w.footer`
4234
- display: flex;
4235
- justify-content: space-between;
4236
- padding: var(--padding-m);
4237
- border-top: 1px solid var(--md-sys-color-surface-container-hover);
4238
- background-color: var(--background-color);
4239
- z-index: 100;
4240
- gap: var(--base-gap-small);
4241
- container-type: inline-size;
4242
- container-name: comment-input-footer;
4243
-
4244
- /* the frame link button can make the buttons too wide for a narrow panel:
4245
- move the submit buttons onto their own line instead of hiding them */
4246
- &:has(.frame-link) {
4247
- flex-wrap: wrap;
4248
- }
4249
-
4250
- /* remove save button icon */
4251
- .comment {
4252
- min-width: 75px;
4253
- .icon {
4254
- display: none;
4255
- }
4256
- background-color: var(--button-color);
4257
- color: var(--button-text-color);
4258
- }
4259
- `, ga = w.div`
4260
- display: flex;
4261
- gap: var(--base-gap-small);
4262
-
4263
- &:has(.frame-link) {
4264
- flex-wrap: wrap;
4265
- }
4266
-
4267
- button {
4268
- &.text {
4269
- &:hover {
4270
- background-color: var(--button-color-secondary);
4271
- }
4272
- }
4273
- }
4274
- `, tc = w.div`
4275
- display: inline-flex;
4276
- align-items: center;
4277
- border-radius: var(--border-radius-m);
4278
- padding-right: var(--padding-s);
4279
-
4280
- &.selected {
4281
- color: var(--md-sys-color-on-primary-container);
4282
- background-color: var(--md-sys-color-primary-container);
4283
-
4284
- &:hover {
4285
- background-color: var(--md-sys-color-primary-container-hover);
4286
- }
4287
- }
4288
- `, nc = w(te)`
4289
- color: inherit;
4290
- background: transparent;
4291
-
4292
- &:hover {
4293
- background-color: var(--md-sys-color-primary-container-hover) !important;
4294
- }
4295
- `, oc = w(te)`
4296
- width: 100%;
4297
- padding: 4px 6px;
4298
- white-space: nowrap;
4299
- color: inherit;
4300
- background: transparent;
4301
-
4302
- &:hover {
4303
- background-color: var(--md-sys-color-surface-container-low) !important;
4304
- }
4305
- `, rc = w(to)`
4306
- min-width: 0;
4307
- padding: 4px 8px;
4308
- `, ic = w(ga)`
4309
- margin-left: auto;
4310
- flex-shrink: 1;
4311
- overflow: hidden;
4312
- `, sc = w.div`
4313
- position: absolute;
4314
- inset: 0;
4315
- user-select: none;
4316
- pointer-events: none;
4317
-
4318
- display: flex;
4319
- justify-content: center;
4320
- align-items: center;
4321
-
4322
- opacity: 0;
4323
- transition: opacity 0.2s;
4324
-
4325
- &.show {
4326
- opacity: 1;
4327
- }
4328
-
4329
- background-color: rgba(0, 0, 0, 0.5);
4330
-
4331
- z-index: 300;
4332
-
4333
- .icon {
4334
- font-size: 40px;
4335
- }
4336
- `, ac = w.span`
4337
- padding: 12px 15px;
4338
- /* italic */
4339
- font-style: italic;
4340
- opacity: 0.4;
4341
- `, lc = w.div`
4342
- display: grid;
4343
- gap: var(--base-gap-medium);
4344
- grid-template-columns: 1fr 1fr;
4345
- `, cc = w.div`
4346
- margin-top: var(--padding-m);
4347
- `, dc = w(te)`
4348
- background: transparent;
4349
- border: solid 1px currentColor;
4350
- flex-grow: 1;
4351
- height: 32px;
4352
-
4353
- &.danger {
4354
- color: var(--md-sys-color-error);
4355
- }
4356
-
4357
- &.tertiary {
4358
- color: var(--md-sys-color-tertiary);
4359
- }
4360
-
4361
- &:hover {
4362
- background: rgb(from currentColor r g b / 0.25);
4363
- }
4364
-
4365
- @container comment-input-footer (max-width: 345px) {
4366
- .version-review-buttons.guest & .label {
4367
- position: absolute;
4368
- opacity: 0;
4369
- width: 0;
4370
- pointer-events: none;
4371
- }
4372
- }
4373
-
4374
- @container comment-input-footer (max-width: 510px) {
4375
- .version-review-buttons:not(.guest) & .label {
4376
- position: absolute;
4377
- opacity: 0;
4378
- width: 0;
4379
- pointer-events: none;
4380
- }
4381
- }
4382
- `, uc = w.div`
4383
- border-radius: var(--border-radius-l);
4384
- margin-bottom: var(--padding-m);
4385
- user-select: none;
4386
- display: flex;
4387
- gap: var(--base-gap-small);
4388
- overflow: hidden;
4389
- padding: var(--padding-m) var(--padding-s);
4390
- align-items: center;
4391
- line-height: 1;
4392
-
4393
- &.approve,
4394
- &.approve .icon,
4395
- &.approve .date {
4396
- background-color: var(--md-sys-color-tertiary);
4397
- color: var(--md-sys-color-on-tertiary);
4398
- }
4399
-
4400
- &.request_changes,
4401
- &.request_changes .icon,
4402
- &.request_changes .date {
4403
- background-color: var(--md-sys-color-error);
4404
- color: var(--md-sys-color-on-error);
4405
- }
4406
- `;
4407
- w.div`
4408
- border-radius: var(--border-radius-m);
4409
- `;
4410
- const mc = w.li`
4411
- /* VARS */
4412
- --background-color: var(--md-sys-color-surface-container);
4413
- --button-color-secondary: var(--md-sys-color-surface-container-high);
4414
- --border-color: transparent;
4415
-
4416
- /* only apply category colours if category classname is present */
4417
- &.category {
4418
- /* CATEGORY */
4419
- ${({ $categoryPrimary: t, $categorySecondary: e, $categoryTertiary: n }) => Dn(t, e, n)}
4420
- }
4421
-
4422
- /* reset default */
4423
- list-style: none;
4424
- margin: 0;
4425
- padding: 0;
4426
-
4427
- display: flex;
4428
- flex-direction: column;
4429
- gap: var(--base-gap-small);
4430
-
4431
- width: 100%;
4432
- padding: var(--padding-m);
4433
- border-radius: var(--border-radius-m);
4434
-
4435
- /* by default hide menu */
4436
-
4437
- .isEditing {
4438
- z-index: 1000;
4439
- }
4440
-
4441
- :not(.isEditing) {
4442
- /* on hover show menu and hide date */
4443
- &:hover {
4444
- .tools {
4445
- opacity: 1;
4446
- }
4447
- }
4448
- }
4449
-
4450
- /* keep tools visible when menu is open */
4451
- &.menuOpen {
4452
- .tools {
4453
- opacity: 1;
4454
- }
4455
- }
4456
-
4457
- &.isHighlighted {
4458
- background-color: var(--md-sys-color-secondary-container);
4459
- }
4460
- `, pc = w.div`
4461
- background-color: var(--background-color);
4462
- border-radius: var(--border-radius-m);
4463
- padding: var(--padding-m);
4464
- padding: 12px 10px;
4465
- position: relative;
4466
- min-width: 0;
4467
-
4468
- /* the text can always be selected and copied, even when the host turns selection off around
4469
- the feed (e.g. the review player's splitter). Doubled for specificity, mentions keep theirs. */
4470
- && .comment-text,
4471
- && .comment-text *:not(.reference, .reference *) {
4472
- -webkit-user-select: text;
4473
- user-select: text;
4474
- }
4475
-
4476
- p {
4477
- margin: 0;
4478
- }
4479
- /* a blank line between paragraphs (lines of one paragraph are joined by hard breaks) */
4480
- p + p {
4481
- margin-top: 20px;
4482
- }
4483
- /* quote lines are rendered as paragraphs, they sit tight */
4484
- blockquote p + p {
4485
- margin-top: 0;
4486
- }
4487
-
4488
- & > *:not(.tools):not(h1) {
4489
- margin-bottom: 0;
4490
- }
4491
-
4492
- a {
4493
- color: var(--md-sys-color-primary);
4494
- }
4495
-
4496
- img {
4497
- width: 100%;
4498
- }
4499
-
4500
- p {
4501
- word-break: break-word;
4502
- .reference {
4503
- margin-right: -2px;
4504
- top: 5px;
4505
- user-select: all;
4506
- }
4507
-
4508
- /* target empty lines with &nbsp; or br */
4509
- &.empty-line {
4510
- height: 20px;
4511
- margin: 0;
4512
- }
4513
- }
4514
-
4515
- h1 {
4516
- ${Oe.titleLarge}
4517
- font-size: 24px;
4518
- }
4519
-
4520
- h2 {
4521
- ${Oe.titleMedium}
4522
- font-size: 20px;
4523
- }
4524
-
4525
- h3 {
4526
- ${Oe.titleSmall}
4527
- font-size: 16px;
4528
- }
4529
-
4530
- h1,
4531
- h2,
4532
- h3 {
4533
- margin-top: 16px;
4534
- }
4535
-
4536
- ul,
4537
- ol {
4538
- .reference {
4539
- top: 6px;
4540
- }
4541
- }
4542
-
4543
- .contains-task-list {
4544
- list-style: none;
4545
- display: flex;
4546
- flex-direction: column;
4547
- gap: var(--base-gap-large);
4548
- padding-left: 8px;
4549
- margin: 16px 0;
4550
-
4551
- li {
4552
- align-items: center;
4553
- }
4554
-
4555
- & > * {
4556
- padding-left: 1.5rem;
4557
- }
4558
-
4559
- p {
4560
- margin: 0;
4561
-
4562
- .reference {
4563
- top: 0px;
4564
- margin-left: 4px;
4565
- }
4566
- }
4567
- }
4568
-
4569
- blockquote {
4570
- margin: 0;
4571
- padding-left: 16px;
4572
- position: relative;
4573
-
4574
- &::before {
4575
- content: '';
4576
- position: absolute;
4577
- left: 0;
4578
- top: 0;
4579
- bottom: 0;
4580
- width: 4px;
4581
- background-color: var(--md-sys-color-outline-variant);
4582
- border-radius: 2px;
4583
- }
4584
- }
4585
-
4586
- /* Inline code elements (not in pre blocks) */
4587
- code:not(pre code) {
4588
- font-family: monospace;
4589
- background-color: var(--md-sys-color-surface-container-lowest);
4590
- padding: 2px 4px;
4591
- border-radius: 2px;
4592
- }
4593
-
4594
- &.isEditing {
4595
- padding: 0;
4596
- border-radius: var(--border-radius-l);
4597
- }
4598
- `, Gt = w.p`
4599
- margin: 0;
4600
-
4601
- &:first-child {
4602
- margin-top: 14px;
4603
- }
4604
-
4605
- &:last-child {
4606
- margin-bottom: 14px;
4607
- }
4608
- `;
4609
- w.div`
4610
- display: flex;
4611
- flex-wrap: wrap;
4612
- gap: var(--base-gap-large);
4613
- `;
4614
- const Pn = Ee`
4615
- height: 100px;
4616
- width: 100px;
4617
- object-fit: contain;
4618
- padding: 4px;
4619
- cursor: pointer;
4620
- position: relative;
4621
-
4622
- border-radius: var(--border-radius-m);
4623
- background-color: var(--md-sys-color-surface-container-high);
4624
-
4625
- &:hover {
4626
- background-color: var(--md-sys-color-surface-container-high-hover);
4627
- }
4628
-
4629
- &:active {
4630
- background-color: var(--md-sys-color-surface-container-high-active);
4631
- }
4632
- `;
4633
- w.img`
4634
- ${Pn}
4635
- `;
4636
- w.a`
4637
- ${Pn}
4638
-
4639
- display: flex;
4640
- flex-direction: column;
4641
- align-items: center;
4642
- justify-content: center;
4643
- .icon {
4644
- margin-bottom: 20px;
4645
- font-size: 32px;
4646
- color: var(--md-sys-color-outline);
4647
- }
4648
- `;
4649
- w.span`
4650
- position: absolute;
4651
- bottom: 4px;
4652
- left: 0;
4653
- right: 0;
4654
- text-align: center;
4655
- /* break text */
4656
- overflow-wrap: break-word;
4657
- color: var(--md-sys-color-outline);
4658
- `;
4659
- const Wt = w.pre`
4660
- margin: 0;
4661
- padding: 8px 10px;
4662
- border-radius: var(--border-radius-m);
4663
- background-color: var(--md-sys-color-surface-container-high);
4664
- font-family: monospace;
4665
- /* same size as inline code */
4666
- font-size: 0.9em;
4667
- line-height: 18px;
4668
- tab-size: 2;
4669
-
4670
- line-break: anywhere;
4671
- word-break: break-word;
4672
- white-space: pre-wrap;
4673
- overflow: hidden;
4674
-
4675
- /* Ensure all child elements use monospace font (and not the global span size) */
4676
- * {
4677
- font-family: monospace !important;
4678
- font-size: inherit;
4679
- }
4680
-
4681
- /* syntax highlighting, same colours as the editor */
4682
- ${Tn}
4683
- `, ha = w.code`
4684
- font-family: monospace;
4685
- font-size: 0.9em;
4686
- padding: 1px 4px;
4687
- border-radius: 4px;
4688
- background-color: var(--md-sys-color-surface-container-highest);
4689
- color: var(--md-sys-color-tertiary);
4690
- white-space: pre-wrap;
4691
- word-break: break-word;
4692
- `, gc = w.div`
4693
- display: flex;
4694
- position: absolute;
4695
- right: 4px;
4696
- top: 4px;
4697
- background-color: var(--button-color-secondary);
4698
- border-radius: var(--border-radius-m);
4699
- z-index: 50;
4700
- padding: 2px;
4701
- gap: var(--base-gap-small);
4702
-
4703
- /* by default hidden */
4704
- opacity: 0;
4705
- `, hc = w(te)`
4706
- &.hasIcon {
4707
- padding: 4px;
4708
- }
4709
- background-color: unset;
4710
-
4711
- &:hover {
4712
- background-color: var(--button-color-secondary);
4713
- filter: brightness(1.2);
4714
- }
4715
-
4716
- [icon='edit_square'] {
4717
- position: relative;
4718
- top: -1px;
4719
- }
4720
- `, fc = w.span`
4721
- background-color: var(--md-sys-color-secondary-container);
4722
- display: flex;
4723
- align-items: center;
4724
- gap: var(--base-gap-small);
4725
- border-radius: var(--border-radius-m);
4726
- padding: var(--padding-m);
4727
- margin: 16px 0 !important;
4728
-
4729
- &,
4730
- .icon {
4731
- color: var(--md-sys-color-on-secondary-container);
4732
- }
4733
-
4734
- p {
4735
- margin: 0;
4736
- }
4737
-
4738
- .icon {
4739
- font-size: 24px;
4740
- }
4741
- `, bc = w.div`
4742
- display: flex;
4743
- align-items: center;
4744
- gap: var(--base-gap-small);
4745
- min-width: 0;
4746
- overflow-x: auto;
4747
- padding-bottom: 4px;
4748
- `, yc = w.button`
4749
- display: inline-flex;
4750
- align-items: center;
4751
- gap: var(--base-gap-small);
4752
- flex-shrink: 0;
4753
- white-space: nowrap;
4754
- padding: 2px 6px;
4755
- border: none;
4756
- border-radius: var(--border-radius-m);
4757
- background-color: var(--button-color, var(--md-sys-color-primary));
4758
- color: var(--button-text-color, var(--md-sys-color-on-primary));
4759
- ${Oe.labelMedium}
4760
- font-variant-numeric: tabular-nums;
4761
-
4762
- &:is(button) {
4763
- cursor: pointer;
4764
- }
4765
-
4766
- .icon {
4767
- font-size: 16px;
4768
- color: inherit;
4769
- }
4770
-
4771
- &:is(button):hover:not(:disabled) {
4772
- filter: brightness(1.2);
4773
- }
4774
-
4775
- &:disabled {
4776
- cursor: default;
4777
- }
4778
- `, fa = [
4779
- "user",
4780
- "team",
4781
- "task",
4782
- "folder",
4783
- "version",
4784
- "representation",
4785
- "workfile",
4786
- "product"
4787
- ], ba = (t = "") => {
4788
- if (t.startsWith("https://")) return { url: t, type: "url" };
4789
- if (t.startsWith("/")) return { url: t, type: "relative" };
4790
- if (t.includes(":")) {
4791
- const e = t.split(":"), [n, o] = e;
4792
- if (fa.includes(n) && o && e.length === 2) {
4793
- const r = (() => {
4794
- try {
4795
- return decodeURIComponent(o);
4796
- } catch {
4797
- return o;
4798
- }
4799
- })();
4800
- return { type: n, id: r };
4801
- }
4802
- }
4803
- return {};
4804
- }, ya = (t) => qt.Children.toArray(t).map((e) => typeof e == "string" || typeof e == "number" ? String(e) : "").join(""), vc = ({ children: t, href: e }, {
4805
- entityId: n,
4806
- entityType: o,
4807
- userName: r,
4808
- userTeamNames: i,
4809
- projectName: s,
4810
- onReferenceClick: a,
4811
- activityId: u,
4812
- onReferenceTooltip: d,
4813
- categoryPrimary: v,
4814
- categorySecondary: x,
4815
- onActivityLinkClick: g
4816
- }) => {
4817
- const h = ze(e);
4818
- if (h) {
4819
- if (h.isSource) {
4820
- const C = h.entity ?? (n && o ? { id: n, type: o } : null);
4821
- if (!s || !C) return null;
4822
- const b = pa(s, h.activityId, C);
4823
- return /* @__PURE__ */ l(
4824
- da,
4825
- {
4826
- projectName: s,
4827
- activityId: h.activityId,
4828
- entityId: C.id,
4829
- onClick: () => g ? g({ activityId: h.activityId, projectName: s, url: b }) : window.open(b, "_blank", "noreferrer"),
4830
- categoryPrimary: v,
4831
- categorySecondary: x
4832
- }
4833
- );
4834
- }
4835
- const p = ya(t).trim(), y = !p || /^https?:\/\//.test(p) ? $n : p, k = h;
4836
- return /* @__PURE__ */ l(
4837
- rt,
4838
- {
4839
- type: "activity",
4840
- id: `activity-${h.activityId}`,
4841
- icon: "chat",
4842
- onClick: () => g ? g(k) : window.open(e, "_blank", "noreferrer"),
4843
- categoryPrimary: v,
4844
- categorySecondary: x,
4845
- "data-tooltip": "Go to comment",
4846
- children: y
4847
- }
4848
- );
4849
- }
4850
- const { url: f, type: c, id: m } = ba(e);
4851
- if (!f && !c && !m)
4852
- return t;
4853
- if (f || !c || !m)
4854
- return c === "relative" && f ? /* @__PURE__ */ l(ma, { to: f, children: t }) : /* @__PURE__ */ l("a", { href: f, target: "_blank", rel: "noreferrer", children: t });
4855
- const _ = t && t.toString().replace("@", "") || "", T = m === n || c === "user" && m === r || c === "team" && !!i?.includes(m), E = m.replaceAll(".", "-").replaceAll(" ", "-");
4856
- return /* @__PURE__ */ l(
4857
- rt,
4858
- {
4859
- type: c,
4860
- id: E,
4861
- variant: T ? "filled" : "surface",
4862
- onClick: () => {
4863
- c !== "user" && c !== "team" && a({ entityId: m, entityType: c, projectName: s, activityId: u });
4864
- },
4865
- onMouseEnter: (p, y) => d({ type: c, id: E, label: _, name: m, pos: y }),
4866
- categoryPrimary: v,
4867
- categorySecondary: x,
4868
- "data-mention-value": `${c}:${m}`,
4869
- "data-mention-label": _,
4870
- children: _
4871
- }
4872
- );
4873
- }, xc = ({ type: t, checked: e, ...n }, { activity: o, onCheckChange: r }) => t === "checkbox" ? /* @__PURE__ */ l(
4874
- ca,
4875
- {
4876
- checked: !!e,
4877
- onChange: (i) => r && r(i, o)
4878
- }
4879
- ) : /* @__PURE__ */ l("input", { type: t, disabled: !0, ...n }), kc = ({ node: t, className: e, children: n }) => {
4880
- if (!(!!e?.startsWith("language-") || t?.position && t.position.start.line !== t.position.end.line)) return /* @__PURE__ */ l(ha, { children: n });
4881
- const r = e?.replace(/^language-/, ""), i = typeof n == "string" ? n.replace(/\n$/, "") : null, s = i !== null ? xr(i, r) : null;
4882
- return s !== null ? /* @__PURE__ */ l(Wt, { children: /* @__PURE__ */ l("code", { className: e, dangerouslySetInnerHTML: { __html: s } }) }) : /* @__PURE__ */ l(Wt, { children: n });
4883
- }, wc = ({ children: t }) => {
4884
- const e = qt.Children.toArray(t).find((o) => !!o?.props)?.props?.children;
4885
- if (!e) return /* @__PURE__ */ l("blockquote", { children: t });
4886
- const n = [];
4887
- if (typeof e == "string")
4888
- e.split(`
4889
- `).forEach((r, i) => {
4890
- n.push(/* @__PURE__ */ l(Gt, { children: r }, i));
4891
- });
4892
- else if (Vn(e)) {
4893
- const o = [];
4894
- let r = 0;
4895
- e.forEach((i) => {
4896
- o[r] || (o[r] = []), typeof i == "string" ? i.split(/(\n)/).forEach((a) => {
4897
- a === `
4898
- ` ? (r++, o[r] = []) : o[r].push(a);
4899
- }) : o[r].push(i);
4900
- }), o.forEach((i, s) => {
4901
- n.push(/* @__PURE__ */ l(Gt, { children: i }, s));
4902
- });
4903
- }
4904
- return /* @__PURE__ */ l("blockquote", { children: n });
4905
- }, va = w.span`
4906
- position: absolute;
4907
- top: 3px;
4908
- right: 3px;
4909
- z-index: 20;
4910
- --icon-size: 14px;
4911
- width: var(--icon-size);
4912
- height: var(--icon-size);
4913
- pointer-events: none;
4914
-
4915
- transition: opacity 200ms;
4916
-
4917
- .icon {
4918
- font-variation-settings: 'FILL' 1;
4919
- font-size: var(--icon-size);
4920
- z-index: 20;
4921
- position: relative;
4922
- color: var(--md-sys-color-outline-variant);
4923
- }
4924
-
4925
- &::before {
4926
- content: '';
4927
- position: absolute;
4928
- inset: 2px;
4929
- background: var(--md-sys-color-on-surface);
4930
- z-index: 0;
4931
- border-radius: 100%;
4932
- }
4933
- `, _c = Qt(
4934
- ({ className: t, ...e }, n) => /* @__PURE__ */ l(va, { className: P("playable", t), ...e, ref: n, children: /* @__PURE__ */ l(J, { icon: "play_circle" }) })
4935
- );
4936
- export {
4937
- Ae as $,
4938
- $n as A,
4939
- ae as B,
4940
- ia as C,
4941
- Tr as D,
4942
- be as E,
4943
- Lr as F,
4944
- ye as G,
4945
- Wl as H,
4946
- vt as I,
4947
- ql as J,
4948
- Yl as K,
4949
- aa as L,
4950
- Fr as M,
4951
- Se as N,
4952
- jl as O,
4953
- Ss as P,
4954
- vn as Q,
4955
- Cr as R,
4956
- bt as S,
4957
- Gl as T,
4958
- fr as U,
4959
- Ar as V,
4960
- ci as W,
4961
- ze as X,
4962
- Or as Y,
4963
- j as Z,
4964
- _c as _,
4965
- ra as a,
4966
- fa as a0,
4967
- Zs as a1,
4968
- uc as a2,
4969
- lc as a3,
4970
- dc as a4,
4971
- Vl as a5,
4972
- Jl as a6,
4973
- Xl as a7,
4974
- Zl as a8,
4975
- ac as a9,
4976
- ec as aa,
4977
- ga as ab,
4978
- tc as ac,
4979
- nc as ad,
4980
- rc as ae,
4981
- oc as af,
4982
- ic as ag,
4983
- sc as ah,
4984
- cc as ai,
4985
- rt as aj,
4986
- bc as ak,
4987
- yc as al,
4988
- pa as am,
4989
- mc as an,
4990
- pc as ao,
4991
- gc as ap,
4992
- hc as aq,
4993
- fc as ar,
4994
- vc as as,
4995
- wc as b,
4996
- kc as c,
4997
- Ql as d,
4998
- Kl as e,
4999
- z as f,
5000
- sa as g,
5001
- An as h,
5002
- xc as i,
5003
- De as j,
5004
- pe as k,
5005
- Rt as l,
5006
- Xe as m,
5007
- hn as n,
5008
- Rr as o,
5009
- re as p,
5010
- et as q,
5011
- Ul as r,
5012
- Hl as s,
5013
- oa as t,
5014
- Pe as u,
5015
- Xr as v,
5016
- ht as w,
5017
- Er as x,
5018
- Gs as y,
5019
- ve as z
5020
- };