@commentkit/comment-kit 2.0.1 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +14 -6
  3. package/dist/node/cli/api.js +61 -15
  4. package/dist/node/cli/credentials.js +8 -0
  5. package/dist/node/cli/doctor.js +68 -5
  6. package/dist/node/cli/main.js +275 -52
  7. package/dist/node/cli/website.js +140 -0
  8. package/dist/node/types/next.d.ts +4 -4
  9. package/dist/npm/THIRD_PARTY_NOTICES.txt +47 -0
  10. package/dist/npm/chunks/{AgentSend-DOy3jhyF.js → AgentSend-B4rxdY68.js} +3 -3
  11. package/dist/npm/chunks/Checklist-Cy68X5qC.js +269 -0
  12. package/dist/npm/chunks/Composer-D65l6Jg4.js +734 -0
  13. package/dist/npm/chunks/DatePicker-BPzzqW3f.js +161 -0
  14. package/dist/npm/chunks/{Guest-7hcN765o.js → Guest-C-ZhARI0.js} +18 -17
  15. package/dist/npm/chunks/{MarkupEditor-6bJGpWGO.js → MarkupEditor-BOb2jFTR.js} +8 -8
  16. package/dist/npm/chunks/{Panel-ChPUB68C.js → Panel-DgdCgaC-.js} +217 -218
  17. package/dist/npm/chunks/{Settings-CB5eEKnf.js → Settings-BbWu2Rd5.js} +34 -33
  18. package/dist/npm/chunks/{Shortcuts-eAyjJ89P.js → Shortcuts-C5wEx-Mq.js} +25 -23
  19. package/dist/npm/chunks/SignInFirst-BlMbutED.js +36 -0
  20. package/dist/npm/chunks/{StyleEditor-CZTdAA5c.js → StyleEditor-BN2z7mUs.js} +4 -4
  21. package/dist/npm/chunks/{StylePanel-B4pHQUL9.js → StylePanel-BZk-r-kl.js} +3 -3
  22. package/dist/npm/chunks/TaskFields-B2-YvIwV.js +617 -0
  23. package/dist/npm/chunks/ThreadCard-xKy4JbXK.js +1142 -0
  24. package/dist/npm/chunks/{Viewer-DY6zb90M.js → Viewer-DL6M3wAT.js} +9 -8
  25. package/dist/npm/chunks/{agent-MTQHr9ei.js → agent-D1VQvc14.js} +12 -12
  26. package/dist/npm/chunks/{ar-L5cQ-NPe.js → ar-DtfC6tHi.js} +53 -12
  27. package/dist/npm/chunks/{card-bits-CTdrkYn8.js → card-bits-B94SwnS9.js} +12 -10
  28. package/dist/npm/chunks/{client-7eVxvg5j.js → client-CULjcQxz.js} +13 -11
  29. package/dist/npm/chunks/{confetti-BIs5s14P.js → confetti-K_xKxQGa.js} +1 -1
  30. package/dist/npm/chunks/{context-Cf6khm7A.js → context-0MfEgoip.js} +1 -1
  31. package/dist/npm/chunks/{de-D0C-v6tP.js → de-CSyX5Cz-.js} +53 -12
  32. package/dist/npm/chunks/{dpop-0A76OPa9.js → dpop-DpxIN5kL.js} +1 -1
  33. package/dist/npm/chunks/entrance-CO0AzUKy.js +90 -0
  34. package/dist/npm/chunks/{es-Bw4Dj9tN.js → es-D7SAi7fz.js} +53 -12
  35. package/dist/npm/chunks/{extension-DFVOvciD.js → extension-DpfiPOjC.js} +1 -1
  36. package/dist/npm/chunks/{extension-SmoH5AA4.js → extension-faFfCApb.js} +2 -2
  37. package/dist/npm/chunks/{files-4lV9YQIX.js → files-BkHuRlcW.js} +2 -2
  38. package/dist/npm/chunks/{fr-TkuQaIAa.js → fr-CIr2nUyu.js} +53 -12
  39. package/dist/npm/chunks/{hi-DXSH2U8d.js → hi-BTocxOL5.js} +53 -12
  40. package/dist/npm/chunks/{i18n-aVSu9TcJ.js → i18n-CDw_D17c.js} +17 -21
  41. package/dist/npm/chunks/icons-BJLm_C0M.js +141 -0
  42. package/dist/npm/chunks/{identify-BGYh2dVo.js → identify-963WDKul.js} +1 -1
  43. package/dist/npm/chunks/{it-CiWA_bch.js → it-DCExRo0r.js} +53 -12
  44. package/dist/npm/chunks/{ja-C-QmR3yz.js → ja-CgWpTdWi.js} +52 -11
  45. package/dist/npm/chunks/late-words-QnNheaDY.js +59 -0
  46. package/dist/npm/chunks/{live-BExWHzQ7.js → live-BI72WQBA.js} +31 -23
  47. package/dist/npm/chunks/{nl-CEmZRqjX.js → nl-DhTQ8oJ_.js} +53 -12
  48. package/dist/npm/chunks/{page-key-HSY3Lze5.js → page-key-CW8Mtf60.js} +1 -1
  49. package/dist/npm/chunks/{pick-B3sR7jtS.js → pick-BRhngGMq.js} +1 -1
  50. package/dist/npm/chunks/{pkce-CfZhiNBi.js → pkce-BEeLAZhN.js} +1 -1
  51. package/dist/npm/chunks/{pt-BR-b-a8sxO8.js → pt-BR-DrO6LV4n.js} +53 -12
  52. package/dist/npm/chunks/{report-DaVuoRYS.js → report-DAzQvgUh.js} +1 -1
  53. package/dist/npm/chunks/{show-BoN8AC-F.js → show-Ka3g4eCJ.js} +7 -7
  54. package/dist/npm/chunks/signin-Car5vP1U.js +101 -0
  55. package/dist/npm/chunks/{source-mk3rGBBQ.js → source-dd_it90W.js} +1 -1
  56. package/dist/npm/chunks/{src-C8rZFyL_.js → src-fTYV50pw.js} +21 -15
  57. package/dist/npm/chunks/start-CE5eR33Z.js +1916 -0
  58. package/dist/npm/chunks/states-DLMCvwes.js +3 -0
  59. package/dist/npm/chunks/{upload-B2mkgMeJ.js → upload-Dcv9CCly.js} +1 -1
  60. package/dist/npm/chunks/uploads-CmeoNVO2.js +1236 -0
  61. package/dist/npm/chunks/{wrap-DW6EFbVQ.js → wrap-B0mzrRhc.js} +27 -27
  62. package/dist/npm/chunks/{zh-CN-JTscW8u8.js → zh-CN-Bb8UzT1V.js} +53 -12
  63. package/dist/npm/element.js +7 -1
  64. package/dist/npm/headless.js +2 -2
  65. package/dist/npm/index.js +2 -2
  66. package/dist/npm/react.js +1 -1
  67. package/dist/npm/svelte.js +1 -1
  68. package/dist/npm/types/adapters/vue.d.ts +12 -0
  69. package/dist/npm/types/core/auth.d.ts +1 -0
  70. package/dist/npm/types/core/client.d.ts +5 -1
  71. package/dist/npm/types/core/types.d.ts +17 -2
  72. package/dist/npm/vue.js +5 -1
  73. package/package.json +2 -1
  74. package/dist/npm/chunks/Checklist-CW_SwMpS.js +0 -282
  75. package/dist/npm/chunks/Composer-Bveq5QrK.js +0 -727
  76. package/dist/npm/chunks/TaskFields-C8BX0Sgg.js +0 -289
  77. package/dist/npm/chunks/ThreadCard-B1EsX3PR.js +0 -1160
  78. package/dist/npm/chunks/late-words-80_VWt8S.js +0 -14
  79. package/dist/npm/chunks/signin-BOWr_WCo.js +0 -75
  80. package/dist/npm/chunks/start-CV4j78_q.js +0 -1894
  81. package/dist/npm/chunks/states-b9Bv3Ci7.js +0 -3
  82. package/dist/npm/chunks/uploads-8AxyRq7g.js +0 -1147
