@commentkit/comment-kit 0.7.3 → 0.7.5

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 (50) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +2 -2
  3. package/SECURITY.md +1 -1
  4. package/dist/angular.es.js +2 -2
  5. package/dist/comment-kit.es.js +3 -3
  6. package/dist/demo.es.js +24 -15
  7. package/dist/headless.es.js +2 -2
  8. package/dist/preact.es.js +2 -2
  9. package/dist/qwik.qwik.mjs +2 -2
  10. package/dist/react.es.js +2 -2
  11. package/dist/shared/ShadowRootContext-DD6a0QaI.js +11 -0
  12. package/dist/shared/annotation-toolbar-DgqxkHy8.js +1085 -0
  13. package/dist/shared/{attachment-refresh-agUheZPF.js → attachment-refresh-DRX7dKDI.js} +3 -3
  14. package/dist/shared/{button-By0hGrJK.js → button-D4GHW6oZ.js} +133 -164
  15. package/dist/shared/{button-group-C285iSkZ.js → button-group-BVR7iT-S.js} +13 -13
  16. package/dist/shared/{capture-colors-CxSLsU5-.js → capture-colors-D0uLr-vZ.js} +12 -2
  17. package/dist/shared/{comment-drawing-canvas-B3zqdIZH.js → comment-drawing-canvas-hSdcLShI.js} +2 -2
  18. package/dist/shared/{comment-icon-4SQd3nlz.js → comment-icon-D8JTCEJ7.js} +109 -110
  19. package/dist/shared/{comment-image-lightbox-j9y3Klh6.js → comment-image-lightbox-4zroOCCG.js} +7 -7
  20. package/dist/shared/{comment-images-content-aJrMaOi9.js → comment-images-content-D4hTya6e.js} +28 -28
  21. package/dist/shared/{comment-kit-core-Bsyydwpk.js → comment-kit-core-D068rcdY.js} +467 -503
  22. package/dist/shared/{comment-kit-ui-qKjCHHOy.js → comment-kit-ui-BDzNt0jv.js} +5078 -5254
  23. package/dist/shared/{comment-screenshot-annotator-aDtgMbBF.js → comment-screenshot-annotator-BGnu_NgP.js} +2 -2
  24. package/dist/shared/{comment-screenshot-overlay-B-rAubia.js → comment-screenshot-overlay-BCRmojWB.js} +17 -14
  25. package/dist/shared/{dev-export-panel-mrxmtzei.js → dev-export-panel-CYmUKmIV.js} +3 -3
  26. package/dist/shared/{dev-grab-Cc-lJYBv.js → dev-grab-BYsCpsGI.js} +48 -47
  27. package/dist/shared/dist-D9A5k-N4.js +617 -0
  28. package/dist/shared/{element-selector-4TxTAXHK.js → element-selector-79Oo5pit.js} +4 -4
  29. package/dist/shared/{mount-ui-Dbqe5VsO.js → mount-ui-DuHk132g.js} +4 -4
  30. package/dist/shared/{pusher-zAMukOay.js → pusher-3jyUauYd.js} +1 -1
  31. package/dist/shared/{realtime-t5o6fk6w.js → realtime-DspH16g5.js} +41 -28
  32. package/dist/shared/{realtime-recovery-BSVMwsXJ.js → realtime-recovery-BjlV-ewc.js} +57 -30
  33. package/dist/shared/screenshot-BIuEaRiu.js +199 -0
  34. package/dist/shared/{separator-aphZiRoJ.js → separator-UhJb0Row.js} +1222 -1288
  35. package/dist/shared/{shadow-root-DlfbvZF9.js → shadow-root-3-yGIhMs.js} +3 -5
  36. package/dist/shared/{token-session-ZzSO1tEl.js → token-session-_Pi4fOEi.js} +1 -1
  37. package/dist/shared/{useRender-D1z_X_BY.js → useRender-Uxk1OPK-.js} +1 -1
  38. package/dist/shared/{useValueChanged-CrzfD8l-.js → useValueChanged-DKq5cMot.js} +13 -13
  39. package/dist/shared/{websocket-manager-DGN8T9mq.js → websocket-manager-CvgZSo_L.js} +2 -2
  40. package/dist/solid.es.js +2 -2
  41. package/dist/svelte.es.js +2 -2
  42. package/dist/types/core/api-client.d.ts +17 -9
  43. package/dist/types/core/comment-kit-core.d.ts +4 -2
  44. package/dist/types/core/types.d.ts +37 -4
  45. package/dist/vue.es.js +2 -2
  46. package/docs/api-reference.md +29 -17
  47. package/package.json +1 -1
  48. package/dist/shared/ShadowRootContext-CjciYxVN.js +0 -13
  49. package/dist/shared/annotation-toolbar-XpqojzM2.js +0 -1094
  50. package/dist/shared/dist-De294MVF.js +0 -623
