@commentkit/comment-kit 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +109 -13
  3. package/SECURITY.md +2 -2
  4. package/dist/node/cli/doctor.js +84 -20
  5. package/dist/node/cli/init.js +349 -35
  6. package/dist/node/cli/main.js +35 -17
  7. package/dist/node/cli/mcp.js +187 -6
  8. package/dist/node/shared/dashboard-places.js +33 -0
  9. package/dist/npm/chunks/{AgentSend-DxRJIYiz.js → AgentSend-DOy3jhyF.js} +16 -16
  10. package/dist/npm/chunks/{Checklist-CnlfeSbc.js → Checklist-CW_SwMpS.js} +70 -70
  11. package/dist/npm/chunks/{Composer-B1bBVszY.js → Composer-Bveq5QrK.js} +276 -274
  12. package/dist/npm/chunks/{Guest-vvNPz8h-.js → Guest-7hcN765o.js} +58 -55
  13. package/dist/npm/chunks/{MarkupEditor-VCOXh9d2.js → MarkupEditor-6bJGpWGO.js} +46 -39
  14. package/dist/npm/chunks/Panel-ChPUB68C.js +1211 -0
  15. package/dist/npm/chunks/{Settings-BGoZS2iV.js → Settings-CB5eEKnf.js} +77 -77
  16. package/dist/npm/chunks/{Shortcuts-B2OMvczr.js → Shortcuts-eAyjJ89P.js} +4 -4
  17. package/dist/npm/chunks/{StyleEditor-CJ_d8Huf.js → StyleEditor-CZTdAA5c.js} +10 -10
  18. package/dist/npm/chunks/{StylePanel-yQzHHlY7.js → StylePanel-B4pHQUL9.js} +61 -61
  19. package/dist/npm/chunks/{TaskFields-fmy6_HtK.js → TaskFields-C8BX0Sgg.js} +55 -55
  20. package/dist/npm/chunks/ThreadCard-B1EsX3PR.js +1160 -0
  21. package/dist/npm/chunks/Viewer-DY6zb90M.js +114 -0
  22. package/dist/npm/chunks/{agent-C1OQzBAm.js → agent-MTQHr9ei.js} +1 -1
  23. package/dist/npm/chunks/{ar-CAJ3XT8e.js → ar-L5cQ-NPe.js} +2 -0
  24. package/dist/npm/chunks/{card-bits-CAnzrqx3.js → card-bits-CTdrkYn8.js} +16 -16
  25. package/dist/npm/chunks/{client-kNAo2TTG.js → client-7eVxvg5j.js} +7 -7
  26. package/dist/npm/chunks/{confetti-CkBdSu19.js → confetti-BIs5s14P.js} +1 -1
  27. package/dist/npm/chunks/{context-B8UAzve0.js → context-Cf6khm7A.js} +1 -1
  28. package/dist/npm/chunks/{de-Dl18G48t.js → de-D0C-v6tP.js} +2 -0
  29. package/dist/npm/chunks/{dialog-GO04oC3D.js → dialog-DvdIkCW0.js} +1 -1
  30. package/dist/npm/chunks/{dpop-U48QIQd7.js → dpop-0A76OPa9.js} +1 -1
  31. package/dist/npm/chunks/{es-Dxk79lS9.js → es-Bw4Dj9tN.js} +2 -0
  32. package/dist/npm/chunks/{extension-CKFpPWmi.js → extension-DFVOvciD.js} +1 -1
  33. package/dist/npm/chunks/{extension-E81hWyiT.js → extension-SmoH5AA4.js} +2 -2
  34. package/dist/npm/chunks/{files-DyD5BZgp.js → files-4lV9YQIX.js} +2 -2
  35. package/dist/npm/chunks/{fr-8BebGKYD.js → fr-TkuQaIAa.js} +2 -0
  36. package/dist/npm/chunks/{hi-BIN6Yy_p.js → hi-DXSH2U8d.js} +2 -0
  37. package/dist/npm/chunks/{i18n-DOBt8e9U.js → i18n-aVSu9TcJ.js} +56 -47
  38. package/dist/npm/chunks/{identify-CN-3xzqL.js → identify-BGYh2dVo.js} +4 -4
  39. package/dist/npm/chunks/{it-Cr6EwpPQ.js → it-CiWA_bch.js} +2 -0
  40. package/dist/npm/chunks/{ja-Iy3s5aur.js → ja-C-QmR3yz.js} +2 -0
  41. package/dist/npm/chunks/{late-words-B2bmZceJ.js → late-words-80_VWt8S.js} +3 -1
  42. package/dist/npm/chunks/{live-CelVeZfP.js → live-BExWHzQ7.js} +1 -1
  43. package/dist/npm/chunks/{nl-B84WHqqe.js → nl-CEmZRqjX.js} +2 -0
  44. package/dist/npm/chunks/{page-key-DepmJzC1.js → page-key-HSY3Lze5.js} +1 -1
  45. package/dist/npm/chunks/{pick-yTyqtxN0.js → pick-B3sR7jtS.js} +1 -1
  46. package/dist/npm/chunks/{pkce-ChKGSW_4.js → pkce-CfZhiNBi.js} +1 -1
  47. package/dist/npm/chunks/{pt-BR-DOkdlfoe.js → pt-BR-b-a8sxO8.js} +2 -0
  48. package/dist/npm/chunks/{report-CrIqQZDI.js → report-DaVuoRYS.js} +1 -1
  49. package/dist/npm/chunks/show-BoN8AC-F.js +97 -0
  50. package/dist/npm/chunks/{signin-Dd1rb2BP.js → signin-BOWr_WCo.js} +3 -3
  51. package/dist/npm/chunks/{source-pXVve2Cx.js → source-mk3rGBBQ.js} +1 -1
  52. package/dist/npm/chunks/{src-BTMy4Gyc.js → src-C8rZFyL_.js} +77 -70
  53. package/dist/npm/chunks/start-CV4j78_q.js +1894 -0
  54. package/dist/npm/chunks/{states-sfTbjZz8.js → states-b9Bv3Ci7.js} +1 -1
  55. package/dist/npm/chunks/{upload-MgPYqPyE.js → upload-B2mkgMeJ.js} +1 -1
  56. package/dist/npm/chunks/uploads-8AxyRq7g.js +1147 -0
  57. package/dist/npm/chunks/{wrap-Bl0gbnFa.js → wrap-DW6EFbVQ.js} +1 -1
  58. package/dist/npm/chunks/{zh-CN-Z5fQCb7G.js → zh-CN-JTscW8u8.js} +2 -0
  59. package/dist/npm/element.js +1 -1
  60. package/dist/npm/headless.js +2 -2
  61. package/dist/npm/index.js +2 -2
  62. package/dist/npm/react.js +1 -1
  63. package/dist/npm/svelte.js +1 -1
  64. package/dist/npm/types/core/types.d.ts +2 -2
  65. package/dist/npm/vue.js +1 -1
  66. package/package.json +3 -1
  67. package/dist/npm/chunks/Panel-F37vIL1K.js +0 -1206
  68. package/dist/npm/chunks/ThreadCard-D51slKST.js +0 -1113
  69. package/dist/npm/chunks/Viewer-BOBadqmC.js +0 -111
  70. package/dist/npm/chunks/show-BgVC8gWY.js +0 -97
  71. package/dist/npm/chunks/start-DtVlpt7p.js +0 -1878
  72. package/dist/npm/chunks/uploads-D49mywwz.js +0 -1146