@@ -0,0 +1,1142 @@
1
+ import { n as e } from "./src-fTYV50pw.js";
2
+ import { b as t, v as n } from "./client-CULjcQxz.js";
3
+ import { s as r } from "./anchor-BsQNVkHj.js";
4
+ import { _ as i, a, b as o, c as s, d as c, f as l, i as u, m as d, o as f, u as p, v as m } from "./i18n-CDw_D17c.js";
5
+ import { r as h } from "./agent-D1VQvc14.js";
6
+ import { n as g } from "./icons-BJLm_C0M.js";
7
+ import { a as _, c as v, f as ee, g as te, h as y, i as b, l as ne, m as re, n as ie, t as ae, u as oe } from "./uploads-CmeoNVO2.js";
8
+ import { a as x, r as se } from "./files-BkHuRlcW.js";
9
+ import { i as ce, n as le, r as ue, t as de } from "./card-bits-B94SwnS9.js";
10
+ import { n as fe } from "./drafts-B0ctr1g9.js";
11
+ import { t as pe } from "./states-DLMCvwes.js";
12
+ import { n as me, r as S, t as he } from "./context-0MfEgoip.js";
13
+ import { r as ge, t as _e } from "./Checklist-Cy68X5qC.js";
14
+ import { StatusField as ve, TaskFields as ye } from "./TaskFields-B2-YvIwV.js";
15
+ import { C as be, F as C, I as xe, N as Se, P as w, S as Ce, T, _ as we, b as Te, c as E, g as Ee, j as De, k as D, r as Oe, s as ke, w as Ae, x as je, y as Me } from "./start-CE5eR33Z.js";
16
+ // src/ui/Reactions.tsx
17
+ var O = x.slice(0, 6);
18
+ function k(e) {
19
+ if (!e) return;
20
+ Se(e), e.querySelector("button")?.focus({ preventScroll: !0 });
21
+ let t = e.closest(".ck-card-body")?.getBoundingClientRect();
22
+ t && e.getBoundingClientRect().top < t.top && (e.dataset.below = ""), e.scrollIntoView({ block: "nearest" });
23
+ }
24
+ function A({ reactions: e = [], canWrite: t, picker: n = !0, onReact: r }) {
25
+ let [o, c] = i(!1), l = d(null), u = () => {
26
+ c(!1), (l.current?.firstElementChild)?.focus();
27
+ };
28
+ return Ce(o, l, () => c(!1)), !e.length && !t ? null : /* @__PURE__ */ p("div", {
29
+ class: "ck-reactions",
30
+ children: [
31
+ e.map((e) => {
32
+ let t = `${a("reactionLabel", e.count, { emoji: e.emoji })}${e.mine ? `, ${s("youReacted")}` : ""}`;
33
+ return /* @__PURE__ */ p("button", {
34
+ class: "ck-reaction",
35
+ "aria-pressed": e.mine,
36
+ "aria-label": t,
37
+ title: t,
38
+ onClick: () => r(e.emoji),
39
+ children: [/* @__PURE__ */ p(T, { char: e.emoji }), /* @__PURE__ */ p("span", { children: e.count })]
40
+ });
41
+ }),
42
+ t && O.filter((t) => !e.some((e) => e.emoji === t)).slice(0, 3).map((e) => /* @__PURE__ */ p("button", {
43
+ class: "ck-reaction ck-reaction-add",
44
+ "aria-label": s("reactWith", { emoji: e }),
45
+ title: s("reactWith", { emoji: e }),
46
+ onClick: () => r(e),
47
+ children: /* @__PURE__ */ p(T, { char: e })
48
+ })),
49
+ t && n ? /* @__PURE__ */ p("span", {
50
+ class: "ck-picker-wrap",
51
+ ref: l,
52
+ children: [/* @__PURE__ */ p("button", {
53
+ class: "ck-icon ck-icon-sm ck-reaction-more",
54
+ "aria-label": s("addReaction"),
55
+ "aria-haspopup": "true",
56
+ "aria-expanded": o,
57
+ onClick: () => c(!o),
58
+ children: /* @__PURE__ */ p(g, {
59
+ name: "smilePlus",
60
+ size: 14
61
+ })
62
+ }), o ? /* @__PURE__ */ p("div", {
63
+ class: "ck-picker ck-pop",
64
+ role: "group",
65
+ "aria-label": s("moreReactions"),
66
+ ref: k,
67
+ onKeyDown: (e) => {
68
+ e.key === "Escape" ? (e.stopPropagation(), u()) : Me(e, "button", !1);
69
+ },
70
+ children: x.map((t) => /* @__PURE__ */ p("button", {
71
+ "aria-pressed": e.some((e) => e.emoji === t && e.mine),
72
+ "aria-label": s("reactWith", { emoji: t }),
73
+ onClick: () => (u(), r(t)),
74
+ children: /* @__PURE__ */ p(T, { char: t })
75
+ }))
76
+ }) : null]
77
+ }) : null
78
+ ]
79
+ });
80
+ }
81
+ // src/ui/ThreadMessage.tsx
82
+ function Ne(e) {
83
+ let { client: t, message: n, first: r, mine: i, edit: a, canWrite: c, simple: l } = e, d = (e) => {
84
+ let t = e.currentTarget.getRootNode().getElementById(`ck-msg-${n.reply_to.id}`);
85
+ t?.scrollIntoView({
86
+ block: "center",
87
+ behavior: Pe() ? "auto" : "smooth"
88
+ }), t?.focus({ preventScroll: !0 });
89
+ }, m = i && !r, h = a ? null : /* @__PURE__ */ p("span", {
90
+ class: "ck-msg-actions",
91
+ children: [
92
+ l ? null : /* @__PURE__ */ p(o, { children: [c ? /* @__PURE__ */ p("button", {
93
+ class: "ck-icon ck-icon-sm",
94
+ "aria-label": s("replyTo", { name: n.author.name }),
95
+ "data-tip": s("quoteReply"),
96
+ onClick: e.onQuote,
97
+ children: /* @__PURE__ */ p(g, {
98
+ name: "reply",
99
+ size: 14
100
+ })
101
+ }) : null, /* @__PURE__ */ p("button", {
102
+ class: "ck-icon ck-icon-sm",
103
+ "aria-label": s("copyText"),
104
+ onClick: e.onCopy,
105
+ children: /* @__PURE__ */ p(g, {
106
+ name: "copy",
107
+ size: 14
108
+ })
109
+ })] }),
110
+ c && i ? /* @__PURE__ */ p("button", {
111
+ class: "ck-ghost ck-ghost-sm",
112
+ onClick: e.onEdit,
113
+ children: s("edit")
114
+ }) : null,
115
+ e.canDelete ? /* @__PURE__ */ p("button", {
116
+ class: "ck-ghost ck-ghost-sm ck-danger",
117
+ onClick: e.onDelete,
118
+ children: s("delete")
119
+ }) : null
120
+ ]
121
+ });
122
+ return /* @__PURE__ */ p("div", {
123
+ class: "ck-msg",
124
+ id: `ck-msg-${n.id}`,
125
+ tabIndex: -1,
126
+ "data-mine": i || void 0,
127
+ "data-reply": !r || void 0,
128
+ "data-new": e.fresh || void 0,
129
+ children: [/* @__PURE__ */ p(Ae, { person: n.author }), /* @__PURE__ */ p("div", {
130
+ class: "ck-msg-main",
131
+ children: [
132
+ /* @__PURE__ */ p("div", {
133
+ class: "ck-msg-meta",
134
+ children: [
135
+ m ? h : null,
136
+ /* @__PURE__ */ p("bdi", {
137
+ class: "ck-msg-name",
138
+ children: n.author.name
139
+ }),
140
+ /* @__PURE__ */ p("time", {
141
+ dateTime: n.created_at,
142
+ title: u(n.created_at),
143
+ children: f(n.created_at)
144
+ }),
145
+ n.edited_at ? /* @__PURE__ */ p("span", {
146
+ title: u(n.edited_at),
147
+ children: ["· ", s("edited")]
148
+ }) : null,
149
+ n.visibility === "team" ? /* @__PURE__ */ p("span", {
150
+ class: "ck-team-only",
151
+ children: s("teamOnly")
152
+ }) : null,
153
+ m ? null : h
154
+ ]
155
+ }),
156
+ n.reply_to ? /* @__PURE__ */ p("button", {
157
+ class: "ck-quote ck-quote-msg",
158
+ onClick: d,
159
+ children: [
160
+ /* @__PURE__ */ p("strong", { children: /* @__PURE__ */ p("bdi", { children: n.reply_to.author.name }) }),
161
+ " ",
162
+ /* @__PURE__ */ p("bdi", { children: n.reply_to.excerpt })
163
+ ]
164
+ }) : null,
165
+ a ? /* @__PURE__ */ p("div", {
166
+ class: "ck-msg-edit",
167
+ children: [/* @__PURE__ */ p("div", {
168
+ onKeyDown: (e) => {
169
+ e.key === "Escape" && (e.stopPropagation(), a.onCancel());
170
+ },
171
+ children: /* @__PURE__ */ p(ne, {
172
+ client: t,
173
+ value: a.body,
174
+ onChange: a.onChange,
175
+ onMentions: () => void 0,
176
+ onSubmit: a.onSave,
177
+ placeholder: s("edit"),
178
+ autofocus: !0,
179
+ disabled: a.busy,
180
+ canMention: !0
181
+ })
182
+ }), /* @__PURE__ */ p("div", {
183
+ class: "ck-actions",
184
+ children: [/* @__PURE__ */ p("button", {
185
+ class: "ck-btn",
186
+ onClick: a.onCancel,
187
+ children: s("cancel")
188
+ }), /* @__PURE__ */ p("button", {
189
+ class: "ck-btn ck-primary",
190
+ "aria-disabled": a.busy || !a.body.trim() || void 0,
191
+ onClick: () => a.body.trim() && a.onSave(),
192
+ children: a.busy ? s("saving") : s("save")
193
+ })]
194
+ })]
195
+ }) : /* @__PURE__ */ p(o, { children: [/* @__PURE__ */ p("div", {
196
+ class: "ck-msg-body",
197
+ dir: "auto",
198
+ children: /* @__PURE__ */ p(D, {
199
+ text: n.body,
200
+ people: e.people
201
+ })
202
+ }), /* @__PURE__ */ p(M, {
203
+ client: t,
204
+ text: n.body,
205
+ onLoad: e.onImageLoad
206
+ })] }),
207
+ /* @__PURE__ */ p(Fe, {
208
+ files: n.attachments ?? [],
209
+ shot: r ? e.shot : null,
210
+ onView: e.onView,
211
+ onLoad: e.onImageLoad
212
+ }),
213
+ /* @__PURE__ */ p(A, {
214
+ reactions: n.reactions,
215
+ canWrite: c,
216
+ picker: !l,
217
+ onReact: e.onReact
218
+ }),
219
+ e.alone ? /* @__PURE__ */ p("p", {
220
+ class: "ck-muted ck-no-replies",
221
+ children: s("noReplies")
222
+ }) : null
223
+ ]
224
+ })]
225
+ });
226
+ }
227
+ function Pe() {
228
+ return matchMedia("(prefers-reduced-motion: reduce)").matches;
229
+ }
230
+ function j(e) {
231
+ return e.mime.startsWith("image/") && !!(C(e.url, "image") || C(e.thumbnail_url, "image"));
232
+ }
233
+ function Fe({ files: e, shot: t, onView: n, onLoad: r }) {
234
+ let i = e.filter((e) => e.kind !== "screenshot"), a = i.filter(j), c = [...t ? [{
235
+ src: t.src,
236
+ name: t.name,
237
+ href: t.href
238
+ }] : [], ...a.map((e) => ({
239
+ src: C(e.url, "image") ?? C(e.thumbnail_url, "image"),
240
+ name: e.name,
241
+ href: C(e.url)
242
+ }))], l = [...t ? [t.thumb] : [], ...a.map((e) => C(e.thumbnail_url, "image") ?? C(e.url, "image"))], u = i.filter((e) => !j(e));
243
+ return /* @__PURE__ */ p(o, { children: [l.length === 1 ? /* @__PURE__ */ p("button", {
244
+ class: "ck-shot",
245
+ "aria-label": s("openImage", { name: c[0].name }),
246
+ onClick: () => n(c, 0),
247
+ children: /* @__PURE__ */ p("img", {
248
+ src: l[0],
249
+ alt: c[0].name,
250
+ loading: "lazy",
251
+ onLoad: r
252
+ })
253
+ }) : l.length ? /* @__PURE__ */ p("div", {
254
+ class: "ck-grid",
255
+ "data-count": Math.min(l.length, 4),
256
+ children: l.slice(0, 4).map((e, t) => /* @__PURE__ */ p("button", {
257
+ class: "ck-grid-item",
258
+ "aria-label": t === 3 && l.length > 4 ? s("openImageMore", {
259
+ name: c[t].name,
260
+ n: l.length - 4
261
+ }) : s("openImage", { name: c[t].name }),
262
+ onClick: () => n(c, t),
263
+ children: [/* @__PURE__ */ p("img", {
264
+ src: e,
265
+ alt: c[t].name,
266
+ loading: "lazy",
267
+ onLoad: r
268
+ }), t === 3 && l.length > 4 ? /* @__PURE__ */ p("span", {
269
+ class: "ck-grid-more",
270
+ "aria-hidden": "true",
271
+ children: ["+", l.length - 4]
272
+ }) : null]
273
+ }))
274
+ }) : null, u.length ? /* @__PURE__ */ p("div", {
275
+ class: "ck-files",
276
+ children: u.map((e) => {
277
+ let t = C(e.url);
278
+ return t ? /* @__PURE__ */ p("a", {
279
+ class: "ck-file",
280
+ href: t,
281
+ target: "_blank",
282
+ rel: "noopener noreferrer",
283
+ children: /* @__PURE__ */ p("bdi", { children: e.name })
284
+ }) : /* @__PURE__ */ p("span", {
285
+ class: "ck-file",
286
+ children: /* @__PURE__ */ p("bdi", { children: e.name })
287
+ });
288
+ })
289
+ }) : null] });
290
+ }
291
+ function M({ client: e, text: t, onLoad: n }) {
292
+ let r = m(() => [...new Set([...t.matchAll(/https?:\/\/[^\s<>"')​-‏‪-‮⁠-⁩]+/g)].map((e) => C(e[0])).filter((e) => !!e))].slice(0, 2), [t]), [a, o] = i([]);
293
+ return c(() => {
294
+ let t = !0;
295
+ return o([]), r.length && Promise.all(r.map((t) => e.linkPreview(t))).then((e) => t && o(e.filter((e) => !!e))), () => {
296
+ t = !1;
297
+ };
298
+ }, [r.join(" ")]), c(() => void (a.length && n()), [a]), a.length ? /* @__PURE__ */ p("div", {
299
+ class: "ck-previews",
300
+ children: a.map((e) => {
301
+ let t = C(e.url);
302
+ return t ? /* @__PURE__ */ p("a", {
303
+ class: "ck-preview",
304
+ href: t,
305
+ target: "_blank",
306
+ rel: "noopener noreferrer nofollow ugc",
307
+ children: [
308
+ /* @__PURE__ */ p("span", {
309
+ class: "ck-preview-site",
310
+ children: /* @__PURE__ */ p("bdi", { children: e.site })
311
+ }),
312
+ /* @__PURE__ */ p("strong", {
313
+ title: e.title,
314
+ children: /* @__PURE__ */ p("bdi", { children: e.title })
315
+ }),
316
+ e.description ? /* @__PURE__ */ p("span", {
317
+ class: "ck-preview-text",
318
+ children: /* @__PURE__ */ p("bdi", { children: e.description })
319
+ }) : null
320
+ ]
321
+ }) : null;
322
+ })
323
+ }) : null;
324
+ }
325
+ var N = 24, Ie = 10, Le = 4e3;
326
+ function Re(e, t, n) {
327
+ let [r, a] = i(""), o = d(n);
328
+ return o.current = n, c(() => {
329
+ if (!t) return;
330
+ let n = null, r = !1, i = null, c = -1e9, l, u = () => (clearTimeout(l), a("")), d = (t) => t.composedPath().some((t) => t === e.current || t instanceof Element && t.hasAttribute("data-commentkit-host")), f = (t) => {
331
+ if (n = null, d(t)) return void (i = null, u());
332
+ t.isPrimary && t.button === 0 && (n = t, r = !!(e.current?.getRootNode())?.querySelector?.(".ck-pop"));
333
+ }, p = (t) => {
334
+ let d = n;
335
+ if (n = null, !d || t.pointerId !== d.pointerId) return;
336
+ if (r) return void (i = null);
337
+ if (Math.hypot(t.clientX - d.clientX, t.clientY - d.clientY) > Ie) return;
338
+ let f = Date.now();
339
+ if (i && f - i.at <= 500 && Math.hypot(t.clientX - i.x, t.clientY - i.y) <= N) return i = null, u(), o.current();
340
+ i = {
341
+ x: t.clientX,
342
+ y: t.clientY,
343
+ at: f
344
+ }, P(e.current), !(f - c < 6e3) && (c = f, a(s(t.pointerType === "mouse" ? "closeCardHint" : "closeCardHintTouch")), clearTimeout(l), l = setTimeout(u, Le));
345
+ }, m = () => n = null;
346
+ return addEventListener("pointerdown", f, !0), addEventListener("pointerup", p, !0), addEventListener("pointercancel", m, !0), addEventListener("keydown", u, !0), () => {
347
+ clearTimeout(l), removeEventListener("pointerdown", f, !0), removeEventListener("pointerup", p, !0), removeEventListener("pointercancel", m, !0), removeEventListener("keydown", u, !0);
348
+ };
349
+ }, [t]), t ? r : "";
350
+ }
351
+ function P(e) {
352
+ e && !Pe() && (e.removeAttribute("data-nudge"), e.offsetWidth, e.setAttribute("data-nudge", ""));
353
+ }
354
+ // src/ui/StyleChanges.tsx
355
+ function ze({ thread: e, element: t, editable: n, onChange: r }, a) {
356
+ let { reportError: o } = S(a), c = m(() => _(e.style_changes), [e.style_changes]), [u, f] = i(!1), [h, g] = i(!1), ee = Te(h, () => import("./StyleEditor-BN2z7mUs.js").then((e) => e.StyleEditor), o), te = d(null), y = t instanceof HTMLElement || t instanceof SVGElement ? t : null;
357
+ return l(() => {
358
+ if (!u || !y) return;
359
+ let e = te.current = new b(y);
360
+ return e.apply(c), () => e.revert();
361
+ }, [
362
+ u,
363
+ y,
364
+ c
365
+ ]), h && y && ee ? /* @__PURE__ */ p(ee, {
366
+ thread: e,
367
+ element: y,
368
+ onSaved: (e) => r?.(e),
369
+ onClose: () => g(!1)
370
+ }) : c.length ? /* @__PURE__ */ p("section", {
371
+ class: "ck-style-card",
372
+ "aria-label": s("styleSuggested"),
373
+ children: [/* @__PURE__ */ p("div", {
374
+ class: "ck-style-card-head",
375
+ children: [/* @__PURE__ */ p("span", { children: s("styleSuggested") }), y ? /* @__PURE__ */ p("span", {
376
+ class: "ck-style-card-actions",
377
+ children: [n ? /* @__PURE__ */ p("button", {
378
+ class: "ck-ghost ck-ghost-sm",
379
+ "aria-label": s("styleEdit"),
380
+ onClick: () => {
381
+ te.current?.revert(), f(!1), g(!0);
382
+ },
383
+ children: s("edit")
384
+ }) : null, /* @__PURE__ */ p("button", {
385
+ class: "ck-chip",
386
+ "aria-pressed": u,
387
+ onClick: () => f(!u),
388
+ children: s("stylePreview")
389
+ })]
390
+ }) : null]
391
+ }), /* @__PURE__ */ p("ul", { children: c.map((e) => /* @__PURE__ */ p("li", { children: /* @__PURE__ */ p("code", { children: v(e) }) })) })]
392
+ }) : null;
393
+ }
394
+ // src/ui/ThreadContext.tsx
395
+ function Be({ thread: e, anchor: t, branch: n }) {
396
+ return /* @__PURE__ */ p(o, { children: [
397
+ t === "detached" ? /* @__PURE__ */ p("div", {
398
+ class: "ck-note",
399
+ "data-tone": "warning",
400
+ children: s("detached")
401
+ }) : null,
402
+ t === "moved" ? /* @__PURE__ */ p("p", {
403
+ class: "ck-muted",
404
+ children: s("moved")
405
+ }) : null,
406
+ w(e) ? /* @__PURE__ */ p("p", {
407
+ class: "ck-muted",
408
+ title: `${e.breakpoint}px`,
409
+ children: s(`screen_${xe(e.breakpoint)}`)
410
+ }) : null,
411
+ e.page.branch && n ? /* @__PURE__ */ p("p", {
412
+ class: "ck-muted ck-build",
413
+ children: s("leftOnBranch", {
414
+ branch: e.page.branch,
415
+ commit: e.page.commit_sha ? ` @ ${e.page.commit_sha.slice(0, 7)}` : ""
416
+ })
417
+ }) : null,
418
+ e.anchor.quote ? /* @__PURE__ */ p("blockquote", {
419
+ class: "ck-quote",
420
+ "aria-label": s("quotedText"),
421
+ children: /* @__PURE__ */ p("bdi", { children: e.anchor.quote })
422
+ }) : null,
423
+ e.description?.trim() ? /* @__PURE__ */ p("details", {
424
+ class: "ck-description",
425
+ open: e.description.length <= 280,
426
+ children: [/* @__PURE__ */ p("summary", { children: s("description") }), /* @__PURE__ */ p("p", { children: /* @__PURE__ */ p("bdi", { children: e.description }) })]
427
+ }) : null
428
+ ] });
429
+ }
430
+ function Ve({ thread: e }) {
431
+ let [t, n] = i(!1), r = C(e.page.url), a = e.capture?.device, o = e.capture?.viewport, c = [[s("detailCreated"), /* @__PURE__ */ p("time", {
432
+ dateTime: e.created_at,
433
+ children: u(e.created_at)
434
+ })]];
435
+ if (e.resolved_at && e.status === "resolved" && c.push([s("detailResolved"), /* @__PURE__ */ p("time", {
436
+ dateTime: e.resolved_at,
437
+ children: u(e.resolved_at)
438
+ })]), r && c.push([s("detailPage"), /* @__PURE__ */ p("a", {
439
+ href: r,
440
+ target: "_blank",
441
+ rel: "noopener noreferrer",
442
+ children: /* @__PURE__ */ p("bdi", { children: e.page.title || e.page.path })
443
+ })]), a?.browser || a?.os) {
444
+ let e = a.browser && `${a.browser}${a.browser_version ? ` ${a.browser_version.split(".")[0]}` : ""}`, t = a.os && `${a.os}${a.os_version ? ` ${a.os_version}` : ""}`;
445
+ c.push([s("detailBrowser"), /* @__PURE__ */ p("bdi", { children: [e, t].filter(Boolean).join(" · ") })]);
446
+ }
447
+ return o?.width && c.push([s("detailWindow"), /* @__PURE__ */ p("bdi", {
448
+ dir: "ltr",
449
+ children: `${o.width} × ${o.height}`
450
+ })]), /* @__PURE__ */ p("div", {
451
+ class: "ck-details",
452
+ children: [/* @__PURE__ */ p("button", {
453
+ class: "ck-details-toggle",
454
+ "aria-expanded": t,
455
+ "aria-controls": t ? "ck-details" : void 0,
456
+ onClick: () => n(!t),
457
+ children: [/* @__PURE__ */ p(g, {
458
+ name: "chevronRight",
459
+ size: 14
460
+ }), s("details")]
461
+ }), t ? /* @__PURE__ */ p("dl", {
462
+ id: "ck-details",
463
+ children: c.map(([e, t]) => /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ p("dt", { children: e }), /* @__PURE__ */ p("dd", { children: t })] }))
464
+ }) : null]
465
+ });
466
+ }
467
+ E(pe), E(".ck-msg-actions .ck-ghost{place-items:center;min-width:24px;display:inline-grid}.ck-msg-body .ck-pre code{box-shadow:none;font-size:var(--ck-fs-sm);background:0 0;padding:0;line-height:1.55}.ck-reaction .ck-emoji{vertical-align:-2px;width:14px;height:14px}.ck-msg-skeleton .ck-skeleton:not(.ck-skeleton-avatar){margin:4px 0 12px}.ck-msg-skeleton .ck-skeleton:first-child{width:34%}.ck-msg-skeleton .ck-skeleton:nth-child(2){width:92%}.ck-msg-skeleton .ck-skeleton:nth-child(3){width:64%}.ck-thread-head{position:relative}.ck-thread-head .ck-card-title:focus-visible{outline:none}.ck-thread-head .ck-menu{right:auto}.ck-thread-head .ck-menu:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:8px}.ck-thread-head .ck-menu:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:8px}.ck-thread-head .ck-menu:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:8px}.ck-thread-head .ck-menu:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:8px}.ck-more{display:contents}.ck-thread-head .ck-ghost[aria-expanded=true]{background:var(--ck-bg-hover);color:var(--ck-text)}.ck-card-hint{z-index:3;border-radius:var(--ck-radius-md);background:var(--ck-text);width:max-content;max-width:calc(100% - 32px);color:var(--ck-bg);font-size:var(--ck-fs-sm);text-align:center;pointer-events:none;font-weight:500;line-height:1.4;position:absolute;top:56px;left:50%;translate:-50%}.ck-card-hint:not(:empty){box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) var(--ck-ease);border:1px solid #0000;padding:5px 11px}.ck-card[data-nudge]{animation:ck-nudge .3s var(--ck-ease)}@keyframes ck-nudge{20%{translate:-6px}45%{translate:5px}70%{translate:-3px}90%{translate:1px}}@media (prefers-reduced-motion:reduce){.ck-card[data-nudge],.ck-card-hint{animation:none}}.ck-reply-foot{flex-direction:column;align-items:stretch;position:relative}.ck-reply-foot .ck-actions,.ck-reply-foot .ck-note{margin-top:0}.ck-reply-foot .ck-foot-actions{gap:8px;margin-top:0}.ck-btn>.ck-i{margin-inline-start:-2px}.ck-extras{gap:8px;margin-block-start:4px;margin-block-end:8px;margin-inline-start:32px;display:grid}.ck-extras:empty{display:none}.ck-extras>*{margin:0}.ck-card-body>.ck-note:first-child{margin:0 0 8px}.ck-card-embedded{width:auto;height:100%;max-height:none;box-shadow:none;animation:ck-slide-in var(--ck-dur) var(--ck-ease);border:0;border-radius:0;flex-direction:column;display:flex;position:static;top:auto;bottom:auto;left:auto;right:auto}.ck-card-embedded .ck-card-body{flex:1;min-height:0}.ck-back svg{scale:-1 1}.ck-root[dir=rtl] .ck-back svg{scale:1}.ck-step svg{rotate:-90deg}.ck-step[data-dir=next] svg{rotate:90deg}.ck-card-pos{font-size:var(--ck-fs-sm);font-variant-numeric:tabular-nums;white-space:nowrap}.ck-thread-head .ck-card-title{min-width:4.5em}@media (max-width:520px){.ck-thread-head .ck-card-pos{display:none}}@keyframes ck-slide-in{0%{opacity:0;translate:24px}}.ck-root[dir=rtl] .ck-card-embedded{animation-name:ck-slide-in-rtl}@keyframes ck-slide-in-rtl{0%{opacity:0;translate:-24px}}.ck-thread-skeleton{gap:12px;display:grid}.ck-skeleton-meta{width:40%;height:10px}.ck-msg-skeleton{gap:8px;display:flex}.ck-msg-skeleton>div{flex:1}.ck-msg-skeleton .ck-skeleton.ck-skeleton-avatar{border-radius:50%;flex:none;width:24px;height:24px;margin:0;display:block}.ck-thread-skeleton .ck-msg-skeleton:nth-child(3){opacity:.7}.ck-thread-skeleton .ck-msg-skeleton:nth-child(4){opacity:.45}.ck-build{overflow-wrap:anywhere}.ck-description{border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);font-size:var(--ck-fs-md);margin:0 0 8px;padding:8px 12px}.ck-description summary{cursor:pointer;color:var(--ck-text-muted);font-size:var(--ck-fs-sm);border-radius:var(--ck-radius-sm);font-weight:600}.ck-description p{white-space:pre-wrap;overflow-wrap:anywhere;text-wrap:pretty;max-height:240px;margin:4px 0 0;overflow:auto}.ck-details{font-size:var(--ck-fs-sm);margin:0 0 8px}.ck-details-toggle{min-height:24px;color:var(--ck-text-muted);font-size:var(--ck-fs-sm);border-radius:var(--ck-radius-sm);transition:color var(--ck-fast);background:0 0;border:0;align-items:center;gap:4px;margin-inline-start:-4px;padding:0 4px;font-weight:600;display:inline-flex}.ck-details-toggle svg{transition:rotate var(--ck-dur) var(--ck-ease)}.ck-root[dir=rtl] .ck-details-toggle svg{scale:-1 1}.ck-details-toggle[aria-expanded=true] svg{rotate:90deg}.ck-details dl{border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);grid-template-columns:max-content minmax(0,1fr);gap:4px 12px;margin:4px 0 0;padding:8px 12px;display:grid}.ck-details dl>div{display:contents}.ck-details dt{color:var(--ck-text-muted)}.ck-details dd{overflow-wrap:anywhere;font-variant-numeric:tabular-nums;min-width:0;margin:0}.ck-details a{color:inherit;text-underline-offset:2px}.ck-review-ask{border-radius:var(--ck-radius-md);background:var(--ck-bg-muted);background:color-mix(in srgb, var(--ck-review) 14%, var(--ck-bg));box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--ck-review) 30%, transparent);text-wrap:pretty;margin-bottom:12px;padding:12px}.ck-review-ask .ck-actions{margin-top:8px}.ck-extra{gap:8px;display:grid}.ck-checklist-head{font-size:var(--ck-fs-sm);font-variant-numeric:tabular-nums;justify-content:space-between;align-items:center;gap:8px;display:flex}.ck-checklist-title{color:var(--ck-text-muted);font-weight:600}.ck-checklist-bar{border-radius:var(--ck-radius-pill);background:var(--ck-border);height:4px;margin-top:4px;display:block;overflow:hidden}.ck-checklist-bar>span{background:var(--ck-success);transform-origin:0;height:100%;transition:scale var(--ck-dur) var(--ck-ease);display:block}.ck-root[dir=rtl] .ck-checklist-bar>span{transform-origin:100%}.ck-checklist ul{gap:0;margin:4px 0 0;padding:0;list-style:none;display:grid}.ck-checklist li{align-items:flex-start;gap:4px;min-height:28px;display:flex}.ck-checklist li .ck-check{min-width:0;font-size:var(--ck-fs-md);overflow-wrap:anywhere;flex:1;margin:0;padding:4px 0}.ck-checklist li .ck-check:has(input:disabled){cursor:default}.ck-checklist li[data-done] bdi{color:var(--ck-text-muted);text-decoration:line-through}.ck-checklist li .ck-icon{opacity:0;transition:opacity var(--ck-fast), background-color var(--ck-fast), color var(--ck-fast)}.ck-checklist li:hover .ck-icon,.ck-checklist li:focus-within .ck-icon{opacity:1}.ck-checklist-add{align-items:center;gap:4px;display:flex}.ck-checklist-add .ck-input{min-width:0;height:32px;font-size:var(--ck-fs-md);flex:1}.ck-msg{gap:8px;padding:4px 0;display:flex}.ck-msg+.ck-msg{border-top:1px solid var(--ck-hairline);padding-top:12px}.ck-msg+.ck-msg[data-reply]{border-top:0;padding-top:8px}.ck-msg-main{flex:1;min-width:0}.ck-msg-meta{font-size:var(--ck-fs-sm);color:var(--ck-text-muted);flex-wrap:wrap;align-items:baseline;gap:4px 8px;display:flex}.ck-msg-meta .ck-msg-name{overflow-wrap:anywhere;min-width:0}.ck-msg-meta time{cursor:default;font-variant-numeric:tabular-nums}.ck-team-only{border-radius:var(--ck-radius-pill);background:color-mix(in srgb, var(--ck-accent) 12%, transparent);color:var(--ck-text);font-size:var(--ck-fs-2xs);padding:0 6px;font-weight:600}.ck-msg-actions{opacity:0;transition:opacity var(--ck-fast);gap:4px;margin-inline-start:auto;display:inline-flex}.ck-msg:hover .ck-msg-actions,.ck-msg:focus-within .ck-msg-actions{opacity:1}.ck-msg-body{white-space:pre-wrap;overflow-wrap:anywhere;text-wrap:pretty;margin-top:2px;line-height:1.5}.ck-msg-body a{color:var(--ck-accent-text);text-underline-offset:2px}.ck-msg-body code{font-family:var(--ck-mono);font-size:var(--ck-fs-sm);border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);box-shadow:0 0 0 1px var(--ck-hairline);padding:0 4px}.ck-msg-body s{color:var(--ck-text-muted)}.ck-msg[data-reply] .ck-msg-body{border-radius:var(--ck-radius);background:var(--ck-bg-muted);max-width:100%;padding:4px 12px;display:inline-block}.ck-msg[data-reply] .ck-msg-body:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--ck-radius-sm)}.ck-msg[data-reply] .ck-msg-body:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--ck-radius-sm)}.ck-msg[data-reply] .ck-msg-body:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ck-radius-sm)}.ck-msg[data-reply] .ck-msg-body:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ck-radius-sm)}.ck-msg[data-reply] .ck-msg-body code{background:var(--ck-bg)}.ck-msg[data-reply][data-mine]{flex-direction:row-reverse}.ck-msg[data-reply][data-mine] .ck-msg-main{flex-direction:column;align-items:flex-end;display:flex}.ck-msg[data-reply][data-mine] .ck-msg-meta{justify-content:flex-end}.ck-msg[data-reply][data-mine] .ck-msg-actions{margin-inline-start:0;margin-inline-end:auto}.ck-msg[data-mine] .ck-msg-edit .ck-actions{justify-content:flex-end}.ck-msg[data-reply][data-mine] .ck-msg-body{background:var(--ck-accent-soft)}.ck-msg[data-reply][data-mine] .ck-msg-body:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--ck-radius);border-top-right-radius:var(--ck-radius-sm)}.ck-msg[data-reply][data-mine] .ck-msg-body:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--ck-radius);border-top-right-radius:var(--ck-radius-sm)}.ck-msg[data-reply][data-mine] .ck-msg-body:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ck-radius);border-top-left-radius:var(--ck-radius-sm)}.ck-msg[data-reply][data-mine] .ck-msg-body:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ck-radius);border-top-left-radius:var(--ck-radius-sm)}.ck-msg[data-reply][data-mine] .ck-reactions{justify-content:flex-end}.ck-msg[data-reply][data-mine] .ck-msg-body .ck-pre{text-align:start}.ck-msg[data-new]{animation:ck-reply-in var(--ck-dur) var(--ck-ease)}@keyframes ck-reply-in{0%{opacity:0;translate:0 8px}}.ck-msg-edit{width:100%}.ck-quote-msg{border-top:0;border-bottom:0;text-align:start;text-overflow:ellipsis;white-space:nowrap;width:100%;transition:color var(--ck-fast);border-inline-end:0;margin:4px 0 8px;overflow:hidden}.ck-quote-msg strong,.ck-quoting strong{color:var(--ck-text);font-weight:600}.ck-no-replies{font-size:var(--ck-fs-sm);text-wrap:pretty;margin:8px 0 0}.ck-card-body>p.ck-muted{text-wrap:pretty}.ck-msg:focus-visible{outline-offset:2px;border-radius:var(--ck-radius-sm)}.ck-card .ck-btn[aria-disabled=true]{opacity:.5;cursor:default}button.ck-shot{cursor:zoom-in;text-align:start;background:0 0;border:0;width:100%;padding:0;display:block}button.ck-shot:focus-visible{outline-offset:2px}.ck-grid{border-radius:var(--ck-radius-md);grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;margin-top:8px;display:grid;overflow:hidden}.ck-grid[data-count=\"3\"] .ck-grid-item:first-child{aspect-ratio:auto;grid-row:span 2}.ck-grid-item{aspect-ratio:4/3;background:var(--ck-bg-muted);cursor:zoom-in;border:0;padding:0;position:relative;overflow:hidden}.ck-grid-item:focus-visible{outline-offset:-2px;z-index:1}.ck-grid-item img{object-fit:cover;outline:1px solid var(--ck-img-outline);outline-offset:-1px;width:100%;height:100%;transition:scale var(--ck-dur) var(--ck-ease);display:block}.ck-grid-more{color:#fff;font-size:var(--ck-fs-xl);font-variant-numeric:tabular-nums;background:#1213168c;place-items:center;font-weight:700;display:grid;position:absolute;top:0;bottom:0;left:0;right:0}.ck-msg .ck-file{color:var(--ck-text);overflow-wrap:anywhere;transition:background-color var(--ck-fast);text-decoration:none}.ck-previews{gap:8px;margin-top:8px;display:grid}.ck-preview{padding:8px 12px;border-inline-start:3px solid var(--ck-border);border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);color:var(--ck-text);font-size:var(--ck-fs-sm);transition:background-color var(--ck-fast);gap:4px;padding-inline-start:9px;text-decoration:none;display:grid}.ck-preview>*{min-width:0}.ck-preview strong{text-overflow:ellipsis;white-space:nowrap;font-weight:600;overflow:hidden}.ck-preview-site{color:var(--ck-text-muted);font-size:var(--ck-fs-xs);overflow-wrap:anywhere}.ck-preview-text{color:var(--ck-text-muted);-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.ck-reactions{flex-wrap:wrap;gap:4px;margin-top:8px;display:flex}.ck-reaction{border-radius:var(--ck-radius-pill);border:1px solid var(--ck-hairline);background:var(--ck-bg-muted);min-width:32px;height:24px;color:var(--ck-text);font-size:var(--ck-fs-sm);font-variant-numeric:tabular-nums;transition:background-color var(--ck-fast), border-color var(--ck-fast), color var(--ck-fast), scale var(--ck-fast) ease-out;justify-content:center;align-items:center;gap:4px;padding:0 8px;display:inline-flex}.ck-reaction:active{scale:.96}.ck-reaction[aria-pressed=true]{border-color:color-mix(in srgb, var(--ck-accent) 35%, var(--ck-bg));background:var(--ck-accent-soft);color:var(--ck-accent-text)}.ck-reaction .ck-emoji{margin:0}.ck-reaction-add{opacity:.55;transition:opacity var(--ck-fast), background-color var(--ck-fast)}.ck-reaction-add:focus-visible{opacity:1}.ck-picker-wrap{display:inline-flex;position:relative}.ck-reaction-more{color:var(--ck-text-muted);padding:0}.ck-picker{z-index:4;bottom:calc(100% + 8px);background:var(--ck-bg);border-radius:var(--ck-radius-md);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-fast) var(--ck-ease);border:1px solid #0000;grid-template-columns:repeat(8,32px);gap:4px;padding:4px;display:grid;position:absolute}.ck-picker:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){left:0}.ck-picker:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){left:0}.ck-picker:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){right:0}.ck-picker:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){right:0}.ck-picker[data-below]{top:calc(100% + 8px);bottom:auto}.ck-picker button{border-radius:var(--ck-radius-sm);width:32px;height:32px;font-size:var(--ck-fs-lg);transition:background-color var(--ck-fast), scale var(--ck-fast) ease-out;background:0 0;border:0;place-items:center;padding:0;display:grid}.ck-picker button[aria-pressed=true]{background:var(--ck-accent-soft)}.ck-picker button:active{scale:.96}.ck-picker .ck-emoji{width:20px;height:20px;margin:0}@media (max-width:520px){.ck-picker{grid-template-columns:repeat(6,36px)}.ck-picker button{width:36px;height:36px}}.ck-quoting{border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);border-inline-start:3px solid var(--ck-accent-text);font-size:var(--ck-fs-sm);color:var(--ck-text-muted);align-items:center;gap:8px;margin-bottom:8px;padding:4px;padding-inline-start:5px;display:flex}.ck-quoting>svg{flex:none}.ck-quoting>span{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.ck-quoting .ck-ghost{flex:none;place-items:center;min-width:24px;padding:0;display:grid}.ck-jump{box-shadow:var(--ck-shadow-sm);animation:ck-pop var(--ck-fast) var(--ck-ease);z-index:1;position:absolute;bottom:calc(100% + 8px);left:50%;translate:-50%}.ck-mention-card{z-index:5;background:var(--ck-bg);border-radius:var(--ck-radius-md);max-width:240px;box-shadow:var(--ck-shadow);pointer-events:none;animation:ck-fade var(--ck-fast) ease-out;font-size:var(--ck-fs-md);border:1px solid #0000;align-items:center;gap:8px;padding:4px;padding-inline-end:12px;display:flex;position:fixed}.ck-mention-card .ck-avatar{--ck-av:24px}.ck-mention-card .ck-msg-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}@media (hover:hover){.ck-reaction:hover{background:var(--ck-bg-hover)}.ck-reaction-add:hover{opacity:1}.ck-reaction-more:hover{color:var(--ck-text)}.ck-picker button:hover{background:var(--ck-bg-hover)}.ck-quote-msg:hover,.ck-details-toggle:hover{color:var(--ck-text)}.ck-grid-item:hover img,button.ck-shot:hover img{scale:1.02}.ck-preview:hover,.ck-msg a.ck-file:hover{background:var(--ck-bg-hover)}}@media (forced-colors:active){.ck-reaction[aria-pressed=true],.ck-picker button[aria-pressed=true]{color:highlighttext;background:highlight}}@media (hover:none){.ck-msg-actions,.ck-checklist li .ck-icon{opacity:1}}@media (pointer:coarse){.ck-reaction,.ck-msg-actions .ck-ghost,.ck-details-toggle{min-width:44px;min-height:44px}.ck-checklist li{align-items:center}.ck-checklist-add .ck-input{height:44px;font-size:var(--ck-fs-lg)}.ck-picker{grid-template-columns:repeat(6,44px)}.ck-picker button{width:44px;height:44px}}");
468
+ function He(e, t) {
469
+ return !!t && e.id !== null && e.id === t.person.id && e.type === t.person.type;
470
+ }
471
+ function Ue(e, t) {
472
+ let n = /* @__PURE__ */ new Set(), r = [...new Set(t)].filter(Boolean).sort((e, t) => t.length - e.length);
473
+ if (!r.length) return n;
474
+ let i = r.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")), a = RegExp(`(?:^|[\\s(\\[])@(${i.join("|")})(?![\\p{L}\\p{N}_-])`, "gu");
475
+ for (let t of e.matchAll(a)) n.add(t[1]);
476
+ return n;
477
+ }
478
+ var We = /* @__PURE__ */ new Map();
479
+ function F({ client: a, threadId: u, version: f = 0, onClose: _, onError: v, notify: b, embedded: x, onMovePin: pe }) {
480
+ let S = be(a.state, (e) => e.session), xe = be(a.state, (e) => e.config?.read_only ?? !1), Se = be(a.state, (e) => e.config?.limits?.upload_types), w = je(), T = d(null), E = be(a.state, (e) => e.threads.find((e) => e.id === u) ?? null), [D, O] = i(E), [k, A] = i([]), [j, Fe] = i(null), M = fe(a.options.project, "reply", u), [N, Ie] = i(() => re(M)), Le = (e) => {
481
+ e !== N && (L.current = null), Ie(e), y(M, e);
482
+ }, P = ie(a, (e) => v(new n(0, "file_rejected", e))), [F, Ke] = i(null), qe = Te(F, () => e(() => import("./Viewer-DL6M3wAT.js")).then((e) => e.Viewer), v), Je = (e, t) => Ke({
483
+ images: e,
484
+ start: t
485
+ }), Ye = d(null), [Xe, Ze] = i([]), [I, Qe] = i(!1), [$e, et] = i(!1), L = d(null), [R, tt] = i(!1), nt = d(null), rt = d(null);
486
+ l(() => {
487
+ R && rt.current?.querySelector("[role=menuitem]")?.focus();
488
+ }, [R]);
489
+ let it = () => {
490
+ tt(!1), nt.current?.focus();
491
+ }, at = d(null);
492
+ Ce(R, at, () => tt(!1));
493
+ let ot = d(null), st = Re(ot, !x, _);
494
+ te(ot);
495
+ let [z, B] = i(null), [V, ct] = i(null), [lt, ut] = i(!1), dt = d(0), [H, ft] = i([]), pt = m(() => H.map((e) => e.name), [H]), [U, W] = i(null), mt = d(/* @__PURE__ */ new Set()), [ht, gt] = i(!1), [_t, vt] = i(!0), yt = d(null), [bt, xt] = i(0), St = (e = !1) => yt.current?.scrollTo({
496
+ top: yt.current.scrollHeight,
497
+ behavior: e && !Pe() ? "smooth" : "auto"
498
+ });
499
+ c(() => {
500
+ lt || St();
501
+ }, [k.length]);
502
+ let Ct = () => !lt && St();
503
+ c(() => {
504
+ S && oe(a).then(ft);
505
+ }, [S?.person.id]);
506
+ let G = d(u);
507
+ G.current = u;
508
+ let K = d(null), wt = (e) => {
509
+ K.current?.(), K.current = null;
510
+ let t = () => {
511
+ G.current === e && a.state.get().unread > 0 && a.markRead({ threadId: e }).catch(() => void 0);
512
+ };
513
+ if (a.inboxLoaded || a.state.get().unread > 0) return t();
514
+ let n = a.state.subscribe(() => {
515
+ a.inboxLoaded && (n(), K.current = null, t());
516
+ });
517
+ K.current = n;
518
+ };
519
+ c(() => () => K.current?.(), []);
520
+ let q = async (e = !1) => {
521
+ let t = u;
522
+ try {
523
+ let [n, r] = await Promise.all([a.getThread(t), a.allMessages(t, { refresh: e })]);
524
+ if (G.current !== t) return;
525
+ O(n), mt.current.size || r.forEach((e) => mt.current.add(e.id)), A(r), !We.has(t) && typeof n.watching == "boolean" && vt(n.watching), wt(t);
526
+ } catch (e) {
527
+ if (G.current !== t) return;
528
+ let r = e instanceof n && (e.status === 404 || e.status === 403);
529
+ if (E && !r) {
530
+ v(e);
531
+ return;
532
+ }
533
+ if (E) {
534
+ v(new n(404, "thread_not_found", s("threadNotFound"))), _();
535
+ return;
536
+ }
537
+ Fe({
538
+ gone: r,
539
+ text: r ? s("threadNotFound") : Ee(e)
540
+ });
541
+ }
542
+ };
543
+ l(() => {
544
+ O(E), A([]), Ie(re(M)), P.clear(), ct(null), ut(!1), W(null), mt.current = /* @__PURE__ */ new Set(), gt(!1), et(!1), L.current = null, vt(We.get(u) ?? E?.watching ?? !0), q();
545
+ }, [u]), c(() => {
546
+ E && D && E.updated_at !== D.updated_at && q(!0);
547
+ }, [E?.updated_at]);
548
+ let Tt = d(f);
549
+ c(() => {
550
+ f !== Tt.current && (Tt.current = f, q(!0));
551
+ }, [f]);
552
+ let J = m(() => D ? r(D.anchor) : null, [D]);
553
+ c(() => {
554
+ !x && J?.element && J.state !== "detached" && J.element.scrollIntoView({
555
+ block: "center",
556
+ behavior: Pe() ? "auto" : "smooth"
557
+ });
558
+ }, [J?.element]), c(() => {
559
+ D && T.current?.focus({ preventScroll: !0 });
560
+ }, [D?.id]);
561
+ let Y = () => Oe(a);
562
+ if (l(() => {
563
+ let e = (e) => {
564
+ if (x && (e.key === "j" || e.key === "k") && !e.metaKey && !e.ctrlKey && !e.altKey && Y() && we(e)) {
565
+ let t = e.key === "j" ? x.onNext : x.onPrev;
566
+ t && (e.preventDefault(), t());
567
+ } else e.key !== "e" && e.key !== "E" || e.metaKey || e.ctrlKey || e.altKey || !D || !Y() || we(e) && S?.capabilities.comment && !xe && D.status !== "resolved" && (e.preventDefault(), $("resolved"));
568
+ };
569
+ return addEventListener("keydown", e), () => removeEventListener("keydown", e);
570
+ }), !D) return /* @__PURE__ */ p("div", {
571
+ class: x ? "ck-card ck-card-embedded" : "ck-card",
572
+ style: x ? void 0 : ue({
573
+ x: innerWidth - 400,
574
+ y: 80
575
+ }),
576
+ role: "region",
577
+ "aria-label": s("loadingThread"),
578
+ "aria-busy": !j,
579
+ "data-commentkit-ui": !0,
580
+ ref: ot,
581
+ children: [/* @__PURE__ */ p("div", {
582
+ class: "ck-card-head",
583
+ children: [
584
+ x ? /* @__PURE__ */ p("button", {
585
+ class: "ck-icon ck-back",
586
+ "aria-label": s("backToList"),
587
+ onClick: x.onBack,
588
+ children: /* @__PURE__ */ p(g, { name: "chevronRight" })
589
+ }) : null,
590
+ /* @__PURE__ */ p("span", {
591
+ class: "ck-card-title",
592
+ children: j ? "" : s("loadingThread")
593
+ }),
594
+ /* @__PURE__ */ p("button", {
595
+ class: "ck-icon",
596
+ "aria-label": s("closeCard"),
597
+ onClick: x ? x.onBack : _,
598
+ children: /* @__PURE__ */ p(g, { name: "clear" })
599
+ })
600
+ ]
601
+ }), j ? /* @__PURE__ */ p("div", {
602
+ class: "ck-card-body ck-empty",
603
+ role: "alert",
604
+ children: [
605
+ /* @__PURE__ */ p(ge, { name: j.gone ? "gone" : "error" }),
606
+ /* @__PURE__ */ p("span", { children: j.text }),
607
+ /* @__PURE__ */ p("button", {
608
+ class: "ck-btn",
609
+ onClick: j.gone ? _ : () => {
610
+ Fe(null), q();
611
+ },
612
+ children: s(j.gone ? "close" : "retry")
613
+ })
614
+ ]
615
+ }) : /* @__PURE__ */ p("div", {
616
+ class: "ck-card-body ck-thread-skeleton",
617
+ children: [/* @__PURE__ */ p("div", { class: "ck-skeleton ck-skeleton-meta" }), [
618
+ 0,
619
+ 1,
620
+ 2
621
+ ].map(() => /* @__PURE__ */ p("div", {
622
+ class: "ck-msg-skeleton",
623
+ children: [/* @__PURE__ */ p("span", { class: "ck-skeleton ck-skeleton-avatar" }), /* @__PURE__ */ p("div", { children: [
624
+ /* @__PURE__ */ p("div", { class: "ck-skeleton" }),
625
+ /* @__PURE__ */ p("div", { class: "ck-skeleton" }),
626
+ /* @__PURE__ */ p("div", { class: "ck-skeleton" })
627
+ ] })]
628
+ }))]
629
+ })]
630
+ });
631
+ let X = S?.capabilities, Z = !!X?.triage, Q = !!X?.comment && !xe, Et = a.options.tools?.attachments !== !1, Dt = S && D.author.id === S.person.id && D.author.type === (S.person.type === "guest" ? "guest" : "user"), Ot = J ? {
632
+ x: J.point.x - scrollX,
633
+ y: J.point.y - scrollY
634
+ } : {
635
+ x: innerWidth - 400,
636
+ y: 80
637
+ }, kt = ue({
638
+ x: Math.min(Math.max(Ot.x, 0), innerWidth),
639
+ y: Math.min(Math.max(Ot.y, 0), innerHeight - 40)
640
+ }), At = Z ? D.reference : s("feedbackRef", { ref: D.reference }), jt = (e) => {
641
+ if (!(e instanceof n && e.status === 412)) return v(e);
642
+ B(null), b({
643
+ text: s("editConflict"),
644
+ tone: "info"
645
+ }), q();
646
+ }, Mt = (e) => G.current === e.id && O(e), $ = async (e) => {
647
+ let t = D;
648
+ try {
649
+ Mt(await a.updateThread(D.id, { status: e })), e === "resolved" && import("./confetti-K_xKxQGa.js").then((e) => e.celebrate(yt.current)).catch(() => void 0), e === "resolved" ? b({
650
+ text: s("resolvedToast", { ref: D.reference }),
651
+ tone: "success",
652
+ action: {
653
+ label: s("undo"),
654
+ run: () => void ce(a, t, b, v).then((e) => e && G.current === e.id && O(e))
655
+ }
656
+ }) : e === "open" && (t.status === "resolved" || t.status === "closed") && b({
657
+ text: s("reopenedToast", { ref: D.reference }),
658
+ tone: "info"
659
+ });
660
+ } catch (e) {
661
+ jt(e);
662
+ }
663
+ }, Nt = () => a.watch(D.id, !_t).then((e) => {
664
+ let t = e?.watching ?? !_t;
665
+ We.set(D.id, t), G.current === D.id && vt(t), b({ text: s(t ? "followed" : "muted", { ref: D.reference }) });
666
+ }, v), Pt = () => {
667
+ if (!z || I) return;
668
+ Qe(!0);
669
+ let e = Ue(z.body, H.map((e) => e.name)), t = H.filter((t) => /^\d+$/.test(t.id ?? "") && e.has(t.name)).map((e) => Number(e.id));
670
+ a.editMessage(z.id, z.body, ...t.length ? [{ mentionIds: t }] : []).then((e) => {
671
+ A((t) => t.map((t) => t.id === e.id ? e : t)), B(null), b({
672
+ text: s("editedToast"),
673
+ tone: "success"
674
+ }), e.id === k[0]?.id && a.refreshThread(D.id);
675
+ }, jt).finally(() => Qe(!1));
676
+ }, Ft = async () => {
677
+ if (N.trim() && !I && w) {
678
+ Qe(!0), et(!1);
679
+ try {
680
+ let e = await P.ready(), n = e.ids;
681
+ e.missing && b({
682
+ text: s("sentWithoutFiles"),
683
+ tone: "info"
684
+ });
685
+ let r = await a.reply(D.id, N.trim(), {
686
+ replyTo: V?.id ?? null,
687
+ mentionIds: Xe,
688
+ attachmentIds: n,
689
+ idempotencyKey: L.current ?? (L.current = t(16))
690
+ });
691
+ if (L.current = null, ee(M), G.current !== D.id) return;
692
+ A((e) => e.some((e) => e.id === r.id) ? e : [...e, r]), ct(null), ut(!1), Ie(""), P.clear(), (D.status === "resolved" || D.status === "closed") && O({
693
+ ...D,
694
+ status: "open"
695
+ });
696
+ } catch (e) {
697
+ et(le(e) ?? !0);
698
+ } finally {
699
+ Qe(!1);
700
+ }
701
+ }
702
+ }, It = async (e, t) => {
703
+ let n = e.reactions?.find((e) => e.emoji === t)?.mine ?? !1, r = (e) => {
704
+ let r = (e.reactions ?? []).map((e) => e.emoji === t ? {
705
+ ...e,
706
+ count: e.count + (n ? -1 : 1),
707
+ mine: !n
708
+ } : e).filter((e) => e.count > 0);
709
+ return !n && !r.some((e) => e.emoji === t) && r.push({
710
+ emoji: t,
711
+ count: 1,
712
+ mine: !0
713
+ }), {
714
+ ...e,
715
+ reactions: r
716
+ };
717
+ };
718
+ A(k.map((t) => t.id === e.id ? r(t) : t));
719
+ try {
720
+ await a.react(e.id, t, !n);
721
+ } catch (e) {
722
+ v(e), q();
723
+ }
724
+ }, Lt = (e) => P.add(e), Rt = (e) => {
725
+ let t = k.findIndex((t) => t.id === e.id);
726
+ A((t) => t.filter((t) => t.id !== e.id)), T.current?.focus({ preventScroll: !0 }), b({
727
+ text: s("replyDeleted"),
728
+ action: {
729
+ label: s("undo"),
730
+ run: () => G.current === D.id && A((n) => n.some((t) => t.id === e.id) ? n : [
731
+ ...n.slice(0, t),
732
+ e,
733
+ ...n.slice(t)
734
+ ])
735
+ },
736
+ expires: Ge,
737
+ onExpire: () => void a.deleteMessage(e.id).then(() => a.refreshThread(D.id), (e) => {
738
+ v(e), G.current === D.id && q();
739
+ })
740
+ });
741
+ }, zt = () => {
742
+ let e = a.state.get().threads;
743
+ a.state.set((e) => ({ threads: e.threads.filter((e) => e.id !== D.id) })), _(), b({
744
+ text: s("threadDeleted", { ref: D.reference }),
745
+ action: {
746
+ label: s("undo"),
747
+ run: () => a.state.set((t) => ({ threads: t.threads.some((e) => e.id === D.id) ? t.threads : e.filter((e) => e.id === D.id).concat(t.threads) }))
748
+ },
749
+ expires: Ge,
750
+ onExpire: () => void a.deleteThread(D.id).catch((e) => {
751
+ v(e), a.refreshThread(D.id);
752
+ })
753
+ });
754
+ }, Bt = async (e, t) => {
755
+ try {
756
+ await navigator.clipboard.writeText(e), b({ text: t });
757
+ } catch {
758
+ v(Error(s("errorGeneric")));
759
+ }
760
+ }, Vt = (() => {
761
+ let e = C(D.page.url);
762
+ return e ? ke(e, D.id) : "";
763
+ })(), Ht = C(D.capture?.screenshot?.thumbnail_url, "image"), Ut = C(D.capture?.screenshot?.url), Wt = Ht ? {
764
+ thumb: Ht,
765
+ src: Ut ?? Ht,
766
+ href: Ut,
767
+ name: s("screenshot")
768
+ } : null, Gt = D.status === "resolved" || D.status === "closed";
769
+ return /* @__PURE__ */ p(he, {
770
+ value: me(a, b, jt, S),
771
+ children: /* @__PURE__ */ p("div", {
772
+ class: x ? "ck-card ck-card-embedded" : "ck-card",
773
+ style: x ? void 0 : kt,
774
+ role: "region",
775
+ "aria-label": At,
776
+ "data-commentkit-ui": !0,
777
+ ref: ot,
778
+ onKeyDown: x ? (e) => e.key === "Escape" && !e.defaultPrevented && (e.stopPropagation(), x.onBack()) : void 0,
779
+ children: [
780
+ /* @__PURE__ */ p("div", {
781
+ class: "ck-card-head ck-thread-head",
782
+ ref: rt,
783
+ children: [
784
+ x ? /* @__PURE__ */ p("button", {
785
+ class: "ck-icon ck-back",
786
+ "aria-label": s("backToList"),
787
+ onClick: x.onBack,
788
+ children: /* @__PURE__ */ p(g, { name: "chevronRight" })
789
+ }) : null,
790
+ /* @__PURE__ */ p("span", {
791
+ class: "ck-card-title",
792
+ ref: T,
793
+ tabIndex: -1,
794
+ children: At
795
+ }),
796
+ /* @__PURE__ */ p(ve, {
797
+ status: D.status,
798
+ editable: !!X?.set_any_status && Q,
799
+ onPick: (e) => void $(e)
800
+ }),
801
+ /* @__PURE__ */ p("span", { class: "ck-spacer" }),
802
+ x?.position ? /* @__PURE__ */ p("span", {
803
+ class: "ck-muted ck-card-pos",
804
+ children: s("countOf", {
805
+ n: x.position.n,
806
+ total: x.position.total
807
+ })
808
+ }) : null,
809
+ x?.onPrev ? /* @__PURE__ */ p("button", {
810
+ class: "ck-icon ck-step",
811
+ "aria-label": s("previousThread"),
812
+ "data-tip": Y() ? `${s("previousThread")} (K)` : void 0,
813
+ "aria-keyshortcuts": Y() ? "K" : void 0,
814
+ onClick: x.onPrev,
815
+ children: /* @__PURE__ */ p(g, { name: "chevronRight" })
816
+ }) : null,
817
+ x?.onNext ? /* @__PURE__ */ p("button", {
818
+ class: "ck-icon ck-step",
819
+ "data-dir": "next",
820
+ "aria-label": s("nextThread"),
821
+ "data-tip": Y() ? `${s("nextThread")} (J)` : void 0,
822
+ "aria-keyshortcuts": Y() ? "J" : void 0,
823
+ onClick: x.onNext,
824
+ children: /* @__PURE__ */ p(g, { name: "chevronRight" })
825
+ }) : null,
826
+ /* @__PURE__ */ p("span", {
827
+ class: "ck-more",
828
+ ref: at,
829
+ children: [/* @__PURE__ */ p("button", {
830
+ class: "ck-icon",
831
+ ref: nt,
832
+ "aria-label": s("moreThread"),
833
+ "aria-haspopup": "menu",
834
+ "aria-expanded": R,
835
+ "aria-controls": R ? "ck-thread-menu" : void 0,
836
+ onClick: () => tt(!R),
837
+ children: /* @__PURE__ */ p(g, { name: "more" })
838
+ }), R ? /* @__PURE__ */ p("div", {
839
+ class: "ck-menu ck-pop",
840
+ id: "ck-thread-menu",
841
+ role: "menu",
842
+ onClick: it,
843
+ onKeyDown: (e) => e.key === "Escape" ? (e.stopPropagation(), it()) : Me(e, "[role=menuitem]", !0),
844
+ children: [
845
+ x ? /* @__PURE__ */ p("button", {
846
+ role: "menuitem",
847
+ onClick: () => x.onShow(D),
848
+ children: s("showOnPage")
849
+ }) : null,
850
+ Vt ? /* @__PURE__ */ p("button", {
851
+ role: "menuitem",
852
+ onClick: () => void Bt(Vt, s("copied")),
853
+ children: s("copyLink")
854
+ }) : null,
855
+ pe && X?.triage && Q ? /* @__PURE__ */ p("button", {
856
+ role: "menuitem",
857
+ onClick: pe,
858
+ children: s("movePin")
859
+ }) : null,
860
+ Z && Q && a.options.tools?.checklist !== !1 && !D.checklist?.length ? /* @__PURE__ */ p("button", {
861
+ role: "menuitem",
862
+ onClick: () => xt((e) => e + 1),
863
+ children: s("addChecklist")
864
+ }) : null,
865
+ X?.export_for_agents ? /* @__PURE__ */ p("button", {
866
+ role: "menuitem",
867
+ onClick: () => void Bt(h(D, k), s("copiedForAgent")),
868
+ children: s("copyForAgent")
869
+ }) : null,
870
+ /* @__PURE__ */ p("button", {
871
+ role: "menuitem",
872
+ onClick: () => void Nt(),
873
+ children: s(_t ? "mute" : "unmute")
874
+ }),
875
+ Q && (X?.manage || Dt && D.message_count <= 1) ? /* @__PURE__ */ p("button", {
876
+ role: "menuitem",
877
+ class: "ck-danger",
878
+ onClick: zt,
879
+ children: s("delete")
880
+ }) : null
881
+ ]
882
+ }) : null]
883
+ }),
884
+ x ? null : /* @__PURE__ */ p("button", {
885
+ class: "ck-icon",
886
+ "aria-label": s("closeCard"),
887
+ onClick: _,
888
+ children: /* @__PURE__ */ p(g, { name: "clear" })
889
+ })
890
+ ]
891
+ }),
892
+ x ? null : /* @__PURE__ */ p("div", {
893
+ class: "ck-card-hint",
894
+ role: "status",
895
+ children: st
896
+ }),
897
+ /* @__PURE__ */ p(ye, {
898
+ thread: D,
899
+ editable: !!X?.triage && Q,
900
+ onChange: Mt
901
+ }),
902
+ /* @__PURE__ */ p("div", {
903
+ class: "ck-card-body",
904
+ ref: yt,
905
+ onScroll: (e) => {
906
+ let t = e.currentTarget, n = t.scrollHeight - t.scrollTop - t.clientHeight > 120, r = t.scrollTop < dt.current;
907
+ dt.current = t.scrollTop, ut((e) => n && (e || r)), W(null);
908
+ },
909
+ onMouseOver: (e) => {
910
+ let t = e.target.closest?.(".ck-mention");
911
+ if (!t) return W(null);
912
+ let n = t.textContent?.replace(/^@/, "") ?? "", r = H.find((e) => e.name === n) ?? H.find((e) => n.startsWith(e.name));
913
+ if (!r) return;
914
+ let i = t.getBoundingClientRect();
915
+ W({
916
+ person: r,
917
+ x: i.left,
918
+ y: i.bottom + 6
919
+ });
920
+ },
921
+ onMouseLeave: () => W(null),
922
+ children: [D.status === "in_review" && !X?.set_any_status && Q ? /* @__PURE__ */ p("div", {
923
+ class: "ck-review-ask",
924
+ children: [/* @__PURE__ */ p("div", { children: s("reviewAsk") }), /* @__PURE__ */ p("div", {
925
+ class: "ck-actions",
926
+ children: [/* @__PURE__ */ p("button", {
927
+ class: "ck-btn ck-primary",
928
+ onClick: () => void $("resolved"),
929
+ children: [
930
+ /* @__PURE__ */ p(g, {
931
+ name: "check",
932
+ size: 14
933
+ }),
934
+ " ",
935
+ s("looksGood")
936
+ ]
937
+ }), /* @__PURE__ */ p("button", {
938
+ class: "ck-btn",
939
+ onClick: () => gt(!0),
940
+ children: s("notYet")
941
+ })]
942
+ })]
943
+ }) : null, k.map((e, t) => {
944
+ let n = He(e.author, S), r = t === 0;
945
+ return /* @__PURE__ */ p(o, { children: [/* @__PURE__ */ p(Ne, {
946
+ client: a,
947
+ message: e,
948
+ first: r,
949
+ mine: n,
950
+ fresh: !mt.current.has(e.id),
951
+ people: pt,
952
+ shot: Wt,
953
+ canWrite: Q,
954
+ simple: !Z,
955
+ canDelete: Q && (n || !!X?.manage) && !r,
956
+ edit: z?.id === e.id ? {
957
+ body: z.body,
958
+ busy: I,
959
+ onChange: (t) => B({
960
+ id: e.id,
961
+ body: t
962
+ }),
963
+ onCancel: () => B(null),
964
+ onSave: Pt
965
+ } : null,
966
+ alone: r && k.length === 1,
967
+ onQuote: () => ct(e),
968
+ onCopy: () => void Bt(e.body, s("copiedText")),
969
+ onEdit: () => B({
970
+ id: e.id,
971
+ body: e.body
972
+ }),
973
+ onDelete: () => Rt(e),
974
+ onReact: (t) => void It(e, t),
975
+ onView: Je,
976
+ onImageLoad: Ct
977
+ }), r ? /* @__PURE__ */ p("div", {
978
+ class: "ck-extras",
979
+ children: [
980
+ /* @__PURE__ */ p(Be, {
981
+ thread: D,
982
+ anchor: J?.state,
983
+ branch: Z && !!a.options.branch
984
+ }),
985
+ /* @__PURE__ */ p(_e, {
986
+ thread: D,
987
+ editable: Q && (Z || !!Dt),
988
+ addable: Z && a.options.tools?.checklist !== !1,
989
+ start: bt,
990
+ onChange: Mt
991
+ }, D.id),
992
+ D.style_changes?.length ? /* @__PURE__ */ p(ze, {
993
+ thread: D,
994
+ element: J?.state === "detached" ? null : J?.element ?? null,
995
+ editable: Q && (!!X?.triage || !!Dt),
996
+ onChange: Mt
997
+ }, D.id) : null,
998
+ Z ? /* @__PURE__ */ p(Ve, { thread: D }) : null
999
+ ]
1000
+ }) : null] }, e.id);
1001
+ })]
1002
+ }),
1003
+ /* @__PURE__ */ p("div", {
1004
+ class: "ck-card-foot ck-reply-foot",
1005
+ ...Q && Et ? se(Lt) : {},
1006
+ children: [lt ? /* @__PURE__ */ p("button", {
1007
+ class: "ck-chip ck-jump",
1008
+ onClick: () => (ut(!1), St(!0)),
1009
+ children: [/* @__PURE__ */ p(g, {
1010
+ name: "arrowDown",
1011
+ size: 14
1012
+ }), s("jumpToLatest")]
1013
+ }) : null, Q ? /* @__PURE__ */ p(o, { children: [
1014
+ w ? null : /* @__PURE__ */ p("div", {
1015
+ class: "ck-note",
1016
+ "data-tone": "warning",
1017
+ role: "status",
1018
+ children: s("offline")
1019
+ }),
1020
+ $e && w ? /* @__PURE__ */ p("div", {
1021
+ class: "ck-note",
1022
+ "data-tone": "warning",
1023
+ role: "alert",
1024
+ children: $e === !0 ? /* @__PURE__ */ p(o, { children: [
1025
+ s("replyFailed"),
1026
+ " ",
1027
+ /* @__PURE__ */ p("button", {
1028
+ class: "ck-btn",
1029
+ "aria-disabled": I || void 0,
1030
+ onClick: () => void Ft(),
1031
+ children: s("retry")
1032
+ })
1033
+ ] }) : $e
1034
+ }) : null,
1035
+ /* @__PURE__ */ p(ne, {
1036
+ client: a,
1037
+ value: N,
1038
+ onChange: Le,
1039
+ onMentions: Ze,
1040
+ onSubmit: () => void Ft(),
1041
+ placeholder: s(ht ? "notYetPlaceholder" : Gt ? "replyToReopen" : "replyPlaceholder"),
1042
+ autofocus: ht || !!V,
1043
+ disabled: I,
1044
+ canMention: !0,
1045
+ tools: Et ? /* @__PURE__ */ p(de, {
1046
+ input: Ye,
1047
+ onFiles: Lt,
1048
+ types: Se
1049
+ }) : null,
1050
+ above: V ? /* @__PURE__ */ p("div", {
1051
+ class: "ck-quoting",
1052
+ role: "status",
1053
+ children: [
1054
+ /* @__PURE__ */ p(g, {
1055
+ name: "reply",
1056
+ size: 14
1057
+ }),
1058
+ /* @__PURE__ */ p("span", {
1059
+ title: V.body.slice(0, 280),
1060
+ children: [
1061
+ /* @__PURE__ */ p("strong", { children: /* @__PURE__ */ p("bdi", { children: V.author.name }) }),
1062
+ " ",
1063
+ /* @__PURE__ */ p("bdi", { children: V.body.slice(0, 140) })
1064
+ ]
1065
+ }),
1066
+ /* @__PURE__ */ p("button", {
1067
+ class: "ck-icon ck-icon-sm",
1068
+ "aria-label": s("quoteCancel"),
1069
+ onClick: () => ct(null),
1070
+ children: /* @__PURE__ */ p(g, {
1071
+ name: "clear",
1072
+ size: 14
1073
+ })
1074
+ })
1075
+ ]
1076
+ }) : null
1077
+ }),
1078
+ /* @__PURE__ */ p(ae, {
1079
+ items: P.items,
1080
+ onRemove: P.remove,
1081
+ onRetry: P.retry,
1082
+ onOpen: (e) => Je(P.items.filter((e) => e.preview).map((e) => ({
1083
+ src: e.preview,
1084
+ name: e.file.name
1085
+ })), e)
1086
+ }),
1087
+ /* @__PURE__ */ p("div", {
1088
+ class: "ck-actions ck-foot-actions",
1089
+ children: [
1090
+ Gt ? /* @__PURE__ */ p("button", {
1091
+ class: "ck-btn",
1092
+ onClick: () => void $("open"),
1093
+ children: [
1094
+ /* @__PURE__ */ p(g, { name: "reopen" }),
1095
+ " ",
1096
+ s("reopen")
1097
+ ]
1098
+ }) : /* @__PURE__ */ p("button", {
1099
+ class: "ck-btn",
1100
+ title: s("resolveHint"),
1101
+ "aria-keyshortcuts": Y() ? "E" : void 0,
1102
+ onClick: () => void $("resolved"),
1103
+ children: [
1104
+ /* @__PURE__ */ p(g, { name: "circleCheck" }),
1105
+ " ",
1106
+ s("resolve")
1107
+ ]
1108
+ }),
1109
+ /* @__PURE__ */ p("span", { class: "ck-spacer" }),
1110
+ /* @__PURE__ */ p("button", {
1111
+ class: N.trim() || I ? D.status === "in_review" && !X?.set_any_status && Q ? "ck-btn" : "ck-btn ck-primary" : "ck-btn ck-quiet",
1112
+ "aria-disabled": I || !N.trim() || !w || void 0,
1113
+ onClick: () => w && void Ft(),
1114
+ children: s(I ? "sending" : "reply")
1115
+ })
1116
+ ]
1117
+ })
1118
+ ] }) : /* @__PURE__ */ p("div", {
1119
+ class: "ck-note",
1120
+ children: s(xe ? "readOnlyReply" : "noReplyAccess")
1121
+ })]
1122
+ }),
1123
+ F && qe ? /* @__PURE__ */ p(qe, {
1124
+ images: F.images,
1125
+ start: F.start,
1126
+ onClose: () => Ke(null)
1127
+ }) : null,
1128
+ U ? /* @__PURE__ */ p("div", {
1129
+ class: "ck-mention-card",
1130
+ style: De(Math.max(8, Math.min(U.x, innerWidth - 248)), U.y),
1131
+ "aria-hidden": "true",
1132
+ children: [/* @__PURE__ */ p(Ae, { person: U.person }), /* @__PURE__ */ p("bdi", {
1133
+ class: "ck-msg-name",
1134
+ children: U.person.name
1135
+ })]
1136
+ }) : null
1137
+ ]
1138
+ })
1139
+ });
1140
+ }
1141
+ var Ge = 6e3;
1142
+ export { F as ThreadCard, He as isMine, Ue as mentionedNames };