@commentkit/comment-kit 1.0.0-beta.0 → 1.0.0-beta.2

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 (49) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +102 -8
  3. package/SECURITY.md +7 -2
  4. package/dist/npm/chunks/Guest-CKoV6pEK.js +157 -0
  5. package/dist/npm/chunks/MarkupEditor-DAo4qppg.js +199 -0
  6. package/dist/npm/chunks/Panel-BRBDHlGg.js +399 -0
  7. package/dist/npm/chunks/Shortcuts-CHMcrjAM.js +56 -0
  8. package/dist/npm/chunks/ThreadCard-D8FzIxbs.js +570 -0
  9. package/dist/npm/chunks/ar-D3SPpN1T.js +195 -0
  10. package/dist/npm/chunks/{client-D1vrh_5G.js → client-D1NizpDK.js} +86 -49
  11. package/dist/npm/chunks/de-C8eC6c6f.js +187 -0
  12. package/dist/npm/chunks/es-Bczf42tm.js +187 -0
  13. package/dist/npm/chunks/extension--it1LAj-.js +54 -0
  14. package/dist/npm/chunks/extension-XfuRGu2o.js +26 -0
  15. package/dist/npm/chunks/format-Bw_tNOh9.js +524 -0
  16. package/dist/npm/chunks/fr-BaQw-v2e.js +187 -0
  17. package/dist/npm/chunks/hi-BamV-yXv.js +187 -0
  18. package/dist/npm/chunks/{html2canvas-_mjSRP3G.js → html2canvas-DfGb8yka.js} +1145 -1132
  19. package/dist/npm/chunks/it-DC14_EjN.js +187 -0
  20. package/dist/npm/chunks/ja-B1mmTN7Y.js +187 -0
  21. package/dist/npm/chunks/mount-5fFig0k6.js +1447 -0
  22. package/dist/npm/chunks/nl-BfhqUsmX.js +187 -0
  23. package/dist/npm/chunks/privacy-DLhezjyi.js +30 -0
  24. package/dist/npm/chunks/pt-BR-CEPu4W5U.js +187 -0
  25. package/dist/npm/chunks/{pusher-DRKlokR8.js → pusher-BSsQoE1K.js} +1 -1
  26. package/dist/npm/chunks/realtime-CBRW9BB3.js +34 -0
  27. package/dist/npm/chunks/report-Dh4fxd4J.js +27 -0
  28. package/dist/npm/chunks/{rolldown-runtime-VHNaYcLd.js → rolldown-runtime-Y_bBpyJl.js} +10 -3
  29. package/dist/npm/chunks/src-DujplxfI.js +517 -0
  30. package/dist/npm/chunks/zh-CN-kgqjYwHQ.js +187 -0
  31. package/dist/npm/element.js +28 -11
  32. package/dist/npm/headless.js +2 -2
  33. package/dist/npm/index.js +3 -3
  34. package/dist/npm/react.js +12 -3
  35. package/dist/npm/svelte.js +12 -3
  36. package/dist/npm/types/adapters/react.d.ts +2 -0
  37. package/dist/npm/types/adapters/svelte.d.ts +1 -1
  38. package/dist/npm/types/adapters/vue.d.ts +72 -0
  39. package/dist/npm/types/core/api.d.ts +2 -0
  40. package/dist/npm/types/core/auth.d.ts +42 -3
  41. package/dist/npm/types/core/client.d.ts +15 -1
  42. package/dist/npm/types/core/types.d.ts +31 -6
  43. package/dist/npm/types/element.d.ts +4 -1
  44. package/dist/npm/types/index.d.ts +3 -1
  45. package/dist/npm/vue.js +46 -7
  46. package/package.json +8 -2
  47. package/dist/npm/chunks/mount-Ce1MZrcm.js +0 -2485
  48. package/dist/npm/chunks/realtime-5SvAvTUU.js +0 -23
  49. package/dist/npm/chunks/src-DJjfvVsa.js +0 -330
