@commentkit/comment-kit 0.7.7 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +172 -732
  3. package/SECURITY.md +24 -14
  4. package/dist/npm/THIRD_PARTY_NOTICES.txt +73 -0
  5. package/dist/npm/chunks/Guest-CKoV6pEK.js +157 -0
  6. package/dist/npm/chunks/MarkupEditor-DAo4qppg.js +199 -0
  7. package/dist/npm/chunks/Panel-BRBDHlGg.js +399 -0
  8. package/dist/npm/chunks/Shortcuts-CHMcrjAM.js +56 -0
  9. package/dist/npm/chunks/ThreadCard-D8FzIxbs.js +570 -0
  10. package/dist/npm/chunks/anchor-DT-Ynhh1.js +270 -0
  11. package/dist/npm/chunks/ar-D3SPpN1T.js +195 -0
  12. package/dist/npm/chunks/client-D1NizpDK.js +627 -0
  13. package/dist/{shared/capture-colors-D0uLr-vZ.js → npm/chunks/colors-CX-IPjvb.js} +2 -0
  14. package/dist/npm/chunks/de-C8eC6c6f.js +187 -0
  15. package/dist/npm/chunks/es-Bczf42tm.js +187 -0
  16. package/dist/npm/chunks/extension--it1LAj-.js +54 -0
  17. package/dist/npm/chunks/extension-XfuRGu2o.js +26 -0
  18. package/dist/npm/chunks/format-Bw_tNOh9.js +524 -0
  19. package/dist/npm/chunks/fr-BaQw-v2e.js +187 -0
  20. package/dist/npm/chunks/hi-BamV-yXv.js +187 -0
  21. package/dist/npm/chunks/html2canvas-DfGb8yka.js +4024 -0
  22. package/dist/npm/chunks/it-DC14_EjN.js +187 -0
  23. package/dist/npm/chunks/ja-B1mmTN7Y.js +187 -0
  24. package/dist/npm/chunks/mount-5fFig0k6.js +1447 -0
  25. package/dist/npm/chunks/nl-BfhqUsmX.js +187 -0
  26. package/dist/npm/chunks/privacy-DLhezjyi.js +30 -0
  27. package/dist/npm/chunks/pt-BR-CEPu4W5U.js +187 -0
  28. package/dist/{shared/pusher-CnhQgAvF.js → npm/chunks/pusher-BSsQoE1K.js} +224 -222
  29. package/dist/npm/chunks/realtime-CBRW9BB3.js +34 -0
  30. package/dist/npm/chunks/report-Dh4fxd4J.js +27 -0
  31. package/dist/npm/chunks/rolldown-runtime-Y_bBpyJl.js +20 -0
  32. package/dist/npm/chunks/src-DujplxfI.js +517 -0
  33. package/dist/npm/chunks/zh-CN-kgqjYwHQ.js +187 -0
  34. package/dist/npm/element.js +41 -0
  35. package/dist/npm/headless.js +3 -0
  36. package/dist/npm/index.js +3 -0
  37. package/dist/npm/react.js +26 -0
  38. package/dist/npm/svelte.js +17 -0
  39. package/dist/npm/types/adapters/react.d.ts +11 -0
  40. package/dist/npm/types/adapters/svelte.d.ts +9 -0
  41. package/dist/npm/types/adapters/vue.d.ts +118 -0
  42. package/dist/npm/types/anchor/index.d.ts +49 -0
  43. package/dist/npm/types/core/api.d.ts +31 -0
  44. package/dist/npm/types/core/auth.d.ts +87 -0
  45. package/dist/npm/types/core/client.d.ts +114 -0
  46. package/dist/npm/types/core/store.d.ts +7 -0
  47. package/dist/npm/types/core/types.d.ts +303 -0
  48. package/dist/npm/types/element.d.ts +13 -0
  49. package/dist/npm/types/headless.d.ts +7 -0
  50. package/dist/npm/types/index.d.ts +32 -0
  51. package/dist/npm/vue.js +71 -0
  52. package/package.json +71 -173
  53. package/dist/THIRD_PARTY_NOTICES.txt +0 -284
  54. package/dist/angular.es.js +0 -321
  55. package/dist/comment-kit.es.js +0 -218
  56. package/dist/demo.es.js +0 -483
  57. package/dist/headless.es.js +0 -4
  58. package/dist/preact.es.js +0 -117
  59. package/dist/qwik.es.js +0 -1
  60. package/dist/qwik.qwik.mjs +0 -114
  61. package/dist/react.es.js +0 -98
  62. package/dist/shared/ShadowRootContext-DD6a0QaI.js +0 -11
  63. package/dist/shared/annotation-icons-Dh-bmNYK.js +0 -172
  64. package/dist/shared/annotation-toolbar-zeiCmKIr.js +0 -1086
  65. package/dist/shared/attachment-refresh-DAacLaRu.js +0 -94
  66. package/dist/shared/bridge-CJoGYngu.js +0 -177
  67. package/dist/shared/button-D4GHW6oZ.js +0 -474
  68. package/dist/shared/button-group-BVR7iT-S.js +0 -91
  69. package/dist/shared/capture-privacy-CiOrcAlt.js +0 -101
  70. package/dist/shared/comment-drawing-canvas-Btc12IsS.js +0 -124
  71. package/dist/shared/comment-icon-D8JTCEJ7.js +0 -607
  72. package/dist/shared/comment-image-lightbox--QpbcAtH.js +0 -190
  73. package/dist/shared/comment-images-content-C_r4SHM-.js +0 -214
  74. package/dist/shared/comment-kit-core-CmLUFujd.js +0 -3682
  75. package/dist/shared/comment-kit-ui-BHwYuSIi.js +0 -19391
  76. package/dist/shared/comment-screenshot-annotator-zJZyO-XM.js +0 -151
  77. package/dist/shared/comment-screenshot-overlay-CoKTYB0J.js +0 -205
  78. package/dist/shared/comment-shortcut-groups-CfEmkitU.js +0 -153
  79. package/dist/shared/createReactComponent-BZHeRbD0.js +0 -45
  80. package/dist/shared/dev-export-panel-Cnt6oCZU.js +0 -207
  81. package/dist/shared/dev-grab-B85jo9AS.js +0 -197
  82. package/dist/shared/dist-D9A5k-N4.js +0 -617
  83. package/dist/shared/dom-Bhf4WFtY.js +0 -223
  84. package/dist/shared/element-selector-Cng84xC7.js +0 -902
  85. package/dist/shared/error-boundary-D3PD74vI.js +0 -21
  86. package/dist/shared/errors-Bu5ajEmB.js +0 -22
  87. package/dist/shared/icons-nzMOLzrm.js +0 -266
  88. package/dist/shared/input-UPtAj0M6.js +0 -111
  89. package/dist/shared/mount-ui-Dz7FB_Ak.js +0 -208
  90. package/dist/shared/realtime-recovery-BjlV-ewc.js +0 -162
  91. package/dist/shared/realtime-yGLX4wMK.js +0 -334
  92. package/dist/shared/request-activity-DQrAUwfA.js +0 -11
  93. package/dist/shared/screenshot-B5-hwpmt.js +0 -199
  94. package/dist/shared/separator-UhJb0Row.js +0 -3955
  95. package/dist/shared/shadow-root-B58ZI2yz.js +0 -133
  96. package/dist/shared/styles-CnYsLS2f.js +0 -2
  97. package/dist/shared/text-B4HHZNaa.js +0 -23
  98. package/dist/shared/token-session-D92MYbNu.js +0 -25
  99. package/dist/shared/useLabelableId-8n0QmH8N.js +0 -154
  100. package/dist/shared/useRender-Uxk1OPK-.js +0 -5
  101. package/dist/shared/useValueChanged-DKq5cMot.js +0 -92
  102. package/dist/shared/validation-3wbbbuX0.js +0 -70
  103. package/dist/shared/websocket-manager-KhH4hL0Q.js +0 -381
  104. package/dist/solid.es.js +0 -98
  105. package/dist/svelte.es.js +0 -130
  106. package/dist/types/adapters/bridge.d.ts +0 -122
  107. package/dist/types/angular/index.d.ts +0 -145
  108. package/dist/types/core/agent-context.d.ts +0 -17
  109. package/dist/types/core/api-client.d.ts +0 -155
  110. package/dist/types/core/comment-kit-core.d.ts +0 -254
  111. package/dist/types/core/local-demo.d.ts +0 -60
  112. package/dist/types/core/types.d.ts +0 -770
  113. package/dist/types/core/websocket-manager.d.ts +0 -125
  114. package/dist/types/core/write-access.d.ts +0 -11
  115. package/dist/types/demo.d.ts +0 -17
  116. package/dist/types/headless.d.ts +0 -8
  117. package/dist/types/index.d.ts +0 -87
  118. package/dist/types/preact/index.d.ts +0 -25
  119. package/dist/types/qwik/index.d.ts +0 -73
  120. package/dist/types/react/client.d.ts +0 -31
  121. package/dist/types/react/index.d.ts +0 -4
  122. package/dist/types/solid/index.d.ts +0 -37
  123. package/dist/types/svelte/index.d.ts +0 -55
  124. package/dist/types/utils/dom.d.ts +0 -59
  125. package/dist/types/utils/event-emitter.d.ts +0 -11
  126. package/dist/types/vue/index.d.ts +0 -87
  127. package/dist/vue.es.js +0 -148
  128. package/docs/api-reference.md +0 -405
  129. package/docs/local-demo.md +0 -60