@@ -7,6 +7,8 @@ var t = /* @__PURE__ */ e({ LATE: () => n }), n = {
7
7
  finishTitle: "Send your comment?",
8
8
  finishBody: "You opened the link from your code email. Press the button to publish the comment you wrote on this website.",
9
9
  finishSend: "Send my comment",
10
- finishExpired: "This link no longer works. Links in the code email work once, for 10 minutes. If your comment is still waiting, enter the code on the page where you wrote it."
10
+ finishExpired: "This link no longer works. Links in the code email work once, for 10 minutes. If your comment is still waiting, enter the code on the page where you wrote it.",
11
+ closeCardHint: "Press × to close, or double-click outside.",
12
+ closeCardHintTouch: "Tap × to close, or double-tap outside."
11
13
  };
12
14
  export { t as n, n as t };
@@ -1,4 +1,4 @@
1
- import { o as e } from "./client-kNAo2TTG.js";
1
+ import { o as e } from "./client-7eVxvg5j.js";
2
2
  import { a as t, i as n, n as r, r as i } from "./drafts-B0ctr1g9.js";
3
3
  // src/ui/live.ts
4
4
  var a = 1500, o = 1e4;
@@ -189,6 +189,8 @@ var e = {
189
189
  finishBody: "Je hebt de link uit de e-mail met je code geopend. Druk op de knop om de reactie te plaatsen die je op deze website hebt geschreven.",
190
190
  finishSend: "Mijn reactie versturen",
191
191
  finishExpired: "Deze link werkt niet meer. Links in de e-mail met de code werken één keer, 10 minuten lang. Wacht je reactie nog? Vul dan de code in op de pagina waar je hem hebt geschreven.",
192
+ closeCardHint: "Druk op × om te sluiten, of dubbelklik ernaast.",
193
+ closeCardHintTouch: "Tik op × om te sluiten, of tik twee keer ernaast.",
192
194
  verifyWrong: "Die code klopt niet. Controleer de e-mail of vraag een nieuwe code.",
193
195
  verifyDifferent: "Ander e-mailadres gebruiken",
194
196
  verifyExpired: "Deze code werkt niet meer. Je reactie staat nog op dit apparaat.",
@@ -1,4 +1,4 @@
1
- import { u as e } from "./client-kNAo2TTG.js";
1
+ import { u as e } from "./client-7eVxvg5j.js";
2
2
  // src/core/page-key.ts
3
3
  var t = [
4
4
  "gclid",
@@ -105,7 +105,7 @@ function _() {
105
105
  }
106
106
  var v = null, y = !1;
107
107
  function b() {
108
- r(), !y && _() && (y = !0, import("./source-pXVve2Cx.js").then((e) => v = e.readSource, () => y = !1));
108
+ r(), !y && _() && (y = !0, import("./source-mk3rGBBQ.js").then((e) => v = e.readSource, () => y = !1));
109
109
  }
110
110
  function x(e) {
111
111
  let t = null;
@@ -1,4 +1,4 @@
1
- import { v as e, y as t } from "./client-kNAo2TTG.js";
1
+ import { v as e, y as t } from "./client-7eVxvg5j.js";
2
2
  // src/core/pkce.ts
3
3
  async function n(n) {
4
4
  if (!crypto.subtle) throw new e(0, "insecure_context", "Sign-in needs this page to be on https.");
@@ -189,6 +189,8 @@ var e = {
189
189
  finishBody: "Você abriu o link do e-mail com o seu código. Toque no botão para publicar o comentário que você escreveu neste site.",
190
190
  finishSend: "Enviar meu comentário",
191
191
  finishExpired: "Este link não funciona mais. Os links do e-mail com o código funcionam uma vez, por 10 minutos. Se o seu comentário ainda estiver esperando, digite o código na página onde você o escreveu.",
192
+ closeCardHint: "Pressione × para fechar, ou clique duas vezes fora.",
193
+ closeCardHintTouch: "Toque em × para fechar, ou toque duas vezes fora.",
192
194
  verifyWrong: "Esse código não está certo. Confira o e-mail ou peça um novo código.",
193
195
  verifyDifferent: "Usar outro e-mail",
194
196
  verifyExpired: "Este código não é mais válido. Seu comentário continua salvo neste dispositivo.",
@@ -1,4 +1,4 @@
1
- import { d as e, i as t, n } from "./client-kNAo2TTG.js";
1
+ import { d as e, i as t, n } from "./client-7eVxvg5j.js";
2
2
  // src/core/report.ts
3
3
  var r = 0;
4
4
  function i(r, i) {
@@ -0,0 +1,97 @@
1
+ import { a as e, i as t, n, o as r, r as i } from "./src-C8rZFyL_.js";
2
+ import { i as a, l as o, v as s } from "./client-7eVxvg5j.js";
3
+ import { n as c } from "./page-key-HSY3Lze5.js";
4
+ // src/core/show.ts
5
+ var l;
6
+ function u() {
7
+ if (/[?&]ck(_thread)?(=|&|$)/.test(location.search)) return !0;
8
+ try {
9
+ return !!sessionStorage.getItem("commentkit:share");
10
+ } catch {
11
+ return !1;
12
+ }
13
+ }
14
+ o(c);
15
+ var d = (e) => e.disabled_reason === "version_blocked", f = (e) => e.disabled_reason === "not_live", p = (e) => {
16
+ let t = e.state.get().session;
17
+ return !!t && t.role !== "guest";
18
+ };
19
+ async function m(i, a, o, s, m, v, y = () => void 0) {
20
+ let b = (l ?? (l = u())) || o;
21
+ if (d(a)) return y(), null;
22
+ let x = f(a);
23
+ if (x && !i.auth.hasSession() && !e()) return y(), null;
24
+ if (!a.enabled && !b && !x) return null;
25
+ c.ignore(a.pages?.ignored_query_params);
26
+ let S = n(() => import("./start-CV4j78_q.js").then((e) => e.t)), C = S.then((e) => e.setLocale(i.options.locale));
27
+ if (S.catch(() => void 0), C.catch(() => void 0), await i.auth.completeRedirect().catch(() => !1), e() && await import("./extension-SmoH5AA4.js").then((e) => e.extensionHandoff(i.auth)).catch(() => !1), v && a.enabled && await import("./identify-BGYh2dVo.js").then((e) => e.identify(i, v, null, !0)).catch(() => !1), await i.loadSession().catch(() => null), i.state.get().session || h(i.options.project), x && !p(i)) return y(), null;
28
+ let w = await S, { installDiagnostics: T, mountWidget: E } = w;
29
+ if (x && Object.assign(w.en, (await import("./late-words-80_VWt8S.js").then((e) => e.n)).LATE), await C, s()) return null;
30
+ let D = T({
31
+ console: a.features.console_capture,
32
+ network: a.features.network_capture,
33
+ endpoint: i.endpoint
34
+ }), O = () => {
35
+ m(), r(!1);
36
+ }, k;
37
+ try {
38
+ k = E(i, () => (g([t() + 1, Date.now()]), O()), O);
39
+ } catch (e) {
40
+ throw D(), e;
41
+ }
42
+ let A = setTimeout(g, 3e4, null), j = _(i, b, m, y), M = i.state.get().config, N = i.state.subscribe((e) => {
43
+ e.config && e.config !== M && c.ignore((M = e.config).pages?.ignored_query_params);
44
+ });
45
+ return i.emit("ready", { session: i.state.get().session }), Object.assign(() => {
46
+ clearTimeout(A), j(), N();
47
+ for (let e of [k, D]) try {
48
+ e();
49
+ } catch (e) {
50
+ console.warn("[CommentKit] hide() failed.", e);
51
+ }
52
+ }, { attach: () => k.attach?.() });
53
+ }
54
+ function h(e) {
55
+ let t = `commentkit:draft:v2:${e}:`;
56
+ try {
57
+ for (let e = localStorage.length - 1; e >= 0; e--) {
58
+ let n = localStorage.key(e);
59
+ n?.startsWith(t) && n.includes("~", t.length) && localStorage.removeItem(n);
60
+ }
61
+ } catch {}
62
+ }
63
+ function g(e) {
64
+ try {
65
+ e ? localStorage.setItem(i, JSON.stringify(e)) : localStorage.removeItem(i);
66
+ } catch {}
67
+ }
68
+ function _(e, t, n, r) {
69
+ let i = Date.now(), a = () => {
70
+ document.visibilityState === "hidden" || Date.now() - i < 15e3 || (i = Date.now(), e.loadConfig().then((i) => {
71
+ d(i) || f(i) && !p(e) ? (n(), r()) : i.enabled || t || f(i) || n();
72
+ }, () => void 0));
73
+ }, o = setInterval(a, 6e4);
74
+ return document.addEventListener("visibilitychange", a), () => {
75
+ clearInterval(o), document.removeEventListener("visibilitychange", a);
76
+ };
77
+ }
78
+ function v(e, t) {
79
+ let n = e.state.get().config;
80
+ if (n && (d(n) || f(n))) return;
81
+ let r = t instanceof s;
82
+ console.warn(r ? `[CommentKit] The widget could not start: ${t.message} (${t.code}). See https://commentkit.dev/docs/errors#${t.code}` : "[CommentKit] The widget could not start; your page is not affected. See https://commentkit.dev/docs/troubleshooting", t), r && e.emit("error", { error: t }), (!r || t.status >= 500) && e.reportCrash(t, "start");
83
+ }
84
+ function y(e, t) {
85
+ import("./report-DaVuoRYS.js").then((n) => n.reportStart(e, t)).catch(() => void 0);
86
+ }
87
+ var b = "See https://commentkit.dev/docs/";
88
+ function x(e, ...t) {
89
+ let [n, r] = t, i = {
90
+ key: `init() needs your publishable project key, which starts with pk_live_ or pk_test_ (${n ? "the one given is not one" : "none was given"}), so the widget stays off. Copy it from the website's Settings → Install in CommentKit and pass it as init({ project: "pk_live_…" }) or data-project="pk_live_…". ${b}quickstart`,
91
+ copy: `CommentKit was added twice: version ${String(n)} is already running on this page, so this copy (${a}) stays off. Add it once, with either the npm package or the script tag, not both. ${b}troubleshooting`,
92
+ project: `init() was called again with another project (${String(n)}) while ${String(r)} is running; the first one stays. Call destroy() on every handle of the first one before starting another project. ${b}troubleshooting`,
93
+ cooling: `The widget is hidden for a few hours on this browser after 3 crashes in a row. Cmd/Ctrl+Shift+K or show() brings it back now. ${b}troubleshooting`
94
+ };
95
+ console.warn(`[CommentKit] ${i[e]}`);
96
+ }
97
+ export { x as explain, v as failed, h as forgetSignedIn, m as mount, y as reportStart };
@@ -1,6 +1,6 @@
1
- import { b as e } from "./client-kNAo2TTG.js";
2
- import { r as t } from "./page-key-DepmJzC1.js";
3
- import { t as n } from "./pkce-ChKGSW_4.js";
1
+ import { b as e } from "./client-7eVxvg5j.js";
2
+ import { r as t } from "./page-key-HSY3Lze5.js";
3
+ import { t as n } from "./pkce-CfZhiNBi.js";
4
4
  import { t as r } from "./locale-D8Q4Q2Nt.js";
5
5
  // src/core/signin.ts
6
6
  function i(e = navigator.userAgent) {
@@ -1,4 +1,4 @@
1
- import { f as e } from "./client-kNAo2TTG.js";
1
+ import { f as e } from "./client-7eVxvg5j.js";
2
2
  // src/anchor/source.ts
3
3
  var t = /^[A-Za-z_$][\w$.-]*$/, n = /* @__PURE__ */ new Set([
4
4
  "src",
@@ -1,4 +1,4 @@
1
- import { a as e, d as t, i as n, p as r, s as i, t as a } from "./client-kNAo2TTG.js";
1
+ import { a as e, d as t, i as n, p as r, s as i, t as a } from "./client-7eVxvg5j.js";
2
2
  // src/activation.ts
3
3
  var o = "commentkit:active", s = "data-commentkit-extension";
4
4
  function c() {
@@ -44,15 +44,22 @@ function h() {
44
44
  return 0;
45
45
  }
46
46
  }
47
+ // src/core/retry-import.ts
48
+ function g(e, t = 2) {
49
+ return e().catch((n) => {
50
+ if (!t) throw n;
51
+ return new Promise((e) => setTimeout(e, 1500 / t)).then(() => g(e, t - 1));
52
+ });
53
+ }
47
54
  // src/index.ts
48
- var g = null, _ = null, v = null, y = {}, b = Symbol.for("commentkit.instance");
49
- function x(e, t, ...n) {
50
- y[e] || (y[e] = 1, console.warn(`[CommentKit] ${t}`, ...n));
55
+ var _ = null, v = null, y = null, b = {}, x = Symbol.for("commentkit.instance");
56
+ function S(e, t, ...n) {
57
+ b[e] || (b[e] = 1, console.warn(`[CommentKit] ${t}`, ...n));
51
58
  }
52
- function S(e, ...t) {
53
- y[e] || (y[e] = 1, import("./show-BgVC8gWY.js").then((n) => n.explain(e, ...t)).catch(T));
59
+ function C(e, ...t) {
60
+ b[e] || (b[e] = 1, import("./show-BoN8AC-F.js").then((n) => n.explain(e, ...t)).catch(E));
54
61
  }
55
- function C() {
62
+ function w() {
56
63
  let e = (e) => typeof e == "string" && e.trim() ? e.trim().slice(0, 255) : null;
57
64
  try {
58
65
  let t = typeof __COMMENTKIT_BUILD__ < "u" ? __COMMENTKIT_BUILD__ : globalThis.__COMMENTKIT_BUILD__;
@@ -69,27 +76,27 @@ function C() {
69
76
  };
70
77
  }
71
78
  }
72
- function w(e) {
79
+ function T(e) {
73
80
  let t = f("signin"), n = f("code", 1);
74
- if (typeof window > "u") return j(e);
81
+ if (typeof window > "u") return M(e);
75
82
  try {
76
83
  let r = t ?? e?._signin;
77
- if (r != null && (_ = r), v = n ?? e?._finish ?? v, g) return e?.project !== g.project && S("project", e?.project, g.project), g.client.auth.takeSignInLink(_), _ = null, O(g);
78
- let i = k(e);
79
- return typeof i == "string" ? j(e, i) : (g = i, O(i));
84
+ if (r != null && (v = r), y = n ?? e?._finish ?? y, _) return e?.project !== _.project && C("project", e?.project, _.project), _.client.auth.takeSignInLink(v), v = null, k(_);
85
+ let i = A(e);
86
+ return typeof i == "string" ? M(e, i) : (_ = i, k(i));
80
87
  } catch (t) {
81
- return console.warn("[CommentKit] The widget could not start because of an error inside CommentKit; your page is not affected. See https://commentkit.dev/docs/troubleshooting", t), import("./show-BgVC8gWY.js").then((n) => n.reportStart(e, t)).catch(T), j(e);
88
+ return console.warn("[CommentKit] The widget could not start because of an error inside CommentKit; your page is not affected. See https://commentkit.dev/docs/troubleshooting", t), import("./show-BoN8AC-F.js").then((n) => n.reportStart(e, t)).catch(E), M(e);
82
89
  }
83
90
  }
84
- var T = () => void 0, E = (e) => (t) => x(e, `${e}() failed.`, t), D = (e, t) => (...n) => t(...n).then(T, E(e));
85
- function O(e) {
91
+ var E = () => void 0, D = (e) => (t) => S(e, `${e}() failed.`, t), O = (e, t) => (...n) => t(...n).then(E, D(e));
92
+ function k(e) {
86
93
  e.refs++;
87
94
  let t = !0, n = /* @__PURE__ */ new Set();
88
95
  return {
89
96
  ...e.api,
90
97
  client: e.client,
91
98
  on: ((r, i) => {
92
- if (!t) return T;
99
+ if (!t) return E;
93
100
  let a = e.client.on(r, i);
94
101
  return n.add(a), a;
95
102
  }),
@@ -99,98 +106,98 @@ function O(e) {
99
106
  _m: e.started
100
107
  };
101
108
  }
102
- function k(e) {
103
- if (!e?.project || !t.test(e.project)) return S("key", !!e?.project), "bad project key";
109
+ function A(e) {
110
+ if (!e?.project || !t.test(e.project)) return C("key", !!e?.project), "bad project key";
104
111
  let o = document;
105
- if (o[b]) return S("copy", o[b]), "second copy";
106
- let s = C(), { _key: l, _signin: f, _finish: m, identity: y, ...x } = e, w = {
107
- ...x,
112
+ if (o[x]) return C("copy", o[x]), "second copy";
113
+ let s = w(), { _key: l, _signin: f, _finish: m, identity: b, ...S } = e, T = {
114
+ ...S,
108
115
  ...r(e.branch || s.branch, e.commit || s.commit)
109
- }, O = new a(w), k = null, A = null, j = !1, M = !1, N = !!l, P = O.auth.takeSignInLink(_) || !!(O.auth.finishLink = v);
110
- _ = v = null;
111
- let F = 0, I, L = (e) => (e === !0 && (M = !0), M && k?.attach?.(), j || k ? Promise.resolve() : (A ?? (A = (async (e) => {
112
- let t = () => e !== F, n = import("./show-BgVC8gWY.js");
113
- n.catch(T);
116
+ }, k = new a(T), A = null, j = null, M = !1, N = !1, P = !!l, F = k.auth.takeSignInLink(v) || !!(k.auth.finishLink = y);
117
+ v = y = null;
118
+ let I = 0, L, R = (e) => (e === !0 && (N = !0), N && A?.attach?.(), M || A ? Promise.resolve() : (j ?? (j = (async (e) => {
119
+ let t = () => e !== I, n = g(() => import("./show-BoN8AC-F.js"));
120
+ n.catch(E);
114
121
  try {
115
- let e = await O.loadConfig();
122
+ let e = await k.loadConfig();
116
123
  if (t()) return;
117
- k = await (await n).mount(O, e, P, t, R, y, () => I = setTimeout(L, 6e4)), M && k?.attach?.(), k && N && d(!0);
124
+ A = await (await n).mount(k, e, F, t, z, b, () => L = setTimeout(R, 6e4)), N && A?.attach?.(), A && P && d(!0);
118
125
  } catch (e) {
119
- await n.then((t) => t.failed(O, e), E("show"));
126
+ await n.then((t) => t.failed(k, e), D("show"));
120
127
  } finally {
121
- t() || (A = null);
128
+ t() || (j = null);
122
129
  }
123
- })(F)), A)), R = () => {
124
- clearTimeout(I), F++, M = !1, A = null, k?.(), k = null;
125
- }, z = w.toggleShortcut === !1 ? T : p(() => {
130
+ })(I)), j)), z = () => {
131
+ clearTimeout(L), I++, N = !1, j = null, A?.(), A = null;
132
+ }, B = T.toggleShortcut === !1 ? E : p(() => {
126
133
  try {
127
- if (k) return O.state.set({ request: {
134
+ if (A) return k.state.set({ request: {
128
135
  kind: "inbox",
129
136
  at: Date.now()
130
137
  } }), !0;
131
- N = !0, L(!0);
138
+ P = !0, R(!0);
132
139
  } catch (e) {
133
- E("shortcut")(e);
140
+ D("shortcut")(e);
134
141
  }
135
142
  });
136
- c() && import("./extension-E81hWyiT.js").then((e) => e.extensionHello()).catch(() => void 0);
137
- let B = P || N || u(w.project, w.hideOnProduction ?? !0) || !!y;
138
- B && !P && !N && h() >= 3 && (B = !1, S("cooling")), B && !O.auth.hasSession() && O.prefetchSignIn();
139
- let V = B ? L().then(() => !!k) : Promise.resolve(!1), H = {
140
- show: () => L(!0),
141
- hide: R,
142
- open: D("open", async (e) => {
143
- O.state.set({ opening: String(e).slice(0, 64) }), await L(!0);
143
+ c() && import("./extension-SmoH5AA4.js").then((e) => e.extensionHello()).catch(() => void 0);
144
+ let V = F || P || u(T.project, T.hideOnProduction ?? !0) || !!b;
145
+ V && !F && !P && h() >= 3 && (V = !1, C("cooling")), V && !k.auth.hasSession() && k.prefetchSignIn();
146
+ let H = V ? R().then(() => !!A) : Promise.resolve(!1), U = {
147
+ show: () => R(!0),
148
+ hide: z,
149
+ open: O("open", async (e) => {
150
+ k.state.set({ opening: String(e).slice(0, 64) }), await R(!0);
144
151
  }),
145
- comment: D("comment", async (e = !0) => {
146
- e && (N = !0), await L(e), e && k && d(!0), O.state.set({ request: {
152
+ comment: O("comment", async (e = !0) => {
153
+ e && (P = !0), await R(e), e && A && d(!0), k.state.set({ request: {
147
154
  kind: e ? "comment" : "stop",
148
155
  at: Date.now()
149
156
  } });
150
157
  }),
151
- signIn: async () => await O.signIn() === "signed_in",
152
- identify: (e) => import("./identify-CN-3xzqL.js").then((t) => t.identify(O, e, L)).catch(() => !1),
153
- signOut: D("signOut", () => O.signOut()),
154
- session: () => i(O.state.get().session)
158
+ signIn: async () => await k.signIn() === "signed_in",
159
+ identify: (e) => import("./identify-BGYh2dVo.js").then((t) => t.identify(k, e, R)).catch(() => !1),
160
+ signOut: O("signOut", () => k.signOut()),
161
+ session: () => i(k.state.get().session)
155
162
  };
156
- Object.defineProperty(o, b, {
163
+ Object.defineProperty(o, x, {
157
164
  value: n,
158
165
  configurable: !0
159
166
  });
160
- let U = {
161
- project: w.project,
162
- client: O,
167
+ let W = {
168
+ project: T.project,
169
+ client: k,
163
170
  refs: 0,
164
- started: V,
165
- api: H,
171
+ started: H,
172
+ api: U,
166
173
  destroy() {
167
- j = !0, R(), z(), _ = O.auth.signInLink, v = O.auth.finishLink, delete o[b], g === U && (g = null);
174
+ M = !0, z(), B(), v = k.auth.signInLink, y = k.auth.finishLink, delete o[x], _ === W && (_ = null);
168
175
  try {
169
- O.destroy();
176
+ k.destroy();
170
177
  } catch (e) {
171
- E("destroy")(e);
178
+ D("destroy")(e);
172
179
  }
173
180
  }
174
181
  };
175
- return U;
182
+ return W;
176
183
  }
177
- var A = () => new Proxy(() => Promise.resolve(), { get: (e, t) => t === "then" ? void 0 : t === Symbol.toPrimitive ? () => "" : A() });
178
- function j(t, n) {
179
- let r = async () => void 0, i = async () => !1, a = () => T, o = e(), s = t ?? {}, c = {
184
+ var j = () => new Proxy(() => Promise.resolve(), { get: (e, t) => t === "then" ? void 0 : t === Symbol.toPrimitive ? () => "" : j() });
185
+ function M(t, n) {
186
+ let r = async () => void 0, i = async () => !1, a = () => E, o = e(), s = t ?? {}, c = {
180
187
  options: s,
181
188
  state: {
182
189
  get: () => o,
183
190
  subscribe: a,
184
- set: T
191
+ set: E
185
192
  },
186
193
  on: a,
187
- emit: T,
194
+ emit: E,
188
195
  endpoint: String(s.endpoint ?? "https://commentkit.dev").replace(/\/+$/, "")
189
196
  };
190
197
  return {
191
- client: new Proxy(c, { get: (e, t) => t in e ? e[t] : t === "then" ? void 0 : A() }),
198
+ client: new Proxy(c, { get: (e, t) => t in e ? e[t] : t === "then" ? void 0 : j() }),
192
199
  show: r,
193
- hide: T,
200
+ hide: E,
194
201
  open: r,
195
202
  comment: r,
196
203
  signIn: i,
@@ -198,11 +205,11 @@ function j(t, n) {
198
205
  signOut: r,
199
206
  session: () => null,
200
207
  on: a,
201
- destroy: T,
208
+ destroy: E,
202
209
  ...n ? { _r() {
203
210
  let e = n && /* @__PURE__ */ Error(`init() stayed off: ${n}`);
204
- n = void 0, e && import("./show-BgVC8gWY.js").then((n) => n.reportStart(t, e)).catch(T);
211
+ n = void 0, e && import("./show-BoN8AC-F.js").then((n) => n.reportStart(t, e)).catch(E);
205
212
  } } : {}
206
213
  };
207
214
  }
208
- export { d as a, c as i, m as n, h as r, w as t };
215
+ export { c as a, h as i, g as n, d as o, m as r, T as t };