@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,734 @@
1
+ import { a as e } from "./src-fTYV50pw.js";
2
+ import { b as t, o as n, v as r } from "./client-CULjcQxz.js";
3
+ import { a as i, c as a, o, s } from "./privacy-BWUGlHw5.js";
4
+ import { s as c } from "./anchor-BsQNVkHj.js";
5
+ import { _ as l, b as u, c as d, d as f, f as p, m, u as h, v as g } from "./i18n-CDw_D17c.js";
6
+ import { n as _, t as ee } from "./icons-BJLm_C0M.js";
7
+ import { a as te, c as ne, d as re, f as ie, g as ae, h as oe, i as se, l as ce, m as le, n as ue, o as de, p as v, t as fe } from "./uploads-CmeoNVO2.js";
8
+ import { r as pe } from "./files-BkHuRlcW.js";
9
+ import { n as me, r as he, t as ge } from "./card-bits-B94SwnS9.js";
10
+ import { i as y } from "./drafts-B0ctr1g9.js";
11
+ import { t as b } from "./states-DLMCvwes.js";
12
+ import { C as x, F as _e, M as ve, b as S, c as C, f as ye, j as be, l as xe, m as Se, p as Ce, w as we, x as Te, z as Ee } from "./start-CE5eR33Z.js";
13
+ // src/capture/context.ts
14
+ function De() {
15
+ let e = navigator.userAgent, t = w(e, [
16
+ ["Edge", /Edg\/([\d.]+)/],
17
+ ["Opera", /OPR\/([\d.]+)/],
18
+ ["Samsung Internet", /SamsungBrowser\/([\d.]+)/],
19
+ ["Chrome", /Chrome\/([\d.]+)/],
20
+ ["Firefox", /Firefox\/([\d.]+)/],
21
+ ["Safari", /Version\/([\d.]+).*Safari/]
22
+ ]), n = w(e, [
23
+ ["iOS", /(?:iPhone|iPad|iPod).*OS ([\d_]+)/],
24
+ ["Android", /Android ([\d.]+)/],
25
+ ["Windows", /Windows NT ([\d.]+)/],
26
+ ["macOS", /Mac OS X ([\d_]+)/],
27
+ ["ChromeOS", /CrOS [^ ]+ ([\d.]+)/],
28
+ ["Linux", /Linux()/]
29
+ ]), r = innerWidth, i = matchMedia?.("(pointer: coarse)").matches ?? !1;
30
+ return {
31
+ viewport: {
32
+ width: r,
33
+ height: innerHeight,
34
+ dpr: Math.round((devicePixelRatio || 1) * 100) / 100,
35
+ zoom: Math.round((visualViewport?.scale ?? 1) * 100) / 100
36
+ },
37
+ device: {
38
+ browser: t?.[0],
39
+ browser_version: t?.[1]?.split(".")[0],
40
+ os: n?.[0],
41
+ os_version: n?.[1]?.replace(/_/g, "."),
42
+ type: i ? r >= 768 ? "tablet" : "mobile" : "desktop",
43
+ locale: navigator.language,
44
+ color_scheme: matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light",
45
+ user_agent: e.slice(0, 500)
46
+ }
47
+ };
48
+ }
49
+ function w(e, t) {
50
+ for (let [n, r] of t) {
51
+ let t = e.match(r);
52
+ if (t) return [n, t[1] ?? ""];
53
+ }
54
+ return null;
55
+ }
56
+ // src/capture/screenshot.ts
57
+ var T = 8e6, E = 15e3;
58
+ function Oe() {
59
+ e() || import("./html2canvas-pro.esm-B7b8p5Wr.js").catch(() => void 0);
60
+ }
61
+ async function ke(t = {}) {
62
+ let n = (t.redact ?? []).filter(s), r = o(t.privacy), i = innerWidth, a = innerHeight, c = null;
63
+ e() && (c = await import("./extension-DpfiPOjC.js").then((e) => e.captureTab(n, r)).catch(() => null)), c ?? (c = await D(n, r, i, a));
64
+ let l = c.getContext("2d"), u = c.width / Math.max(1, i);
65
+ return l && Ae(l, u, t), t.crop && t.region && (c = k(c, u, t.region, i, a)), {
66
+ blob: await Me(c),
67
+ width: c.width,
68
+ height: c.height
69
+ };
70
+ }
71
+ async function D(e, t, n, r) {
72
+ let [{ default: o }, { captureBackground: s, normalizeCaptureColors: c, settleStylesheets: l }] = await Promise.all([import("./html2canvas-pro.esm-B7b8p5Wr.js"), import("./colors-CWAn_swA.js")]), u = a([], t), d = (t) => t.tagName === "NOSCRIPT" || i(t, u) || e.some((e) => Ne(t, e)), f = Math.min(devicePixelRatio || 1, 2, Math.sqrt(T / Math.max(1, n * r)));
73
+ return A(o(document.documentElement, {
74
+ useCORS: !0,
75
+ logging: !1,
76
+ backgroundColor: s(getComputedStyle(document.body).backgroundColor),
77
+ scale: f,
78
+ x: scrollX,
79
+ y: scrollY,
80
+ width: n,
81
+ height: r,
82
+ windowWidth: document.documentElement.clientWidth,
83
+ windowHeight: r,
84
+ ignoreElements: d,
85
+ onclone: async (e) => {
86
+ await l(e), c(e);
87
+ }
88
+ }), E);
89
+ }
90
+ function Ae(e, t, n) {
91
+ e.setTransform(1, 0, 0, 1, 0, 0);
92
+ let r = n.accent ?? "#ff5733";
93
+ if (n.region) {
94
+ let i = n.region;
95
+ e.save(), e.lineWidth = 3 * t, e.strokeStyle = r, e.setLineDash([8 * t, 6 * t]), e.strokeRect(i.x * t, i.y * t, i.w * t, i.h * t), e.restore();
96
+ }
97
+ if (n.pin) {
98
+ let i = n.pin.x * t, a = n.pin.y * t, o = 11 * t;
99
+ e.save(), e.shadowColor = "rgba(0,0,0,0.25)", e.shadowBlur = 6 * t, e.fillStyle = r, e.beginPath(), e.arc(i, a - o, o, Math.PI, 0), e.lineTo(i, a + o * .4), e.closePath(), e.fill(), e.shadowBlur = 0, e.fillStyle = "#ffffff", e.beginPath(), e.arc(i, a - o, o * .38, 0, Math.PI * 2), e.fill(), e.restore();
100
+ }
101
+ }
102
+ var O = {
103
+ w: 320,
104
+ h: 200
105
+ };
106
+ function je(e, t, n) {
107
+ let r = Math.min(t, Math.max(O.w, e.w + 64)), i = Math.min(n, Math.max(O.h, e.h + 64));
108
+ return {
109
+ x: Math.min(Math.max(0, e.x + e.w / 2 - r / 2), t - r),
110
+ y: Math.min(Math.max(0, e.y + e.h / 2 - i / 2), n - i),
111
+ w: r,
112
+ h: i
113
+ };
114
+ }
115
+ function k(e, t, n, r, i) {
116
+ let a = je(n, r, i), o = document.createElement("canvas");
117
+ return o.width = Math.max(1, Math.round(a.w * t)), o.height = Math.max(1, Math.round(a.h * t)), o.getContext("2d")?.drawImage(e, a.x * t, a.y * t, o.width, o.height, 0, 0, o.width, o.height), o;
118
+ }
119
+ function Me(e) {
120
+ return new Promise((t, n) => {
121
+ e.toBlob((r) => {
122
+ if (r && r.type === "image/webp") return t(r);
123
+ e.toBlob((e) => e ? t(e) : n(/* @__PURE__ */ Error("Could not encode the screenshot.")), "image/png");
124
+ }, "image/webp", .86);
125
+ });
126
+ }
127
+ function A(e, t) {
128
+ return new Promise((n, r) => {
129
+ let i = setTimeout(() => r(/* @__PURE__ */ Error("The screenshot took too long. Your feedback will be sent without it.")), t);
130
+ e.then((e) => (clearTimeout(i), n(e)), (e) => (clearTimeout(i), r(e)));
131
+ });
132
+ }
133
+ function Ne(e, t) {
134
+ try {
135
+ return e.matches(t) || !!e.closest(t);
136
+ } catch {
137
+ return !1;
138
+ }
139
+ }
140
+ C(b), C(re);
141
+ function Pe({ client: e, draft: i, signedIn: a, onSignIn: o, onCancel: s, onSent: re, onError: v, share: b = null, onPending: _e }) {
142
+ let C = x(e.state, (e) => e.config), w = x(e.state, (e) => e.session?.person ?? null), T = g(() => Se(e, i.anchor), [i.anchor]), [E, Oe] = l(() => He()), [D, Ae] = l(() => le(T, void 0, Se(e, i.anchor, n()))), [O, je] = l([]), [k, Me] = l(null), A = e.options.tools ?? {}, Ne = C?.features.screenshots !== !1 && A.screenshots !== !1, Pe = A.attachments !== !1, [j, We] = l(Ne ? "capturing" : "off"), N = x(e.state, (e) => !!e.session?.capabilities.triage), Ge = N && A.checklist !== !1, [P] = l(() => Ue(T)), [Ke, qe] = l(P?.task ?? {}), [F, Je] = l(P?.checklist ?? null), [I, Ye] = l(""), Xe = S(N, () => import("./TaskFields-B2-YvIwV.js").then((e) => e.TaskDraft), () => void 0), [L, Ze] = l(P?.markup ?? []), [Qe, R] = l(!1), $e = S(Qe, () => import("./MarkupEditor-BOb2jFTR.js").then((e) => e.MarkupEditor), (e) => (R(!1), v(e))), z = ue(e, (e) => v(new r(0, "file_rejected", e))), B = g(() => {
143
+ if (!N || A.style === !1 || i.anchor.type !== "element" && i.anchor.type !== "text") return null;
144
+ let e = c(i.anchor).element;
145
+ return e instanceof HTMLElement || e instanceof SVGElement ? e : null;
146
+ }, [i.anchor, N]), [V, et] = l(P?.styles ?? []), [H, tt] = l(!1), nt = S(H, () => import("./StylePanel-BZk-r-kl.js").then((e) => e.StylePanel), v), U = m(null), W = m(null), rt = () => {
147
+ B && (U.current ?? (U.current = de(B)), W.current ?? (W.current = new se(B)), tt(!0));
148
+ };
149
+ p(() => {
150
+ H ? W.current?.apply(V) : W.current?.revert();
151
+ }, [H, V]), p(() => () => W.current?.revert(), []);
152
+ let [G, it] = l(null), at = S(G !== null, () => import("./Viewer-DL6M3wAT.js").then((e) => e.Viewer), v), [K, q] = l("idle"), J = K !== "idle", [ot, st] = l(!1);
153
+ f(() => {
154
+ if (K !== "sending") return st(!1);
155
+ let e = setTimeout(() => st(!0), 1e4);
156
+ return () => clearTimeout(e);
157
+ }, [K]);
158
+ let Y = m(null), ct = m(!1), [lt, ut] = l(() => {
159
+ let e = !!y(Ce);
160
+ return y(Ce, null), e && a;
161
+ }), [dt, ft] = l(!1), pt = !!(C?.features.console_capture || C?.features.network_capture), mt = x(e.state, (e) => !e.session || e.session.role === "guest"), [ht, gt] = l(C?.features.capture_consent_default === !0 && !mt), X = Te(), _t = !a && !b, Z = !a && !!b && !e.auth.pending(), [vt, yt] = l(null), bt = {
162
+ name: m(null),
163
+ email: m(null)
164
+ }, xt = m(null), Q = m(null), St = m(null);
165
+ p(() => void (lt && St.current?.focus({ preventScroll: !0 })), []);
166
+ let Ct = () => {
167
+ y(ye, null), y(M, null);
168
+ };
169
+ p(() => () => {
170
+ Y.current?.abort(), ct.current || Ct();
171
+ }, []);
172
+ let wt = (e) => {
173
+ Y.current?.abort(), Ct(), s(e);
174
+ }, Tt = m(null);
175
+ ae(Tt);
176
+ let Et = m(null), Dt = m(null), [Ot] = l(() => (e) => {
177
+ e && !Et.current && ve(e), Et.current = e;
178
+ }), kt = m(null), At = m(null), jt = m(null), Mt = m(!1);
179
+ p(() => {
180
+ j === "off" && Mt.current && jt.current?.focus(), Mt.current = !1;
181
+ }, [j]);
182
+ let Nt = (e, t) => {
183
+ let n = e.closest(".ck-draft-item");
184
+ ((n?.nextElementSibling ?? n?.previousElementSibling)?.querySelector(".ck-draft-item button, input") ?? t())?.focus();
185
+ }, Pt = m(Promise.resolve(null));
186
+ f(() => {
187
+ if (j !== "capturing") return;
188
+ let t = !1, n = 0, r = 0;
189
+ return Pt.current = new Promise((a) => {
190
+ let o = !1, s = () => {
191
+ if (!o) {
192
+ if (o = !0, t) return a(null);
193
+ ke({
194
+ redact: [...C?.privacy.redact_selectors ?? [], ...e.options.redact ?? []],
195
+ privacy: xe(C, e.options.privacy),
196
+ pin: i.region ? null : i.point,
197
+ region: i.region,
198
+ crop: !!i.region
199
+ }).then(a, () => a(null));
200
+ }
201
+ };
202
+ n = requestAnimationFrame(() => n = requestAnimationFrame(s)), r = window.setTimeout(s, 300);
203
+ }), Pt.current.then((e) => {
204
+ t || (e && Me(e), We(e ? "ready" : "failed"));
205
+ }), () => {
206
+ t = !0, cancelAnimationFrame(n), clearTimeout(r);
207
+ };
208
+ }, []);
209
+ let $ = g(() => k && URL.createObjectURL(k.blob), [k]);
210
+ p(() => () => void ($ && URL.revokeObjectURL($)), [$]);
211
+ let Ft = (e) => {
212
+ Ae(e), oe(T, e);
213
+ };
214
+ p(() => {
215
+ Q.current = null;
216
+ }, [
217
+ D,
218
+ O,
219
+ k,
220
+ j,
221
+ L,
222
+ z.items,
223
+ ht,
224
+ Ke,
225
+ F,
226
+ V
227
+ ]);
228
+ let It = g(() => he(i.point, i.region ? {
229
+ top: i.region.y,
230
+ bottom: i.region.y + i.region.h
231
+ } : void 0), [i.point]), Lt = (e) => z.add(e), Rt = async () => {
232
+ let n = null, r = null, a = j === "capturing" ? await Pt.current : j === "ready" ? k : null;
233
+ if (a) try {
234
+ let t = a.blob.type, r = `screenshot.${t === "image/webp" ? "webp" : t === "image/jpeg" ? "jpg" : "png"}`;
235
+ n = (await e.upload(a.blob, r, "screenshot")).id;
236
+ } catch {
237
+ r = "screenshot";
238
+ }
239
+ let o = await z.ready(), s = o.ids;
240
+ o.missing && (r ?? (r = "files"));
241
+ let c = {
242
+ ...De(),
243
+ ...pt && ht ? Ee() : {},
244
+ screenshot_id: n,
245
+ markup: L.length ? L : void 0
246
+ }, l = N ? Le(Ke) : void 0, u = [...F ?? [], ...F && I.trim() ? [I.trim()] : []], d = B ? te(V) : [];
247
+ return {
248
+ key: t(16),
249
+ input: {
250
+ anchor: i.anchor,
251
+ body: D.trim(),
252
+ capture: c,
253
+ attachmentIds: s,
254
+ mentionIds: O,
255
+ task: l,
256
+ checklist: u,
257
+ styleChanges: d
258
+ },
259
+ missing: r
260
+ };
261
+ }, zt = async () => {
262
+ if (J || !D.trim() || !X) return;
263
+ ft(!1);
264
+ let t = Z ? E.name.trim() ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(E.email.trim()) ? null : "email" : "name" : null;
265
+ if (yt(t), t) return bt[t].current?.focus();
266
+ ut(!1), q("sending");
267
+ let n = !1, s = new AbortController(), c = D.trim(), l = new Set(e.state.get().threads.map((e) => e.id)), u = () => void 0;
268
+ try {
269
+ let t = !a && !b;
270
+ if (Z && b) {
271
+ let { startGuest: n } = await import("./Guest-C-ZhARI0.js");
272
+ y(Ve, JSON.stringify({
273
+ name: E.name,
274
+ email: E.email
275
+ })), t = await n(e, {
276
+ share: b,
277
+ ...E
278
+ }) === "popup";
279
+ }
280
+ if (t) {
281
+ y(ye, JSON.stringify({
282
+ draft: i,
283
+ scrollY
284
+ })), oe(T, D), y(M, JSON.stringify({
285
+ id: T,
286
+ checklist: F,
287
+ task: Ke,
288
+ markup: L,
289
+ styles: V
290
+ })), q("signing-in");
291
+ let e = await o((Y.current = new AbortController()).signal);
292
+ if (Y.current = null, St.current?.focus({ preventScroll: !0 }), e === "redirecting" ? ct.current = !0 : Ct(), e !== "signed_in") return;
293
+ q("sending");
294
+ }
295
+ let r = Q.current ?? (Q.current = await Rt()), d = (e) => {
296
+ n || (n = !0, u(), Q.current = null, ie(T), y(Ve, null), re(e, r.missing));
297
+ }, f = e.state.get().session?.person;
298
+ f && (u = e.state.subscribe(() => {
299
+ let t = e.state.get().threads.find((e) => !l.has(e.id) && e.first_message?.body === c && e.author.id === f.id);
300
+ t && !t.pending_verification && (d(t), s.abort());
301
+ }));
302
+ let p = await e.createThread({
303
+ ...r.input,
304
+ idempotencyKey: r.key,
305
+ signal: s.signal
306
+ });
307
+ if (n) return;
308
+ if (u(), Q.current = null, p.pending_verification) return _e?.(e.auth.pending()?.email ?? E.email);
309
+ d(p);
310
+ } catch (t) {
311
+ if (n) return;
312
+ if (t instanceof r && ["pending_limit", "verification_required"].includes(t.code) && e.auth.pending()) return _e?.(e.auth.pending().email);
313
+ let i = me(t);
314
+ ft(i ?? !0), i || v(t);
315
+ } finally {
316
+ u(), q("idle");
317
+ }
318
+ };
319
+ return /* @__PURE__ */ h(u, { children: [i.region ? /* @__PURE__ */ h("div", {
320
+ class: "ck-pending-region",
321
+ style: be(i.region.x, i.region.y, i.region.w, i.region.h),
322
+ "aria-hidden": "true",
323
+ "data-commentkit-ui": !0
324
+ }) : i.anchor.type === "page" ? null : /* @__PURE__ */ h("div", {
325
+ class: "ck-pending-pin",
326
+ style: be(i.point.x, i.point.y),
327
+ "aria-hidden": "true",
328
+ "data-commentkit-ui": !0,
329
+ children: [/* @__PURE__ */ h("svg", {
330
+ viewBox: "5 3 54 62",
331
+ children: /* @__PURE__ */ h("path", { d: Ie })
332
+ }), w ? /* @__PURE__ */ h(we, { person: w }) : null]
333
+ }), /* @__PURE__ */ h("div", {
334
+ class: "ck-card ck-composer",
335
+ ref: Tt,
336
+ style: It,
337
+ role: "region",
338
+ "aria-label": d("comment"),
339
+ "data-commentkit-ui": !0,
340
+ onKeyDown: (e) => e.key === "Escape" && wt(!0),
341
+ ...Pe ? pe(Lt) : {},
342
+ children: [
343
+ /* @__PURE__ */ h("div", {
344
+ class: "ck-card-body",
345
+ children: [
346
+ i.anchor.quote ? /* @__PURE__ */ h("blockquote", {
347
+ class: "ck-quote",
348
+ "aria-label": d("quotedText"),
349
+ children: /* @__PURE__ */ h("bdi", { children: i.anchor.quote.slice(0, 200) })
350
+ }) : null,
351
+ X ? null : /* @__PURE__ */ h("div", {
352
+ class: "ck-note",
353
+ "data-tone": "warning",
354
+ role: "status",
355
+ children: d("offlineSend")
356
+ }),
357
+ dt && X ? /* @__PURE__ */ h("div", {
358
+ class: "ck-note",
359
+ "data-tone": "warning",
360
+ role: "alert",
361
+ children: dt === !0 ? /* @__PURE__ */ h(u, { children: [
362
+ d("sendFailed"),
363
+ " ",
364
+ /* @__PURE__ */ h("button", {
365
+ class: "ck-btn",
366
+ onClick: () => (St.current?.focus(), void zt()),
367
+ children: d("retry")
368
+ })
369
+ ] }) : `${dt} ${d("savedHere")}`
370
+ }) : null,
371
+ /* @__PURE__ */ h(ce, {
372
+ client: e,
373
+ value: D,
374
+ onChange: Ft,
375
+ onMentions: je,
376
+ onSubmit: () => void zt(),
377
+ placeholder: d("composerPlaceholder"),
378
+ autofocus: !0,
379
+ disabled: J,
380
+ canMention: a,
381
+ tools: /* @__PURE__ */ h(u, { children: [
382
+ Pe ? /* @__PURE__ */ h(ge, {
383
+ input: xt,
384
+ onFiles: Lt,
385
+ types: C?.limits?.upload_types
386
+ }) : null,
387
+ Ge ? /* @__PURE__ */ h("button", {
388
+ ref: Dt,
389
+ class: "ck-icon ck-icon-sm",
390
+ "data-tool": "checklist",
391
+ "aria-label": d("addChecklist"),
392
+ "aria-pressed": F === null ? !1 : !F.length || void 0,
393
+ onClick: () => F?.length ? Et.current?.focus() : F === null ? Je([]) : (Ye(""), Je(null)),
394
+ children: /* @__PURE__ */ h(_, { name: "listChecks" })
395
+ }) : null,
396
+ B ? /* @__PURE__ */ h("button", {
397
+ ref: kt,
398
+ class: "ck-icon ck-icon-sm",
399
+ "data-tool": "style",
400
+ "aria-label": d("adjustStyle"),
401
+ "aria-pressed": H,
402
+ onClick: () => H ? tt(!1) : rt(),
403
+ children: /* @__PURE__ */ h(_, { name: "sliders" })
404
+ }) : null
405
+ ] })
406
+ }),
407
+ F === null ? null : /* @__PURE__ */ h("div", {
408
+ class: "ck-draft-list",
409
+ role: "group",
410
+ "aria-label": d("checklist"),
411
+ children: [F.map((e, t) => /* @__PURE__ */ h("div", {
412
+ class: "ck-draft-item",
413
+ children: [
414
+ /* @__PURE__ */ h("span", {
415
+ "aria-hidden": "true",
416
+ class: "ck-draft-box"
417
+ }),
418
+ /* @__PURE__ */ h("bdi", { children: e }),
419
+ /* @__PURE__ */ h("button", {
420
+ class: "ck-ghost ck-ghost-sm",
421
+ "aria-label": d("removeItem", { item: e }),
422
+ onClick: (e) => {
423
+ Nt(e.currentTarget, () => Et.current ?? Dt.current), Je(F.filter((e, n) => n !== t));
424
+ },
425
+ children: /* @__PURE__ */ h(_, {
426
+ name: "clear",
427
+ size: 12
428
+ })
429
+ })
430
+ ]
431
+ })), F.length < 30 ? /* @__PURE__ */ h("input", {
432
+ class: "ck-input",
433
+ maxLength: 300,
434
+ placeholder: d("checklistAdd"),
435
+ "aria-label": d("checklistAdd"),
436
+ enterKeyHint: "done",
437
+ value: I,
438
+ ref: Ot,
439
+ onInput: (e) => Ye(e.target.value),
440
+ onKeyDown: (e) => {
441
+ e.key !== "Escape" && e.stopPropagation(), e.key === "Enter" && I.trim() && (e.preventDefault(), Je([...F, I.trim()]), Ye(""));
442
+ }
443
+ }) : null]
444
+ }),
445
+ V.length ? /* @__PURE__ */ h("div", {
446
+ class: "ck-draft-list ck-style-list",
447
+ role: "group",
448
+ "aria-label": d("styleChanges"),
449
+ children: V.map((e) => /* @__PURE__ */ h("div", {
450
+ class: "ck-draft-item",
451
+ children: [/* @__PURE__ */ h("code", { children: ne(e) }), /* @__PURE__ */ h("button", {
452
+ class: "ck-ghost ck-ghost-sm",
453
+ "aria-label": d("styleRemoveChange", { change: ne(e) }),
454
+ onClick: (t) => {
455
+ Nt(t.currentTarget, () => kt.current), et(V.filter((t) => t.property !== e.property));
456
+ },
457
+ children: /* @__PURE__ */ h(_, {
458
+ name: "clear",
459
+ size: 12
460
+ })
461
+ })]
462
+ }))
463
+ }) : null,
464
+ H && nt && U.current ? /* @__PURE__ */ h(nt, {
465
+ base: U.current,
466
+ changes: V,
467
+ onChange: et,
468
+ onClose: () => tt(!1)
469
+ }) : null,
470
+ j === "capturing" ? /* @__PURE__ */ h("div", {
471
+ class: "ck-shot-row",
472
+ "aria-busy": "true",
473
+ children: [/* @__PURE__ */ h("span", { class: "ck-shot-thumb ck-skeleton" }), /* @__PURE__ */ h("span", {
474
+ class: "ck-muted",
475
+ children: d("capturing")
476
+ })]
477
+ }) : null,
478
+ j === "failed" ? /* @__PURE__ */ h("p", {
479
+ class: "ck-muted",
480
+ children: d("capturingFailed")
481
+ }) : null,
482
+ j === "ready" && $ ? /* @__PURE__ */ h("div", {
483
+ class: "ck-shot-row",
484
+ children: [/* @__PURE__ */ h("button", {
485
+ class: "ck-shot-thumb",
486
+ "aria-label": d("openImage", { name: d("screenshot") }),
487
+ onClick: () => it(-1),
488
+ children: /* @__PURE__ */ h("img", {
489
+ src: $,
490
+ alt: d("screenshotIncluded"),
491
+ style: { objectPosition: Re(i) }
492
+ })
493
+ }), /* @__PURE__ */ h("div", {
494
+ class: "ck-shot-side",
495
+ children: [/* @__PURE__ */ h("span", {
496
+ class: "ck-shot-label",
497
+ children: d("screenshotLabel")
498
+ }), /* @__PURE__ */ h("span", {
499
+ class: "ck-shot-actions",
500
+ children: [A.markup === !1 ? null : /* @__PURE__ */ h("button", {
501
+ class: "ck-ghost ck-ghost-sm",
502
+ ref: At,
503
+ onClick: () => R(!0),
504
+ children: [/* @__PURE__ */ h(_, {
505
+ name: "pen",
506
+ size: 14
507
+ }), d("markupShort")]
508
+ }), /* @__PURE__ */ h("button", {
509
+ class: "ck-ghost ck-ghost-sm",
510
+ "aria-label": d("screenshotRemove"),
511
+ onClick: () => (We("off"), Mt.current = !0),
512
+ children: [/* @__PURE__ */ h(_, {
513
+ name: "clear",
514
+ size: 14
515
+ }), d("screenshotRemoveShort")]
516
+ })]
517
+ })]
518
+ })]
519
+ }) : null,
520
+ j === "off" && k ? /* @__PURE__ */ h("button", {
521
+ class: "ck-ghost ck-ghost-sm ck-shot-add",
522
+ ref: jt,
523
+ onClick: () => We("ready"),
524
+ children: [/* @__PURE__ */ h(_, {
525
+ name: "imagePlus",
526
+ size: 14
527
+ }), d("screenshotAdd")]
528
+ }) : null,
529
+ pt ? /* @__PURE__ */ h("label", {
530
+ class: "ck-check",
531
+ children: [/* @__PURE__ */ h(ee, {
532
+ checked: ht,
533
+ onChange: (e) => gt(e.target.checked)
534
+ }), d("includeDiagnostics")]
535
+ }) : null,
536
+ pt ? /* @__PURE__ */ h(Fe, {}) : null,
537
+ /* @__PURE__ */ h(fe, {
538
+ items: z.items,
539
+ onRemove: z.remove,
540
+ onRetry: z.retry,
541
+ onOpen: it
542
+ }),
543
+ N && Xe ? /* @__PURE__ */ h(Xe, {
544
+ client: e,
545
+ value: Ke,
546
+ onChange: qe
547
+ }) : null,
548
+ lt && !J ? /* @__PURE__ */ h("div", {
549
+ class: "ck-note",
550
+ role: "status",
551
+ children: d("signedInPressSend")
552
+ }) : null,
553
+ K === "signing-in" ? /* @__PURE__ */ h("div", {
554
+ class: "ck-note",
555
+ role: "status",
556
+ children: [/* @__PURE__ */ h("div", { children: d("signInWaiting") }), /* @__PURE__ */ h("button", {
557
+ class: "ck-btn",
558
+ onClick: () => Y.current?.abort(),
559
+ children: d("signInCancel")
560
+ })]
561
+ }) : null,
562
+ Z || _t && !J ? /* @__PURE__ */ h("div", {
563
+ class: "ck-note",
564
+ children: [
565
+ /* @__PURE__ */ h("strong", { children: d(Z ? "guestIntro" : "signInToSendTitle") }),
566
+ /* @__PURE__ */ h("div", { children: d(Z ? "guestExplain" : "signInToSendBody") }),
567
+ Z ? /* @__PURE__ */ h("div", {
568
+ class: "ck-guest",
569
+ children: [["name", "email"].map((e) => /* @__PURE__ */ h("div", {
570
+ class: "ck-field",
571
+ children: [
572
+ /* @__PURE__ */ h("label", {
573
+ for: `ck-guest-${e}`,
574
+ children: d(e === "name" ? "guestName" : "guestEmail")
575
+ }),
576
+ /* @__PURE__ */ h("input", {
577
+ id: `ck-guest-${e}`,
578
+ ref: bt[e],
579
+ class: "ck-input",
580
+ type: e === "email" ? "email" : "text",
581
+ autoComplete: e,
582
+ maxLength: e === "name" ? 120 : 254,
583
+ enterKeyHint: "send",
584
+ autoCapitalize: e === "name" ? "words" : "off",
585
+ value: E[e],
586
+ "aria-invalid": vt === e,
587
+ "aria-describedby": vt === e ? "ck-guest-error" : void 0,
588
+ onInput: (t) => {
589
+ let n = t.target.value;
590
+ Oe((t) => ({
591
+ ...t,
592
+ [e]: n
593
+ }));
594
+ },
595
+ onKeyDown: (e) => {
596
+ e.key !== "Escape" && e.stopPropagation(), e.key === "Enter" && zt();
597
+ }
598
+ }),
599
+ vt === e ? /* @__PURE__ */ h("span", {
600
+ class: "ck-error",
601
+ id: "ck-guest-error",
602
+ role: "alert",
603
+ children: d(e === "name" ? "guestNameMissing" : "guestEmailInvalid")
604
+ }) : null
605
+ ]
606
+ })), /* @__PURE__ */ h("p", {
607
+ class: "ck-muted ck-guest-privacy",
608
+ children: [
609
+ d("guestPrivacy"),
610
+ " ",
611
+ /* @__PURE__ */ h("a", {
612
+ href: Be(e.options.endpoint),
613
+ target: "_blank",
614
+ rel: "noopener noreferrer",
615
+ children: d("guestPrivacyLink")
616
+ }),
617
+ ze(C) ? /* @__PURE__ */ h(u, { children: [" · ", /* @__PURE__ */ h("a", {
618
+ href: ze(C),
619
+ target: "_blank",
620
+ rel: "noopener noreferrer",
621
+ children: d("guestPrivacySite", { website: C?.project.name ?? "" })
622
+ })] }) : null
623
+ ]
624
+ })]
625
+ }) : null
626
+ ]
627
+ }) : null
628
+ ]
629
+ }),
630
+ /* @__PURE__ */ h("div", {
631
+ class: "ck-card-foot",
632
+ children: [
633
+ /* @__PURE__ */ h("span", { class: "ck-spacer" }),
634
+ /* @__PURE__ */ h("button", {
635
+ class: "ck-btn",
636
+ onClick: () => wt(),
637
+ children: d("cancel")
638
+ }),
639
+ /* @__PURE__ */ h("button", {
640
+ ref: St,
641
+ class: D.trim() && X || J ? "ck-btn ck-primary" : "ck-btn ck-quiet",
642
+ "aria-disabled": J || !D.trim() || !X || void 0,
643
+ onClick: () => void zt(),
644
+ children: d(K === "signing-in" ? "signingIn" : K === "sending" ? ot ? "stillSending" : "sending" : _t ? "signInToSend" : "send")
645
+ })
646
+ ]
647
+ }),
648
+ G !== null && at ? /* @__PURE__ */ h(at, {
649
+ images: G < 0 && $ ? [{
650
+ src: $,
651
+ name: d("screenshot")
652
+ }] : z.items.filter((e) => e.preview).map((e) => ({
653
+ src: e.preview,
654
+ name: e.file.name
655
+ })),
656
+ start: Math.max(0, G),
657
+ onClose: () => it(null)
658
+ }) : null,
659
+ Qe && $e && k ? /* @__PURE__ */ h($e, {
660
+ image: k.blob,
661
+ onCancel: () => (R(!1), setTimeout(() => At.current?.focus())),
662
+ onDone: (e, t) => {
663
+ Me({
664
+ ...k,
665
+ blob: e
666
+ }), Ze(t), R(!1), setTimeout(() => At.current?.focus());
667
+ }
668
+ }) : null
669
+ ]
670
+ })] });
671
+ }
672
+ function Fe() {
673
+ let [e, t] = l(!1), n = e ? j(Ee()) : [];
674
+ return /* @__PURE__ */ h("details", {
675
+ class: "ck-diag",
676
+ onToggle: (e) => t(e.currentTarget.open),
677
+ children: [/* @__PURE__ */ h("summary", { children: d("diagnosticsSee") }), e ? n.length ? /* @__PURE__ */ h("ul", { children: n.map((e) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h("bdi", { children: e }) })) }) : /* @__PURE__ */ h("p", {
678
+ class: "ck-muted",
679
+ children: d("diagnosticsEmpty")
680
+ }) : null]
681
+ });
682
+ }
683
+ function j(e) {
684
+ return [...(e.console ?? []).map((e) => `${e.level}: ${e.message}`), ...(e.network ?? []).map((e) => `${e.method} ${e.url} ${e.status}`)];
685
+ }
686
+ var Ie = "M31.5 4.8C17.3 4.4 7 15.2 7 29c0 13 8.5 21.2 20.9 23 1.6.2 2.1 1.2 2.1 2.5v6.9c0 1.7 1.2 2.1 2.5.9 5.7-4.9 16-13.6 21.1-22.1 3.5-5.8 4.7-11.8 3.2-18.1C54.3 11.5 44.7 4.6 31.5 4.8Z";
687
+ function Le(e) {
688
+ let t = {};
689
+ return e.priority && e.priority !== "none" && (t.priority = e.priority), e.assignee_ids?.length && (t.assignee_ids = e.assignee_ids), e.label_ids?.length && (t.label_ids = e.label_ids), Object.keys(t).length ? t : void 0;
690
+ }
691
+ function Re(e) {
692
+ return e.region ? "50% 50%" : `50% ${Math.round(Math.min(100, Math.max(0, e.point.y / Math.max(1, innerHeight) * 100)))}%`;
693
+ }
694
+ var M = "commentkit:pending-extras";
695
+ function ze(e) {
696
+ let t = _e(e?.privacy?.notice_url);
697
+ return t?.startsWith("https:") ? t : null;
698
+ }
699
+ function Be(e) {
700
+ try {
701
+ return `${new URL(e ?? "https://commentkit.dev").origin}/privacy`;
702
+ } catch {
703
+ return "https://commentkit.dev/privacy";
704
+ }
705
+ }
706
+ var Ve = "commentkit:guest-details";
707
+ function He() {
708
+ try {
709
+ let e = JSON.parse(y(Ve) ?? "null"), t = (e, t) => typeof e == "string" ? e.slice(0, t) : "";
710
+ return {
711
+ name: t(e?.name, 120),
712
+ email: t(e?.email, 254)
713
+ };
714
+ } catch {
715
+ return {
716
+ name: "",
717
+ email: ""
718
+ };
719
+ }
720
+ }
721
+ function Ue(e) {
722
+ try {
723
+ let t = JSON.parse(y(M) ?? "null");
724
+ return y(M, null), !t || v(t.id) !== v(e) ? null : {
725
+ checklist: Array.isArray(t.checklist) ? t.checklist.filter((e) => typeof e == "string").slice(0, 30) : null,
726
+ task: t.task && typeof t.task == "object" ? t.task : {},
727
+ markup: Array.isArray(t.markup) ? t.markup.filter((e) => !!e && typeof e == "object" && Array.isArray(e.points)).slice(0, 100) : [],
728
+ styles: te(t.styles)
729
+ };
730
+ } catch {
731
+ return null;
732
+ }
733
+ }
734
+ export { Pe as Composer, j as diagnosticsLines, Be as privacyNotice, ze as siteNotice, Oe as warmCapture };