@commentkit/comment-kit 1.0.0-beta.0 → 1.0.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 (52) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +99 -7
  3. package/SECURITY.md +7 -2
  4. package/dist/npm/chunks/Guest-VNoofLxw.js +157 -0
  5. package/dist/npm/chunks/MarkupEditor-DTXrS3DD.js +199 -0
  6. package/dist/npm/chunks/Panel-B88JYH52.js +438 -0
  7. package/dist/npm/chunks/Shortcuts-BSOKdMHt.js +56 -0
  8. package/dist/npm/chunks/ThreadCard-izybwXIC.js +817 -0
  9. package/dist/npm/chunks/ar-O7EPv0mI.js +222 -0
  10. package/dist/npm/chunks/art-DK1JwPIo.js +155 -0
  11. package/dist/npm/chunks/{client-D1vrh_5G.js → client-Iegfv6ZC.js} +95 -65
  12. package/dist/npm/chunks/de-PGyZVNHX.js +211 -0
  13. package/dist/npm/chunks/es-Bq1idl8M.js +211 -0
  14. package/dist/npm/chunks/extension-B7SelsS0.js +54 -0
  15. package/dist/npm/chunks/extension-DSA8S8Qz.js +26 -0
  16. package/dist/npm/chunks/format-B5tJGtPC.js +524 -0
  17. package/dist/npm/chunks/fr-BVB9GGco.js +211 -0
  18. package/dist/npm/chunks/hi-DyBvrjzQ.js +211 -0
  19. package/dist/npm/chunks/{html2canvas-_mjSRP3G.js → html2canvas-DfGb8yka.js} +1145 -1132
  20. package/dist/npm/chunks/it-BlMMMwZh.js +211 -0
  21. package/dist/npm/chunks/ja-lAioBCJv.js +211 -0
  22. package/dist/npm/chunks/live-YFyP1GnP.js +34 -0
  23. package/dist/npm/chunks/mount-Dx_8NhX3.js +1484 -0
  24. package/dist/npm/chunks/nl-DR8mLHnn.js +211 -0
  25. package/dist/npm/chunks/privacy-DLhezjyi.js +30 -0
  26. package/dist/npm/chunks/pt-BR-D7j6aDPx.js +211 -0
  27. package/dist/npm/chunks/{pusher-DRKlokR8.js → pusher-BSsQoE1K.js} +1 -1
  28. package/dist/npm/chunks/realtime-CBRW9BB3.js +34 -0
  29. package/dist/npm/chunks/report-DoDVi1qT.js +28 -0
  30. package/dist/npm/chunks/{rolldown-runtime-VHNaYcLd.js → rolldown-runtime-Y_bBpyJl.js} +10 -3
  31. package/dist/npm/chunks/src-C1Qp94nr.js +549 -0
  32. package/dist/npm/chunks/zh-CN-tzYg9NPH.js +211 -0
  33. package/dist/npm/element.js +28 -11
  34. package/dist/npm/headless.js +2 -2
  35. package/dist/npm/index.js +3 -3
  36. package/dist/npm/react.js +12 -3
  37. package/dist/npm/svelte.js +12 -3
  38. package/dist/npm/types/adapters/react.d.ts +2 -0
  39. package/dist/npm/types/adapters/svelte.d.ts +1 -1
  40. package/dist/npm/types/adapters/vue.d.ts +72 -0
  41. package/dist/npm/types/anchor/index.d.ts +0 -1
  42. package/dist/npm/types/core/api.d.ts +2 -0
  43. package/dist/npm/types/core/auth.d.ts +42 -5
  44. package/dist/npm/types/core/client.d.ts +22 -7
  45. package/dist/npm/types/core/types.d.ts +50 -6
  46. package/dist/npm/types/element.d.ts +4 -1
  47. package/dist/npm/types/index.d.ts +3 -1
  48. package/dist/npm/vue.js +46 -7
  49. package/package.json +8 -2
  50. package/dist/npm/chunks/mount-Ce1MZrcm.js +0 -2485
  51. package/dist/npm/chunks/realtime-5SvAvTUU.js +0 -23
  52. package/dist/npm/chunks/src-DJjfvVsa.js +0 -330
