@commentkit/comment-kit 1.0.0-beta.0 → 1.0.0-beta.2
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.
- package/CHANGELOG.md +63 -0
- package/README.md +102 -8
- package/SECURITY.md +7 -2
- package/dist/npm/chunks/Guest-CKoV6pEK.js +157 -0
- package/dist/npm/chunks/MarkupEditor-DAo4qppg.js +199 -0
- package/dist/npm/chunks/Panel-BRBDHlGg.js +399 -0
- package/dist/npm/chunks/Shortcuts-CHMcrjAM.js +56 -0
- package/dist/npm/chunks/ThreadCard-D8FzIxbs.js +570 -0
- package/dist/npm/chunks/ar-D3SPpN1T.js +195 -0
- package/dist/npm/chunks/{client-D1vrh_5G.js → client-D1NizpDK.js} +86 -49
- package/dist/npm/chunks/de-C8eC6c6f.js +187 -0
- package/dist/npm/chunks/es-Bczf42tm.js +187 -0
- package/dist/npm/chunks/extension--it1LAj-.js +54 -0
- package/dist/npm/chunks/extension-XfuRGu2o.js +26 -0
- package/dist/npm/chunks/format-Bw_tNOh9.js +524 -0
- package/dist/npm/chunks/fr-BaQw-v2e.js +187 -0
- package/dist/npm/chunks/hi-BamV-yXv.js +187 -0
- package/dist/npm/chunks/{html2canvas-_mjSRP3G.js → html2canvas-DfGb8yka.js} +1145 -1132
- package/dist/npm/chunks/it-DC14_EjN.js +187 -0
- package/dist/npm/chunks/ja-B1mmTN7Y.js +187 -0
- package/dist/npm/chunks/mount-5fFig0k6.js +1447 -0
- package/dist/npm/chunks/nl-BfhqUsmX.js +187 -0
- package/dist/npm/chunks/privacy-DLhezjyi.js +30 -0
- package/dist/npm/chunks/pt-BR-CEPu4W5U.js +187 -0
- package/dist/npm/chunks/{pusher-DRKlokR8.js → pusher-BSsQoE1K.js} +1 -1
- package/dist/npm/chunks/realtime-CBRW9BB3.js +34 -0
- package/dist/npm/chunks/report-Dh4fxd4J.js +27 -0
- package/dist/npm/chunks/{rolldown-runtime-VHNaYcLd.js → rolldown-runtime-Y_bBpyJl.js} +10 -3
- package/dist/npm/chunks/src-DujplxfI.js +517 -0
- package/dist/npm/chunks/zh-CN-kgqjYwHQ.js +187 -0
- package/dist/npm/element.js +28 -11
- package/dist/npm/headless.js +2 -2
- package/dist/npm/index.js +3 -3
- package/dist/npm/react.js +12 -3
- package/dist/npm/svelte.js +12 -3
- package/dist/npm/types/adapters/react.d.ts +2 -0
- package/dist/npm/types/adapters/svelte.d.ts +1 -1
- package/dist/npm/types/adapters/vue.d.ts +72 -0
- package/dist/npm/types/core/api.d.ts +2 -0
- package/dist/npm/types/core/auth.d.ts +42 -3
- package/dist/npm/types/core/client.d.ts +15 -1
- package/dist/npm/types/core/types.d.ts +31 -6
- package/dist/npm/types/element.d.ts +4 -1
- package/dist/npm/types/index.d.ts +3 -1
- package/dist/npm/vue.js +46 -7
- package/package.json +8 -2
- package/dist/npm/chunks/mount-Ce1MZrcm.js +0 -2485
- package/dist/npm/chunks/realtime-5SvAvTUU.js +0 -23
- package/dist/npm/chunks/src-DJjfvVsa.js +0 -330
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
import { c as e, t } from "./client-D1NizpDK.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 n = new URLSearchParams(location.search);
|
|
14
|
+
if (n.has("ck") || n.has("ck_thread") || n.has("ck_code")) return !0;
|
|
15
|
+
try {
|
|
16
|
+
let t = `commentkit:v1:${e}`;
|
|
17
|
+
return !!localStorage.getItem(t) || !!sessionStorage.getItem(t) || localStorage.getItem("commentkit:active") === "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: "Hide",
|
|
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
|
+
allCaughtUp: "You're all caught up.",
|
|
194
|
+
search: "Search feedback",
|
|
195
|
+
detached: "We can't find this spot on the page anymore. It may have changed since the comment was left.",
|
|
196
|
+
moved: "This part of the page changed since the comment was left.",
|
|
197
|
+
screen_phone: "Left on a phone-sized screen",
|
|
198
|
+
screen_tablet: "Left on a tablet-sized screen",
|
|
199
|
+
screen_wide: "Left on a wider screen",
|
|
200
|
+
size_phone: "Phone",
|
|
201
|
+
size_tablet: "Tablet",
|
|
202
|
+
size_wide: "Wide screen",
|
|
203
|
+
status_open: "Open",
|
|
204
|
+
status_in_progress: "In progress",
|
|
205
|
+
status_in_review: "Ready for review",
|
|
206
|
+
status_resolved: "Resolved",
|
|
207
|
+
status_closed: "Closed",
|
|
208
|
+
resolve: "Resolve",
|
|
209
|
+
resolveHint: "Mark this as fixed",
|
|
210
|
+
resolvedToast: "Resolved {ref}.",
|
|
211
|
+
reopen: "Reopen",
|
|
212
|
+
markInProgress: "Start working",
|
|
213
|
+
markInReview: "Ready for review",
|
|
214
|
+
closeThread: "Close without changes",
|
|
215
|
+
reviewAsk: "The team thinks this is fixed. Does it look right to you?",
|
|
216
|
+
looksGood: "Looks good — resolve",
|
|
217
|
+
notYet: "Not yet — reply",
|
|
218
|
+
notYetPlaceholder: "What still needs to change?",
|
|
219
|
+
copyLink: "Copy link",
|
|
220
|
+
copied: "Copied",
|
|
221
|
+
copyForAgent: "Copy for AI agent",
|
|
222
|
+
copiedForAgent: "Copied. Paste it into your AI coding agent.",
|
|
223
|
+
delete: "Delete",
|
|
224
|
+
deleteConfirm: "Delete this feedback for everyone? Replies and the screenshot go too.",
|
|
225
|
+
edit: "Edit",
|
|
226
|
+
edited: "edited",
|
|
227
|
+
save: "Save",
|
|
228
|
+
saving: "Saving…",
|
|
229
|
+
mute: "Stop notifications",
|
|
230
|
+
unmute: "Notify me",
|
|
231
|
+
muted: "You won't get emails about {ref} anymore.",
|
|
232
|
+
followed: "We'll email you about {ref} again.",
|
|
233
|
+
unassigned: "Unassigned",
|
|
234
|
+
readOnly: "Feedback is read-only right now because the workspace plan has ended. You can still read everything.",
|
|
235
|
+
readOnlyGuest: "New feedback is paused on this site right now. You can still read everything.",
|
|
236
|
+
paused: "Feedback is paused on this site right now. Please check back later.",
|
|
237
|
+
offline: "You're offline. We'll keep your draft until you're back.",
|
|
238
|
+
offlineSend: "You're offline. Your comment is saved here; send it when you're back online.",
|
|
239
|
+
errorGeneric: "Something went wrong. Please try again.",
|
|
240
|
+
loadFailed: "We couldn't load the feedback. Check your connection and try again.",
|
|
241
|
+
sendFailed: "Your comment wasn't sent yet. It's still here, so you can try again.",
|
|
242
|
+
savedHere: "Your comment is saved on this device.",
|
|
243
|
+
retry: "Try again",
|
|
244
|
+
loadingThread: "Loading the conversation…",
|
|
245
|
+
readOnlyReply: "You can read this conversation, but replies are turned off right now.",
|
|
246
|
+
noReplyAccess: "You can read this feedback, but you don't have permission to reply.",
|
|
247
|
+
notOnPage: "Not found on this page",
|
|
248
|
+
more: "More",
|
|
249
|
+
allStatuses: "All",
|
|
250
|
+
statusFilter: "Status",
|
|
251
|
+
markAllRead: "Mark all as read",
|
|
252
|
+
messageCount: "{n} messages",
|
|
253
|
+
messageCount_one: "{n} message",
|
|
254
|
+
kind_mention: "mentioned you",
|
|
255
|
+
kind_reply: "replied",
|
|
256
|
+
kind_assigned: "assigned you",
|
|
257
|
+
kind_ready_for_review: "asked you to check a fix",
|
|
258
|
+
kind_reopened: "reopened",
|
|
259
|
+
kind_resolved: "resolved",
|
|
260
|
+
kind_closed: "closed",
|
|
261
|
+
kind_new_feedback: "left feedback",
|
|
262
|
+
kind_due_soon: "reminds you this is due soon",
|
|
263
|
+
kind_overdue: "reminds you this is overdue",
|
|
264
|
+
kind_agent_request: "wants your approval",
|
|
265
|
+
branchFilter: "Which branch to show",
|
|
266
|
+
thisBranch: "This branch ({branch})",
|
|
267
|
+
allBranches: "All branches",
|
|
268
|
+
onBranch: "on {branch}",
|
|
269
|
+
leftOnBranch: "Left on {branch}{commit}",
|
|
270
|
+
welcomeTitle: "Leave feedback on {project}",
|
|
271
|
+
welcomeBody: "Click Comment, then click the spot that should change. No account needed.",
|
|
272
|
+
welcomeBodyTouch: "Tap Comment, then tap the spot that should change. No account needed.",
|
|
273
|
+
gotIt: "Got it",
|
|
274
|
+
justNow: "just now",
|
|
275
|
+
loadingEarlier: "Loading…",
|
|
276
|
+
reactWith: "React with {emoji}",
|
|
277
|
+
shortcutsTitle: "Keyboard shortcuts",
|
|
278
|
+
shortcutComment: "Comment on something on the page",
|
|
279
|
+
shortcutNext: "Go to the next or previous comment",
|
|
280
|
+
shortcutResolve: "Resolve the open comment",
|
|
281
|
+
shortcutClose: "Close or go back",
|
|
282
|
+
shortcutSend: "Send what you wrote",
|
|
283
|
+
shortcutToggle: "Show or hide CommentKit",
|
|
284
|
+
shortcutHelp: "Show this list",
|
|
285
|
+
deleteReplyConfirm: "Delete this reply for everyone?",
|
|
286
|
+
replyDeleted: "Reply deleted",
|
|
287
|
+
peopleHere: "{n} people here",
|
|
288
|
+
peopleHere_one: "{n} person here",
|
|
289
|
+
markupTextAdd: "Add note",
|
|
290
|
+
includeDiagnostics: "Include browser errors to help the developer",
|
|
291
|
+
filters: "Filters",
|
|
292
|
+
assignedToMe: "Assigned to me",
|
|
293
|
+
assigneeFilter: "Assigned to",
|
|
294
|
+
anyone: "Anyone",
|
|
295
|
+
labelFilter: "Label",
|
|
296
|
+
anyLabel: "Any label",
|
|
297
|
+
fileNotAllowed: "{name} can't be attached. Images, PDFs, text, video and Office files work.",
|
|
298
|
+
fileTooBig: "{name} is too big to attach. The limit is {size}.",
|
|
299
|
+
tooManyFiles: "You can attach up to {n} files.",
|
|
300
|
+
removeFile: "Remove {name}",
|
|
301
|
+
threadNotFound: "This feedback was deleted, or you no longer have access to it.",
|
|
302
|
+
readOnlyShort: "Read-only: you can read feedback, but not add to it right now.",
|
|
303
|
+
guestExplain: "We'll email you a 6-digit code. Your comment is published as soon as you enter it.",
|
|
304
|
+
guestName: "Your name",
|
|
305
|
+
guestEmail: "Your email",
|
|
306
|
+
guestIntro: "Your name and email, so the team can reply. No account needed.",
|
|
307
|
+
guestNameMissing: "Add your name so the team knows who wrote this.",
|
|
308
|
+
guestEmailInvalid: "Check your email address, for example name@company.com.",
|
|
309
|
+
shareExpired: "This client link has expired. Ask the team for a new one.",
|
|
310
|
+
verifyTitle: "Check your email",
|
|
311
|
+
verifyBody: "Enter the 6-digit code to publish your comment. We sent it to {email}.",
|
|
312
|
+
verifyCode: "6-digit code",
|
|
313
|
+
verifyPublish: "Publish comment",
|
|
314
|
+
verifyResend: "Send a new code",
|
|
315
|
+
verifyResent: "We sent a new code. It can take a minute to arrive.",
|
|
316
|
+
verifyWait: "Please wait a minute before asking for another code.",
|
|
317
|
+
verifyWrong: "That code isn't right. Check the email, or send a new code.",
|
|
318
|
+
verifyDifferent: "Use a different email",
|
|
319
|
+
verifyExpired: "This code can no longer be used. Your comment is still saved on this device.",
|
|
320
|
+
verifyLinkExpired: "This client link has expired. Ask the person who sent it for a new one. Your comment is saved on this device.",
|
|
321
|
+
verifyRemoved: "The team removed your access to this site. Ask them to add you again.",
|
|
322
|
+
writeAgain: "Write it again",
|
|
323
|
+
pendingNote: "Your comment is waiting for the code we emailed to {email}.",
|
|
324
|
+
enterCode: "Enter code",
|
|
325
|
+
feedbackRef: "Feedback {ref}"
|
|
326
|
+
}, C = [
|
|
327
|
+
"en",
|
|
328
|
+
"es",
|
|
329
|
+
"fr",
|
|
330
|
+
"de",
|
|
331
|
+
"pt-BR",
|
|
332
|
+
"it",
|
|
333
|
+
"nl",
|
|
334
|
+
"ja",
|
|
335
|
+
"zh-CN",
|
|
336
|
+
"hi",
|
|
337
|
+
"ar"
|
|
338
|
+
], w = {
|
|
339
|
+
es: () => import("./es-Bczf42tm.js"),
|
|
340
|
+
fr: () => import("./fr-BaQw-v2e.js"),
|
|
341
|
+
de: () => import("./de-C8eC6c6f.js"),
|
|
342
|
+
"pt-BR": () => import("./pt-BR-CEPu4W5U.js"),
|
|
343
|
+
it: () => import("./it-DC14_EjN.js"),
|
|
344
|
+
nl: () => import("./nl-BfhqUsmX.js"),
|
|
345
|
+
ja: () => import("./ja-B1mmTN7Y.js"),
|
|
346
|
+
"zh-CN": () => import("./zh-CN-kgqjYwHQ.js"),
|
|
347
|
+
hi: () => import("./hi-BamV-yXv.js"),
|
|
348
|
+
ar: () => import("./ar-D3SPpN1T.js")
|
|
349
|
+
}, T = /^(ar|he|iw|fa|ur|ps|yi|ckb|sd|ug|dv)(-|$)/i, E = "en", D = S, O = Promise.resolve();
|
|
350
|
+
function k(e) {
|
|
351
|
+
let t = (e ?? "").trim().replace(/_/g, "-").toLowerCase();
|
|
352
|
+
if (!/^[a-z]{2,3}(-[a-z0-9]{1,8})*$/.test(t)) return null;
|
|
353
|
+
let n = C.find((e) => e.toLowerCase() === t);
|
|
354
|
+
if (n) return n;
|
|
355
|
+
let r = t.split("-")[0];
|
|
356
|
+
return C.find((e) => e.toLowerCase().split("-")[0] === r) ?? null;
|
|
357
|
+
}
|
|
358
|
+
function A(e) {
|
|
359
|
+
let t = [e];
|
|
360
|
+
typeof document < "u" && t.push(document.documentElement.lang), typeof navigator < "u" && t.push(...navigator.languages ?? [], navigator.language);
|
|
361
|
+
for (let e of t) {
|
|
362
|
+
let t = k(e);
|
|
363
|
+
if (t) return t;
|
|
364
|
+
}
|
|
365
|
+
return "en";
|
|
366
|
+
}
|
|
367
|
+
function j(e) {
|
|
368
|
+
let t = A(e);
|
|
369
|
+
return E = t, t === "en" ? (D = S, O = Promise.resolve(), O) : (O = w[t]().then((e) => {
|
|
370
|
+
E === t && (D = e.default);
|
|
371
|
+
}, () => {
|
|
372
|
+
E === t && (E = "en", D = S);
|
|
373
|
+
}), O);
|
|
374
|
+
}
|
|
375
|
+
function M() {
|
|
376
|
+
return E;
|
|
377
|
+
}
|
|
378
|
+
function N(e, t) {
|
|
379
|
+
return e.replace(/\{(\w+)\}/g, (e, n) => String(t[n] ?? ""));
|
|
380
|
+
}
|
|
381
|
+
function P(e, t = {}) {
|
|
382
|
+
return N(D[e] ?? S[e], t);
|
|
383
|
+
}
|
|
384
|
+
function F(e, t, n = {}) {
|
|
385
|
+
let r = "other", i = String(t);
|
|
386
|
+
try {
|
|
387
|
+
r = new Intl.PluralRules(E).select(t), i = new Intl.NumberFormat(E).format(t);
|
|
388
|
+
} catch {}
|
|
389
|
+
let a = S;
|
|
390
|
+
return N(D[`${e}_${r}`] ?? D[e] ?? a[`${e}_${r}`] ?? S[e], {
|
|
391
|
+
...n,
|
|
392
|
+
n: i
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function I() {
|
|
396
|
+
if (T.test(E)) return "rtl";
|
|
397
|
+
let e = document.documentElement.dir || document.body?.dir;
|
|
398
|
+
return e === "rtl" || e === "ltr" ? e : T.test(document.documentElement.lang || "") ? "rtl" : "ltr";
|
|
399
|
+
}
|
|
400
|
+
function L(e, t = Date.now()) {
|
|
401
|
+
let n = new Date(e).getTime();
|
|
402
|
+
if (!Number.isFinite(n)) return "";
|
|
403
|
+
let r = Math.max(0, (t - n) / 1e3);
|
|
404
|
+
if (r < 60) return P("justNow");
|
|
405
|
+
if (r >= 2592e3) return new Date(n).toLocaleDateString(E);
|
|
406
|
+
let [i, a] = r < 3600 ? ["minute", 60] : r < 86400 ? ["hour", 3600] : ["day", 86400], o = Math.floor(r / a);
|
|
407
|
+
try {
|
|
408
|
+
return new Intl.RelativeTimeFormat(E, { numeric: "auto" }).format(-o, i);
|
|
409
|
+
} catch {
|
|
410
|
+
return `${o} ${i}`;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/index.ts
|
|
415
|
+
var R = null;
|
|
416
|
+
function z() {
|
|
417
|
+
let e = (e) => typeof e == "string" && e.trim() ? e.trim().slice(0, 255) : null;
|
|
418
|
+
try {
|
|
419
|
+
let t = typeof __COMMENTKIT_BUILD__ < "u" ? __COMMENTKIT_BUILD__ : globalThis.__COMMENTKIT_BUILD__;
|
|
420
|
+
if (typeof t == "string" && (t = JSON.parse(t)), !t || typeof t != "object") return {
|
|
421
|
+
branch: null,
|
|
422
|
+
commit: null
|
|
423
|
+
};
|
|
424
|
+
let n = t;
|
|
425
|
+
return {
|
|
426
|
+
branch: e(n.branch),
|
|
427
|
+
commit: e(n.commit)
|
|
428
|
+
};
|
|
429
|
+
} catch {
|
|
430
|
+
return {
|
|
431
|
+
branch: null,
|
|
432
|
+
commit: null
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
function B(e) {
|
|
437
|
+
if (R) return R;
|
|
438
|
+
if (typeof window > "u") return U();
|
|
439
|
+
try {
|
|
440
|
+
return V(e);
|
|
441
|
+
} catch (e) {
|
|
442
|
+
return console.warn("[CommentKit] The widget could not start.", e), U();
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
function V(n) {
|
|
446
|
+
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."), U();
|
|
447
|
+
let r = z(), a = {
|
|
448
|
+
...n,
|
|
449
|
+
branch: n.branch || r.branch,
|
|
450
|
+
commit: n.commit || r.commit
|
|
451
|
+
}, l = j(a.locale), u = new t(a), d = null, f = null, p = null, h = null, g = H(), _ = () => {
|
|
452
|
+
let e = Date.now(), t = () => {
|
|
453
|
+
document.visibilityState === "hidden" || Date.now() - e < 15e3 || (e = Date.now(), u.loadConfig().then((e) => !e.enabled && !g && y(), () => void 0));
|
|
454
|
+
}, n = setInterval(t, 6e4);
|
|
455
|
+
return document.addEventListener("visibilitychange", t), () => {
|
|
456
|
+
clearInterval(n), document.removeEventListener("visibilitychange", t);
|
|
457
|
+
};
|
|
458
|
+
}, v = () => d ? Promise.resolve() : (p ?? (p = (async () => {
|
|
459
|
+
try {
|
|
460
|
+
let e = await u.loadConfig();
|
|
461
|
+
if (!e.enabled && !g) return;
|
|
462
|
+
await u.auth.completeRedirect().catch(() => !1), i() && await import("./extension-XfuRGu2o.js").then((e) => e.extensionHandoff(u.auth)).catch(() => !1), await u.loadSession().catch(() => null), f = m({
|
|
463
|
+
console: e.features.console_capture,
|
|
464
|
+
network: e.features.network_capture
|
|
465
|
+
});
|
|
466
|
+
let [{ mountWidget: t }] = await Promise.all([import("./mount-5fFig0k6.js").then((e) => e.t), l]);
|
|
467
|
+
d = t(u, y), h = _(), u.emit("ready", { session: u.state.get().session });
|
|
468
|
+
} catch (t) {
|
|
469
|
+
let n = t instanceof e;
|
|
470
|
+
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");
|
|
471
|
+
} finally {
|
|
472
|
+
p = null;
|
|
473
|
+
}
|
|
474
|
+
})()), p), y = () => {
|
|
475
|
+
h?.(), h = null, d?.(), d = null, f?.(), f = null;
|
|
476
|
+
}, b = c(() => {
|
|
477
|
+
d ? (y(), s(!1)) : (s(!0), v());
|
|
478
|
+
});
|
|
479
|
+
return o(a.project, a.hideOnProduction ?? !0) && v(), R = {
|
|
480
|
+
client: u,
|
|
481
|
+
show: v,
|
|
482
|
+
hide: y,
|
|
483
|
+
open: (e) => (u.state.set({ opening: String(e).slice(0, 64) }), v()),
|
|
484
|
+
signIn: async () => await u.signIn() === "signed_in",
|
|
485
|
+
signOut: () => u.signOut(),
|
|
486
|
+
session: () => u.state.get().session,
|
|
487
|
+
on: (e, t) => u.on(e, t),
|
|
488
|
+
destroy() {
|
|
489
|
+
y(), b(), u.destroy(), R = null;
|
|
490
|
+
}
|
|
491
|
+
}, R;
|
|
492
|
+
}
|
|
493
|
+
function H() {
|
|
494
|
+
let e = new URLSearchParams(location.search);
|
|
495
|
+
if (e.has("ck") || e.has("ck_thread")) return !0;
|
|
496
|
+
try {
|
|
497
|
+
return !!sessionStorage.getItem("commentkit:share");
|
|
498
|
+
} catch {
|
|
499
|
+
return !1;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function U() {
|
|
503
|
+
let e = async () => void 0;
|
|
504
|
+
return {
|
|
505
|
+
client: void 0,
|
|
506
|
+
show: e,
|
|
507
|
+
hide: () => void 0,
|
|
508
|
+
open: e,
|
|
509
|
+
signIn: async () => !1,
|
|
510
|
+
signOut: e,
|
|
511
|
+
session: () => null,
|
|
512
|
+
on: () => () => void 0,
|
|
513
|
+
destroy: () => void 0
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
//#endregion
|
|
517
|
+
export { P as a, b as c, L as i, y as l, M as n, I as o, F as r, h as s, B as t, i as u };
|