@commentkit/comment-kit 1.6.0 → 2.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 (136) hide show
  1. package/CHANGELOG.md +281 -597
  2. package/README.md +334 -154
  3. package/SECURITY.md +47 -46
  4. package/dist/node/THIRD_PARTY_NOTICES.txt +56 -0
  5. package/dist/node/browser.js +17 -0
  6. package/dist/node/cli/api.js +226 -0
  7. package/dist/node/cli/bin.js +18 -0
  8. package/dist/node/cli/credentials.js +268 -0
  9. package/dist/node/cli/doctor.js +725 -0
  10. package/dist/node/cli/format.js +54 -0
  11. package/dist/node/cli/init.js +372 -0
  12. package/dist/node/cli/main.js +519 -0
  13. package/dist/node/cli/mcp.js +114 -0
  14. package/dist/node/cli/open.js +20 -0
  15. package/dist/node/plugins/astro-B5y1Gtbf.js +31 -0
  16. package/dist/node/plugins/astro.js +26 -0
  17. package/dist/node/plugins/git-BIXLbL3f.js +92 -0
  18. package/dist/node/plugins/jsx-Bg4BdSph.js +7958 -0
  19. package/dist/node/plugins/next.js +48 -0
  20. package/dist/node/plugins/options-THop1K92.js +71 -0
  21. package/dist/node/plugins/transform-CKiAuSbk.js +1155 -0
  22. package/dist/node/plugins/vite-BdAYUW10.js +74 -0
  23. package/dist/node/plugins/vite.js +1 -0
  24. package/dist/node/plugins/webpack-R2U2DLlY.js +35 -0
  25. package/dist/node/plugins/webpack-loader.cjs +21 -0
  26. package/dist/node/plugins/webpack-loader.js +18 -0
  27. package/dist/node/plugins/webpack.js +1 -0
  28. package/dist/node/shared/endpoint.js +26 -0
  29. package/dist/node/shared/format.js +63 -0
  30. package/dist/node/types/astro.d.ts +11 -0
  31. package/dist/node/types/next.d.ts +34 -0
  32. package/dist/node/types/options.d.ts +59 -0
  33. package/dist/node/types/vite.d.ts +11 -0
  34. package/dist/node/types/webpack-loader.d.ts +22 -0
  35. package/dist/node/types/webpack.d.ts +27 -0
  36. package/dist/npm/THIRD_PARTY_NOTICES.txt +6 -6
  37. package/dist/npm/chunks/AgentSend-DxRJIYiz.js +68 -0
  38. package/dist/npm/chunks/Checklist-CnlfeSbc.js +282 -0
  39. package/dist/npm/chunks/Composer-B1bBVszY.js +725 -0
  40. package/dist/npm/chunks/Guest-vvNPz8h-.js +267 -0
  41. package/dist/npm/chunks/MarkupEditor-VCOXh9d2.js +338 -0
  42. package/dist/npm/chunks/Panel-F37vIL1K.js +1206 -0
  43. package/dist/npm/chunks/Settings-BGoZS2iV.js +231 -0
  44. package/dist/npm/chunks/Shortcuts-B2OMvczr.js +62 -0
  45. package/dist/npm/chunks/StyleEditor-CJ_d8Huf.js +46 -0
  46. package/dist/npm/chunks/StylePanel-yQzHHlY7.js +199 -0
  47. package/dist/npm/chunks/TaskFields-fmy6_HtK.js +289 -0
  48. package/dist/npm/chunks/ThreadCard-D51slKST.js +1113 -0
  49. package/dist/npm/chunks/Viewer-BOBadqmC.js +111 -0
  50. package/dist/npm/chunks/{agent-BDMQtOzH.js → agent-C1OQzBAm.js} +9 -9
  51. package/dist/npm/chunks/{anchor-BsradQhn.js → anchor-BsQNVkHj.js} +108 -85
  52. package/dist/npm/chunks/{ar-8tPch6W4.js → ar-CAJ3XT8e.js} +69 -19
  53. package/dist/npm/chunks/card-bits-CAnzrqx3.js +53 -0
  54. package/dist/npm/chunks/{client-EFTWxHbJ.js → client-kNAo2TTG.js} +282 -290
  55. package/dist/npm/chunks/confetti-CkBdSu19.js +49 -0
  56. package/dist/npm/chunks/context-B8UAzve0.js +20 -0
  57. package/dist/npm/chunks/context-BuMl7A07.js +48 -0
  58. package/dist/npm/chunks/{de-C63897uD.js → de-Dl18G48t.js} +60 -18
  59. package/dist/npm/chunks/dialog-GO04oC3D.js +3 -0
  60. package/dist/npm/chunks/dpop-U48QIQd7.js +96 -0
  61. package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
  62. package/dist/npm/chunks/{es-CI2bSpvB.js → es-Dxk79lS9.js} +60 -18
  63. package/dist/npm/chunks/extension-CKFpPWmi.js +62 -0
  64. package/dist/npm/chunks/{extension-BST6LH1q.js → extension-E81hWyiT.js} +20 -12
  65. package/dist/npm/chunks/files-DyD5BZgp.js +114 -0
  66. package/dist/npm/chunks/{fr-rsVe-Lqk.js → fr-8BebGKYD.js} +118 -76
  67. package/dist/npm/chunks/{hi-cvwbSaWP.js → hi-BIN6Yy_p.js} +61 -19
  68. package/dist/npm/chunks/{i18n-C4v0M-6z.js → i18n-DOBt8e9U.js} +91 -56
  69. package/dist/npm/chunks/identify-CN-3xzqL.js +106 -0
  70. package/dist/npm/chunks/{it-C8tnV0BF.js → it-Cr6EwpPQ.js} +79 -37
  71. package/dist/npm/chunks/{ja-BWxDfC2f.js → ja-Iy3s5aur.js} +58 -16
  72. package/dist/npm/chunks/late-words-B2bmZceJ.js +12 -0
  73. package/dist/npm/chunks/live-CelVeZfP.js +85 -0
  74. package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
  75. package/dist/npm/chunks/{nl-DNQ6eCht.js → nl-B84WHqqe.js} +61 -19
  76. package/dist/npm/chunks/page-key-DepmJzC1.js +62 -0
  77. package/dist/npm/chunks/{pick-CLyOdjnD.js → pick-yTyqtxN0.js} +45 -44
  78. package/dist/npm/chunks/pkce-ChKGSW_4.js +8 -0
  79. package/dist/npm/chunks/placement-BF_HOUDD.js +74 -0
  80. package/dist/npm/chunks/privacy-BWUGlHw5.js +57 -0
  81. package/dist/npm/chunks/{pt-BR-CkG7vpU2.js → pt-BR-DOkdlfoe.js} +60 -18
  82. package/dist/npm/chunks/{realtime-DIo-Wth4.js → realtime-C79zF50C.js} +14 -12
  83. package/dist/npm/chunks/report-CrIqQZDI.js +44 -0
  84. package/dist/npm/chunks/show-BgVC8gWY.js +97 -0
  85. package/dist/npm/chunks/signin-Dd1rb2BP.js +75 -0
  86. package/dist/npm/chunks/{source-CS7C6wJA.js → source-pXVve2Cx.js} +1 -1
  87. package/dist/npm/chunks/src-BTMy4Gyc.js +208 -0
  88. package/dist/npm/chunks/start-DtVlpt7p.js +1878 -0
  89. package/dist/npm/chunks/states-sfTbjZz8.js +3 -0
  90. package/dist/npm/chunks/upload-MgPYqPyE.js +42 -0
  91. package/dist/npm/chunks/uploads-D49mywwz.js +1146 -0
  92. package/dist/npm/chunks/wrap-Bl0gbnFa.js +69 -0
  93. package/dist/npm/chunks/{zh-CN-BKuZOLBE.js → zh-CN-Z5fQCb7G.js} +59 -17
  94. package/dist/npm/element.js +58 -21
  95. package/dist/npm/headless.js +7 -3
  96. package/dist/npm/index.js +3 -3
  97. package/dist/npm/react.js +18 -11
  98. package/dist/npm/svelte.js +28 -12
  99. package/dist/npm/types/adapters/react.d.ts +4 -1
  100. package/dist/npm/types/adapters/svelte.d.ts +4 -1
  101. package/dist/npm/types/adapters/vue.d.ts +35 -2
  102. package/dist/npm/types/anchor/index.d.ts +19 -0
  103. package/dist/npm/types/capture/privacy.d.ts +14 -0
  104. package/dist/npm/types/core/api.d.ts +20 -1
  105. package/dist/npm/types/core/auth.d.ts +40 -21
  106. package/dist/npm/types/core/client.d.ts +60 -4
  107. package/dist/npm/types/core/page-key.d.ts +42 -0
  108. package/dist/npm/types/core/types.d.ts +87 -4
  109. package/dist/npm/types/element.d.ts +17 -7
  110. package/dist/npm/types/headless.d.ts +2 -1
  111. package/dist/npm/types/index.d.ts +16 -6
  112. package/dist/npm/vue.js +44 -9
  113. package/package.json +88 -14
  114. package/dist/npm/chunks/AgentSend-2JPDseOo.js +0 -63
  115. package/dist/npm/chunks/Checklist-BpDXQebo.js +0 -257
  116. package/dist/npm/chunks/Composer-CAyj-c8e.js +0 -677
  117. package/dist/npm/chunks/Guest-ZdFmTcXI.js +0 -187
  118. package/dist/npm/chunks/MarkupEditor-BFplZwFy.js +0 -332
  119. package/dist/npm/chunks/Panel-BhZ4XRDR.js +0 -861
  120. package/dist/npm/chunks/Settings-SPG9EHUZ.js +0 -204
  121. package/dist/npm/chunks/Shortcuts-C28HVDw6.js +0 -58
  122. package/dist/npm/chunks/StyleEditor-ByZMtq10.js +0 -43
  123. package/dist/npm/chunks/StylePanel-Iwhce2tE.js +0 -197
  124. package/dist/npm/chunks/TaskFields-BsP_fVJg.js +0 -273
  125. package/dist/npm/chunks/ThreadCard-BzVZdDCb.js +0 -1030
  126. package/dist/npm/chunks/Viewer-CqtGrdD8.js +0 -108
  127. package/dist/npm/chunks/card-bits-Bna-g3Py.js +0 -124
  128. package/dist/npm/chunks/confetti-DTKpwF3O.js +0 -40
  129. package/dist/npm/chunks/drafts-akdBsOd0.js +0 -50
  130. package/dist/npm/chunks/extension-D-V3utTm.js +0 -53
  131. package/dist/npm/chunks/live-BCpJVBeN.js +0 -33
  132. package/dist/npm/chunks/report-BBrT3r89.js +0 -27
  133. package/dist/npm/chunks/src-C4FsVoUp.js +0 -148
  134. package/dist/npm/chunks/start-i9M-r3aH.js +0 -1800
  135. package/dist/npm/chunks/upload-DSv7EyBD.js +0 -41
  136. package/dist/npm/chunks/uploads-I01kdqQF.js +0 -1103
