@commentkit/comment-kit 0.0.0-stage → 0.6.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 (207) hide show
  1. package/CHANGELOG.md +276 -0
  2. package/LICENSE +18 -0
  3. package/README.md +766 -2
  4. package/dist/angular/ShadowRootContext-2BrAO1qU.js +7 -0
  5. package/dist/angular/chunk-Cyg4N8Ue.js +11 -0
  6. package/dist/angular/comment-kit-ui-wEJfMh4T.js +9483 -0
  7. package/dist/angular/dom-ON-u4y6t.js +97 -0
  8. package/dist/angular/error-boundary-CxhCm8iF.js +21 -0
  9. package/dist/angular/limits-AEqOBweE.js +71 -0
  10. package/dist/angular/mount-ui-CxChSb8B.js +55 -0
  11. package/dist/angular/pusher-Vs-W-c8I.js +2504 -0
  12. package/dist/angular/realtime-CfJZMEAi.js +558 -0
  13. package/dist/angular/shadow-root-C7wgghDv.js +86 -0
  14. package/dist/angular/styles-CvndAWRF.js +2 -0
  15. package/dist/angular.es.js +3656 -0
  16. package/dist/comment-kit.es.js +3361 -0
  17. package/dist/core/ShadowRootContext--ArKkwbH.js +7 -0
  18. package/dist/core/chunk-t7YoJN_i.js +11 -0
  19. package/dist/core/comment-kit-ui-DjWARy4X.js +9483 -0
  20. package/dist/core/dom-x9svfpMk.js +223 -0
  21. package/dist/core/error-boundary-CN_BGsYl.js +21 -0
  22. package/dist/core/mount-ui-DrFjMJJu.js +55 -0
  23. package/dist/core/pusher-CizoY5NA.js +2504 -0
  24. package/dist/core/realtime-DYf6E_sN.js +278 -0
  25. package/dist/core/shadow-root-09zwHxly.js +86 -0
  26. package/dist/core/styles-D19zARBi.js +2 -0
  27. package/dist/core/websocket-manager-DorGPjR4.js +351 -0
  28. package/dist/preact/ShadowRootContext-CJWLIRy4.js +7 -0
  29. package/dist/preact/chunk-CZ0PdaaN.js +11 -0
  30. package/dist/preact/comment-kit-ui-BKi15Z4Q.js +9483 -0
  31. package/dist/preact/dom-BAV8grk_.js +97 -0
  32. package/dist/preact/error-boundary-B4-Bfy3g.js +21 -0
  33. package/dist/preact/limits-C3ZEKcL_.js +71 -0
  34. package/dist/preact/mount-ui-b9JcJQYE.js +55 -0
  35. package/dist/preact/pusher-BP4kCufH.js +2504 -0
  36. package/dist/preact/realtime-BFgP4BlB.js +558 -0
  37. package/dist/preact/shadow-root-DAhpHo_W.js +86 -0
  38. package/dist/preact/styles-Dwd4AJR8.js +2 -0
  39. package/dist/preact.es.js +3465 -0
  40. package/dist/qwik/ShadowRootContext-CTbULRKq.js +7 -0
  41. package/dist/qwik/chunk-CKKKzG2Q.js +11 -0
  42. package/dist/qwik/comment-kit-ui-CRmJhZlX.js +9483 -0
  43. package/dist/qwik/dom-BjJ-QroQ.js +97 -0
  44. package/dist/qwik/error-boundary-C4hlYQwS.js +21 -0
  45. package/dist/qwik/limits-DK35yjGY.js +71 -0
  46. package/dist/qwik/mount-ui-CaRrLb9u.js +55 -0
  47. package/dist/qwik/pusher-B1KgC4iB.js +2504 -0
  48. package/dist/qwik/realtime-DUhkZAVc.js +558 -0
  49. package/dist/qwik/shadow-root-tLjXys-_.js +86 -0
  50. package/dist/qwik/styles-BB1B91hh.js +2 -0
  51. package/dist/qwik.es.js +3458 -0
  52. package/dist/react/chunk--MHYZ-zp.js +12 -0
  53. package/dist/react/limits-Dflmuf1P.js +168 -0
  54. package/dist/react/pusher-3dki8s2l.js +2505 -0
  55. package/dist/react/realtime-C7h-Agwo.js +558 -0
  56. package/dist/react.es.js +13010 -0
  57. package/dist/solid/ShadowRootContext-BS6MCclL.js +7 -0
  58. package/dist/solid/chunk-B2NCWFvW.js +11 -0
  59. package/dist/solid/comment-kit-ui-Dw_67h_e.js +9483 -0
  60. package/dist/solid/dom-Bpw1A0oz.js +97 -0
  61. package/dist/solid/error-boundary-9mimpbZA.js +21 -0
  62. package/dist/solid/limits-B_69IbLl.js +71 -0
  63. package/dist/solid/mount-ui-bPWYgjmm.js +55 -0
  64. package/dist/solid/pusher-_RVNpj1f.js +2504 -0
  65. package/dist/solid/realtime-DK86zDCJ.js +558 -0
  66. package/dist/solid/shadow-root-D5nErAFI.js +86 -0
  67. package/dist/solid/styles-CtYBghRP.js +2 -0
  68. package/dist/solid.es.js +3446 -0
  69. package/dist/svelte/ShadowRootContext-DhByMr-q.js +7 -0
  70. package/dist/svelte/chunk-Pi70BKld.js +11 -0
  71. package/dist/svelte/comment-kit-ui-DhCWlEd8.js +9483 -0
  72. package/dist/svelte/dom-mfioQqLy.js +97 -0
  73. package/dist/svelte/error-boundary-C3GWI_IX.js +21 -0
  74. package/dist/svelte/limits-CURF22v3.js +71 -0
  75. package/dist/svelte/mount-ui-DtXWMEYn.js +55 -0
  76. package/dist/svelte/pusher-DN1BiUDw.js +2504 -0
  77. package/dist/svelte/realtime-zYOctwRk.js +558 -0
  78. package/dist/svelte/shadow-root-Cz-v-rYe.js +86 -0
  79. package/dist/svelte/styles-DKCGeARl.js +2 -0
  80. package/dist/svelte.es.js +3478 -0
  81. package/dist/types/adapters/bridge.d.ts +125 -0
  82. package/dist/types/adapters/errors.d.ts +3 -0
  83. package/dist/types/angular/index.d.ts +135 -0
  84. package/dist/types/core/agent-context.d.ts +17 -0
  85. package/dist/types/core/api-client.d.ts +137 -0
  86. package/dist/types/core/auth.d.ts +18 -0
  87. package/dist/types/core/comment-kit-core.d.ts +215 -0
  88. package/dist/types/core/comments.d.ts +43 -0
  89. package/dist/types/core/dev-grab.d.ts +14 -0
  90. package/dist/types/core/keyboard.d.ts +12 -0
  91. package/dist/types/core/limits.d.ts +52 -0
  92. package/dist/types/core/offline-queue.d.ts +23 -0
  93. package/dist/types/core/realtime.d.ts +9 -0
  94. package/dist/types/core/screenshot.d.ts +12 -0
  95. package/dist/types/core/session.d.ts +9 -0
  96. package/dist/types/core/source-resolver.d.ts +19 -0
  97. package/dist/types/core/state.d.ts +24 -0
  98. package/dist/types/core/types.d.ts +610 -0
  99. package/dist/types/core/websocket-manager.d.ts +107 -0
  100. package/dist/types/index.d.ts +85 -0
  101. package/dist/types/preact/index.d.ts +25 -0
  102. package/dist/types/qwik/index.d.ts +70 -0
  103. package/dist/types/react/client.d.ts +31 -0
  104. package/dist/types/react/comment-kit-ui.d.ts +9 -0
  105. package/dist/types/react/components/comment-fab.d.ts +34 -0
  106. package/dist/types/react/components/dev-export-panel.d.ts +10 -0
  107. package/dist/types/react/components/element-selector.d.ts +11 -0
  108. package/dist/types/react/components/live-region.d.ts +16 -0
  109. package/dist/types/react/components/screenshot-capture.d.ts +17 -0
  110. package/dist/types/react/components/status-indicator.d.ts +43 -0
  111. package/dist/types/react/error-boundary.d.ts +25 -0
  112. package/dist/types/react/index.d.ts +4 -0
  113. package/dist/types/react/is-local-host.d.ts +2 -0
  114. package/dist/types/react/mount-ui.d.ts +19 -0
  115. package/dist/types/react/shadow-root.d.ts +23 -0
  116. package/dist/types/react/shims/use-sync-external-store-with-selector.d.ts +4 -0
  117. package/dist/types/react/shims/use-sync-external-store.d.ts +1 -0
  118. package/dist/types/react/ui/lib/ShadowRootContext.d.ts +10 -0
  119. package/dist/types/react/ui/lib/cn.d.ts +12 -0
  120. package/dist/types/react/ui/primitives/alert-dialog/alert-dialog.d.ts +23 -0
  121. package/dist/types/react/ui/primitives/alert-dialog/index.d.ts +1 -0
  122. package/dist/types/react/ui/primitives/avatar/avatar.d.ts +10 -0
  123. package/dist/types/react/ui/primitives/avatar/index.d.ts +1 -0
  124. package/dist/types/react/ui/primitives/badge/badge.d.ts +5 -0
  125. package/dist/types/react/ui/primitives/badge/index.d.ts +1 -0
  126. package/dist/types/react/ui/primitives/button/button.d.ts +6 -0
  127. package/dist/types/react/ui/primitives/button/index.d.ts +1 -0
  128. package/dist/types/react/ui/primitives/card/card.d.ts +11 -0
  129. package/dist/types/react/ui/primitives/card/index.d.ts +1 -0
  130. package/dist/types/react/ui/primitives/checkbox/checkbox.d.ts +3 -0
  131. package/dist/types/react/ui/primitives/checkbox/index.d.ts +1 -0
  132. package/dist/types/react/ui/primitives/dialog/dialog.d.ts +17 -0
  133. package/dist/types/react/ui/primitives/dialog/index.d.ts +1 -0
  134. package/dist/types/react/ui/primitives/dropdown-menu/dropdown-menu.d.ts +29 -0
  135. package/dist/types/react/ui/primitives/dropdown-menu/index.d.ts +1 -0
  136. package/dist/types/react/ui/primitives/empty/empty.d.ts +10 -0
  137. package/dist/types/react/ui/primitives/empty/index.d.ts +1 -0
  138. package/dist/types/react/ui/primitives/field/field.d.ts +22 -0
  139. package/dist/types/react/ui/primitives/field/index.d.ts +1 -0
  140. package/dist/types/react/ui/primitives/hover-card/hover-card.d.ts +6 -0
  141. package/dist/types/react/ui/primitives/hover-card/index.d.ts +1 -0
  142. package/dist/types/react/ui/primitives/input/index.d.ts +1 -0
  143. package/dist/types/react/ui/primitives/input/input.d.ts +3 -0
  144. package/dist/types/react/ui/primitives/input-group/index.d.ts +1 -0
  145. package/dist/types/react/ui/primitives/input-group/input-group.d.ts +16 -0
  146. package/dist/types/react/ui/primitives/kbd/index.d.ts +1 -0
  147. package/dist/types/react/ui/primitives/kbd/kbd.d.ts +4 -0
  148. package/dist/types/react/ui/primitives/label/index.d.ts +1 -0
  149. package/dist/types/react/ui/primitives/label/label.d.ts +3 -0
  150. package/dist/types/react/ui/primitives/native-select/index.d.ts +1 -0
  151. package/dist/types/react/ui/primitives/native-select/native-select.d.ts +7 -0
  152. package/dist/types/react/ui/primitives/popover/index.d.ts +1 -0
  153. package/dist/types/react/ui/primitives/popover/popover.d.ts +9 -0
  154. package/dist/types/react/ui/primitives/preview/component-preview.d.ts +8 -0
  155. package/dist/types/react/ui/primitives/progress/index.d.ts +1 -0
  156. package/dist/types/react/ui/primitives/progress/progress.d.ts +7 -0
  157. package/dist/types/react/ui/primitives/radio-group/index.d.ts +1 -0
  158. package/dist/types/react/ui/primitives/radio-group/radio-group.d.ts +6 -0
  159. package/dist/types/react/ui/primitives/scroll-area/index.d.ts +1 -0
  160. package/dist/types/react/ui/primitives/scroll-area/scroll-area.d.ts +6 -0
  161. package/dist/types/react/ui/primitives/select/index.d.ts +1 -0
  162. package/dist/types/react/ui/primitives/select/select.d.ts +15 -0
  163. package/dist/types/react/ui/primitives/separator/index.d.ts +1 -0
  164. package/dist/types/react/ui/primitives/separator/separator.d.ts +3 -0
  165. package/dist/types/react/ui/primitives/sheet/index.d.ts +1 -0
  166. package/dist/types/react/ui/primitives/sheet/sheet.d.ts +14 -0
  167. package/dist/types/react/ui/primitives/skeleton/index.d.ts +1 -0
  168. package/dist/types/react/ui/primitives/skeleton/skeleton.d.ts +3 -0
  169. package/dist/types/react/ui/primitives/slider/index.d.ts +1 -0
  170. package/dist/types/react/ui/primitives/slider/slider.d.ts +7 -0
  171. package/dist/types/react/ui/primitives/sonner/index.d.ts +1 -0
  172. package/dist/types/react/ui/primitives/sonner/sonner.d.ts +4 -0
  173. package/dist/types/react/ui/primitives/spinner/index.d.ts +1 -0
  174. package/dist/types/react/ui/primitives/spinner/spinner.d.ts +3 -0
  175. package/dist/types/react/ui/primitives/switch/index.d.ts +1 -0
  176. package/dist/types/react/ui/primitives/switch/switch.d.ts +5 -0
  177. package/dist/types/react/ui/primitives/tabs/index.d.ts +1 -0
  178. package/dist/types/react/ui/primitives/tabs/tabs.d.ts +8 -0
  179. package/dist/types/react/ui/primitives/textarea/index.d.ts +1 -0
  180. package/dist/types/react/ui/primitives/textarea/textarea.d.ts +3 -0
  181. package/dist/types/react/ui/primitives/toggle/index.d.ts +1 -0
  182. package/dist/types/react/ui/primitives/toggle/toggle.d.ts +7 -0
  183. package/dist/types/react/ui/primitives/toggle-group/index.d.ts +1 -0
  184. package/dist/types/react/ui/primitives/toggle-group/toggle-group.d.ts +14 -0
  185. package/dist/types/react/ui/primitives/tooltip/index.d.ts +1 -0
  186. package/dist/types/react/ui/primitives/tooltip/tooltip.d.ts +7 -0
  187. package/dist/types/solid/index.d.ts +37 -0
  188. package/dist/types/svelte/index.d.ts +55 -0
  189. package/dist/types/utils/dom.d.ts +59 -0
  190. package/dist/types/utils/event-emitter.d.ts +11 -0
  191. package/dist/types/utils/freeze-animations.d.ts +8 -0
  192. package/dist/types/utils/text.d.ts +9 -0
  193. package/dist/types/utils/validation.d.ts +10 -0
  194. package/dist/types/vue/index.d.ts +87 -0
  195. package/dist/vue/ShadowRootContext-BQTcHNil.js +7 -0
  196. package/dist/vue/chunk-DHrubWSL.js +11 -0
  197. package/dist/vue/comment-kit-ui-BX1wDZ2c.js +9483 -0
  198. package/dist/vue/dom-eo0P9Z6Z.js +97 -0
  199. package/dist/vue/error-boundary-DW6uGR8U.js +21 -0
  200. package/dist/vue/limits-B6csdQeI.js +71 -0
  201. package/dist/vue/mount-ui-DdTYzv6J.js +55 -0
  202. package/dist/vue/pusher-cmjNbW6a.js +2504 -0
  203. package/dist/vue/realtime-YJKvS2eB.js +558 -0
  204. package/dist/vue/shadow-root-SLTVf5yk.js +86 -0
  205. package/dist/vue/styles-BrHt1-ia.js +2 -0
  206. package/dist/vue.es.js +3495 -0
  207. package/package.json +205 -4
