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