@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
@@ -0,0 +1,727 @@
1
+ import { a as e } from "./src-C8rZFyL_.js";
2
+ import { b as t, o as n, v as r } from "./client-7eVxvg5j.js";
3
+ import { a as i, c as a, o, s } from "./privacy-BWUGlHw5.js";
4
+ import { s as c } from "./anchor-BsQNVkHj.js";
5
+ import { _ as l, b as u, c as d, d as ee, f, m as p, u as m, v as h } from "./i18n-aVSu9TcJ.js";
6
+ import { r as te } from "./files-4lV9YQIX.js";
7
+ import { n as ne, r as re, t as ie } from "./card-bits-CTdrkYn8.js";
8
+ import { i as g } from "./drafts-B0ctr1g9.js";
9
+ import { a as ae, c as oe, d as se, f as ce, h as le, i as ue, l as de, m as fe, n as pe, o as me, p as _, t as he } from "./uploads-8AxyRq7g.js";
10
+ import { t as v } from "./states-b9Bv3Ci7.js";
11
+ import { C as y, F as ge, M as _e, O as ve, _ as ye, b as be, c as xe, g as b, k as Se, l as Ce, s as x, u as we, y as S } from "./start-CV4j78_q.js";
12
+ // src/capture/context.ts
13
+ function Te() {
14
+ let e = navigator.userAgent, t = C(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 = C(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 C(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 w = 8e6, T = 15e3;
57
+ function Ee() {
58
+ e() || import("./html2canvas-pro.esm-B7b8p5Wr.js").catch(() => void 0);
59
+ }
60
+ async function De(t = {}) {
61
+ let n = (t.redact ?? []).filter(s), r = o(t.privacy), i = innerWidth, a = innerHeight, c = null;
62
+ e() && (c = await import("./extension-DFVOvciD.js").then((e) => e.captureTab(n, r)).catch(() => null)), c ?? (c = await E(n, r, i, a));
63
+ let l = c.getContext("2d"), u = c.width / Math.max(1, i);
64
+ return l && Oe(l, u, t), t.crop && t.region && (c = O(c, u, t.region, i, a)), {
65
+ blob: await Ae(c),
66
+ width: c.width,
67
+ height: c.height
68
+ };
69
+ }
70
+ async function E(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), d = (t) => t.tagName === "NOSCRIPT" || i(t, u) || e.some((e) => je(t, e)), ee = Math.min(devicePixelRatio || 1, 2, Math.sqrt(w / Math.max(1, n * r)));
72
+ return k(o(document.documentElement, {
73
+ useCORS: !0,
74
+ logging: !1,
75
+ backgroundColor: s(getComputedStyle(document.body).backgroundColor),
76
+ scale: ee,
77
+ x: scrollX,
78
+ y: scrollY,
79
+ width: n,
80
+ height: r,
81
+ windowWidth: document.documentElement.clientWidth,
82
+ windowHeight: r,
83
+ ignoreElements: d,
84
+ onclone: async (e) => {
85
+ await l(e), c(e);
86
+ }
87
+ }), T);
88
+ }
89
+ function Oe(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 D = {
102
+ w: 320,
103
+ h: 200
104
+ };
105
+ function ke(e, t, n) {
106
+ let r = Math.min(t, Math.max(D.w, e.w + 64)), i = Math.min(n, Math.max(D.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 O(e, t, n, r, i) {
115
+ let a = ke(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 Ae(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 k(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 je(e, t) {
133
+ try {
134
+ return e.matches(t) || !!e.closest(t);
135
+ } catch {
136
+ return !1;
137
+ }
138
+ }
139
+ x(v), x(se);
140
+ function Me({ client: e, draft: i, signedIn: a, onSignIn: o, onCancel: s, onSent: se, onError: _, share: v = null, onPending: _e }) {
141
+ let x = S(e.state, (e) => e.config), C = S(e.state, (e) => e.session?.person ?? null), w = h(() => we(e, i.anchor), [i.anchor]), [T, Ee] = l(() => Be()), [E, Oe] = l(() => fe(w, void 0, we(e, i.anchor, n()))), [D, ke] = l([]), [O, Ae] = l(null), k = e.options.tools ?? {}, je = x?.features.screenshots !== !1 && k.screenshots !== !1, Me = k.attachments !== !1, [A, He] = l(je ? "capturing" : "off"), M = S(e.state, (e) => !!e.session?.capabilities.triage), Ue = M && k.checklist !== !1, [N] = l(() => Ve(w)), [P, We] = l(N?.task ?? {}), [F, Ge] = l(() => !!Fe(N?.task ?? {})), [I, L] = l(N?.checklist ?? null), [R, Ke] = l(""), qe = b(M, () => import("./TaskFields-C8BX0Sgg.js").then((e) => e.TaskDraft), () => void 0), [z, Je] = l(N?.markup ?? []), [Ye, B] = l(!1), Xe = b(Ye, () => import("./MarkupEditor-6bJGpWGO.js").then((e) => e.MarkupEditor), (e) => (B(!1), _(e))), V = pe(e, (e) => _(new r(0, "file_rejected", e))), H = h(() => {
142
+ if (!M || k.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, M]), [U, Ze] = l(N?.styles ?? []), [W, Qe] = l(!1), $e = b(W, () => import("./StylePanel-B4pHQUL9.js").then((e) => e.StylePanel), _), G = p(null), K = p(null), et = () => {
146
+ H && (G.current ?? (G.current = me(H)), K.current ?? (K.current = new ue(H)), Qe(!0));
147
+ };
148
+ f(() => {
149
+ W ? K.current?.apply(U) : K.current?.revert();
150
+ }, [W, U]), f(() => () => K.current?.revert(), []);
151
+ let [q, tt] = l(null), nt = b(q !== null, () => import("./Viewer-DY6zb90M.js").then((e) => e.Viewer), _), [J, rt] = l(!1), [it, at] = l(!1), ot = !!(x?.features.console_capture || x?.features.network_capture), st = S(e.state, (e) => !e.session || e.session.role === "guest"), [ct, lt] = l(x?.features.capture_consent_default === !0 && !st), Y = ye(), [ut, dt] = l(!1), X = !a && !!v && !e.auth.pending(), [ft, pt] = l(null), mt = {
152
+ name: p(null),
153
+ email: p(null)
154
+ }, ht = p(null), Z = p(null), gt = p(null), Q = p(null), _t = p(null), [vt] = l(() => (e) => {
155
+ e && !Q.current && Se(e), Q.current = e;
156
+ }), yt = p(null), bt = (e, t) => {
157
+ let n = e.closest(".ck-draft-item");
158
+ ((n?.nextElementSibling ?? n?.previousElementSibling)?.querySelector(".ck-draft-item button, input") ?? t())?.focus();
159
+ }, xt = p(Promise.resolve(null));
160
+ ee(() => {
161
+ if (A !== "capturing") return;
162
+ let t = !1, n = 0, r = 0;
163
+ return xt.current = new Promise((a) => {
164
+ let o = !1, s = () => {
165
+ if (!o) {
166
+ if (o = !0, t) return a(null);
167
+ De({
168
+ redact: [...x?.privacy.redact_selectors ?? [], ...e.options.redact ?? []],
169
+ privacy: xe(x, 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
+ }), xt.current.then((e) => {
178
+ t || (e && Ae(e), He(e ? "ready" : "failed"));
179
+ }), () => {
180
+ t = !0, cancelAnimationFrame(n), clearTimeout(r);
181
+ };
182
+ }, []);
183
+ let $ = h(() => O && URL.createObjectURL(O.blob), [O]);
184
+ f(() => () => void ($ && URL.revokeObjectURL($)), [$]);
185
+ let St = (e) => {
186
+ Oe(e), le(w, e);
187
+ };
188
+ f(() => {
189
+ Z.current = null;
190
+ }, [
191
+ E,
192
+ D,
193
+ O,
194
+ A,
195
+ z,
196
+ V.items,
197
+ ct,
198
+ P,
199
+ I,
200
+ U
201
+ ]);
202
+ let Ct = !F && !!Fe(P), wt = h(() => re(i.point, i.region ? {
203
+ top: i.region.y,
204
+ bottom: i.region.y + i.region.h
205
+ } : void 0), [i.point]), Tt = (e) => V.add(e), Et = async () => {
206
+ let n = null, r = null, a = A === "capturing" ? await xt.current : A === "ready" ? O : 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 V.ready(), s = o.ids;
214
+ o.missing && (r ?? (r = "files"));
215
+ let c = {
216
+ ...Te(),
217
+ ...ot && ct ? ge() : {},
218
+ screenshot_id: n,
219
+ markup: z.length ? z : void 0
220
+ }, l = M ? Fe(P) : void 0, u = [...I ?? [], ...I && R.trim() ? [R.trim()] : []], d = H ? ae(U) : [];
221
+ return {
222
+ key: t(16),
223
+ input: {
224
+ anchor: i.anchor,
225
+ body: E.trim(),
226
+ capture: c,
227
+ attachmentIds: s,
228
+ mentionIds: D,
229
+ task: l,
230
+ checklist: u,
231
+ styleChanges: d
232
+ },
233
+ missing: r
234
+ };
235
+ }, Dt = async () => {
236
+ if (J || !E.trim() || !Y) return;
237
+ if (at(!1), !a && !v && !ut) {
238
+ dt(!0);
239
+ return;
240
+ }
241
+ let t = X ? T.name.trim() ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(T.email.trim()) ? null : "email" : "name" : null;
242
+ if (pt(t), t) return mt[t].current?.focus();
243
+ rt(!0);
244
+ try {
245
+ let t = !a && !v;
246
+ if (X && v) {
247
+ let { startGuest: n } = await import("./Guest-7hcN765o.js");
248
+ g(ze, JSON.stringify({
249
+ name: T.name,
250
+ email: T.email
251
+ })), t = await n(e, {
252
+ share: v,
253
+ ...T
254
+ }) === "popup";
255
+ }
256
+ if (t) {
257
+ if (g(Ce, JSON.stringify({
258
+ draft: i,
259
+ scrollY
260
+ })), g(j, JSON.stringify({
261
+ id: w,
262
+ checklist: I,
263
+ task: P,
264
+ markup: z,
265
+ styles: U
266
+ })), !await o()) return;
267
+ g(Ce, null), g(j, null);
268
+ }
269
+ let n = Z.current ?? (Z.current = await Et()), r = await e.createThread({
270
+ ...n.input,
271
+ idempotencyKey: n.key
272
+ });
273
+ if (Z.current = null, r.pending_verification) return _e?.(e.auth.pending()?.email ?? T.email);
274
+ ce(w), g(ze, null), se(r, n.missing);
275
+ } catch (t) {
276
+ if (t instanceof r && ["pending_limit", "verification_required"].includes(t.code) && e.auth.pending()) return _e?.(e.auth.pending().email);
277
+ let n = ne(t);
278
+ at(n ?? !0), n || _(t);
279
+ } finally {
280
+ rt(!1);
281
+ }
282
+ };
283
+ return /* @__PURE__ */ m(u, { children: [i.region ? /* @__PURE__ */ m("div", {
284
+ class: "ck-pending-region",
285
+ style: ve(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: ve(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: Pe })
296
+ }), C ? /* @__PURE__ */ m(be, { person: C }) : null]
297
+ }), /* @__PURE__ */ m("div", {
298
+ class: "ck-card ck-composer",
299
+ style: wt,
300
+ role: "region",
301
+ "aria-label": d("comment"),
302
+ "data-commentkit-ui": !0,
303
+ onKeyDown: (e) => e.key === "Escape" && s(!0),
304
+ ...Me ? te(Tt) : {},
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": d("quotedText"),
312
+ children: /* @__PURE__ */ m("bdi", { children: i.anchor.quote.slice(0, 200) })
313
+ }) : null,
314
+ Y ? null : /* @__PURE__ */ m("div", {
315
+ class: "ck-note",
316
+ "data-tone": "warning",
317
+ role: "status",
318
+ children: d("offlineSend")
319
+ }),
320
+ it && Y ? /* @__PURE__ */ m("div", {
321
+ class: "ck-note",
322
+ "data-tone": "warning",
323
+ role: "alert",
324
+ children: it === !0 ? /* @__PURE__ */ m(u, { children: [
325
+ d("sendFailed"),
326
+ " ",
327
+ /* @__PURE__ */ m("button", {
328
+ class: "ck-btn",
329
+ onClick: () => (gt.current?.focus(), void Dt()),
330
+ children: d("retry")
331
+ })
332
+ ] }) : `${it} ${d("savedHere")}`
333
+ }) : null,
334
+ /* @__PURE__ */ m(de, {
335
+ client: e,
336
+ value: E,
337
+ onChange: St,
338
+ onMentions: ke,
339
+ onSubmit: () => void Dt(),
340
+ placeholder: d("composerPlaceholder"),
341
+ autofocus: !0,
342
+ disabled: J,
343
+ canMention: a
344
+ }),
345
+ I === null ? null : /* @__PURE__ */ m("div", {
346
+ class: "ck-draft-list",
347
+ role: "group",
348
+ "aria-label": d("checklist"),
349
+ children: [I.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": d("removeItem", { item: e }),
360
+ title: d("removeItem", { item: e }),
361
+ onClick: (e) => {
362
+ bt(e.currentTarget, () => Q.current ?? _t.current), L(I.filter((e, n) => n !== t));
363
+ },
364
+ children: /* @__PURE__ */ m(y, {
365
+ name: "close",
366
+ size: 12
367
+ })
368
+ })
369
+ ]
370
+ })), I.length < 30 ? /* @__PURE__ */ m("input", {
371
+ class: "ck-input",
372
+ maxLength: 300,
373
+ placeholder: d("checklistAdd"),
374
+ "aria-label": d("checklistAdd"),
375
+ enterKeyHint: "done",
376
+ value: R,
377
+ ref: vt,
378
+ onInput: (e) => Ke(e.target.value),
379
+ onKeyDown: (e) => {
380
+ e.key !== "Escape" && e.stopPropagation(), e.key === "Enter" && R.trim() && (e.preventDefault(), L([...I, R.trim()]), Ke(""));
381
+ }
382
+ }) : null]
383
+ }),
384
+ U.length ? /* @__PURE__ */ m("div", {
385
+ class: "ck-draft-list ck-style-list",
386
+ role: "group",
387
+ "aria-label": d("styleChanges"),
388
+ children: U.map((e) => /* @__PURE__ */ m("div", {
389
+ class: "ck-draft-item",
390
+ children: [/* @__PURE__ */ m("code", { children: oe(e) }), /* @__PURE__ */ m("button", {
391
+ class: "ck-ghost ck-ghost-sm",
392
+ "aria-label": d("styleRemoveChange", { change: oe(e) }),
393
+ title: d("styleRemoveChange", { change: oe(e) }),
394
+ onClick: (t) => {
395
+ bt(t.currentTarget, () => yt.current), Ze(U.filter((t) => t.property !== e.property));
396
+ },
397
+ children: /* @__PURE__ */ m(y, {
398
+ name: "close",
399
+ size: 12
400
+ })
401
+ })]
402
+ }))
403
+ }) : null,
404
+ W && $e && G.current ? /* @__PURE__ */ m($e, {
405
+ base: G.current,
406
+ changes: U,
407
+ onChange: Ze,
408
+ onClose: () => Qe(!1)
409
+ }) : null,
410
+ M && qe && F ? /* @__PURE__ */ m(qe, {
411
+ client: e,
412
+ value: P,
413
+ onChange: We
414
+ }) : null,
415
+ X || ut && !a ? /* @__PURE__ */ m("div", {
416
+ class: "ck-note",
417
+ children: [
418
+ /* @__PURE__ */ m("strong", { children: d(X ? "guestIntro" : "signInToSend") }),
419
+ /* @__PURE__ */ m("div", { children: d(v ? "guestExplain" : "signInExplain") }),
420
+ X ? /* @__PURE__ */ m("div", {
421
+ class: "ck-guest",
422
+ children: [["name", "email"].map((e) => /* @__PURE__ */ m("div", {
423
+ class: "ck-field",
424
+ children: [
425
+ /* @__PURE__ */ m("label", {
426
+ for: `ck-guest-${e}`,
427
+ children: d(e === "name" ? "guestName" : "guestEmail")
428
+ }),
429
+ /* @__PURE__ */ m("input", {
430
+ id: `ck-guest-${e}`,
431
+ ref: mt[e],
432
+ class: "ck-input",
433
+ type: e === "email" ? "email" : "text",
434
+ autoComplete: e,
435
+ maxLength: e === "name" ? 120 : 254,
436
+ enterKeyHint: "send",
437
+ autoCapitalize: e === "name" ? "words" : "off",
438
+ value: T[e],
439
+ "aria-invalid": ft === e,
440
+ "aria-describedby": ft === e ? "ck-guest-error" : void 0,
441
+ onInput: (t) => {
442
+ let n = t.target.value;
443
+ Ee((t) => ({
444
+ ...t,
445
+ [e]: n
446
+ }));
447
+ },
448
+ onKeyDown: (e) => {
449
+ e.key !== "Escape" && e.stopPropagation(), e.key === "Enter" && Dt();
450
+ }
451
+ }),
452
+ ft === e ? /* @__PURE__ */ m("span", {
453
+ class: "ck-error",
454
+ id: "ck-guest-error",
455
+ role: "alert",
456
+ children: d(e === "name" ? "guestNameMissing" : "guestEmailInvalid")
457
+ }) : null
458
+ ]
459
+ })), /* @__PURE__ */ m("p", {
460
+ class: "ck-muted ck-guest-privacy",
461
+ children: [
462
+ d("guestPrivacy"),
463
+ " ",
464
+ /* @__PURE__ */ m("a", {
465
+ href: Re(e.options.endpoint),
466
+ target: "_blank",
467
+ rel: "noopener noreferrer",
468
+ children: d("guestPrivacyLink")
469
+ }),
470
+ Le(x) ? /* @__PURE__ */ m(u, { children: [" · ", /* @__PURE__ */ m("a", {
471
+ href: Le(x),
472
+ target: "_blank",
473
+ rel: "noopener noreferrer",
474
+ children: d("guestPrivacySite", { website: x?.project.name ?? "" })
475
+ })] }) : null
476
+ ]
477
+ })]
478
+ }) : null
479
+ ]
480
+ }) : null,
481
+ A === "capturing" ? /* @__PURE__ */ m("div", {
482
+ class: "ck-shot ck-shot-wait",
483
+ children: /* @__PURE__ */ m("span", {
484
+ class: "ck-muted",
485
+ children: d("capturing")
486
+ })
487
+ }) : null,
488
+ A === "failed" ? /* @__PURE__ */ m("p", {
489
+ class: "ck-muted",
490
+ children: d("capturingFailed")
491
+ }) : null,
492
+ A === "ready" && $ ? /* @__PURE__ */ m("div", {
493
+ class: "ck-shot",
494
+ children: [/* @__PURE__ */ m("button", {
495
+ class: "ck-shot-open",
496
+ "aria-label": d("openImage", { name: d("screenshot") }),
497
+ onClick: () => tt(-1),
498
+ children: /* @__PURE__ */ m("img", {
499
+ src: $,
500
+ alt: d("screenshotIncluded"),
501
+ title: d("screenshotIncluded"),
502
+ style: { objectPosition: Ie(i) }
503
+ })
504
+ }), /* @__PURE__ */ m("div", {
505
+ class: "ck-shot-tools",
506
+ children: [k.markup === !1 ? null : /* @__PURE__ */ m("button", {
507
+ class: "ck-chip",
508
+ onClick: () => B(!0),
509
+ children: [/* @__PURE__ */ m(y, {
510
+ name: "pen",
511
+ size: 14
512
+ }), d("markup")]
513
+ }), /* @__PURE__ */ m("button", {
514
+ class: "ck-chip",
515
+ onClick: () => He("off"),
516
+ children: d("screenshotRemove")
517
+ })]
518
+ })]
519
+ }) : null,
520
+ A === "off" && O ? /* @__PURE__ */ m("button", {
521
+ class: "ck-chip ck-shot-add",
522
+ onClick: () => He("ready"),
523
+ children: [/* @__PURE__ */ m(y, {
524
+ name: "image",
525
+ size: 14
526
+ }), d("screenshotAdd")]
527
+ }) : null,
528
+ ot ? /* @__PURE__ */ m("label", {
529
+ class: "ck-check",
530
+ children: [/* @__PURE__ */ m("input", {
531
+ type: "checkbox",
532
+ checked: ct,
533
+ onChange: (e) => lt(e.target.checked)
534
+ }), d("includeDiagnostics")]
535
+ }) : null,
536
+ ot ? /* @__PURE__ */ m(Ne, {}) : null,
537
+ /* @__PURE__ */ m(he, {
538
+ items: V.items,
539
+ onRemove: V.remove,
540
+ onRetry: V.retry,
541
+ onOpen: tt
542
+ })
543
+ ]
544
+ }),
545
+ /* @__PURE__ */ m("div", {
546
+ class: "ck-card-foot",
547
+ children: [
548
+ /* @__PURE__ */ m("div", {
549
+ class: "ck-tools",
550
+ children: [
551
+ Me ? /* @__PURE__ */ m(ie, {
552
+ input: ht,
553
+ onFiles: Tt,
554
+ types: x?.limits?.upload_types
555
+ }) : null,
556
+ Ue ? /* @__PURE__ */ m("button", {
557
+ ref: _t,
558
+ class: "ck-ghost",
559
+ "data-tool": "checklist",
560
+ "aria-label": d("addChecklist"),
561
+ title: d("addChecklist"),
562
+ "aria-pressed": I === null ? !1 : !I.length || void 0,
563
+ onClick: () => I?.length ? Q.current?.focus() : I === null ? L([]) : (Ke(""), L(null)),
564
+ children: /* @__PURE__ */ m("svg", {
565
+ width: "16",
566
+ height: "16",
567
+ viewBox: "0 0 24 24",
568
+ fill: "none",
569
+ stroke: "currentColor",
570
+ "stroke-width": "2",
571
+ "stroke-linecap": "round",
572
+ "stroke-linejoin": "round",
573
+ "aria-hidden": "true",
574
+ children: /* @__PURE__ */ m("path", { d: "m3 6 2 2 4-4M3 16l2 2 4-4M13 7h8M13 17h8" })
575
+ })
576
+ }) : null,
577
+ M && qe ? /* @__PURE__ */ m("button", {
578
+ class: "ck-ghost",
579
+ "data-tool": "task",
580
+ "aria-label": d("taskDetails"),
581
+ title: d("taskDetails"),
582
+ "aria-pressed": F,
583
+ "data-set": Ct ? "" : void 0,
584
+ "aria-describedby": Ct ? "ck-task-set" : void 0,
585
+ onClick: () => Ge(!F),
586
+ children: [/* @__PURE__ */ m("svg", {
587
+ width: "16",
588
+ height: "16",
589
+ viewBox: "0 0 24 24",
590
+ fill: "none",
591
+ stroke: "currentColor",
592
+ "stroke-width": "2",
593
+ "stroke-linecap": "round",
594
+ "stroke-linejoin": "round",
595
+ "aria-hidden": "true",
596
+ children: /* @__PURE__ */ m("path", { d: "M5 21V4h11l-2 4 2 4H5" })
597
+ }), /* @__PURE__ */ m("span", {
598
+ id: "ck-task-set",
599
+ hidden: !0,
600
+ children: d("taskDetailsSet")
601
+ })]
602
+ }) : null,
603
+ H ? /* @__PURE__ */ m("button", {
604
+ ref: yt,
605
+ class: "ck-ghost",
606
+ "data-tool": "style",
607
+ "aria-label": d("adjustStyle"),
608
+ title: d("adjustStyle"),
609
+ "aria-pressed": W,
610
+ onClick: () => W ? Qe(!1) : et(),
611
+ children: /* @__PURE__ */ m("svg", {
612
+ width: "16",
613
+ height: "16",
614
+ viewBox: "0 0 24 24",
615
+ fill: "none",
616
+ stroke: "currentColor",
617
+ "stroke-width": "2",
618
+ "stroke-linecap": "round",
619
+ "stroke-linejoin": "round",
620
+ "aria-hidden": "true",
621
+ children: /* @__PURE__ */ m("path", { d: "M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6" })
622
+ })
623
+ }) : null
624
+ ]
625
+ }),
626
+ /* @__PURE__ */ m("span", { class: "ck-spacer" }),
627
+ /* @__PURE__ */ m("button", {
628
+ class: "ck-btn",
629
+ onClick: () => s(),
630
+ children: d("cancel")
631
+ }),
632
+ /* @__PURE__ */ m("button", {
633
+ ref: gt,
634
+ class: "ck-btn ck-primary",
635
+ "aria-disabled": J || !E.trim() || !Y || void 0,
636
+ onClick: () => void Dt(),
637
+ children: d(J ? "sending" : ut && !a ? "signIn" : "send")
638
+ })
639
+ ]
640
+ }),
641
+ q !== null && nt ? /* @__PURE__ */ m(nt, {
642
+ images: q < 0 && $ ? [{
643
+ src: $,
644
+ name: d("screenshot")
645
+ }] : V.items.filter((e) => e.preview).map((e) => ({
646
+ src: e.preview,
647
+ name: e.file.name
648
+ })),
649
+ start: Math.max(0, q),
650
+ onClose: () => tt(null)
651
+ }) : null,
652
+ Ye && Xe && O ? /* @__PURE__ */ m(Xe, {
653
+ image: O.blob,
654
+ onCancel: () => B(!1),
655
+ onDone: (e, t) => {
656
+ Ae({
657
+ ...O,
658
+ blob: e
659
+ }), Je(t), B(!1);
660
+ }
661
+ }) : null
662
+ ]
663
+ })] });
664
+ }
665
+ function Ne() {
666
+ let [e, t] = l(!1), n = e ? A(ge()) : [];
667
+ return /* @__PURE__ */ m("details", {
668
+ class: "ck-diag",
669
+ onToggle: (e) => t(e.currentTarget.open),
670
+ children: [/* @__PURE__ */ m("summary", { children: d("diagnosticsSee") }), e ? n.length ? /* @__PURE__ */ m("ul", { children: n.map((e) => /* @__PURE__ */ m("li", { children: /* @__PURE__ */ m("bdi", { children: e }) })) }) : /* @__PURE__ */ m("p", {
671
+ class: "ck-muted",
672
+ children: d("diagnosticsEmpty")
673
+ }) : null]
674
+ });
675
+ }
676
+ function A(e) {
677
+ return [...(e.console ?? []).map((e) => `${e.level}: ${e.message}`), ...(e.network ?? []).map((e) => `${e.method} ${e.url} ${e.status}`)];
678
+ }
679
+ var Pe = "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";
680
+ function Fe(e) {
681
+ let t = {};
682
+ 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;
683
+ }
684
+ function Ie(e) {
685
+ return e.region ? "50% 50%" : `50% ${Math.round(Math.min(100, Math.max(0, e.point.y / Math.max(1, innerHeight) * 100)))}%`;
686
+ }
687
+ var j = "commentkit:pending-extras";
688
+ function Le(e) {
689
+ let t = _e(e?.privacy?.notice_url);
690
+ return t?.startsWith("https:") ? t : null;
691
+ }
692
+ function Re(e) {
693
+ try {
694
+ return `${new URL(e ?? "https://commentkit.dev").origin}/privacy`;
695
+ } catch {
696
+ return "https://commentkit.dev/privacy";
697
+ }
698
+ }
699
+ var ze = "commentkit:guest-details";
700
+ function Be() {
701
+ try {
702
+ let e = JSON.parse(g(ze) ?? "null"), t = (e, t) => typeof e == "string" ? e.slice(0, t) : "";
703
+ return {
704
+ name: t(e?.name, 120),
705
+ email: t(e?.email, 254)
706
+ };
707
+ } catch {
708
+ return {
709
+ name: "",
710
+ email: ""
711
+ };
712
+ }
713
+ }
714
+ function Ve(e) {
715
+ try {
716
+ let t = JSON.parse(g(j) ?? "null");
717
+ return g(j, null), !t || _(t.id) !== _(e) ? null : {
718
+ checklist: Array.isArray(t.checklist) ? t.checklist.filter((e) => typeof e == "string").slice(0, 30) : null,
719
+ task: t.task && typeof t.task == "object" ? t.task : {},
720
+ markup: Array.isArray(t.markup) ? t.markup.filter((e) => !!e && typeof e == "object" && Array.isArray(e.points)).slice(0, 100) : [],
721
+ styles: ae(t.styles)
722
+ };
723
+ } catch {
724
+ return null;
725
+ }
726
+ }
727
+ export { Me as Composer, A as diagnosticsLines, Re as privacyNotice, Le as siteNotice, Ee as warmCapture };