@commentkit/comment-kit 1.0.1 → 1.5.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 (77) hide show
  1. package/CHANGELOG.md +126 -1
  2. package/README.md +12 -5
  3. package/SECURITY.md +3 -1
  4. package/dist/npm/THIRD_PARTY_NOTICES.txt +22 -23
  5. package/dist/npm/chunks/AgentSend-DyWxNQ0p.js +64 -0
  6. package/dist/npm/chunks/Checklist-VYkSl6Q9.js +259 -0
  7. package/dist/npm/chunks/Composer-CnsGQirF.js +679 -0
  8. package/dist/npm/chunks/Guest-DkIvY5zt.js +170 -0
  9. package/dist/npm/chunks/MarkupEditor-DxTI9nJH.js +334 -0
  10. package/dist/npm/chunks/Panel-riaMYxt-.js +863 -0
  11. package/dist/npm/chunks/Settings-CB4zxQAL.js +206 -0
  12. package/dist/npm/chunks/{Shortcuts-3AOERWBh.js → Shortcuts-D1cbajg_.js} +21 -17
  13. package/dist/npm/chunks/StyleEditor-BtTv3I8_.js +44 -0
  14. package/dist/npm/chunks/StylePanel-BI-n5Me1.js +199 -0
  15. package/dist/npm/chunks/TaskFields-HwrD0FrH.js +272 -0
  16. package/dist/npm/chunks/ThreadCard-CjaC8BTa.js +1026 -0
  17. package/dist/npm/chunks/Viewer-BnWshSXb.js +110 -0
  18. package/dist/npm/chunks/agent-Cr6NB6We.js +146 -0
  19. package/dist/npm/chunks/anchor-OCQnjp_6.js +294 -0
  20. package/dist/npm/chunks/{ar-BVQ4ToG2.js → ar-BQ9K9Oqf.js} +188 -7
  21. package/dist/npm/chunks/card-bits-CxteYiZ9.js +126 -0
  22. package/dist/npm/chunks/client-CJ1tpI62.js +754 -0
  23. package/dist/npm/chunks/colors-0Ied7PE2.js +101 -0
  24. package/dist/npm/chunks/confetti-DKeKR7-6.js +41 -0
  25. package/dist/npm/chunks/{de-CamSq76K.js → de-CcPi8xdC.js} +159 -7
  26. package/dist/npm/chunks/drafts-CpQdHhcK.js +51 -0
  27. package/dist/npm/chunks/{es-BBIlcnsU.js → es-DXgkjDCG.js} +159 -7
  28. package/dist/npm/chunks/extension-BIGfr4Gh.js +50 -0
  29. package/dist/npm/chunks/{extension-CLm_T7Vj.js → extension-DkDSW4qw.js} +2 -2
  30. package/dist/npm/chunks/{fr-BXsff0Zz.js → fr-IjJaUbWh.js} +159 -7
  31. package/dist/npm/chunks/{hi-y-APBuxh.js → hi-BhKQK2MU.js} +159 -7
  32. package/dist/npm/chunks/html2canvas-pro.esm-lgs6tb4C.js +8378 -0
  33. package/dist/npm/chunks/i18n-DAJGndZ2.js +904 -0
  34. package/dist/npm/chunks/{it-C5MH_Ktv.js → it-DKiSCkiD.js} +159 -7
  35. package/dist/npm/chunks/{ja-s1JJld2J.js → ja-BI1WagDg.js} +159 -7
  36. package/dist/npm/chunks/{live-CkVrNM1-.js → live-B-mo27Qq.js} +1 -1
  37. package/dist/npm/chunks/lock-C82sC17d.js +30 -0
  38. package/dist/npm/chunks/{nl-CFzRMEfl.js → nl-CJw3VUQ5.js} +159 -7
  39. package/dist/npm/chunks/pick-CYPkLLFJ.js +120 -0
  40. package/dist/npm/chunks/{pt-BR-DE_r-5UM.js → pt-BR-CjBolC5g.js} +159 -7
  41. package/dist/npm/chunks/{pusher-BSsQoE1K.js → realtime-D22tI_AS.js} +58 -4
  42. package/dist/npm/chunks/source-CTQmAh0Y.js +146 -0
  43. package/dist/npm/chunks/src-CgBEoWl0.js +150 -0
  44. package/dist/npm/chunks/start-DW9_DKmf.js +1783 -0
  45. package/dist/npm/chunks/upload-BmrpZE5G.js +42 -0
  46. package/dist/npm/chunks/uploads-CipONvCy.js +541 -0
  47. package/dist/npm/chunks/{zh-CN--gibO2l7.js → zh-CN-BrZGx2S0.js} +159 -7
  48. package/dist/npm/element.js +4 -5
  49. package/dist/npm/headless.js +3 -3
  50. package/dist/npm/index.js +2 -2
  51. package/dist/npm/react.js +1 -1
  52. package/dist/npm/svelte.js +1 -1
  53. package/dist/npm/types/adapters/vue.d.ts +14 -0
  54. package/dist/npm/types/anchor/index.d.ts +22 -1
  55. package/dist/npm/types/core/api.d.ts +3 -0
  56. package/dist/npm/types/core/auth.d.ts +11 -0
  57. package/dist/npm/types/core/client.d.ts +128 -6
  58. package/dist/npm/types/core/types.d.ts +78 -4
  59. package/dist/npm/types/headless.d.ts +1 -1
  60. package/dist/npm/types/index.d.ts +6 -1
  61. package/dist/npm/vue.js +5 -1
  62. package/package.json +6 -3
  63. package/dist/npm/chunks/Guest-CdfnuD8T.js +0 -157
  64. package/dist/npm/chunks/MarkupEditor-Clb17Tse.js +0 -199
  65. package/dist/npm/chunks/Panel-CgvEbZXr.js +0 -438
  66. package/dist/npm/chunks/ThreadCard-DuGKe-gE.js +0 -817
  67. package/dist/npm/chunks/anchor-DT-Ynhh1.js +0 -270
  68. package/dist/npm/chunks/art-Bn9_ANNS.js +0 -155
  69. package/dist/npm/chunks/client-CS5oL_LQ.js +0 -620
  70. package/dist/npm/chunks/colors-CX-IPjvb.js +0 -86
  71. package/dist/npm/chunks/extension-DWHHer7j.js +0 -26
  72. package/dist/npm/chunks/format-CP2xZaec.js +0 -524
  73. package/dist/npm/chunks/html2canvas-DfGb8yka.js +0 -4024
  74. package/dist/npm/chunks/mount-VmnAiANB.js +0 -1507
  75. package/dist/npm/chunks/privacy-DLhezjyi.js +0 -30
  76. package/dist/npm/chunks/realtime-CBRW9BB3.js +0 -34
  77. package/dist/npm/chunks/src-DG8ehgE9.js +0 -549