@@ -0,0 +1,97 @@
1
+ var e = typeof window < "u", t = 1920, n = 1080, r = 1;
2
+ function i(e) {
3
+ if (typeof CSS < "u" && typeof CSS.escape == "function") return CSS.escape(e);
4
+ let t = Array.from(e);
5
+ return t.map((n, r) => {
6
+ let i = n.codePointAt(0), a = r > 0 ? t[r - 1] : "";
7
+ return i === 0 || i < 32 || i === 127 || r === 0 && /[0-9]/.test(n) || r === 1 && a === "-" && /[0-9]/.test(n) || r === 0 && n === "-" && e.length === 1 || !/[a-zA-Z0-9_-]/.test(n) ? `\\${i.toString(16)} ` : n;
8
+ }).join("");
9
+ }
10
+ function a(e) {
11
+ return e.includes("\"") ? e.includes("'") ? `concat(${e.split("\"").map((e) => `"${e}"`).join(", '\"', ")})` : `'${e}'` : `"${e}"`;
12
+ }
13
+ function o(e) {
14
+ return Number.isFinite(e) ? e : 0;
15
+ }
16
+ function s(e, t) {
17
+ return typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t;
18
+ }
19
+ function c(r) {
20
+ /* v8 ignore start -- SSR fallbacks unreachable in jsdom */
21
+ let i = e ? s(window.innerWidth, t) : t, a = e ? s(window.innerHeight, n) : n;
22
+ /* v8 ignore stop */
23
+ return {
24
+ width: s(r?.width, i),
25
+ height: s(r?.height, a)
26
+ };
27
+ }
28
+ var l = 8;
29
+ function u(t) {
30
+ if (t.id) return `#${i(t.id)}`;
31
+ let n = e && typeof document < "u" && typeof document.querySelectorAll == "function", a = [], o = t;
32
+ for (; o && o.nodeType === r && a.length < l;) {
33
+ let e = o.nodeName.toLowerCase();
34
+ if (o.className && typeof o.className == "string") {
35
+ let t = o.className.split(/\s+/).filter(Boolean).find((e) => !e.startsWith("ck-"));
36
+ t && (e += `.${i(t)}`);
37
+ }
38
+ if (o.parentElement) {
39
+ let t = o.nodeName.toLowerCase(), n = Array.from(o.parentElement.children).filter((e) => e.nodeName.toLowerCase() === t);
40
+ n.length > 1 && (e += `:nth-of-type(${n.indexOf(o) + 1})`);
41
+ }
42
+ if (a.unshift(e), n) {
43
+ let e = a.join(" > ");
44
+ try {
45
+ if (document.querySelectorAll(e).length === 1) return e;
46
+ } catch {}
47
+ }
48
+ o = o.parentElement;
49
+ }
50
+ return a.join(" > ");
51
+ }
52
+ function d(e) {
53
+ if (e.id) return `//*[@id=${a(e.id)}]`;
54
+ let t = [], n = e;
55
+ for (; n && n.nodeType === r;) {
56
+ let e = 1, r = n.previousElementSibling;
57
+ for (; r;) r.nodeName === n.nodeName && e++, r = r.previousElementSibling;
58
+ t.unshift(`${n.nodeName.toLowerCase()}[${e}]`), n = n.parentElement;
59
+ }
60
+ return "/" + t.join("/");
61
+ }
62
+ function f(t, n) {
63
+ /* v8 ignore start -- SSR guard unreachable in jsdom */
64
+ if (!e) return null;
65
+ /* v8 ignore stop */
66
+ if (typeof t == "string") try {
67
+ let e = document.querySelector(t);
68
+ if (e) return e;
69
+ } catch {}
70
+ if (typeof n == "string" && n) try {
71
+ let e = document.evaluate(n, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
72
+ return e?.nodeType === r ? e : null;
73
+ } catch {}
74
+ return null;
75
+ }
76
+ function p(e, t, n) {
77
+ let { width: r, height: i } = c(n);
78
+ return {
79
+ x: o(e) / r * 100,
80
+ y: o(t) / i * 100
81
+ };
82
+ }
83
+ function m() {
84
+ /* v8 ignore stop */
85
+ return e ? {
86
+ url: window.location.href,
87
+ path: window.location.pathname + window.location.search,
88
+ title: document.title,
89
+ domain: window.location.hostname
90
+ } : {
91
+ url: "",
92
+ path: "",
93
+ title: "",
94
+ domain: ""
95
+ };
96
+ }
97
+ export { p as a, m as i, u as n, d as r, f as t };
@@ -0,0 +1,21 @@
1
+ import e from "react";
2
+ var t = class extends e.Component {
3
+ constructor(...e) {
4
+ super(...e), this.state = { hasError: !1 };
5
+ }
6
+ static getDerivedStateFromError() {
7
+ return { hasError: !0 };
8
+ }
9
+ componentDidUpdate(e) {
10
+ this.state.hasError && e.resetKey !== this.props.resetKey && this.setState({ hasError: !1 });
11
+ }
12
+ componentDidCatch(e, t) {
13
+ try {
14
+ console.error("[CommentKit] UI error caught by ErrorBoundary:", e, t.componentStack);
15
+ } catch {}
16
+ }
17
+ render() {
18
+ return this.state.hasError ? this.props.fallback ?? null : this.props.children;
19
+ }
20
+ };
21
+ export { t as ErrorBoundary };
@@ -0,0 +1,71 @@
1
+ function e(e) {
2
+ for (let t = 0; t < e.length; t++) {
3
+ let n = e.charCodeAt(t);
4
+ if (n < 32 || n === 127) return !0;
5
+ }
6
+ return !1;
7
+ }
8
+ function t(e) {
9
+ for (let t = 0; t < e.length; t++) {
10
+ let n = e.charCodeAt(t);
11
+ if (n < 32 && n !== 9 && n !== 10 && n !== 13 || n === 127) return !0;
12
+ }
13
+ return !1;
14
+ }
15
+ function n(e) {
16
+ return typeof e == "object" && !!e && !Array.isArray(e);
17
+ }
18
+ function r(e) {
19
+ return typeof e == "number" && Number.isFinite(e);
20
+ }
21
+ function i(e) {
22
+ return r(e) && e >= 0 && e <= 100;
23
+ }
24
+ function a(t, n) {
25
+ return typeof t == "string" && t.trim().length > 0 && t.length <= n && !e(t);
26
+ }
27
+ function o(t, n) {
28
+ return t === void 0 || typeof t == "string" && t.length <= n && !e(t);
29
+ }
30
+ function s(e, n) {
31
+ return typeof e == "string" && e.trim().length > 0 && e.length <= n && !t(e);
32
+ }
33
+ function c(e, t = 254) {
34
+ if (!a(e, t)) return !1;
35
+ let n = e.trim();
36
+ if (n !== e) return !1;
37
+ let r = n.indexOf("@");
38
+ return r > 0 && r === n.lastIndexOf("@") && r < n.length - 1 && !/\s/.test(n);
39
+ }
40
+ var l = new Set(/* @__PURE__ */ "exe.dll.bat.cmd.com.msi.scr.pif.cpl.sh.bash.zsh.ps1.py.rb.pl.php.jar.js.mjs.cjs.html.htm.xhtml.svg.swf.wasm".split("."));
41
+ function u(e) {
42
+ let t = e.lastIndexOf("."), n = t >= 0 ? e.slice(t + 1).toLowerCase() : "";
43
+ return l.has(n);
44
+ }
45
+ var d = Object.freeze({
46
+ ID: 256,
47
+ CONTENT: 1e4,
48
+ REPLY_CONTENT: 5e3,
49
+ NAME: 500,
50
+ EMAIL: 254,
51
+ PAGE: 2e3,
52
+ SELECTOR: 2048,
53
+ EMOJI: 32,
54
+ COLOR: 128,
55
+ DRAWING_PATH_DATA: 5e4,
56
+ DRAWING_TEXT: 5e3,
57
+ DRAWING_TYPE: 20,
58
+ DRAWING_PATHS: 1e3,
59
+ TEXT_SELECTION: 2e4,
60
+ DESCRIPTION: 1e4,
61
+ ASSIGNEES: 100,
62
+ CHECKLIST_ITEMS: 100,
63
+ CHECKLIST_LABEL: 500,
64
+ ONLINE_USERS: 500,
65
+ RENDERED_CURSORS: 24,
66
+ CURSOR_EMITS_PER_SEC: 240,
67
+ REACTION_COUNT: 1e6,
68
+ PENDING_MUTATIONS: 1e3,
69
+ RETRY_DELAY: 3e4
70
+ });
71
+ export { r as a, s as c, c as d, t as i, o as l, u as n, i as o, e as r, n as s, d as t, a as u };
@@ -0,0 +1,55 @@
1
+ function e(e) {
2
+ let t = e;
3
+ if (!t || typeof t.getState != "function" || typeof t.on != "function") throw TypeError("CommentKit UI requires a valid CommentKitCore instance");
4
+ }
5
+ function t() {
6
+ if (typeof document > "u" || !document.body) throw Error("CommentKit UI requires a browser document body");
7
+ return document.body;
8
+ }
9
+ function n(e) {
10
+ return typeof e == "function";
11
+ }
12
+ async function r(r) {
13
+ e(r);
14
+ let i = await import("react"), { createRoot: a } = await import("react-dom/client"), { default: o } = await import("./styles-CtYBghRP.js"), { ShadowContainer: s } = await import("./shadow-root-D5nErAFI.js"), { ErrorBoundary: c } = await import("./error-boundary-9mimpbZA.js"), { CommentKitUI: l } = await import("./comment-kit-ui-Dw_67h_e.js"), u = typeof r.getConfig == "function" ? r.getConfig() : void 0, d = s, f = c, p = t();
15
+ if (p.querySelector("[data-commentkit], [data-commentkit-host]")) return console.warn("[CommentKit] UI is already mounted on this page — skipping duplicate mount. Destroy the existing instance first if you need to remount."), { unmount() {} };
16
+ let m = document.createElement("div");
17
+ m.setAttribute("data-commentkit", ""), p.appendChild(m);
18
+ let h = !0, g = null, _ = null, v = () => {
19
+ if (h = !1, _) {
20
+ try {
21
+ _();
22
+ } catch {}
23
+ _ = null;
24
+ }
25
+ if (g) {
26
+ try {
27
+ g.unmount();
28
+ } catch {}
29
+ g = null;
30
+ }
31
+ m.remove();
32
+ }, y = (e) => {
33
+ if (!h || !g) return;
34
+ let t = i.createElement(l, {
35
+ core: r,
36
+ state: e
37
+ }), n = i.createElement(d, {
38
+ styles: o,
39
+ config: u
40
+ }, t);
41
+ g.render(i.createElement(f, null, n));
42
+ };
43
+ try {
44
+ g = a(m), y(r.getState());
45
+ let e = r.on("state:changed", y);
46
+ if (!n(e)) throw TypeError("CommentKit core subscription did not return an unsubscribe function");
47
+ _ = e;
48
+ } catch (e) {
49
+ throw v(), e;
50
+ }
51
+ return { unmount() {
52
+ v();
53
+ } };
54
+ }
55
+ export { r as mountCommentKitUI };