@commentkit/comment-kit 1.5.1 → 2.0.0

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