@@ -0,0 +1,199 @@
1
+ import { a as e } from "./src-DujplxfI.js";
2
+ import { a as t, d as n, f as r, h as i, p as a } from "./format-Bw_tNOh9.js";
3
+ //#region src/ui/MarkupEditor.tsx
4
+ var o = [
5
+ "#ff3b30",
6
+ "#ff9500",
7
+ "#34c759",
8
+ "#007aff",
9
+ "#121316"
10
+ ], s = [
11
+ "color_red",
12
+ "color_orange",
13
+ "color_green",
14
+ "color_blue",
15
+ "color_black"
16
+ ];
17
+ function c({ image: c, onDone: u, onCancel: d }) {
18
+ let f = a(null), [p, m] = i(null), [h, g] = i("arrow"), [_, v] = i(o[0]), [y, b] = i([]), x = a(null), [S, C] = i(null), w = a(null), T = a(null);
19
+ r(() => (w.current ?? T.current)?.focus({ preventScroll: !0 }), [!!S]);
20
+ let E = () => {
21
+ let e = S?.text.trim().slice(0, 500);
22
+ S && e && b([...y, {
23
+ tool: "text",
24
+ color: _,
25
+ points: [S.x, S.y],
26
+ text: e
27
+ }]), T.current?.focus({ preventScroll: !0 }), C(null);
28
+ };
29
+ r(() => {
30
+ createImageBitmap(c).then(m);
31
+ }, [c]), r(() => D(), [p, y]);
32
+ let D = (e) => {
33
+ let t = f.current;
34
+ if (!t || !p) return;
35
+ t.width = p.width, t.height = p.height;
36
+ let n = t.getContext("2d");
37
+ n.drawImage(p, 0, 0);
38
+ for (let t of e ? [...y, e] : y) l(n, t, p);
39
+ }, O = (e) => {
40
+ let t = f.current, n = t.getBoundingClientRect();
41
+ return [Math.round((e.clientX - n.left) / n.width * t.width), Math.round((e.clientY - n.top) / n.height * t.height)];
42
+ };
43
+ return /* @__PURE__ */ n("div", {
44
+ class: "ck-markup",
45
+ ref: T,
46
+ tabIndex: -1,
47
+ role: "dialog",
48
+ "aria-label": e("markup"),
49
+ "data-commentkit-ui": !0,
50
+ onKeyDown: (e) => {
51
+ e.key === "Escape" && (e.stopPropagation(), S ? (T.current?.focus({ preventScroll: !0 }), C(null)) : d());
52
+ },
53
+ children: [
54
+ /* @__PURE__ */ n("div", {
55
+ class: "ck-markup-tools",
56
+ children: [
57
+ [
58
+ "arrow",
59
+ "rect",
60
+ "pen",
61
+ "blur",
62
+ "text"
63
+ ].map((t) => /* @__PURE__ */ n("button", {
64
+ class: "ck-chip",
65
+ "aria-pressed": h === t,
66
+ onClick: () => g(t),
67
+ children: e(`tool_${t}`)
68
+ })),
69
+ o.map((t, r) => /* @__PURE__ */ n("button", {
70
+ class: "ck-chip",
71
+ "aria-pressed": _ === t,
72
+ "aria-label": e(s[r]),
73
+ style: {
74
+ width: "28px",
75
+ padding: 0,
76
+ background: t
77
+ },
78
+ onClick: () => v(t)
79
+ })),
80
+ /* @__PURE__ */ n("button", {
81
+ class: "ck-chip",
82
+ disabled: !y.length,
83
+ onClick: () => b(y.slice(0, -1)),
84
+ children: e("undo")
85
+ }),
86
+ /* @__PURE__ */ n("button", {
87
+ class: "ck-chip",
88
+ onClick: d,
89
+ children: e("cancel")
90
+ }),
91
+ /* @__PURE__ */ n("button", {
92
+ class: "ck-chip ck-primary",
93
+ onClick: () => {
94
+ let e = S?.text.trim().slice(0, 500), t = S && e ? {
95
+ tool: "text",
96
+ color: _,
97
+ points: [S.x, S.y],
98
+ text: e
99
+ } : null;
100
+ t && D(t), f.current?.toBlob((e) => e && u(e, t ? [...y, t] : y), "image/webp", .88);
101
+ },
102
+ children: e("markupDone")
103
+ })
104
+ ]
105
+ }),
106
+ /* @__PURE__ */ n("canvas", {
107
+ ref: f,
108
+ onPointerDown: (e) => {
109
+ let [t, n] = O(e);
110
+ h === "text" ? (e.preventDefault(), E(), C({
111
+ x: t,
112
+ y: n,
113
+ left: Math.min(e.clientX, innerWidth - 240),
114
+ top: Math.max(8, e.clientY - 18),
115
+ text: ""
116
+ })) : (x.current = {
117
+ tool: h,
118
+ color: _,
119
+ points: [
120
+ t,
121
+ n,
122
+ t,
123
+ n
124
+ ]
125
+ }, f.current?.setPointerCapture(e.pointerId));
126
+ },
127
+ onPointerMove: (e) => {
128
+ let t = x.current;
129
+ if (!t?.points) return;
130
+ let [n, r] = O(e);
131
+ t.tool === "pen" ? t.points.length < 4e3 && t.points.push(n, r) : (t.points[2] = n, t.points[3] = r), D(t);
132
+ },
133
+ onPointerUp: () => {
134
+ x.current && b([...y, x.current]), x.current = null;
135
+ }
136
+ }),
137
+ S ? /* @__PURE__ */ n("div", {
138
+ class: "ck-label-box",
139
+ style: t(S.left, S.top),
140
+ children: [/* @__PURE__ */ n("input", {
141
+ ref: w,
142
+ class: "ck-input",
143
+ maxLength: 500,
144
+ value: S.text,
145
+ placeholder: e("markupTextPrompt"),
146
+ "aria-label": e("markupTextPrompt"),
147
+ style: { color: _ },
148
+ onInput: (e) => C({
149
+ ...S,
150
+ text: e.target.value
151
+ }),
152
+ onKeyDown: (e) => {
153
+ e.key === "Enter" && (e.preventDefault(), E());
154
+ }
155
+ }), /* @__PURE__ */ n("button", {
156
+ class: "ck-chip ck-primary",
157
+ onMouseDown: (e) => e.preventDefault(),
158
+ onClick: E,
159
+ children: e("markupTextAdd")
160
+ })]
161
+ }) : null
162
+ ]
163
+ });
164
+ }
165
+ function l(e, t, n) {
166
+ let r = t.points ?? [], i = Math.max(3, Math.round(n.width / 300));
167
+ e.save(), e.strokeStyle = e.fillStyle = t.color ?? "#ff3b30", e.lineWidth = i, e.lineCap = e.lineJoin = "round";
168
+ let [a = 0, o = 0, s = 0, c = 0] = r;
169
+ switch (t.tool) {
170
+ case "rect":
171
+ e.strokeRect(Math.min(a, s), Math.min(o, c), Math.abs(s - a), Math.abs(c - o));
172
+ break;
173
+ case "arrow": {
174
+ let t = Math.atan2(c - o, s - a), n = i * 5;
175
+ e.beginPath(), e.moveTo(a, o), e.lineTo(s, c), e.stroke(), e.beginPath(), e.moveTo(s, c), e.lineTo(s - n * Math.cos(t - .45), c - n * Math.sin(t - .45)), e.lineTo(s - n * Math.cos(t + .45), c - n * Math.sin(t + .45)), e.closePath(), e.fill();
176
+ break;
177
+ }
178
+ case "pen":
179
+ e.beginPath();
180
+ for (let t = 0; t < r.length; t += 2) (t ? e.lineTo : e.moveTo).call(e, r[t], r[t + 1]);
181
+ e.stroke();
182
+ break;
183
+ case "blur": {
184
+ let t = Math.min(a, s), n = Math.min(o, c), r = Math.abs(s - a), i = Math.abs(c - o);
185
+ if (r > 2 && i > 2) {
186
+ let a = Math.max(8, Math.round(Math.min(r, i) / 6)), o = e.getImageData(t, n, r, i);
187
+ for (let s = 0; s < i; s += a) for (let i = 0; i < r; i += a) {
188
+ let c = (s * r + i) * 4;
189
+ e.fillStyle = `rgb(${o.data[c]},${o.data[c + 1]},${o.data[c + 2]})`, e.fillRect(t + i, n + s, a, a);
190
+ }
191
+ }
192
+ break;
193
+ }
194
+ case "text": e.font = `bold ${i * 6}px system-ui, sans-serif`, e.lineWidth = i * 1.5, e.strokeStyle = "#ffffff", e.strokeText(t.text ?? "", a, o), e.fillText(t.text ?? "", a, o);
195
+ }
196
+ e.restore();
197
+ }
198
+ //#endregion
199
+ export { c as MarkupEditor };
@@ -0,0 +1,399 @@
1
+ import { a as e, i as t, r as n } from "./src-DujplxfI.js";
2
+ import { r } from "./client-D1NizpDK.js";
3
+ import { r as i } from "./anchor-DT-Ynhh1.js";
4
+ import { d as a, f as o, h as s, i as ee, l as c, n as l, p as u, s as d, u as f, y as p } from "./format-Bw_tNOh9.js";
5
+ import { c as te, l as m, n as ne, s as h } from "./mount-5fFig0k6.js";
6
+ //#region src/ui/Panel.tsx
7
+ function g({ client: g, side: y, onClose: x, onOpen: ie }) {
8
+ let S = m(g.state, (e) => e.threads), C = m(g.state, (e) => e.unread), w = m(g.state, (e) => e.allBranches), T = m(g.state, (e) => e.here), E = m(g.state, (e) => e.session), ae = m(g.state, (e) => e.config?.read_only ?? !1), D = g.options.branch, oe = te(), [O, k] = s(C > 0 ? "inbox" : "page"), [A, j] = s({ state: "loading" }), [M, N] = s({ state: "loading" }), [P, F] = s(""), [I, se] = s("active"), [L, R] = s(0), [z, B] = s(""), [V, H] = s(null), [U, W] = s(!1), [G, ce] = s({
9
+ people: [],
10
+ labels: []
11
+ }), K = u(null), q = u(null);
12
+ o(() => q.current?.querySelector("[aria-selected=true]")?.focus({ preventScroll: !0 }), []);
13
+ let J = !!(P || z || V), Y = !!E && E.role !== "guest";
14
+ o(() => {
15
+ if (O === "inbox" || O === "page" && !J) return;
16
+ j({ state: "loading" });
17
+ let e = setTimeout(() => {
18
+ g.listThreads({
19
+ q: P || void 0,
20
+ status: O === "page" ? "active" : I,
21
+ branch: g.branchFilter(),
22
+ page_url: O === "page" ? r() : void 0,
23
+ assignee: z || void 0,
24
+ label: V ?? void 0
25
+ }).then((e) => j({
26
+ state: "ready",
27
+ data: e.data.filter((e) => re(e, z, V, E))
28
+ }), () => j({ state: "error" }));
29
+ }, P ? 250 : 0);
30
+ return () => clearTimeout(e);
31
+ }, [
32
+ O,
33
+ P,
34
+ I,
35
+ L,
36
+ w,
37
+ z,
38
+ V,
39
+ J
40
+ ]), o(() => {
41
+ !U || G.people.length || G.labels.length || Promise.all([g.people().catch(() => []), g.labels().catch(() => [])]).then(([e, t]) => ce({
42
+ people: e.filter((e) => e.assignable && e.id !== null),
43
+ labels: t
44
+ }));
45
+ }, [U]), o(() => {
46
+ O === "inbox" && g.inbox().then((e) => N({
47
+ state: "ready",
48
+ data: e
49
+ }), () => N({ state: "error" }));
50
+ }, [
51
+ O,
52
+ C,
53
+ L
54
+ ]);
55
+ let X = (e) => ne("page" in e ? e.page.url : e.page_url, "page" in e ? e.id : e.thread_id, ie), Z = (e) => h(e, ".ck-item", !0), Q = () => R((e) => e + 1), $ = O === "page" && !J ? {
56
+ state: "ready",
57
+ data: S
58
+ } : A, le = [
59
+ [
60
+ "page",
61
+ "thisPage",
62
+ S.length
63
+ ],
64
+ [
65
+ "all",
66
+ "allPages",
67
+ null
68
+ ],
69
+ [
70
+ "inbox",
71
+ "notifications",
72
+ C || null
73
+ ]
74
+ ];
75
+ return /* @__PURE__ */ a("aside", {
76
+ class: "ck-panel",
77
+ "data-side": y,
78
+ "aria-label": e("inbox"),
79
+ "data-commentkit-ui": !0,
80
+ onKeyDown: (e) => e.key === "Escape" && x(),
81
+ children: [
82
+ /* @__PURE__ */ a("div", {
83
+ class: "ck-card-head",
84
+ children: [
85
+ /* @__PURE__ */ a("span", {
86
+ class: "ck-card-title",
87
+ children: e("inbox")
88
+ }),
89
+ T > 1 ? /* @__PURE__ */ a("span", {
90
+ class: "ck-here",
91
+ role: "status",
92
+ children: [/* @__PURE__ */ a("span", {
93
+ "aria-hidden": "true",
94
+ class: "ck-dot"
95
+ }), n("peopleHere", T)]
96
+ }) : null,
97
+ /* @__PURE__ */ a("button", {
98
+ class: "ck-ghost",
99
+ onClick: x,
100
+ "aria-label": e("close"),
101
+ children: /* @__PURE__ */ a(l, { name: "close" })
102
+ })
103
+ ]
104
+ }),
105
+ /* @__PURE__ */ a("div", {
106
+ class: "ck-tabs",
107
+ role: "tablist",
108
+ ref: q,
109
+ onKeyDown: (e) => h(e, "[role=tab]"),
110
+ children: le.map(([t, n, r]) => /* @__PURE__ */ a("button", {
111
+ role: "tab",
112
+ id: `ck-tab-${t}`,
113
+ "aria-controls": "ck-tabpanel",
114
+ class: "ck-tab",
115
+ "aria-selected": O === t,
116
+ tabIndex: O === t ? 0 : -1,
117
+ onClick: () => k(t),
118
+ onFocus: () => k(t),
119
+ children: [
120
+ e(n),
121
+ " ",
122
+ r ? /* @__PURE__ */ a("span", {
123
+ class: "ck-count",
124
+ children: r
125
+ }) : null
126
+ ]
127
+ }))
128
+ }),
129
+ oe ? null : /* @__PURE__ */ a("div", {
130
+ class: "ck-note",
131
+ "data-tone": "warning",
132
+ role: "status",
133
+ children: e("offline")
134
+ }),
135
+ ae ? /* @__PURE__ */ a("div", {
136
+ class: "ck-note ck-pad-x",
137
+ role: "status",
138
+ children: e("readOnlyShort")
139
+ }) : null,
140
+ D && O !== "inbox" ? /* @__PURE__ */ a("div", {
141
+ class: "ck-branchbar",
142
+ role: "group",
143
+ "aria-label": e("branchFilter"),
144
+ children: [/* @__PURE__ */ a("button", {
145
+ class: "ck-chip",
146
+ "aria-pressed": !w,
147
+ onClick: () => void g.setAllBranches(!1).catch(() => void 0),
148
+ title: D,
149
+ children: e("thisBranch", { branch: b(D) })
150
+ }), /* @__PURE__ */ a("button", {
151
+ class: "ck-chip",
152
+ "aria-pressed": w,
153
+ onClick: () => void g.setAllBranches(!0).catch(() => void 0),
154
+ children: e("allBranches")
155
+ })]
156
+ }) : null,
157
+ O === "inbox" ? null : /* @__PURE__ */ a(p, { children: [
158
+ /* @__PURE__ */ a("div", {
159
+ class: "ck-filters",
160
+ children: [/* @__PURE__ */ a("input", {
161
+ class: "ck-input",
162
+ type: "search",
163
+ "aria-label": e("search"),
164
+ placeholder: e("search"),
165
+ value: P,
166
+ onInput: (e) => F(e.target.value),
167
+ onKeyDown: (e) => e.stopPropagation()
168
+ }), O === "all" ? /* @__PURE__ */ a("select", {
169
+ class: "ck-input",
170
+ "aria-label": e("statusFilter"),
171
+ value: I,
172
+ onChange: (e) => se(e.target.value),
173
+ children: [
174
+ /* @__PURE__ */ a("option", {
175
+ value: "active",
176
+ children: e("status_open")
177
+ }),
178
+ /* @__PURE__ */ a("option", {
179
+ value: "in_review",
180
+ children: e("status_in_review")
181
+ }),
182
+ /* @__PURE__ */ a("option", {
183
+ value: "resolved,closed",
184
+ children: e("status_resolved")
185
+ }),
186
+ /* @__PURE__ */ a("option", {
187
+ value: "all",
188
+ children: e("allStatuses")
189
+ })
190
+ ]
191
+ }) : null]
192
+ }),
193
+ /* @__PURE__ */ a("div", {
194
+ class: "ck-branchbar",
195
+ children: [Y ? /* @__PURE__ */ a("button", {
196
+ class: "ck-chip",
197
+ "aria-pressed": z === "me",
198
+ onClick: () => B(z === "me" ? "" : "me"),
199
+ children: e("assignedToMe")
200
+ }) : null, /* @__PURE__ */ a("button", {
201
+ class: "ck-chip",
202
+ "aria-expanded": U,
203
+ "aria-controls": "ck-more-filters",
204
+ onClick: () => W(!U),
205
+ children: [e("filters"), z || V ? " •" : ""]
206
+ })]
207
+ }),
208
+ U ? /* @__PURE__ */ a("div", {
209
+ class: "ck-filters",
210
+ id: "ck-more-filters",
211
+ children: [Y ? /* @__PURE__ */ a("select", {
212
+ class: "ck-input",
213
+ "aria-label": e("assigneeFilter"),
214
+ value: z,
215
+ onChange: (e) => B(e.target.value),
216
+ children: [
217
+ /* @__PURE__ */ a("option", {
218
+ value: "",
219
+ children: e("anyone")
220
+ }),
221
+ /* @__PURE__ */ a("option", {
222
+ value: "me",
223
+ children: e("assignedToMe")
224
+ }),
225
+ /* @__PURE__ */ a("option", {
226
+ value: "none",
227
+ children: e("unassigned")
228
+ }),
229
+ G.people.map((e) => /* @__PURE__ */ a("option", {
230
+ value: String(e.id),
231
+ children: e.name
232
+ }))
233
+ ]
234
+ }) : null, /* @__PURE__ */ a("select", {
235
+ class: "ck-input",
236
+ "aria-label": e("labelFilter"),
237
+ value: V === null ? "" : String(V),
238
+ onChange: (e) => {
239
+ let t = e.target.value;
240
+ H(t ? Number(t) : null);
241
+ },
242
+ children: [/* @__PURE__ */ a("option", {
243
+ value: "",
244
+ children: e("anyLabel")
245
+ }), G.labels.map((e) => /* @__PURE__ */ a("option", {
246
+ value: String(e.id),
247
+ children: e.name
248
+ }))]
249
+ })]
250
+ }) : null
251
+ ] }),
252
+ /* @__PURE__ */ a("div", {
253
+ class: "ck-card-body",
254
+ id: "ck-tabpanel",
255
+ role: "tabpanel",
256
+ "aria-labelledby": `ck-tab-${O}`,
257
+ style: { padding: 0 },
258
+ "aria-busy": (O === "inbox" ? M : $).state === "loading",
259
+ children: O === "inbox" ? /* @__PURE__ */ a(_, {
260
+ load: M,
261
+ onRetry: Q,
262
+ empty: /* @__PURE__ */ a("strong", { children: e("allCaughtUp") }),
263
+ children: (n) => /* @__PURE__ */ a(p, { children: [/* @__PURE__ */ a("ul", {
264
+ class: "ck-list",
265
+ ref: K,
266
+ onKeyDown: Z,
267
+ children: n.map((e) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a("button", {
268
+ class: "ck-item",
269
+ "data-unread": !e.read,
270
+ onClick: () => X(e),
271
+ children: [/* @__PURE__ */ a("div", {
272
+ class: "ck-item-top",
273
+ children: [
274
+ /* @__PURE__ */ a("strong", { children: /* @__PURE__ */ a("bdi", { children: e.actor.name }) }),
275
+ " ",
276
+ v(e.kind),
277
+ e.reference ? ` · ${e.reference}` : "",
278
+ /* @__PURE__ */ a("span", { class: "ck-spacer" }),
279
+ t(e.created_at)
280
+ ]
281
+ }), e.excerpt ? /* @__PURE__ */ a("div", {
282
+ class: "ck-item-text",
283
+ children: e.excerpt
284
+ }) : null]
285
+ }) }))
286
+ }), C ? /* @__PURE__ */ a("div", {
287
+ class: "ck-pad",
288
+ children: /* @__PURE__ */ a("button", {
289
+ class: "ck-btn",
290
+ onClick: () => void g.markRead({ all: !0 }).then(Q),
291
+ children: e("markAllRead")
292
+ })
293
+ }) : null] })
294
+ }) : /* @__PURE__ */ a(_, {
295
+ load: $,
296
+ onRetry: Q,
297
+ empty: /* @__PURE__ */ a(p, { children: [/* @__PURE__ */ a("strong", { children: e("nothingHere") }), e("nothingHereHint")] }),
298
+ children: (r) => /* @__PURE__ */ a("ul", {
299
+ class: "ck-list",
300
+ ref: K,
301
+ onKeyDown: Z,
302
+ children: r.map((r) => {
303
+ let o = O === "page" && i(r.anchor).state === "detached", s = o ? c(r.capture?.screenshot?.thumbnail_url, "image") : null;
304
+ return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a("button", {
305
+ class: "ck-item",
306
+ onClick: () => X(r),
307
+ children: [
308
+ /* @__PURE__ */ a("div", {
309
+ class: "ck-item-top",
310
+ children: [
311
+ /* @__PURE__ */ a("strong", { children: r.reference }),
312
+ /* @__PURE__ */ a(ee, { status: r.status }),
313
+ d(r) ? /* @__PURE__ */ a("span", {
314
+ class: "ck-badge-soft",
315
+ title: `${e(`screen_${f(r.breakpoint)}`)} (${r.breakpoint}px)`,
316
+ children: e(`size_${f(r.breakpoint)}`)
317
+ }) : null,
318
+ o ? /* @__PURE__ */ a("span", {
319
+ class: "ck-badge-soft",
320
+ title: e("detached"),
321
+ children: e("notOnPage")
322
+ }) : null,
323
+ /* @__PURE__ */ a("span", { class: "ck-spacer" }),
324
+ t(r.last_activity_at)
325
+ ]
326
+ }),
327
+ /* @__PURE__ */ a("div", {
328
+ class: "ck-item-text",
329
+ children: r.first_message?.body
330
+ }),
331
+ s ? /* @__PURE__ */ a("img", {
332
+ class: "ck-item-shot",
333
+ src: s,
334
+ alt: e("screenshot"),
335
+ loading: "lazy"
336
+ }) : null,
337
+ /* @__PURE__ */ a("div", {
338
+ class: "ck-muted",
339
+ children: [
340
+ /* @__PURE__ */ a("bdi", { children: r.author.name }),
341
+ O === "all" ? /* @__PURE__ */ a(p, { children: [" · ", /* @__PURE__ */ a("bdi", { children: r.page.title || r.page.path })] }) : "",
342
+ " · ",
343
+ n("messageCount", r.message_count),
344
+ w && r.page.branch && r.page.branch !== D ? ` · ${e("onBranch", { branch: b(r.page.branch) })}` : ""
345
+ ]
346
+ })
347
+ ]
348
+ }) });
349
+ })
350
+ })
351
+ })
352
+ })
353
+ ]
354
+ });
355
+ }
356
+ function _({ load: t, onRetry: n, empty: r, children: i }) {
357
+ return t.state === "loading" ? /* @__PURE__ */ a("div", {
358
+ class: "ck-empty",
359
+ role: "status",
360
+ children: e("loadingEarlier")
361
+ }) : t.state === "error" ? /* @__PURE__ */ a("div", {
362
+ class: "ck-empty",
363
+ role: "alert",
364
+ children: [e("loadFailed"), /* @__PURE__ */ a("button", {
365
+ class: "ck-btn",
366
+ onClick: n,
367
+ children: e("retry")
368
+ })]
369
+ }) : t.data.length ? /* @__PURE__ */ a(p, { children: i(t.data) }) : /* @__PURE__ */ a("div", {
370
+ class: "ck-empty",
371
+ children: r
372
+ });
373
+ }
374
+ function v(t) {
375
+ let n = `kind_${t}`;
376
+ return /^kind_[a-z_]+$/.test(n) && n in y ? e(n) : t.replace(/_/g, " ");
377
+ }
378
+ var y = {
379
+ kind_mention: !0,
380
+ kind_reply: !0,
381
+ kind_assigned: !0,
382
+ kind_ready_for_review: !0,
383
+ kind_reopened: !0,
384
+ kind_resolved: !0,
385
+ kind_closed: !0,
386
+ kind_new_feedback: !0,
387
+ kind_due_soon: !0,
388
+ kind_overdue: !0,
389
+ kind_agent_request: !0
390
+ };
391
+ function b(e) {
392
+ return e.length > 28 ? `${e.slice(0, 27)}…` : e;
393
+ }
394
+ function re(e, t, n, r) {
395
+ let i = e.assignee;
396
+ return n !== null && e.labels && !e.labels.some((e) => e.id === n) ? !1 : t === "none" ? !i : t === "me" ? !!i && !!r && i.id === r.person.id && i.type === r.person.type : !t || i?.id === t;
397
+ }
398
+ //#endregion
399
+ export { g as Panel };
@@ -0,0 +1,56 @@
1
+ import { a as e } from "./src-DujplxfI.js";
2
+ import { d as t, f as n, n as r, p as i } from "./format-Bw_tNOh9.js";
3
+ //#region src/ui/Shortcuts.tsx
4
+ var a = [
5
+ ["C", "shortcutComment"],
6
+ ["J / K", "shortcutNext"],
7
+ ["E", "shortcutResolve"],
8
+ ["Esc", "shortcutClose"],
9
+ ["⌘ / Ctrl + Enter", "shortcutSend"],
10
+ ["⌘ / Ctrl + Shift + K", "shortcutToggle"],
11
+ ["?", "shortcutHelp"]
12
+ ];
13
+ function o({ onClose: o }) {
14
+ let s = i(null);
15
+ return n(() => {
16
+ let e = s.current?.getRootNode()?.activeElement ?? document.activeElement;
17
+ return s.current?.focus({ preventScroll: !0 }), () => {
18
+ e instanceof HTMLElement && e.isConnected && e.focus({ preventScroll: !0 });
19
+ };
20
+ }, []), /* @__PURE__ */ t("div", {
21
+ class: "ck-scrim",
22
+ "data-commentkit-ui": !0,
23
+ onClick: (e) => e.target === e.currentTarget && o(),
24
+ children: /* @__PURE__ */ t("div", {
25
+ class: "ck-card ck-dialog",
26
+ role: "dialog",
27
+ "aria-modal": "true",
28
+ "aria-labelledby": "ck-shortcuts-title",
29
+ onKeyDown: (e) => {
30
+ e.stopPropagation(), e.key === "Escape" || e.key === "?" ? (e.preventDefault(), o()) : e.key === "Tab" && (e.preventDefault(), s.current?.focus());
31
+ },
32
+ children: [/* @__PURE__ */ t("div", {
33
+ class: "ck-card-head",
34
+ children: [/* @__PURE__ */ t("h2", {
35
+ class: "ck-card-title",
36
+ id: "ck-shortcuts-title",
37
+ children: e("shortcutsTitle")
38
+ }), /* @__PURE__ */ t("button", {
39
+ class: "ck-ghost",
40
+ ref: s,
41
+ "aria-label": e("close"),
42
+ onClick: o,
43
+ children: /* @__PURE__ */ t(r, { name: "close" })
44
+ })]
45
+ }), /* @__PURE__ */ t("dl", {
46
+ class: "ck-card-body ck-keys",
47
+ children: a.map(([n, r]) => /* @__PURE__ */ t("div", { children: [/* @__PURE__ */ t("dt", { children: /* @__PURE__ */ t("kbd", {
48
+ dir: "ltr",
49
+ children: n
50
+ }) }), /* @__PURE__ */ t("dd", { children: e(r) })] }))
51
+ })]
52
+ })
53
+ });
54
+ }
55
+ //#endregion
56
+ export { o as Shortcuts };