@commentkit/comment-kit 1.0.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +126 -1
  2. package/README.md +12 -5
  3. package/SECURITY.md +3 -1
  4. package/dist/npm/THIRD_PARTY_NOTICES.txt +22 -23
  5. package/dist/npm/chunks/AgentSend-DyWxNQ0p.js +64 -0
  6. package/dist/npm/chunks/Checklist-VYkSl6Q9.js +259 -0
  7. package/dist/npm/chunks/Composer-CnsGQirF.js +679 -0
  8. package/dist/npm/chunks/Guest-DkIvY5zt.js +170 -0
  9. package/dist/npm/chunks/MarkupEditor-DxTI9nJH.js +334 -0
  10. package/dist/npm/chunks/Panel-riaMYxt-.js +863 -0
  11. package/dist/npm/chunks/Settings-CB4zxQAL.js +206 -0
  12. package/dist/npm/chunks/{Shortcuts-3AOERWBh.js → Shortcuts-D1cbajg_.js} +21 -17
  13. package/dist/npm/chunks/StyleEditor-BtTv3I8_.js +44 -0
  14. package/dist/npm/chunks/StylePanel-BI-n5Me1.js +199 -0
  15. package/dist/npm/chunks/TaskFields-HwrD0FrH.js +272 -0
  16. package/dist/npm/chunks/ThreadCard-CjaC8BTa.js +1026 -0
  17. package/dist/npm/chunks/Viewer-BnWshSXb.js +110 -0
  18. package/dist/npm/chunks/agent-Cr6NB6We.js +146 -0
  19. package/dist/npm/chunks/anchor-OCQnjp_6.js +294 -0
  20. package/dist/npm/chunks/{ar-BVQ4ToG2.js → ar-BQ9K9Oqf.js} +188 -7
  21. package/dist/npm/chunks/card-bits-CxteYiZ9.js +126 -0
  22. package/dist/npm/chunks/client-CJ1tpI62.js +754 -0
  23. package/dist/npm/chunks/colors-0Ied7PE2.js +101 -0
  24. package/dist/npm/chunks/confetti-DKeKR7-6.js +41 -0
  25. package/dist/npm/chunks/{de-CamSq76K.js → de-CcPi8xdC.js} +159 -7
  26. package/dist/npm/chunks/drafts-CpQdHhcK.js +51 -0
  27. package/dist/npm/chunks/{es-BBIlcnsU.js → es-DXgkjDCG.js} +159 -7
  28. package/dist/npm/chunks/extension-BIGfr4Gh.js +50 -0
  29. package/dist/npm/chunks/{extension-CLm_T7Vj.js → extension-DkDSW4qw.js} +2 -2
  30. package/dist/npm/chunks/{fr-BXsff0Zz.js → fr-IjJaUbWh.js} +159 -7
  31. package/dist/npm/chunks/{hi-y-APBuxh.js → hi-BhKQK2MU.js} +159 -7
  32. package/dist/npm/chunks/html2canvas-pro.esm-lgs6tb4C.js +8378 -0
  33. package/dist/npm/chunks/i18n-DAJGndZ2.js +904 -0
  34. package/dist/npm/chunks/{it-C5MH_Ktv.js → it-DKiSCkiD.js} +159 -7
  35. package/dist/npm/chunks/{ja-s1JJld2J.js → ja-BI1WagDg.js} +159 -7
  36. package/dist/npm/chunks/{live-CkVrNM1-.js → live-B-mo27Qq.js} +1 -1
  37. package/dist/npm/chunks/lock-C82sC17d.js +30 -0
  38. package/dist/npm/chunks/{nl-CFzRMEfl.js → nl-CJw3VUQ5.js} +159 -7
  39. package/dist/npm/chunks/pick-CYPkLLFJ.js +120 -0
  40. package/dist/npm/chunks/{pt-BR-DE_r-5UM.js → pt-BR-CjBolC5g.js} +159 -7
  41. package/dist/npm/chunks/{pusher-BSsQoE1K.js → realtime-D22tI_AS.js} +58 -4
  42. package/dist/npm/chunks/source-CTQmAh0Y.js +146 -0
  43. package/dist/npm/chunks/src-CgBEoWl0.js +150 -0
  44. package/dist/npm/chunks/start-DW9_DKmf.js +1783 -0
  45. package/dist/npm/chunks/upload-BmrpZE5G.js +42 -0
  46. package/dist/npm/chunks/uploads-CipONvCy.js +541 -0
  47. package/dist/npm/chunks/{zh-CN--gibO2l7.js → zh-CN-BrZGx2S0.js} +159 -7
  48. package/dist/npm/element.js +4 -5
  49. package/dist/npm/headless.js +3 -3
  50. package/dist/npm/index.js +2 -2
  51. package/dist/npm/react.js +1 -1
  52. package/dist/npm/svelte.js +1 -1
  53. package/dist/npm/types/adapters/vue.d.ts +14 -0
  54. package/dist/npm/types/anchor/index.d.ts +22 -1
  55. package/dist/npm/types/core/api.d.ts +3 -0
  56. package/dist/npm/types/core/auth.d.ts +11 -0
  57. package/dist/npm/types/core/client.d.ts +128 -6
  58. package/dist/npm/types/core/types.d.ts +78 -4
  59. package/dist/npm/types/headless.d.ts +1 -1
  60. package/dist/npm/types/index.d.ts +6 -1
  61. package/dist/npm/vue.js +5 -1
  62. package/package.json +6 -3
  63. package/dist/npm/chunks/Guest-CdfnuD8T.js +0 -157
  64. package/dist/npm/chunks/MarkupEditor-Clb17Tse.js +0 -199
  65. package/dist/npm/chunks/Panel-CgvEbZXr.js +0 -438
  66. package/dist/npm/chunks/ThreadCard-DuGKe-gE.js +0 -817
  67. package/dist/npm/chunks/anchor-DT-Ynhh1.js +0 -270
  68. package/dist/npm/chunks/art-Bn9_ANNS.js +0 -155
  69. package/dist/npm/chunks/client-CS5oL_LQ.js +0 -620
  70. package/dist/npm/chunks/colors-CX-IPjvb.js +0 -86
  71. package/dist/npm/chunks/extension-DWHHer7j.js +0 -26
  72. package/dist/npm/chunks/format-CP2xZaec.js +0 -524
  73. package/dist/npm/chunks/html2canvas-DfGb8yka.js +0 -4024
  74. package/dist/npm/chunks/mount-VmnAiANB.js +0 -1507
  75. package/dist/npm/chunks/privacy-DLhezjyi.js +0 -30
  76. package/dist/npm/chunks/realtime-CBRW9BB3.js +0 -34
  77. package/dist/npm/chunks/src-DG8ehgE9.js +0 -549
