@commentkit/comment-kit 2.0.0 → 2.1.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.
- package/CHANGELOG.md +57 -0
- package/README.md +123 -19
- package/SECURITY.md +2 -2
- package/dist/node/cli/api.js +61 -15
- package/dist/node/cli/credentials.js +8 -0
- package/dist/node/cli/doctor.js +152 -25
- package/dist/node/cli/init.js +349 -35
- package/dist/node/cli/main.js +310 -69
- package/dist/node/cli/mcp.js +187 -6
- package/dist/node/cli/website.js +140 -0
- package/dist/node/shared/dashboard-places.js +33 -0
- package/dist/node/types/next.d.ts +4 -4
- package/dist/npm/THIRD_PARTY_NOTICES.txt +47 -0
- package/dist/npm/chunks/{AgentSend-DxRJIYiz.js → AgentSend-pA7Ufvye.js} +16 -16
- package/dist/npm/chunks/Checklist-Cn9skOYK.js +269 -0
- package/dist/npm/chunks/Composer-D7H-pzGa.js +734 -0
- package/dist/npm/chunks/DatePicker-Nta5a1xD.js +161 -0
- package/dist/npm/chunks/{Guest-vvNPz8h-.js → Guest-Bi7hlzhs.js} +63 -59
- package/dist/npm/chunks/{MarkupEditor-VCOXh9d2.js → MarkupEditor-WU3USeTk.js} +46 -39
- package/dist/npm/chunks/Panel-DhAzbUbC.js +1210 -0
- package/dist/npm/chunks/{Settings-BGoZS2iV.js → Settings-BmKqPX40.js} +91 -90
- package/dist/npm/chunks/{Shortcuts-B2OMvczr.js → Shortcuts-Bl-c0Sez.js} +25 -23
- package/dist/npm/chunks/SignInFirst-CmGvSYkQ.js +35 -0
- package/dist/npm/chunks/{StyleEditor-CJ_d8Huf.js → StyleEditor-D6fUnlwq.js} +10 -10
- package/dist/npm/chunks/{StylePanel-yQzHHlY7.js → StylePanel-C-Gikxt1.js} +61 -61
- package/dist/npm/chunks/TaskFields-CaKi523b.js +617 -0
- package/dist/npm/chunks/ThreadCard-d_3pUB5V.js +1142 -0
- package/dist/npm/chunks/Viewer-BULQsi9-.js +115 -0
- package/dist/npm/chunks/{agent-C1OQzBAm.js → agent-DHdhIJ3s.js} +1 -1
- package/dist/npm/chunks/{ar-CAJ3XT8e.js → ar-B5UszrQp.js} +53 -12
- package/dist/npm/chunks/card-bits-cV8GdFWX.js +55 -0
- package/dist/npm/chunks/{client-kNAo2TTG.js → client-Cv8ddtuM.js} +13 -11
- package/dist/npm/chunks/{confetti-CkBdSu19.js → confetti-B9zlyILU.js} +1 -1
- package/dist/npm/chunks/{context-B8UAzve0.js → context-CsHnabaA.js} +1 -1
- package/dist/npm/chunks/{de-Dl18G48t.js → de-BE0Aaq8u.js} +53 -12
- package/dist/npm/chunks/{dialog-GO04oC3D.js → dialog-DvdIkCW0.js} +1 -1
- package/dist/npm/chunks/{dpop-U48QIQd7.js → dpop-CwW9ifkq.js} +1 -1
- package/dist/npm/chunks/entrance-Bn_5M9uO.js +90 -0
- package/dist/npm/chunks/{es-Dxk79lS9.js → es-BQviao4d.js} +53 -12
- package/dist/npm/chunks/{extension-E81hWyiT.js → extension-CnQTDC1j.js} +2 -2
- package/dist/npm/chunks/{extension-CKFpPWmi.js → extension-DXhz81XD.js} +1 -1
- package/dist/npm/chunks/{files-DyD5BZgp.js → files-DLEr_wmh.js} +2 -2
- package/dist/npm/chunks/{fr-8BebGKYD.js → fr-C5gu6A06.js} +53 -12
- package/dist/npm/chunks/{hi-BIN6Yy_p.js → hi-DXfQ5EvY.js} +53 -12
- package/dist/npm/chunks/{i18n-DOBt8e9U.js → i18n-Mgs9VOuk.js} +63 -58
- package/dist/npm/chunks/icons-_C6ZWmBY.js +141 -0
- package/dist/npm/chunks/{identify-CN-3xzqL.js → identify-BnQGJOa0.js} +4 -4
- package/dist/npm/chunks/{it-Cr6EwpPQ.js → it-BPHt13FV.js} +53 -12
- package/dist/npm/chunks/{ja-Iy3s5aur.js → ja-BkCqyKR0.js} +52 -11
- package/dist/npm/chunks/late-words-D4Oo_yhJ.js +57 -0
- package/dist/npm/chunks/{live-CelVeZfP.js → live-DXcxj_Af.js} +28 -22
- package/dist/npm/chunks/{nl-B84WHqqe.js → nl-DZxdLLMU.js} +53 -12
- package/dist/npm/chunks/{page-key-DepmJzC1.js → page-key-UqAozdZi.js} +1 -1
- package/dist/npm/chunks/{pick-yTyqtxN0.js → pick-C20RVUas.js} +1 -1
- package/dist/npm/chunks/{pkce-ChKGSW_4.js → pkce-BPvWoBrr.js} +1 -1
- package/dist/npm/chunks/{pt-BR-DOkdlfoe.js → pt-BR-lA9mJ05F.js} +53 -12
- package/dist/npm/chunks/{report-CrIqQZDI.js → report-BjUgUNnT.js} +1 -1
- package/dist/npm/chunks/show-BinoJyED.js +97 -0
- package/dist/npm/chunks/signin-C2jjsxz9.js +101 -0
- package/dist/npm/chunks/{source-pXVve2Cx.js → source-NuflODx3.js} +1 -1
- package/dist/npm/chunks/src-9o2Ocq8d.js +221 -0
- package/dist/npm/chunks/start-Cbx6rMrr.js +1904 -0
- package/dist/npm/chunks/states-DLMCvwes.js +3 -0
- package/dist/npm/chunks/{upload-MgPYqPyE.js → upload-C4NpM-jE.js} +1 -1
- package/dist/npm/chunks/uploads-CY4bDbaI.js +1236 -0
- package/dist/npm/chunks/{wrap-Bl0gbnFa.js → wrap-D-xTKIzj.js} +20 -20
- package/dist/npm/chunks/{zh-CN-Z5fQCb7G.js → zh-CN-yqaDHwBx.js} +53 -12
- package/dist/npm/element.js +7 -1
- package/dist/npm/headless.js +2 -2
- package/dist/npm/index.js +2 -2
- package/dist/npm/react.js +1 -1
- package/dist/npm/svelte.js +1 -1
- package/dist/npm/types/adapters/vue.d.ts +12 -0
- package/dist/npm/types/core/auth.d.ts +1 -0
- package/dist/npm/types/core/client.d.ts +5 -1
- package/dist/npm/types/core/types.d.ts +19 -4
- package/dist/npm/vue.js +5 -1
- package/package.json +4 -1
- package/dist/npm/chunks/Checklist-CnlfeSbc.js +0 -282
- package/dist/npm/chunks/Composer-B1bBVszY.js +0 -725
- package/dist/npm/chunks/Panel-F37vIL1K.js +0 -1206
- package/dist/npm/chunks/TaskFields-fmy6_HtK.js +0 -289
- package/dist/npm/chunks/ThreadCard-D51slKST.js +0 -1113
- package/dist/npm/chunks/Viewer-BOBadqmC.js +0 -111
- package/dist/npm/chunks/card-bits-CAnzrqx3.js +0 -53
- package/dist/npm/chunks/late-words-B2bmZceJ.js +0 -12
- package/dist/npm/chunks/show-BgVC8gWY.js +0 -97
- package/dist/npm/chunks/signin-Dd1rb2BP.js +0 -75
- package/dist/npm/chunks/src-BTMy4Gyc.js +0 -208
- package/dist/npm/chunks/start-DtVlpt7p.js +0 -1878
- package/dist/npm/chunks/states-sfTbjZz8.js +0 -3
- package/dist/npm/chunks/uploads-D49mywwz.js +0 -1146
|
@@ -0,0 +1,1904 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-QGRDbDUS.js";
|
|
2
|
+
import { n as t } from "./src-9o2Ocq8d.js";
|
|
3
|
+
import { o as n, v as r } from "./client-Cv8ddtuM.js";
|
|
4
|
+
import { i, o as a, t as o } from "./anchor-BsQNVkHj.js";
|
|
5
|
+
import { _ as s, a as c, b as l, c as u, d, f, g as p, h as m, l as h, m as g, n as _, o as v, r as y, s as b, u as x, v as ee, x as S, y as C } from "./i18n-Mgs9VOuk.js";
|
|
6
|
+
import { a as w, i as T, n as E, r as D } from "./drafts-B0ctr1g9.js";
|
|
7
|
+
// src/capture/diagnostics.ts
|
|
8
|
+
var O = 20, k = /token|key|secret|passw|^pass$|auth|code|session|sig|credential|^x-amz-|ck_invite/i, A = /[\w.%+-]{1,64}@[A-Za-z0-9-]{1,63}(?:\.[A-Za-z0-9-]{1,63}){0,8}\.[A-Za-z]{2,24}/g, j = /(^|[^\w-])(\+?\d(?:[\s().-]{0,2}\d){8,})(?!\w)/g, M = (e) => e.replace(A, "[email]").replace(j, "$1[number]"), N = /eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+/, P = 1e3, F = [], I = [], L = !1, R = "";
|
|
9
|
+
function z(e) {
|
|
10
|
+
if (L || !(e.console || e.network)) return () => void 0;
|
|
11
|
+
L = !0, R = `${new URL(e.endpoint ?? "https://commentkit.dev").origin}/api/v1/`;
|
|
12
|
+
let t, n = !1;
|
|
13
|
+
return import("./wrap-D-xTKIzj.js").then((r) => n || (t = r.wrap(e)), () => void 0), () => {
|
|
14
|
+
n = !0, t?.(), B(), L = !1;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function te() {
|
|
18
|
+
return {
|
|
19
|
+
console: F.length ? [...F] : void 0,
|
|
20
|
+
network: I.length ? [...I] : void 0
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function B() {
|
|
24
|
+
F.length = 0, I.length = 0;
|
|
25
|
+
}
|
|
26
|
+
function ne(e, t, n, r) {
|
|
27
|
+
try {
|
|
28
|
+
if (new URL(t, location.href).href.startsWith(R)) return;
|
|
29
|
+
} catch {}
|
|
30
|
+
re(I, {
|
|
31
|
+
method: e.slice(0, 10),
|
|
32
|
+
url: H(t).slice(0, 2e3),
|
|
33
|
+
status: n,
|
|
34
|
+
duration_ms: Math.round(performance.now() - r)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function re(e, t) {
|
|
38
|
+
e.push(t), e.length > O && e.shift();
|
|
39
|
+
}
|
|
40
|
+
function V(e) {
|
|
41
|
+
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;
|
|
42
|
+
let t = /* @__PURE__ */ new Map();
|
|
43
|
+
for (let n of e) t.set(n, (t.get(n) ?? 0) + 1);
|
|
44
|
+
let n = 0;
|
|
45
|
+
for (let r of t.values()) n -= r / e.length * Math.log2(r / e.length);
|
|
46
|
+
return n >= 3.5;
|
|
47
|
+
}
|
|
48
|
+
function H(e) {
|
|
49
|
+
try {
|
|
50
|
+
let t = new URL(e, location.href);
|
|
51
|
+
t.username = "", t.password = "", t.pathname = t.pathname.split("/").map((e) => N.test(e) || V(e) && /[A-Za-z\d]{16}/.test(e) && !e.includes(".") ? "[redacted]" : M(U(e)) === U(e) ? e : M(U(e))).join("/");
|
|
52
|
+
for (let [e, n] of [...t.searchParams]) k.test(e) || V(n) ? t.searchParams.set(e, "[redacted]") : M(n) !== n && t.searchParams.set(e, M(n));
|
|
53
|
+
return t.hash && (k.test(t.hash) || t.hash.split(/[#&=/]/).some(V) || M(U(t.hash)) !== U(t.hash)) && (t.hash = "#[redacted]"), t.toString();
|
|
54
|
+
} catch {
|
|
55
|
+
return "[unparseable url]";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function ie(e) {
|
|
59
|
+
return e.replace(/Bearer\s+[A-Za-z0-9._~+/-]+=*/gi, "Bearer [redacted]").replace(new RegExp(N.source, "g"), "[redacted-jwt]").replace(/https?:\/\/[^\s"'<>]+/g, (e) => H(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);
|
|
60
|
+
}
|
|
61
|
+
var U = (e) => {
|
|
62
|
+
try {
|
|
63
|
+
return decodeURIComponent(e);
|
|
64
|
+
} catch {
|
|
65
|
+
return e;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
function ae(e) {
|
|
69
|
+
return M(ie(e.slice(0, P))).slice(0, P);
|
|
70
|
+
}
|
|
71
|
+
// src/ui/format.tsx
|
|
72
|
+
function W(e, t = innerWidth) {
|
|
73
|
+
return !!e.breakpoint && Math.abs(e.breakpoint - t) > 200;
|
|
74
|
+
}
|
|
75
|
+
var oe = (e) => e < 600 ? "phone" : e < 1024 ? "tablet" : "wide", G = (e) => `${Math.round(e * 100) / 100}px`, K = (e, t, n, r) => ({
|
|
76
|
+
left: G(e),
|
|
77
|
+
top: G(t),
|
|
78
|
+
...n === void 0 ? {} : { width: G(n) },
|
|
79
|
+
...r === void 0 ? {} : { height: G(r) }
|
|
80
|
+
});
|
|
81
|
+
function q({ text: e, people: t = [] }) {
|
|
82
|
+
let n = he(t), r = [], i = 0;
|
|
83
|
+
for (let t of e.matchAll(J)) {
|
|
84
|
+
let a = t.index ?? 0;
|
|
85
|
+
a > i && r.push(se(e.slice(i, a), n)), r.push(/* @__PURE__ */ x("pre", {
|
|
86
|
+
class: "ck-pre",
|
|
87
|
+
children: /* @__PURE__ */ x("code", { children: t[2].replace(/^\n|\n$/g, "") })
|
|
88
|
+
})), i = a + t[0].length;
|
|
89
|
+
}
|
|
90
|
+
return i < e.length && r.push(se(e.slice(i), n)), /* @__PURE__ */ x(l, { children: r });
|
|
91
|
+
}
|
|
92
|
+
var J = /```([\w-]*)\n?([\s\S]*?)```/g;
|
|
93
|
+
function se(e, t) {
|
|
94
|
+
let n = e.replace(/^\n/, "").split("\n");
|
|
95
|
+
return n.map((e, r) => /* @__PURE__ */ x(l, { children: [ge(e, t), r < n.length - 1 ? /* @__PURE__ */ x("br", {}) : null] }));
|
|
96
|
+
}
|
|
97
|
+
var ce = null;
|
|
98
|
+
function Y(e) {
|
|
99
|
+
ce = e;
|
|
100
|
+
}
|
|
101
|
+
function le(e) {
|
|
102
|
+
return [...e.includes("") ? e : e.replace(/\ufe0f/g, "")].map((e) => e.codePointAt(0).toString(16)).join("-");
|
|
103
|
+
}
|
|
104
|
+
function ue({ char: e }) {
|
|
105
|
+
let [t, n] = s(!1);
|
|
106
|
+
return !ce || t ? /* @__PURE__ */ x(l, { children: e }) : /* @__PURE__ */ x("img", {
|
|
107
|
+
class: "ck-emoji",
|
|
108
|
+
src: `${ce}/emoji/${le(e)}.svg`,
|
|
109
|
+
alt: e,
|
|
110
|
+
draggable: !1,
|
|
111
|
+
loading: "lazy",
|
|
112
|
+
onError: () => n(!0)
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
var de = String.raw`\p{Extended_Pictographic}(?:\ufe0f|\p{Emoji_Modifier}|\u200d\p{Extended_Pictographic}\ufe0f?)*`, X = String.raw`\*\*[^*\n]+\*\*|~~[^~\n]+~~|\x60[^\x60\n]+\x60|\*[^*\s][^*\n]*\*|(?:^|[\s(\[])_[^_\n]+_(?![\p{L}\p{N}_])`, fe = String.raw`https?:\/\/[^\s<>"')\u200b-\u200f\u202a-\u202e\u2060-\u2069\ufeff]+`, pe = `${X}|${fe}`, me = /* @__PURE__ */ new Map();
|
|
116
|
+
function he(e) {
|
|
117
|
+
let t = e.join("\0"), n = me.get(t);
|
|
118
|
+
if (!n) {
|
|
119
|
+
let r = [...e].filter(Boolean).sort((e, t) => t.length - e.length).map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")), i = `(?:^|[\\s(\\[])@(?:${r.length ? `${r.join("|")}|` : ""}[\\p{L}\\p{N}._-]+)`;
|
|
120
|
+
n = RegExp(`${pe}|${i}|${de}`, "gu"), me.set(t, n);
|
|
121
|
+
}
|
|
122
|
+
return n;
|
|
123
|
+
}
|
|
124
|
+
function ge(e, t) {
|
|
125
|
+
let n = [], r = 0;
|
|
126
|
+
for (let i of e.matchAll(t)) {
|
|
127
|
+
let a = i[0], o = i.index ?? 0;
|
|
128
|
+
if (/^[\s(\[]/.test(a) && /[_@]/.test(a[1] ?? "") && (o += 1, a = a.slice(1)), o > r && n.push(e.slice(r, o)), a.startsWith("**")) n.push(/* @__PURE__ */ x("strong", { children: ge(a.slice(2, -2), t) }));
|
|
129
|
+
else if (a.startsWith("~~")) n.push(/* @__PURE__ */ x("s", { children: ge(a.slice(2, -2), t) }));
|
|
130
|
+
else if (a.startsWith("`")) n.push(/* @__PURE__ */ x("code", { children: a.slice(1, -1) }));
|
|
131
|
+
else if (a.startsWith("*") || a.startsWith("_")) n.push(/* @__PURE__ */ x("em", { children: ge(a.slice(1, -1), t) }));
|
|
132
|
+
else if (a.startsWith("@")) n.push(/* @__PURE__ */ x("span", {
|
|
133
|
+
class: "ck-mention",
|
|
134
|
+
children: /* @__PURE__ */ x("bdi", { children: a })
|
|
135
|
+
}));
|
|
136
|
+
else if (/^\p{Extended_Pictographic}/u.test(a)) n.push(/* @__PURE__ */ x(ue, { char: a }));
|
|
137
|
+
else {
|
|
138
|
+
let e = _e(a);
|
|
139
|
+
n.push(e ? /* @__PURE__ */ x("a", {
|
|
140
|
+
href: e,
|
|
141
|
+
target: "_blank",
|
|
142
|
+
rel: "noopener noreferrer nofollow ugc",
|
|
143
|
+
children: a
|
|
144
|
+
}) : a);
|
|
145
|
+
}
|
|
146
|
+
r = o + a.length;
|
|
147
|
+
}
|
|
148
|
+
return r < e.length && n.push(e.slice(r)), n;
|
|
149
|
+
}
|
|
150
|
+
function _e(e, t = "link") {
|
|
151
|
+
if (!e) return null;
|
|
152
|
+
try {
|
|
153
|
+
let n = new URL(e);
|
|
154
|
+
return n.protocol === "https:" || n.protocol === "http:" || t === "link" && n.protocol === "mailto:" ? n.href : null;
|
|
155
|
+
} catch {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function ve({ person: e }) {
|
|
160
|
+
let [t, n] = s(!1), r = e.name.split(/\s+/).map((e) => [...e][0]).slice(0, 2).join("").toUpperCase() || "?";
|
|
161
|
+
return /* @__PURE__ */ x("span", {
|
|
162
|
+
class: "ck-avatar",
|
|
163
|
+
"aria-hidden": "true",
|
|
164
|
+
children: !t && e.avatar_url && /^https:\/\//.test(e.avatar_url) ? /* @__PURE__ */ x("img", {
|
|
165
|
+
src: e.avatar_url,
|
|
166
|
+
alt: "",
|
|
167
|
+
referrerPolicy: "no-referrer",
|
|
168
|
+
onError: () => n(!0)
|
|
169
|
+
}) : r
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
var ye = (e) => u(`status_${e}`);
|
|
173
|
+
function be({ status: e }) {
|
|
174
|
+
let t = ye(e);
|
|
175
|
+
return /* @__PURE__ */ x("span", {
|
|
176
|
+
class: "ck-status",
|
|
177
|
+
"data-status": e,
|
|
178
|
+
title: t,
|
|
179
|
+
children: t
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function xe({ name: e, size: t = 18 }) {
|
|
183
|
+
return /* @__PURE__ */ x("svg", {
|
|
184
|
+
width: t,
|
|
185
|
+
height: t,
|
|
186
|
+
viewBox: "0 0 24 24",
|
|
187
|
+
fill: "none",
|
|
188
|
+
stroke: "currentColor",
|
|
189
|
+
"stroke-width": e === "more" ? 3.2 : 2,
|
|
190
|
+
"stroke-linecap": "round",
|
|
191
|
+
"stroke-linejoin": "round",
|
|
192
|
+
"aria-hidden": "true",
|
|
193
|
+
children: /* @__PURE__ */ x("path", { d: {
|
|
194
|
+
comment: "M4 5h16v11H8l-4 4z",
|
|
195
|
+
inbox: "M4 13l2-8h12l2 8M4 13v6h16v-6M4 13h5l1 2h4l1-2h5",
|
|
196
|
+
close: "M6 6l12 12M18 6L6 18",
|
|
197
|
+
more: "M5 12h.01M12 12h.01M19 12h.01",
|
|
198
|
+
check: "M5 12l4 4 10-10",
|
|
199
|
+
info: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 11v5M12 8h.01",
|
|
200
|
+
alert: "M12 4l9 16H3zM12 10v4M12 17h.01"
|
|
201
|
+
}[e] })
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function Se(e) {
|
|
205
|
+
e?.focus({ preventScroll: !0 });
|
|
206
|
+
}
|
|
207
|
+
function Ce(e) {
|
|
208
|
+
if (!e) return;
|
|
209
|
+
let t = e.getBoundingClientRect(), n = e.parentElement?.closest(".ck-panel, .ck-card")?.getBoundingClientRect() ?? {
|
|
210
|
+
left: 0,
|
|
211
|
+
right: innerWidth
|
|
212
|
+
}, r = Math.min(0, n.right - 8 - t.right);
|
|
213
|
+
t.left + r < n.left + 8 && (r = n.left + 8 - t.left), r && (e.style.translate = `${Math.round(r)}px 0`);
|
|
214
|
+
}
|
|
215
|
+
// src/ui/hooks.ts
|
|
216
|
+
function Z(e, t) {
|
|
217
|
+
let [n, r] = s(() => t(e.get()));
|
|
218
|
+
return d(() => (r(t(e.get())), e.subscribe((e) => r(() => t(e)))), [e]), n;
|
|
219
|
+
}
|
|
220
|
+
function we(e) {
|
|
221
|
+
let [, t] = s(0), [n] = s(() => ({
|
|
222
|
+
version: 0,
|
|
223
|
+
watch: () => void 0
|
|
224
|
+
}));
|
|
225
|
+
return d(() => {
|
|
226
|
+
if (!e) return;
|
|
227
|
+
let r = 0, i = 0, a = 0, o = 0, s = -1e9, c = !1, l = () => {
|
|
228
|
+
r = 0, c && (c = !1, n.version++, s = performance.now()), t((e) => e + 1);
|
|
229
|
+
}, u = () => {
|
|
230
|
+
r || (r = requestAnimationFrame(l));
|
|
231
|
+
}, d = (e = 0) => {
|
|
232
|
+
c = !0;
|
|
233
|
+
let t = performance.now(), n = Math.max(t + e, s + 100);
|
|
234
|
+
i && n >= o || (clearTimeout(i), o = n, i = window.setTimeout(() => {
|
|
235
|
+
i = 0, u();
|
|
236
|
+
}, n - t));
|
|
237
|
+
}, f = () => d(), p = -1e9, m = () => {
|
|
238
|
+
let e = performance.now();
|
|
239
|
+
n.scrolling = e - p < 60, p = e, clearTimeout(a), a = window.setTimeout(() => {
|
|
240
|
+
n.scrolling = !1, u();
|
|
241
|
+
}, 150), u();
|
|
242
|
+
}, h = new MutationObserver((e) => {
|
|
243
|
+
let t = -1;
|
|
244
|
+
for (let n of e) if (!(n.target instanceof Element && n.target.closest("[data-commentkit-host]")) && !(t = n.type === "childList" ? 0 : 250)) break;
|
|
245
|
+
t >= 0 && d(t);
|
|
246
|
+
});
|
|
247
|
+
h.observe(document.documentElement, {
|
|
248
|
+
subtree: !0,
|
|
249
|
+
childList: !0,
|
|
250
|
+
attributes: !0,
|
|
251
|
+
characterData: !0
|
|
252
|
+
});
|
|
253
|
+
let g = typeof ResizeObserver == "function" ? new ResizeObserver(u) : null, _ = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Set(), y = (e) => {
|
|
254
|
+
for (let t of v) e.has(t) || t.removeEventListener("scroll", m, !0);
|
|
255
|
+
for (let t of e) v.has(t) || t.addEventListener("scroll", m, !0);
|
|
256
|
+
v = e;
|
|
257
|
+
};
|
|
258
|
+
n.watch = (e) => {
|
|
259
|
+
let t = /* @__PURE__ */ new Set([
|
|
260
|
+
document.documentElement,
|
|
261
|
+
document.body,
|
|
262
|
+
...e
|
|
263
|
+
]);
|
|
264
|
+
for (let e of _) t.has(e) || g?.unobserve(e);
|
|
265
|
+
for (let e of t) _.has(e) || g?.observe(e);
|
|
266
|
+
_ = t;
|
|
267
|
+
let n = /* @__PURE__ */ new Set();
|
|
268
|
+
for (let t of e) for (let e = t.ownerDocument.defaultView; e && e !== window && !n.has(e); e = e.parent) n.add(e);
|
|
269
|
+
y(n);
|
|
270
|
+
}, n.watch([]);
|
|
271
|
+
let b = [
|
|
272
|
+
"load",
|
|
273
|
+
"transitionend",
|
|
274
|
+
"animationend"
|
|
275
|
+
];
|
|
276
|
+
addEventListener("resize", f), addEventListener("scroll", m, !0), b.forEach((e) => addEventListener(e, u, !0)), document.fonts?.ready.then(u).catch(() => void 0);
|
|
277
|
+
let x = setInterval(f, 2e3);
|
|
278
|
+
return () => {
|
|
279
|
+
h.disconnect(), g?.disconnect(), n.watch = () => void 0, y(/* @__PURE__ */ new Set()), removeEventListener("resize", f), removeEventListener("scroll", m, !0), b.forEach((e) => removeEventListener(e, u, !0)), clearInterval(x), clearTimeout(i), clearTimeout(a), cancelAnimationFrame(r), n.scrolling = !1;
|
|
280
|
+
};
|
|
281
|
+
}, [e]), n;
|
|
282
|
+
}
|
|
283
|
+
function Te() {
|
|
284
|
+
let [e, t] = s(() => typeof navigator > "u" || navigator.onLine !== !1);
|
|
285
|
+
return d(() => {
|
|
286
|
+
let e = () => t(!0), n = () => t(!1);
|
|
287
|
+
return addEventListener("online", e), addEventListener("offline", n), () => {
|
|
288
|
+
removeEventListener("online", e), removeEventListener("offline", n);
|
|
289
|
+
};
|
|
290
|
+
}, []), e;
|
|
291
|
+
}
|
|
292
|
+
function Ee(e, t, n = !1) {
|
|
293
|
+
let r = !n && getComputedStyle(e.currentTarget).direction === "rtl", i = n ? [
|
|
294
|
+
"ArrowDown",
|
|
295
|
+
"j",
|
|
296
|
+
"J"
|
|
297
|
+
] : [r ? "ArrowLeft" : "ArrowRight"], a = n ? [
|
|
298
|
+
"ArrowUp",
|
|
299
|
+
"k",
|
|
300
|
+
"K"
|
|
301
|
+
] : [r ? "ArrowRight" : "ArrowLeft"], o = i.includes(e.key) ? 1 : a.includes(e.key) ? -1 : e.key === "Home" ? "first" : e.key === "End" ? "last" : null;
|
|
302
|
+
if (o === null) return;
|
|
303
|
+
let s = e.currentTarget, c = [...s.querySelectorAll(t)].filter((e) => !e.hasAttribute("disabled"));
|
|
304
|
+
if (!c.length) return;
|
|
305
|
+
e.preventDefault();
|
|
306
|
+
let l = c.indexOf(s.getRootNode().activeElement);
|
|
307
|
+
c[o === "first" ? 0 : o === "last" ? c.length - 1 : (Math.max(l, o > 0 ? -1 : 0) + o + c.length) % c.length]?.focus();
|
|
308
|
+
}
|
|
309
|
+
function Q(e, t, n) {
|
|
310
|
+
let [r, i] = s(null);
|
|
311
|
+
return d(() => {
|
|
312
|
+
e && !r && t().then((e) => i(() => e), n);
|
|
313
|
+
}, [e]), r;
|
|
314
|
+
}
|
|
315
|
+
function De(e, t, n) {
|
|
316
|
+
f(() => {
|
|
317
|
+
if (!e) return;
|
|
318
|
+
let r = (e) => t.current && !e.composedPath().includes(t.current) && n();
|
|
319
|
+
return addEventListener("pointerdown", r, !0), () => removeEventListener("pointerdown", r, !0);
|
|
320
|
+
}, [e]);
|
|
321
|
+
}
|
|
322
|
+
function Oe(e) {
|
|
323
|
+
return e.composedPath().some((e) => e instanceof HTMLElement && (e.isContentEditable || [
|
|
324
|
+
"INPUT",
|
|
325
|
+
"TEXTAREA",
|
|
326
|
+
"SELECT"
|
|
327
|
+
].includes(e.tagName)));
|
|
328
|
+
}
|
|
329
|
+
function ke(e) {
|
|
330
|
+
let t = e.target;
|
|
331
|
+
return (t === document.body || t === document.documentElement || t instanceof Element && t.hasAttribute("data-commentkit-host")) && !Oe(e);
|
|
332
|
+
}
|
|
333
|
+
function Ae() {
|
|
334
|
+
return typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
335
|
+
}
|
|
336
|
+
function je() {
|
|
337
|
+
return matchMedia("(pointer: coarse)").matches && !matchMedia("(any-pointer: fine)").matches;
|
|
338
|
+
}
|
|
339
|
+
// src/ui/errors.ts
|
|
340
|
+
var Me = {
|
|
341
|
+
network_error: "networkError",
|
|
342
|
+
upload_failed: "uploadFailed",
|
|
343
|
+
share_expired: "shareExpired",
|
|
344
|
+
no_access: "noAccess",
|
|
345
|
+
wrong_project: "noAccess",
|
|
346
|
+
guest_removed: "verifyRemoved",
|
|
347
|
+
origin_not_allowed: "originNotAllowed",
|
|
348
|
+
origin_required: "originNotAllowed",
|
|
349
|
+
widget_disabled: "paused",
|
|
350
|
+
plan_required: "readOnlyGuest",
|
|
351
|
+
not_found: "threadNotFound",
|
|
352
|
+
forbidden: "forbidden",
|
|
353
|
+
rate_limited: "tooFast",
|
|
354
|
+
guest_codes_paused: "guestCodesPaused",
|
|
355
|
+
edit_conflict: "editConflict",
|
|
356
|
+
internal_error: "serverError",
|
|
357
|
+
insecure_context: "insecureContext"
|
|
358
|
+
}, Ne = /* @__PURE__ */ new Set(["file_rejected", "thread_not_found"]);
|
|
359
|
+
function Pe(e) {
|
|
360
|
+
if (!(e instanceof r)) return u("errorGeneric");
|
|
361
|
+
if (Ne.has(e.code)) return e.message;
|
|
362
|
+
let t = Me[e.code] ?? (e.status === 410 ? "shareExpired" : e.status === 429 ? "tooFast" : null);
|
|
363
|
+
return t ? u(t) : _() === "en" && e.status >= 400 && e.message ? e.message : u("errorGeneric");
|
|
364
|
+
}
|
|
365
|
+
// src/ui/draft-key.ts
|
|
366
|
+
var Fe = "commentkit:pending-compose", Ie = "commentkit:press-send", Le = "commentkit:comment-after-sign-in";
|
|
367
|
+
function Re(e, t, n = e.pageKey()) {
|
|
368
|
+
return E(e.options.project, n, t.type, t.selector, t.ck_id, t.source, t.quote);
|
|
369
|
+
}
|
|
370
|
+
// src/ui/privacy.ts
|
|
371
|
+
var ze = (e, t) => e?.privacy?.mode === "strict" ? "strict" : t, Be = [], Ve = null;
|
|
372
|
+
function He(e) {
|
|
373
|
+
Ve = e, e && Be.forEach((t) => We(e, t));
|
|
374
|
+
}
|
|
375
|
+
function Ue(e) {
|
|
376
|
+
Be.includes(e) || (Be.push(e), Ve && We(Ve, e));
|
|
377
|
+
}
|
|
378
|
+
function We(e, t) {
|
|
379
|
+
if ("adoptedStyleSheets" in e && "replaceSync" in CSSStyleSheet.prototype) {
|
|
380
|
+
let n = new CSSStyleSheet();
|
|
381
|
+
n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n];
|
|
382
|
+
} else {
|
|
383
|
+
let n = document.createElement("style");
|
|
384
|
+
n.textContent = t, e.insertBefore(n, e.querySelector(".ck-root"));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
// src/ui/deep-links.ts
|
|
388
|
+
var Ge = "commentkit:share";
|
|
389
|
+
function Ke(e, t) {
|
|
390
|
+
let n = new URL(location.href).searchParams.get(e);
|
|
391
|
+
return !n || !t.test(n) ? null : (Xe(location.href.replace(/^[^#]*/, (t) => t.replace(RegExp(`([?&])${e}=[^&]*(&?)`), (e, t, n) => n ? t : ""))), n);
|
|
392
|
+
}
|
|
393
|
+
function qe(e, t) {
|
|
394
|
+
let [, n = "", r = ""] = /^([^#]*)(.*)$/s.exec(e) ?? [];
|
|
395
|
+
return `${n}${n.includes("?") ? "&" : "?"}ck_thread=${encodeURIComponent(t)}${r}`;
|
|
396
|
+
}
|
|
397
|
+
function Je() {
|
|
398
|
+
let e = Ke("ck", /^[A-Za-z0-9]{16,128}$/);
|
|
399
|
+
return e && T(Ge, e), e ?? T(Ge);
|
|
400
|
+
}
|
|
401
|
+
var Ye = () => Ke("ck_thread", /^[0-9a-f-]{36}$/i);
|
|
402
|
+
function Xe(e) {
|
|
403
|
+
try {
|
|
404
|
+
history.replaceState(history.state, "", e);
|
|
405
|
+
} catch {}
|
|
406
|
+
}
|
|
407
|
+
function Ze(e, t = () => location.href) {
|
|
408
|
+
let n = location.href, r = t(), i = () => {
|
|
409
|
+
if (location.href !== n) {
|
|
410
|
+
n = location.href;
|
|
411
|
+
try {
|
|
412
|
+
let n = t(), i = n !== r;
|
|
413
|
+
r = n, e(i);
|
|
414
|
+
} catch {}
|
|
415
|
+
}
|
|
416
|
+
}, a = setInterval(i, 500);
|
|
417
|
+
return addEventListener("popstate", i), addEventListener("hashchange", i), () => {
|
|
418
|
+
clearInterval(a), removeEventListener("popstate", i), removeEventListener("hashchange", i);
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
// src/ui/prefs.ts
|
|
422
|
+
var Qe = "commentkit:v1:prefs", $e = /* @__PURE__ */ new Set(), et = null;
|
|
423
|
+
function tt(e = !0) {
|
|
424
|
+
if (et !== null) return et;
|
|
425
|
+
try {
|
|
426
|
+
let t = JSON.parse(D(Qe) ?? "{}")?.shortcuts;
|
|
427
|
+
return typeof t == "boolean" ? t : e;
|
|
428
|
+
} catch {
|
|
429
|
+
return e;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function nt(e) {
|
|
433
|
+
return e.options.shortcuts !== !1 && tt(!!e.state.get().session?.capabilities.triage);
|
|
434
|
+
}
|
|
435
|
+
function rt(e) {
|
|
436
|
+
et = e, D(Qe, JSON.stringify({ shortcuts: e })), $e.forEach((e) => e());
|
|
437
|
+
}
|
|
438
|
+
function it(e) {
|
|
439
|
+
return $e.add(e), () => void $e.delete(e);
|
|
440
|
+
}
|
|
441
|
+
// src/ui/Welcome.tsx
|
|
442
|
+
function at({ id: e, position: t, title: n, body: r, primary: i, secondary: a, onPrimary: o, onSecondary: s }) {
|
|
443
|
+
return /* @__PURE__ */ x("div", {
|
|
444
|
+
class: "ck-welcome",
|
|
445
|
+
"data-pos": t,
|
|
446
|
+
role: "region",
|
|
447
|
+
"aria-labelledby": e,
|
|
448
|
+
"data-commentkit-ui": !0,
|
|
449
|
+
children: [
|
|
450
|
+
/* @__PURE__ */ x("h2", {
|
|
451
|
+
id: e,
|
|
452
|
+
children: n
|
|
453
|
+
}),
|
|
454
|
+
/* @__PURE__ */ x("p", { children: r }),
|
|
455
|
+
/* @__PURE__ */ x("div", {
|
|
456
|
+
class: "ck-actions",
|
|
457
|
+
children: [/* @__PURE__ */ x("button", {
|
|
458
|
+
class: "ck-btn",
|
|
459
|
+
onClick: s,
|
|
460
|
+
children: a
|
|
461
|
+
}), /* @__PURE__ */ x("button", {
|
|
462
|
+
class: "ck-btn ck-primary",
|
|
463
|
+
onClick: o,
|
|
464
|
+
children: i
|
|
465
|
+
})]
|
|
466
|
+
})
|
|
467
|
+
]
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
function ot({ position: e, project: t, onStart: n, onDismiss: r }) {
|
|
471
|
+
return /* @__PURE__ */ x(at, {
|
|
472
|
+
id: "ck-welcome-title",
|
|
473
|
+
position: e,
|
|
474
|
+
title: u("welcomeTitle", { project: t }),
|
|
475
|
+
body: u(matchMedia("(pointer: coarse)").matches ? "welcomeBodyTouch" : "welcomeBody"),
|
|
476
|
+
primary: u("comment"),
|
|
477
|
+
secondary: u("gotIt"),
|
|
478
|
+
onPrimary: n,
|
|
479
|
+
onSecondary: r
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
function st({ position: e, project: t, onContinue: n, onDismiss: r }) {
|
|
483
|
+
return /* @__PURE__ */ x(at, {
|
|
484
|
+
id: "ck-signin-link-title",
|
|
485
|
+
position: e,
|
|
486
|
+
title: u("signInLinkTitle", { project: t }),
|
|
487
|
+
body: u("signInLinkBody"),
|
|
488
|
+
primary: u("signIn"),
|
|
489
|
+
secondary: u("notNow"),
|
|
490
|
+
onPrimary: n,
|
|
491
|
+
onSecondary: r
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
// src/ui/chunks.ts
|
|
495
|
+
function ct(e, n, r, i, a, o) {
|
|
496
|
+
let s = Q(a, () => t(() => import("./Settings-BmKqPX40.js")).then((e) => e.Settings), o), c = Q(i, () => t(() => import("./Shortcuts-Bl-c0Sez.js")).then((e) => e.Shortcuts), o), l = Q(r.name === "commenting" || r.name === "composing", () => t(() => import("./Composer-D7H-pzGa.js")).then((t) => (e.state.get().config?.features.screenshots !== !1 && t.warmCapture(), t.Composer)), o), u = Q(r.name === "verify", () => t(() => import("./Guest-Bi7hlzhs.js")).then((e) => e.GuestVerify), o), d = Q(r.name === "panel", () => t(() => import("./Panel-DhAzbUbC.js")).then((e) => e.Panel), o), p = Q(r.name === "thread" || r.name === "panel" ? r.threadId : null, () => t(() => import("./ThreadCard-d_3pUB5V.js")).then((e) => e.ThreadCard), o), m = () => [[...e.state.get().config?.privacy?.redact_selectors ?? [], ...e.options.redact ?? []], ze(e.state.get().config, e.options.privacy)], h = Q(!0, () => Promise.all([t(() => import("./context-BuMl7A07.js").then((e) => e.t)), t(() => import("./pick-C20RVUas.js"))]).then(([e, t]) => (e.install(), e.configurePrivacy(...m()), {
|
|
497
|
+
configurePrivacy: e.configurePrivacy,
|
|
498
|
+
picker: t
|
|
499
|
+
})), o);
|
|
500
|
+
return f(() => h?.configurePrivacy(...m()), [h, n]), {
|
|
501
|
+
Settings: s,
|
|
502
|
+
Shortcuts: c,
|
|
503
|
+
Composer: l,
|
|
504
|
+
GuestVerify: u,
|
|
505
|
+
Panel: d,
|
|
506
|
+
ThreadCard: p,
|
|
507
|
+
anchors: h
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
// src/ui/dock.ts
|
|
511
|
+
var lt = "commentkit:dock";
|
|
512
|
+
function ut(e, t) {
|
|
513
|
+
let [n, r] = s(() => {
|
|
514
|
+
let e = D(lt);
|
|
515
|
+
return e && /^(top|bottom)-(left|center|right)$/.test(e) ? e : null;
|
|
516
|
+
});
|
|
517
|
+
return [n ?? e.options.position ?? t?.appearance.position ?? "bottom-right", (e) => {
|
|
518
|
+
r(e), D(lt, e);
|
|
519
|
+
}];
|
|
520
|
+
}
|
|
521
|
+
// src/ui/keys.ts
|
|
522
|
+
var dt = (e) => !e.metaKey && !e.ctrlKey && !e.altKey, ft = (e, t) => e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains(t));
|
|
523
|
+
function pt(e, t) {
|
|
524
|
+
let { key: n } = e;
|
|
525
|
+
if (e.defaultPrevented || Oe(e) || ft(e, "ck-markup") || ft(e, "ck-pop") || n !== "Escape" && !(t.keys && ke(e))) return null;
|
|
526
|
+
if (t.help) return n === "Escape" ? "closeHelp" : null;
|
|
527
|
+
let { view: r, threads: i } = t;
|
|
528
|
+
if (n === "?" && dt(e)) return "help";
|
|
529
|
+
if (n === "Escape" && r.name !== "idle") return "back";
|
|
530
|
+
if ((n === "c" || n === "C") && dt(e) && r.name === "idle") return "comment";
|
|
531
|
+
if ((n === "j" || n === "k") && dt(e) && t.signedIn && (r.name === "idle" || r.name === "thread")) {
|
|
532
|
+
if (!i.length || ft(e, "ck-panel")) return null;
|
|
533
|
+
let t = r.name === "thread" ? i.findIndex((e) => e.id === r.threadId) : -1;
|
|
534
|
+
return i[(t + (n === "j" ? 1 : i.length - 1 + +(t < 0))) % i.length] ?? null;
|
|
535
|
+
}
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
function mt(e, t) {
|
|
539
|
+
f(() => {
|
|
540
|
+
let n = (n) => {
|
|
541
|
+
let r = pt(n, e());
|
|
542
|
+
r && (r !== "closeHelp" && n.preventDefault(), t(r));
|
|
543
|
+
};
|
|
544
|
+
return addEventListener("keydown", n, !0), () => removeEventListener("keydown", n, !0);
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
function ht(e, t, n, r) {
|
|
548
|
+
let i = t.name === "commenting", a = g(!1);
|
|
549
|
+
d(() => {
|
|
550
|
+
(a.current || i) && e.emit("mode", { commenting: i }), a.current = !0;
|
|
551
|
+
}, [i]);
|
|
552
|
+
let o = Z(e.state, (e) => e.request);
|
|
553
|
+
d(() => {
|
|
554
|
+
o && (e.state.set({ request: null }), o.kind === "comment" ? i || r.comment() : o.kind === "stop" ? r.go({ name: "stop" }) : n ? r.togglePanel() : r.signIn());
|
|
555
|
+
}, [o]);
|
|
556
|
+
}
|
|
557
|
+
// src/ui/Launcher.tsx
|
|
558
|
+
function gt({ client: e, position: n, onMove: r, commenting: i, panelOpen: a, onComment: o, onPanel: c, onSignIn: p, onSignOut: m, onShortcuts: h, onApprove: _, onHide: v, onSettings: y, waiting: b, onCode: ee, covered: S, entrance: C }) {
|
|
559
|
+
let w = Z(e.state, (e) => e.config?.read_only ?? !1), T = Z(e.state, (e) => e.session), E = Z(e.state, (e) => e.unread), [D, O] = s(!1), [k, A] = s(null), j = g(null), M = g(null), N = g(null);
|
|
560
|
+
d(() => void (D && M.current?.querySelector("[role=menuitem]")?.focus()), [D]), De(D, M, () => O(!1)), f(() => {
|
|
561
|
+
let e = M.current;
|
|
562
|
+
if (!C || !e) return;
|
|
563
|
+
e.dataset.entering = "";
|
|
564
|
+
let n = () => void (e.dataset.entering = "done"), r = setTimeout(() => n(), 1500);
|
|
565
|
+
return t(() => import("./entrance-Bn_5M9uO.js")).then((t) => {
|
|
566
|
+
clearTimeout(r), e.dataset.entering === "" && (n = t.enter(e, C.key, C.say).stop);
|
|
567
|
+
}, () => n()), () => (clearTimeout(r), n());
|
|
568
|
+
}, []);
|
|
569
|
+
let P = Ae();
|
|
570
|
+
return /* @__PURE__ */ x("div", {
|
|
571
|
+
class: "ck-launcher",
|
|
572
|
+
"data-pos": n,
|
|
573
|
+
"data-covered": S,
|
|
574
|
+
"data-dragging": k ? "true" : void 0,
|
|
575
|
+
"data-commentkit-ui": !0,
|
|
576
|
+
ref: M,
|
|
577
|
+
style: k ? {
|
|
578
|
+
left: G(k.x),
|
|
579
|
+
top: G(k.y),
|
|
580
|
+
right: "auto",
|
|
581
|
+
bottom: "auto",
|
|
582
|
+
translate: "none"
|
|
583
|
+
} : void 0,
|
|
584
|
+
children: [
|
|
585
|
+
D ? null : b ? /* @__PURE__ */ x("div", {
|
|
586
|
+
class: "ck-note ck-launcher-note",
|
|
587
|
+
role: "status",
|
|
588
|
+
children: [
|
|
589
|
+
u("pendingNote", { email: b }),
|
|
590
|
+
" ",
|
|
591
|
+
/* @__PURE__ */ x("button", {
|
|
592
|
+
class: "ck-btn",
|
|
593
|
+
onClick: ee,
|
|
594
|
+
children: u("enterCode")
|
|
595
|
+
})
|
|
596
|
+
]
|
|
597
|
+
}) : w ? /* @__PURE__ */ x("div", {
|
|
598
|
+
class: "ck-note ck-launcher-note",
|
|
599
|
+
role: "status",
|
|
600
|
+
children: u("readOnlyShort")
|
|
601
|
+
}) : null,
|
|
602
|
+
/* @__PURE__ */ x("div", {
|
|
603
|
+
class: "ck-bar",
|
|
604
|
+
role: "group",
|
|
605
|
+
"aria-label": "CommentKit",
|
|
606
|
+
children: [
|
|
607
|
+
/* @__PURE__ */ x("button", {
|
|
608
|
+
class: "ck-bar-btn",
|
|
609
|
+
"aria-pressed": i,
|
|
610
|
+
onClick: o,
|
|
611
|
+
title: u("commentHint"),
|
|
612
|
+
"aria-keyshortcuts": h ? "C" : void 0,
|
|
613
|
+
children: [/* @__PURE__ */ x(xe, { name: "comment" }), /* @__PURE__ */ x("span", {
|
|
614
|
+
class: "ck-label",
|
|
615
|
+
children: u("comment")
|
|
616
|
+
})]
|
|
617
|
+
}),
|
|
618
|
+
T ? /* @__PURE__ */ x("button", {
|
|
619
|
+
class: "ck-bar-btn ck-icon-btn",
|
|
620
|
+
"aria-pressed": a,
|
|
621
|
+
onClick: c,
|
|
622
|
+
title: u("inbox"),
|
|
623
|
+
"aria-label": `${u("inbox")}${E ? ` (${E})` : ""}`,
|
|
624
|
+
children: [/* @__PURE__ */ x(xe, { name: "inbox" }), E > 0 ? /* @__PURE__ */ x("span", {
|
|
625
|
+
class: "ck-badge",
|
|
626
|
+
children: E > 99 ? "99+" : E
|
|
627
|
+
}) : null]
|
|
628
|
+
}) : null,
|
|
629
|
+
/* @__PURE__ */ x("button", {
|
|
630
|
+
class: "ck-bar-btn ck-icon-btn",
|
|
631
|
+
ref: N,
|
|
632
|
+
"aria-haspopup": "menu",
|
|
633
|
+
"aria-expanded": D,
|
|
634
|
+
onClick: () => O(!D),
|
|
635
|
+
"aria-label": u("moreFeedback"),
|
|
636
|
+
title: u("moreFeedback"),
|
|
637
|
+
children: /* @__PURE__ */ x(xe, { name: "more" })
|
|
638
|
+
}),
|
|
639
|
+
/* @__PURE__ */ x("button", {
|
|
640
|
+
class: "ck-grip",
|
|
641
|
+
"aria-label": u("moveToolbar"),
|
|
642
|
+
title: u("moveToolbar"),
|
|
643
|
+
"aria-keyshortcuts": "ArrowLeft ArrowRight ArrowUp ArrowDown",
|
|
644
|
+
onPointerDown: (e) => {
|
|
645
|
+
if (e.button !== 0) return;
|
|
646
|
+
let t = e.currentTarget.closest(".ck-launcher").getBoundingClientRect();
|
|
647
|
+
j.current = {
|
|
648
|
+
dx: e.clientX - t.left,
|
|
649
|
+
dy: e.clientY - t.top
|
|
650
|
+
}, e.currentTarget.setPointerCapture(e.pointerId);
|
|
651
|
+
},
|
|
652
|
+
onPointerMove: (e) => {
|
|
653
|
+
let t = j.current;
|
|
654
|
+
t && A({
|
|
655
|
+
x: e.clientX - t.dx,
|
|
656
|
+
y: e.clientY - t.dy
|
|
657
|
+
});
|
|
658
|
+
},
|
|
659
|
+
onPointerUp: (e) => {
|
|
660
|
+
let t = j.current;
|
|
661
|
+
if (j.current = null, !t || !k) return A(null);
|
|
662
|
+
A(null), r(_t(e.clientX, e.clientY));
|
|
663
|
+
},
|
|
664
|
+
onPointerCancel: () => (j.current = null, A(null)),
|
|
665
|
+
onKeyDown: (e) => {
|
|
666
|
+
let t = vt(n, e.key);
|
|
667
|
+
t && (e.preventDefault(), r(t));
|
|
668
|
+
},
|
|
669
|
+
children: /* @__PURE__ */ x("svg", {
|
|
670
|
+
width: "8",
|
|
671
|
+
height: "14",
|
|
672
|
+
viewBox: "0 0 8 14",
|
|
673
|
+
"aria-hidden": "true",
|
|
674
|
+
children: [
|
|
675
|
+
/* @__PURE__ */ x("circle", {
|
|
676
|
+
cx: "2",
|
|
677
|
+
cy: "2",
|
|
678
|
+
r: "1.2"
|
|
679
|
+
}),
|
|
680
|
+
/* @__PURE__ */ x("circle", {
|
|
681
|
+
cx: "6",
|
|
682
|
+
cy: "2",
|
|
683
|
+
r: "1.2"
|
|
684
|
+
}),
|
|
685
|
+
/* @__PURE__ */ x("circle", {
|
|
686
|
+
cx: "2",
|
|
687
|
+
cy: "7",
|
|
688
|
+
r: "1.2"
|
|
689
|
+
}),
|
|
690
|
+
/* @__PURE__ */ x("circle", {
|
|
691
|
+
cx: "6",
|
|
692
|
+
cy: "7",
|
|
693
|
+
r: "1.2"
|
|
694
|
+
}),
|
|
695
|
+
/* @__PURE__ */ x("circle", {
|
|
696
|
+
cx: "2",
|
|
697
|
+
cy: "12",
|
|
698
|
+
r: "1.2"
|
|
699
|
+
}),
|
|
700
|
+
/* @__PURE__ */ x("circle", {
|
|
701
|
+
cx: "6",
|
|
702
|
+
cy: "12",
|
|
703
|
+
r: "1.2"
|
|
704
|
+
})
|
|
705
|
+
]
|
|
706
|
+
})
|
|
707
|
+
})
|
|
708
|
+
]
|
|
709
|
+
}),
|
|
710
|
+
D ? /* @__PURE__ */ x("div", {
|
|
711
|
+
class: "ck-menu ck-pop",
|
|
712
|
+
role: "menu",
|
|
713
|
+
onClick: () => (O(!1), N.current?.focus()),
|
|
714
|
+
onKeyDown: (e) => e.key === "Escape" ? (e.stopPropagation(), O(!1), N.current?.focus()) : Ee(e, "[role=menuitem]", !0),
|
|
715
|
+
children: [
|
|
716
|
+
T ? /* @__PURE__ */ x(l, { children: [
|
|
717
|
+
/* @__PURE__ */ x("div", {
|
|
718
|
+
class: "ck-menu-head",
|
|
719
|
+
title: `${T.person.name} · ${T.project.name}`,
|
|
720
|
+
children: [
|
|
721
|
+
/* @__PURE__ */ x("bdi", { children: T.person.name }),
|
|
722
|
+
" · ",
|
|
723
|
+
/* @__PURE__ */ x("bdi", { children: T.project.name })
|
|
724
|
+
]
|
|
725
|
+
}),
|
|
726
|
+
/* @__PURE__ */ x("button", {
|
|
727
|
+
role: "menuitem",
|
|
728
|
+
onClick: y,
|
|
729
|
+
children: u("settings")
|
|
730
|
+
}),
|
|
731
|
+
_ ? /* @__PURE__ */ x("button", {
|
|
732
|
+
role: "menuitem",
|
|
733
|
+
onClick: _,
|
|
734
|
+
children: u("signOffApprove")
|
|
735
|
+
}) : null
|
|
736
|
+
] }) : /* @__PURE__ */ x("button", {
|
|
737
|
+
role: "menuitem",
|
|
738
|
+
onClick: p,
|
|
739
|
+
children: u("signInMember")
|
|
740
|
+
}),
|
|
741
|
+
h ? /* @__PURE__ */ x("button", {
|
|
742
|
+
role: "menuitem",
|
|
743
|
+
"aria-keyshortcuts": "?",
|
|
744
|
+
onClick: h,
|
|
745
|
+
children: u("shortcutsTitle")
|
|
746
|
+
}) : null,
|
|
747
|
+
/* @__PURE__ */ x("button", {
|
|
748
|
+
role: "menuitem",
|
|
749
|
+
class: "ck-menu-two",
|
|
750
|
+
"aria-keyshortcuts": P ? "Meta+Shift+K" : "Control+Shift+K",
|
|
751
|
+
onClick: v,
|
|
752
|
+
children: [u("hideWidget"), je() ? null : /* @__PURE__ */ x("span", {
|
|
753
|
+
class: "ck-muted",
|
|
754
|
+
children: u("hideWidgetHint", { keys: P ? "⌘ Shift K" : "Ctrl Shift K" })
|
|
755
|
+
})]
|
|
756
|
+
}),
|
|
757
|
+
T ? /* @__PURE__ */ x("button", {
|
|
758
|
+
role: "menuitem",
|
|
759
|
+
class: "ck-danger",
|
|
760
|
+
onClick: m,
|
|
761
|
+
children: u("signOut")
|
|
762
|
+
}) : null
|
|
763
|
+
]
|
|
764
|
+
}) : null
|
|
765
|
+
]
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
function _t(e, t) {
|
|
769
|
+
return `${t < innerHeight / 2 ? "top" : "bottom"}-${e < innerWidth / 3 ? "left" : e > innerWidth * 2 / 3 ? "right" : "center"}`;
|
|
770
|
+
}
|
|
771
|
+
function vt(e, t) {
|
|
772
|
+
let [n, r] = e.split("-"), i = [
|
|
773
|
+
"left",
|
|
774
|
+
"center",
|
|
775
|
+
"right"
|
|
776
|
+
], a = i.indexOf(r);
|
|
777
|
+
return t === "ArrowLeft" && a > 0 ? `${n}-${i[a - 1]}` : t === "ArrowRight" && a < 2 ? `${n}-${i[a + 1]}` : t === "ArrowUp" && n === "bottom" ? `top-${r}` : t === "ArrowDown" && n === "top" ? `bottom-${r}` : null;
|
|
778
|
+
}
|
|
779
|
+
function yt({ onCancel: e, onPick: t, quote: n = !0, move: r = !1, picker: c = null }) {
|
|
780
|
+
let [p] = s(() => {
|
|
781
|
+
let e = document.activeElement;
|
|
782
|
+
return e && e !== document.body && e !== document.documentElement && !i(e) ? e : null;
|
|
783
|
+
}), m = ee(() => matchMedia("(pointer: coarse)").matches, []), [h, _] = s(null), v = g(c);
|
|
784
|
+
d(() => {
|
|
785
|
+
let e = !0, r = (r) => {
|
|
786
|
+
if (!e) return;
|
|
787
|
+
v.current = r, r.prepare();
|
|
788
|
+
let i = n ? r.selected() : null, o = i?.toString().trim();
|
|
789
|
+
if (i && o) {
|
|
790
|
+
let e = a(i.startContainer, i.getBoundingClientRect()), n = i.commonAncestorContainer.nodeType === 1 ? i.commonAncestorContainer : i.commonAncestorContainer.parentElement;
|
|
791
|
+
t({
|
|
792
|
+
anchor: y({
|
|
793
|
+
element: n,
|
|
794
|
+
clientX: e.left,
|
|
795
|
+
clientY: e.top,
|
|
796
|
+
quote: o
|
|
797
|
+
}),
|
|
798
|
+
point: {
|
|
799
|
+
x: e.left,
|
|
800
|
+
y: e.bottom
|
|
801
|
+
},
|
|
802
|
+
region: {
|
|
803
|
+
x: e.left,
|
|
804
|
+
y: e.top,
|
|
805
|
+
w: e.width,
|
|
806
|
+
h: e.height
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
return c ? r(c) : import("./pick-C20RVUas.js").then(r, () => {}), () => void (e = !1);
|
|
812
|
+
}, []);
|
|
813
|
+
let y = (e) => o({
|
|
814
|
+
...e,
|
|
815
|
+
extra: v.current?.extra
|
|
816
|
+
}), [b, S] = s(null), C = g(null), w = g(null), [T, E] = s([]), D = g(null), O = g(null);
|
|
817
|
+
f(() => O.current?.focus({ preventScroll: !0 }), []);
|
|
818
|
+
let k = g(null), A = g({
|
|
819
|
+
timer: null,
|
|
820
|
+
fired: !1
|
|
821
|
+
}), j = () => {
|
|
822
|
+
A.current.timer && clearTimeout(A.current.timer), A.current.timer = null;
|
|
823
|
+
};
|
|
824
|
+
d(() => j, []);
|
|
825
|
+
let M = (e, t) => {
|
|
826
|
+
let n = D.current;
|
|
827
|
+
if (!n) return null;
|
|
828
|
+
let r = v.current;
|
|
829
|
+
n.style.pointerEvents = "none";
|
|
830
|
+
let a = r ? r.deepAt(e, t) : document.elementsFromPoint(e, t).find((e) => !i(e) && e !== document.documentElement && e !== document.body) ?? document.body;
|
|
831
|
+
return n.style.pointerEvents = "auto", r ? r.paintedAt(a, (n) => {
|
|
832
|
+
let i = F(e, t);
|
|
833
|
+
return !!i && n.contains(i.node) && r.overText(e, t, i);
|
|
834
|
+
}) : a;
|
|
835
|
+
}, N = (e) => {
|
|
836
|
+
if (!v.current) return;
|
|
837
|
+
let n = a(e), r = n.left + Math.min(n.width / 2, 24), i = n.top + Math.min(n.height / 2, 24);
|
|
838
|
+
t({
|
|
839
|
+
anchor: y({
|
|
840
|
+
element: e,
|
|
841
|
+
clientX: r,
|
|
842
|
+
clientY: i
|
|
843
|
+
}),
|
|
844
|
+
point: {
|
|
845
|
+
x: r,
|
|
846
|
+
y: n.top + n.height
|
|
847
|
+
},
|
|
848
|
+
region: null
|
|
849
|
+
});
|
|
850
|
+
}, P = () => {
|
|
851
|
+
t({
|
|
852
|
+
anchor: {
|
|
853
|
+
type: "page",
|
|
854
|
+
page: {
|
|
855
|
+
x: 50,
|
|
856
|
+
y: Math.round(scrollY + Math.min(120, innerHeight / 3))
|
|
857
|
+
}
|
|
858
|
+
},
|
|
859
|
+
point: {
|
|
860
|
+
x: innerWidth / 2,
|
|
861
|
+
y: Math.min(120, innerHeight / 3)
|
|
862
|
+
},
|
|
863
|
+
region: null
|
|
864
|
+
});
|
|
865
|
+
}, F = (e, t) => {
|
|
866
|
+
let n = D.current, r = v.current;
|
|
867
|
+
if (!n || !r) return null;
|
|
868
|
+
n.style.pointerEvents = "none";
|
|
869
|
+
try {
|
|
870
|
+
return r.caretAt(e, t);
|
|
871
|
+
} finally {
|
|
872
|
+
n.style.pointerEvents = "auto";
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
return f(() => {
|
|
876
|
+
let t = (t) => {
|
|
877
|
+
if (t.key === "Escape") e();
|
|
878
|
+
else if (r && t.key === "Enter") {
|
|
879
|
+
let e = document.activeElement;
|
|
880
|
+
if (!e || e === document.body || e.hasAttribute("data-commentkit-host")) return;
|
|
881
|
+
t.preventDefault(), N(e);
|
|
882
|
+
} else t.key === "Enter" && !t.composedPath().some((e) => e instanceof HTMLButtonElement) && (t.preventDefault(), p ? N(p) : P());
|
|
883
|
+
};
|
|
884
|
+
return addEventListener("keydown", t), () => removeEventListener("keydown", t);
|
|
885
|
+
}, [e, r]), /* @__PURE__ */ x(l, { children: [
|
|
886
|
+
/* @__PURE__ */ x("div", {
|
|
887
|
+
class: "ck-mode-frame",
|
|
888
|
+
"aria-hidden": "true",
|
|
889
|
+
"data-commentkit-ui": !0
|
|
890
|
+
}),
|
|
891
|
+
/* @__PURE__ */ x("div", {
|
|
892
|
+
class: "ck-mode-hint",
|
|
893
|
+
role: "group",
|
|
894
|
+
"aria-label": u("comment"),
|
|
895
|
+
"data-commentkit-ui": !0,
|
|
896
|
+
children: [
|
|
897
|
+
/* @__PURE__ */ x("span", {
|
|
898
|
+
role: "status",
|
|
899
|
+
children: u(r ? m ? "movePinHintTouch" : "movePinHint" : n ? m ? "modeBarTouch" : "modeBar" : m ? "modeBarTouchNoText" : "modeBarNoText")
|
|
900
|
+
}),
|
|
901
|
+
r ? null : p ? /* @__PURE__ */ x("button", {
|
|
902
|
+
class: "ck-chip",
|
|
903
|
+
ref: O,
|
|
904
|
+
onClick: () => N(p),
|
|
905
|
+
children: u("commentFocused")
|
|
906
|
+
}) : null,
|
|
907
|
+
r ? null : /* @__PURE__ */ x("button", {
|
|
908
|
+
class: "ck-chip",
|
|
909
|
+
ref: p ? void 0 : O,
|
|
910
|
+
onClick: P,
|
|
911
|
+
children: u("commentOnPage")
|
|
912
|
+
}),
|
|
913
|
+
/* @__PURE__ */ x("button", {
|
|
914
|
+
class: "ck-chip",
|
|
915
|
+
ref: r ? O : void 0,
|
|
916
|
+
onClick: e,
|
|
917
|
+
children: u("cancel")
|
|
918
|
+
})
|
|
919
|
+
]
|
|
920
|
+
}),
|
|
921
|
+
/* @__PURE__ */ x("div", {
|
|
922
|
+
ref: D,
|
|
923
|
+
class: "ck-catcher",
|
|
924
|
+
"data-commentkit-ui": !0,
|
|
925
|
+
onPointerMove: (e) => {
|
|
926
|
+
if (e.pointerType === "touch") {
|
|
927
|
+
let t = k.current;
|
|
928
|
+
t && (Math.abs(e.clientX - t.x) > 8 || Math.abs(e.clientY - t.y) > 8) && j();
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
if (k.current && C.current) {
|
|
932
|
+
let t = F(e.clientX, e.clientY);
|
|
933
|
+
if (!t) return;
|
|
934
|
+
let n = v.current, r = n.between(C.current, t);
|
|
935
|
+
if (!r) return;
|
|
936
|
+
w.current = r, E(n.boxesOf(r).filter((e) => e.width > 0 && e.height > 0).slice(0, 200));
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
if (k.current) {
|
|
940
|
+
S({
|
|
941
|
+
x: k.current.x,
|
|
942
|
+
y: k.current.y,
|
|
943
|
+
x2: e.clientX,
|
|
944
|
+
y2: e.clientY
|
|
945
|
+
});
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
let t = M(e.clientX, e.clientY);
|
|
949
|
+
_(t ? a(t) : null);
|
|
950
|
+
},
|
|
951
|
+
onPointerDown: (e) => {
|
|
952
|
+
if (e.button !== 0 || !v.current) return;
|
|
953
|
+
let r = M(e.clientX, e.clientY);
|
|
954
|
+
if (r) {
|
|
955
|
+
if (k.current = {
|
|
956
|
+
x: e.clientX,
|
|
957
|
+
y: e.clientY,
|
|
958
|
+
target: r
|
|
959
|
+
}, A.current.fired = !1, C.current = null, w.current = null, n && e.pointerType !== "touch" && !e.shiftKey) {
|
|
960
|
+
let t = F(e.clientX, e.clientY);
|
|
961
|
+
t && v.current.overText(e.clientX, e.clientY, t) && (C.current = t);
|
|
962
|
+
}
|
|
963
|
+
e.pointerType === "touch" && (e.preventDefault(), j(), A.current.timer = setTimeout(() => {
|
|
964
|
+
let e = k.current;
|
|
965
|
+
A.current.timer = null, e && (A.current.fired = !0, k.current = null, bt(e.x, e.y), t({
|
|
966
|
+
anchor: y({
|
|
967
|
+
element: e.target,
|
|
968
|
+
clientX: e.x,
|
|
969
|
+
clientY: e.y
|
|
970
|
+
}),
|
|
971
|
+
point: {
|
|
972
|
+
x: e.x,
|
|
973
|
+
y: e.y
|
|
974
|
+
},
|
|
975
|
+
region: null
|
|
976
|
+
}));
|
|
977
|
+
}, 500)), e.pointerType !== "touch" && D.current?.setPointerCapture(e.pointerId);
|
|
978
|
+
}
|
|
979
|
+
},
|
|
980
|
+
onPointerUp: (e) => {
|
|
981
|
+
j();
|
|
982
|
+
let n = k.current;
|
|
983
|
+
if (k.current = null, S(null), E([]), !n) return;
|
|
984
|
+
let r = w.current;
|
|
985
|
+
C.current = null, w.current = null;
|
|
986
|
+
let i = r?.toString().trim();
|
|
987
|
+
if (r && i) {
|
|
988
|
+
let e = a(r.startContainer, r.getBoundingClientRect()), o = r.commonAncestorContainer.nodeType === 1 ? r.commonAncestorContainer : r.commonAncestorContainer.parentElement ?? n.target;
|
|
989
|
+
t({
|
|
990
|
+
anchor: y({
|
|
991
|
+
element: o,
|
|
992
|
+
clientX: e.left,
|
|
993
|
+
clientY: e.top,
|
|
994
|
+
quote: i
|
|
995
|
+
}),
|
|
996
|
+
point: {
|
|
997
|
+
x: e.left,
|
|
998
|
+
y: e.bottom
|
|
999
|
+
},
|
|
1000
|
+
region: {
|
|
1001
|
+
x: e.left,
|
|
1002
|
+
y: e.top,
|
|
1003
|
+
w: e.width,
|
|
1004
|
+
h: e.height
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
let o = Math.abs(e.clientX - n.x) > 8 || Math.abs(e.clientY - n.y) > 8;
|
|
1010
|
+
if (e.pointerType === "touch" && o) return;
|
|
1011
|
+
e.pointerType === "touch" && bt(e.clientX, e.clientY);
|
|
1012
|
+
let s = e.pointerType !== "touch" && Math.abs(e.clientX - n.x) > 8 && Math.abs(e.clientY - n.y) > 8, c = s ? xt(n.target, M(e.clientX, e.clientY) ?? n.target) : n.target;
|
|
1013
|
+
t({
|
|
1014
|
+
anchor: y({
|
|
1015
|
+
element: c,
|
|
1016
|
+
clientX: n.x,
|
|
1017
|
+
clientY: n.y,
|
|
1018
|
+
...s ? {
|
|
1019
|
+
endX: e.clientX,
|
|
1020
|
+
endY: e.clientY
|
|
1021
|
+
} : {}
|
|
1022
|
+
}),
|
|
1023
|
+
point: {
|
|
1024
|
+
x: s ? Math.max(n.x, e.clientX) : e.clientX,
|
|
1025
|
+
y: s ? Math.max(n.y, e.clientY) : e.clientY
|
|
1026
|
+
},
|
|
1027
|
+
region: s ? {
|
|
1028
|
+
x: Math.min(n.x, e.clientX),
|
|
1029
|
+
y: Math.min(n.y, e.clientY),
|
|
1030
|
+
w: Math.abs(e.clientX - n.x),
|
|
1031
|
+
h: Math.abs(e.clientY - n.y)
|
|
1032
|
+
} : null
|
|
1033
|
+
});
|
|
1034
|
+
},
|
|
1035
|
+
onPointerCancel: () => {
|
|
1036
|
+
j(), k.current = null, S(null);
|
|
1037
|
+
},
|
|
1038
|
+
onContextMenu: (t) => {
|
|
1039
|
+
t.preventDefault(), A.current.timer || A.current.fired || m || e();
|
|
1040
|
+
}
|
|
1041
|
+
}),
|
|
1042
|
+
h && !b && !T.length ? /* @__PURE__ */ x("div", {
|
|
1043
|
+
class: "ck-outline",
|
|
1044
|
+
style: K(h.left - 2, h.top - 2, h.width + 4, h.height + 4)
|
|
1045
|
+
}) : null,
|
|
1046
|
+
T.map((e) => /* @__PURE__ */ x("div", {
|
|
1047
|
+
class: "ck-text-box",
|
|
1048
|
+
style: K(e.left, e.top, e.width, e.height)
|
|
1049
|
+
})),
|
|
1050
|
+
b && !C.current ? /* @__PURE__ */ x("div", {
|
|
1051
|
+
class: "ck-region",
|
|
1052
|
+
style: K(Math.min(b.x, b.x2), Math.min(b.y, b.y2), Math.abs(b.x2 - b.x), Math.abs(b.y2 - b.y))
|
|
1053
|
+
}) : null
|
|
1054
|
+
] });
|
|
1055
|
+
}
|
|
1056
|
+
function bt(e, t) {
|
|
1057
|
+
$();
|
|
1058
|
+
let n = (n) => {
|
|
1059
|
+
Math.abs(n.clientX - e) > 24 || Math.abs(n.clientY - t) > 24 || (n.preventDefault(), n.stopPropagation(), $());
|
|
1060
|
+
};
|
|
1061
|
+
addEventListener("click", n, !0);
|
|
1062
|
+
let r = setTimeout($, 700);
|
|
1063
|
+
$ = () => {
|
|
1064
|
+
removeEventListener("click", n, !0), clearTimeout(r), $ = () => void 0;
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
var $ = () => void 0;
|
|
1068
|
+
function xt(e, t) {
|
|
1069
|
+
if (e.contains(t)) return e;
|
|
1070
|
+
for (let n = t; n; n = n.parentElement) if (n.contains(e)) return n;
|
|
1071
|
+
return document.body;
|
|
1072
|
+
}
|
|
1073
|
+
// src/ui/nav.ts
|
|
1074
|
+
function St(e, t, n) {
|
|
1075
|
+
let r = _e(e);
|
|
1076
|
+
if (!r || !/^https?:$/.test(new URL(r).protocol) || Ct(r)) return n(t);
|
|
1077
|
+
location.assign(qe(r, t));
|
|
1078
|
+
}
|
|
1079
|
+
function Ct(e) {
|
|
1080
|
+
try {
|
|
1081
|
+
let t = new URL(e), r = new URL(n());
|
|
1082
|
+
return t.origin === r.origin && t.pathname === r.pathname && t.search === r.search && (t.hash === r.hash || !t.hash.startsWith("#/"));
|
|
1083
|
+
} catch {
|
|
1084
|
+
return !1;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
// src/ui/Pins.tsx
|
|
1088
|
+
var wt = "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", Tt = 6;
|
|
1089
|
+
function Et({ client: e, activeId: t, onOpen: n, notify: r, onError: c }) {
|
|
1090
|
+
let f = Z(e.state, (e) => e.threads), p = Z(e.state, (e) => !!e.session?.capabilities.triage && !e.config?.read_only), m = we(f.length > 0), h = Q(!0, () => import("./placement-BF_HOUDD.js")), _ = ee(() => h?.createPlacer(), [h]), [, v] = s(0), [y] = s(() => /* @__PURE__ */ new Map()), [b] = s(() => /* @__PURE__ */ new Map());
|
|
1091
|
+
d(() => {
|
|
1092
|
+
let e = new Set(f.map((e) => e.id));
|
|
1093
|
+
_?.keep(e);
|
|
1094
|
+
for (let t of [y, b]) for (let n of t.keys()) e.has(n) || t.delete(n);
|
|
1095
|
+
}, [f, _]), d(() => {
|
|
1096
|
+
let e = _?.wait();
|
|
1097
|
+
if (e == null) return;
|
|
1098
|
+
let t = setTimeout(() => v((e) => e + 1), e);
|
|
1099
|
+
return () => clearTimeout(t);
|
|
1100
|
+
});
|
|
1101
|
+
let S = g(null), C = g(null), w = typeof matchMedia == "function" && matchMedia("(hover: hover)").matches, T = f.map((e) => ({
|
|
1102
|
+
thread: e,
|
|
1103
|
+
at: _ ? _(e.id, e.anchor, m.version) : null
|
|
1104
|
+
})), E = (e) => {
|
|
1105
|
+
let t = e?.getBoundingClientRect() ?? {
|
|
1106
|
+
left: -scrollX,
|
|
1107
|
+
top: -scrollY,
|
|
1108
|
+
width: 100
|
|
1109
|
+
};
|
|
1110
|
+
return (e, n) => ({
|
|
1111
|
+
x: (e - t.left) / (t.width / 100 || 1),
|
|
1112
|
+
y: (n - t.top) / (t.width / 100 || 1)
|
|
1113
|
+
});
|
|
1114
|
+
}, D = E(S.current), O = E(C.current), k = T.flatMap(({ thread: e, at: t }) => {
|
|
1115
|
+
let n = e.anchor.quote;
|
|
1116
|
+
if (!t || e.anchor.type !== "text" || !n) return [];
|
|
1117
|
+
let r = y.get(e.id);
|
|
1118
|
+
r?.[0] !== m.version && y.set(e.id, r = [m.version, jt(t.element, n)]);
|
|
1119
|
+
let i = t.element.getBoundingClientRect(), o = a(t.element);
|
|
1120
|
+
return [...r[1]?.getClientRects() ?? []].map((e) => new DOMRect(e.x + o.x - i.x, e.y + o.y - i.y, e.width, e.height)).filter((e) => e.width > 0 && e.height > 0 && t.inView(e.left + e.width / 2, e.top + e.height / 2)).slice(0, 50).map((n) => ({
|
|
1121
|
+
id: e.id,
|
|
1122
|
+
fixed: t.fixed,
|
|
1123
|
+
x: n.left,
|
|
1124
|
+
y: n.top,
|
|
1125
|
+
w: n.width,
|
|
1126
|
+
h: n.height
|
|
1127
|
+
}));
|
|
1128
|
+
}), A = g(k);
|
|
1129
|
+
A.current = k, d(() => m.watch(T.flatMap(({ at: e }) => e?.element ? [e.element] : []))), d(() => {
|
|
1130
|
+
if (!w) return;
|
|
1131
|
+
let e = 0, t = null, n = (n) => {
|
|
1132
|
+
e || (e = requestAnimationFrame(() => {
|
|
1133
|
+
e = 0;
|
|
1134
|
+
let r = n.clientX, i = n.clientY, a = A.current.find((e) => r >= e.x && r <= e.x + e.w && i >= e.y && i <= e.y + e.h)?.id ?? null;
|
|
1135
|
+
a !== t && (t = a, R(a, a ? 250 : 120));
|
|
1136
|
+
}));
|
|
1137
|
+
};
|
|
1138
|
+
return addEventListener("pointermove", n, { passive: !0 }), () => {
|
|
1139
|
+
removeEventListener("pointermove", n), cancelAnimationFrame(e);
|
|
1140
|
+
};
|
|
1141
|
+
}, [k.length > 0]);
|
|
1142
|
+
let [j, M] = s(null), [N, P] = s(null), F = g(null), I = g(!1), L = g(null), R = (e, t) => {
|
|
1143
|
+
L.current && clearTimeout(L.current), L.current = setTimeout(() => M(e), t);
|
|
1144
|
+
};
|
|
1145
|
+
d(() => () => void (L.current && clearTimeout(L.current)), []);
|
|
1146
|
+
let z = (t, n, a) => {
|
|
1147
|
+
let s = document.elementsFromPoint(n, a).find((e) => !i(e) && e !== document.documentElement);
|
|
1148
|
+
s && Dt(e, t, o({
|
|
1149
|
+
element: s,
|
|
1150
|
+
clientX: n,
|
|
1151
|
+
clientY: a
|
|
1152
|
+
}), r, c);
|
|
1153
|
+
}, te = (e) => {
|
|
1154
|
+
e.style.translate = "", P(null);
|
|
1155
|
+
}, B = {
|
|
1156
|
+
page: [],
|
|
1157
|
+
fixed: []
|
|
1158
|
+
};
|
|
1159
|
+
for (let e of k) {
|
|
1160
|
+
let n = (e.fixed ? O : D)(e.x, e.y);
|
|
1161
|
+
B[e.fixed ? "fixed" : "page"].push(/* @__PURE__ */ x("div", {
|
|
1162
|
+
class: "ck-shade",
|
|
1163
|
+
"data-active": e.id === t || e.id === j || void 0,
|
|
1164
|
+
style: K(n.x, n.y, e.w, e.h),
|
|
1165
|
+
"aria-hidden": "true"
|
|
1166
|
+
}));
|
|
1167
|
+
}
|
|
1168
|
+
for (let { thread: e, at: r } of T) {
|
|
1169
|
+
if (!r) continue;
|
|
1170
|
+
let i = r.fixed ? O : D, a = N === e.id, { x: o, y: s } = r, c = !a && r.clipped, d = !1;
|
|
1171
|
+
!c && !a && e.id !== t && (d = m.scrolling ? !!b.get(e.id) : Ot(r.element, o, s), b.set(e.id, d));
|
|
1172
|
+
let f = c || d, h = j === e.id && !N && e.id !== t && !f, g = i(o, s), _ = r.resolved.rect && e.id === t && !c ? i(r.resolved.rect.x - scrollX, r.resolved.rect.y - scrollY) : null;
|
|
1173
|
+
B[r.fixed ? "fixed" : "page"].push(/* @__PURE__ */ x(l, { children: [
|
|
1174
|
+
_ ? /* @__PURE__ */ x("div", {
|
|
1175
|
+
class: "ck-pin-region",
|
|
1176
|
+
style: K(_.x, _.y, r.resolved.rect.w, r.resolved.rect.h)
|
|
1177
|
+
}) : null,
|
|
1178
|
+
/* @__PURE__ */ x("button", {
|
|
1179
|
+
class: "ck-pin",
|
|
1180
|
+
style: K(g.x, g.y),
|
|
1181
|
+
"data-status": e.status,
|
|
1182
|
+
"data-state": r.resolved.state,
|
|
1183
|
+
"data-dragging": a || void 0,
|
|
1184
|
+
"data-covered": f || void 0,
|
|
1185
|
+
"data-clipped": c || void 0,
|
|
1186
|
+
tabIndex: f ? -1 : void 0,
|
|
1187
|
+
"data-movable": p || void 0,
|
|
1188
|
+
"aria-expanded": e.id === t,
|
|
1189
|
+
"aria-label": `${e.reference} · ${u(`status_${e.status}`)}: ${e.first_message?.body.slice(0, 80) ?? ""}`,
|
|
1190
|
+
"aria-roledescription": p ? u("pinMovable") : void 0,
|
|
1191
|
+
onPointerEnter: () => w && R(e.id, 250),
|
|
1192
|
+
onPointerLeave: () => w && R(null, 120),
|
|
1193
|
+
onFocus: () => R(e.id, 0),
|
|
1194
|
+
onBlur: () => R(null, 0),
|
|
1195
|
+
onPointerDown: (t) => {
|
|
1196
|
+
if (!p || t.button !== 0) return;
|
|
1197
|
+
let n = t.currentTarget.parentElement?.getBoundingClientRect().width;
|
|
1198
|
+
F.current = {
|
|
1199
|
+
id: e.id,
|
|
1200
|
+
x: t.clientX,
|
|
1201
|
+
y: t.clientY,
|
|
1202
|
+
moved: !1,
|
|
1203
|
+
scale: (n ?? 100) / 100 || 1
|
|
1204
|
+
}, t.currentTarget.setPointerCapture?.(t.pointerId);
|
|
1205
|
+
},
|
|
1206
|
+
onPointerMove: (t) => {
|
|
1207
|
+
let n = F.current;
|
|
1208
|
+
if (n && n.id === e.id) {
|
|
1209
|
+
if (!n.moved) {
|
|
1210
|
+
if (Math.hypot(t.clientX - n.x, t.clientY - n.y) < Tt) return;
|
|
1211
|
+
n.moved = !0, M(null), P(e.id);
|
|
1212
|
+
}
|
|
1213
|
+
t.currentTarget.style.translate = `${(t.clientX - n.x) / n.scale}px ${(t.clientY - n.y) / n.scale}px`;
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
onPointerUp: (t) => {
|
|
1217
|
+
let n = F.current;
|
|
1218
|
+
F.current = null, n?.moved && (I.current = !0, te(t.currentTarget), z(e, t.clientX, t.clientY));
|
|
1219
|
+
},
|
|
1220
|
+
onPointerCancel: (e) => {
|
|
1221
|
+
F.current = null, te(e.currentTarget);
|
|
1222
|
+
},
|
|
1223
|
+
onClick: () => {
|
|
1224
|
+
if (I.current) return void (I.current = !1);
|
|
1225
|
+
n(e);
|
|
1226
|
+
},
|
|
1227
|
+
onKeyDown: (e) => e.key === "Escape" && M(null),
|
|
1228
|
+
children: [/* @__PURE__ */ x("svg", {
|
|
1229
|
+
viewBox: "5 3 54 62",
|
|
1230
|
+
"aria-hidden": "true",
|
|
1231
|
+
children: /* @__PURE__ */ x("path", { d: wt })
|
|
1232
|
+
}), /* @__PURE__ */ x("span", {
|
|
1233
|
+
"data-long": e.number > 999 || void 0,
|
|
1234
|
+
children: e.number > 9999 ? `${e.number / 1e3 | 0}k` : e.number
|
|
1235
|
+
})]
|
|
1236
|
+
}),
|
|
1237
|
+
h ? /* @__PURE__ */ x(At, {
|
|
1238
|
+
thread: e,
|
|
1239
|
+
x: o,
|
|
1240
|
+
y: s,
|
|
1241
|
+
to: i
|
|
1242
|
+
}) : null
|
|
1243
|
+
] }, e.id));
|
|
1244
|
+
}
|
|
1245
|
+
return /* @__PURE__ */ x(l, { children: [/* @__PURE__ */ x("div", {
|
|
1246
|
+
class: "ck-pins",
|
|
1247
|
+
ref: S,
|
|
1248
|
+
"data-commentkit-ui": !0,
|
|
1249
|
+
children: B.page
|
|
1250
|
+
}), /* @__PURE__ */ x("div", {
|
|
1251
|
+
class: "ck-pins",
|
|
1252
|
+
ref: C,
|
|
1253
|
+
"data-fixed": !0,
|
|
1254
|
+
"data-commentkit-ui": !0,
|
|
1255
|
+
children: B.fixed
|
|
1256
|
+
})] });
|
|
1257
|
+
}
|
|
1258
|
+
function Dt(e, t, n, r, i) {
|
|
1259
|
+
let a = t.anchor, o = (n) => e.state.set((e) => ({ threads: e.threads.map((e) => e.id === t.id ? {
|
|
1260
|
+
...e,
|
|
1261
|
+
anchor: n
|
|
1262
|
+
} : e) }));
|
|
1263
|
+
o(n), e.updateThread(t.id, { anchor: n }).then(() => {
|
|
1264
|
+
r({
|
|
1265
|
+
text: u("pinMoved", { ref: t.reference }),
|
|
1266
|
+
tone: "success",
|
|
1267
|
+
action: {
|
|
1268
|
+
label: u("undo"),
|
|
1269
|
+
run: () => void e.updateThread(t.id, { anchor: a }).catch(i)
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
}, (e) => {
|
|
1273
|
+
o(a), i(e);
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
function Ot(e, t, n) {
|
|
1277
|
+
if (!e?.isConnected || t < 0 || n < 0 || t >= innerWidth || n >= innerHeight) return !1;
|
|
1278
|
+
let r = document.elementsFromPoint(t, n).find((e) => !i(e)), a = kt(e), o = r && kt(r);
|
|
1279
|
+
return !!o && o !== document.documentElement && o !== document.body && !a.contains(o) && !o.contains(a);
|
|
1280
|
+
}
|
|
1281
|
+
function kt(e) {
|
|
1282
|
+
for (let t; t = e.getRootNode().host ?? (e.ownerDocument !== document && e.ownerDocument.defaultView?.frameElement);) e = t;
|
|
1283
|
+
return e;
|
|
1284
|
+
}
|
|
1285
|
+
function At({ thread: e, x: t, y: n, to: r }) {
|
|
1286
|
+
let i = n > 180, a = h() === "rtl" ? t - 18 - 260 : t + 18, o = r(Math.min(Math.max(8, a), innerWidth - 260 - 8), i ? n - 16 : n + 24);
|
|
1287
|
+
return /* @__PURE__ */ x("div", {
|
|
1288
|
+
class: "ck-peek",
|
|
1289
|
+
style: {
|
|
1290
|
+
...K(o.x, o.y, 260),
|
|
1291
|
+
translate: i ? "0 -100%" : void 0
|
|
1292
|
+
},
|
|
1293
|
+
"aria-hidden": "true",
|
|
1294
|
+
children: [
|
|
1295
|
+
/* @__PURE__ */ x("div", {
|
|
1296
|
+
class: "ck-peek-top",
|
|
1297
|
+
children: [
|
|
1298
|
+
/* @__PURE__ */ x(ve, { person: e.author }),
|
|
1299
|
+
/* @__PURE__ */ x("bdi", {
|
|
1300
|
+
class: "ck-msg-name",
|
|
1301
|
+
children: e.author.name
|
|
1302
|
+
}),
|
|
1303
|
+
/* @__PURE__ */ x("span", {
|
|
1304
|
+
class: "ck-time",
|
|
1305
|
+
children: v(e.created_at)
|
|
1306
|
+
})
|
|
1307
|
+
]
|
|
1308
|
+
}),
|
|
1309
|
+
e.anchor.quote ? /* @__PURE__ */ x("div", {
|
|
1310
|
+
class: "ck-quote ck-peek-quote",
|
|
1311
|
+
children: /* @__PURE__ */ x("bdi", { children: e.anchor.quote })
|
|
1312
|
+
}) : null,
|
|
1313
|
+
/* @__PURE__ */ x("div", {
|
|
1314
|
+
class: "ck-peek-text",
|
|
1315
|
+
dir: "auto",
|
|
1316
|
+
children: e.first_message?.body
|
|
1317
|
+
}),
|
|
1318
|
+
/* @__PURE__ */ x("div", {
|
|
1319
|
+
class: "ck-peek-foot",
|
|
1320
|
+
children: [/* @__PURE__ */ x(be, { status: e.status }), /* @__PURE__ */ x("span", {
|
|
1321
|
+
class: "ck-muted",
|
|
1322
|
+
children: c("messageCount", e.message_count)
|
|
1323
|
+
})]
|
|
1324
|
+
})
|
|
1325
|
+
]
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
function jt(e, t) {
|
|
1329
|
+
let n = t.replace(/\s+/g, " ").trim().toLowerCase();
|
|
1330
|
+
if (!n) return null;
|
|
1331
|
+
let r = [], i = "", a = e.ownerDocument, o = a.createTreeWalker(e, NodeFilter.SHOW_TEXT);
|
|
1332
|
+
for (let e = o.nextNode(); e; e = o.nextNode()) {
|
|
1333
|
+
for (let t = 0; t < e.data.length; t++) {
|
|
1334
|
+
let n = /\s/.test(e.data[t]) ? " " : e.data[t].toLowerCase();
|
|
1335
|
+
n === " " && i.endsWith(" ") || (i += n, r.push({
|
|
1336
|
+
node: e,
|
|
1337
|
+
offset: t
|
|
1338
|
+
}));
|
|
1339
|
+
}
|
|
1340
|
+
if (i.length > 2e4) break;
|
|
1341
|
+
}
|
|
1342
|
+
let s = i.indexOf(n);
|
|
1343
|
+
if (s < 0) return null;
|
|
1344
|
+
let c = r[s], l = r[s + n.length - 1], u = a.createRange();
|
|
1345
|
+
return u.setStart(c.node, c.offset), u.setEnd(l.node, l.offset + 1), u;
|
|
1346
|
+
}
|
|
1347
|
+
// src/ui/session.ts
|
|
1348
|
+
function Mt(e, t, { view: n, open: r, go: i, openThread: a, notify: o, reportError: c }) {
|
|
1349
|
+
let l = Z(e.state, (e) => e.opening), f = g(null), p = g(null);
|
|
1350
|
+
p.current = n.name === "thread" ? n.threadId : n.name === "panel" ? n.threadId ?? null : null;
|
|
1351
|
+
let [m, h] = s(0);
|
|
1352
|
+
return d(() => () => f.current?.stop(), []), d(() => {
|
|
1353
|
+
let n = () => {
|
|
1354
|
+
let e = Ye();
|
|
1355
|
+
e && (t ? r({
|
|
1356
|
+
name: "thread",
|
|
1357
|
+
threadId: e
|
|
1358
|
+
}) : D("commentkit:pending-thread", e));
|
|
1359
|
+
}, a = () => t && void e.loadPageThreads().catch(c);
|
|
1360
|
+
Pt(e, c) || a(), n();
|
|
1361
|
+
let o, s = !1;
|
|
1362
|
+
if (t) {
|
|
1363
|
+
e.inbox().catch(() => void 0);
|
|
1364
|
+
let t = e.state.get().config, n = () => h((e) => e + 1);
|
|
1365
|
+
import("./live-DXcxj_Af.js").then((r) => {
|
|
1366
|
+
if (s) return;
|
|
1367
|
+
o = r.catchUp(e, n);
|
|
1368
|
+
let a = r.comeBack();
|
|
1369
|
+
if (a.draft && (scrollTo({
|
|
1370
|
+
top: a.scrollY,
|
|
1371
|
+
behavior: "auto"
|
|
1372
|
+
}), i({
|
|
1373
|
+
name: "composing",
|
|
1374
|
+
draft: a.draft
|
|
1375
|
+
})), a.thread ? i({
|
|
1376
|
+
name: "thread",
|
|
1377
|
+
threadId: a.thread
|
|
1378
|
+
}) : a.comment && !a.draft && i({ name: "commenting" }), t?.features.realtime && t.realtime) return f.current ?? (f.current = r.liveUpdates(e, () => p.current, n)), e.connectRealtime((e) => f.current?.onPing(e));
|
|
1379
|
+
}).catch(() => void 0);
|
|
1380
|
+
}
|
|
1381
|
+
let l = Ze((e) => (e && a(), n()), () => e.pageKey());
|
|
1382
|
+
return () => {
|
|
1383
|
+
s = !0, o?.(), l();
|
|
1384
|
+
};
|
|
1385
|
+
}, [
|
|
1386
|
+
e,
|
|
1387
|
+
t,
|
|
1388
|
+
c
|
|
1389
|
+
]), d(() => {
|
|
1390
|
+
let n = e.auth.pending();
|
|
1391
|
+
!t && n && i({
|
|
1392
|
+
name: "verify",
|
|
1393
|
+
email: n.email,
|
|
1394
|
+
draft: null
|
|
1395
|
+
});
|
|
1396
|
+
}, []), d(() => {
|
|
1397
|
+
l && t && (e.state.set({ opening: null }), import("./live-DXcxj_Af.js").then((t) => t.openReference(e, l, a, St, () => o({
|
|
1398
|
+
text: u("threadNotFound"),
|
|
1399
|
+
tone: "error"
|
|
1400
|
+
}), c), c));
|
|
1401
|
+
}, [l, t]), {
|
|
1402
|
+
cardVersion: m,
|
|
1403
|
+
openId: p.current
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
var Nt = null;
|
|
1407
|
+
function Pt(e, t) {
|
|
1408
|
+
let n = e.state.get().session, r = !n?.capabilities.triage, i = n && `${n.person.type}:${n.person.id}:${r}`, a = !!i && i !== Nt && !!e.options.branch && r !== e.state.get().allBranches;
|
|
1409
|
+
return Nt = i, a && e.setAllBranches(r).catch(t), a;
|
|
1410
|
+
}
|
|
1411
|
+
function Ft(e, t, n, r) {
|
|
1412
|
+
let i = async (n, i) => {
|
|
1413
|
+
let a = null, o = e.on("error", ({ error: e }) => a = e), s = await e.signIn(t, n).finally(o);
|
|
1414
|
+
return s !== "signed_in" && s !== "redirecting" && !n?.aborted && !(i && s === "cancelled") && r({
|
|
1415
|
+
text: s === "popup_blocked" ? u("popupBlocked") : a ? Pe(a) : u("signInCancelled"),
|
|
1416
|
+
tone: "error"
|
|
1417
|
+
}), s;
|
|
1418
|
+
}, a = g(n);
|
|
1419
|
+
return d(() => {
|
|
1420
|
+
let t = a.current;
|
|
1421
|
+
a.current = n, t && !n && import("./live-DXcxj_Af.js").then((n) => n.forgetPerson(e.options.project, t)).catch(() => void 0);
|
|
1422
|
+
}, [n]), {
|
|
1423
|
+
signIn: i,
|
|
1424
|
+
signOut: () => void e.signOut()
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
var It = /* @__PURE__ */ new WeakSet();
|
|
1428
|
+
function Lt() {
|
|
1429
|
+
let e = g([]), [t, n] = s(e.current), r = p((t, r = !1) => {
|
|
1430
|
+
n(e.current = e.current.filter((e) => e !== t)), !It.has(t) && (It.add(t), r || t.onExpire?.());
|
|
1431
|
+
}, []);
|
|
1432
|
+
d(() => {
|
|
1433
|
+
let e = t.filter((e) => (e.tone === "error" || e.action) && !e.expires);
|
|
1434
|
+
if (!e.length) return;
|
|
1435
|
+
let n = (t) => {
|
|
1436
|
+
t.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("ck-toast")) || e.forEach((e) => r(e));
|
|
1437
|
+
};
|
|
1438
|
+
return addEventListener("pointerdown", n, !0), () => removeEventListener("pointerdown", n, !0);
|
|
1439
|
+
}, [t]), d(() => {
|
|
1440
|
+
let t = () => e.current.forEach((e) => r(e));
|
|
1441
|
+
return addEventListener("pagehide", t), () => {
|
|
1442
|
+
removeEventListener("pagehide", t), t();
|
|
1443
|
+
};
|
|
1444
|
+
}, []);
|
|
1445
|
+
let i = g(null), a = g([]);
|
|
1446
|
+
return d(() => () => a.current.forEach(clearTimeout), []), {
|
|
1447
|
+
toasts: t,
|
|
1448
|
+
notify: p((t) => {
|
|
1449
|
+
let o = (e, t) => a.current.push(setTimeout(e, t)), s = [...e.current, t], c = s.filter((e) => e === t || e.text !== t.text);
|
|
1450
|
+
for (let e of s) e !== t && (e.text === t.text || c.indexOf(e) < c.length - 3) && r(e);
|
|
1451
|
+
n(e.current = e.current.concat(t));
|
|
1452
|
+
let l = () => i.current?.matches(":hover, :focus-within") ? o(l, 1e3) : r(t);
|
|
1453
|
+
(t.expires || t.tone !== "error" && !t.action) && o(l, t.expires ?? 4e3);
|
|
1454
|
+
}, []),
|
|
1455
|
+
dismiss: r,
|
|
1456
|
+
region: i
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
function Rt({ toasts: { toasts: e, dismiss: t, region: n }, children: r }) {
|
|
1460
|
+
return /* @__PURE__ */ x("div", {
|
|
1461
|
+
class: "ck-toast-region",
|
|
1462
|
+
role: "status",
|
|
1463
|
+
"aria-live": "polite",
|
|
1464
|
+
"aria-label": u("messagesRegion"),
|
|
1465
|
+
ref: n,
|
|
1466
|
+
"data-commentkit-ui": !0,
|
|
1467
|
+
children: [r, e.map((e) => /* @__PURE__ */ x("div", {
|
|
1468
|
+
class: "ck-toast",
|
|
1469
|
+
"data-tone": e.tone,
|
|
1470
|
+
children: [
|
|
1471
|
+
e.tone ? /* @__PURE__ */ x("span", {
|
|
1472
|
+
class: "ck-toast-icon",
|
|
1473
|
+
"aria-hidden": "true",
|
|
1474
|
+
children: /* @__PURE__ */ x(xe, {
|
|
1475
|
+
name: e.tone === "error" ? "alert" : e.tone === "success" ? "check" : "info",
|
|
1476
|
+
size: 15
|
|
1477
|
+
})
|
|
1478
|
+
}) : null,
|
|
1479
|
+
/* @__PURE__ */ x("span", { children: e.text }),
|
|
1480
|
+
e.action ? /* @__PURE__ */ x("button", {
|
|
1481
|
+
onClick: () => (t(e, !0), e.action.run()),
|
|
1482
|
+
children: e.action.label
|
|
1483
|
+
}) : null,
|
|
1484
|
+
e.tone === "error" || e.action ? /* @__PURE__ */ x("button", {
|
|
1485
|
+
class: "ck-toast-close",
|
|
1486
|
+
"aria-label": u("dismissMessage"),
|
|
1487
|
+
title: u("dismissMessage"),
|
|
1488
|
+
onClick: () => t(e),
|
|
1489
|
+
children: /* @__PURE__ */ x(xe, {
|
|
1490
|
+
name: "close",
|
|
1491
|
+
size: 14
|
|
1492
|
+
})
|
|
1493
|
+
}) : null
|
|
1494
|
+
]
|
|
1495
|
+
}, e.text))]
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
// src/ui/view.ts
|
|
1499
|
+
var zt = { name: "idle" };
|
|
1500
|
+
function Bt(e, t) {
|
|
1501
|
+
let n = e.name === "panel" && e.order || [];
|
|
1502
|
+
switch (t.name) {
|
|
1503
|
+
case "stop": return e.name === "commenting" ? zt : e;
|
|
1504
|
+
case "back": return e.name === "panel" ? {
|
|
1505
|
+
name: "panel",
|
|
1506
|
+
order: n
|
|
1507
|
+
} : e;
|
|
1508
|
+
case "step": {
|
|
1509
|
+
if (e.name !== "panel" || !e.threadId) return e;
|
|
1510
|
+
let r = n.indexOf(e.threadId);
|
|
1511
|
+
return r < 0 ? e : {
|
|
1512
|
+
...e,
|
|
1513
|
+
threadId: n[(r + t.by + n.length) % n.length]
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
case "edit": return e.name === "verify" ? e.draft ? {
|
|
1517
|
+
name: "composing",
|
|
1518
|
+
draft: e.draft
|
|
1519
|
+
} : { name: "commenting" } : e;
|
|
1520
|
+
default: return t;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
function Vt() {
|
|
1524
|
+
let [e, t] = m(Bt, zt), n = g(null);
|
|
1525
|
+
d(() => {
|
|
1526
|
+
if (e.name === "idle") {
|
|
1527
|
+
let e = n.current;
|
|
1528
|
+
n.current = null, e?.isConnected && e.focus({ preventScroll: !0 });
|
|
1529
|
+
}
|
|
1530
|
+
}, [e.name]);
|
|
1531
|
+
let [r, i] = s(!1), a = g(null), o = p((e) => {
|
|
1532
|
+
if (!a.current) {
|
|
1533
|
+
if (e === !0 || matchMedia("(prefers-reduced-motion: reduce)").matches) return t(zt);
|
|
1534
|
+
i(!0), a.current = setTimeout(() => {
|
|
1535
|
+
a.current = null, i(!1), t(zt);
|
|
1536
|
+
}, 120);
|
|
1537
|
+
}
|
|
1538
|
+
}, []);
|
|
1539
|
+
return d(() => () => void (a.current && clearTimeout(a.current)), []), {
|
|
1540
|
+
view: e,
|
|
1541
|
+
go: t,
|
|
1542
|
+
open: (r) => {
|
|
1543
|
+
if (e.name === "idle") {
|
|
1544
|
+
let e = document.querySelector("[data-commentkit-host]")?.shadowRoot?.activeElement;
|
|
1545
|
+
n.current = e instanceof HTMLElement ? e : null;
|
|
1546
|
+
}
|
|
1547
|
+
a.current && (clearTimeout(a.current), a.current = null, i(!1)), t(r);
|
|
1548
|
+
},
|
|
1549
|
+
close: o,
|
|
1550
|
+
closing: r
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
// src/ui/App.tsx
|
|
1554
|
+
var Ht = "commentkit:welcomed";
|
|
1555
|
+
function Ut({ client: e, onHide: t = () => void 0 }) {
|
|
1556
|
+
let n = Z(e.state, ({ config: e }) => e?.enabled === !1 && (e.disabled_reason || "paused")[0]);
|
|
1557
|
+
return n ? n == "v" ? null : /* @__PURE__ */ x("div", {
|
|
1558
|
+
class: "ck-toast",
|
|
1559
|
+
role: "status",
|
|
1560
|
+
children: u(n == "n" ? "notLive" : "paused")
|
|
1561
|
+
}) : /* @__PURE__ */ x(Wt, {
|
|
1562
|
+
client: e,
|
|
1563
|
+
onHide: t
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
function Wt({ client: e, onHide: n }) {
|
|
1567
|
+
let [i] = s(() => {
|
|
1568
|
+
let t = e.entrance ?? (e.auth.hasSignInLink() || e.auth.finishLink || /[?&]ck(_thread)?=[^&#]/.test(location.href) ? "link" : null);
|
|
1569
|
+
return e.entrance = void 0, t;
|
|
1570
|
+
}), [a, o] = s(""), c = Z(e.state, (e) => e.config), f = Z(e.state, (e) => e.session), m = f && `${f.person.type}:${f.person.id}`;
|
|
1571
|
+
w(m);
|
|
1572
|
+
let h = Lt(), { notify: g } = h, { view: _, go: v, open: y, close: b, closing: ee } = Vt(), [S, C] = s(!1), [T, E] = s(!1), O = p((t) => {
|
|
1573
|
+
let n = e.auth.pending();
|
|
1574
|
+
if (t instanceof r && t.code === "verification_required" && n) return v({
|
|
1575
|
+
name: "verify",
|
|
1576
|
+
email: n.email,
|
|
1577
|
+
draft: null
|
|
1578
|
+
});
|
|
1579
|
+
g({
|
|
1580
|
+
text: Pe(t),
|
|
1581
|
+
tone: "error"
|
|
1582
|
+
});
|
|
1583
|
+
}, [g]), { Settings: k, Shortcuts: A, Composer: j, GuestVerify: M, Panel: N, ThreadCard: P, anchors: F } = ct(e, c, _, S, T, O), I = Q(e.auth.finishLink, () => t(() => import("./Guest-Bi7hlzhs.js")).then((e) => e.GuestFinish), O), [L] = s(Je), [R, z] = s(() => !!L && !D(Ht)), [te, B] = s(() => e.auth.hasSignInLink()), [ne, re] = s(null), [, V] = s(0);
|
|
1584
|
+
d(() => it(() => V((e) => e + 1)), []), d(() => () => $(), []);
|
|
1585
|
+
let H = nt(e), ie = H && f?.capabilities.triage && !je() ? () => C(!0) : null, U = c?.read_only ?? !1, ae = u(f && f.role !== "guest" ? "readOnly" : "readOnlyGuest"), W = !f && _.name === "idle" ? e.auth.pending() : null, [oe, G] = s(!1), K = Q(oe, () => t(() => import("./SignInFirst-CmGvSYkQ.js")).then((e) => e.SignInFirst), O), q = () => {
|
|
1586
|
+
if (U) return g({
|
|
1587
|
+
text: ae,
|
|
1588
|
+
tone: "error"
|
|
1589
|
+
});
|
|
1590
|
+
if (z(!1), !f && !L && !e.auth.pending() && !e.auth.hasSession()) return G(!0);
|
|
1591
|
+
y({ name: "commenting" });
|
|
1592
|
+
}, J = (e) => y({
|
|
1593
|
+
name: "thread",
|
|
1594
|
+
threadId: typeof e == "string" ? e : e.id
|
|
1595
|
+
}), se = () => _.name === "panel" ? b() : y({ name: "panel" }), ce = (t) => {
|
|
1596
|
+
let n = e.state.get().threads.find((e) => e.id === t);
|
|
1597
|
+
return n ? () => v({
|
|
1598
|
+
name: "commenting",
|
|
1599
|
+
move: n
|
|
1600
|
+
}) : void 0;
|
|
1601
|
+
}, { signIn: Y, signOut: le } = Ft(e, L, m, g);
|
|
1602
|
+
d(() => void (f && G(!1)), [f]);
|
|
1603
|
+
let { cardVersion: ue, openId: de } = Mt(e, f, {
|
|
1604
|
+
view: _,
|
|
1605
|
+
open: y,
|
|
1606
|
+
go: v,
|
|
1607
|
+
openThread: J,
|
|
1608
|
+
notify: g,
|
|
1609
|
+
reportError: O
|
|
1610
|
+
});
|
|
1611
|
+
mt(() => ({
|
|
1612
|
+
view: _,
|
|
1613
|
+
help: S,
|
|
1614
|
+
keys: H,
|
|
1615
|
+
signedIn: !!f,
|
|
1616
|
+
threads: e.state.get().threads
|
|
1617
|
+
}), (e) => e === "help" ? C(!0) : e === "closeHelp" ? C(!1) : e === "comment" ? q() : e === "back" ? _.name === "commenting" ? v({ name: "idle" }) : b(!0) : J(e)), ht(e, _, f, {
|
|
1618
|
+
comment: q,
|
|
1619
|
+
go: v,
|
|
1620
|
+
togglePanel: se,
|
|
1621
|
+
signIn: () => void Y()
|
|
1622
|
+
});
|
|
1623
|
+
let [X, fe] = ut(e, c);
|
|
1624
|
+
return /* @__PURE__ */ x(l, { children: [
|
|
1625
|
+
f ? /* @__PURE__ */ x(Et, {
|
|
1626
|
+
client: e,
|
|
1627
|
+
activeId: de,
|
|
1628
|
+
onOpen: J,
|
|
1629
|
+
notify: g,
|
|
1630
|
+
onError: O
|
|
1631
|
+
}) : null,
|
|
1632
|
+
_.name === "commenting" && F ? /* @__PURE__ */ x(yt, {
|
|
1633
|
+
picker: F.picker,
|
|
1634
|
+
quote: e.options.tools?.text !== !1 && !_.move,
|
|
1635
|
+
move: !!_.move,
|
|
1636
|
+
onCancel: () => v({ name: "idle" }),
|
|
1637
|
+
onPick: (t) => {
|
|
1638
|
+
let n = _.move;
|
|
1639
|
+
if (!n) return v({
|
|
1640
|
+
name: "composing",
|
|
1641
|
+
draft: t
|
|
1642
|
+
});
|
|
1643
|
+
v({ name: "idle" }), Dt(e, n, t.anchor, g, O);
|
|
1644
|
+
}
|
|
1645
|
+
}) : null,
|
|
1646
|
+
/* @__PURE__ */ x("div", {
|
|
1647
|
+
class: "ck-layer",
|
|
1648
|
+
"data-closing": ee || void 0,
|
|
1649
|
+
"data-pos": X,
|
|
1650
|
+
children: [
|
|
1651
|
+
_.name === "composing" && j ? /* @__PURE__ */ x(j, {
|
|
1652
|
+
client: e,
|
|
1653
|
+
draft: _.draft,
|
|
1654
|
+
signedIn: !!f,
|
|
1655
|
+
onSignIn: Y,
|
|
1656
|
+
onCancel: b,
|
|
1657
|
+
share: L,
|
|
1658
|
+
onError: O,
|
|
1659
|
+
onSent: (t, n) => {
|
|
1660
|
+
let r = e.state.get().session;
|
|
1661
|
+
g({
|
|
1662
|
+
text: n ? u(n === "screenshot" ? "sentWithoutScreenshot" : "sentWithoutFiles") : r?.role === "guest" || !r ? u("sentGuest") : u("sent"),
|
|
1663
|
+
tone: n ? "info" : "success"
|
|
1664
|
+
}), J(t);
|
|
1665
|
+
},
|
|
1666
|
+
onPending: (e) => {
|
|
1667
|
+
re(_.draft), v({
|
|
1668
|
+
name: "verify",
|
|
1669
|
+
email: e,
|
|
1670
|
+
draft: _.draft
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
}) : null,
|
|
1674
|
+
_.name === "verify" && M ? /* @__PURE__ */ x(M, {
|
|
1675
|
+
client: e,
|
|
1676
|
+
email: _.email,
|
|
1677
|
+
onDifferentEmail: () => v({ name: "edit" }),
|
|
1678
|
+
onClose: b,
|
|
1679
|
+
onDone: (t) => {
|
|
1680
|
+
if (_.draft) {
|
|
1681
|
+
let t = Re(e, _.draft.anchor);
|
|
1682
|
+
D(t, null), D(t.replace(/[^:]*~/, ""), null);
|
|
1683
|
+
}
|
|
1684
|
+
g({
|
|
1685
|
+
text: u("sentGuest"),
|
|
1686
|
+
tone: "success"
|
|
1687
|
+
}), t[0] ? J(t[0]) : v({ name: "idle" });
|
|
1688
|
+
}
|
|
1689
|
+
}) : null,
|
|
1690
|
+
_.name === "thread" && P ? /* @__PURE__ */ x(P, {
|
|
1691
|
+
client: e,
|
|
1692
|
+
threadId: _.threadId,
|
|
1693
|
+
version: ue,
|
|
1694
|
+
onClose: b,
|
|
1695
|
+
onError: O,
|
|
1696
|
+
notify: g,
|
|
1697
|
+
onMovePin: ce(_.threadId)
|
|
1698
|
+
}) : null,
|
|
1699
|
+
_.name === "panel" && N ? /* @__PURE__ */ x(N, {
|
|
1700
|
+
client: e,
|
|
1701
|
+
side: X.endsWith("left") ? "left" : "right",
|
|
1702
|
+
dock: X.startsWith("top") ? "top" : "bottom",
|
|
1703
|
+
onClose: b,
|
|
1704
|
+
version: ue,
|
|
1705
|
+
onError: O,
|
|
1706
|
+
notify: g,
|
|
1707
|
+
reveal: _.signOff,
|
|
1708
|
+
onOpen: (e, t) => v({
|
|
1709
|
+
name: "panel",
|
|
1710
|
+
threadId: typeof e == "string" ? e : e.id,
|
|
1711
|
+
order: t
|
|
1712
|
+
}),
|
|
1713
|
+
detail: _.threadId && P ? (() => {
|
|
1714
|
+
let t = _.order ?? [], n = t.indexOf(_.threadId), r = (e) => t.length > 1 && n >= 0 ? () => v({
|
|
1715
|
+
name: "step",
|
|
1716
|
+
by: e
|
|
1717
|
+
}) : void 0;
|
|
1718
|
+
return /* @__PURE__ */ x(P, {
|
|
1719
|
+
client: e,
|
|
1720
|
+
threadId: _.threadId,
|
|
1721
|
+
version: ue,
|
|
1722
|
+
onClose: b,
|
|
1723
|
+
onError: O,
|
|
1724
|
+
notify: g,
|
|
1725
|
+
onMovePin: ce(_.threadId),
|
|
1726
|
+
embedded: {
|
|
1727
|
+
onBack: () => v({ name: "back" }),
|
|
1728
|
+
onPrev: r(-1),
|
|
1729
|
+
onNext: r(1),
|
|
1730
|
+
position: n < 0 ? null : {
|
|
1731
|
+
n: n + 1,
|
|
1732
|
+
total: t.length
|
|
1733
|
+
},
|
|
1734
|
+
onShow: (e) => {
|
|
1735
|
+
v({ name: "idle" }), St(e.page.url, e.id, J);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
});
|
|
1739
|
+
})() : null
|
|
1740
|
+
}) : null
|
|
1741
|
+
]
|
|
1742
|
+
}),
|
|
1743
|
+
I ? /* @__PURE__ */ x(I, {
|
|
1744
|
+
client: e,
|
|
1745
|
+
position: X,
|
|
1746
|
+
notify: g,
|
|
1747
|
+
onOpen: J
|
|
1748
|
+
}) : oe && K && !f && _.name === "idle" ? /* @__PURE__ */ x(K, {
|
|
1749
|
+
position: X,
|
|
1750
|
+
website: c?.project.name ?? "",
|
|
1751
|
+
signIn: () => Y(void 0, !0),
|
|
1752
|
+
onSignedIn: () => (G(!1), y({ name: "commenting" })),
|
|
1753
|
+
onDismiss: () => G(!1)
|
|
1754
|
+
}) : te && !f && !W && _.name === "idle" ? /* @__PURE__ */ x(st, {
|
|
1755
|
+
position: X,
|
|
1756
|
+
project: c?.project.name ?? "",
|
|
1757
|
+
onContinue: () => {
|
|
1758
|
+
B(!1), Y().then(() => B(e.auth.hasSignInLink()));
|
|
1759
|
+
},
|
|
1760
|
+
onDismiss: () => B(!1)
|
|
1761
|
+
}) : R && !f && !U && _.name === "idle" ? /* @__PURE__ */ x(ot, {
|
|
1762
|
+
position: X,
|
|
1763
|
+
project: c?.project.name ?? "",
|
|
1764
|
+
onStart: q,
|
|
1765
|
+
onDismiss: () => {
|
|
1766
|
+
z(!1), D(Ht, "1");
|
|
1767
|
+
}
|
|
1768
|
+
}) : null,
|
|
1769
|
+
/* @__PURE__ */ x(gt, {
|
|
1770
|
+
client: e,
|
|
1771
|
+
position: X,
|
|
1772
|
+
onMove: fe,
|
|
1773
|
+
commenting: _.name === "commenting",
|
|
1774
|
+
panelOpen: _.name === "panel",
|
|
1775
|
+
onComment: () => _.name === "commenting" ? v({ name: "idle" }) : q(),
|
|
1776
|
+
onPanel: se,
|
|
1777
|
+
onSignIn: () => void Y(),
|
|
1778
|
+
onSignOut: le,
|
|
1779
|
+
onShortcuts: ie,
|
|
1780
|
+
onApprove: f?.capabilities.comment && !U ? () => y({
|
|
1781
|
+
name: "panel",
|
|
1782
|
+
signOff: Date.now()
|
|
1783
|
+
}) : null,
|
|
1784
|
+
onSettings: () => E(!0),
|
|
1785
|
+
onHide: n,
|
|
1786
|
+
waiting: W?.email ?? null,
|
|
1787
|
+
onCode: () => W && y({
|
|
1788
|
+
name: "verify",
|
|
1789
|
+
email: W.email,
|
|
1790
|
+
draft: ne
|
|
1791
|
+
}),
|
|
1792
|
+
covered: _.name !== "idle" && _.name !== "commenting" || S || T,
|
|
1793
|
+
entrance: i ? {
|
|
1794
|
+
key: i === "key",
|
|
1795
|
+
say: () => o(u(H ? "shownAnnounce" : "shownAnnounceNoKeys"))
|
|
1796
|
+
} : null
|
|
1797
|
+
}),
|
|
1798
|
+
S && A ? /* @__PURE__ */ x(A, { onClose: () => C(!1) }) : null,
|
|
1799
|
+
T && k ? /* @__PURE__ */ x(k, {
|
|
1800
|
+
client: e,
|
|
1801
|
+
onClose: () => E(!1),
|
|
1802
|
+
onShortcuts: ie,
|
|
1803
|
+
onHide: n,
|
|
1804
|
+
onSignOut: le
|
|
1805
|
+
}) : null,
|
|
1806
|
+
/* @__PURE__ */ x(Rt, {
|
|
1807
|
+
toasts: h,
|
|
1808
|
+
children: [U && _.name === "commenting" ? /* @__PURE__ */ x("div", {
|
|
1809
|
+
class: "ck-toast",
|
|
1810
|
+
children: ae
|
|
1811
|
+
}) : null, a ? /* @__PURE__ */ x("span", {
|
|
1812
|
+
class: "ck-sr",
|
|
1813
|
+
children: a
|
|
1814
|
+
}) : null]
|
|
1815
|
+
})
|
|
1816
|
+
] });
|
|
1817
|
+
}
|
|
1818
|
+
// src/ui/styles.css?inline
|
|
1819
|
+
var Gt = ":host{all:initial;--ck-accent:#c2341b;--ck-ix:var(--commentkit-inset-x,var(--ck-opt-ix,0px));--ck-iy:var(--commentkit-inset-y,var(--ck-opt-iy,0px));--ck-accent-ink:#fff;--ck-mark:#ff5733;--ck-mark-ink:#121316;--ck-accent-soft:color-mix(in srgb, var(--ck-accent) 12%, var(--ck-bg));--ck-bg:#fff;--ck-bg-muted:#f7f7f8;--ck-bg-hover:#eeeef0;--ck-border:#e3e3e7;--ck-control:#84858f;--ck-ring:#65677a;--ck-hairline:#12131614;--ck-text:#121316;--ck-text-muted:#5e5f6e;--ck-danger:#c10007;--ck-success:#16794c;--ck-warning:#a15c00;--ck-open:#a6a09b;--ck-review:#8e51ff;--ck-progress:#2563eb;--ck-shadow-sm:0 0 0 1px #1313161a, 0 2px 2px -1px #0000000f, 0 4px 4px -2px #0000000a;--ck-shadow:0 0 0 1px var(--ck-hairline), 0 10px 32px #222a3526, 0 1px 1px #0000000d, 0 4px 6px #222a3514, 0 24px 68px #2f30371a;--ck-radius:12px;--ck-radius-sm:6px;--ck-radius-md:8px;--ck-ease:cubic-bezier(.2, .8, .2, 1);--ck-font:ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;--ck-mono:ui-monospace, SFMono-Regular, Menlo, monospace;--ck-z:1000;--ck-fs-2xs:10px;--ck-fs-xs:11px;--ck-fs-sm:12px;--ck-fs-md:13px;--ck-fs:14px;--ck-fs-lg:16px;--ck-fs-xl:20px;--ck-radius-pill:999px;--ck-fast:.12s;--ck-dur:.2s;--ck-img-outline:#0000001a}@supports not (color:color-mix(in srgb, red, red)){:host{--ck-accent-soft:var(--ck-bg-muted)}}@media print{:host,.ck-root{display:none!important}}:host([data-theme=dark]){--ck-bg:#212126;--ck-bg-muted:#1a1a1e;--ck-bg-hover:#2a2a30;--ck-border:#36363c;--ck-control:#7c7d87;--ck-ring:#a1a2ae;--ck-hairline:#ffffff1a;--ck-text:#fff;--ck-text-muted:#9394a1;--ck-img-outline:#ffffff1a;--ck-danger:#ffa2a2;--ck-success:#4cc38a;--ck-warning:#e3a33f;--ck-shadow-sm:0 0 0 1px var(--ck-hairline), 0 2px 2px -1px #0000004d, 0 4px 4px -2px #0003;--ck-shadow:0 0 0 1px var(--ck-hairline), 0 8px 24px #0006, 0 24px 68px #0000004d}.ck-root{all:initial;font-family:var(--ck-font);font-size:var(--ck-fs);color:var(--ck-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.45;display:block}*,:before,:after{box-sizing:border-box}button,input,textarea,select{font:inherit;color:inherit}button{cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:manipulation}button,a{-webkit-tap-highlight-color:transparent}button:-webkit-any(:disabled,[aria-disabled=true]){opacity:.5;cursor:default}button:is(:disabled,[aria-disabled=true]){opacity:.5;cursor:default}::placeholder{color:var(--ck-text-muted);opacity:1}.ck-root *{scrollbar-width:thin;scrollbar-color:var(--ck-border) transparent}@keyframes ck-pop{0%{opacity:0;transform:translateY(6px)scale(.98)}}@keyframes ck-fade{0%{opacity:0}}@keyframes ck-sheet{0%{translate:0 100%}}.ck-bar-btn,.ck-btn,.ck-chip,.ck-ghost,.ck-input,.ck-grip,.ck-menu button,.ck-toast button,.ck-shade{transition:background-color var(--ck-fast), color var(--ck-fast), border-color var(--ck-fast), box-shadow var(--ck-fast), filter var(--ck-fast), opacity var(--ck-fast), scale var(--ck-fast) ease-out}.ck-bar-btn:active,.ck-btn:active,.ck-chip:active,.ck-ghost:active{scale:.96}.ck-launcher{z-index:var(--ck-z);align-items:center;gap:8px;display:flex;position:fixed}.ck-launcher[data-pos$=right],.ck-welcome[data-pos$=right]{right:calc(20px + var(--ck-ix))}.ck-launcher[data-pos$=left],.ck-welcome[data-pos$=left]{left:calc(20px + var(--ck-ix))}.ck-launcher[data-pos^=top]{top:calc(20px + var(--ck-iy))}.ck-launcher[data-pos^=bottom]{bottom:calc(20px + var(--ck-iy) + env(safe-area-inset-bottom,0px))}.ck-launcher[data-pos$=center],.ck-welcome[data-pos$=center]{left:50%;translate:-50%}.ck-bar{background:var(--ck-bg);background:color-mix(in srgb, var(--ck-bg) 86%, transparent);-webkit-backdrop-filter:blur(14px)saturate(1.4);backdrop-filter:blur(14px)saturate(1.4);border-radius:var(--ck-radius-pill);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) var(--ck-ease);align-items:center;gap:2px;padding:4px;display:flex}.ck-bar-btn{border-radius:var(--ck-radius-pill);height:36px;font-size:var(--ck-fs-md);white-space:nowrap;background:0 0;border:0;align-items:center;gap:6px;padding:0 12px;font-weight:600;display:inline-flex}.ck-bar-btn svg,.ck-btn svg,.ck-ghost svg{flex:none}.ck-bar-btn[aria-pressed=true],.ck-primary{background:var(--ck-accent);color:var(--ck-accent-ink);box-shadow:inset 0 1px 0 #ffffff38, 0 1px 2px color-mix(in srgb, var(--ck-accent) 40%, transparent)}.ck-bar-btn[aria-expanded=true]{background:var(--ck-bg-hover)}.ck-icon-btn{width:36px;color:var(--ck-text-muted);justify-content:center;padding:0;position:relative}.ck-badge{border-radius:var(--ck-radius-pill);background:var(--ck-danger);min-width:16px;height:16px;color:var(--ck-bg);font-size:var(--ck-fs-2xs);box-shadow:0 0 0 2px var(--ck-bg);font-variant-numeric:tabular-nums;place-items:center;padding:0 4px;font-weight:700;line-height:1;display:grid;position:absolute;top:2px;right:2px}.ck-grip{border-radius:var(--ck-radius-pill);width:24px;height:32px;color:var(--ck-text-muted);cursor:grab;touch-action:none;opacity:.75;background:0 0;border:0;place-items:center;margin-inline-start:-4px;margin-inline-end:0;padding:0;display:grid}.ck-grip svg{fill:currentColor}.ck-launcher[data-dragging]{opacity:.92}.ck-launcher[data-entering=\"\"]{opacity:0}.ck-launcher[data-entering] .ck-bar{animation:none}.ck-launcher[data-dragging] .ck-grip{cursor:grabbing}.ck-mode-hint{z-index:var(--ck-z);padding:8px;border-radius:var(--ck-radius);background:var(--ck-text);background:color-mix(in srgb, var(--ck-text) 90%, transparent);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);width:max-content;max-width:calc(100% - 24px);color:var(--ck-bg);font-size:var(--ck-fs-md);box-shadow:var(--ck-shadow);flex-wrap:wrap;justify-content:center;align-items:center;gap:8px 12px;padding-inline-start:16px;font-weight:600;display:flex;position:fixed;top:16px;left:50%;translate:-50%}.ck-mode-hint .ck-chip{background:color-mix(in srgb, currentColor 8%, transparent);color:inherit;border-color:color-mix(in srgb, currentColor 60%, transparent)}.ck-mode-frame{z-index:calc(var(--ck-z) - 1);pointer-events:none;box-shadow:inset 0 0 0 1.5px color-mix(in srgb, var(--ck-accent) 75%, transparent), inset 0 0 14px 2px color-mix(in srgb, var(--ck-accent) 16%, transparent);position:fixed;top:0;bottom:0;left:0;right:0}.ck-catcher{z-index:calc(var(--ck-z) - 2);cursor:crosshair;touch-action:pan-x pan-y pinch-zoom;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;background:0 0;position:fixed;top:0;bottom:0;left:0;right:0}.ck-outline{z-index:calc(var(--ck-z) - 1);pointer-events:none;border:2px solid var(--ck-accent);border-radius:var(--ck-radius-sm);background:color-mix(in srgb, var(--ck-accent) 8%, transparent);box-shadow:0 0 0 4px color-mix(in srgb, var(--ck-accent) 14%, transparent);position:fixed}.ck-region{z-index:calc(var(--ck-z) - 1);pointer-events:none;border-radius:var(--ck-radius-sm);position:fixed}.ck-region,.ck-pending-region{--ck-dash:linear-gradient(90deg, var(--ck-accent) 50%, transparent 0);--ck-dash-v:linear-gradient(0deg, var(--ck-accent) 50%, transparent 0);background:var(--ck-dash) 0 0 / 12px 2px repeat-x, var(--ck-dash) 0 100% / 12px 2px repeat-x, var(--ck-dash-v) 0 0 / 2px 12px repeat-y, var(--ck-dash-v) 100% 0 / 2px 12px repeat-y, color-mix(in srgb, var(--ck-accent) 8%, transparent);animation:.6s linear infinite ck-ants}@keyframes ck-ants{to{background-position:12px 0,-12px 100%,0 -12px,100% 12px,0 0}}.ck-text-box{z-index:var(--ck-z);pointer-events:none;background:color-mix(in srgb, var(--ck-accent) 30%, transparent);border-radius:2px;position:fixed}.ck-pins{width:100px;height:0;z-index:calc(var(--ck-z) - 3);position:absolute;top:0;left:0}.ck-pins[data-fixed]{position:fixed}.ck-pin{--ck-pin:var(--ck-mark);transform-origin:49% 97%;width:28px;height:32px;color:var(--ck-mark-ink);font-size:var(--ck-fs-xs);font-variant-numeric:tabular-nums;filter:drop-shadow(0 0 .6px #fff)drop-shadow(0 0 .6px #fff)drop-shadow(0 3px 6px #12131647);transition:scale var(--ck-fast) var(--ck-ease), filter var(--ck-fast);animation:ck-fade var(--ck-dur) ease-out;background:0 0;border:0;padding:0;font-weight:700;position:absolute;transform:translate(-49%,-97%)}.ck-pin svg{width:100%;height:100%;position:absolute;top:0;bottom:0;left:0;right:0;overflow:visible}.ck-pin path{fill:var(--ck-pin);stroke:#121316;stroke-width:2px;stroke-linejoin:round}.ck-pin>span{text-align:center;line-height:1;position:absolute;top:41%;left:0;right:0;translate:0 -50%}.ck-pin[data-status=in_review]{--ck-pin:color-mix(in srgb, var(--ck-review) 90%, #000);color:#fff}.ck-pin[data-status=in_progress]{--ck-pin:var(--ck-progress);color:#fff}.ck-pin[data-status=resolved]{--ck-pin:var(--ck-success);color:var(--ck-bg)}.ck-pin>span[data-long]{letter-spacing:-.08em;font-size:9px}.ck-pin[data-state=moved]{opacity:.85}.ck-pin[data-covered]{opacity:0;pointer-events:none;transition:opacity var(--ck-fast) ease-out}.ck-pin[data-clipped]{display:none}.ck-pin[aria-expanded=true]{filter:drop-shadow(0 0 .6px #fff) drop-shadow(0 0 .6px #fff) drop-shadow(0 0 5px color-mix(in srgb, var(--ck-pin) 60%, transparent)) drop-shadow(0 4px 8px #1213164d);scale:1.14}.ck-pin:focus-visible{border-radius:50%}.ck-pin-region{pointer-events:none;border:2px dashed var(--ck-accent);border-radius:var(--ck-radius-sm);position:absolute}.ck-pin[data-movable]{touch-action:none}.ck-pin[data-dragging]{cursor:grabbing;filter:drop-shadow(0 0 .6px #fff)drop-shadow(0 8px 14px #12131659);z-index:2;transition:none;scale:1.18}.ck-pin[aria-expanded=true]:before{content:\"\";width:28px;height:28px;box-shadow:0 0 0 2px var(--ck-pin);pointer-events:none;opacity:0;border-radius:50%;margin:-14px 0 0 -14px;animation:.9s ease-out 2 ck-ping;position:absolute;top:40%;left:50%}@keyframes ck-ping{0%{opacity:.8;scale:.6}to{opacity:0;scale:2.2}}.ck-peek{z-index:3;background:var(--ck-bg);border-radius:var(--ck-radius-md);box-shadow:var(--ck-shadow);pointer-events:none;animation:ck-fade var(--ck-fast) ease-out;font-size:var(--ck-fs-md);padding:12px;position:absolute}.ck-peek-top{align-items:center;gap:8px;display:flex}.ck-peek-top .ck-avatar{--ck-av:20px}.ck-peek-top .ck-time{color:var(--ck-text-muted);font-size:var(--ck-fs-sm);margin-inline-start:auto}.ck-peek-quote{-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:8px 0 0;display:-webkit-box;overflow:hidden}.ck-peek-text{-webkit-line-clamp:3;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin-top:4px;line-height:1.45;display:-webkit-box;overflow:hidden}.ck-peek-foot{font-size:var(--ck-fs-sm);align-items:center;gap:8px;margin-top:8px;display:flex}@keyframes ck-pin-drop{0%{opacity:0;translate:0 -8px;scale:.4}}.ck-shade{pointer-events:none;background:color-mix(in srgb, var(--ck-accent) 16%, transparent);box-shadow:inset 0 -2px 0 color-mix(in srgb, var(--ck-accent) 55%, transparent);border-radius:2px;position:absolute}.ck-shade[data-active]{background:color-mix(in srgb, var(--ck-accent) 28%, transparent)}.ck-card{z-index:calc(var(--ck-z) + 1);width:min(380px,100vw - 24px);max-height:min(560px,100vh - 24px);background:var(--ck-bg);border-radius:var(--ck-radius);max-height:min(560px,100dvh - 24px);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) var(--ck-ease);flex-direction:column;display:flex;position:fixed;overflow:hidden}.ck-card-head{border-bottom:1px solid var(--ck-hairline);align-items:center;gap:4px;min-height:48px;padding:8px;padding-inline-start:16px;display:flex}.ck-card-title,.ck-peek-top bdi{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-weight:600;overflow:hidden}.ck-card h2.ck-card-title{font-size:var(--ck-fs);margin:0}.ck-card-body{background:linear-gradient(var(--ck-bg) 40%, #0000) top/100% 24px no-repeat local, linear-gradient(#0000, var(--ck-bg) 60%) bottom/100% 24px no-repeat local, linear-gradient(var(--ck-border), #0000) top/100% 8px no-repeat, linear-gradient(#0000, var(--ck-border)) bottom/100% 8px no-repeat;flex:1;min-height:0;padding:12px 16px;overflow:auto}.ck-card>:not(.ck-card-body){flex-shrink:0}.ck-card-foot{border-top:1px solid var(--ck-hairline);align-items:center;gap:8px;padding:12px;display:flex}.ck-card-body>p.ck-muted{margin:0 0 8px;line-height:1.4}.ck-ghost{border-radius:var(--ck-radius-sm);color:var(--ck-text-muted);background:0 0;border:0;padding:6px 8px;font-weight:600}.ck-card-head .ck-ghost{flex:none;place-items:center;width:32px;height:32px;padding:0;display:inline-grid}.ck-ghost-sm{min-height:24px;font-size:var(--ck-fs-sm);padding:0 4px}.ck-ghost.ck-danger{color:var(--ck-danger)}.ck-btn{border-radius:var(--ck-radius-sm);background:var(--ck-bg);height:32px;box-shadow:var(--ck-shadow-sm);font-size:var(--ck-fs-md);white-space:nowrap;border:0;justify-content:center;align-items:center;gap:6px;padding:0 12px;font-weight:600;display:inline-flex}.ck-btn.ck-primary{background:var(--ck-accent);color:var(--ck-accent-ink);box-shadow:inset 0 1px 0 #ffffff38, 0 0 0 1px color-mix(in srgb, var(--ck-accent) 80%, #000), 0 2px 2px -1px #00000029}.ck-spacer{flex:1}.ck-actions{flex-wrap:wrap;gap:8px;margin-top:12px;display:flex}.ck-chip{border-radius:var(--ck-radius-pill);border:1px solid var(--ck-control);background:var(--ck-bg);height:28px;color:var(--ck-text-muted);font-size:var(--ck-fs-sm);cursor:pointer;white-space:nowrap;align-items:center;gap:4px;max-width:100%;padding:0 12px;font-weight:600;display:inline-flex;overflow:hidden}.ck-chip[aria-pressed=true],.ck-chip[aria-expanded=true]{background:var(--ck-accent-soft);color:var(--ck-accent-text);border-color:var(--ck-accent);border-color:color-mix(in srgb, var(--ck-accent) 45%, var(--ck-border))}.ck-chip .ck-count{margin-inline-start:2px}.ck-input{border-radius:var(--ck-radius-sm);border:1px solid var(--ck-control);background:var(--ck-bg);width:100%;height:32px;padding:0 11px}.ck-input[aria-invalid=true]{border-color:var(--ck-danger)}.ck-input::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none}.ck-field{font-size:var(--ck-fs-md);color:var(--ck-text-muted);gap:4px;font-weight:500;display:grid}.ck-field .ck-input{color:var(--ck-text);font-weight:400;font-size:var(--ck-fs)}.ck-muted{color:var(--ck-text-muted);font-size:var(--ck-fs-sm)}.ck-note{border-radius:var(--ck-radius-md);background:var(--ck-bg-muted);font-size:var(--ck-fs-md);overflow-wrap:anywhere;margin:8px 0 0;padding:8px 12px;line-height:1.45}.ck-note[data-tone=warning]{background:var(--ck-bg-muted);background:color-mix(in srgb, var(--ck-warning) 12%, var(--ck-bg))}.ck-note[data-tone=error]{background:var(--ck-bg-muted);background:color-mix(in srgb, var(--ck-danger) 10%, var(--ck-bg));color:var(--ck-danger)}.ck-avatar{--ck-av:24px;width:var(--ck-av);height:var(--ck-av);background:var(--ck-bg-hover);color:var(--ck-text);font-size:max(8px, calc(var(--ck-av) * .4));box-shadow:0 0 0 1px var(--ck-hairline);border-radius:50%;flex:none;place-items:center;font-weight:600;display:grid;overflow:hidden}.ck-avatar img{object-fit:cover;outline:1px solid var(--ck-img-outline);outline-offset:-1px;width:100%;height:100%}.ck-msg-name{color:var(--ck-text);font-weight:600;font-size:var(--ck-fs-md)}.ck-status{--ck-tone:var(--ck-open);font-size:var(--ck-fs-sm);border-radius:var(--ck-radius-pill);background:var(--ck-bg-muted);background:color-mix(in srgb, var(--ck-tone) 12%, var(--ck-bg));color:color-mix(in srgb, var(--ck-tone) 45%, var(--ck-text));white-space:nowrap;align-items:center;gap:6px;padding:2px 8px;font-weight:600;display:inline-flex}.ck-status:before{content:\"\";background:var(--ck-tone);border-radius:50%;width:8px;height:8px}.ck-status[data-status=in_progress]{--ck-tone:var(--ck-progress)}.ck-status[data-status=in_review]{--ck-tone:var(--ck-review)}.ck-status[data-status=resolved]{--ck-tone:var(--ck-success)}.ck-status[data-status=closed]{--ck-tone:var(--ck-text-muted)}.ck-mention{color:var(--ck-accent-text);font-weight:600}.ck-pre{overscroll-behavior-x:contain;border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);box-shadow:0 0 0 1px var(--ck-hairline);white-space:pre;margin:6px 0;padding:8px 12px;overflow-x:auto}.ck-quote{border-radius:var(--ck-radius-sm);border-inline-start:3px solid color-mix(in srgb, var(--ck-accent) 70%, var(--ck-border));background:var(--ck-bg-muted);color:var(--ck-text-muted);font-size:var(--ck-fs-sm);overflow-wrap:anywhere;margin:0 0 8px;padding:4px 8px;line-height:1.45;display:block}.ck-emoji{vertical-align:-.2em;width:1.15em;height:1.15em;margin:0 .04em;display:inline-block}.ck-time{white-space:nowrap;font-variant-numeric:tabular-nums;flex:none;line-height:1.67}.ck-menu{z-index:2;background:var(--ck-bg);border-radius:var(--ck-radius-md);min-width:210px;max-width:min(320px,100vw - 24px);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) var(--ck-ease);padding:4px;position:absolute;top:48px}.ck-menu:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:8px}.ck-menu:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:8px}.ck-menu:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:8px}.ck-menu:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:8px}.ck-menu button{text-align:start;border-radius:var(--ck-radius-sm);width:100%;font-size:var(--ck-fs-md);background:0 0;border:0;align-items:center;gap:8px;padding:8px 12px;display:flex}.ck-menu .ck-danger{color:var(--ck-danger)}.ck-menu-head{border-bottom:1px solid var(--ck-hairline);font-size:var(--ck-fs-sm);color:var(--ck-text-muted);text-overflow:ellipsis;white-space:nowrap;margin-bottom:4px;padding:4px 12px 8px;overflow:hidden}.ck-menu-two{flex-direction:column;align-items:flex-start!important;gap:0!important}.ck-menu-two .ck-muted{font-size:var(--ck-fs-xs)}[dir=rtl] .ck-search .ck-ghost,[dir=rtl] .ck-badge{left:8px;right:auto}[dir=rtl] .ck-search .ck-ghost{left:4px}[dir=rtl] .ck-badge{left:2px}.ck-launcher .ck-menu{top:auto;bottom:52px;left:auto;right:0}.ck-launcher[data-pos^=top] .ck-menu{top:52px;bottom:auto}.ck-launcher[data-pos$=left] .ck-menu{left:0;right:auto}.ck-launcher-note{background:var(--ck-bg);width:max-content;max-width:min(300px,100vw - 40px);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) var(--ck-ease);margin:0;position:absolute;bottom:calc(100% + 8px);right:0}.ck-launcher[data-pos$=left] .ck-launcher-note{left:0;right:auto}.ck-launcher[data-pos^=top] .ck-launcher-note{top:calc(100% + 8px);bottom:auto}.ck-launcher[data-pos$=center] .ck-launcher-note,.ck-launcher[data-pos$=center] .ck-menu{left:50%;right:auto;translate:-50%}.ck-panel{z-index:var(--ck-z);background:var(--ck-bg);border-radius:var(--ck-radius);width:min(400px,100vw - 24px);box-shadow:var(--ck-shadow);transform-origin:100% 100%;animation:ck-grow var(--ck-dur) var(--ck-ease);flex-direction:column;display:flex;position:fixed;top:12px;bottom:12px;overflow:hidden}.ck-panel[data-side=right]{right:12px}.ck-panel[data-side=left]{transform-origin:0 100%;left:12px}@media (min-width:521px) and (min-height:481px){.ck-panel[data-dock=bottom]{bottom:calc(76px + var(--ck-iy) + env(safe-area-inset-bottom,0px))}.ck-panel[data-dock=top]{top:calc(76px + var(--ck-iy))}}.ck-panel[data-dock=top][data-side=right]{transform-origin:100% 0}.ck-panel[data-dock=top][data-side=left]{transform-origin:0 0}.ck-toast{z-index:calc(var(--ck-z) + 1);border-radius:var(--ck-radius-md);background:var(--ck-bg);max-width:min(360px,100vw - 24px);color:var(--ck-text);font-size:var(--ck-fs-md);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) var(--ck-ease);align-items:center;gap:8px;padding:8px;padding-inline-start:12px;font-weight:500;line-height:1.4;display:flex;position:fixed;bottom:84px;left:50%;translate:-50%}.ck-toast>span{overflow-wrap:anywhere;min-width:0}.ck-toast-region{z-index:calc(var(--ck-z) + 1);left:50%;bottom:calc(84px + var(--ck-kb,0px) + env(safe-area-inset-bottom,0px));pointer-events:none;flex-direction:column;align-items:center;gap:8px;width:max-content;max-width:calc(100vw - 24px);display:flex;position:fixed;translate:-50%}.ck-layer[data-pos^=bottom]~.ck-toast-region{bottom:calc(84px + var(--ck-iy) + var(--ck-kb,0px) + env(safe-area-inset-bottom,0px))}.ck-toast-region .ck-toast{pointer-events:auto;position:relative;bottom:auto;left:auto;translate:none}.ck-layer:has(.ck-card,.ck-panel)~.ck-toast-region{flex-direction:column-reverse;top:12px;bottom:auto}.ck-toast-icon{width:20px;height:20px;color:var(--ck-text-muted);border-radius:50%;flex:none;place-items:center;display:grid}.ck-toast[data-tone=success] .ck-toast-icon{color:var(--ck-success)}.ck-toast[data-tone=error] .ck-toast-icon{color:var(--ck-danger)}.ck-toast button{border-radius:var(--ck-radius-sm);min-height:24px;color:var(--ck-accent-text);background:0 0;border:0;flex:none;padding:4px 8px;font-weight:600}.ck-toast .ck-toast-close{width:24px;color:var(--ck-text-muted);place-items:center;padding:0;display:grid}.ck-welcome{z-index:var(--ck-z);background:var(--ck-bg);border-radius:var(--ck-radius);width:min(340px,100vw - 24px);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) var(--ck-ease);padding:16px;position:fixed}.ck-welcome[data-pos^=top]{top:calc(76px + var(--ck-iy))}.ck-welcome[data-pos^=bottom]{bottom:calc(76px + var(--ck-iy) + env(safe-area-inset-bottom,0px))}.ck-welcome h2{font-size:var(--ck-fs-lg);overflow-wrap:anywhere;margin:0 0 4px;font-weight:600}.ck-welcome p{color:var(--ck-text-muted);margin:0 0 16px;line-height:1.5}.ck-welcome .ck-actions{justify-content:flex-end;margin:0}.ck-card:has(.ck-markup,.ck-viewer){z-index:calc(var(--ck-z) + 3)}.ck-panel:has(.ck-viewer){z-index:calc(var(--ck-z) + 3)}.ck-root :focus{outline:none}.ck-root :focus-visible{outline:2px solid var(--ck-ring);outline-offset:2px}.ck-mode-hint :focus-visible{outline-color:currentColor}.ck-card-body,.ck-menu,.ck-markup{overscroll-behavior:contain}.ck-card,.ck-panel,.ck-menu,.ck-bar,.ck-toast,.ck-welcome,.ck-btn,.ck-launcher-note,.ck-peek,.ck-mode-hint{border:1px solid #0000}@media (prefers-reduced-motion:reduce){*,:before,:after{transition:none!important;animation:none!important}}.ck-note,.ck-empty,.ck-toast span,.ck-welcome p{text-wrap:pretty}.ck-empty strong,.ck-welcome h2{text-wrap:balance}@keyframes ck-grow{0%{opacity:0;scale:.94}}@keyframes ck-panel-out{to{opacity:0;scale:.94}}@keyframes ck-out{to{opacity:0;translate:0 6px;scale:.97}}@keyframes ck-sheet-out{to{translate:0 100%}}.ck-layer[data-closing] .ck-panel{animation:ck-panel-out var(--ck-fast) var(--ck-ease) forwards;pointer-events:none}.ck-layer[data-closing] .ck-card:not(.ck-card-embedded){animation:ck-out var(--ck-fast) var(--ck-ease) forwards;pointer-events:none}@media (max-width:520px){.ck-launcher[data-covered=true]{display:none}.ck-card{width:auto;max-height:70vh;max-height:min(70dvh, calc(100dvh - 24px - var(--ck-kb,0px)));animation-name:ck-sheet;left:12px!important;right:12px!important;bottom:calc(12px + var(--ck-kb,0px) + env(safe-area-inset-bottom,0px))!important;top:auto!important}.ck-panel{bottom:var(--ck-kb,0px);height:80vh;height:min(80dvh, calc(100dvh - 12px - var(--ck-kb,0px)));border-radius:var(--ck-radius) var(--ck-radius) 0 0;width:100%;padding-bottom:env(safe-area-inset-bottom,0px);animation-name:ck-sheet;top:auto;left:0!important;right:0!important}.ck-mode-hint{top:auto;bottom:calc(84px + env(safe-area-inset-bottom,0px))}.ck-root:has(>.ck-launcher[data-pos^=bottom]) .ck-mode-hint{bottom:calc(84px + var(--ck-iy) + env(safe-area-inset-bottom,0px))}.ck-mode-hint~.ck-toast-region{top:12px;bottom:auto}.ck-root:has(.ck-toast) .ck-launcher-note{display:none}.ck-layer[data-closing] .ck-panel,.ck-layer[data-closing] .ck-card:not(.ck-card-embedded){animation:ck-sheet-out var(--ck-fast) var(--ck-ease) forwards}}@media (pointer:coarse){.ck-bar-btn,.ck-btn,.ck-ghost,.ck-chip,.ck-menu button,.ck-toast button{min-width:44px;min-height:44px}.ck-search .ck-ghost{min-width:36px;min-height:36px}.ck-root .ck-input{font-size:var(--ck-fs-lg);min-height:44px}.ck-pin:after{content:\"\";position:absolute;top:-10px;bottom:-10px;left:-10px;right:-10px}.ck-grip{display:none}}@media (hover:hover){.ck-bar-btn:hover,.ck-ghost:hover,.ck-menu button:hover,.ck-toast button:hover{background:var(--ck-bg-hover)}.ck-bar-btn[aria-pressed=true]:hover,.ck-primary:hover,.ck-btn.ck-primary:hover{background:var(--ck-accent);filter:brightness(.96)}.ck-icon-btn:hover,.ck-ghost:hover,.ck-format .ck-ghost:hover,.ck-msg-actions .ck-ghost:hover,.ck-chip:hover{color:var(--ck-text)}.ck-mode-hint .ck-chip:hover{color:inherit;background:color-mix(in srgb, currentColor 16%, transparent)}.ck-pin:hover{scale:1.08}.ck-pin[data-movable]:hover{cursor:grab}.ck-btn:hover,.ck-chip:hover{background:var(--ck-bg-muted)}.ck-input:hover{border-color:var(--ck-text-muted)}.ck-grip:hover{opacity:1}}";
|
|
1820
|
+
// src/ui/mount.tsx
|
|
1821
|
+
function Kt(e, t = () => void 0, n = t) {
|
|
1822
|
+
let r = document.createElement("div");
|
|
1823
|
+
r.setAttribute("data-commentkit-host", ""), r.style.cssText = "display:block;position:absolute;top:0;left:0;width:0;height:0;z-index:2147483000;visibility:visible;".replace(/;/g, "!important;");
|
|
1824
|
+
let i = r.attachShadow({ mode: "open" });
|
|
1825
|
+
for (let t of ["x", "y"]) {
|
|
1826
|
+
let n = Number(e.options.inset?.[t]);
|
|
1827
|
+
Number.isFinite(n) && r.style.setProperty(`--ck-opt-i${t}`, G(Math.max(0, n)));
|
|
1828
|
+
}
|
|
1829
|
+
if ("adoptedStyleSheets" in Document.prototype && "replaceSync" in CSSStyleSheet.prototype) {
|
|
1830
|
+
let e = new CSSStyleSheet();
|
|
1831
|
+
e.replaceSync(Gt), i.adoptedStyleSheets = [e];
|
|
1832
|
+
} else {
|
|
1833
|
+
let e = document.createElement("style");
|
|
1834
|
+
e.textContent = Gt, i.appendChild(e);
|
|
1835
|
+
}
|
|
1836
|
+
let a = document.createElement("div");
|
|
1837
|
+
a.className = "ck-root", a.dir = h(), a.lang = _(), i.appendChild(a), He(i), Y(e.assets);
|
|
1838
|
+
let o = !1, s = () => o || r.isConnected || document.documentElement.appendChild(r), c = () => typeof requestIdleCallback == "function" ? requestIdleCallback(s, { timeout: 2e3 }) : setTimeout(s, 50);
|
|
1839
|
+
"commentkitLoader" in document.documentElement.dataset && document.readyState !== "complete" ? addEventListener("load", c) : s();
|
|
1840
|
+
let l = () => {
|
|
1841
|
+
let t = e.state.get();
|
|
1842
|
+
(t.request || t.opening) && s();
|
|
1843
|
+
let n = e.state.get().theme ?? e.options.theme ?? e.state.get().config?.appearance.theme ?? "auto", i = n === "dark" || n === "auto" && matchMedia("(prefers-color-scheme: dark)").matches;
|
|
1844
|
+
r.setAttribute("data-theme", i ? "dark" : "light");
|
|
1845
|
+
let a = e.state.get().config?.appearance.accent, o = !!a && /^#[0-9a-f]{6}$/i.test(a), c = qt(o ? a : "#c2341b");
|
|
1846
|
+
if (o) {
|
|
1847
|
+
let e = c;
|
|
1848
|
+
for (; Yt(e) > .1833 && Yt(e) < .2047;) e = Jt(e, [
|
|
1849
|
+
0,
|
|
1850
|
+
0,
|
|
1851
|
+
0
|
|
1852
|
+
], .98).map(Math.round);
|
|
1853
|
+
let t = e === c ? a : `rgb(${e})`, n = Yt(e) > .194 ? "#121316" : "#ffffff";
|
|
1854
|
+
r.style.setProperty("--ck-accent", t), r.style.setProperty("--ck-mark", t), r.style.setProperty("--ck-accent-ink", n), r.style.setProperty("--ck-mark-ink", n);
|
|
1855
|
+
}
|
|
1856
|
+
let l = Yt(Jt(c, qt(i ? "#212126" : "#ffffff"), .12)) + .05, u = qt(i ? "#ffffff" : "#121316"), d = c;
|
|
1857
|
+
for (let e = 1, t; e > 0 && (t = Yt(d = Jt(c, u, e)) + .05) / l < 4.5 && l / t < 4.5; e -= .05);
|
|
1858
|
+
r.style.setProperty("--ck-accent-text", `rgb(${d.map(Math.round)})`);
|
|
1859
|
+
};
|
|
1860
|
+
l();
|
|
1861
|
+
let u = matchMedia("(prefers-color-scheme: dark)");
|
|
1862
|
+
u.addEventListener?.("change", l);
|
|
1863
|
+
let d = e.state.subscribe(l), f = window.visualViewport, p = () => f && r.style.setProperty("--ck-kb", G(f.scale > 1.01 ? 0 : Math.max(0, Math.round(innerHeight - f.height - f.offsetTop))));
|
|
1864
|
+
return f?.addEventListener("resize", p), f?.addEventListener("scroll", p), C(/* @__PURE__ */ x(Zt, {
|
|
1865
|
+
onCrash: t,
|
|
1866
|
+
onError: (t) => e.reportCrash(t),
|
|
1867
|
+
children: /* @__PURE__ */ x(Ut, {
|
|
1868
|
+
client: e,
|
|
1869
|
+
onHide: n
|
|
1870
|
+
})
|
|
1871
|
+
}), a), Object.assign(() => {
|
|
1872
|
+
o = !0, removeEventListener("load", c), C(null, a), He(null), d(), u.removeEventListener?.("change", l), f?.removeEventListener("resize", p), f?.removeEventListener("scroll", p), r.remove();
|
|
1873
|
+
}, { attach: s });
|
|
1874
|
+
}
|
|
1875
|
+
var qt = (e) => e.slice(1).match(/../g).map((e) => parseInt(e, 16)), Jt = (e, t, n) => e.map((e, r) => e * n + t[r] * (1 - n)), Yt = (e) => {
|
|
1876
|
+
let [t, n, r] = e.map((e) => (e /= 255) <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
|
|
1877
|
+
return .2126 * t + .7152 * n + .0722 * r;
|
|
1878
|
+
}, Xt = !1, Zt = class extends S {
|
|
1879
|
+
constructor(...e) {
|
|
1880
|
+
super(...e), this.state = { crashed: !1 };
|
|
1881
|
+
}
|
|
1882
|
+
componentDidCatch(e) {
|
|
1883
|
+
if (!this.state.crashed) {
|
|
1884
|
+
this.setState({ crashed: !0 });
|
|
1885
|
+
try {
|
|
1886
|
+
this.props.onError?.(e);
|
|
1887
|
+
} catch {}
|
|
1888
|
+
Xt || (Xt = !0, console.warn("[CommentKit] The widget stopped after an error and was removed. Your page is not affected.", e)), setTimeout(() => {
|
|
1889
|
+
try {
|
|
1890
|
+
this.props.onCrash();
|
|
1891
|
+
} catch {}
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
render() {
|
|
1896
|
+
return this.state.crashed ? null : this.props.children;
|
|
1897
|
+
}
|
|
1898
|
+
}, Qt = /* @__PURE__ */ e({
|
|
1899
|
+
en: () => y,
|
|
1900
|
+
installDiagnostics: () => z,
|
|
1901
|
+
mountWidget: () => Kt,
|
|
1902
|
+
setLocale: () => b
|
|
1903
|
+
});
|
|
1904
|
+
export { K as A, ne as B, ve as C, X as D, fe as E, oe as F, ae as H, ye as I, F as L, Ce as M, W as N, q as O, _e as P, te as R, Z as S, J as T, H as U, ie as V, Ae as _, rt as a, Te as b, Ue as c, Fe as d, y as en, Ie as f, ke as g, Pe as h, it as i, z as installDiagnostics, Se as j, be as k, ze as l, Me as m, Kt as mountWidget, at as n, tt as o, Re as p, nt as r, qe as s, b as setLocale, Qt as t, Le as u, Ee as v, ue as w, De as x, Q as y, re as z };
|