@@ -0,0 +1,725 @@
1
+ import { i as e } from "./src-BTMy4Gyc.js";
2
+ import { b as t, o as n, v as r } from "./client-kNAo2TTG.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, c as u, d as ee, f as d, g as f, p, u as m, y as te } from "./i18n-DOBt8e9U.js";
6
+ import { r as ne } from "./files-DyD5BZgp.js";
7
+ import { n as re, r as ie, t as ae } from "./card-bits-CAnzrqx3.js";
8
+ import { i as h } from "./drafts-B0ctr1g9.js";
9
+ import { a as oe, c as se, d as ce, f as le, h as ue, i as de, l as fe, m as pe, n as me, o as he, p as g, t as ge } from "./uploads-D49mywwz.js";
10
+ import { t as _ } from "./states-sfTbjZz8.js";
11
+ import { C as v, F as _e, M as ve, O as ye, _ as be, b as xe, c as Se, g as y, k as Ce, l as we, s as b, u as Te, y as x } from "./start-DtVlpt7p.js";
12
+ // src/capture/context.ts
13
+ function Ee() {
14
+ let e = navigator.userAgent, t = S(e, [
15
+ ["Edge", /Edg\/([\d.]+)/],
16
+ ["Opera", /OPR\/([\d.]+)/],
17
+ ["Samsung Internet", /SamsungBrowser\/([\d.]+)/],
18
+ ["Chrome", /Chrome\/([\d.]+)/],
19
+ ["Firefox", /Firefox\/([\d.]+)/],
20
+ ["Safari", /Version\/([\d.]+).*Safari/]
21
+ ]), n = S(e, [
22
+ ["iOS", /(?:iPhone|iPad|iPod).*OS ([\d_]+)/],
23
+ ["Android", /Android ([\d.]+)/],
24
+ ["Windows", /Windows NT ([\d.]+)/],
25
+ ["macOS", /Mac OS X ([\d_]+)/],
26
+ ["ChromeOS", /CrOS [^ ]+ ([\d.]+)/],
27
+ ["Linux", /Linux()/]
28
+ ]), r = innerWidth, i = matchMedia?.("(pointer: coarse)").matches ?? !1;
29
+ return {
30
+ viewport: {
31
+ width: r,
32
+ height: innerHeight,
33
+ dpr: Math.round((devicePixelRatio || 1) * 100) / 100,
34
+ zoom: Math.round((visualViewport?.scale ?? 1) * 100) / 100
35
+ },
36
+ device: {
37
+ browser: t?.[0],
38
+ browser_version: t?.[1]?.split(".")[0],
39
+ os: n?.[0],
40
+ os_version: n?.[1]?.replace(/_/g, "."),
41
+ type: i ? r >= 768 ? "tablet" : "mobile" : "desktop",
42
+ locale: navigator.language,
43
+ color_scheme: matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light",
44
+ user_agent: e.slice(0, 500)
45
+ }
46
+ };
47
+ }
48
+ function S(e, t) {
49
+ for (let [n, r] of t) {
50
+ let t = e.match(r);
51
+ if (t) return [n, t[1] ?? ""];
52
+ }
53
+ return null;
54
+ }
55
+ // src/capture/screenshot.ts
56
+ var C = 8e6, w = 15e3;
57
+ function De() {
58
+ e() || import("./html2canvas-pro.esm-B7b8p5Wr.js").catch(() => void 0);
59
+ }
60
+ async function Oe(t = {}) {
61
+ let n = (t.redact ?? []).filter(s), r = o(t.privacy), i = innerWidth, a = innerHeight, c = null;
62
+ e() && (c = await import("./extension-CKFpPWmi.js").then((e) => e.captureTab(n, r)).catch(() => null)), c ?? (c = await T(n, r, i, a));
63
+ let l = c.getContext("2d"), u = c.width / Math.max(1, i);
64
+ return l && ke(l, u, t), t.crop && t.region && (c = D(c, u, t.region, i, a)), {
65
+ blob: await je(c),
66
+ width: c.width,
67
+ height: c.height
68
+ };
69
+ }
70
+ async function T(e, t, n, r) {
71
+ 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), ee = (t) => t.tagName === "NOSCRIPT" || i(t, u) || e.some((e) => Me(t, e)), d = Math.min(devicePixelRatio || 1, 2, Math.sqrt(C / Math.max(1, n * r)));
72
+ return O(o(document.documentElement, {
73
+ useCORS: !0,
74
+ logging: !1,
75
+ backgroundColor: s(getComputedStyle(document.body).backgroundColor),
76
+ scale: d,
77
+ x: scrollX,
78
+ y: scrollY,
79
+ width: n,
80
+ height: r,
81
+ windowWidth: document.documentElement.clientWidth,
82
+ windowHeight: r,
83
+ ignoreElements: ee,
84
+ onclone: async (e) => {
85
+ await l(e), c(e);
86
+ }
87
+ }), w);
88
+ }
89
+ function ke(e, t, n) {
90
+ e.setTransform(1, 0, 0, 1, 0, 0);
91
+ let r = n.accent ?? "#ff5733";
92
+ if (n.region) {
93
+ let i = n.region;
94
+ 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();
95
+ }
96
+ if (n.pin) {
97
+ let i = n.pin.x * t, a = n.pin.y * t, o = 11 * t;
98
+ 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();
99
+ }
100
+ }
101
+ var E = {
102
+ w: 320,
103
+ h: 200
104
+ };
105
+ function Ae(e, t, n) {
106
+ let r = Math.min(t, Math.max(E.w, e.w + 64)), i = Math.min(n, Math.max(E.h, e.h + 64));
107
+ return {
108
+ x: Math.min(Math.max(0, e.x + e.w / 2 - r / 2), t - r),
109
+ y: Math.min(Math.max(0, e.y + e.h / 2 - i / 2), n - i),
110
+ w: r,
111
+ h: i
112
+ };
113
+ }
114
+ function D(e, t, n, r, i) {
115
+ let a = Ae(n, r, i), o = document.createElement("canvas");
116
+ 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;
117
+ }
118
+ function je(e) {
119
+ return new Promise((t, n) => {
120
+ e.toBlob((r) => {
121
+ if (r && r.type === "image/webp") return t(r);
122
+ e.toBlob((e) => e ? t(e) : n(/* @__PURE__ */ Error("Could not encode the screenshot.")), "image/png");
123
+ }, "image/webp", .86);
124
+ });
125
+ }
126
+ function O(e, t) {
127
+ return new Promise((n, r) => {
128
+ let i = setTimeout(() => r(/* @__PURE__ */ Error("The screenshot took too long. Your feedback will be sent without it.")), t);
129
+ e.then((e) => (clearTimeout(i), n(e)), (e) => (clearTimeout(i), r(e)));
130
+ });
131
+ }
132
+ function Me(e, t) {
133
+ try {
134
+ return e.matches(t) || !!e.closest(t);
135
+ } catch {
136
+ return !1;
137
+ }
138
+ }
139
+ b(_), b(ce);
140
+ function Ne({ client: e, draft: i, signedIn: a, onSignIn: o, onCancel: s, onSent: ce, onError: g, share: _ = null, onPending: ve }) {
141
+ let b = x(e.state, (e) => e.config), S = x(e.state, (e) => e.session?.person ?? null), C = l(() => Te(e, i.anchor), [i.anchor]), [w, De] = f(() => Ve()), [T, ke] = f(() => pe(C, void 0, Te(e, i.anchor, n()))), [E, Ae] = f([]), [D, je] = f(null), O = e.options.tools ?? {}, Me = b?.features.screenshots !== !1 && O.screenshots !== !1, Ne = O.attachments !== !1, [k, Ue] = f(Me ? "capturing" : "off"), j = x(e.state, (e) => !!e.session?.capabilities.triage), We = j && O.checklist !== !1, [M] = f(() => He(C)), [N, Ge] = f(M?.task ?? {}), [P, Ke] = f(() => !!Ie(M?.task ?? {})), [F, I] = f(M?.checklist ?? null), [L, qe] = f(""), Je = y(j, () => import("./TaskFields-fmy6_HtK.js").then((e) => e.TaskDraft), () => void 0), [R, Ye] = f(M?.markup ?? []), [Xe, z] = f(!1), Ze = y(Xe, () => import("./MarkupEditor-VCOXh9d2.js").then((e) => e.MarkupEditor), (e) => (z(!1), g(e))), B = me(e, (e) => g(new r(0, "file_rejected", e))), V = l(() => {
142
+ if (!j || O.style === !1 || i.anchor.type !== "element" && i.anchor.type !== "text") return null;
143
+ let e = c(i.anchor).element;
144
+ return e instanceof HTMLElement || e instanceof SVGElement ? e : null;
145
+ }, [i.anchor, j]), [H, Qe] = f(M?.styles ?? []), [U, $e] = f(!1), et = y(U, () => import("./StylePanel-yQzHHlY7.js").then((e) => e.StylePanel), g), W = p(null), G = p(null), tt = () => {
146
+ V && (W.current ?? (W.current = he(V)), G.current ?? (G.current = new de(V)), $e(!0));
147
+ };
148
+ d(() => {
149
+ U ? G.current?.apply(H) : G.current?.revert();
150
+ }, [U, H]), d(() => () => G.current?.revert(), []);
151
+ let [K, nt] = f(null), rt = y(K !== null, () => import("./Viewer-BOBadqmC.js").then((e) => e.Viewer), g), [q, it] = f(!1), [at, ot] = f(!1), st = !!(b?.features.console_capture || b?.features.network_capture), ct = x(e.state, (e) => !e.session || e.session.role === "guest"), [lt, ut] = f(b?.features.capture_consent_default === !0 && !ct), J = be(), [dt, ft] = f(!1), Y = !a && !!_ && !e.auth.pending(), [pt, mt] = f(null), ht = {
152
+ name: p(null),
153
+ email: p(null)
154
+ }, gt = p(null), X = p(null), _t = p(null), Z = p(null), vt = p(null), [yt] = f(() => (e) => {
155
+ e && !Z.current && Ce(e), Z.current = e;
156
+ }), bt = p(null), xt = (e, t) => {
157
+ let n = e.closest(".ck-draft-item");
158
+ ((n?.nextElementSibling ?? n?.previousElementSibling)?.querySelector(".ck-draft-item button, input") ?? t())?.focus();
159
+ }, St = p(Promise.resolve(null));
160
+ ee(() => {
161
+ if (k !== "capturing") return;
162
+ let t = !1, n = 0, r = 0;
163
+ return St.current = new Promise((a) => {
164
+ let o = !1, s = () => {
165
+ if (!o) {
166
+ if (o = !0, t) return a(null);
167
+ Oe({
168
+ redact: [...b?.privacy.redact_selectors ?? [], ...e.options.redact ?? []],
169
+ privacy: Se(b, e.options.privacy),
170
+ pin: i.region ? null : i.point,
171
+ region: i.region,
172
+ crop: !!i.region
173
+ }).then(a, () => a(null));
174
+ }
175
+ };
176
+ n = requestAnimationFrame(() => n = requestAnimationFrame(s)), r = window.setTimeout(s, 300);
177
+ }), St.current.then((e) => {
178
+ t || (e && je(e), Ue(e ? "ready" : "failed"));
179
+ }), () => {
180
+ t = !0, cancelAnimationFrame(n), clearTimeout(r);
181
+ };
182
+ }, []);
183
+ let Q = l(() => D && URL.createObjectURL(D.blob), [D]);
184
+ d(() => () => void (Q && URL.revokeObjectURL(Q)), [Q]);
185
+ let Ct = (e) => {
186
+ ke(e), ue(C, e);
187
+ };
188
+ d(() => {
189
+ X.current = null;
190
+ }, [
191
+ T,
192
+ E,
193
+ D,
194
+ k,
195
+ R,
196
+ B.items,
197
+ lt,
198
+ N,
199
+ F,
200
+ H
201
+ ]);
202
+ let wt = !P && !!Ie(N), Tt = l(() => ie(i.point, i.region ? {
203
+ top: i.region.y,
204
+ bottom: i.region.y + i.region.h
205
+ } : void 0), [i.point]), Et = (e) => B.add(e), Dt = async () => {
206
+ let n = null, r = null, a = k === "capturing" ? await St.current : k === "ready" ? D : null;
207
+ if (a) try {
208
+ let t = a.blob.type, r = `screenshot.${t === "image/webp" ? "webp" : t === "image/jpeg" ? "jpg" : "png"}`;
209
+ n = (await e.upload(a.blob, r, "screenshot")).id;
210
+ } catch {
211
+ r = "screenshot";
212
+ }
213
+ let o = await B.ready(), s = o.ids;
214
+ o.missing && (r ?? (r = "files"));
215
+ let c = {
216
+ ...Ee(),
217
+ ...st && lt ? _e() : {},
218
+ screenshot_id: n,
219
+ markup: R.length ? R : void 0
220
+ }, l = j ? Ie(N) : void 0, u = [...F ?? [], ...F && L.trim() ? [L.trim()] : []], ee = V ? oe(H) : [];
221
+ return {
222
+ key: t(16),
223
+ input: {
224
+ anchor: i.anchor,
225
+ body: T.trim(),
226
+ capture: c,
227
+ attachmentIds: s,
228
+ mentionIds: E,
229
+ task: l,
230
+ checklist: u,
231
+ styleChanges: ee
232
+ },
233
+ missing: r
234
+ };
235
+ }, $ = async () => {
236
+ if (q || !T.trim() || !J) return;
237
+ if (ot(!1), !a && !_ && !dt) {
238
+ ft(!0);
239
+ return;
240
+ }
241
+ let t = Y ? w.name.trim() ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(w.email.trim()) ? null : "email" : "name" : null;
242
+ if (mt(t), t) return ht[t].current?.focus();
243
+ it(!0);
244
+ try {
245
+ let t = !a && !_;
246
+ if (Y && _) {
247
+ let { startGuest: n } = await import("./Guest-vvNPz8h-.js");
248
+ h(Be, JSON.stringify({
249
+ name: w.name,
250
+ email: w.email
251
+ })), t = await n(e, {
252
+ share: _,
253
+ ...w
254
+ }) === "popup";
255
+ }
256
+ if (t) {
257
+ if (h(we, JSON.stringify({
258
+ draft: i,
259
+ scrollY
260
+ })), h(A, JSON.stringify({
261
+ id: C,
262
+ checklist: F,
263
+ task: N,
264
+ markup: R,
265
+ styles: H
266
+ })), !await o()) return;
267
+ h(we, null), h(A, null);
268
+ }
269
+ let n = X.current ?? (X.current = await Dt()), r = await e.createThread({
270
+ ...n.input,
271
+ idempotencyKey: n.key
272
+ });
273
+ if (X.current = null, r.pending_verification) return ve?.(e.auth.pending()?.email ?? w.email);
274
+ le(C), h(Be, null), ce(r, n.missing);
275
+ } catch (t) {
276
+ if (t instanceof r && ["pending_limit", "verification_required"].includes(t.code) && e.auth.pending()) return ve?.(e.auth.pending().email);
277
+ let n = re(t);
278
+ ot(n ?? !0), n || g(t);
279
+ } finally {
280
+ it(!1);
281
+ }
282
+ };
283
+ return /* @__PURE__ */ m(te, { children: [i.region ? /* @__PURE__ */ m("div", {
284
+ class: "ck-pending-region",
285
+ style: ye(i.region.x, i.region.y, i.region.w, i.region.h),
286
+ "aria-hidden": "true",
287
+ "data-commentkit-ui": !0
288
+ }) : i.anchor.type === "page" ? null : /* @__PURE__ */ m("div", {
289
+ class: "ck-pending-pin",
290
+ style: ye(i.point.x, i.point.y),
291
+ "aria-hidden": "true",
292
+ "data-commentkit-ui": !0,
293
+ children: [/* @__PURE__ */ m("svg", {
294
+ viewBox: "5 3 54 62",
295
+ children: /* @__PURE__ */ m("path", { d: Fe })
296
+ }), S ? /* @__PURE__ */ m(xe, { person: S }) : null]
297
+ }), /* @__PURE__ */ m("div", {
298
+ class: "ck-card ck-composer",
299
+ style: Tt,
300
+ role: "region",
301
+ "aria-label": u("comment"),
302
+ "data-commentkit-ui": !0,
303
+ onKeyDown: (e) => e.key === "Escape" && s(!0),
304
+ ...Ne ? ne(Et) : {},
305
+ children: [
306
+ /* @__PURE__ */ m("div", {
307
+ class: "ck-card-body",
308
+ children: [
309
+ i.anchor.quote ? /* @__PURE__ */ m("blockquote", {
310
+ class: "ck-quote",
311
+ "aria-label": u("quotedText"),
312
+ children: /* @__PURE__ */ m("bdi", { children: i.anchor.quote.slice(0, 200) })
313
+ }) : null,
314
+ J ? null : /* @__PURE__ */ m("div", {
315
+ class: "ck-note",
316
+ "data-tone": "warning",
317
+ role: "status",
318
+ children: u("offlineSend")
319
+ }),
320
+ at && J ? /* @__PURE__ */ m("div", {
321
+ class: "ck-note",
322
+ "data-tone": "warning",
323
+ role: "alert",
324
+ children: at === !0 ? /* @__PURE__ */ m(te, { children: [
325
+ u("sendFailed"),
326
+ " ",
327
+ /* @__PURE__ */ m("button", {
328
+ class: "ck-btn",
329
+ onClick: () => (_t.current?.focus(), void $()),
330
+ children: u("retry")
331
+ })
332
+ ] }) : `${at} ${u("savedHere")}`
333
+ }) : null,
334
+ /* @__PURE__ */ m(fe, {
335
+ client: e,
336
+ value: T,
337
+ onChange: Ct,
338
+ onMentions: Ae,
339
+ onSubmit: () => void $(),
340
+ placeholder: u("composerPlaceholder"),
341
+ autofocus: !0,
342
+ disabled: q,
343
+ canMention: a
344
+ }),
345
+ F === null ? null : /* @__PURE__ */ m("div", {
346
+ class: "ck-draft-list",
347
+ role: "group",
348
+ "aria-label": u("checklist"),
349
+ children: [F.map((e, t) => /* @__PURE__ */ m("div", {
350
+ class: "ck-draft-item",
351
+ children: [
352
+ /* @__PURE__ */ m("span", {
353
+ "aria-hidden": "true",
354
+ class: "ck-draft-box"
355
+ }),
356
+ /* @__PURE__ */ m("bdi", { children: e }),
357
+ /* @__PURE__ */ m("button", {
358
+ class: "ck-ghost ck-ghost-sm",
359
+ "aria-label": u("removeItem", { item: e }),
360
+ onClick: (e) => {
361
+ xt(e.currentTarget, () => Z.current ?? vt.current), I(F.filter((e, n) => n !== t));
362
+ },
363
+ children: /* @__PURE__ */ m(v, {
364
+ name: "close",
365
+ size: 12
366
+ })
367
+ })
368
+ ]
369
+ })), F.length < 30 ? /* @__PURE__ */ m("input", {
370
+ class: "ck-input",
371
+ maxLength: 300,
372
+ placeholder: u("checklistAdd"),
373
+ "aria-label": u("checklistAdd"),
374
+ enterKeyHint: "done",
375
+ value: L,
376
+ ref: yt,
377
+ onInput: (e) => qe(e.target.value),
378
+ onKeyDown: (e) => {
379
+ e.key !== "Escape" && e.stopPropagation(), e.key === "Enter" && L.trim() && (e.preventDefault(), I([...F, L.trim()]), qe(""));
380
+ }
381
+ }) : null]
382
+ }),
383
+ H.length ? /* @__PURE__ */ m("div", {
384
+ class: "ck-draft-list ck-style-list",
385
+ role: "group",
386
+ "aria-label": u("styleChanges"),
387
+ children: H.map((e) => /* @__PURE__ */ m("div", {
388
+ class: "ck-draft-item",
389
+ children: [/* @__PURE__ */ m("code", { children: se(e) }), /* @__PURE__ */ m("button", {
390
+ class: "ck-ghost ck-ghost-sm",
391
+ "aria-label": u("styleRemoveChange", { change: se(e) }),
392
+ onClick: (t) => {
393
+ xt(t.currentTarget, () => bt.current), Qe(H.filter((t) => t.property !== e.property));
394
+ },
395
+ children: /* @__PURE__ */ m(v, {
396
+ name: "close",
397
+ size: 12
398
+ })
399
+ })]
400
+ }))
401
+ }) : null,
402
+ U && et && W.current ? /* @__PURE__ */ m(et, {
403
+ base: W.current,
404
+ changes: H,
405
+ onChange: Qe,
406
+ onClose: () => $e(!1)
407
+ }) : null,
408
+ j && Je && P ? /* @__PURE__ */ m(Je, {
409
+ client: e,
410
+ value: N,
411
+ onChange: Ge
412
+ }) : null,
413
+ Y || dt && !a ? /* @__PURE__ */ m("div", {
414
+ class: "ck-note",
415
+ children: [
416
+ /* @__PURE__ */ m("strong", { children: u(Y ? "guestIntro" : "signInToSend") }),
417
+ /* @__PURE__ */ m("div", { children: u(_ ? "guestExplain" : "signInExplain") }),
418
+ Y ? /* @__PURE__ */ m("div", {
419
+ class: "ck-guest",
420
+ children: [["name", "email"].map((e) => /* @__PURE__ */ m("div", {
421
+ class: "ck-field",
422
+ children: [
423
+ /* @__PURE__ */ m("label", {
424
+ for: `ck-guest-${e}`,
425
+ children: u(e === "name" ? "guestName" : "guestEmail")
426
+ }),
427
+ /* @__PURE__ */ m("input", {
428
+ id: `ck-guest-${e}`,
429
+ ref: ht[e],
430
+ class: "ck-input",
431
+ type: e === "email" ? "email" : "text",
432
+ autoComplete: e,
433
+ maxLength: e === "name" ? 120 : 254,
434
+ enterKeyHint: "send",
435
+ autoCapitalize: e === "name" ? "words" : "off",
436
+ value: w[e],
437
+ "aria-invalid": pt === e,
438
+ "aria-describedby": pt === e ? "ck-guest-error" : void 0,
439
+ onInput: (t) => {
440
+ let n = t.target.value;
441
+ De((t) => ({
442
+ ...t,
443
+ [e]: n
444
+ }));
445
+ },
446
+ onKeyDown: (e) => {
447
+ e.key !== "Escape" && e.stopPropagation(), e.key === "Enter" && $();
448
+ }
449
+ }),
450
+ pt === e ? /* @__PURE__ */ m("span", {
451
+ class: "ck-error",
452
+ id: "ck-guest-error",
453
+ role: "alert",
454
+ children: u(e === "name" ? "guestNameMissing" : "guestEmailInvalid")
455
+ }) : null
456
+ ]
457
+ })), /* @__PURE__ */ m("p", {
458
+ class: "ck-muted ck-guest-privacy",
459
+ children: [
460
+ u("guestPrivacy"),
461
+ " ",
462
+ /* @__PURE__ */ m("a", {
463
+ href: ze(e.options.endpoint),
464
+ target: "_blank",
465
+ rel: "noopener noreferrer",
466
+ children: u("guestPrivacyLink")
467
+ }),
468
+ Re(b) ? /* @__PURE__ */ m(te, { children: [" · ", /* @__PURE__ */ m("a", {
469
+ href: Re(b),
470
+ target: "_blank",
471
+ rel: "noopener noreferrer",
472
+ children: u("guestPrivacySite", { website: b?.project.name ?? "" })
473
+ })] }) : null
474
+ ]
475
+ })]
476
+ }) : null
477
+ ]
478
+ }) : null,
479
+ k === "capturing" ? /* @__PURE__ */ m("div", {
480
+ class: "ck-shot ck-shot-wait",
481
+ children: /* @__PURE__ */ m("span", {
482
+ class: "ck-muted",
483
+ children: u("capturing")
484
+ })
485
+ }) : null,
486
+ k === "failed" ? /* @__PURE__ */ m("p", {
487
+ class: "ck-muted",
488
+ children: u("capturingFailed")
489
+ }) : null,
490
+ k === "ready" && Q ? /* @__PURE__ */ m("div", {
491
+ class: "ck-shot",
492
+ children: [/* @__PURE__ */ m("button", {
493
+ class: "ck-shot-open",
494
+ "aria-label": u("openImage", { name: u("screenshot") }),
495
+ onClick: () => nt(-1),
496
+ children: /* @__PURE__ */ m("img", {
497
+ src: Q,
498
+ alt: u("screenshotIncluded"),
499
+ title: u("screenshotIncluded"),
500
+ style: { objectPosition: Le(i) }
501
+ })
502
+ }), /* @__PURE__ */ m("div", {
503
+ class: "ck-shot-tools",
504
+ children: [O.markup === !1 ? null : /* @__PURE__ */ m("button", {
505
+ class: "ck-chip",
506
+ onClick: () => z(!0),
507
+ children: [/* @__PURE__ */ m(v, {
508
+ name: "pen",
509
+ size: 14
510
+ }), u("markup")]
511
+ }), /* @__PURE__ */ m("button", {
512
+ class: "ck-chip",
513
+ onClick: () => Ue("off"),
514
+ children: u("screenshotRemove")
515
+ })]
516
+ })]
517
+ }) : null,
518
+ k === "off" && D ? /* @__PURE__ */ m("button", {
519
+ class: "ck-chip ck-shot-add",
520
+ onClick: () => Ue("ready"),
521
+ children: [/* @__PURE__ */ m(v, {
522
+ name: "image",
523
+ size: 14
524
+ }), u("screenshotAdd")]
525
+ }) : null,
526
+ st ? /* @__PURE__ */ m("label", {
527
+ class: "ck-check",
528
+ children: [/* @__PURE__ */ m("input", {
529
+ type: "checkbox",
530
+ checked: lt,
531
+ onChange: (e) => ut(e.target.checked)
532
+ }), u("includeDiagnostics")]
533
+ }) : null,
534
+ st ? /* @__PURE__ */ m(Pe, {}) : null,
535
+ /* @__PURE__ */ m(ge, {
536
+ items: B.items,
537
+ onRemove: B.remove,
538
+ onRetry: B.retry,
539
+ onOpen: nt
540
+ })
541
+ ]
542
+ }),
543
+ /* @__PURE__ */ m("div", {
544
+ class: "ck-card-foot",
545
+ children: [
546
+ /* @__PURE__ */ m("div", {
547
+ class: "ck-tools",
548
+ children: [
549
+ Ne ? /* @__PURE__ */ m(ae, {
550
+ input: gt,
551
+ onFiles: Et,
552
+ types: b?.limits?.upload_types
553
+ }) : null,
554
+ We ? /* @__PURE__ */ m("button", {
555
+ ref: vt,
556
+ class: "ck-ghost",
557
+ "data-tool": "checklist",
558
+ "aria-label": u("addChecklist"),
559
+ title: u("addChecklist"),
560
+ "aria-pressed": F === null ? !1 : !F.length || void 0,
561
+ onClick: () => F?.length ? Z.current?.focus() : F === null ? I([]) : (qe(""), I(null)),
562
+ children: /* @__PURE__ */ m("svg", {
563
+ width: "16",
564
+ height: "16",
565
+ viewBox: "0 0 24 24",
566
+ fill: "none",
567
+ stroke: "currentColor",
568
+ "stroke-width": "2",
569
+ "stroke-linecap": "round",
570
+ "stroke-linejoin": "round",
571
+ "aria-hidden": "true",
572
+ children: /* @__PURE__ */ m("path", { d: "m3 6 2 2 4-4M3 16l2 2 4-4M13 7h8M13 17h8" })
573
+ })
574
+ }) : null,
575
+ j && Je ? /* @__PURE__ */ m("button", {
576
+ class: "ck-ghost",
577
+ "data-tool": "task",
578
+ "aria-label": u("taskDetails"),
579
+ title: u("taskDetails"),
580
+ "aria-pressed": P,
581
+ "data-set": wt ? "" : void 0,
582
+ "aria-describedby": wt ? "ck-task-set" : void 0,
583
+ onClick: () => Ke(!P),
584
+ children: [/* @__PURE__ */ m("svg", {
585
+ width: "16",
586
+ height: "16",
587
+ viewBox: "0 0 24 24",
588
+ fill: "none",
589
+ stroke: "currentColor",
590
+ "stroke-width": "2",
591
+ "stroke-linecap": "round",
592
+ "stroke-linejoin": "round",
593
+ "aria-hidden": "true",
594
+ children: /* @__PURE__ */ m("path", { d: "M5 21V4h11l-2 4 2 4H5" })
595
+ }), /* @__PURE__ */ m("span", {
596
+ id: "ck-task-set",
597
+ hidden: !0,
598
+ children: u("taskDetailsSet")
599
+ })]
600
+ }) : null,
601
+ V ? /* @__PURE__ */ m("button", {
602
+ ref: bt,
603
+ class: "ck-ghost",
604
+ "data-tool": "style",
605
+ "aria-label": u("adjustStyle"),
606
+ title: u("adjustStyle"),
607
+ "aria-pressed": U,
608
+ onClick: () => U ? $e(!1) : tt(),
609
+ children: /* @__PURE__ */ m("svg", {
610
+ width: "16",
611
+ height: "16",
612
+ viewBox: "0 0 24 24",
613
+ fill: "none",
614
+ stroke: "currentColor",
615
+ "stroke-width": "2",
616
+ "stroke-linecap": "round",
617
+ "stroke-linejoin": "round",
618
+ "aria-hidden": "true",
619
+ children: /* @__PURE__ */ m("path", { d: "M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6" })
620
+ })
621
+ }) : null
622
+ ]
623
+ }),
624
+ /* @__PURE__ */ m("span", { class: "ck-spacer" }),
625
+ /* @__PURE__ */ m("button", {
626
+ class: "ck-btn",
627
+ onClick: () => s(),
628
+ children: u("cancel")
629
+ }),
630
+ /* @__PURE__ */ m("button", {
631
+ ref: _t,
632
+ class: "ck-btn ck-primary",
633
+ "aria-disabled": q || !T.trim() || !J || void 0,
634
+ onClick: () => void $(),
635
+ children: u(q ? "sending" : dt && !a ? "signIn" : "send")
636
+ })
637
+ ]
638
+ }),
639
+ K !== null && rt ? /* @__PURE__ */ m(rt, {
640
+ images: K < 0 && Q ? [{
641
+ src: Q,
642
+ name: u("screenshot")
643
+ }] : B.items.filter((e) => e.preview).map((e) => ({
644
+ src: e.preview,
645
+ name: e.file.name
646
+ })),
647
+ start: Math.max(0, K),
648
+ onClose: () => nt(null)
649
+ }) : null,
650
+ Xe && Ze && D ? /* @__PURE__ */ m(Ze, {
651
+ image: D.blob,
652
+ onCancel: () => z(!1),
653
+ onDone: (e, t) => {
654
+ je({
655
+ ...D,
656
+ blob: e
657
+ }), Ye(t), z(!1);
658
+ }
659
+ }) : null
660
+ ]
661
+ })] });
662
+ }
663
+ function Pe() {
664
+ let [e, t] = f(!1), n = e ? k(_e()) : [];
665
+ return /* @__PURE__ */ m("details", {
666
+ class: "ck-diag",
667
+ onToggle: (e) => t(e.currentTarget.open),
668
+ children: [/* @__PURE__ */ m("summary", { children: u("diagnosticsSee") }), e ? n.length ? /* @__PURE__ */ m("ul", { children: n.map((e) => /* @__PURE__ */ m("li", { children: /* @__PURE__ */ m("bdi", { children: e }) })) }) : /* @__PURE__ */ m("p", {
669
+ class: "ck-muted",
670
+ children: u("diagnosticsEmpty")
671
+ }) : null]
672
+ });
673
+ }
674
+ function k(e) {
675
+ return [...(e.console ?? []).map((e) => `${e.level}: ${e.message}`), ...(e.network ?? []).map((e) => `${e.method} ${e.url} ${e.status}`)];
676
+ }
677
+ var Fe = "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";
678
+ function Ie(e) {
679
+ let t = {};
680
+ 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;
681
+ }
682
+ function Le(e) {
683
+ return e.region ? "50% 50%" : `50% ${Math.round(Math.min(100, Math.max(0, e.point.y / Math.max(1, innerHeight) * 100)))}%`;
684
+ }
685
+ var A = "commentkit:pending-extras";
686
+ function Re(e) {
687
+ let t = ve(e?.privacy?.notice_url);
688
+ return t?.startsWith("https:") ? t : null;
689
+ }
690
+ function ze(e) {
691
+ try {
692
+ return `${new URL(e ?? "https://commentkit.dev").origin}/privacy`;
693
+ } catch {
694
+ return "https://commentkit.dev/privacy";
695
+ }
696
+ }
697
+ var Be = "commentkit:guest-details";
698
+ function Ve() {
699
+ try {
700
+ let e = JSON.parse(h(Be) ?? "null"), t = (e, t) => typeof e == "string" ? e.slice(0, t) : "";
701
+ return {
702
+ name: t(e?.name, 120),
703
+ email: t(e?.email, 254)
704
+ };
705
+ } catch {
706
+ return {
707
+ name: "",
708
+ email: ""
709
+ };
710
+ }
711
+ }
712
+ function He(e) {
713
+ try {
714
+ let t = JSON.parse(h(A) ?? "null");
715
+ return h(A, null), !t || g(t.id) !== g(e) ? null : {
716
+ checklist: Array.isArray(t.checklist) ? t.checklist.filter((e) => typeof e == "string").slice(0, 30) : null,
717
+ task: t.task && typeof t.task == "object" ? t.task : {},
718
+ markup: Array.isArray(t.markup) ? t.markup.filter((e) => !!e && typeof e == "object" && Array.isArray(e.points)).slice(0, 100) : [],
719
+ styles: oe(t.styles)
720
+ };
721
+ } catch {
722
+ return null;
723
+ }
724
+ }
725
+ export { Ne as Composer, De as warmCapture };