@@ -1,30 +0,0 @@
1
- var e = "iframe,[data-commentkit],[data-commentkit-host],[data-commentkit-ui],[data-commentkit-panel],[data-commentkit-redact],[data-html2canvas-ignore],input[type=\"password\"],input[type=\"hidden\"]," + [
2
- "current-password",
3
- "new-password",
4
- "one-time-code",
5
- "cc-name",
6
- "cc-given-name",
7
- "cc-additional-name",
8
- "cc-family-name",
9
- "cc-number",
10
- "cc-exp",
11
- "cc-exp-month",
12
- "cc-exp-year",
13
- "cc-csc",
14
- "cc-type"
15
- ].map((e) => `[autocomplete~="${e}" i]`).join(",");
16
- function t(t) {
17
- try {
18
- let n = t;
19
- for (; n;) {
20
- if (n.closest(e)) return !0;
21
- let t = n.getRootNode();
22
- n = t instanceof ShadowRoot ? t.host : null;
23
- }
24
- return !1;
25
- } catch {
26
- return !0;
27
- }
28
- }
29
- //#endregion
30
- export { t as n, e as t };
@@ -1,34 +0,0 @@
1
- import { r as e } from "./rolldown-runtime-Y_bBpyJl.js";
2
- //#region src/core/realtime.ts
3
- async function t(t) {
4
- let { default: n } = await import("./pusher-BSsQoE1K.js").then((t) => /* @__PURE__ */ e(t.default, 1)), r = new n(t.key, {
5
- wsHost: t.host,
6
- wsPort: t.port,
7
- wssPort: t.port,
8
- forceTLS: t.scheme === "https",
9
- enabledTransports: ["ws", "wss"],
10
- disableStats: !0,
11
- cluster: "",
12
- channelAuthorization: {
13
- transport: "ajax",
14
- endpoint: "/unused",
15
- customHandler: (e, n) => {
16
- t.authorize(e.socketId, e.channelName).then((e) => n(null, e), (e) => n(e, null));
17
- }
18
- }
19
- }), i = r.subscribe(`presence-ck.project.${t.projectId}`);
20
- i.bind("feedback.changed", (e) => t.onFeedback(e));
21
- let a = () => t.onPresence?.(i.members?.count ?? 0);
22
- for (let e of [
23
- "pusher:subscription_succeeded",
24
- "pusher:member_added",
25
- "pusher:member_removed"
26
- ]) i.bind(e, a);
27
- return r.subscribe(`private-ck.inbox.${t.inbox}`).bind("inbox.changed", (e) => {
28
- (e.project_id == null || String(e.project_id) === String(t.projectId)) && t.onInbox(e.unread);
29
- }), { disconnect: () => {
30
- r.disconnect(), t.onPresence?.(0);
31
- } };
32
- }
33
- //#endregion
34
- export { t as connect };
@@ -1,549 +0,0 @@
1
- import { c as e, t } from "./client-CS5oL_LQ.js";
2
- //#region src/activation.ts
3
- var n = "commentkit:active", r = "data-commentkit-extension";
4
- function i() {
5
- return document.documentElement.hasAttribute(r);
6
- }
7
- function a(e = location.origin) {
8
- let t = new URL(e).hostname;
9
- return t === "localhost" || t === "127.0.0.1" || t === "[::1]" || t.endsWith(".localhost") || t.endsWith(".test");
10
- }
11
- function o(e, t = !0) {
12
- if (!t || a() || i()) return !0;
13
- let r = new URLSearchParams(location.search);
14
- if (r.has("ck") || r.has("ck_thread") || r.has("ck_code")) return !0;
15
- try {
16
- let t = `commentkit:v1:${e}`;
17
- return !!localStorage.getItem(t) || !!sessionStorage.getItem(t) || localStorage.getItem(n) === "1";
18
- } catch {
19
- return !1;
20
- }
21
- }
22
- function s(e) {
23
- try {
24
- e ? localStorage.setItem(n, "1") : localStorage.removeItem(n);
25
- } catch {}
26
- }
27
- function c(e) {
28
- let t = (t) => {
29
- (t.metaKey || t.ctrlKey) && t.shiftKey && t.key.toLowerCase() === "k" && (t.preventDefault(), e());
30
- };
31
- return addEventListener("keydown", t), () => removeEventListener("keydown", t);
32
- }
33
- //#endregion
34
- //#region src/capture/diagnostics.ts
35
- var l = 20, u = /token|key|secret|passw|^pass$|auth|code|session|sig|credential|^x-amz-|ck_invite/i, d = [], f = [], p = !1;
36
- function m(e) {
37
- if (p) return () => void 0;
38
- p = !0;
39
- let t = [];
40
- if (e.console) {
41
- for (let e of ["error", "warn"]) {
42
- let n = console[e];
43
- console[e] = (...t) => {
44
- _(d, {
45
- level: e,
46
- message: b(t.map(x).join(" ")).slice(0, 1e3),
47
- at: (/* @__PURE__ */ new Date()).toISOString()
48
- }), n.apply(console, t);
49
- }, t.push(() => console[e] = n);
50
- }
51
- let e = (e) => _(d, {
52
- level: "error",
53
- message: b(e.message || String(e.error)).slice(0, 1e3),
54
- at: (/* @__PURE__ */ new Date()).toISOString()
55
- }), n = (e) => _(d, {
56
- level: "error",
57
- message: b(`Unhandled promise rejection: ${x(e.reason)}`).slice(0, 1e3),
58
- at: (/* @__PURE__ */ new Date()).toISOString()
59
- });
60
- addEventListener("error", e), addEventListener("unhandledrejection", n), t.push(() => removeEventListener("error", e), () => removeEventListener("unhandledrejection", n));
61
- }
62
- if (e.network && typeof fetch == "function") {
63
- let e = window.fetch;
64
- window.fetch = async (...t) => {
65
- let n = performance.now(), r = (t[1]?.method ?? (t[0] instanceof Request ? t[0].method : "GET")).toUpperCase(), i = t[0] instanceof Request ? t[0].url : String(t[0]);
66
- try {
67
- let a = await e(...t);
68
- return a.status >= 400 && g(r, i, a.status, n), a;
69
- } catch (e) {
70
- throw g(r, i, 0, n), e;
71
- }
72
- }, t.push(() => window.fetch = e);
73
- }
74
- if (e.network && typeof XMLHttpRequest == "function") {
75
- let e = XMLHttpRequest.prototype, { open: n, send: r } = e, i = /* @__PURE__ */ new WeakMap();
76
- e.open = function(e, t, ...r) {
77
- return i.set(this, {
78
- method: String(e).toUpperCase(),
79
- url: String(t)
80
- }), n.call(this, e, t, ...r);
81
- }, e.send = function(e) {
82
- let t = i.get(this), n = performance.now();
83
- return t && this.addEventListener("loadend", () => {
84
- (this.status >= 400 || this.status === 0) && g(t.method, t.url, this.status, n);
85
- }, { once: !0 }), r.call(this, e);
86
- }, t.push(() => {
87
- e.open = n, e.send = r;
88
- });
89
- }
90
- return () => {
91
- t.forEach((e) => e()), p = !1;
92
- };
93
- }
94
- function h() {
95
- return {
96
- console: d.length ? [...d] : void 0,
97
- network: f.length ? [...f] : void 0
98
- };
99
- }
100
- function g(e, t, n, r) {
101
- t.includes("/api/v1/") || _(f, {
102
- method: e.slice(0, 10),
103
- url: y(t).slice(0, 2e3),
104
- status: n,
105
- duration_ms: Math.round(performance.now() - r)
106
- });
107
- }
108
- function _(e, t) {
109
- e.push(t), e.length > l && e.shift();
110
- }
111
- function v(e) {
112
- if (e.length < 24 || !/^[\w~+/=.-]+$/.test(e) || !/\d/.test(e) || !/[a-z]/i.test(e) || /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)) return !1;
113
- let t = /* @__PURE__ */ new Map();
114
- for (let n of e) t.set(n, (t.get(n) ?? 0) + 1);
115
- let n = 0;
116
- for (let r of t.values()) n -= r / e.length * Math.log2(r / e.length);
117
- return n >= 3.5;
118
- }
119
- function y(e) {
120
- try {
121
- let t = new URL(e, location.href);
122
- t.username = "", t.password = "";
123
- for (let [e, n] of [...t.searchParams]) (u.test(e) || v(n)) && t.searchParams.set(e, "[redacted]");
124
- return t.hash && (u.test(t.hash) || t.hash.split(/[#&=/]/).some(v)) && (t.hash = "#[redacted]"), t.toString();
125
- } catch {
126
- return "[unparseable url]";
127
- }
128
- }
129
- function b(e) {
130
- return e.replace(/Bearer\s+[A-Za-z0-9._~+/-]+=*/gi, "Bearer [redacted]").replace(/eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+/g, "[redacted-jwt]").replace(/https?:\/\/[^\s"'<>]+/g, (e) => y(e)).replace(/\b((?:[\w-]*[_-])?(?:token|secret|password|passwd|pwd|api[_-]?key|access[_-]?key|private[_-]?key|session[_-]?id|signature|authorization|auth[_-]?code))(["']?\s*[:=]\s*["']?)(?!\[redacted)[^\s"'&,;]+/gi, "$1$2[redacted]").replace(/[\w~+=-]{24,}/g, (e) => v(e) ? "[redacted]" : e);
131
- }
132
- function x(e) {
133
- if (e instanceof Error) return `${e.name}: ${e.message}`;
134
- if (typeof e == "string") return e;
135
- try {
136
- return JSON.stringify(e)?.slice(0, 500) ?? String(e);
137
- } catch {
138
- return String(e);
139
- }
140
- }
141
- //#endregion
142
- //#region src/ui/i18n.ts
143
- var S = {
144
- comment: "Comment",
145
- commentHint: "Click anything on the page to comment on it",
146
- inbox: "Inbox",
147
- close: "Close",
148
- cancel: "Cancel",
149
- send: "Send",
150
- sending: "Sending…",
151
- reply: "Reply",
152
- replyPlaceholder: "Write a reply…",
153
- composerPlaceholder: "What should change here? Be as specific as you like.",
154
- modeBar: "Click anything to comment · Drag to mark an area · Select text first to quote it · Esc to stop",
155
- modeBarTouch: "Tap anything to comment · Scroll as usual · Select text first to quote it",
156
- commentOnPage: "Comment on the whole page",
157
- commentFocused: "Comment on the selected part",
158
- attach: "Attach a file",
159
- screenshot: "Screenshot",
160
- screenshotIncluded: "A screenshot of what you see is included automatically.",
161
- screenshotRemove: "Don't include screenshot",
162
- screenshotAdd: "Include screenshot",
163
- markup: "Draw on screenshot",
164
- markupDone: "Done drawing",
165
- tool_arrow: "Arrow",
166
- tool_rect: "Box",
167
- tool_pen: "Pen",
168
- tool_blur: "Blur",
169
- tool_text: "Text",
170
- markupTextPrompt: "What should the note say?",
171
- undo: "Undo",
172
- color_red: "Red",
173
- color_orange: "Orange",
174
- color_green: "Green",
175
- color_blue: "Blue",
176
- color_black: "Black",
177
- capturing: "Taking screenshot…",
178
- uploadFailed: "The file could not be attached. You can still send your comment.",
179
- signInToSend: "One last step: tell us who you are",
180
- signInExplain: "We open a small window so you can confirm your email. You only do this once on this device.",
181
- signIn: "Continue",
182
- signInMember: "Sign in",
183
- signOut: "Sign out",
184
- popupBlocked: "Your browser blocked the sign-in window. Click the button again, or allow pop-ups for this site.",
185
- signInCancelled: "Sign-in was closed before it finished. Your comment is still here.",
186
- sent: "Sent! The team has been notified.",
187
- sentGuest: "Sent! We'll email you when someone replies.",
188
- thisPage: "This page",
189
- allPages: "All pages",
190
- notifications: "Notifications",
191
- nothingHere: "No feedback on this page yet.",
192
- nothingHereHint: "Click Comment, then click anything on the page.",
193
- nothingAnywhere: "No feedback on this site yet.",
194
- noMatch: "No feedback matches your search or filters.",
195
- clearFilters: "Clear filters",
196
- allCaughtUp: "You're all caught up.",
197
- search: "Search feedback",
198
- detached: "We can't find this spot on the page anymore. It may have changed since the comment was left.",
199
- moved: "This part of the page changed since the comment was left.",
200
- screen_phone: "Left on a phone-sized screen",
201
- screen_tablet: "Left on a tablet-sized screen",
202
- screen_wide: "Left on a wider screen",
203
- size_phone: "Phone",
204
- size_tablet: "Tablet",
205
- size_wide: "Wide screen",
206
- status_open: "Open",
207
- status_in_progress: "In progress",
208
- status_in_review: "Ready for review",
209
- status_resolved: "Resolved",
210
- status_closed: "Closed",
211
- resolve: "Resolve",
212
- resolveHint: "Mark this as fixed",
213
- resolvedToast: "Resolved {ref}.",
214
- reopen: "Reopen",
215
- markInProgress: "Start working",
216
- markInReview: "Ready for review",
217
- closeThread: "Close without changes",
218
- reviewAsk: "The team thinks this is fixed. Does it look right to you?",
219
- looksGood: "Looks good — resolve",
220
- notYet: "Not yet — reply",
221
- notYetPlaceholder: "What still needs to change?",
222
- copyLink: "Copy link",
223
- copied: "Copied",
224
- copyForAgent: "Copy for AI agent",
225
- copiedForAgent: "Copied. Paste it into your AI coding agent.",
226
- delete: "Delete",
227
- deleteConfirm: "Delete this feedback for everyone? Replies and the screenshot go too.",
228
- edit: "Edit",
229
- edited: "edited",
230
- save: "Save",
231
- saving: "Saving…",
232
- mute: "Turn off notifications",
233
- unmute: "Turn on notifications",
234
- muted: "You won't get emails about {ref} anymore.",
235
- followed: "We'll email you about {ref} again.",
236
- unassigned: "Unassigned",
237
- readOnly: "Feedback is read-only right now because your team's subscription has ended. You can still read everything.",
238
- readOnlyGuest: "New feedback is paused on this site right now. You can still read everything.",
239
- paused: "Feedback is paused on this site right now. Check back later.",
240
- offline: "You're offline. We'll keep your draft until you're back.",
241
- offlineSend: "You're offline. Your comment is saved here; send it when you're back online.",
242
- errorGeneric: "That didn't work. Check your connection and try again.",
243
- loadFailed: "We couldn't load the feedback. Check your connection and try again.",
244
- sendFailed: "Your comment wasn't sent yet. It's still here, so you can try again.",
245
- savedHere: "Your comment is saved on this device.",
246
- retry: "Try again",
247
- loadingThread: "Loading the conversation…",
248
- readOnlyReply: "You can read this conversation, but replies are turned off right now.",
249
- noReplyAccess: "You can read this feedback, but you don't have permission to reply.",
250
- notOnPage: "Not found on this page",
251
- more: "More",
252
- allStatuses: "All",
253
- statusFilter: "Status",
254
- markAllRead: "Mark all as read",
255
- messageCount: "{n} messages",
256
- messageCount_one: "{n} message",
257
- kind_mention: "{actor} mentioned you",
258
- kind_reply: "{actor} replied",
259
- kind_assigned: "{actor} assigned you",
260
- kind_ready_for_review: "{actor} asked you to check a fix",
261
- kind_reopened: "{actor} reopened",
262
- kind_resolved: "{actor} resolved",
263
- kind_closed: "{actor} closed",
264
- kind_new_feedback: "{actor} left feedback",
265
- kind_due_soon: "{actor} reminds you this is due soon",
266
- kind_overdue: "{actor} reminds you this is overdue",
267
- kind_agent_request: "{actor} wants your approval",
268
- personName: "{name}",
269
- branchFilter: "Which version of the site to show",
270
- thisBranch: "This version ({branch})",
271
- allBranches: "All versions",
272
- onBranch: "on version {branch}",
273
- leftOnBranch: "Left on version {branch}{commit}",
274
- welcomeTitle: "Leave feedback on {project}",
275
- welcomeBody: "Click Comment, then click the spot that should change. No account needed.",
276
- welcomeBodyTouch: "Tap Comment, then tap the spot that should change. No account needed.",
277
- gotIt: "Got it",
278
- justNow: "just now",
279
- loadingEarlier: "Loading…",
280
- reactWith: "React with {emoji}",
281
- shortcutsTitle: "Keyboard shortcuts",
282
- shortcutComment: "Comment on something on the page",
283
- shortcutNext: "Go to the next or previous comment",
284
- shortcutResolve: "Resolve the open comment",
285
- shortcutClose: "Close or go back",
286
- shortcutSend: "Send what you wrote",
287
- shortcutToggle: "Show or hide CommentKit",
288
- shortcutHelp: "Show this list",
289
- deleteReplyConfirm: "Delete this reply for everyone?",
290
- replyDeleted: "Reply deleted",
291
- peopleHere: "{n} people here",
292
- peopleHere_one: "{n} person here",
293
- markupTextAdd: "Add note",
294
- includeDiagnostics: "Include technical details to help the developer",
295
- filters: "Filters",
296
- assignedToMe: "Assigned to me",
297
- assigneeFilter: "Assigned to",
298
- anyone: "Anyone",
299
- labelFilter: "Label",
300
- anyLabel: "Any label",
301
- fileNotAllowed: "{name} can't be attached. You can attach images, PDFs, text, video and Office files.",
302
- fileTooBig: "{name} is too big to attach. The limit is {size}.",
303
- tooManyFiles: "You can attach up to {n} files.",
304
- tooManyFiles_one: "You can attach up to {n} file.",
305
- removeFile: "Remove {name}",
306
- threadNotFound: "This feedback was deleted, or you no longer have access to it.",
307
- readOnlyShort: "Read-only: you can read feedback, but not add to it right now.",
308
- guestExplain: "We'll email you a 6-digit code. Your comment is published as soon as you enter the code.",
309
- guestName: "Your name",
310
- guestEmail: "Your email",
311
- guestIntro: "Your name and email, so the team can reply. No account needed.",
312
- guestNameMissing: "Add your name so the team knows who wrote this.",
313
- guestEmailInvalid: "Check your email address, for example name@company.com.",
314
- shareExpired: "This client link has expired. Ask the team for a new one.",
315
- verifyTitle: "Check your email",
316
- verifyBody: "Enter the 6-digit code to publish your comment. We sent it to {email}.",
317
- verifyCode: "6-digit code",
318
- verifyPublish: "Publish comment",
319
- verifyResend: "Send a new code",
320
- verifyResent: "We sent a new code. It can take a minute to arrive.",
321
- verifyWait: "Wait a minute before asking for another code.",
322
- verifyWrong: "That code isn't right. Check the email, or send a new code.",
323
- verifyDifferent: "Use a different email",
324
- verifyExpired: "This code can no longer be used. Your comment is still saved on this device.",
325
- verifyLinkExpired: "This client link has expired. Ask the person who sent it for a new one. Your comment is saved on this device.",
326
- verifyRemoved: "The team removed your access to this site. Ask them to add you again.",
327
- writeAgain: "Write it again",
328
- pendingNote: "Your comment is waiting for the code we emailed to {email}.",
329
- enterCode: "Enter code",
330
- feedbackRef: "Feedback {ref}",
331
- networkError: "We couldn't reach CommentKit. Check your connection: your text is saved here, so you can try again.",
332
- noAccess: "You don't have access to feedback on this site. Ask the team to invite you again.",
333
- originNotAllowed: "Feedback can't be sent from this web address yet. Ask the team to add it to the project.",
334
- forbidden: "You don't have permission to do that.",
335
- tooFast: "That was a lot at once. Wait a moment, then try again.",
336
- sentWithoutScreenshot: "Sent, but without the screenshot: it couldn't be uploaded.",
337
- sentWithoutFiles: "Sent, but some files couldn't be attached. You can add them in a reply.",
338
- replyFailed: "Your reply wasn't sent yet. It's still here, so you can try again.",
339
- taskDetails: "Task details",
340
- priority: "Priority",
341
- priority_none: "No priority",
342
- priority_low: "Low",
343
- priority_medium: "Medium",
344
- priority_high: "High",
345
- priority_urgent: "Urgent",
346
- dueDate: "Due date",
347
- dueOn: "Due {date}",
348
- labels: "Labels",
349
- noLabels: "No labels"
350
- }, C = [
351
- "en",
352
- "es",
353
- "fr",
354
- "de",
355
- "pt-BR",
356
- "it",
357
- "nl",
358
- "ja",
359
- "zh-CN",
360
- "hi",
361
- "ar"
362
- ], w = {
363
- es: () => import("./es-BBIlcnsU.js"),
364
- fr: () => import("./fr-BXsff0Zz.js"),
365
- de: () => import("./de-CamSq76K.js"),
366
- "pt-BR": () => import("./pt-BR-DE_r-5UM.js"),
367
- it: () => import("./it-C5MH_Ktv.js"),
368
- nl: () => import("./nl-CFzRMEfl.js"),
369
- ja: () => import("./ja-s1JJld2J.js"),
370
- "zh-CN": () => import("./zh-CN--gibO2l7.js"),
371
- hi: () => import("./hi-y-APBuxh.js"),
372
- ar: () => import("./ar-BVQ4ToG2.js")
373
- }, T = /^(ar|he|iw|fa|ur|ps|yi|ckb|sd|ug|dv)(-|$)/i, E = "en", D = S, O = Promise.resolve();
374
- function k(e) {
375
- let t = (e ?? "").trim().replace(/_/g, "-").toLowerCase();
376
- if (!/^[a-z]{2,3}(-[a-z0-9]{1,8})*$/.test(t)) return null;
377
- let n = C.find((e) => e.toLowerCase() === t);
378
- if (n) return n;
379
- let r = t.split("-")[0];
380
- return C.find((e) => e.toLowerCase().split("-")[0] === r) ?? null;
381
- }
382
- function A(e) {
383
- let t = [e];
384
- typeof document < "u" && t.push(document.documentElement.lang), typeof navigator < "u" && t.push(...navigator.languages ?? [], navigator.language);
385
- for (let e of t) {
386
- let t = k(e);
387
- if (t) return t;
388
- }
389
- return "en";
390
- }
391
- function j(e) {
392
- let t = A(e);
393
- return E = t, t === "en" ? (D = S, O = Promise.resolve(), O) : (O = w[t]().then((e) => {
394
- E === t && (D = e.default);
395
- }, () => {
396
- E === t && (E = "en", D = S);
397
- }), O);
398
- }
399
- function M() {
400
- return E;
401
- }
402
- function N(e, t) {
403
- let n = T.test(E);
404
- return e.replace(/\{(\w+)\}/g, (e, r) => {
405
- let i = String(t[r] ?? "");
406
- return n && i ? `\u2068${i}\u2069` : i;
407
- });
408
- }
409
- function P(e, t = {}) {
410
- return N(D[e] ?? S[e], t);
411
- }
412
- function F(e, t) {
413
- let [n = "", r = ""] = (D[e] ?? S[e]).split(`{${t}}`);
414
- return [n, r];
415
- }
416
- function I(e, t, n = {}) {
417
- let r = "other", i = String(t);
418
- try {
419
- r = new Intl.PluralRules(E).select(t), i = new Intl.NumberFormat(E).format(t);
420
- } catch {}
421
- let a = S;
422
- return N(D[`${e}_${r}`] ?? D[e] ?? a[`${e}_${r}`] ?? S[e], {
423
- ...n,
424
- n: i
425
- });
426
- }
427
- function L() {
428
- if (T.test(E)) return "rtl";
429
- let e = document.documentElement.dir || document.body?.dir;
430
- return e === "rtl" || e === "ltr" ? e : T.test(document.documentElement.lang || "") ? "rtl" : "ltr";
431
- }
432
- function R(e, t = Date.now()) {
433
- let n = new Date(e).getTime();
434
- if (!Number.isFinite(n)) return "";
435
- let r = Math.max(0, (t - n) / 1e3);
436
- if (r < 60) return P("justNow");
437
- if (r >= 2592e3) return new Date(n).toLocaleDateString(E);
438
- let [i, a] = r < 3600 ? ["minute", 60] : r < 86400 ? ["hour", 3600] : ["day", 86400], o = Math.floor(r / a);
439
- try {
440
- return new Intl.RelativeTimeFormat(E, { numeric: "auto" }).format(-o, i);
441
- } catch {
442
- return `${o} ${i}`;
443
- }
444
- }
445
- //#endregion
446
- //#region src/index.ts
447
- var z = null;
448
- function B() {
449
- let e = (e) => typeof e == "string" && e.trim() ? e.trim().slice(0, 255) : null;
450
- try {
451
- let t = typeof __COMMENTKIT_BUILD__ < "u" ? __COMMENTKIT_BUILD__ : globalThis.__COMMENTKIT_BUILD__;
452
- if (typeof t == "string" && (t = JSON.parse(t)), !t || typeof t != "object") return {
453
- branch: null,
454
- commit: null
455
- };
456
- let n = t;
457
- return {
458
- branch: e(n.branch),
459
- commit: e(n.commit)
460
- };
461
- } catch {
462
- return {
463
- branch: null,
464
- commit: null
465
- };
466
- }
467
- }
468
- function V(e) {
469
- if (z) return z;
470
- if (typeof window > "u") return W();
471
- try {
472
- return H(e);
473
- } catch (e) {
474
- return console.warn("[CommentKit] The widget could not start.", e), W();
475
- }
476
- }
477
- function H(n) {
478
- if (!n?.project || !/^pk_(live|test)_[a-z0-9]{20,40}$/.test(n.project)) return console.warn("[CommentKit] init() needs your publishable project key (pk_live_… or pk_test_…). Find it in your CommentKit project under Setup."), W();
479
- let r = B(), a = {
480
- ...n,
481
- branch: n.branch || r.branch,
482
- commit: n.commit || r.commit
483
- }, l = j(a.locale), u = new t(a), d = null, f = null, p = null, h = null, g = U(), _ = () => {
484
- let e = Date.now(), t = () => {
485
- document.visibilityState === "hidden" || Date.now() - e < 15e3 || (e = Date.now(), u.loadConfig().then((e) => !e.enabled && !g && y(), () => void 0));
486
- }, n = setInterval(t, 6e4);
487
- return document.addEventListener("visibilitychange", t), () => {
488
- clearInterval(n), document.removeEventListener("visibilitychange", t);
489
- };
490
- }, v = () => d ? Promise.resolve() : (p ?? (p = (async () => {
491
- try {
492
- let e = await u.loadConfig();
493
- if (!e.enabled && !g) return;
494
- await u.auth.completeRedirect().catch(() => !1), i() && await import("./extension-DWHHer7j.js").then((e) => e.extensionHandoff(u.auth)).catch(() => !1), await u.loadSession().catch(() => null), f = m({
495
- console: e.features.console_capture,
496
- network: e.features.network_capture
497
- });
498
- let [{ mountWidget: t }] = await Promise.all([import("./mount-VmnAiANB.js").then((e) => e.t), l]);
499
- d = t(u, y), h = _(), u.emit("ready", { session: u.state.get().session });
500
- } catch (t) {
501
- let n = t instanceof e;
502
- console.warn(n ? `[CommentKit] The widget could not start: ${t.message} (${t.code}). See https://commentkit.dev/docs/errors#${t.code}` : "[CommentKit] The widget could not start.", t), n && u.emit("error", { error: t }), (!n || t.status >= 500) && u.reportCrash(t, "start");
503
- } finally {
504
- p = null;
505
- }
506
- })()), p), y = () => {
507
- h?.(), h = null, d?.(), d = null, f?.(), f = null;
508
- }, b = c(() => {
509
- d ? (y(), s(!1)) : (s(!0), v());
510
- });
511
- return o(a.project, a.hideOnProduction ?? !0) && v(), z = {
512
- client: u,
513
- show: v,
514
- hide: y,
515
- open: (e) => (u.state.set({ opening: String(e).slice(0, 64) }), v()),
516
- signIn: async () => await u.signIn() === "signed_in",
517
- signOut: () => u.signOut(),
518
- session: () => u.state.get().session,
519
- on: (e, t) => u.on(e, t),
520
- destroy() {
521
- y(), b(), u.destroy(), z = null;
522
- }
523
- }, z;
524
- }
525
- function U() {
526
- let e = new URLSearchParams(location.search);
527
- if (e.has("ck") || e.has("ck_thread")) return !0;
528
- try {
529
- return !!sessionStorage.getItem("commentkit:share");
530
- } catch {
531
- return !1;
532
- }
533
- }
534
- function W() {
535
- let e = async () => void 0;
536
- return {
537
- client: void 0,
538
- show: e,
539
- hide: () => void 0,
540
- open: e,
541
- signIn: async () => !1,
542
- signOut: e,
543
- session: () => null,
544
- on: () => () => void 0,
545
- destroy: () => void 0
546
- };
547
- }
548
- //#endregion
549
- export { R as a, h as c, i as d, I as i, b as l, F as n, P as o, M as r, L as s, V as t, y as u };