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