@@ -0,0 +1,617 @@
1
+ import e from "react";
2
+ import t from "react-dom";
3
+ var n = (e) => {
4
+ switch (e) {
5
+ case "success": return a;
6
+ case "info": return s;
7
+ case "warning": return o;
8
+ case "error": return c;
9
+ default: return null;
10
+ }
11
+ }, r = Array(12).fill(0), i = ({ visible: t, className: n }) => /*#__PURE__*/ e.createElement("div", {
12
+ className: ["sonner-loading-wrapper", n].filter(Boolean).join(" "),
13
+ "data-visible": t
14
+ }, /*#__PURE__*/ e.createElement("div", { className: "sonner-spinner" }, r.map((t, n) => /*#__PURE__*/ e.createElement("div", {
15
+ className: "sonner-loading-bar",
16
+ key: `spinner-bar-${n}`
17
+ })))), a = /*#__PURE__*/ e.createElement("svg", {
18
+ xmlns: "http://www.w3.org/2000/svg",
19
+ viewBox: "0 0 20 20",
20
+ fill: "currentColor",
21
+ height: "20",
22
+ width: "20",
23
+ "aria-hidden": "true"
24
+ }, /*#__PURE__*/ e.createElement("path", {
25
+ fillRule: "evenodd",
26
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
27
+ clipRule: "evenodd"
28
+ })), o = /*#__PURE__*/ e.createElement("svg", {
29
+ xmlns: "http://www.w3.org/2000/svg",
30
+ viewBox: "0 0 24 24",
31
+ fill: "currentColor",
32
+ height: "20",
33
+ width: "20",
34
+ "aria-hidden": "true"
35
+ }, /*#__PURE__*/ e.createElement("path", {
36
+ fillRule: "evenodd",
37
+ d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
38
+ clipRule: "evenodd"
39
+ })), s = /*#__PURE__*/ e.createElement("svg", {
40
+ xmlns: "http://www.w3.org/2000/svg",
41
+ viewBox: "0 0 20 20",
42
+ fill: "currentColor",
43
+ height: "20",
44
+ width: "20",
45
+ "aria-hidden": "true"
46
+ }, /*#__PURE__*/ e.createElement("path", {
47
+ fillRule: "evenodd",
48
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
49
+ clipRule: "evenodd"
50
+ })), c = /*#__PURE__*/ e.createElement("svg", {
51
+ xmlns: "http://www.w3.org/2000/svg",
52
+ viewBox: "0 0 20 20",
53
+ fill: "currentColor",
54
+ height: "20",
55
+ width: "20",
56
+ "aria-hidden": "true"
57
+ }, /*#__PURE__*/ e.createElement("path", {
58
+ fillRule: "evenodd",
59
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
60
+ clipRule: "evenodd"
61
+ })), ee = /*#__PURE__*/ e.createElement("svg", {
62
+ xmlns: "http://www.w3.org/2000/svg",
63
+ width: "12",
64
+ height: "12",
65
+ viewBox: "0 0 24 24",
66
+ fill: "none",
67
+ stroke: "currentColor",
68
+ strokeWidth: "1.5",
69
+ strokeLinecap: "round",
70
+ strokeLinejoin: "round",
71
+ "aria-hidden": "true"
72
+ }, /*#__PURE__*/ e.createElement("line", {
73
+ x1: "18",
74
+ y1: "6",
75
+ x2: "6",
76
+ y2: "18"
77
+ }), /*#__PURE__*/ e.createElement("line", {
78
+ x1: "6",
79
+ y1: "6",
80
+ x2: "18",
81
+ y2: "18"
82
+ })), l = () => {
83
+ let [t, n] = e.useState(document.hidden);
84
+ return e.useEffect(() => {
85
+ let e = () => {
86
+ n(document.hidden);
87
+ };
88
+ return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
89
+ }, []), t;
90
+ }, u = 1, d = 100, f = (e) => typeof e?.id == "number" || e?.id?.length > 0 ? e.id : u++, p = new class {
91
+ constructor() {
92
+ this.subscribe = (e) => (this.subscribers.push(e), this.getActiveToasts().forEach((t) => e(t)), () => {
93
+ let t = this.subscribers.indexOf(e);
94
+ this.subscribers.splice(t, 1);
95
+ }), this.publish = (e) => {
96
+ this.subscribers.forEach((t) => t(e));
97
+ }, this.addToast = (e) => {
98
+ this.publish(e), this.toasts = [...this.toasts, e], this.trimHistory();
99
+ }, this.trimHistory = () => {
100
+ let e = this.toasts.length - d;
101
+ e <= 0 || (this.toasts = this.toasts.filter((t) => e > 0 && this.dismissedToasts.has(t.id) ? (this.dismissedToasts.delete(t.id), e--, !1) : !0));
102
+ }, this.create = (e) => {
103
+ let { message: t, ...n } = e, r = f(e), i = this.pendingDismissals.get(r);
104
+ i !== void 0 && (cancelAnimationFrame(i), this.pendingDismissals.delete(r), this.dismissedToasts.delete(r));
105
+ let a = this.dismissedToasts.has(r), o = e.dismissible === void 0 || e.dismissible;
106
+ return a && (this.dismissedToasts.delete(r), this.toasts = this.toasts.filter((e) => e.id !== r)), !a && this.toasts.find((e) => e.id === r) ? this.toasts = this.toasts.map((n) => n.id === r ? (this.publish({
107
+ ...n,
108
+ ...e,
109
+ id: r,
110
+ title: t
111
+ }), {
112
+ ...n,
113
+ ...e,
114
+ id: r,
115
+ dismissible: o,
116
+ title: t
117
+ }) : n) : this.addToast({
118
+ title: t,
119
+ ...n,
120
+ dismissible: o,
121
+ id: r
122
+ }), r;
123
+ }, this.dismiss = (e) => {
124
+ if (e == null) return this.getActiveToasts().forEach((e) => {
125
+ this.dismissedToasts.add(e.id), this.subscribers.forEach((t) => t({
126
+ id: e.id,
127
+ dismiss: !0
128
+ }));
129
+ }), e;
130
+ this.dismissedToasts.add(e);
131
+ let t = this.pendingDismissals.get(e);
132
+ return t !== void 0 && cancelAnimationFrame(t), this.pendingDismissals.set(e, requestAnimationFrame(() => {
133
+ this.pendingDismissals.delete(e), this.subscribers.forEach((t) => t({
134
+ id: e,
135
+ dismiss: !0
136
+ }));
137
+ })), e;
138
+ }, this.message = (e, t) => this.create({
139
+ ...t,
140
+ message: e,
141
+ type: void 0
142
+ }), this.error = (e, t) => this.create({
143
+ ...t,
144
+ message: e,
145
+ type: "error"
146
+ }), this.success = (e, t) => this.create({
147
+ ...t,
148
+ type: "success",
149
+ message: e
150
+ }), this.info = (e, t) => this.create({
151
+ ...t,
152
+ type: "info",
153
+ message: e
154
+ }), this.warning = (e, t) => this.create({
155
+ ...t,
156
+ type: "warning",
157
+ message: e
158
+ }), this.loading = (e, t) => this.create({
159
+ ...t,
160
+ type: "loading",
161
+ message: e
162
+ }), this.promise = (t, n) => {
163
+ if (!n) return;
164
+ let r;
165
+ n.loading !== void 0 && (r = this.create({
166
+ ...n,
167
+ promise: t,
168
+ type: "loading",
169
+ message: n.loading,
170
+ description: typeof n.description == "function" ? void 0 : n.description
171
+ }));
172
+ let i = Promise.resolve(t instanceof Function ? t() : t), a = r !== void 0, o, s = i.then(async (t) => {
173
+ if (o = ["resolve", t], e.isValidElement(t)) a = !1, this.create({
174
+ id: r,
175
+ type: "default",
176
+ message: t
177
+ });
178
+ else if (h(t) && !t.ok) {
179
+ a = !1;
180
+ let i = typeof n.error == "function" ? await n.error(`HTTP error! status: ${t.status}`) : n.error, o = typeof n.description == "function" ? await n.description(`HTTP error! status: ${t.status}`) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
181
+ this.create({
182
+ id: r,
183
+ type: "error",
184
+ description: o,
185
+ ...s
186
+ });
187
+ } else if (t instanceof Error) {
188
+ a = !1;
189
+ let i = typeof n.error == "function" ? await n.error(t) : n.error, o = typeof n.description == "function" ? await n.description(t) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
190
+ this.create({
191
+ id: r,
192
+ type: "error",
193
+ description: o,
194
+ ...s
195
+ });
196
+ } else if (n.success !== void 0) {
197
+ a = !1;
198
+ let i = typeof n.success == "function" ? await n.success(t) : n.success, o = typeof n.description == "function" ? await n.description(t) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
199
+ this.create({
200
+ id: r,
201
+ type: "success",
202
+ description: o,
203
+ ...s
204
+ });
205
+ }
206
+ }).catch(async (t) => {
207
+ if (o = ["reject", t], n.error !== void 0) {
208
+ a = !1;
209
+ let i = typeof n.error == "function" ? await n.error(t) : n.error, o = typeof n.description == "function" ? await n.description(t) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
210
+ this.create({
211
+ id: r,
212
+ type: "error",
213
+ description: o,
214
+ ...s
215
+ });
216
+ }
217
+ }).finally(() => {
218
+ a && (this.dismiss(r), r = void 0), n.finally == null || n.finally.call(n);
219
+ }), c = () => new Promise((e, t) => s.then(() => o[0] === "reject" ? t(o[1]) : e(o[1])).catch(t));
220
+ return typeof r != "string" && typeof r != "number" ? { unwrap: c } : Object.assign(r, { unwrap: c });
221
+ }, this.custom = (e, t) => {
222
+ let n = f(t);
223
+ return this.create({
224
+ ...t,
225
+ jsx: e(n),
226
+ id: n,
227
+ type: void 0
228
+ }), n;
229
+ }, this.getActiveToasts = () => this.toasts.filter((e) => !this.dismissedToasts.has(e.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set(), this.pendingDismissals = /* @__PURE__ */ new Map();
230
+ }
231
+ }(), m = (e, t) => p.message(e, t), h = (e) => e && typeof e == "object" && "ok" in e && typeof e.ok == "boolean" && "status" in e && typeof e.status == "number", g = Object.assign(m, {
232
+ success: p.success,
233
+ info: p.info,
234
+ warning: p.warning,
235
+ error: p.error,
236
+ custom: p.custom,
237
+ message: p.message,
238
+ promise: p.promise,
239
+ dismiss: p.dismiss,
240
+ loading: p.loading
241
+ }, {
242
+ getHistory: () => p.toasts,
243
+ getToasts: () => p.getActiveToasts()
244
+ });
245
+ function _(e) {
246
+ return e.label !== void 0;
247
+ }
248
+ var v = 3, y = "24px", b = "16px", x = 4e3, te = 356, ne = 14, re = 45, ie = 200;
249
+ function S(...e) {
250
+ return e.filter(Boolean).join(" ");
251
+ }
252
+ function C(e) {
253
+ let [t, n] = e.split("-"), r = [];
254
+ return t && r.push(t), n && r.push(n), r;
255
+ }
256
+ var ae = (t) => {
257
+ let { invert: r, toast: a, unstyled: o, interacting: s, setHeights: c, visibleToasts: u, heights: d, index: f, toasts: p, expanded: m, removeToast: h, defaultRichColors: g, closeButton: v, style: y, cancelButtonStyle: b, actionButtonStyle: te, className: ne = "", descriptionClassName: ae = "", duration: w, position: T, gap: E, expandByDefault: D, classNames: O, icons: k, closeButtonAriaLabel: oe = "Close toast" } = t, [A, j] = e.useState(null), [M, N] = e.useState(null), [P, F] = e.useState(!1), [I, L] = e.useState(!1), [R, z] = e.useState(!1), [B, se] = e.useState(!1), [ce, le] = e.useState(!1), [ue, V] = e.useState(0), [de, H] = e.useState(0), U = e.useRef(a.duration || w || x), fe = e.useRef(null), W = e.useRef(null), pe = f === 0, me = f + 1 <= u, G = a.type, he = G ?? "default", K = a.dismissible !== !1, ge = a.className || "", _e = a.descriptionClassName || "", q = e.useMemo(() => d.findIndex((e) => e.toastId === a.id) || 0, [d, a.id]), ve = e.useMemo(() => a.closeButton ?? v, [a.closeButton, v]), ye = e.useMemo(() => a.duration || w || x, [a.duration, w]), J = e.useRef(0), Y = e.useRef(0), be = e.useRef(0), X = e.useRef(null), [xe, Se] = T.split("-"), Ce = e.useMemo(() => d.reduce((e, t, n) => n >= q ? e : e + t.height, 0), [d, q]), we = l(), Z = e.useMemo(() => t.swipeDirections ?? C(T), [t.swipeDirections, T]), Te = a.invert || r, Q = G === "loading";
258
+ Y.current = e.useMemo(() => q * E + Ce, [q, Ce]), e.useEffect(() => {
259
+ U.current = ye;
260
+ }, [ye]), e.useEffect(() => {
261
+ F(!0);
262
+ }, []), e.useEffect(() => {
263
+ let e = W.current;
264
+ if (e) {
265
+ let t = e.getBoundingClientRect().height;
266
+ return H(t), c((e) => [{
267
+ toastId: a.id,
268
+ height: t,
269
+ position: a.position
270
+ }, ...e]), () => c((e) => e.filter((e) => e.toastId !== a.id));
271
+ }
272
+ }, [c, a.id]), e.useLayoutEffect(() => {
273
+ if (!P) return;
274
+ let e = W.current, t = e.style.height;
275
+ e.style.height = "auto";
276
+ let n = e.getBoundingClientRect().height;
277
+ e.style.height = t, H(n), c((e) => e.find((e) => e.toastId === a.id) ? e.map((e) => e.toastId === a.id ? {
278
+ ...e,
279
+ height: n
280
+ } : e) : [{
281
+ toastId: a.id,
282
+ height: n,
283
+ position: a.position
284
+ }, ...e]);
285
+ }, [
286
+ P,
287
+ a.title,
288
+ a.description,
289
+ c,
290
+ a.id,
291
+ a.jsx,
292
+ a.action,
293
+ a.cancel
294
+ ]);
295
+ let $ = e.useCallback(() => {
296
+ L(!0), V(Y.current), c((e) => e.filter((e) => e.toastId !== a.id)), setTimeout(() => {
297
+ h(a);
298
+ }, ie);
299
+ }, [
300
+ a,
301
+ h,
302
+ c,
303
+ Y
304
+ ]);
305
+ e.useEffect(() => {
306
+ if (a.promise && G === "loading" || a.duration === Infinity || a.type === "loading") return;
307
+ let e;
308
+ return m || s || we ? (() => {
309
+ if (be.current < J.current) {
310
+ let e = (/* @__PURE__ */ new Date()).getTime() - J.current;
311
+ U.current -= e;
312
+ }
313
+ be.current = (/* @__PURE__ */ new Date()).getTime();
314
+ })() : U.current !== Infinity && (J.current = (/* @__PURE__ */ new Date()).getTime(), e = setTimeout(() => {
315
+ a.onAutoClose == null || a.onAutoClose.call(a, a), $();
316
+ }, U.current)), () => clearTimeout(e);
317
+ }, [
318
+ m,
319
+ s,
320
+ a,
321
+ G,
322
+ we,
323
+ $
324
+ ]), e.useEffect(() => {
325
+ a.delete && ($(), a.onDismiss == null || a.onDismiss.call(a, a));
326
+ }, [$, a.delete]);
327
+ function Ee() {
328
+ return k?.loading ? /*#__PURE__*/ e.createElement("div", {
329
+ className: S(O?.loader, a?.classNames?.loader, "sonner-loader"),
330
+ "data-visible": G === "loading"
331
+ }, k.loading) : /*#__PURE__*/ e.createElement(i, {
332
+ className: S(O?.loader, a?.classNames?.loader),
333
+ visible: G === "loading"
334
+ });
335
+ }
336
+ let De = a.icon || k?.[G] || n(G);
337
+ return /*#__PURE__*/ e.createElement("li", {
338
+ tabIndex: 0,
339
+ ref: W,
340
+ className: S(ne, ge, O?.toast, a?.classNames?.toast, O?.[he], a?.classNames?.[he]),
341
+ "data-sonner-toast": "",
342
+ "data-rich-colors": a.richColors ?? g,
343
+ "data-styled": !(a.jsx || a.unstyled || o),
344
+ "data-mounted": P,
345
+ "data-promise": !!a.promise,
346
+ "data-swiped": ce,
347
+ "data-removed": I,
348
+ "data-visible": me,
349
+ "data-y-position": xe,
350
+ "data-x-position": Se,
351
+ "data-index": f,
352
+ "data-front": pe,
353
+ "data-swiping": R,
354
+ "data-dismissible": K,
355
+ "data-type": G,
356
+ "data-invert": Te,
357
+ "data-swipe-out": B,
358
+ "data-swipe-direction": M,
359
+ "data-expanded": !!(m || D && P),
360
+ "data-testid": a.testId,
361
+ style: {
362
+ "--index": f,
363
+ "--toasts-before": f,
364
+ "--z-index": p.length - f,
365
+ "--offset": `${I ? ue : Y.current}px`,
366
+ "--initial-height": D ? "auto" : `${de}px`,
367
+ ...y,
368
+ ...a.style
369
+ },
370
+ onDragEnd: () => {
371
+ z(!1), j(null), X.current = null;
372
+ },
373
+ onPointerDown: (e) => {
374
+ e.button !== 2 && !Q && K && (fe.current = /* @__PURE__ */ new Date(), V(Y.current), e.target.setPointerCapture(e.pointerId), e.target.tagName !== "BUTTON" && (z(!0), X.current = {
375
+ x: e.clientX,
376
+ y: e.clientY
377
+ }));
378
+ },
379
+ onPointerUp: () => {
380
+ if (B || !K) return;
381
+ X.current = null;
382
+ let e = Number(W.current?.style.getPropertyValue("--swipe-amount-x").replace("px", "") || 0), t = Number(W.current?.style.getPropertyValue("--swipe-amount-y").replace("px", "") || 0), n = (/* @__PURE__ */ new Date()).getTime() - fe.current?.getTime(), r = A === "x" ? e : t, i = Math.abs(r) / n;
383
+ if ((A === "x" ? Z.includes(e > 0 ? "right" : "left") : Z.includes(t > 0 ? "bottom" : "top")) && (Math.abs(r) >= re || i > .11)) V(Y.current), a.onDismiss == null || a.onDismiss.call(a, a), N(A === "x" ? e > 0 ? "right" : "left" : t > 0 ? "down" : "up"), $(), se(!0);
384
+ else {
385
+ var o, s;
386
+ (o = W.current) == null || o.style.setProperty("--swipe-amount-x", "0px"), (s = W.current) == null || s.style.setProperty("--swipe-amount-y", "0px"), le(!1), z(!1), j(null);
387
+ }
388
+ },
389
+ onPointerMove: (e) => {
390
+ var t, n;
391
+ if (!X.current || !K || window.getSelection()?.toString().length > 0) return;
392
+ let r = e.clientY - X.current.y, i = e.clientX - X.current.x;
393
+ !A && (Math.abs(i) > 1 || Math.abs(r) > 1) && j(Math.abs(i) > Math.abs(r) ? "x" : "y");
394
+ let a = {
395
+ x: 0,
396
+ y: 0
397
+ }, o = (e) => 1 / (1.5 + Math.abs(e) / 20);
398
+ if (A === "y") {
399
+ if (Z.includes("top") || Z.includes("bottom")) {
400
+ if (Z.includes("top") && r < 0 || Z.includes("bottom") && r > 0) a.y = r;
401
+ else {
402
+ let e = r * o(r);
403
+ a.y = Math.abs(e) < Math.abs(r) ? e : r;
404
+ }
405
+ }
406
+ } else if (A === "x" && (Z.includes("left") || Z.includes("right"))) {
407
+ if (Z.includes("left") && i < 0 || Z.includes("right") && i > 0) a.x = i;
408
+ else {
409
+ let e = i * o(i);
410
+ a.x = Math.abs(e) < Math.abs(i) ? e : i;
411
+ }
412
+ }
413
+ (Math.abs(a.x) > 0 || Math.abs(a.y) > 0) && le(!0), (t = W.current) == null || t.style.setProperty("--swipe-amount-x", `${a.x}px`), (n = W.current) == null || n.style.setProperty("--swipe-amount-y", `${a.y}px`);
414
+ }
415
+ }, ve && !a.jsx && G !== "loading" ? /*#__PURE__*/ e.createElement("button", {
416
+ "aria-label": oe,
417
+ "data-disabled": Q,
418
+ "data-close-button": !0,
419
+ onClick: Q || !K ? () => {} : () => {
420
+ $(), a.onDismiss == null || a.onDismiss.call(a, a);
421
+ },
422
+ className: S(O?.closeButton, a?.classNames?.closeButton)
423
+ }, k?.close ?? ee) : null, (G || a.icon || a.promise) && a.icon !== null && (k?.[G] !== null || a.icon) ? /*#__PURE__*/ e.createElement("div", {
424
+ "data-icon": "",
425
+ className: S(O?.icon, a?.classNames?.icon)
426
+ }, G === "loading" ? a.icon || Ee() : a.promise ? Ee() : null, G === "loading" ? null : De) : null, /*#__PURE__*/ e.createElement("div", {
427
+ "data-content": "",
428
+ className: S(O?.content, a?.classNames?.content)
429
+ }, /*#__PURE__*/ e.createElement("div", {
430
+ "data-title": "",
431
+ className: S(O?.title, a?.classNames?.title)
432
+ }, a.jsx ? a.jsx : typeof a.title == "function" ? a.title() : a.title), a.description ? /*#__PURE__*/ e.createElement("div", {
433
+ "data-description": "",
434
+ className: S(ae, _e, O?.description, a?.classNames?.description)
435
+ }, typeof a.description == "function" ? a.description() : a.description) : null), /*#__PURE__*/ e.isValidElement(a.cancel) ? a.cancel : a.cancel && _(a.cancel) ? /*#__PURE__*/ e.createElement("button", {
436
+ "data-button": !0,
437
+ "data-cancel": !0,
438
+ style: a.cancelButtonStyle || b,
439
+ onClick: (e) => {
440
+ _(a.cancel) && K && (a.cancel.onClick == null || a.cancel.onClick.call(a.cancel, e), $());
441
+ },
442
+ className: S(O?.cancelButton, a?.classNames?.cancelButton)
443
+ }, a.cancel.label) : null, /*#__PURE__*/ e.isValidElement(a.action) ? a.action : a.action && _(a.action) ? /*#__PURE__*/ e.createElement("button", {
444
+ "data-button": !0,
445
+ "data-action": !0,
446
+ style: a.actionButtonStyle || te,
447
+ onClick: (e) => {
448
+ _(a.action) && (a.action.onClick == null || a.action.onClick.call(a.action, e), !e.defaultPrevented && $());
449
+ },
450
+ className: S(O?.actionButton, a?.classNames?.actionButton)
451
+ }, a.action.label) : null);
452
+ };
453
+ function w() {
454
+ if (typeof window > "u" || typeof document > "u") return "ltr";
455
+ let e = document.documentElement.getAttribute("dir");
456
+ return e === "auto" || !e ? window.getComputedStyle(document.documentElement).direction : e;
457
+ }
458
+ function T(e, t) {
459
+ let n = {};
460
+ return [e, t].forEach((e, t) => {
461
+ let r = t === 1, i = r ? "--mobile-offset" : "--offset", a = r ? b : y;
462
+ function o(e) {
463
+ [
464
+ "top",
465
+ "right",
466
+ "bottom",
467
+ "left"
468
+ ].forEach((t) => {
469
+ n[`${i}-${t}`] = typeof e == "number" ? `${e}px` : e;
470
+ });
471
+ }
472
+ typeof e == "number" || typeof e == "string" ? o(e) : typeof e == "object" ? [
473
+ "top",
474
+ "right",
475
+ "bottom",
476
+ "left"
477
+ ].forEach((t) => {
478
+ e[t] === void 0 ? n[`${i}-${t}`] = a : n[`${i}-${t}`] = typeof e[t] == "number" ? `${e[t]}px` : e[t];
479
+ }) : o(a);
480
+ }), n;
481
+ }
482
+ var E = /*#__PURE__*/ e.forwardRef(function(n, r) {
483
+ let { id: i, invert: a, position: o = "bottom-right", hotkey: s = ["altKey", "KeyT"], expand: c, closeButton: ee, className: l, offset: u, mobileOffset: d, theme: f = "light", richColors: m, duration: h, style: g, visibleToasts: _ = v, toastOptions: y, dir: b = w(), gap: x = ne, icons: re, customAriaLabel: ie, containerAriaLabel: S = "Notifications" } = n, [C, E] = e.useState([]), D = e.useMemo(() => i ? C.filter((e) => e.toasterId === i) : C.filter((e) => !e.toasterId), [C, i]), O = e.useMemo(() => Array.from(new Set([o].concat(D.filter((e) => e.position).map((e) => e.position)))), [D, o]), [k, oe] = e.useState([]), [A, j] = e.useState(!1), [M, N] = e.useState(!1), [P, F] = e.useState(f === "system" ? typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : f), I = e.useRef(null), L = s.join("+").replace(/Key/g, "").replace(/Digit/g, ""), R = e.useRef(null), z = e.useRef(!1), B = e.useCallback((e) => {
484
+ E((t) => (t.find((t) => t.id === e.id)?.delete || p.dismiss(e.id), t.filter(({ id: t }) => t !== e.id)));
485
+ }, []);
486
+ return e.useEffect(() => p.subscribe((e) => {
487
+ e.dismiss ? requestAnimationFrame(() => {
488
+ E((t) => t.map((t) => t.id === e.id ? {
489
+ ...t,
490
+ delete: !0
491
+ } : t));
492
+ }) : setTimeout(() => {
493
+ t.flushSync(() => {
494
+ E((t) => {
495
+ let n = t.findIndex((t) => t.id === e.id);
496
+ return n === -1 ? [e, ...t] : [
497
+ ...t.slice(0, n),
498
+ {
499
+ ...t[n],
500
+ ...e
501
+ },
502
+ ...t.slice(n + 1)
503
+ ];
504
+ });
505
+ });
506
+ });
507
+ }), []), e.useEffect(() => {
508
+ if (f !== "system") {
509
+ F(f);
510
+ return;
511
+ }
512
+ if (f === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? F("dark") : F("light")), typeof window > "u") return;
513
+ let e = window.matchMedia("(prefers-color-scheme: dark)");
514
+ try {
515
+ e.addEventListener("change", ({ matches: e }) => {
516
+ F(e ? "dark" : "light");
517
+ });
518
+ } catch {
519
+ e.addListener(({ matches: e }) => {
520
+ try {
521
+ F(e ? "dark" : "light");
522
+ } catch (e) {
523
+ console.error(e);
524
+ }
525
+ });
526
+ }
527
+ }, [f]), e.useEffect(() => {
528
+ C.length <= 1 && j(!1);
529
+ }, [C]), e.useEffect(() => {
530
+ let e = (e) => {
531
+ if (s.length > 0 && s.every((t) => e[t] || e.code === t)) {
532
+ var t;
533
+ j(!0), (t = I.current) == null || t.focus();
534
+ }
535
+ e.code === "Escape" && (document.activeElement === I.current || I.current?.contains(document.activeElement)) && j(!1);
536
+ };
537
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
538
+ }, [s]), e.useEffect(() => {
539
+ if (I.current) return () => {
540
+ R.current && (R.current.focus({ preventScroll: !0 }), R.current = null, z.current = !1);
541
+ };
542
+ }, [I.current]), /*#__PURE__*/ e.createElement("section", {
543
+ ref: r,
544
+ "aria-label": ie ?? `${S} ${L}`,
545
+ tabIndex: -1,
546
+ "aria-live": "polite",
547
+ "aria-relevant": "additions text",
548
+ "aria-atomic": "false",
549
+ suppressHydrationWarning: !0,
550
+ "data-react-aria-top-layer": !0
551
+ }, O.map((t, r) => {
552
+ let [i, o] = t.split("-");
553
+ return D.length ? /*#__PURE__*/ e.createElement("ol", {
554
+ key: t,
555
+ dir: b === "auto" ? w() : b,
556
+ tabIndex: -1,
557
+ ref: I,
558
+ className: l,
559
+ "data-sonner-toaster": !0,
560
+ "data-sonner-theme": P,
561
+ "data-y-position": i,
562
+ "data-x-position": o,
563
+ style: {
564
+ "--front-toast-height": `${k[0]?.height || 0}px`,
565
+ "--width": `${te}px`,
566
+ "--gap": `${x}px`,
567
+ ...g,
568
+ ...T(u, d)
569
+ },
570
+ onBlur: (e) => {
571
+ z.current && !e.currentTarget.contains(e.relatedTarget) && (z.current = !1, R.current &&= (R.current.focus({ preventScroll: !0 }), null));
572
+ },
573
+ onFocus: (e) => {
574
+ e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" || z.current || (z.current = !0, R.current = e.relatedTarget);
575
+ },
576
+ onMouseEnter: () => j(!0),
577
+ onMouseMove: () => j(!0),
578
+ onMouseLeave: () => {
579
+ M || j(!1);
580
+ },
581
+ onDragEnd: () => j(!1),
582
+ onPointerDown: (e) => {
583
+ e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" || N(!0);
584
+ },
585
+ onPointerUp: () => N(!1)
586
+ }, D.filter((e) => !e.position && r === 0 || e.position === t).map((r, i) => /*#__PURE__*/ e.createElement(ae, {
587
+ key: r.id,
588
+ icons: re,
589
+ index: i,
590
+ toast: r,
591
+ defaultRichColors: m,
592
+ duration: y?.duration ?? h,
593
+ className: y?.className,
594
+ descriptionClassName: y?.descriptionClassName,
595
+ invert: a,
596
+ visibleToasts: _,
597
+ closeButton: y?.closeButton ?? ee,
598
+ interacting: M,
599
+ position: t,
600
+ style: y?.style,
601
+ unstyled: y?.unstyled,
602
+ classNames: y?.classNames,
603
+ cancelButtonStyle: y?.cancelButtonStyle,
604
+ actionButtonStyle: y?.actionButtonStyle,
605
+ closeButtonAriaLabel: y?.closeButtonAriaLabel,
606
+ removeToast: B,
607
+ toasts: D.filter((e) => e.position == r.position),
608
+ heights: k.filter((e) => e.position == r.position),
609
+ setHeights: oe,
610
+ expandByDefault: c,
611
+ gap: x,
612
+ expanded: A,
613
+ swipeDirections: n.swipeDirections
614
+ }))) : null;
615
+ }));
616
+ });
617
+ export { g as n, E as t };
@@ -1,9 +1,9 @@
1
- import { u as e } from "./comment-kit-core-Bsyydwpk.js";
1
+ import { u as e } from "./comment-kit-core-D068rcdY.js";
2
2
  import { a as t, i as n, m as r, n as i, o as a } from "./dom-Bhf4WFtY.js";
3
- import { n as o } from "./dist-De294MVF.js";
4
- import { t as s } from "./button-By0hGrJK.js";
3
+ import { n as o } from "./dist-D9A5k-N4.js";
4
+ import { t as s } from "./button-D4GHW6oZ.js";
5
5
  import { t as c } from "./createReactComponent-BZHeRbD0.js";
6
- import { G as l, K as ee, S as te, V as u, n as ne } from "./comment-kit-ui-qKjCHHOy.js";
6
+ import { G as l, K as ee, S as te, V as u, n as ne } from "./comment-kit-ui-BDzNt0jv.js";
7
7
  import * as d from "react";
8
8
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
9
9
  var re = c("outline", "paperclip", "Paperclip", [["path", {
@@ -1,5 +1,5 @@
1
- import { o as e } from "./websocket-manager-DGN8T9mq.js";
2
- import { u as t } from "./comment-kit-core-Bsyydwpk.js";
1
+ import { o as e } from "./websocket-manager-CvgZSo_L.js";
2
+ import { u as t } from "./comment-kit-core-D068rcdY.js";
3
3
  import { n } from "./errors-Bu5ajEmB.js";
4
4
  var r = null, i = /* @__PURE__ */ new Set();
5
5
  function a() {
@@ -150,9 +150,9 @@ async function b(e, r = {}) {
150
150
  import("react"),
151
151
  import("react-dom/client"),
152
152
  import("./styles-CnYsLS2f.js"),
153
- import("./shadow-root-DlfbvZF9.js"),
153
+ import("./shadow-root-3-yGIhMs.js"),
154
154
  import("./error-boundary-D3PD74vI.js"),
155
- import("./comment-kit-ui-qKjCHHOy.js").then((e) => e.t)
155
+ import("./comment-kit-ui-BDzNt0jv.js").then((e) => e.t)
156
156
  ]);
157
157
  if (!h || t !== w) return;
158
158
  let f = g(n, "createElement"), p = g(r, "createRoot"), m = l.ShadowContainer, _ = u.ErrorBoundary;
@@ -1,4 +1,4 @@
1
- import { a as e } from "./websocket-manager-DGN8T9mq.js";
1
+ import { a as e } from "./websocket-manager-CvgZSo_L.js";
2
2
  var t = /* @__PURE__ */ e(((e, t) => {
3
3
  (function(n, r) {
4
4
  typeof e == "object" && typeof t == "object" ? t.exports = r() : typeof define == "function" && define.amd ? define([], r) : typeof e == "object" ? e.Pusher = r() : n.Pusher = r();