@@ -0,0 +1,199 @@
1
+ import { o as e } from "./src-C1Qp94nr.js";
2
+ import { a as t, d as n, f as r, h as i, p as a } from "./format-B5tJGtPC.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,438 @@
1
+ import { a as e, i as t, n, o as r } from "./src-C1Qp94nr.js";
2
+ import { r as i } from "./client-Iegfv6ZC.js";
3
+ import { r as a } from "./anchor-DT-Ynhh1.js";
4
+ import { d as o, f as s, h as c, i as ee, l as te, n as ne, p as l, s as re, u, y as d } from "./format-B5tJGtPC.js";
5
+ import { t as f } from "./art-DK1JwPIo.js";
6
+ import { c as p, l as m, n as h, u as g } from "./mount-Dx_8NhX3.js";
7
+ //#region src/ui/Panel.tsx
8
+ function _({ client: n, side: f, dock: _ = "bottom", onClose: y, onOpen: ae }) {
9
+ let S = g(n.state, (e) => e.threads), C = g(n.state, (e) => e.unread), w = g(n.state, (e) => e.allBranches), T = g(n.state, (e) => e.here), E = g(n.state, (e) => e.session), oe = g(n.state, (e) => e.config?.read_only ?? !1), D = n.options.branch, se = m(), [O, k] = c(C > 0 ? "inbox" : "page"), [ce, A] = c({ state: "loading" }), [j, M] = c({ state: "loading" }), [N, P] = c(""), [F, I] = c("active"), [L, le] = c(0), [R, z] = c(""), [B, V] = c(null), [H, U] = c(!1), [W, ue] = c({
10
+ people: [],
11
+ labels: []
12
+ }), G = l(null), K = l(null);
13
+ s(() => K.current?.querySelector("[aria-selected=true]")?.focus({ preventScroll: !0 }), []);
14
+ let q = !!(N || R || B), J = q || F !== "active", de = () => {
15
+ P(""), I("active"), z(""), V(null);
16
+ }, Y = !!E && E.role !== "guest";
17
+ s(() => {
18
+ if (O === "inbox" || O === "page" && !q) return;
19
+ A({ state: "loading" });
20
+ let e = setTimeout(() => {
21
+ n.listThreads({
22
+ q: N || void 0,
23
+ status: O === "page" ? "active" : F,
24
+ branch: n.branchFilter(),
25
+ page_url: O === "page" ? i() : void 0,
26
+ assignee: R || void 0,
27
+ label: B ?? void 0
28
+ }).then((e) => A({
29
+ state: "ready",
30
+ data: e.data.filter((e) => x(e, R, B, E))
31
+ }), () => A({ state: "error" }));
32
+ }, N ? 250 : 0);
33
+ return () => clearTimeout(e);
34
+ }, [
35
+ O,
36
+ N,
37
+ F,
38
+ L,
39
+ w,
40
+ R,
41
+ B,
42
+ q
43
+ ]), s(() => {
44
+ !H || W.people.length || W.labels.length || Promise.all([n.people().catch(() => []), n.labels().catch(() => [])]).then(([e, t]) => ue({
45
+ people: e.filter((e) => e.assignable && e.id !== null),
46
+ labels: t
47
+ }));
48
+ }, [H]), s(() => {
49
+ O === "inbox" && n.inbox().then((e) => M({
50
+ state: "ready",
51
+ data: e
52
+ }), () => M({ state: "error" }));
53
+ }, [
54
+ O,
55
+ C,
56
+ L
57
+ ]);
58
+ let X = (e) => h("page" in e ? e.page.url : e.page_url, "page" in e ? e.id : e.thread_id, ae), Z = (e) => p(e, ".ck-item", !0), Q = () => le((e) => e + 1), $ = O === "page" && !q ? {
59
+ state: "ready",
60
+ data: S
61
+ } : ce, fe = [
62
+ [
63
+ "page",
64
+ "thisPage",
65
+ S.length
66
+ ],
67
+ [
68
+ "all",
69
+ "allPages",
70
+ null
71
+ ],
72
+ [
73
+ "inbox",
74
+ "notifications",
75
+ C || null
76
+ ]
77
+ ];
78
+ return /* @__PURE__ */ o("aside", {
79
+ class: "ck-panel",
80
+ "data-side": f,
81
+ "data-dock": _,
82
+ "aria-label": r("inbox"),
83
+ "data-commentkit-ui": !0,
84
+ onKeyDown: (e) => e.key === "Escape" && y(),
85
+ children: [
86
+ /* @__PURE__ */ o("div", {
87
+ class: "ck-card-head",
88
+ children: [
89
+ /* @__PURE__ */ o("span", {
90
+ class: "ck-card-title",
91
+ children: r("inbox")
92
+ }),
93
+ T > 1 ? /* @__PURE__ */ o("span", {
94
+ class: "ck-here",
95
+ role: "status",
96
+ children: [/* @__PURE__ */ o("span", {
97
+ "aria-hidden": "true",
98
+ class: "ck-dot"
99
+ }), t("peopleHere", T)]
100
+ }) : null,
101
+ /* @__PURE__ */ o("button", {
102
+ class: "ck-ghost",
103
+ onClick: y,
104
+ "aria-label": r("close"),
105
+ children: /* @__PURE__ */ o(ne, { name: "close" })
106
+ })
107
+ ]
108
+ }),
109
+ /* @__PURE__ */ o("div", {
110
+ class: "ck-tabs",
111
+ role: "tablist",
112
+ ref: K,
113
+ onKeyDown: (e) => p(e, "[role=tab]"),
114
+ children: fe.map(([e, t, n]) => /* @__PURE__ */ o("button", {
115
+ role: "tab",
116
+ id: `ck-tab-${e}`,
117
+ "aria-controls": "ck-tabpanel",
118
+ class: "ck-tab",
119
+ "aria-selected": O === e,
120
+ tabIndex: O === e ? 0 : -1,
121
+ onClick: () => k(e),
122
+ onFocus: () => k(e),
123
+ children: [
124
+ r(t),
125
+ " ",
126
+ n ? /* @__PURE__ */ o("span", {
127
+ class: "ck-count",
128
+ children: n
129
+ }) : null
130
+ ]
131
+ }))
132
+ }),
133
+ se ? null : /* @__PURE__ */ o("div", {
134
+ class: "ck-note",
135
+ "data-tone": "warning",
136
+ role: "status",
137
+ children: r("offline")
138
+ }),
139
+ oe ? /* @__PURE__ */ o("div", {
140
+ class: "ck-note ck-pad-x",
141
+ role: "status",
142
+ children: r("readOnlyShort")
143
+ }) : null,
144
+ D && O !== "inbox" ? /* @__PURE__ */ o("div", {
145
+ class: "ck-branchbar",
146
+ role: "group",
147
+ "aria-label": r("branchFilter"),
148
+ children: [/* @__PURE__ */ o("button", {
149
+ class: "ck-chip",
150
+ "aria-pressed": !w,
151
+ onClick: () => void n.setAllBranches(!1).catch(() => void 0),
152
+ title: D,
153
+ children: r("thisBranch", { branch: b(D) })
154
+ }), /* @__PURE__ */ o("button", {
155
+ class: "ck-chip",
156
+ "aria-pressed": w,
157
+ onClick: () => void n.setAllBranches(!0).catch(() => void 0),
158
+ children: r("allBranches")
159
+ })]
160
+ }) : null,
161
+ O === "inbox" ? null : /* @__PURE__ */ o(d, { children: [
162
+ /* @__PURE__ */ o("div", {
163
+ class: "ck-filters",
164
+ children: [/* @__PURE__ */ o("input", {
165
+ class: "ck-input",
166
+ type: "search",
167
+ "aria-label": r("search"),
168
+ placeholder: r("search"),
169
+ value: N,
170
+ onInput: (e) => P(e.target.value),
171
+ onKeyDown: (e) => e.stopPropagation()
172
+ }), O === "all" ? /* @__PURE__ */ o("select", {
173
+ class: "ck-input",
174
+ "aria-label": r("statusFilter"),
175
+ value: F,
176
+ onChange: (e) => I(e.target.value),
177
+ children: [
178
+ /* @__PURE__ */ o("option", {
179
+ value: "active",
180
+ children: r("status_open")
181
+ }),
182
+ /* @__PURE__ */ o("option", {
183
+ value: "in_review",
184
+ children: r("status_in_review")
185
+ }),
186
+ /* @__PURE__ */ o("option", {
187
+ value: "resolved,closed",
188
+ children: r("status_resolved")
189
+ }),
190
+ /* @__PURE__ */ o("option", {
191
+ value: "all",
192
+ children: r("allStatuses")
193
+ })
194
+ ]
195
+ }) : null]
196
+ }),
197
+ /* @__PURE__ */ o("div", {
198
+ class: "ck-branchbar",
199
+ children: [Y ? /* @__PURE__ */ o("button", {
200
+ class: "ck-chip",
201
+ "aria-pressed": R === "me",
202
+ onClick: () => z(R === "me" ? "" : "me"),
203
+ children: r("assignedToMe")
204
+ }) : null, /* @__PURE__ */ o("button", {
205
+ class: "ck-chip",
206
+ "aria-expanded": H,
207
+ "aria-controls": "ck-more-filters",
208
+ onClick: () => U(!H),
209
+ children: [r("filters"), R || B ? " •" : ""]
210
+ })]
211
+ }),
212
+ H ? /* @__PURE__ */ o("div", {
213
+ class: "ck-filters",
214
+ id: "ck-more-filters",
215
+ children: [Y ? /* @__PURE__ */ o("select", {
216
+ class: "ck-input",
217
+ "aria-label": r("assigneeFilter"),
218
+ value: R,
219
+ onChange: (e) => z(e.target.value),
220
+ children: [
221
+ /* @__PURE__ */ o("option", {
222
+ value: "",
223
+ children: r("anyone")
224
+ }),
225
+ /* @__PURE__ */ o("option", {
226
+ value: "me",
227
+ children: r("assignedToMe")
228
+ }),
229
+ /* @__PURE__ */ o("option", {
230
+ value: "none",
231
+ children: r("unassigned")
232
+ }),
233
+ W.people.map((e) => /* @__PURE__ */ o("option", {
234
+ value: String(e.id),
235
+ children: e.name
236
+ }))
237
+ ]
238
+ }) : null, /* @__PURE__ */ o("select", {
239
+ class: "ck-input",
240
+ "aria-label": r("labelFilter"),
241
+ value: B === null ? "" : String(B),
242
+ onChange: (e) => {
243
+ let t = e.target.value;
244
+ V(t ? Number(t) : null);
245
+ },
246
+ children: [/* @__PURE__ */ o("option", {
247
+ value: "",
248
+ children: r("anyLabel")
249
+ }), W.labels.map((e) => /* @__PURE__ */ o("option", {
250
+ value: String(e.id),
251
+ children: e.name
252
+ }))]
253
+ })]
254
+ }) : null
255
+ ] }),
256
+ /* @__PURE__ */ o("div", {
257
+ class: "ck-card-body",
258
+ id: "ck-tabpanel",
259
+ role: "tabpanel",
260
+ "aria-labelledby": `ck-tab-${O}`,
261
+ style: { padding: 0 },
262
+ "aria-busy": (O === "inbox" ? j : $).state === "loading",
263
+ children: O === "inbox" ? /* @__PURE__ */ o(v, {
264
+ load: j,
265
+ onRetry: Q,
266
+ art: "caughtUp",
267
+ empty: /* @__PURE__ */ o("strong", { children: r("allCaughtUp") }),
268
+ children: (t) => /* @__PURE__ */ o(d, { children: [/* @__PURE__ */ o("ul", {
269
+ class: "ck-list",
270
+ ref: G,
271
+ onKeyDown: Z,
272
+ children: t.map((t) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("button", {
273
+ class: "ck-item",
274
+ "data-unread": !t.read,
275
+ onClick: () => X(t),
276
+ children: [/* @__PURE__ */ o("div", {
277
+ class: "ck-item-top",
278
+ children: [/* @__PURE__ */ o("span", {
279
+ class: "ck-item-tags",
280
+ children: [/* @__PURE__ */ o(ie, { item: t }), t.reference ? ` · ${t.reference}` : ""]
281
+ }), /* @__PURE__ */ o("span", {
282
+ class: "ck-time",
283
+ children: e(t.created_at)
284
+ })]
285
+ }), t.excerpt ? /* @__PURE__ */ o("div", {
286
+ class: "ck-item-text",
287
+ children: t.excerpt
288
+ }) : null]
289
+ }) }))
290
+ }), C ? /* @__PURE__ */ o("div", {
291
+ class: "ck-pad",
292
+ children: /* @__PURE__ */ o("button", {
293
+ class: "ck-btn",
294
+ onClick: () => void n.markRead({ all: !0 }).then(Q),
295
+ children: r("markAllRead")
296
+ })
297
+ }) : null] })
298
+ }) : /* @__PURE__ */ o(v, {
299
+ load: $,
300
+ onRetry: Q,
301
+ art: J ? "noMatch" : "noFeedback",
302
+ empty: J ? /* @__PURE__ */ o(d, { children: [/* @__PURE__ */ o("strong", { children: r("noMatch") }), /* @__PURE__ */ o("button", {
303
+ class: "ck-btn",
304
+ onClick: de,
305
+ children: r("clearFilters")
306
+ })] }) : /* @__PURE__ */ o(d, { children: [/* @__PURE__ */ o("strong", { children: r(O === "all" ? "nothingAnywhere" : "nothingHere") }), /* @__PURE__ */ o("span", {
307
+ class: "ck-hint",
308
+ children: r("nothingHereHint")
309
+ })] }),
310
+ children: (n) => /* @__PURE__ */ o("ul", {
311
+ class: "ck-list",
312
+ ref: G,
313
+ onKeyDown: Z,
314
+ children: n.map((n) => {
315
+ let i = O === "page" && a(n.anchor).state === "detached", s = i ? te(n.capture?.screenshot?.thumbnail_url, "image") : null;
316
+ return /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("button", {
317
+ class: "ck-item",
318
+ "data-shot": s ? "true" : void 0,
319
+ onClick: () => X(n),
320
+ children: [/* @__PURE__ */ o("div", {
321
+ class: "ck-item-main",
322
+ children: [
323
+ /* @__PURE__ */ o("div", {
324
+ class: "ck-item-top",
325
+ children: [/* @__PURE__ */ o("span", {
326
+ class: "ck-item-tags",
327
+ children: [
328
+ /* @__PURE__ */ o("strong", { children: Y ? n.reference : r("feedbackRef", { ref: n.reference }) }),
329
+ /* @__PURE__ */ o(ee, { status: n.status }),
330
+ re(n) ? /* @__PURE__ */ o("span", {
331
+ class: "ck-tag",
332
+ title: `${r(`screen_${u(n.breakpoint)}`)} (${n.breakpoint}px)`,
333
+ children: r(`size_${u(n.breakpoint)}`)
334
+ }) : null,
335
+ i ? /* @__PURE__ */ o("span", {
336
+ class: "ck-badge-soft",
337
+ title: r("detached"),
338
+ children: r("notOnPage")
339
+ }) : null
340
+ ]
341
+ }), /* @__PURE__ */ o("span", {
342
+ class: "ck-time",
343
+ children: e(n.last_activity_at)
344
+ })]
345
+ }),
346
+ /* @__PURE__ */ o("div", {
347
+ class: "ck-item-text",
348
+ children: n.first_message?.body
349
+ }),
350
+ /* @__PURE__ */ o("div", {
351
+ class: "ck-muted ck-item-meta",
352
+ children: [
353
+ /* @__PURE__ */ o("bdi", { children: n.author.name }),
354
+ O === "all" ? /* @__PURE__ */ o(d, { children: [" · ", /* @__PURE__ */ o("bdi", { children: n.page.title || n.page.path })] }) : "",
355
+ " · ",
356
+ t("messageCount", n.message_count),
357
+ w && n.page.branch && n.page.branch !== D ? ` · ${r("onBranch", { branch: b(n.page.branch) })}` : ""
358
+ ]
359
+ })
360
+ ]
361
+ }), s ? /* @__PURE__ */ o("img", {
362
+ class: "ck-item-thumb",
363
+ src: s,
364
+ alt: r("screenshot"),
365
+ loading: "lazy"
366
+ }) : null]
367
+ }) });
368
+ })
369
+ })
370
+ })
371
+ })
372
+ ]
373
+ });
374
+ }
375
+ function v({ load: e, onRetry: t, art: n, empty: i, children: a }) {
376
+ return e.state === "loading" ? /* @__PURE__ */ o("div", {
377
+ class: "ck-loading",
378
+ role: "status",
379
+ "aria-label": r("loadingEarlier"),
380
+ children: [
381
+ 0,
382
+ 1,
383
+ 2
384
+ ].map(() => /* @__PURE__ */ o("div", {
385
+ class: "ck-loading-row",
386
+ children: [
387
+ /* @__PURE__ */ o("div", { class: "ck-skeleton" }),
388
+ /* @__PURE__ */ o("div", { class: "ck-skeleton" }),
389
+ /* @__PURE__ */ o("div", { class: "ck-skeleton" })
390
+ ]
391
+ }))
392
+ }) : e.state === "error" ? /* @__PURE__ */ o("div", {
393
+ class: "ck-empty",
394
+ role: "alert",
395
+ children: [
396
+ /* @__PURE__ */ o(f, { name: "error" }),
397
+ r("loadFailed"),
398
+ /* @__PURE__ */ o("button", {
399
+ class: "ck-btn",
400
+ onClick: t,
401
+ children: r("retry")
402
+ })
403
+ ]
404
+ }) : e.data.length ? /* @__PURE__ */ o(d, { children: a(e.data) }) : /* @__PURE__ */ o("div", {
405
+ class: "ck-empty",
406
+ children: [/* @__PURE__ */ o(f, { name: n }), i]
407
+ });
408
+ }
409
+ function ie({ item: e }) {
410
+ let t = `kind_${e.kind}`, [i, a] = /^kind_[a-z_]+$/.test(t) && t in y ? n(t, "actor") : ["", ` ${e.kind.replace(/_/g, " ")}`], { type: s, name: c } = e.actor;
411
+ return /* @__PURE__ */ o(d, { children: [
412
+ i,
413
+ /* @__PURE__ */ o("strong", { children: /* @__PURE__ */ o("bdi", { children: s === "agent" || s === "integration" || s === "system" ? c : r("personName", { name: c }) }) }),
414
+ a
415
+ ] });
416
+ }
417
+ var y = {
418
+ kind_mention: !0,
419
+ kind_reply: !0,
420
+ kind_assigned: !0,
421
+ kind_ready_for_review: !0,
422
+ kind_reopened: !0,
423
+ kind_resolved: !0,
424
+ kind_closed: !0,
425
+ kind_new_feedback: !0,
426
+ kind_due_soon: !0,
427
+ kind_overdue: !0,
428
+ kind_agent_request: !0
429
+ };
430
+ function b(e) {
431
+ return e.length > 28 ? `${e.slice(0, 27)}…` : e;
432
+ }
433
+ function x(e, t, n, r) {
434
+ let i = e.assignee;
435
+ 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;
436
+ }
437
+ //#endregion
438
+ export { _ as Panel };
@@ -0,0 +1,56 @@
1
+ import { o as e } from "./src-C1Qp94nr.js";
2
+ import { d as t, f as n, n as r, p as i } from "./format-B5tJGtPC.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 };