@@ -0,0 +1,679 @@
1
+ import { n as e } from "./src-CgBEoWl0.js";
2
+ import { p as t } from "./client-CJ1tpI62.js";
3
+ import { a as n } from "./anchor-OCQnjp_6.js";
4
+ import { d as r, f as i, l as a, m as o, p as s, s as c, u as l, v as ee } from "./i18n-DAJGndZ2.js";
5
+ import { n as te, o as ne, r as re, t as ie } from "./card-bits-CxteYiZ9.js";
6
+ import { i as ae, r as oe, t as se } from "./drafts-CpQdHhcK.js";
7
+ import { a as ce, c as le, d as u, i as ue, l as de, n as fe, o as pe, t as me } from "./uploads-CipONvCy.js";
8
+ import { S as he, a as ge, d, h as _e, i as ve, l as ye, m as be, n as f, o as xe, s as Se } from "./start-DW9_DKmf.js";
9
+ var p = "iframe,[data-commentkit],[data-commentkit-host],[data-commentkit-ui],[data-commentkit-panel],[data-commentkit-redact],[data-html2canvas-ignore],input[type=\"password\"],input[type=\"hidden\"],input[type=\"email\" i],input[type=\"tel\" i]," + [
10
+ "current-password",
11
+ "new-password",
12
+ "one-time-code",
13
+ "email",
14
+ "tel",
15
+ "street-address",
16
+ "address-line1",
17
+ "address-line2",
18
+ "address-line3",
19
+ "postal-code"
20
+ ].map((e) => `[autocomplete~="${e}" i]`).join(",") + "," + ["cc-", "tel-"].map((e) => `[autocomplete^="${e}" i],[autocomplete*=" ${e}" i]`).join(",");
21
+ function m(e) {
22
+ try {
23
+ let t = e;
24
+ for (; t;) {
25
+ if (t.closest(p)) return !0;
26
+ let e = t.getRootNode();
27
+ t = e instanceof ShadowRoot ? e.host : null;
28
+ }
29
+ return !1;
30
+ } catch {
31
+ return !0;
32
+ }
33
+ }
34
+ //#endregion
35
+ //#region src/capture/context.ts
36
+ function Ce() {
37
+ let e = navigator.userAgent, t = we(e, [
38
+ ["Edge", /Edg\/([\d.]+)/],
39
+ ["Opera", /OPR\/([\d.]+)/],
40
+ ["Samsung Internet", /SamsungBrowser\/([\d.]+)/],
41
+ ["Chrome", /Chrome\/([\d.]+)/],
42
+ ["Firefox", /Firefox\/([\d.]+)/],
43
+ ["Safari", /Version\/([\d.]+).*Safari/]
44
+ ]), n = we(e, [
45
+ ["iOS", /(?:iPhone|iPad|iPod).*OS ([\d_]+)/],
46
+ ["Android", /Android ([\d.]+)/],
47
+ ["Windows", /Windows NT ([\d.]+)/],
48
+ ["macOS", /Mac OS X ([\d_]+)/],
49
+ ["ChromeOS", /CrOS [^ ]+ ([\d.]+)/],
50
+ ["Linux", /Linux()/]
51
+ ]), r = innerWidth, i = matchMedia?.("(pointer: coarse)").matches ?? !1;
52
+ return {
53
+ viewport: {
54
+ width: r,
55
+ height: innerHeight,
56
+ dpr: Math.round((devicePixelRatio || 1) * 100) / 100,
57
+ zoom: Math.round((visualViewport?.scale ?? 1) * 100) / 100
58
+ },
59
+ device: {
60
+ browser: t?.[0],
61
+ browser_version: t?.[1]?.split(".")[0],
62
+ os: n?.[0],
63
+ os_version: n?.[1]?.replace(/_/g, "."),
64
+ type: i ? r >= 768 ? "tablet" : "mobile" : "desktop",
65
+ locale: navigator.language,
66
+ color_scheme: matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light",
67
+ user_agent: e.slice(0, 500)
68
+ }
69
+ };
70
+ }
71
+ function we(e, t) {
72
+ for (let [n, r] of t) {
73
+ let t = e.match(r);
74
+ if (t) return [n, t[1] ?? ""];
75
+ }
76
+ return null;
77
+ }
78
+ //#endregion
79
+ //#region src/capture/screenshot.ts
80
+ var h = 8e6, g = 15e3;
81
+ function _() {
82
+ e() || import("./html2canvas-pro.esm-lgs6tb4C.js").catch(() => void 0);
83
+ }
84
+ async function Te(t = {}) {
85
+ let n = (t.redact ?? []).filter(C), r = innerWidth, i = innerHeight, a = null;
86
+ e() && (a = await import("./extension-DkDSW4qw.js").then((e) => e.captureTab(n)).catch(() => null)), a ?? (a = await v(n, r, i));
87
+ let o = a.getContext("2d"), s = a.width / Math.max(1, r);
88
+ return o && y(o, s, t), t.crop && t.region && (a = Ee(a, s, t.region, r, i)), {
89
+ blob: await S(a),
90
+ width: a.width,
91
+ height: a.height
92
+ };
93
+ }
94
+ async function v(e, t, n) {
95
+ let [{ default: r }, { captureBackground: i, normalizeCaptureColors: a }] = await Promise.all([import("./html2canvas-pro.esm-lgs6tb4C.js"), import("./colors-0Ied7PE2.js")]), o = (t) => t.tagName === "NOSCRIPT" || m(t) || e.some((e) => Oe(t, e)), s = Math.min(devicePixelRatio || 1, 2, Math.sqrt(h / Math.max(1, t * n)));
96
+ return De(r(document.documentElement, {
97
+ useCORS: !0,
98
+ logging: !1,
99
+ backgroundColor: i(getComputedStyle(document.body).backgroundColor),
100
+ scale: s,
101
+ x: scrollX,
102
+ y: scrollY,
103
+ width: t,
104
+ height: n,
105
+ windowWidth: document.documentElement.clientWidth,
106
+ windowHeight: n,
107
+ ignoreElements: o,
108
+ onclone: a
109
+ }), g);
110
+ }
111
+ function y(e, t, n) {
112
+ e.setTransform(1, 0, 0, 1, 0, 0);
113
+ let r = n.accent ?? "#ff5733";
114
+ if (n.region) {
115
+ let i = n.region;
116
+ 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();
117
+ }
118
+ if (n.pin) {
119
+ let i = n.pin.x * t, a = n.pin.y * t, o = 11 * t;
120
+ 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();
121
+ }
122
+ }
123
+ var b = {
124
+ w: 320,
125
+ h: 200
126
+ };
127
+ function x(e, t, n) {
128
+ let r = Math.min(t, Math.max(b.w, e.w + 64)), i = Math.min(n, Math.max(b.h, e.h + 64));
129
+ return {
130
+ x: Math.min(Math.max(0, e.x + e.w / 2 - r / 2), t - r),
131
+ y: Math.min(Math.max(0, e.y + e.h / 2 - i / 2), n - i),
132
+ w: r,
133
+ h: i
134
+ };
135
+ }
136
+ function Ee(e, t, n, r, i) {
137
+ let a = x(n, r, i), o = document.createElement("canvas");
138
+ 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;
139
+ }
140
+ function S(e) {
141
+ return new Promise((t, n) => {
142
+ e.toBlob((r) => {
143
+ if (r && r.type === "image/webp") return t(r);
144
+ e.toBlob((e) => e ? t(e) : n(/* @__PURE__ */ Error("Could not encode the screenshot.")), "image/png");
145
+ }, "image/webp", .86);
146
+ });
147
+ }
148
+ function De(e, t) {
149
+ return new Promise((n, r) => {
150
+ let i = setTimeout(() => r(/* @__PURE__ */ Error("The screenshot took too long. Your feedback will be sent without it.")), t);
151
+ e.then((e) => (clearTimeout(i), n(e)), (e) => (clearTimeout(i), r(e)));
152
+ });
153
+ }
154
+ function C(e) {
155
+ try {
156
+ return document.createDocumentFragment().querySelector(e), !0;
157
+ } catch {
158
+ return !1;
159
+ }
160
+ }
161
+ function Oe(e, t) {
162
+ try {
163
+ return e.matches(t) || !!e.closest(t);
164
+ } catch {
165
+ return !1;
166
+ }
167
+ }
168
+ //#endregion
169
+ //#region src/ui/Composer.tsx
170
+ f(u);
171
+ function w({ client: e, draft: u, signedIn: f, onSignIn: p, onCancel: m, onSent: we, onError: h, share: g = null, onPending: _ }) {
172
+ let v = ge(e.state, (e) => e.config), y = ge(e.state, (e) => e.session?.person ?? null), b = s(() => Se(e, u.anchor), [u.anchor]), [x, Ee] = o(() => Ne()), [S, De] = o(() => oe(b)), [C, Oe] = o([]), [w, Fe] = o(null), [Ie, Le] = o(null), k = e.options.tools ?? {}, Re = v?.features.screenshots !== !1 && k.screenshots !== !1, ze = k.attachments !== !1, [A, j] = o(Re ? "capturing" : "off"), M = ge(e.state, (e) => !!e.session?.capabilities.triage), [N] = o(() => Pe(b)), [P, Be] = o(N?.task ?? {}), [F, I] = o(N?.checklist ?? null), [L, Ve] = o(""), [R, He] = o(null);
173
+ l(() => {
174
+ M && !R && import("./TaskFields-HwrD0FrH.js").then((e) => He(() => e.TaskDraft), () => void 0);
175
+ }, [M]);
176
+ let [z, Ue] = o(N?.markup ?? []), [We, B] = o(null), V = fe(e, (e) => h(new t(0, "file_rejected", e))), H = s(() => {
177
+ if (u.anchor.type !== "element" && u.anchor.type !== "text") return null;
178
+ let e = n(u.anchor).element;
179
+ return e instanceof HTMLElement || e instanceof SVGElement ? e : null;
180
+ }, [u.anchor]), [U, Ge] = o(N?.styles ?? []), [W, Ke] = o(!1), [G, qe] = o(null), K = i(null), q = i(null), Je = () => {
181
+ H && (K.current ?? (K.current = pe(H)), q.current ?? (q.current = new ue(H)), Ke(!0), G || import("./StylePanel-BI-n5Me1.js").then((e) => qe(() => e.StylePanel), h));
182
+ };
183
+ r(() => {
184
+ W ? q.current?.apply(U) : q.current?.revert();
185
+ }, [W, U]), r(() => () => q.current?.revert(), []);
186
+ let [Ye, Xe] = o(null), [J, Ze] = o(null), Qe = (e) => {
187
+ Xe(e), J || import("./Viewer-BnWshSXb.js").then((e) => Ze(() => e.Viewer), h);
188
+ }, [Y, $e] = o(!1), [et, tt] = o(!1), nt = !!(v?.features.console_capture || v?.features.network_capture), [rt, it] = o(v?.features.capture_consent_default === !0), X = ve(), [at, ot] = o(!1), Z = !f && !!g && !e.auth.pending(), [st, ct] = o(null), lt = {
189
+ name: i(null),
190
+ email: i(null)
191
+ }, ut = i(null), Q = i(null), dt = i(Promise.resolve(null));
192
+ l(() => {
193
+ if (A !== "capturing") return;
194
+ let t = !1, n = 0, r = 0;
195
+ return dt.current = new Promise((i) => {
196
+ let a = !1, o = () => {
197
+ if (!a) {
198
+ if (a = !0, t) return i(null);
199
+ Te({
200
+ redact: [...v?.privacy.redact_selectors ?? [], ...e.options.redact ?? []],
201
+ pin: u.region ? null : u.point,
202
+ region: u.region,
203
+ crop: !!u.region
204
+ }).then(i, () => i(null));
205
+ }
206
+ };
207
+ n = requestAnimationFrame(() => n = requestAnimationFrame(o)), r = window.setTimeout(o, 300);
208
+ }), dt.current.then((e) => {
209
+ t || (e && Fe(e), j(e ? "ready" : "failed"));
210
+ }), () => {
211
+ t = !0, cancelAnimationFrame(n), clearTimeout(r);
212
+ };
213
+ }, []), l(() => {
214
+ if (!w) return;
215
+ let e = URL.createObjectURL(w.blob);
216
+ return Le(e), () => URL.revokeObjectURL(e);
217
+ }, [w]);
218
+ let ft = (e) => {
219
+ De(e), ae(b, e);
220
+ };
221
+ l(() => {
222
+ Q.current = null;
223
+ }, [
224
+ S,
225
+ C,
226
+ w,
227
+ A,
228
+ z,
229
+ V.items,
230
+ rt,
231
+ P,
232
+ F,
233
+ U
234
+ ]);
235
+ let pt = s(() => re(u.point, u.region ? {
236
+ top: u.region.y,
237
+ bottom: u.region.y + u.region.h
238
+ } : void 0), [u.point]), mt = (e) => V.add(e), ht = async () => {
239
+ let t = null, n = null, r = A === "capturing" ? await dt.current : A === "ready" ? w : null;
240
+ if (r) try {
241
+ let n = r.blob.type, i = `screenshot.${n === "image/webp" ? "webp" : n === "image/jpeg" ? "jpg" : "png"}`;
242
+ t = (await e.upload(r.blob, i, "screenshot")).id;
243
+ } catch {
244
+ n = "screenshot";
245
+ }
246
+ let i = await V.ready(), a = i.ids;
247
+ i.missing && (n ?? (n = "files"));
248
+ let o = {
249
+ ...Ce(),
250
+ ...nt && rt ? he() : {},
251
+ screenshot_id: t,
252
+ markup: z.length ? z : void 0
253
+ }, s = M ? Ae(P) : void 0, c = [...F ?? [], ...L.trim() ? [L.trim()] : []], l = H ? ce(U) : [];
254
+ return {
255
+ key: crypto.randomUUID(),
256
+ input: {
257
+ anchor: u.anchor,
258
+ body: S.trim(),
259
+ capture: o,
260
+ attachmentIds: a,
261
+ mentionIds: C,
262
+ task: s,
263
+ checklist: c,
264
+ styleChanges: l
265
+ },
266
+ missing: n
267
+ };
268
+ }, $ = async () => {
269
+ if (Y || !S.trim() || !X) return;
270
+ if (tt(!1), !f && !g && !at) {
271
+ ot(!0);
272
+ return;
273
+ }
274
+ let n = Z ? x.name.trim() ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(x.email.trim()) ? null : "email" : "name" : null;
275
+ if (ct(n), n) return lt[n].current?.focus();
276
+ $e(!0);
277
+ try {
278
+ let t = !f && !g;
279
+ if (Z && g) {
280
+ let { startGuest: n } = await import("./Guest-DkIvY5zt.js");
281
+ D(E, JSON.stringify({
282
+ name: x.name,
283
+ email: x.email
284
+ })), t = await n(e, {
285
+ share: g,
286
+ ...x
287
+ }) === "popup";
288
+ }
289
+ if (t) {
290
+ if (D(xe, JSON.stringify({
291
+ draft: u,
292
+ scrollY
293
+ })), D(T, JSON.stringify({
294
+ id: b,
295
+ checklist: F,
296
+ task: P,
297
+ markup: z,
298
+ styles: U
299
+ })), !await p()) return;
300
+ O(xe), O(T);
301
+ }
302
+ let n = Q.current ?? (Q.current = await ht()), r = await e.createThread({
303
+ ...n.input,
304
+ idempotencyKey: n.key
305
+ });
306
+ if (Q.current = null, r.pending_verification) return _?.(e.auth.pending()?.email ?? x.email);
307
+ se(b), O(E), we(r, n.missing);
308
+ } catch (n) {
309
+ if (n instanceof t && ["pending_limit", "verification_required"].includes(n.code) && e.auth.pending()) return _?.(e.auth.pending().email);
310
+ let r = te(n);
311
+ tt(r ?? !0), r || h(n);
312
+ } finally {
313
+ $e(!1);
314
+ }
315
+ };
316
+ return /* @__PURE__ */ a(ee, { children: [u.region ? /* @__PURE__ */ a("div", {
317
+ class: "ck-pending-region",
318
+ style: be(u.region.x, u.region.y, u.region.w, u.region.h),
319
+ "aria-hidden": "true",
320
+ "data-commentkit-ui": !0
321
+ }) : u.anchor.type === "page" ? null : /* @__PURE__ */ a("div", {
322
+ class: "ck-pending-pin",
323
+ style: be(u.point.x, u.point.y),
324
+ "aria-hidden": "true",
325
+ "data-commentkit-ui": !0,
326
+ children: [/* @__PURE__ */ a("svg", {
327
+ viewBox: "5 3 54 62",
328
+ children: /* @__PURE__ */ a("path", { d: ke })
329
+ }), y ? /* @__PURE__ */ a(ye, { person: y }) : null]
330
+ }), /* @__PURE__ */ a("div", {
331
+ class: "ck-card ck-composer",
332
+ style: pt,
333
+ role: "dialog",
334
+ "aria-label": c("comment"),
335
+ "data-commentkit-ui": !0,
336
+ onKeyDown: (e) => e.key === "Escape" && m(),
337
+ ...ze ? ne(mt) : {},
338
+ children: [
339
+ /* @__PURE__ */ a("div", {
340
+ class: "ck-card-body",
341
+ style: { position: "relative" },
342
+ children: [
343
+ u.anchor.quote ? /* @__PURE__ */ a("blockquote", {
344
+ class: "ck-quote",
345
+ "aria-label": c("quotedText"),
346
+ children: /* @__PURE__ */ a("bdi", { children: u.anchor.quote.slice(0, 200) })
347
+ }) : null,
348
+ X ? null : /* @__PURE__ */ a("div", {
349
+ class: "ck-note",
350
+ "data-tone": "warning",
351
+ role: "status",
352
+ children: c("offlineSend")
353
+ }),
354
+ et && X ? /* @__PURE__ */ a("div", {
355
+ class: "ck-note",
356
+ "data-tone": "warning",
357
+ role: "alert",
358
+ children: et === !0 ? /* @__PURE__ */ a(ee, { children: [
359
+ c("sendFailed"),
360
+ " ",
361
+ /* @__PURE__ */ a("button", {
362
+ class: "ck-btn",
363
+ onClick: () => void $(),
364
+ children: c("retry")
365
+ })
366
+ ] }) : `${et} ${c("savedHere")}`
367
+ }) : null,
368
+ /* @__PURE__ */ a(de, {
369
+ client: e,
370
+ value: S,
371
+ onChange: ft,
372
+ onMentions: Oe,
373
+ onSubmit: () => void $(),
374
+ placeholder: c("composerPlaceholder"),
375
+ autofocus: !0,
376
+ disabled: Y,
377
+ canMention: f
378
+ }),
379
+ F === null ? null : /* @__PURE__ */ a("div", {
380
+ class: "ck-draft-list",
381
+ role: "group",
382
+ "aria-label": c("checklist"),
383
+ children: [F.map((e, t) => /* @__PURE__ */ a("div", {
384
+ class: "ck-draft-item",
385
+ children: [
386
+ /* @__PURE__ */ a("span", {
387
+ "aria-hidden": "true",
388
+ class: "ck-draft-box"
389
+ }),
390
+ /* @__PURE__ */ a("bdi", { children: e }),
391
+ /* @__PURE__ */ a("button", {
392
+ class: "ck-ghost ck-ghost-sm",
393
+ "aria-label": c("removeItem", { item: e }),
394
+ onClick: () => I(F.filter((e, n) => n !== t)),
395
+ children: /* @__PURE__ */ a(d, {
396
+ name: "close",
397
+ size: 12
398
+ })
399
+ })
400
+ ]
401
+ })), F.length < 30 ? /* @__PURE__ */ a("input", {
402
+ class: "ck-input",
403
+ maxLength: 300,
404
+ placeholder: c("checklistAdd"),
405
+ "aria-label": c("checklistAdd"),
406
+ value: L,
407
+ ref: _e,
408
+ onInput: (e) => Ve(e.target.value),
409
+ onKeyDown: (e) => {
410
+ e.key !== "Escape" && e.stopPropagation(), e.key === "Enter" && L.trim() && (e.preventDefault(), I([...F, L.trim()]), Ve(""));
411
+ }
412
+ }) : null]
413
+ }),
414
+ U.length ? /* @__PURE__ */ a("div", {
415
+ class: "ck-draft-list ck-style-list",
416
+ role: "group",
417
+ "aria-label": c("styleChanges"),
418
+ children: U.map((e) => /* @__PURE__ */ a("div", {
419
+ class: "ck-draft-item",
420
+ children: [/* @__PURE__ */ a("code", { children: le(e) }), /* @__PURE__ */ a("button", {
421
+ class: "ck-ghost ck-ghost-sm",
422
+ "aria-label": c("styleRemoveChange", { change: le(e) }),
423
+ onClick: () => Ge(U.filter((t) => t.property !== e.property)),
424
+ children: /* @__PURE__ */ a(d, {
425
+ name: "close",
426
+ size: 12
427
+ })
428
+ })]
429
+ }))
430
+ }) : null,
431
+ W && G && K.current ? /* @__PURE__ */ a(G, {
432
+ base: K.current,
433
+ changes: U,
434
+ onChange: Ge,
435
+ onClose: () => Ke(!1)
436
+ }) : null,
437
+ F === null || H && !W ? /* @__PURE__ */ a("div", {
438
+ class: "ck-extra-add",
439
+ children: [F === null ? /* @__PURE__ */ a("button", {
440
+ class: "ck-ghost ck-ghost-sm",
441
+ onClick: () => I([]),
442
+ children: ["+ ", c("addChecklist")]
443
+ }) : null, H && !W ? /* @__PURE__ */ a("button", {
444
+ class: "ck-chip",
445
+ onClick: Je,
446
+ children: [/* @__PURE__ */ a("svg", {
447
+ width: "13",
448
+ height: "13",
449
+ viewBox: "0 0 24 24",
450
+ fill: "none",
451
+ stroke: "currentColor",
452
+ "stroke-width": "2",
453
+ "stroke-linecap": "round",
454
+ "stroke-linejoin": "round",
455
+ "aria-hidden": "true",
456
+ children: /* @__PURE__ */ a("path", { d: "M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6" })
457
+ }), c("adjustStyle")]
458
+ }) : null]
459
+ }) : null,
460
+ M && R ? /* @__PURE__ */ a(R, {
461
+ client: e,
462
+ value: P,
463
+ onChange: Be
464
+ }) : null,
465
+ Z || at && !f ? /* @__PURE__ */ a("div", {
466
+ class: "ck-note",
467
+ children: [
468
+ /* @__PURE__ */ a("strong", { children: c(Z ? "guestIntro" : "signInToSend") }),
469
+ /* @__PURE__ */ a("div", { children: c(g ? "guestExplain" : "signInExplain") }),
470
+ Z ? /* @__PURE__ */ a("div", {
471
+ class: "ck-guest",
472
+ children: [["name", "email"].map((e) => /* @__PURE__ */ a("div", {
473
+ class: "ck-field",
474
+ children: [
475
+ /* @__PURE__ */ a("label", {
476
+ for: `ck-guest-${e}`,
477
+ children: c(e === "name" ? "guestName" : "guestEmail")
478
+ }),
479
+ /* @__PURE__ */ a("input", {
480
+ id: `ck-guest-${e}`,
481
+ ref: lt[e],
482
+ class: "ck-input",
483
+ type: e === "email" ? "email" : "text",
484
+ autoComplete: e,
485
+ maxLength: e === "name" ? 120 : 254,
486
+ value: x[e],
487
+ "aria-invalid": st === e,
488
+ "aria-describedby": st === e ? "ck-guest-error" : void 0,
489
+ onInput: (t) => {
490
+ let n = t.target.value;
491
+ Ee((t) => ({
492
+ ...t,
493
+ [e]: n
494
+ }));
495
+ },
496
+ onKeyDown: (e) => {
497
+ e.key !== "Escape" && e.stopPropagation(), e.key === "Enter" && $();
498
+ }
499
+ }),
500
+ st === e ? /* @__PURE__ */ a("span", {
501
+ class: "ck-error",
502
+ id: "ck-guest-error",
503
+ role: "alert",
504
+ children: c(e === "name" ? "guestNameMissing" : "guestEmailInvalid")
505
+ }) : null
506
+ ]
507
+ })), /* @__PURE__ */ a("p", {
508
+ class: "ck-muted ck-guest-privacy",
509
+ children: [
510
+ c("guestPrivacy"),
511
+ " ",
512
+ /* @__PURE__ */ a("a", {
513
+ href: Me(e.options.endpoint),
514
+ target: "_blank",
515
+ rel: "noopener noreferrer",
516
+ children: c("guestPrivacyLink")
517
+ })
518
+ ]
519
+ })]
520
+ }) : null
521
+ ]
522
+ }) : null,
523
+ A === "capturing" ? /* @__PURE__ */ a("div", {
524
+ class: "ck-shot ck-shot-wait",
525
+ children: /* @__PURE__ */ a("span", {
526
+ class: "ck-muted",
527
+ children: c("capturing")
528
+ })
529
+ }) : null,
530
+ A === "failed" ? /* @__PURE__ */ a("p", {
531
+ class: "ck-muted",
532
+ children: c("capturingFailed")
533
+ }) : null,
534
+ A === "ready" && Ie ? /* @__PURE__ */ a("div", {
535
+ class: "ck-shot",
536
+ children: [/* @__PURE__ */ a("img", {
537
+ src: Ie,
538
+ alt: c("screenshotIncluded"),
539
+ title: c("screenshotIncluded"),
540
+ style: { objectPosition: je(u) }
541
+ }), /* @__PURE__ */ a("div", {
542
+ class: "ck-shot-tools",
543
+ children: [k.markup === !1 ? null : /* @__PURE__ */ a("button", {
544
+ class: "ck-chip",
545
+ onClick: () => void import("./MarkupEditor-DxTI9nJH.js").then((e) => B(() => e.MarkupEditor), h),
546
+ children: [/* @__PURE__ */ a(d, {
547
+ name: "pen",
548
+ size: 14
549
+ }), c("markup")]
550
+ }), /* @__PURE__ */ a("button", {
551
+ class: "ck-chip",
552
+ onClick: () => j("off"),
553
+ children: c("screenshotRemove")
554
+ })]
555
+ })]
556
+ }) : null,
557
+ A === "off" && w ? /* @__PURE__ */ a("button", {
558
+ class: "ck-chip",
559
+ style: { marginTop: "8px" },
560
+ onClick: () => j("ready"),
561
+ children: [/* @__PURE__ */ a(d, {
562
+ name: "image",
563
+ size: 14
564
+ }), c("screenshotAdd")]
565
+ }) : null,
566
+ nt ? /* @__PURE__ */ a("label", {
567
+ class: "ck-check",
568
+ children: [/* @__PURE__ */ a("input", {
569
+ type: "checkbox",
570
+ checked: rt,
571
+ onChange: (e) => it(e.target.checked)
572
+ }), c("includeDiagnostics")]
573
+ }) : null,
574
+ /* @__PURE__ */ a(me, {
575
+ items: V.items,
576
+ onRemove: V.remove,
577
+ onRetry: V.retry,
578
+ onOpen: Qe
579
+ })
580
+ ]
581
+ }),
582
+ /* @__PURE__ */ a("div", {
583
+ class: "ck-card-foot",
584
+ children: [
585
+ ze ? /* @__PURE__ */ a(ie, {
586
+ input: ut,
587
+ onFiles: mt
588
+ }) : null,
589
+ /* @__PURE__ */ a("span", { class: "ck-spacer" }),
590
+ /* @__PURE__ */ a("button", {
591
+ class: "ck-btn",
592
+ onClick: m,
593
+ children: c("cancel")
594
+ }),
595
+ /* @__PURE__ */ a("button", {
596
+ class: "ck-btn ck-primary",
597
+ disabled: Y || !S.trim() || !X,
598
+ onClick: () => void $(),
599
+ children: c(Y ? "sending" : at && !f ? "signIn" : "send")
600
+ })
601
+ ]
602
+ }),
603
+ Ye !== null && J ? /* @__PURE__ */ a(J, {
604
+ images: V.items.filter((e) => e.preview).map((e) => ({
605
+ src: e.preview,
606
+ name: e.file.name
607
+ })),
608
+ start: Ye,
609
+ onClose: () => Xe(null)
610
+ }) : null,
611
+ We && w ? /* @__PURE__ */ a(We, {
612
+ image: w.blob,
613
+ onCancel: () => B(null),
614
+ onDone: (e, t) => {
615
+ Fe({
616
+ ...w,
617
+ blob: e
618
+ }), Ue(t), B(null);
619
+ }
620
+ }) : null
621
+ ]
622
+ })] });
623
+ }
624
+ var ke = "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";
625
+ function Ae(e) {
626
+ let t = {};
627
+ 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;
628
+ }
629
+ function je(e) {
630
+ return e.region ? "50% 50%" : `50% ${Math.round(Math.min(100, Math.max(0, e.point.y / Math.max(1, innerHeight) * 100)))}%`;
631
+ }
632
+ var T = "commentkit:pending-extras";
633
+ function Me(e) {
634
+ try {
635
+ return `${new URL(e ?? "https://commentkit.dev").origin}/privacy`;
636
+ } catch {
637
+ return "https://commentkit.dev/privacy";
638
+ }
639
+ }
640
+ var E = "commentkit:guest-details";
641
+ function Ne() {
642
+ try {
643
+ let e = JSON.parse(sessionStorage.getItem(E) ?? "null"), t = (e, t) => typeof e == "string" ? e.slice(0, t) : "";
644
+ return {
645
+ name: t(e?.name, 120),
646
+ email: t(e?.email, 254)
647
+ };
648
+ } catch {
649
+ return {
650
+ name: "",
651
+ email: ""
652
+ };
653
+ }
654
+ }
655
+ function Pe(e) {
656
+ try {
657
+ let t = JSON.parse(sessionStorage.getItem(T) ?? "null");
658
+ return sessionStorage.removeItem(T), !t || t.id !== e ? null : {
659
+ checklist: Array.isArray(t.checklist) ? t.checklist.filter((e) => typeof e == "string").slice(0, 30) : null,
660
+ task: t.task && typeof t.task == "object" ? t.task : {},
661
+ markup: Array.isArray(t.markup) ? t.markup.filter((e) => !!e && typeof e == "object" && Array.isArray(e.points)).slice(0, 100) : [],
662
+ styles: ce(t.styles)
663
+ };
664
+ } catch {
665
+ return null;
666
+ }
667
+ }
668
+ function D(e, t) {
669
+ try {
670
+ sessionStorage.setItem(e, t);
671
+ } catch {}
672
+ }
673
+ function O(e) {
674
+ try {
675
+ sessionStorage.removeItem(e);
676
+ } catch {}
677
+ }
678
+ //#endregion
679
+ export { w as Composer, p as t, _ as warmCapture };