@@ -1,607 +0,0 @@
1
- import { A as e, C as t, E as n, F as r, L as i, R as a, d as o, f as s, k as c, m as l, y as u } from "./button-D4GHW6oZ.js";
2
- import { $t as d, Ct as f, Dt as p, Et as m, J as ee, Mt as h, Ot as g, Qt as te, Tt as ne, U as _, Z as re, Zt as v, at as ie, bt as ae, cn as oe, ct as se, en as y, gt as ce, in as le, it as ue, jt as de, kt as fe, lt as pe, nn as me, nt as he, ot as ge, rn as _e, rt as ve, tn as b, tt as ye, un as x, ut as be, wt as S } from "./separator-UhJb0Row.js";
3
- import { N as xe, P as Se, f as Ce, j as we, k as C, t as w } from "./useValueChanged-DKq5cMot.js";
4
- import * as T from "react";
5
- import { jsx as E, jsxs as Te } from "react/jsx-runtime";
6
- var D = 0;
7
- function O(e, t = {}) {
8
- let { preventScroll: n = !1, sync: r = !1, shouldFocus: i } = t;
9
- cancelAnimationFrame(D);
10
- function o() {
11
- (!i || i()) && e?.focus({ preventScroll: n });
12
- }
13
- if (r) return o(), a;
14
- let s = requestAnimationFrame(o);
15
- return D = s, () => {
16
- D === s && (cancelAnimationFrame(s), D = 0);
17
- };
18
- }
19
- var Ee = "data-base-ui-inert", k = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakSet(), j = /* @__PURE__ */ new WeakMap(), M = 0;
20
- function N(t) {
21
- return t ? e(t) ? t.host : N(t.parentNode) : null;
22
- }
23
- var P = (e, t) => t.map((t) => {
24
- if (e.contains(t)) return t;
25
- let n = N(t);
26
- return e.contains(n) ? n : null;
27
- }).filter((e) => e != null), F = (e) => {
28
- let t = /* @__PURE__ */ new Set();
29
- return e.forEach((e) => {
30
- let n = e;
31
- for (; n && !t.has(n);) t.add(n), n = n.parentNode;
32
- }), t;
33
- }, De = (e, t, n) => {
34
- let r = [], i = (e) => {
35
- e && !n.has(e) && Array.from(e.children).forEach((e) => {
36
- u(e) !== "script" && (t.has(e) ? i(e) : r.push(e));
37
- });
38
- };
39
- return i(e), r;
40
- };
41
- function I(e, t, n, { mark: r = !0 }) {
42
- let i = P(t, e), a = r ? De(t, F(i), new Set(i)) : [], o = [], s = [];
43
- if (n) {
44
- let e = P(t, Array.from(t.querySelectorAll("[aria-live]"))), n = i.concat(e);
45
- De(t, F(n), new Set(n)).forEach((e) => {
46
- let t = e.getAttribute("aria-hidden"), n = t !== null && t !== "false", r = (k.get(e) || 0) + 1;
47
- k.set(e, r), o.push(e), r === 1 && n && A.add(e), n || e.setAttribute("aria-hidden", "true");
48
- });
49
- }
50
- return r && a.forEach((e) => {
51
- let t = (j.get(e) || 0) + 1;
52
- j.set(e, t), s.push(e), t === 1 && e.setAttribute(Ee, "");
53
- }), M += 1, () => {
54
- o.forEach((e) => {
55
- let t = (k.get(e) || 0) - 1;
56
- k.set(e, t), t || (A.has(e) || e.removeAttribute("aria-hidden"), A.delete(e));
57
- }), r && s.forEach((e) => {
58
- let t = (j.get(e) || 0) - 1;
59
- j.set(e, t), t || e.removeAttribute(Ee);
60
- }), --M, M || (k = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakSet(), j = /* @__PURE__ */ new WeakMap());
61
- };
62
- }
63
- function Oe(e, t = {}) {
64
- let { ariaHidden: n = !1, mark: r = !0 } = t, i = f(e[0]).body;
65
- return I(e, i, n, { mark: r });
66
- }
67
- function ke(e, n) {
68
- let r = t(y(e));
69
- return e instanceof r.KeyboardEvent ? "keyboard" : e instanceof r.FocusEvent ? n || "keyboard" : "pointerType" in e ? e.pointerType || (me(e) ? "keyboard" : n || "mouse") : "touches" in e ? "touch" : e instanceof r.MouseEvent ? n || (e.detail === 0 ? "keyboard" : "mouse") : "";
70
- }
71
- var Ae = 20, L = [];
72
- function je() {
73
- L = L.filter((e) => e.deref()?.isConnected);
74
- }
75
- function Me(e) {
76
- je(), e && u(e) !== "body" && (L.push(new WeakRef(e)), L.length > Ae && (L = L.slice(-20)));
77
- }
78
- function Ne() {
79
- return je(), L[L.length - 1]?.deref();
80
- }
81
- function Pe(e) {
82
- return e ? pe(e) ? e : be(e)[0] || e : null;
83
- }
84
- function Fe(e) {
85
- if (e.hasAttribute("tabindex") && !e.hasAttribute("data-tabindex") || !e.getAttribute("role")?.includes("dialog")) return;
86
- let t = ue(e).filter((e) => {
87
- let t = e.getAttribute("data-tabindex") || "";
88
- return pe(e) || e.hasAttribute("data-tabindex") && !t.startsWith("-");
89
- }), n = e.getAttribute("tabindex");
90
- t.length === 0 ? n !== "0" && (e.setAttribute("tabindex", "0"), e.setAttribute("data-tabindex", "0")) : (n !== "-1" || e.hasAttribute("data-tabindex") && e.getAttribute("data-tabindex") !== "-1") && (e.setAttribute("tabindex", "-1"), e.setAttribute("data-tabindex", "-1"));
91
- }
92
- function Ie(e) {
93
- let { context: t, children: i, disabled: a = !1, initialFocus: o = !0, returnFocus: c = !0, explicitReturnFocus: ue, restoreFocus: b = !1, modal: x = !0, closeOnFocusOut: S = !0, openInteractionType: xe = "", nextFocusableElement: C, previousFocusableElement: w, beforeContentFocusGuardRef: D, externalTree: Ee, getInsideElements: k } = e, A = t.useState("open"), j = t.useState("domReferenceElement"), M = t.useState("floatingElement"), { events: N, dataRef: P } = t.context, F = s(() => P.current.floatingContext?.nodeId), De = o === !1, I = de(j) && De, Ae = m(o), L = m(c), Ie = m(ue), R = m(xe), Le = m(A), z = ee(Ee), B = re(), V = T.useRef(!1), H = T.useRef(!1), U = T.useRef(!1), Re = T.useRef(null), W = T.useRef(""), G = T.useRef(""), K = T.useRef(null), q = T.useRef(null), ze = l(K, D, B?.beforeInsideRef), Be = l(q, B?.afterInsideRef), Ve = Se(), J = Se(), He = ne(), Y = B != null, X = fe(M), Z = s((e = X) => e ? be(e) : []), Q = s(() => k?.().filter((e) => e != null) ?? []);
94
- T.useEffect(() => {
95
- if (a || !x) return;
96
- function e(e) {
97
- e.key === "Tab" && d(X, v(f(X))) && Z().length === 0 && !I && le(e);
98
- }
99
- let t = f(X);
100
- return g(t, "keydown", e);
101
- }, [
102
- a,
103
- X,
104
- x,
105
- I,
106
- Z
107
- ]), T.useEffect(() => {
108
- if (a || !A) return;
109
- let e = f(X);
110
- function t() {
111
- U.current = !1;
112
- }
113
- function n(e) {
114
- let t = y(e), n = Q(), r = d(M, t) || d(j, t) || d(B?.portalNode, t) || n.some((e) => e === t || d(e, t));
115
- U.current = !r, G.current = e.pointerType || "keyboard", te(t, "[data-base-ui-click-trigger]") && (H.current = !0, J.start(0, () => {
116
- H.current = !1;
117
- }));
118
- }
119
- function r() {
120
- G.current = "keyboard";
121
- }
122
- return p(g(e, "pointerdown", n, !0), g(e, "pointerup", t, !0), g(e, "pointercancel", t, !0), g(e, "keydown", r, !0), t);
123
- }, [
124
- a,
125
- M,
126
- j,
127
- X,
128
- A,
129
- B,
130
- J,
131
- Q
132
- ]), T.useEffect(() => {
133
- if (a || !S) return;
134
- let e = f(X);
135
- function r() {
136
- H.current = !0, J.start(0, () => {
137
- H.current = !1;
138
- });
139
- }
140
- function i(e) {
141
- let t = y(e);
142
- pe(t) && (Re.current = t);
143
- }
144
- function o(r) {
145
- let i = r.relatedTarget, a = r.currentTarget, o = y(r);
146
- x && i == null && o != null && d(M, o) && Me(o), queueMicrotask(() => {
147
- let s = F(), c = t.context.triggerElements, l = Q(), u = i?.hasAttribute(ye("focus-guard")) && [
148
- K.current,
149
- q.current,
150
- B?.beforeInsideRef.current,
151
- B?.afterInsideRef.current,
152
- B?.beforeOutsideRef.current,
153
- B?.afterOutsideRef.current,
154
- _(w),
155
- _(C)
156
- ].includes(i), f = !(d(j, i) || d(M, i) || d(i, M) || d(B?.portalNode, i) || l.some((e) => e === i || d(e, i)) || c.hasMatchingElement((e) => d(e, i)) || u || z && (ve(z.nodesRef.current, s).find((e) => d(e.context?.elements.floating, i) || d(e.context?.elements.domReference, i)) || he(z.nodesRef.current, s).find((e) => [e.context?.elements.floating, fe(e.context?.elements.floating)].includes(i) || e.context?.elements.domReference === i)));
157
- if (a === j && X && Fe(X), b && a !== j && !ce(o) && v(e) === e.body) {
158
- if (n(X) && (X.focus(), b === "popup")) {
159
- He.request(() => {
160
- X.focus();
161
- });
162
- return;
163
- }
164
- let e = Z(), t = Re.current, r = (t && e.includes(t) ? t : null) || e[e.length - 1] || X;
165
- n(r) && r.focus();
166
- }
167
- P.current.insideReactTree ? P.current.insideReactTree = !1 : (I || !x) && i && f && !H.current && (I || i !== Ne()) && (V.current = !0, t.setOpen(!1, we(Ce, r)));
168
- });
169
- }
170
- function s() {
171
- U.current || (P.current.insideReactTree = !0, Ve.start(0, () => {
172
- P.current.insideReactTree = !1;
173
- }));
174
- }
175
- let c = n(j) ? j : null;
176
- if (M || c) return p(c && g(c, "focusout", o), c && g(c, "pointerdown", r), M && g(M, "focusin", i), M && g(M, "focusout", o), M && B && g(M, "focusout", s, !0));
177
- }, [
178
- a,
179
- j,
180
- M,
181
- X,
182
- x,
183
- z,
184
- B,
185
- t,
186
- S,
187
- b,
188
- Z,
189
- I,
190
- F,
191
- P,
192
- Ve,
193
- J,
194
- He,
195
- C,
196
- w,
197
- Q
198
- ]), T.useEffect(() => {
199
- if (a || !M || !A) return;
200
- let e = Array.from(B?.portalNode?.querySelectorAll(`[${ye("portal")}]`) || []), t = (z ? he(z.nodesRef.current, F()) : []).find((e) => de(e.context?.elements.domReference || null))?.context?.elements.domReference, n = Oe([
201
- M,
202
- ...e,
203
- K.current,
204
- q.current,
205
- B?.beforeOutsideRef.current,
206
- B?.afterOutsideRef.current,
207
- ...Q(),
208
- t,
209
- _(w),
210
- _(C),
211
- I ? j : null
212
- ].filter((e) => e != null), {
213
- ariaHidden: x || I,
214
- mark: !1
215
- }), r = Oe([M, ...e].filter((e) => e != null));
216
- return () => {
217
- r(), n();
218
- };
219
- }, [
220
- A,
221
- a,
222
- j,
223
- M,
224
- x,
225
- B,
226
- I,
227
- z,
228
- F,
229
- C,
230
- w,
231
- Q
232
- ]), r(() => {
233
- if (!A || a || !n(X)) return;
234
- W.current = "", G.current = "";
235
- let e = f(X), t = v(e);
236
- queueMicrotask(() => {
237
- let n = Ae.current, r = typeof n == "function" ? n(R.current || "") : n;
238
- if (r === void 0 || r === !1 || d(X, t)) return;
239
- let i = null, a = () => (i ??= Z(X), i[0] || X), o;
240
- o = r === !0 || r === null ? a() : _(r), o ||= a();
241
- let s = d(X, v(e)), c = P.current.openEvent, l = c?.type === "mousedown" && me(c);
242
- O(o, {
243
- sync: l,
244
- preventScroll: o === X,
245
- shouldFocus() {
246
- if (!Le.current) return !1;
247
- if (s) return !0;
248
- let t = v(e);
249
- return !(t !== o && d(X, t));
250
- }
251
- });
252
- });
253
- }, [
254
- a,
255
- A,
256
- X,
257
- Z,
258
- Ae,
259
- R,
260
- Le,
261
- P
262
- ]);
263
- let $ = T.useRef(null);
264
- r(() => {
265
- if (a || !X) {
266
- $.current = null;
267
- return;
268
- }
269
- $.current &&= ($.current.cancelled = !0, null);
270
- let e = f(X), t = v(e), r = R.current == null;
271
- Me(t);
272
- function i(e) {
273
- if (e.open || (W.current = ke(e.nativeEvent, G.current)), (e.reason === "focus-out" && e.triggerElement?.hasAttribute(ye("focus-guard")) || e.reason === "trigger-hover" && e.nativeEvent.type === "mouseleave") && (V.current = !0), e.reason === "outside-press") {
274
- if (e.nested) V.current = !1;
275
- else if (me(e.nativeEvent) || _e(e.nativeEvent)) V.current = !1;
276
- else {
277
- let e = !1;
278
- f(X).createElement("div").focus({ get preventScroll() {
279
- return e = !0, !1;
280
- } }), e ? V.current = !1 : V.current = !0;
281
- }
282
- }
283
- }
284
- N.on("openchange", i);
285
- function o(e) {
286
- let n = L.current, i = typeof n == "function" ? n(e) : n;
287
- if (i === void 0 || i === !1) return null;
288
- i === null && (i = !0);
289
- let a = j?.isConnected ? j : null, o = t?.isConnected && u(t) !== "body" ? t : null, s = r ? o || a : a || o;
290
- return s ||= Ne() || null, typeof i == "boolean" ? s : _(i) || s || null;
291
- }
292
- return () => {
293
- N.off("openchange", i);
294
- let t = v(e), r = Q(), a = d(M, t) || r.some((e) => e === t || d(e, t)) || z && ve(z.nodesRef.current, F(), !1).some((e) => d(e.context?.elements.floating, t)), s = L.current, c = W.current, l = o(c), u = { cancelled: !1 };
295
- $.current = u, queueMicrotask(() => {
296
- $.current === u && ($.current = null);
297
- let r = Pe(l), i = Ie.current ?? typeof s != "boolean";
298
- if (!u.cancelled && s && !V.current && n(r) && (i || r === t || t === e.body || a)) {
299
- let e = { preventScroll: !0 };
300
- c === "keyboard" && (e.focusVisible = !0), r.focus(e);
301
- }
302
- V.current = !1;
303
- });
304
- };
305
- }, [
306
- a,
307
- M,
308
- X,
309
- L,
310
- Ie,
311
- R,
312
- N,
313
- z,
314
- j,
315
- F,
316
- Q
317
- ]), r(() => {
318
- if (!oe || A || !M) return;
319
- let e = v(f(M));
320
- n(e) && h(e) && d(M, e) && e.blur();
321
- }, [A, M]), r(() => {
322
- if (!a && B) return B.setFocusManagerState({
323
- modal: x,
324
- closeOnFocusOut: S,
325
- open: A,
326
- onOpenChange: t.setOpen,
327
- domReference: j
328
- }), () => {
329
- B.setFocusManagerState(null);
330
- };
331
- }, [
332
- a,
333
- B,
334
- x,
335
- A,
336
- t,
337
- S,
338
- j
339
- ]), r(() => {
340
- if (!a && X) return Fe(X), () => {
341
- queueMicrotask(je);
342
- };
343
- }, [a, X]);
344
- let Ue = !a && (!x || !I) && (Y || x);
345
- return /*#__PURE__*/ Te(T.Fragment, { children: [
346
- Ue && /*#__PURE__*/ E(ae, {
347
- "data-type": "inside",
348
- ref: ze,
349
- onFocus: (e) => {
350
- if (x) {
351
- let e = Z();
352
- O(e[e.length - 1]);
353
- } else B?.portalNode && (V.current = !1, se(e, B.portalNode) ? ie(j)?.focus() : _(w ?? B.beforeOutsideRef)?.focus());
354
- }
355
- }),
356
- i,
357
- Ue && /*#__PURE__*/ E(ae, {
358
- "data-type": "inside",
359
- ref: Be,
360
- onFocus: (e) => {
361
- x ? O(Z()[0]) : B?.portalNode && (S && (V.current = !0), se(e, B.portalNode) ? ge(j)?.focus() : _(C ?? B.afterOutsideRef)?.focus());
362
- }
363
- })
364
- ] });
365
- }
366
- function R(e, t = {}) {
367
- let { enabled: n = !0, event: r = "click", toggle: a = !0, ignoreMouse: o = !1, stickIfOpen: s = !0, touchOpenDelay: c = 0, reason: l = C } = t, u = e.context.dataRef, d = T.useRef(void 0), f = ne(), p = Se(), m = T.useMemo(() => {
368
- function t(t, n, r, i) {
369
- let a = we(l, n, r);
370
- t && i === "touch" && c > 0 ? p.start(c, () => {
371
- e.setOpen(!0, a);
372
- }) : e.setOpen(t, a);
373
- }
374
- function n(t, n, r) {
375
- let i = u.current.openEvent, o = e.select("domReferenceElement") !== n;
376
- return t && o || !t || !a ? !0 : i && (typeof s == "function" ? s() : s) ? !r(i.type) : !1;
377
- }
378
- return {
379
- onPointerDown(e) {
380
- d.current = b(e.pointerType, !0) && _e(e.nativeEvent) ? "virtual" : e.pointerType;
381
- },
382
- onMouseDown(i) {
383
- let a = d.current, s = i.nativeEvent, c = e.select("open");
384
- if (i.button !== 0 || r === "click" || b(a, !0) && o) return;
385
- let l = n(c, i.currentTarget, (e) => e === "click" || e === "mousedown"), u = y(s), p = h(u);
386
- if (p || a === "virtual") {
387
- t(l, s, p ? u : i.currentTarget, a);
388
- return;
389
- }
390
- let m = i.currentTarget;
391
- f.request(() => {
392
- t(l, s, m, a);
393
- });
394
- },
395
- onClick(i) {
396
- if (r === "mousedown-only") return;
397
- let a = d.current;
398
- r === "mousedown" && a ? d.current = void 0 : b(a, !0) && o || t(n(e.select("open"), i.currentTarget, (e) => e === "click" || e === "mousedown" || e === "keydown" || e === "keyup"), i.nativeEvent, i.currentTarget, a);
399
- },
400
- onKeyDown() {
401
- d.current = void 0;
402
- }
403
- };
404
- }, [
405
- u,
406
- r,
407
- o,
408
- l,
409
- e,
410
- s,
411
- a,
412
- f,
413
- p,
414
- c
415
- ]);
416
- return T.useMemo(() => n ? { reference: m } : i, [n, m]);
417
- }
418
- function Le(e) {
419
- return o(19) ? e : e ? "true" : void 0;
420
- }
421
- var z = {}, B = {}, V = "";
422
- function H(e, t) {
423
- return c(e) ? e : t;
424
- }
425
- function U(e, t, n) {
426
- return /hidden|clip/.test(e.getComputedStyle(H(t, n)).overflowY);
427
- }
428
- function Re(e) {
429
- if (typeof document > "u") return !1;
430
- let n = f(e);
431
- return t(n).innerWidth - n.documentElement.clientWidth > 0;
432
- }
433
- function W(e) {
434
- if (!(typeof CSS < "u" && CSS.supports && CSS.supports("scrollbar-gutter", "stable")) || typeof document > "u") return !1;
435
- let t = f(e), n = t.documentElement, r = t.body, i = H(n, r), a = i.style.overflowY, o = n.style.scrollbarGutter;
436
- n.style.scrollbarGutter = "stable", i.style.overflowY = "scroll";
437
- let s = i.offsetWidth;
438
- i.style.overflowY = "hidden";
439
- let c = i.offsetWidth;
440
- return i.style.overflowY = a, n.style.scrollbarGutter = o, s === c;
441
- }
442
- function G(e) {
443
- let t = f(e), n = t.documentElement, r = t.body, i = H(n, r), a = {
444
- overflowY: i.style.overflowY,
445
- overflowX: i.style.overflowX
446
- };
447
- return Object.assign(i.style, {
448
- overflowY: "hidden",
449
- overflowX: "hidden"
450
- }), () => {
451
- Object.assign(i.style, a);
452
- };
453
- }
454
- function K(e) {
455
- let n = f(e), r = n.documentElement, i = n.body, a = t(r), o = 0, s = 0, c = !1, l = S.create();
456
- if (oe && (a.visualViewport?.scale ?? 1) !== 1) return () => {};
457
- function u() {
458
- let t = a.getComputedStyle(r), n = a.getComputedStyle(i), l = (t.scrollbarGutter || "").includes("both-edges") ? "stable both-edges" : "stable";
459
- o = r.scrollTop, s = r.scrollLeft, z = {
460
- scrollbarGutter: r.style.scrollbarGutter,
461
- overflowY: r.style.overflowY,
462
- overflowX: r.style.overflowX
463
- }, V = r.style.scrollBehavior, B = {
464
- position: i.style.position,
465
- height: i.style.height,
466
- width: i.style.width,
467
- boxSizing: i.style.boxSizing,
468
- overflowY: i.style.overflowY,
469
- overflowX: i.style.overflowX,
470
- scrollBehavior: i.style.scrollBehavior
471
- };
472
- let u = r.scrollHeight > r.clientHeight, d = r.scrollWidth > r.clientWidth, f = t.overflowY === "scroll" || n.overflowY === "scroll", p = t.overflowX === "scroll" || n.overflowX === "scroll", m = Math.max(0, a.innerWidth - i.clientWidth), ee = Math.max(0, a.innerHeight - i.clientHeight), h = parseFloat(n.marginTop) + parseFloat(n.marginBottom), g = parseFloat(n.marginLeft) + parseFloat(n.marginRight), te = H(r, i);
473
- c = W(e), c ? (r.style.scrollbarGutter = l, te.style.overflowY = "hidden", te.style.overflowX = "hidden") : (Object.assign(r.style, {
474
- scrollbarGutter: l,
475
- overflowY: "hidden",
476
- overflowX: "hidden"
477
- }), (u || f) && (r.style.overflowY = "scroll"), (d || p) && (r.style.overflowX = "scroll"), Object.assign(i.style, {
478
- position: "relative",
479
- height: h || ee ? `calc(100dvh - ${h + ee}px)` : "100dvh",
480
- width: g || m ? `calc(100vw - ${g + m}px)` : "100vw",
481
- boxSizing: "border-box",
482
- overflowY: "hidden",
483
- overflowX: "hidden",
484
- scrollBehavior: "unset"
485
- }), i.scrollTop = o, i.scrollLeft = s, r.setAttribute("data-base-ui-scroll-locked", ""), r.style.scrollBehavior = "unset");
486
- }
487
- function d() {
488
- Object.assign(r.style, z), Object.assign(i.style, B), c || (r.scrollTop = o, r.scrollLeft = s, r.removeAttribute("data-base-ui-scroll-locked"), r.style.scrollBehavior = V);
489
- }
490
- function p() {
491
- d(), l.request(u);
492
- }
493
- u();
494
- let m = g(a, "resize", p);
495
- return () => {
496
- l.cancel(), d(), typeof a.removeEventListener == "function" && m();
497
- };
498
- }
499
- var q = new class {
500
- lockCount = 0;
501
- restore = null;
502
- timeoutLock = xe.create();
503
- timeoutUnlock = xe.create();
504
- acquire(e) {
505
- return this.lockCount += 1, this.lockCount === 1 && this.restore === null && this.timeoutLock.start(0, () => this.lock(e)), this.release;
506
- }
507
- release = () => {
508
- --this.lockCount, this.lockCount === 0 && this.restore && this.timeoutUnlock.start(0, this.unlock);
509
- };
510
- unlock = () => {
511
- this.lockCount === 0 && this.restore && (this.restore?.(), this.restore = null);
512
- };
513
- lock(e) {
514
- if (this.lockCount === 0 || this.restore !== null) return;
515
- let n = f(e), r = n.documentElement, i = n.body, a = t(r);
516
- if (U(a, r, i)) {
517
- let t = new a.MutationObserver(() => {
518
- U(a, r, i) || (t.disconnect(), this.restore = null, this.lock(e));
519
- }), n = { attributes: !0 };
520
- t.observe(r, n), t.observe(i, n), this.restore = () => t.disconnect();
521
- return;
522
- }
523
- let o = x || !Re(e);
524
- this.restore = o ? G(e) : K(e);
525
- }
526
- }();
527
- function ze(e = !0, t = null) {
528
- r(() => {
529
- if (e) return q.acquire(t);
530
- }, [e, t]);
531
- }
532
- var Be = /*#__PURE__*/ T.forwardRef(function(e, t) {
533
- let { cutout: n, ...r } = e, i;
534
- if (n) {
535
- let e = n.getBoundingClientRect();
536
- i = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`;
537
- }
538
- return /*#__PURE__*/ E("div", {
539
- ref: t,
540
- role: "presentation",
541
- "data-base-ui-inert": "",
542
- ...r,
543
- style: {
544
- position: "fixed",
545
- inset: 0,
546
- userSelect: "none",
547
- WebkitUserSelect: "none",
548
- clipPath: i
549
- }
550
- });
551
- });
552
- function Ve(e) {
553
- let t = T.useRef(""), n = T.useCallback((n) => {
554
- n.defaultPrevented || (t.current = n.pointerType, e(n, n.pointerType));
555
- }, [e]);
556
- return {
557
- onClick: T.useCallback((n) => {
558
- n.detail === 0 ? e(n, "keyboard") : ("pointerType" in n ? e(n, n.pointerType) : e(n, t.current), t.current = "");
559
- }, [e]),
560
- onPointerDown: n
561
- };
562
- }
563
- function J(e, t) {
564
- let { onClick: n, onPointerDown: r } = Ve(s((n, r) => {
565
- (typeof e == "function" ? e() : e) || t(r || (x ? "touch" : ""));
566
- }));
567
- return T.useMemo(() => ({
568
- onClick: n,
569
- onPointerDown: r
570
- }), [n, r]);
571
- }
572
- function He(e) {
573
- let [t, n] = T.useState(null), r = J(e, n);
574
- return w(e, (t) => {
575
- t && !e && n(null);
576
- }), T.useMemo(() => ({
577
- openMethod: t,
578
- triggerProps: r
579
- }), [t, r]);
580
- }
581
- function Y({ className: e, children: t, strokeWidth: n = 2, ...r }) {
582
- return /* @__PURE__ */ E("svg", {
583
- viewBox: "0 0 24 24",
584
- fill: "none",
585
- stroke: "currentColor",
586
- strokeWidth: n,
587
- strokeLinecap: "round",
588
- strokeLinejoin: "round",
589
- "aria-hidden": "true",
590
- ...r,
591
- className: e,
592
- children: t
593
- });
594
- }
595
- function X(e) {
596
- return /* @__PURE__ */ Te(Y, {
597
- ...e,
598
- children: [/* @__PURE__ */ E("path", { d: "M9.14339 10.691L9.35031 10.4841C11.329 8.50532 14.5372 8.50532 16.5159 10.4841C18.4947 12.4628 18.4947 15.671 16.5159 17.6497L13.6497 20.5159C11.671 22.4947 8.46279 22.4947 6.48405 20.5159C4.50532 18.5372 4.50532 15.329 6.48405 13.3503L6.9484 12.886" }), /* @__PURE__ */ E("path", { d: "M17.0516 11.114L17.5159 10.6497C19.4947 8.67095 19.4947 5.46279 17.5159 3.48405C15.5372 1.50532 12.329 1.50532 10.3503 3.48405L7.48405 6.35031C5.50532 8.32904 5.50532 11.5372 7.48405 13.5159C9.46279 15.4947 12.671 15.4947 14.6497 13.5159L14.8566 13.309" })]
599
- });
600
- }
601
- function Z(e) {
602
- return /* @__PURE__ */ E(Y, {
603
- ...e,
604
- children: /* @__PURE__ */ E("path", { d: "M5 14.5C5 14.5 6.5 14.5 8.5 18C8.5 18 14.0588 8.83333 19 7" })
605
- });
606
- }
607
- export { J as a, Le as c, O as d, He as i, R as l, X as n, Be as o, Z as r, ze as s, Y as t, Ie as u };