@refraction-ui/react 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form.cjs +1 -0
- package/dist/form.js +1 -0
- package/dist/index.cjs +1807 -473
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2084 -766
- package/dist/index.js.map +1 -1
- package/dist/internal/conversation/index.d.cts +235 -0
- package/dist/internal/conversation/index.d.ts +235 -0
- package/dist/internal/cookie-consent/index.d.cts +77 -0
- package/dist/internal/cookie-consent/index.d.ts +77 -0
- package/dist/internal/react-conversation/index.d.cts +97 -0
- package/dist/internal/react-conversation/index.d.ts +97 -0
- package/dist/internal/react-cookie-consent/index.d.cts +46 -0
- package/dist/internal/react-cookie-consent/index.d.ts +46 -0
- package/dist/theme.cjs +1 -0
- package/dist/theme.js +1 -0
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
var React11 = require('react');
|
|
@@ -24667,12 +24668,12 @@ function nr(t2) {
|
|
|
24667
24668
|
function Or(t2, e2) {
|
|
24668
24669
|
var { organization: i2, projectId: r2, prefix: s2, severityAllowList: n2 = ["error"], sendExceptionsToPostHog: o2 = true } = void 0 === e2 ? {} : e2;
|
|
24669
24670
|
return (e3) => {
|
|
24670
|
-
var a2, l2, u2,
|
|
24671
|
+
var a2, l2, u2, h5, d2;
|
|
24671
24672
|
if ("*" !== n2 && !n2.includes(e3.level) || !t2.__loaded) return e3;
|
|
24672
24673
|
e3.tags || (e3.tags = {});
|
|
24673
24674
|
var v2 = t2.requestRouter.endpointFor("ui", "/project/" + t2.config.token + "/person/" + t2.get_distinct_id());
|
|
24674
24675
|
e3.tags["PostHog Person URL"] = v2, t2.sessionRecordingStarted() && (e3.tags["PostHog Recording URL"] = t2.get_session_replay_url({ withTimestamp: true }));
|
|
24675
|
-
var c2, p2 = (null == (a2 = e3.exception) ? void 0 : a2.values) || [], _2 = p2.map(((t3) => f({}, t3, { stacktrace: t3.stacktrace ? f({}, t3.stacktrace, { type: "raw", frames: (t3.stacktrace.frames || []).map(((t4) => f({}, t4, { platform: "web:javascript" }))) }) : void 0 }))), g2 = { $exception_message: (null == (l2 = p2[0]) ? void 0 : l2.value) || e3.message, $exception_type: null == (u2 = p2[0]) ? void 0 : u2.type, $exception_level: e3.level, $exception_list: _2, $sentry_event_id: e3.event_id, $sentry_exception: e3.exception, $sentry_exception_message: (null == (
|
|
24676
|
+
var c2, p2 = (null == (a2 = e3.exception) ? void 0 : a2.values) || [], _2 = p2.map(((t3) => f({}, t3, { stacktrace: t3.stacktrace ? f({}, t3.stacktrace, { type: "raw", frames: (t3.stacktrace.frames || []).map(((t4) => f({}, t4, { platform: "web:javascript" }))) }) : void 0 }))), g2 = { $exception_message: (null == (l2 = p2[0]) ? void 0 : l2.value) || e3.message, $exception_type: null == (u2 = p2[0]) ? void 0 : u2.type, $exception_level: e3.level, $exception_list: _2, $sentry_event_id: e3.event_id, $sentry_exception: e3.exception, $sentry_exception_message: (null == (h5 = p2[0]) ? void 0 : h5.value) || e3.message, $sentry_exception_type: null == (d2 = p2[0]) ? void 0 : d2.type, $sentry_tags: e3.tags };
|
|
24676
24677
|
return i2 && r2 && (g2.$sentry_url = (s2 || "https://sentry.io/organizations/") + i2 + "/issues/?project=" + r2 + "&query=" + e3.event_id), o2 && (null == (c2 = t2.exceptions) || c2.sendExceptionEvent(g2)), e3;
|
|
24677
24678
|
};
|
|
24678
24679
|
}
|
|
@@ -24755,31 +24756,31 @@ function Zs(t2, e2) {
|
|
|
24755
24756
|
i2.p(t2);
|
|
24756
24757
|
var s2, n2, o2, a2, l2, u2 = (a2 = 10 + ((s2 = e2).filename && s2.filename.length + 1 || 0), l2 = 8, (function(t3, e3, i3, r3, s3, n3) {
|
|
24757
24758
|
var o3 = t3.length, a3 = new xs(r3 + o3 + 5 * (1 + Math.floor(o3 / 7e3)) + s3), l3 = a3.subarray(r3, a3.length - s3), u3 = 0;
|
|
24758
|
-
if (!e3 || 8 > o3) for (var
|
|
24759
|
-
var d2 =
|
|
24760
|
-
o3 > d2 ? u3 = Ys(l3, u3, t3.subarray(
|
|
24759
|
+
if (!e3 || 8 > o3) for (var h6 = 0; o3 >= h6; h6 += 65535) {
|
|
24760
|
+
var d2 = h6 + 65535;
|
|
24761
|
+
o3 > d2 ? u3 = Ys(l3, u3, t3.subarray(h6, d2)) : (l3[h6] = true, u3 = Ys(l3, u3, t3.subarray(h6, o3)));
|
|
24761
24762
|
}
|
|
24762
24763
|
else {
|
|
24763
24764
|
for (var v2 = Ks[e3 - 1], c2 = v2 >>> 13, p2 = 8191 & v2, f2 = (1 << i3) - 1, _2 = new Es(32768), g2 = new Es(f2 + 1), m2 = Math.ceil(i3 / 3), b2 = 2 * m2, y2 = function(e4) {
|
|
24764
24765
|
return (t3[e4] ^ t3[e4 + 1] << m2 ^ t3[e4 + 2] << b2) & f2;
|
|
24765
|
-
}, w2 = new Ss(25e3), x2 = new Es(288), E2 = new Es(32), S2 = 0, T2 = 0, k2 = (
|
|
24766
|
-
var O2 = y2(
|
|
24767
|
-
if (_2[I2] = C2, g2[O2] = I2,
|
|
24768
|
-
var A2 = o3 -
|
|
24766
|
+
}, w2 = new Ss(25e3), x2 = new Es(288), E2 = new Es(32), S2 = 0, T2 = 0, k2 = (h6 = 0, 0), R2 = 0, P2 = 0; o3 > h6; ++h6) {
|
|
24767
|
+
var O2 = y2(h6), I2 = 32767 & h6, C2 = g2[O2];
|
|
24768
|
+
if (_2[I2] = C2, g2[O2] = I2, h6 >= R2) {
|
|
24769
|
+
var A2 = o3 - h6;
|
|
24769
24770
|
if ((S2 > 7e3 || k2 > 24576) && A2 > 423) {
|
|
24770
|
-
u3 = Js(t3, l3, 0, w2, x2, E2, T2, k2, P2,
|
|
24771
|
+
u3 = Js(t3, l3, 0, w2, x2, E2, T2, k2, P2, h6 - P2, u3), k2 = S2 = T2 = 0, P2 = h6;
|
|
24771
24772
|
for (var F3 = 0; 286 > F3; ++F3) x2[F3] = 0;
|
|
24772
24773
|
for (F3 = 0; 30 > F3; ++F3) E2[F3] = 0;
|
|
24773
24774
|
}
|
|
24774
24775
|
var M3 = 2, D2 = 0, U2 = p2, L2 = I2 - C2 & 32767;
|
|
24775
|
-
if (A2 > 2 && O2 == y2(
|
|
24776
|
-
if (t3[
|
|
24777
|
-
for (var B2 = 0; z2 > B2 && t3[
|
|
24776
|
+
if (A2 > 2 && O2 == y2(h6 - L2)) for (var N2 = Math.min(c2, A2) - 1, j2 = Math.min(32767, h6), z2 = Math.min(258, A2); j2 >= L2 && --U2 && I2 != C2; ) {
|
|
24777
|
+
if (t3[h6 + M3] == t3[h6 + M3 - L2]) {
|
|
24778
|
+
for (var B2 = 0; z2 > B2 && t3[h6 + B2] == t3[h6 + B2 - L2]; ++B2) ;
|
|
24778
24779
|
if (B2 > M3) {
|
|
24779
24780
|
if (M3 = B2, D2 = L2, B2 > N2) break;
|
|
24780
24781
|
var H2 = Math.min(L2, B2 - 2), q2 = 0;
|
|
24781
24782
|
for (F3 = 0; H2 > F3; ++F3) {
|
|
24782
|
-
var V2 =
|
|
24783
|
+
var V2 = h6 - L2 + F3 + 32768 & 32767, W2 = V2 - _2[V2] + 32768 & 32767;
|
|
24783
24784
|
W2 > q2 && (q2 = W2, C2 = V2);
|
|
24784
24785
|
}
|
|
24785
24786
|
}
|
|
@@ -24789,21 +24790,21 @@ function Zs(t2, e2) {
|
|
|
24789
24790
|
if (D2) {
|
|
24790
24791
|
w2[k2++] = 268435456 | Os[M3] << 18 | Is[D2];
|
|
24791
24792
|
var G2 = 31 & Os[M3], Y2 = 31 & Is[D2];
|
|
24792
|
-
T2 += $s[G2] + Ts[Y2], ++x2[257 + G2], ++E2[Y2], R2 =
|
|
24793
|
-
} else w2[k2++] = t3[
|
|
24793
|
+
T2 += $s[G2] + Ts[Y2], ++x2[257 + G2], ++E2[Y2], R2 = h6 + M3, ++S2;
|
|
24794
|
+
} else w2[k2++] = t3[h6], ++x2[t3[h6]];
|
|
24794
24795
|
}
|
|
24795
24796
|
}
|
|
24796
|
-
u3 = Js(t3, l3, true, w2, x2, E2, T2, k2, P2,
|
|
24797
|
+
u3 = Js(t3, l3, true, w2, x2, E2, T2, k2, P2, h6 - P2, u3);
|
|
24797
24798
|
}
|
|
24798
24799
|
return zs(a3, 0, r3 + js(u3) + s3);
|
|
24799
|
-
})(n2 = t2, null == (o2 = e2).level ? 6 : o2.level, null == o2.mem ? Math.ceil(1.5 * Math.max(8, Math.min(13, Math.log(n2.length)))) : 12 + o2.mem, a2, l2)),
|
|
24800
|
+
})(n2 = t2, null == (o2 = e2).level ? 6 : o2.level, null == o2.mem ? Math.ceil(1.5 * Math.max(8, Math.min(13, Math.log(n2.length)))) : 12 + o2.mem, a2, l2)), h5 = u2.length;
|
|
24800
24801
|
return (function(t3, e3) {
|
|
24801
24802
|
var i3 = e3.filename;
|
|
24802
24803
|
if (t3[0] = 31, t3[1] = 139, t3[2] = 8, t3[8] = 2 > e3.level ? 4 : 9 == e3.level ? 2 : 0, t3[9] = 3, 0 != e3.mtime && Qs(t3, 4, Math.floor(new Date(e3.mtime || Date.now()) / 1e3)), i3) {
|
|
24803
24804
|
t3[3] = 8;
|
|
24804
24805
|
for (var r3 = 0; i3.length >= r3; ++r3) t3[r3 + 10] = i3.charCodeAt(r3);
|
|
24805
24806
|
}
|
|
24806
|
-
})(u2, e2), Qs(u2,
|
|
24807
|
+
})(u2, e2), Qs(u2, h5 - 8, i2.d()), Qs(u2, h5 - 4, r2), u2;
|
|
24807
24808
|
}
|
|
24808
24809
|
function Sn(t2, e2, i2) {
|
|
24809
24810
|
return on({ distinct_id: t2, userPropertiesToSet: e2, userPropertiesToSetOnce: i2 });
|
|
@@ -24941,13 +24942,13 @@ function No(t2) {
|
|
|
24941
24942
|
function jo(e2, i2) {
|
|
24942
24943
|
var r2, s2, { e: n2, maskAllElementAttributes: o2, maskAllText: a2, elementAttributeIgnoreList: l2, elementsChainAsString: u2 } = i2;
|
|
24943
24944
|
if (!so(e2)) return { props: {} };
|
|
24944
|
-
for (var
|
|
24945
|
+
for (var h5 = [e2], d2 = e2; d2.parentNode && !no(d2, "body"); ) if (ao(d2.parentNode)) h5.push(d2.parentNode.host), d2 = d2.parentNode.host;
|
|
24945
24946
|
else {
|
|
24946
24947
|
if (!so(d2.parentNode)) break;
|
|
24947
|
-
|
|
24948
|
+
h5.push(d2.parentNode), d2 = d2.parentNode;
|
|
24948
24949
|
}
|
|
24949
24950
|
var v2, c2, p2 = [], _2 = {}, g2 = false, m2 = false;
|
|
24950
|
-
if (Ki(
|
|
24951
|
+
if (Ki(h5, ((t2) => {
|
|
24951
24952
|
var e3 = xo(t2);
|
|
24952
24953
|
if (no(t2, "a")) {
|
|
24953
24954
|
var i3 = t2.getAttribute("href");
|
|
@@ -25050,7 +25051,7 @@ function sa(t2, e2, i2) {
|
|
|
25050
25051
|
return false;
|
|
25051
25052
|
}
|
|
25052
25053
|
}
|
|
25053
|
-
var t, e, i, r, s, n, o, a, l, u,
|
|
25054
|
+
var t, e, i, r, s, n, o, a, l, u, h4, d, v, g, m, b, y, w, x, E, S, k, R, O, I, C, A, F2, M2, D, U, L, N, j, z, B, H, q, V, W, G, Y, Q, Z, tt, it, rt, st, nt, ot, at, lt, ut, ht, dt, vt, ct, pt, ft, _t, gt, mt, bt, yt, wt, xt, Et, St, $t, Tt, kt, Rt, Pt, Ot, It, Ct, At, Ft, Mt, Dt, Ut, Lt, Nt, jt, zt, Bt, Ht, qt, Vt, Wt, Gt, Yt, Jt, Kt, Xt, Qt, Zt, te, ee, ie, re, ae, le, he, de, ve, ce, pe, fe, _e, ge, me, be, ye, we, xe, Ee, Se, Te, ke, Re, Pe, Oe, Ie, Ce, Ae, Me, Ue, Le, Ne, je, ze, Be, He, qe, Ve, We, Ge, Ye, Je, Ke, Xe, Qe, Ze, ti, ei, ii, ri, si, ni, oi, ai, li, ui, hi, di, vi, ci, pi, fi, _i, gi, mi, bi, yi, wi, xi, Ei, Si, $i, Ti, ki, Ri, Pi, Oi, Ii, Ci, Ai, Fi, Mi, Di, Ui, Li, Ni, ji, zi, Bi, Hi, qi, Vi, Wi, Gi, Yi, Xi, Zi, tr, er, ir, or, ar, lr, ur, hr, dr, vr, cr, pr, fr, _r, gr, mr, br, yr, wr, xr, Er, Sr, $r, Tr, kr, Rr, Pr, Ir, Cr, Ar, Fr, Mr, Dr, Ur, Lr, Nr, jr, zr, Br, Hr, Yr, ts, es, is, rs, ss, ns, os, as, ls, us, hs, ds, vs, cs, ps, fs, _s, gs, ms, bs, ys, ws, xs, Es, Ss, $s, Ts, ks, Rs, Ps, Os, Fs, Is, Cs, As, Ms, Ds, Us, Ls, Ns, js, zs, Bs, Hs, qs, Vs, Ws, Gs, Ys, Js, Ks, Xs, Qs, tn, en, rn, sn, nn, on, an, ln, un, hn, dn, vn, cn2, pn, fn, _n, gn, mn, bn, yn, wn, xn, En, $n, Tn, Rn, Pn, On, In, Cn, An, Fn, Mn, Dn, Un, Ln, Nn, jn, zn, Bn, Hn, qn, Vn, Wn, Gn, Yn, Jn, Kn, Xn, Qn, Zn, to, eo, io, fo, mo, bo, yo, wo, So, $o, To, ko, Ro, Po, Mo, Do, Uo, zo, Ho, qo, Vo, Wo, Go, Yo, Jo, Ko, Xo, Qo, ta, ea, ia, ra, na, oa, aa, la, ua, ha, da, va, ca, pa, fa, _a12, ga, ma, ba, ya, wa, xa, Ea, Sa, $a, Ta, ka, Ra, Pa, Oa, Ia, Ca, Aa, Fa, Ma, Da, Ua, La;
|
|
25054
25055
|
var init_module = __esm({
|
|
25055
25056
|
"../../node_modules/.pnpm/posthog-js@1.373.5/node_modules/posthog-js/dist/module.js"() {
|
|
25056
25057
|
t = "undefined" != typeof window ? window : void 0;
|
|
@@ -25065,7 +25066,7 @@ var init_module = __esm({
|
|
|
25065
25066
|
a = null == e ? void 0 : e.AbortController;
|
|
25066
25067
|
l = null == e ? void 0 : e.CompressionStream;
|
|
25067
25068
|
u = null == i ? void 0 : i.userAgent;
|
|
25068
|
-
|
|
25069
|
+
h4 = null != t ? t : {};
|
|
25069
25070
|
d = "1.373.5";
|
|
25070
25071
|
v = { DEBUG: false, LIB_VERSION: d, LIB_NAME: "web", JS_SDK_VERSION: d };
|
|
25071
25072
|
m = (function(t2) {
|
|
@@ -25560,7 +25561,7 @@ var init_module = __esm({
|
|
|
25560
25561
|
};
|
|
25561
25562
|
Ue = function(e2, i2) {
|
|
25562
25563
|
var { debugEnabled: r2 } = void 0 === i2 ? {} : i2, s2 = { k(i3) {
|
|
25563
|
-
if (t && (v.DEBUG ||
|
|
25564
|
+
if (t && (v.DEBUG || h4.POSTHOG_DEBUG || r2) && !N(t.console) && t.console) {
|
|
25564
25565
|
for (var s3 = ("__rrweb_original__" in t.console[i3]) ? t.console[i3].__rrweb_original__ : t.console[i3], n2 = arguments.length, o2 = new Array(n2 > 1 ? n2 - 1 : 0), a2 = 1; n2 > a2; a2++) o2[a2 - 1] = arguments[a2];
|
|
25565
25566
|
s3(e2, ...o2);
|
|
25566
25567
|
}
|
|
@@ -25614,7 +25615,7 @@ var init_module = __esm({
|
|
|
25614
25615
|
};
|
|
25615
25616
|
null != r && r.body ? l2() : null == r || r.addEventListener("DOMContentLoaded", l2);
|
|
25616
25617
|
};
|
|
25617
|
-
|
|
25618
|
+
h4.__PosthogExtensions__ = h4.__PosthogExtensions__ || {}, h4.__PosthogExtensions__.loadExternalDependency = (t2, e2, i2) => {
|
|
25618
25619
|
if ("remote-config" !== e2) {
|
|
25619
25620
|
var r2;
|
|
25620
25621
|
if (t2.config.__preview_external_dependency_versioned_paths) r2 = t2.requestRouter.endpointFor("assets", "/static/" + t2.version + "/" + e2 + ".js");
|
|
@@ -25631,7 +25632,7 @@ var init_module = __esm({
|
|
|
25631
25632
|
var o2 = t2.requestRouter.endpointFor("assets", "/array/" + t2.config.token + "/config.js");
|
|
25632
25633
|
ze(t2, o2, i2);
|
|
25633
25634
|
}
|
|
25634
|
-
},
|
|
25635
|
+
}, h4.__PosthogExtensions__.loadSiteApp = (t2, e2, i2) => {
|
|
25635
25636
|
var r2 = t2.requestRouter.endpointFor("api", e2);
|
|
25636
25637
|
ze(t2, r2, i2);
|
|
25637
25638
|
};
|
|
@@ -25853,8 +25854,8 @@ var init_module = __esm({
|
|
|
25853
25854
|
u2.setTime(u2.getTime() + 864e5 * i2), o2 = "; expires=" + u2.toUTCString();
|
|
25854
25855
|
}
|
|
25855
25856
|
n2 && (a2 = "; secure");
|
|
25856
|
-
var
|
|
25857
|
-
return
|
|
25857
|
+
var h5 = t2 + "=" + encodeURIComponent(JSON.stringify(e2)) + o2 + "; SameSite=Lax; path=/" + l2 + a2;
|
|
25858
|
+
return h5.length > 3686.4 && Le.warn("cookieStore warning: large cookie, len=" + h5.length), r.cookie = h5, h5;
|
|
25858
25859
|
} catch (t3) {
|
|
25859
25860
|
return;
|
|
25860
25861
|
}
|
|
@@ -25999,7 +26000,7 @@ var init_module = __esm({
|
|
|
25999
26000
|
return this.ar;
|
|
26000
26001
|
}
|
|
26001
26002
|
rr() {
|
|
26002
|
-
return !!this.qt.respect_dnt && [null == i ? void 0 : i.doNotTrack, null == i ? void 0 : i.msDoNotTrack,
|
|
26003
|
+
return !!this.qt.respect_dnt && [null == i ? void 0 : i.doNotTrack, null == i ? void 0 : i.msDoNotTrack, h4.doNotTrack].some(((t2) => Z(t2)));
|
|
26003
26004
|
}
|
|
26004
26005
|
};
|
|
26005
26006
|
Sr = Ne("[Dead Clicks]");
|
|
@@ -26025,16 +26026,16 @@ var init_module = __esm({
|
|
|
26025
26026
|
}
|
|
26026
26027
|
lr(t2) {
|
|
26027
26028
|
var e2, i2;
|
|
26028
|
-
null != (e2 =
|
|
26029
|
+
null != (e2 = h4.__PosthogExtensions__) && e2.initDeadClicksAutocapture && t2(), null == (i2 = h4.__PosthogExtensions__) || null == i2.loadExternalDependency || i2.loadExternalDependency(this.instance, "dead-clicks-autocapture", ((e3) => {
|
|
26029
26030
|
e3 ? Sr.error("failed to load script", e3) : t2();
|
|
26030
26031
|
}));
|
|
26031
26032
|
}
|
|
26032
26033
|
hr() {
|
|
26033
26034
|
var t2;
|
|
26034
26035
|
if (r) {
|
|
26035
|
-
if (!this.ur && null != (t2 =
|
|
26036
|
+
if (!this.ur && null != (t2 = h4.__PosthogExtensions__) && t2.initDeadClicksAutocapture) {
|
|
26036
26037
|
var e2 = U(this.instance.config.capture_dead_clicks) ? this.instance.config.capture_dead_clicks : {};
|
|
26037
|
-
e2.__onCapture = this.onCapture, this.ur =
|
|
26038
|
+
e2.__onCapture = this.onCapture, this.ur = h4.__PosthogExtensions__.initDeadClicksAutocapture(this.instance, e2), this.ur.start(r), Sr.info("starting...");
|
|
26038
26039
|
}
|
|
26039
26040
|
} else Sr.error("`document` not found. Cannot start.");
|
|
26040
26041
|
}
|
|
@@ -26082,11 +26083,11 @@ var init_module = __esm({
|
|
|
26082
26083
|
if (!i2) return { $pageview_id: e2 };
|
|
26083
26084
|
var r2 = { $pageview_id: e2, $prev_pageview_id: i2.pageViewId }, s2 = this._instance.scrollManager.getContext();
|
|
26084
26085
|
if (s2 && !this._instance.config.disable_scroll_properties) {
|
|
26085
|
-
var { maxScrollHeight: n2, lastScrollY: o2, maxScrollY: a2, maxContentHeight: l2, lastContentY: u2, maxContentY:
|
|
26086
|
-
if (!(N(n2) || N(o2) || N(a2) || N(l2) || N(u2) || N(
|
|
26087
|
-
n2 = Math.ceil(n2), o2 = Math.ceil(o2), a2 = Math.ceil(a2), l2 = Math.ceil(l2), u2 = Math.ceil(u2),
|
|
26088
|
-
var d2 = n2 > 1 ? et(o2 / n2, 0, 1, Le) : 1, v2 = n2 > 1 ? et(a2 / n2, 0, 1, Le) : 1, c2 = l2 > 1 ? et(u2 / l2, 0, 1, Le) : 1, p2 = l2 > 1 ? et(
|
|
26089
|
-
r2 = Xi(r2, { $prev_pageview_last_scroll: o2, $prev_pageview_last_scroll_percentage: d2, $prev_pageview_max_scroll: a2, $prev_pageview_max_scroll_percentage: v2, $prev_pageview_last_content: u2, $prev_pageview_last_content_percentage: c2, $prev_pageview_max_content:
|
|
26086
|
+
var { maxScrollHeight: n2, lastScrollY: o2, maxScrollY: a2, maxContentHeight: l2, lastContentY: u2, maxContentY: h5 } = s2;
|
|
26087
|
+
if (!(N(n2) || N(o2) || N(a2) || N(l2) || N(u2) || N(h5))) {
|
|
26088
|
+
n2 = Math.ceil(n2), o2 = Math.ceil(o2), a2 = Math.ceil(a2), l2 = Math.ceil(l2), u2 = Math.ceil(u2), h5 = Math.ceil(h5);
|
|
26089
|
+
var d2 = n2 > 1 ? et(o2 / n2, 0, 1, Le) : 1, v2 = n2 > 1 ? et(a2 / n2, 0, 1, Le) : 1, c2 = l2 > 1 ? et(u2 / l2, 0, 1, Le) : 1, p2 = l2 > 1 ? et(h5 / l2, 0, 1, Le) : 1;
|
|
26090
|
+
r2 = Xi(r2, { $prev_pageview_last_scroll: o2, $prev_pageview_last_scroll_percentage: d2, $prev_pageview_max_scroll: a2, $prev_pageview_max_scroll_percentage: v2, $prev_pageview_last_content: u2, $prev_pageview_last_content_percentage: c2, $prev_pageview_max_content: h5, $prev_pageview_max_content_percentage: p2 });
|
|
26090
26091
|
}
|
|
26091
26092
|
}
|
|
26092
26093
|
return i2.pathname && (r2.$prev_pageview_pathname = i2.pathname), i2.timestamp && (r2.$prev_pageview_duration = (t2.getTime() - i2.timestamp.getTime()) / 1e3), r2;
|
|
@@ -26121,9 +26122,9 @@ var init_module = __esm({
|
|
|
26121
26122
|
};
|
|
26122
26123
|
Ur = function(t2, e2, i2) {
|
|
26123
26124
|
if (!t2 || !e2 || !e2.length) return t2;
|
|
26124
|
-
for (var r2 = t2.split("#"), s2 = r2[1], n2 = (r2[0] || "").split("?"), o2 = n2[1], a2 = n2[0], l2 = (o2 || "").split("&"), u2 = [],
|
|
26125
|
-
var d2 = l2[
|
|
26126
|
-
M2(d2) && (e2.includes(d2[0]) ? u2.push(d2[0] + "=" + i2) : u2.push(l2[
|
|
26125
|
+
for (var r2 = t2.split("#"), s2 = r2[1], n2 = (r2[0] || "").split("?"), o2 = n2[1], a2 = n2[0], l2 = (o2 || "").split("&"), u2 = [], h5 = 0; l2.length > h5; h5++) {
|
|
26126
|
+
var d2 = l2[h5].split("=");
|
|
26127
|
+
M2(d2) && (e2.includes(d2[0]) ? u2.push(d2[0] + "=" + i2) : u2.push(l2[h5]));
|
|
26127
26128
|
}
|
|
26128
26129
|
var v2 = a2;
|
|
26129
26130
|
return null != o2 && (v2 += "?" + u2.join("&")), null != s2 && (v2 += "#" + s2), v2;
|
|
@@ -26379,11 +26380,11 @@ var init_module = __esm({
|
|
|
26379
26380
|
}
|
|
26380
26381
|
get remoteConfig() {
|
|
26381
26382
|
var t2;
|
|
26382
|
-
return null == (t2 =
|
|
26383
|
+
return null == (t2 = h4._POSTHOG_REMOTE_CONFIG) || null == (t2 = t2[this._instance.config.token]) ? void 0 : t2.config;
|
|
26383
26384
|
}
|
|
26384
26385
|
Mr(t2) {
|
|
26385
26386
|
var e2, i2;
|
|
26386
|
-
null != (e2 =
|
|
26387
|
+
null != (e2 = h4.__PosthogExtensions__) && e2.loadExternalDependency ? null == (i2 = h4.__PosthogExtensions__) || null == i2.loadExternalDependency || i2.loadExternalDependency(this._instance, "remote-config", (() => t2(this.remoteConfig))) : t2();
|
|
26387
26388
|
}
|
|
26388
26389
|
Pr(t2) {
|
|
26389
26390
|
this._instance._send_request({ method: "GET", url: this._instance.requestRouter.endpointFor("assets", "/array/" + this._instance.config.token + "/config"), callback(e2) {
|
|
@@ -26452,7 +26453,7 @@ var init_module = __esm({
|
|
|
26452
26453
|
if (i2) {
|
|
26453
26454
|
o2 = new Es(1 << e2);
|
|
26454
26455
|
var l2 = 15 - e2;
|
|
26455
|
-
for (s2 = 0; r2 > s2; ++s2) if (t2[s2]) for (var u2 = s2 << 4 | t2[s2],
|
|
26456
|
+
for (s2 = 0; r2 > s2; ++s2) if (t2[s2]) for (var u2 = s2 << 4 | t2[s2], h5 = e2 - t2[s2], d2 = a2[t2[s2] - 1]++ << h5, v2 = d2 | (1 << h5) - 1; v2 >= d2; ++d2) o2[Cs[d2] >>> l2] = u2;
|
|
26456
26457
|
} else for (o2 = new Es(r2), s2 = 0; r2 > s2; ++s2) o2[s2] = Cs[a2[t2[s2] - 1]++] >>> 15 - t2[s2];
|
|
26457
26458
|
return o2;
|
|
26458
26459
|
};
|
|
@@ -26492,11 +26493,11 @@ var init_module = __esm({
|
|
|
26492
26493
|
i2.sort((function(t3, e3) {
|
|
26493
26494
|
return t3.f - e3.f;
|
|
26494
26495
|
})), i2.push({ s: -1, f: 25001 });
|
|
26495
|
-
var a2 = i2[0], l2 = i2[1], u2 = 0,
|
|
26496
|
-
for (i2[0] = { s: -1, f: a2.f + l2.f, l: a2, r: l2 };
|
|
26496
|
+
var a2 = i2[0], l2 = i2[1], u2 = 0, h5 = 1, d2 = 2;
|
|
26497
|
+
for (i2[0] = { s: -1, f: a2.f + l2.f, l: a2, r: l2 }; h5 != s2 - 1; ) a2 = i2[i2[d2].f > i2[u2].f ? u2++ : d2++], l2 = i2[u2 != h5 && i2[d2].f > i2[u2].f ? u2++ : d2++], i2[h5++] = { s: -1, f: a2.f + l2.f, l: a2, r: l2 };
|
|
26497
26498
|
var v2 = n2[0].s;
|
|
26498
26499
|
for (r2 = 1; s2 > r2; ++r2) n2[r2].s > v2 && (v2 = n2[r2].s);
|
|
26499
|
-
var c2 = new Es(v2 + 1), p2 = Vs(i2[
|
|
26500
|
+
var c2 = new Es(v2 + 1), p2 = Vs(i2[h5 - 1], c2, 0);
|
|
26500
26501
|
if (p2 > e2) {
|
|
26501
26502
|
r2 = 0;
|
|
26502
26503
|
var f2 = 0, _2 = p2 - e2, g2 = 1 << _2;
|
|
@@ -26550,30 +26551,30 @@ var init_module = __esm({
|
|
|
26550
26551
|
for (var n2 = 0; r2 > n2; ++n2) t2[s2 + n2 + 4] = i2[n2];
|
|
26551
26552
|
return 8 * (s2 + 4 + r2);
|
|
26552
26553
|
};
|
|
26553
|
-
Js = function(t2, e2, i2, r2, s2, n2, o2, a2, l2, u2,
|
|
26554
|
-
Bs(e2,
|
|
26554
|
+
Js = function(t2, e2, i2, r2, s2, n2, o2, a2, l2, u2, h5) {
|
|
26555
|
+
Bs(e2, h5++, i2), ++s2[256];
|
|
26555
26556
|
for (var d2 = qs(s2, 15), v2 = d2[0], c2 = d2[1], p2 = qs(n2, 15), f2 = p2[0], _2 = p2[1], g2 = Ws(v2), m2 = g2[0], b2 = g2[1], y2 = Ws(f2), w2 = y2[0], x2 = y2[1], E2 = new Es(19), S2 = 0; m2.length > S2; ++S2) E2[31 & m2[S2]]++;
|
|
26556
26557
|
for (S2 = 0; w2.length > S2; ++S2) E2[31 & w2[S2]]++;
|
|
26557
26558
|
for (var T2 = qs(E2, 7), k2 = T2[0], R2 = T2[1], P2 = 19; P2 > 4 && !k2[ks[P2 - 1]]; --P2) ;
|
|
26558
26559
|
var O2, I2, C2, A2, F3 = u2 + 5 << 3, M3 = Gs(s2, Ds) + Gs(n2, Us) + o2, D2 = Gs(s2, v2) + Gs(n2, f2) + o2 + 14 + 3 * P2 + Gs(E2, k2) + (2 * E2[16] + 3 * E2[17] + 7 * E2[18]);
|
|
26559
|
-
if (M3 >= F3 && D2 >= F3) return Ys(e2,
|
|
26560
|
-
if (Bs(e2,
|
|
26560
|
+
if (M3 >= F3 && D2 >= F3) return Ys(e2, h5, t2.subarray(l2, l2 + u2));
|
|
26561
|
+
if (Bs(e2, h5, 1 + (M3 > D2)), h5 += 2, M3 > D2) {
|
|
26561
26562
|
O2 = Ms(v2, c2, 0), I2 = v2, C2 = Ms(f2, _2, 0), A2 = f2;
|
|
26562
26563
|
var U2 = Ms(k2, R2, 0);
|
|
26563
|
-
for (Bs(e2,
|
|
26564
|
-
|
|
26564
|
+
for (Bs(e2, h5, b2 - 257), Bs(e2, h5 + 5, x2 - 1), Bs(e2, h5 + 10, P2 - 4), h5 += 14, S2 = 0; P2 > S2; ++S2) Bs(e2, h5 + 3 * S2, k2[ks[S2]]);
|
|
26565
|
+
h5 += 3 * P2;
|
|
26565
26566
|
for (var L2 = [m2, w2], N2 = 0; 2 > N2; ++N2) {
|
|
26566
26567
|
var j2 = L2[N2];
|
|
26567
|
-
for (S2 = 0; j2.length > S2; ++S2) Bs(e2,
|
|
26568
|
+
for (S2 = 0; j2.length > S2; ++S2) Bs(e2, h5, U2[z2 = 31 & j2[S2]]), h5 += k2[z2], z2 > 15 && (Bs(e2, h5, j2[S2] >>> 5 & 127), h5 += j2[S2] >>> 12);
|
|
26568
26569
|
}
|
|
26569
26570
|
} else O2 = Ls, I2 = Ds, C2 = Ns, A2 = Us;
|
|
26570
26571
|
for (S2 = 0; a2 > S2; ++S2) if (r2[S2] > 255) {
|
|
26571
26572
|
var z2;
|
|
26572
|
-
Hs(e2,
|
|
26573
|
+
Hs(e2, h5, O2[257 + (z2 = r2[S2] >>> 18 & 31)]), h5 += I2[z2 + 257], z2 > 7 && (Bs(e2, h5, r2[S2] >>> 23 & 31), h5 += $s[z2]);
|
|
26573
26574
|
var B2 = 31 & r2[S2];
|
|
26574
|
-
Hs(e2,
|
|
26575
|
-
} else Hs(e2,
|
|
26576
|
-
return Hs(e2,
|
|
26575
|
+
Hs(e2, h5, C2[B2]), h5 += A2[B2], B2 > 3 && (Hs(e2, h5, r2[S2] >>> 5 & 8191), h5 += Ts[B2]);
|
|
26576
|
+
} else Hs(e2, h5, O2[r2[S2]]), h5 += I2[r2[S2]];
|
|
26577
|
+
return Hs(e2, h5, O2[256]), h5 + I2[256];
|
|
26577
26578
|
};
|
|
26578
26579
|
Ks = new Ss([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
|
|
26579
26580
|
Xs = (function() {
|
|
@@ -26668,12 +26669,12 @@ var init_module = __esm({
|
|
|
26668
26669
|
Ki(t2.headers, (function(t3, e3) {
|
|
26669
26670
|
u2.append(e3, t3);
|
|
26670
26671
|
})), s2 && u2.append("Content-Type", s2);
|
|
26671
|
-
var
|
|
26672
|
+
var h5 = null;
|
|
26672
26673
|
if (a) {
|
|
26673
26674
|
var d2 = new a();
|
|
26674
|
-
|
|
26675
|
+
h5 = { signal: d2.signal, timeout: setTimeout((() => d2.abort()), t2.timeout) };
|
|
26675
26676
|
}
|
|
26676
|
-
n(i2, f({ method: (null == t2 ? void 0 : t2.method) || "GET", headers: u2, keepalive: "POST" === t2.method && 52428.8 > (l2 || 0), body: o2, signal: null == (e2 =
|
|
26677
|
+
n(i2, f({ method: (null == t2 ? void 0 : t2.method) || "GET", headers: u2, keepalive: "POST" === t2.method && 52428.8 > (l2 || 0), body: o2, signal: null == (e2 = h5) ? void 0 : e2.signal }, t2.fetchOptions)).then(((e3) => e3.text().then(((i3) => {
|
|
26677
26678
|
var r3 = { statusCode: e3.status, text: i3 };
|
|
26678
26679
|
if (200 === e3.status) try {
|
|
26679
26680
|
r3.json = JSON.parse(i3);
|
|
@@ -26683,7 +26684,7 @@ var init_module = __esm({
|
|
|
26683
26684
|
null == t2.callback || t2.callback(r3);
|
|
26684
26685
|
})))).catch(((e3) => {
|
|
26685
26686
|
Le.error(e3), null == t2.callback || t2.callback({ statusCode: 0, error: e3 });
|
|
26686
|
-
})).finally((() =>
|
|
26687
|
+
})).finally((() => h5 ? clearTimeout(h5.timeout) : null));
|
|
26687
26688
|
} }), o && dn.push({ transport: "XHR", method(t2) {
|
|
26688
26689
|
var e2 = new o(), { url: i2, encodedBody: r2 } = ln(t2);
|
|
26689
26690
|
e2.open(t2.method || "GET", i2, true);
|
|
@@ -26949,10 +26950,10 @@ var init_module = __esm({
|
|
|
26949
26950
|
}
|
|
26950
26951
|
checkAndGetSessionAndWindowId(t2, e2) {
|
|
26951
26952
|
if (void 0 === t2 && (t2 = false), void 0 === e2 && (e2 = null), this.qt.cookieless_mode === Ni) throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');
|
|
26952
|
-
var i2 = e2 || (/* @__PURE__ */ new Date()).getTime(), [r2, s2, n2] = this.ki(), o2 = this.Si(), a2 = V(n2) && Math.abs(i2 - n2) > 864e5, l2 = false, u2 = !s2,
|
|
26953
|
-
u2 ||
|
|
26953
|
+
var i2 = e2 || (/* @__PURE__ */ new Date()).getTime(), [r2, s2, n2] = this.ki(), o2 = this.Si(), a2 = V(n2) && Math.abs(i2 - n2) > 864e5, l2 = false, u2 = !s2, h5 = !u2 && !t2 && this.hi(i2, r2);
|
|
26954
|
+
u2 || h5 || a2 ? (s2 = this.vi(), o2 = this.fi(), yn.info("new session ID generated", { sessionId: s2, windowId: o2, changeReason: { noSessionId: u2, activityTimeout: h5, sessionPastMaximumLength: a2 } }), n2 = i2, l2 = true) : o2 || (o2 = this.fi(), l2 = true);
|
|
26954
26955
|
var d2 = V(r2) && t2 && !a2 ? r2 : i2, v2 = V(n2) ? n2 : (/* @__PURE__ */ new Date()).getTime();
|
|
26955
|
-
return this.xi(o2), this.bi(s2, d2, v2), t2 || this.pi(), l2 && this.ui.forEach(((t3) => t3(s2, o2, l2 ? { noSessionId: u2, activityTimeout:
|
|
26956
|
+
return this.xi(o2), this.bi(s2, d2, v2), t2 || this.pi(), l2 && this.ui.forEach(((t3) => t3(s2, o2, l2 ? { noSessionId: u2, activityTimeout: h5, sessionPastMaximumLength: a2 } : void 0))), { sessionId: s2, windowId: o2, sessionStartTimestamp: v2, changeReason: l2 ? { noSessionId: u2, activityTimeout: h5, sessionPastMaximumLength: a2 } : void 0, lastActivityTimestamp: r2 };
|
|
26956
26957
|
}
|
|
26957
26958
|
pi() {
|
|
26958
26959
|
clearTimeout(this.Ci), this.Ci = setTimeout((() => {
|
|
@@ -27053,7 +27054,7 @@ var init_module = __esm({
|
|
|
27053
27054
|
}
|
|
27054
27055
|
lr(t2, e2) {
|
|
27055
27056
|
var i2;
|
|
27056
|
-
null == (i2 =
|
|
27057
|
+
null == (i2 = h4.__PosthogExtensions__) || null == i2.loadExternalDependency || i2.loadExternalDependency(this._instance, t2, ((t3) => {
|
|
27057
27058
|
if (t3) return Dn.error("failed to load script", t3);
|
|
27058
27059
|
e2();
|
|
27059
27060
|
}));
|
|
@@ -27061,10 +27062,10 @@ var init_module = __esm({
|
|
|
27061
27062
|
startIfEnabledOrStop() {
|
|
27062
27063
|
var t2 = this, e2 = function(e3) {
|
|
27063
27064
|
var i3, s3, n2;
|
|
27064
|
-
!r2 || null != (i3 =
|
|
27065
|
+
!r2 || null != (i3 = h4.__PosthogExtensions__) && null != (i3 = i3.integrations) && i3[e3] || t2.lr(Un[e3], (() => {
|
|
27065
27066
|
var i4;
|
|
27066
|
-
null == (i4 =
|
|
27067
|
-
})), !r2 && null != (s3 =
|
|
27067
|
+
null == (i4 = h4.__PosthogExtensions__) || null == (i4 = i4.integrations) || null == (i4 = i4[e3]) || i4.start(t2._instance);
|
|
27068
|
+
})), !r2 && null != (s3 = h4.__PosthogExtensions__) && null != (s3 = s3.integrations) && s3[e3] && (null == (n2 = h4.__PosthogExtensions__) || null == (n2 = n2.integrations) || null == (n2 = n2[e3]) || n2.stop());
|
|
27068
27069
|
};
|
|
27069
27070
|
for (var [i2, r2] of Object.entries(null !== (s2 = this._instance.config.integrations) && void 0 !== s2 ? s2 : {})) {
|
|
27070
27071
|
var s2;
|
|
@@ -27160,12 +27161,12 @@ var init_module = __esm({
|
|
|
27160
27161
|
if (u2 || (this.sessionManager = new wn(this), this.sessionPropsManager = new mn(this, this.sessionManager, this.persistence)), this.config.__preview_deferred_init_extensions ? (Le.info("Deferring extension initialization to improve startup performance"), setTimeout((() => {
|
|
27161
27162
|
this.Vi(u2);
|
|
27162
27163
|
}), 0)) : (Le.info("Initializing extensions synchronously"), this.Vi(u2)), v.DEBUG = v.DEBUG || this.config.debug, v.DEBUG && Le.info("Starting in debug mode", { this: this, config: i2, thisC: f({}, this.config), p: a2, s: l2 }), !this.config.identity_distinct_id || null != (s2 = i2.bootstrap) && s2.distinctID || (i2.bootstrap = f({}, i2.bootstrap, { distinctID: this.config.identity_distinct_id, isIdentifiedID: true })), void 0 !== (null == (n2 = i2.bootstrap) ? void 0 : n2.distinctID)) {
|
|
27163
|
-
var
|
|
27164
|
-
if (i2.bootstrap.isIdentifiedID && null != d2 && d2 !==
|
|
27165
|
-
else if (i2.bootstrap.isIdentifiedID && null != d2 && d2 !==
|
|
27164
|
+
var h5 = i2.bootstrap.distinctID, d2 = this.get_distinct_id(), c2 = this.persistence.get_property($i);
|
|
27165
|
+
if (i2.bootstrap.isIdentifiedID && null != d2 && d2 !== h5 && c2 === ji) this.identify(h5);
|
|
27166
|
+
else if (i2.bootstrap.isIdentifiedID && null != d2 && d2 !== h5 && c2 === zi) Le.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");
|
|
27166
27167
|
else {
|
|
27167
|
-
var p2 = this.config.get_device_id(dr()), _2 = i2.bootstrap.isIdentifiedID ? p2 :
|
|
27168
|
-
this.persistence.set_property($i, i2.bootstrap.isIdentifiedID ? zi : ji), this.register({ distinct_id:
|
|
27168
|
+
var p2 = this.config.get_device_id(dr()), _2 = i2.bootstrap.isIdentifiedID ? p2 : h5;
|
|
27169
|
+
this.persistence.set_property($i, i2.bootstrap.isIdentifiedID ? zi : ji), this.register({ distinct_id: h5, $device_id: _2 });
|
|
27169
27170
|
}
|
|
27170
27171
|
}
|
|
27171
27172
|
if (u2) this.register_once({ distinct_id: Ai, $device_id: null }, "");
|
|
@@ -27201,19 +27202,19 @@ var init_module = __esm({
|
|
|
27201
27202
|
})(this, (() => this.Wi())) : this.Wi(), D(this.config._onCapture) && this.config._onCapture !== Bn && (Le.warn("onCapture is deprecated. Please use `before_send` instead"), this.on("eventCaptured", ((t2) => this.config._onCapture(t2.event, t2)))), this.config.ip && Le.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'), this;
|
|
27202
27203
|
}
|
|
27203
27204
|
Vi(t2) {
|
|
27204
|
-
var e2, i2, r2, s2, n2, o2, a2, l2 = performance.now(), u2 = f({}, _Zn.__defaultExtensionClasses, this.config.__extensionClasses),
|
|
27205
|
-
u2.featureFlags && this.Pi.push(this.featureFlags = null !== (e2 = this.featureFlags) && void 0 !== e2 ? e2 : new u2.featureFlags(this)), u2.exceptions && this.Pi.push(this.exceptions = null !== (i2 = this.exceptions) && void 0 !== i2 ? i2 : new u2.exceptions(this)), u2.historyAutocapture && this.Pi.push(this.historyAutocapture = new u2.historyAutocapture(this)), u2.tracingHeaders && this.Pi.push(new u2.tracingHeaders(this)), u2.siteApps && this.Pi.push(this.siteApps = new u2.siteApps(this)), u2.sessionRecording && !t2 && this.Pi.push(this.sessionRecording = new u2.sessionRecording(this)), this.config.disable_scroll_properties ||
|
|
27205
|
+
var e2, i2, r2, s2, n2, o2, a2, l2 = performance.now(), u2 = f({}, _Zn.__defaultExtensionClasses, this.config.__extensionClasses), h5 = [];
|
|
27206
|
+
u2.featureFlags && this.Pi.push(this.featureFlags = null !== (e2 = this.featureFlags) && void 0 !== e2 ? e2 : new u2.featureFlags(this)), u2.exceptions && this.Pi.push(this.exceptions = null !== (i2 = this.exceptions) && void 0 !== i2 ? i2 : new u2.exceptions(this)), u2.historyAutocapture && this.Pi.push(this.historyAutocapture = new u2.historyAutocapture(this)), u2.tracingHeaders && this.Pi.push(new u2.tracingHeaders(this)), u2.siteApps && this.Pi.push(this.siteApps = new u2.siteApps(this)), u2.sessionRecording && !t2 && this.Pi.push(this.sessionRecording = new u2.sessionRecording(this)), this.config.disable_scroll_properties || h5.push((() => {
|
|
27206
27207
|
this.scrollManager.startMeasuringScrollPosition();
|
|
27207
27208
|
})), u2.autocapture && this.Pi.push(this.autocapture = new u2.autocapture(this)), u2.surveys && this.Pi.push(this.surveys = null !== (r2 = this.surveys) && void 0 !== r2 ? r2 : new u2.surveys(this)), u2.logs && this.Pi.push(this.logs = null !== (s2 = this.logs) && void 0 !== s2 ? s2 : new u2.logs(this)), u2.conversations && this.Pi.push(this.conversations = null !== (n2 = this.conversations) && void 0 !== n2 ? n2 : new u2.conversations(this)), u2.productTours && this.Pi.push(this.productTours = new u2.productTours(this)), u2.heatmaps && this.Pi.push(this.heatmaps = new u2.heatmaps(this)), u2.webVitalsAutocapture && this.Pi.push(this.webVitalsAutocapture = new u2.webVitalsAutocapture(this)), u2.exceptionObserver && this.Pi.push(this.exceptionObserver = new u2.exceptionObserver(this)), u2.deadClicksAutocapture && this.Pi.push(this.deadClicksAutocapture = new u2.deadClicksAutocapture(this, Tr)), u2.toolbar && this.Pi.push(this.toolbar = null !== (o2 = this.toolbar) && void 0 !== o2 ? o2 : new u2.toolbar(this)), u2.experiments && this.Pi.push(this.experiments = null !== (a2 = this.experiments) && void 0 !== a2 ? a2 : new u2.experiments(this)), this.Pi.forEach(((t3) => {
|
|
27208
|
-
t3.initialize &&
|
|
27209
|
+
t3.initialize && h5.push((() => {
|
|
27209
27210
|
null == t3.initialize || t3.initialize();
|
|
27210
27211
|
}));
|
|
27211
|
-
})),
|
|
27212
|
+
})), h5.push((() => {
|
|
27212
27213
|
if (this.Zi) {
|
|
27213
27214
|
var t3 = this.Zi;
|
|
27214
27215
|
this.Zi = void 0, this.Rr(t3);
|
|
27215
27216
|
}
|
|
27216
|
-
})), this.Gi(
|
|
27217
|
+
})), this.Gi(h5, l2);
|
|
27217
27218
|
}
|
|
27218
27219
|
Gi(t2, e2) {
|
|
27219
27220
|
for (; t2.length > 0; ) {
|
|
@@ -27335,7 +27336,7 @@ var init_module = __esm({
|
|
|
27335
27336
|
var u2 = null != i2 && i2.skip_client_rate_limiting ? void 0 : this.rateLimiter.clientRateLimitContext();
|
|
27336
27337
|
if (null == u2 || !u2.isRateLimited) {
|
|
27337
27338
|
null != e2 && e2.$current_url && !j(null == e2 ? void 0 : e2.$current_url) && (Le.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."), null == e2 || delete e2.$current_url), "$exception" !== t2 || null != i2 && i2.en || Le.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."), this.sessionPersistence.update_search_keyword(), this.config.save_campaign_params && this.sessionPersistence.update_campaign_params(), this.config.save_referrer && this.sessionPersistence.update_referrer_info(), (this.config.save_campaign_params || this.config.save_referrer) && this.persistence.set_initial_person_info();
|
|
27338
|
-
var
|
|
27339
|
+
var h5 = /* @__PURE__ */ new Date(), d2 = (null == i2 ? void 0 : i2.timestamp) || h5, v2 = (null == i2 ? void 0 : i2.uuid) || dr(), c2 = { uuid: v2, event: t2, properties: this.calculateEventProperties(t2, e2 || {}, d2, v2) };
|
|
27339
27340
|
t2 === Vi && this.config.__preview_capture_bot_pageviews && l2 && (c2.event = "$bot_pageview", c2.properties.$browser_type = "bot"), u2 && (c2.properties.$lib_rate_limit_remaining_tokens = u2.remainingTokens), (null == i2 ? void 0 : i2.$set) && (c2.$set = null == i2 ? void 0 : i2.$set);
|
|
27340
27341
|
var p2, _2, g2, m2 = this.tn(null == i2 ? void 0 : i2.$set_once, t2 !== Yi, t2 === Gi);
|
|
27341
27342
|
if (m2 && (c2.$set_once = m2), null != i2 && i2._noTruncate || (s2 = this.config.properties_string_max_length, n2 = c2, o2 = (t3) => j(t3) ? t3.slice(0, s2) : t3, a2 = /* @__PURE__ */ new Set(), c2 = (function t3(e3, i3) {
|
|
@@ -27345,7 +27346,7 @@ var init_module = __esm({
|
|
|
27345
27346
|
a2.has(e4) || (r3[i4] = t3(e4));
|
|
27346
27347
|
}))), r3);
|
|
27347
27348
|
var r3;
|
|
27348
|
-
})(n2)), c2.timestamp = d2, N(null == i2 ? void 0 : i2.timestamp) || (c2.properties.$event_time_override_provided = true, c2.properties.$event_time_override_system_time =
|
|
27349
|
+
})(n2)), c2.timestamp = d2, N(null == i2 ? void 0 : i2.timestamp) || (c2.properties.$event_time_override_provided = true, c2.properties.$event_time_override_system_time = h5), t2 === hs.DISMISSED || t2 === hs.SENT) {
|
|
27349
27350
|
var b2 = null == e2 ? void 0 : e2[ds.SURVEY_ID], y2 = null == e2 ? void 0 : e2[ds.SURVEY_ITERATION];
|
|
27350
27351
|
((t3) => {
|
|
27351
27352
|
try {
|
|
@@ -27384,45 +27385,45 @@ var init_module = __esm({
|
|
|
27384
27385
|
}
|
|
27385
27386
|
calculateEventProperties(e2, i2, n2, o2, a2) {
|
|
27386
27387
|
if (n2 = n2 || /* @__PURE__ */ new Date(), !this.persistence || !this.sessionPersistence) return i2;
|
|
27387
|
-
var l2 = a2 ? void 0 : this.persistence.remove_event_timer(e2),
|
|
27388
|
-
if (
|
|
27388
|
+
var l2 = a2 ? void 0 : this.persistence.remove_event_timer(e2), h5 = f({}, i2);
|
|
27389
|
+
if (h5.token = this.config.token, h5.$config_defaults = this.config.defaults, this.Ri() && (h5.$cookieless_mode = true), "$snapshot" === e2) {
|
|
27389
27390
|
var d2 = f({}, this.persistence.properties(), this.sessionPersistence.properties());
|
|
27390
|
-
return
|
|
27391
|
+
return h5.distinct_id = d2.distinct_id, (!j(h5.distinct_id) && !q(h5.distinct_id) || z(h5.distinct_id)) && Le.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"), h5;
|
|
27391
27392
|
}
|
|
27392
27393
|
var c2, p2 = (function(e3, i3) {
|
|
27393
27394
|
var r2, n3, o3, a3;
|
|
27394
27395
|
if (!u) return {};
|
|
27395
|
-
var l3,
|
|
27396
|
+
var l3, h6, d3, c3, p3, f2, _3, g3, m3 = e3 ? [...jr, ...i3 || []] : [], [b3, y3] = (function(t2) {
|
|
27396
27397
|
for (var e4 = 0; Zt.length > e4; e4++) {
|
|
27397
27398
|
var [i4, r3] = Zt[e4], s2 = i4.exec(t2), n4 = s2 && (D(r3) ? r3(s2, t2) : r3);
|
|
27398
27399
|
if (n4) return n4;
|
|
27399
27400
|
}
|
|
27400
27401
|
return ["", ""];
|
|
27401
27402
|
})(u);
|
|
27402
|
-
return Xi(er({ $os: b3, $os_version: y3, $browser: Kt(u, navigator.vendor), $device: te(u), $device_type: (
|
|
27403
|
+
return Xi(er({ $os: b3, $os_version: y3, $browser: Kt(u, navigator.vendor), $device: te(u), $device_type: (h6 = u, d3 = { userAgentDataPlatform: null == (r2 = navigator) || null == (r2 = r2.userAgentData) ? void 0 : r2.platform, maxTouchPoints: null == (n3 = navigator) ? void 0 : n3.maxTouchPoints, screenWidth: null == t || null == (o3 = t.screen) ? void 0 : o3.width, screenHeight: null == t || null == (a3 = t.screen) ? void 0 : a3.height, devicePixelRatio: null == t ? void 0 : t.devicePixelRatio }, g3 = te(h6), g3 === dt || g3 === ht || "Kobo" === g3 || "Kindle Fire" === g3 || g3 === zt ? ut : g3 === Ot || g3 === Ct || g3 === It || g3 === Lt ? "Console" : g3 === ct ? "Wearable" : g3 ? ot : "Android" === (null == d3 ? void 0 : d3.userAgentDataPlatform) && (null !== (c3 = null == d3 ? void 0 : d3.maxTouchPoints) && void 0 !== c3 ? c3 : 0) > 0 ? 600 > Math.min(null !== (p3 = null == d3 ? void 0 : d3.screenWidth) && void 0 !== p3 ? p3 : 0, null !== (f2 = null == d3 ? void 0 : d3.screenHeight) && void 0 !== f2 ? f2 : 0) / (null !== (_3 = null == d3 ? void 0 : d3.devicePixelRatio) && void 0 !== _3 ? _3 : 1) ? ot : ut : "Desktop"), $timezone: Qr(), $timezone_offset: Zr() }), { $current_url: Ur(null == s ? void 0 : s.href, m3, Br), $host: null == s ? void 0 : s.host, $pathname: null == s ? void 0 : s.pathname, $raw_user_agent: u.length > 1e3 ? u.substring(0, 997) + "..." : u, $browser_version: Qt(u, navigator.vendor), $browser_language: Gr(), $browser_language_prefix: (l3 = Gr(), "string" == typeof l3 ? l3.split("-")[0] : void 0), $screen_height: null == t ? void 0 : t.screen.height, $screen_width: null == t ? void 0 : t.screen.width, $viewport_height: null == t ? void 0 : t.innerHeight, $viewport_width: null == t ? void 0 : t.innerWidth, $lib: v.LIB_NAME, $lib_version: v.LIB_VERSION, $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10), $time: Date.now() / 1e3 });
|
|
27403
27404
|
})(this.config.mask_personal_data_properties, this.config.custom_personal_data_properties);
|
|
27404
27405
|
if (this.sessionManager) {
|
|
27405
27406
|
var { sessionId: _2, windowId: g2 } = this.sessionManager.checkAndGetSessionAndWindowId(a2, n2.getTime());
|
|
27406
|
-
|
|
27407
|
+
h5.$session_id = _2, h5.$window_id = g2;
|
|
27407
27408
|
}
|
|
27408
|
-
this.sessionPropsManager && Xi(
|
|
27409
|
+
this.sessionPropsManager && Xi(h5, this.sessionPropsManager.getSessionProps());
|
|
27409
27410
|
try {
|
|
27410
27411
|
var m2;
|
|
27411
|
-
this.sessionRecording && Xi(
|
|
27412
|
+
this.sessionRecording && Xi(h5, this.sessionRecording.sdkDebugProperties), h5.$sdk_debug_retry_queue_size = null == (m2 = this.zi) ? void 0 : m2.length;
|
|
27412
27413
|
} catch (t2) {
|
|
27413
|
-
|
|
27414
|
+
h5.$sdk_debug_error_capturing_properties = String(t2);
|
|
27414
27415
|
}
|
|
27415
|
-
if (this.requestRouter.region === Rn && (
|
|
27416
|
+
if (this.requestRouter.region === Rn && (h5.$lib_custom_api_host = this.config.api_host), c2 = e2 !== Vi || a2 ? e2 !== Wi || a2 ? this.pageViewManager.doEvent() : this.pageViewManager.doPageLeave(n2) : this.pageViewManager.doPageView(n2, o2), h5 = Xi(h5, c2), e2 === Vi && r && (h5.title = r.title), !N(l2)) {
|
|
27416
27417
|
var b2 = n2.getTime() - l2;
|
|
27417
|
-
|
|
27418
|
+
h5.$duration = parseFloat((b2 / 1e3).toFixed(3));
|
|
27418
27419
|
}
|
|
27419
|
-
u && this.config.opt_out_useragent_filter && (
|
|
27420
|
-
delete
|
|
27420
|
+
u && this.config.opt_out_useragent_filter && (h5.$browser_type = this._is_bot() ? "bot" : "browser"), (h5 = Xi({}, p2, this.persistence.properties(), this.sessionPersistence.properties(), h5)).$is_identified = this._isIdentified(), M2(this.config.property_denylist) ? Ki(this.config.property_denylist, (function(t2) {
|
|
27421
|
+
delete h5[t2];
|
|
27421
27422
|
})) : Le.error(Wn + this.config.property_denylist + " or property_blacklist config: " + this.config.property_blacklist);
|
|
27422
27423
|
var y2 = this.config.sanitize_properties;
|
|
27423
|
-
y2 && (Le.error(Vn),
|
|
27424
|
+
y2 && (Le.error(Vn), h5 = y2(h5, e2));
|
|
27424
27425
|
var w2 = this.nn();
|
|
27425
|
-
return
|
|
27426
|
+
return h5.$process_person_profile = w2, w2 && !a2 && this.sn("_calculate_event_properties"), h5;
|
|
27426
27427
|
}
|
|
27427
27428
|
tn(t2, e2, i2) {
|
|
27428
27429
|
var r2;
|
|
@@ -27581,8 +27582,8 @@ var init_module = __esm({
|
|
|
27581
27582
|
var u2 = this.get_property(He);
|
|
27582
27583
|
if (this.consent.reset(), null == (e2 = this.persistence) || e2.clear(), null == (i2 = this.sessionPersistence) || i2.clear(), null == (r2 = this.surveys) || r2.reset(), null == (s2 = this.Yi) || s2.stop(), null == (n2 = this.featureFlags) || n2.reset(), null == (o2 = this.conversations) || o2.reset(), null == (a2 = this.persistence) || a2.set_property($i, ji), null == (l2 = this.sessionManager) || l2.resetSessionId(), this.$i = null, this.config.cookieless_mode === Ni) this.register_once({ distinct_id: Ai, $device_id: null }, "");
|
|
27583
27584
|
else {
|
|
27584
|
-
var
|
|
27585
|
-
this.register_once({ distinct_id:
|
|
27585
|
+
var h5 = this.config.get_device_id(dr());
|
|
27586
|
+
this.register_once({ distinct_id: h5, $device_id: t2 ? h5 : u2 }, "");
|
|
27586
27587
|
}
|
|
27587
27588
|
this.register({ $last_posthog_reset: (/* @__PURE__ */ new Date()).toISOString() }, 1), delete this.config.identity_distinct_id, delete this.config.identity_hash, this.reloadFeatureFlags();
|
|
27588
27589
|
}
|
|
@@ -27620,12 +27621,12 @@ var init_module = __esm({
|
|
|
27620
27621
|
set_config(t2) {
|
|
27621
27622
|
var e2 = f({}, this.config);
|
|
27622
27623
|
if (U(t2)) {
|
|
27623
|
-
var i2, r2, s2, n2, o2, a2, l2, u2,
|
|
27624
|
+
var i2, r2, s2, n2, o2, a2, l2, u2, h5, d2;
|
|
27624
27625
|
Xi(this.config, Xn(t2));
|
|
27625
27626
|
var c2 = this.Hi();
|
|
27626
27627
|
null == (i2 = this.persistence) || i2.update_config(this.config, e2, c2), this.sessionPersistence = "sessionStorage" === this.config.persistence || "memory" === this.config.persistence ? this.persistence : new es(f({}, this.config, { persistence: "sessionStorage" }), c2);
|
|
27627
27628
|
var p2 = this.Di(this.config.debug);
|
|
27628
|
-
W(p2) && (this.config.debug = p2), W(this.config.debug) && (this.config.debug ? (v.DEBUG = true, gr.R() && gr.N("ph_debug", true), Le.info("set_config", { config: t2, oldConfig: e2, newConfig: f({}, this.config) })) : (v.DEBUG = false, gr.R() && gr.q("ph_debug"))), null == (r2 = this.exceptionObserver) || r2.onConfigChange(), null == (s2 = this.exceptions) || s2.onConfigChange(), null == (n2 = this.sessionRecording) || n2.startIfEnabledOrStop(), null == (o2 = this.autocapture) || o2.startIfEnabled(), null == (a2 = this.heatmaps) || a2.startIfEnabled(), null == (l2 = this.exceptionObserver) || l2.startIfEnabledOrStop(), null == (u2 = this.deadClicksAutocapture) || u2.startIfEnabledOrStop(), null == (
|
|
27629
|
+
W(p2) && (this.config.debug = p2), W(this.config.debug) && (this.config.debug ? (v.DEBUG = true, gr.R() && gr.N("ph_debug", true), Le.info("set_config", { config: t2, oldConfig: e2, newConfig: f({}, this.config) })) : (v.DEBUG = false, gr.R() && gr.q("ph_debug"))), null == (r2 = this.exceptionObserver) || r2.onConfigChange(), null == (s2 = this.exceptions) || s2.onConfigChange(), null == (n2 = this.sessionRecording) || n2.startIfEnabledOrStop(), null == (o2 = this.autocapture) || o2.startIfEnabled(), null == (a2 = this.heatmaps) || a2.startIfEnabled(), null == (l2 = this.exceptionObserver) || l2.startIfEnabledOrStop(), null == (u2 = this.deadClicksAutocapture) || u2.startIfEnabledOrStop(), null == (h5 = this.surveys) || h5.loadIfEnabled(), this.cn(), null == (d2 = this.externalIntegrations) || d2.startIfEnabledOrStop();
|
|
27629
27630
|
}
|
|
27630
27631
|
}
|
|
27631
27632
|
_overrideSDKInfo(t2, e2) {
|
|
@@ -27721,8 +27722,8 @@ var init_module = __esm({
|
|
|
27721
27722
|
var a2, l2 = null !== (s2 = null == (n2 = this.config.__extensionClasses) ? void 0 : n2.sessionRecording) && void 0 !== s2 ? s2 : null == (o2 = _Zn.__defaultExtensionClasses) ? void 0 : o2.sessionRecording;
|
|
27722
27723
|
l2 && (this.sessionRecording = this.Mi(this.sessionRecording, new l2(this)), this.Qi && (null == (a2 = this.sessionRecording) || null == a2.onRemoteConfig || a2.onRemoteConfig(this.Qi)));
|
|
27723
27724
|
}
|
|
27724
|
-
var u2,
|
|
27725
|
-
this.consent.optInOut(true), this.cn(), this.Ji(), null == (e2 = this.sessionRecording) || e2.startIfEnabledOrStop(), this.config.cookieless_mode == Li && (null == (u2 = this.surveys) || u2.loadIfEnabled()), (N(null == t2 ? void 0 : t2.captureEventName) || null != t2 && t2.captureEventName) && this.capture(null !== (
|
|
27725
|
+
var u2, h5;
|
|
27726
|
+
this.consent.optInOut(true), this.cn(), this.Ji(), null == (e2 = this.sessionRecording) || e2.startIfEnabledOrStop(), this.config.cookieless_mode == Li && (null == (u2 = this.surveys) || u2.loadIfEnabled()), (N(null == t2 ? void 0 : t2.captureEventName) || null != t2 && t2.captureEventName) && this.capture(null !== (h5 = null == t2 ? void 0 : t2.captureEventName) && void 0 !== h5 ? h5 : "$opt_in", null == t2 ? void 0 : t2.captureProperties, { send_instantly: true }), this.config.capture_pageview && this.Ki();
|
|
27726
27727
|
} else Le.warn(Hn);
|
|
27727
27728
|
}
|
|
27728
27729
|
opt_out_capturing() {
|
|
@@ -28017,8 +28018,8 @@ var init_module = __esm({
|
|
|
28017
28018
|
r2.info("event matched, removing item from activated items", { event: t2, eventPayload: e2, existingActivatedItems: o2 });
|
|
28018
28019
|
var u2 = (null == e2 || null == (a2 = e2.properties) ? void 0 : a2.$survey_id) || (null == e2 || null == (l2 = e2.properties) ? void 0 : l2.$product_tour_id);
|
|
28019
28020
|
if (u2) {
|
|
28020
|
-
var
|
|
28021
|
-
0 >
|
|
28021
|
+
var h5 = o2.indexOf(u2);
|
|
28022
|
+
0 > h5 || (o2.splice(h5, 1), this.qn(o2));
|
|
28022
28023
|
}
|
|
28023
28024
|
} else {
|
|
28024
28025
|
if (this.En.has(t2)) {
|
|
@@ -28187,7 +28188,7 @@ var init_module = __esm({
|
|
|
28187
28188
|
if (H(t2.conditions) || H(null == (e2 = t2.conditions) ? void 0 : e2.utm)) return true;
|
|
28188
28189
|
var i2 = qr();
|
|
28189
28190
|
if (i2.utm_source) {
|
|
28190
|
-
var r2, s2, n2, o2, a2, l2, u2,
|
|
28191
|
+
var r2, s2, n2, o2, a2, l2, u2, h5, d2 = null == (r2 = t2.conditions) || null == (r2 = r2.utm) || !r2.utm_campaign || (null == (s2 = t2.conditions) || null == (s2 = s2.utm) ? void 0 : s2.utm_campaign) == i2.utm_campaign, v2 = null == (n2 = t2.conditions) || null == (n2 = n2.utm) || !n2.utm_source || (null == (o2 = t2.conditions) || null == (o2 = o2.utm) ? void 0 : o2.utm_source) == i2.utm_source, c2 = null == (a2 = t2.conditions) || null == (a2 = a2.utm) || !a2.utm_medium || (null == (l2 = t2.conditions) || null == (l2 = l2.utm) ? void 0 : l2.utm_medium) == i2.utm_medium, p2 = null == (u2 = t2.conditions) || null == (u2 = u2.utm) || !u2.utm_term || (null == (h5 = t2.conditions) || null == (h5 = h5.utm) ? void 0 : h5.utm_term) == i2.utm_term;
|
|
28191
28192
|
return d2 && c2 && p2 && v2;
|
|
28192
28193
|
}
|
|
28193
28194
|
return false;
|
|
@@ -28255,8 +28256,8 @@ var init_module = __esm({
|
|
|
28255
28256
|
updateFlags(t2, e2, i2) {
|
|
28256
28257
|
var r2 = null != i2 && i2.merge ? this.getFlagVariants() : {}, s2 = null != i2 && i2.merge ? this.getFlagPayloads() : {}, n2 = f({}, r2, t2), o2 = f({}, s2, e2), a2 = {};
|
|
28257
28258
|
for (var [l2, u2] of Object.entries(n2)) {
|
|
28258
|
-
var
|
|
28259
|
-
a2[l2] = { key: l2, enabled: !!
|
|
28259
|
+
var h5 = "string" == typeof u2;
|
|
28260
|
+
a2[l2] = { key: l2, enabled: !!h5 || Boolean(u2), variant: h5 ? u2 : void 0, reason: void 0, metadata: N(null == o2 ? void 0 : o2[l2]) ? void 0 : { id: 0, version: void 0, description: void 0, payload: o2[l2] } };
|
|
28260
28261
|
}
|
|
28261
28262
|
this.receivedFeatureFlags({ flags: a2 });
|
|
28262
28263
|
}
|
|
@@ -28271,8 +28272,8 @@ var init_module = __esm({
|
|
|
28271
28272
|
if (!i2 && !e2) return t2 || {};
|
|
28272
28273
|
var r2 = Xi({}, t2 || {}), s2 = [.../* @__PURE__ */ new Set([...Object.keys(i2 || {}), ...Object.keys(e2 || {})])];
|
|
28273
28274
|
for (var n2 of s2) {
|
|
28274
|
-
var o2, a2, l2 = r2[n2], u2 = null == e2 ? void 0 : e2[n2],
|
|
28275
|
-
|
|
28275
|
+
var o2, a2, l2 = r2[n2], u2 = null == e2 ? void 0 : e2[n2], h5 = N(u2) ? null !== (o2 = null == l2 ? void 0 : l2.enabled) && void 0 !== o2 && o2 : !!u2, d2 = N(u2) ? l2.variant : "string" == typeof u2 ? u2 : void 0, v2 = null == i2 ? void 0 : i2[n2], c2 = f({}, l2, { enabled: h5, variant: h5 ? null != d2 ? d2 : null == l2 ? void 0 : l2.variant : void 0 });
|
|
28276
|
+
h5 !== (null == l2 ? void 0 : l2.enabled) && (c2.original_enabled = null == l2 ? void 0 : l2.enabled), d2 !== (null == l2 ? void 0 : l2.variant) && (c2.original_variant = null == l2 ? void 0 : l2.variant), v2 && (c2.metadata = f({}, null == l2 ? void 0 : l2.metadata, { payload: v2, original_payload: null == l2 || null == (a2 = l2.metadata) ? void 0 : a2.payload })), r2[n2] = c2;
|
|
28276
28277
|
}
|
|
28277
28278
|
return this.Kn || (ca.warn(" Overriding feature flag details!", { flagDetails: t2, overriddenPayloads: i2, finalDetails: r2 }), this.Kn = true), r2;
|
|
28278
28279
|
}
|
|
@@ -28346,8 +28347,8 @@ var init_module = __esm({
|
|
|
28346
28347
|
if (!this.ls()) {
|
|
28347
28348
|
var i2 = this.getFlagVariants(), r2 = t2 in i2, s2 = i2[t2], n2 = this.getFlagPayloads()[t2], o2 = String(s2), a2 = this.os(ci) || void 0, l2 = this.os(Si) || void 0, u2 = this.os(wi) || {};
|
|
28348
28349
|
if (this.qt.advanced_feature_flags_dedup_per_session) {
|
|
28349
|
-
var
|
|
28350
|
-
d2 && d2 !== v2 && (u2 = {}, null == (
|
|
28350
|
+
var h5, d2 = this._instance.get_session_id(), v2 = this.os(xi);
|
|
28351
|
+
d2 && d2 !== v2 && (u2 = {}, null == (h5 = this.ni) || h5.register({ [wi]: u2, [xi]: d2 }));
|
|
28351
28352
|
}
|
|
28352
28353
|
if ((e2.send_event || !("send_event" in e2)) && (!(t2 in u2) || !u2[t2].includes(o2))) {
|
|
28353
28354
|
var c2, p2, f2, _2, g2, m2, b2, y2, w2, x2;
|
|
@@ -28412,7 +28413,7 @@ var init_module = __esm({
|
|
|
28412
28413
|
})))) : ca.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"), t4;
|
|
28413
28414
|
})(t3), a2 = o2.flags, l2 = o2.featureFlags, u2 = o2.featureFlagPayloads;
|
|
28414
28415
|
if (l2) {
|
|
28415
|
-
var
|
|
28416
|
+
var h5 = t3.requestId, d2 = t3.evaluatedAt;
|
|
28416
28417
|
if (M2(l2)) {
|
|
28417
28418
|
ca.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");
|
|
28418
28419
|
var v2 = {};
|
|
@@ -28437,7 +28438,7 @@ var init_module = __esm({
|
|
|
28437
28438
|
return m2.has(e4);
|
|
28438
28439
|
}))));
|
|
28439
28440
|
} else p2 = f({}, i3, p2), _2 = f({}, r3, _2), g2 = f({}, s3, g2);
|
|
28440
|
-
e3 && e3.register(f({ [ui]: Object.keys(ga(p2)), [li]: p2 || {}, [vi]: _2 || {}, [di]: g2 || {} },
|
|
28441
|
+
e3 && e3.register(f({ [ui]: Object.keys(ga(p2)), [li]: p2 || {}, [vi]: _2 || {}, [di]: g2 || {} }, h5 ? { [ci]: h5 } : {}, d2 ? { [Si]: d2 } : {}));
|
|
28441
28442
|
}
|
|
28442
28443
|
}
|
|
28443
28444
|
})(t2, this.ni, r2, s2, n2, i2), e2 || (this.ss = false), this.ps(e2);
|
|
@@ -28564,7 +28565,7 @@ var init_module = __esm({
|
|
|
28564
28565
|
}
|
|
28565
28566
|
xs(t2) {
|
|
28566
28567
|
var e2, i2, r2;
|
|
28567
|
-
this.ws && (this.bs !== Yo && this.bs !== Jo && (this.bs = Go), null !=
|
|
28568
|
+
this.ws && (this.bs !== Yo && this.bs !== Jo && (this.bs = Go), null != h4 && null != (e2 = h4.__PosthogExtensions__) && null != (e2 = e2.rrweb) && e2.record && null != (i2 = h4.__PosthogExtensions__) && i2.initSessionRecording ? this.Ss(t2) : null == (r2 = h4.__PosthogExtensions__) || null == r2.loadExternalDependency || r2.loadExternalDependency(this._instance, this.ks, ((e3) => {
|
|
28568
28569
|
if (e3) return Xo.error("could not load recorder", e3);
|
|
28569
28570
|
this.Ss(t2);
|
|
28570
28571
|
})));
|
|
@@ -28621,8 +28622,8 @@ var init_module = __esm({
|
|
|
28621
28622
|
}
|
|
28622
28623
|
Ss(t2) {
|
|
28623
28624
|
var e2, i2;
|
|
28624
|
-
if (null == (e2 =
|
|
28625
|
-
if (this.ys || (this.ys = null == (i2 =
|
|
28625
|
+
if (null == (e2 = h4.__PosthogExtensions__) || !e2.initSessionRecording) return Xo.warn("Called on script loaded before session recording is available. This can be caused by adblockers."), void this._instance.register_for_session({ [Di]: true });
|
|
28626
|
+
if (this.ys || (this.ys = null == (i2 = h4.__PosthogExtensions__) ? void 0 : i2.initSessionRecording(this._instance), this.ys._forceAllowLocalhostNetworkCapture = this._forceAllowLocalhostNetworkCapture), !this.Ms()) {
|
|
28626
28627
|
if (this.bs === Jo || this.bs === Yo) return;
|
|
28627
28628
|
return this.bs = Yo, Xo.info("persisted remote config is stale, requesting fresh config before starting"), void new bs(this._instance).load();
|
|
28628
28629
|
}
|
|
@@ -28746,8 +28747,8 @@ var init_module = __esm({
|
|
|
28746
28747
|
if (null != (o3 = r3) && o3.url_allowlist && !uo(r3.url_allowlist)) return false;
|
|
28747
28748
|
if (null != (a3 = r3) && a3.url_ignorelist && uo(r3.url_ignorelist)) return false;
|
|
28748
28749
|
if (null != (l3 = r3) && l3.dom_event_allowlist) {
|
|
28749
|
-
var
|
|
28750
|
-
if (
|
|
28750
|
+
var h6 = r3.dom_event_allowlist;
|
|
28751
|
+
if (h6 && !h6.some(((t2) => i3.type === t2))) return false;
|
|
28751
28752
|
}
|
|
28752
28753
|
var { parentIsUsefulElement: d3, targetElementList: v2 } = wo(e3, s3);
|
|
28753
28754
|
if (!(function(t2, e4) {
|
|
@@ -28780,9 +28781,9 @@ var init_module = __esm({
|
|
|
28780
28781
|
if (a2) return false;
|
|
28781
28782
|
var l2 = this.getElementSelectors(s2);
|
|
28782
28783
|
if (l2 && l2.length > 0 && (o2.$element_selectors = l2), i2 === Do) {
|
|
28783
|
-
var u2,
|
|
28784
|
-
if (!
|
|
28785
|
-
o2.$selected_content =
|
|
28784
|
+
var u2, h5 = vo(null == t || null == (u2 = t.getSelection()) ? void 0 : u2.toString()), d2 = e2.type || "clipboard";
|
|
28785
|
+
if (!h5) return false;
|
|
28786
|
+
o2.$selected_content = h5, o2.$copy_type = d2;
|
|
28786
28787
|
}
|
|
28787
28788
|
return this.instance.capture(i2, o2), true;
|
|
28788
28789
|
}
|
|
@@ -28935,7 +28936,7 @@ var init_module = __esm({
|
|
|
28935
28936
|
}
|
|
28936
28937
|
}, this.so = () => {
|
|
28937
28938
|
if (!this.Ps) {
|
|
28938
|
-
var t3, e3, i2, r2, s2 =
|
|
28939
|
+
var t3, e3, i2, r2, s2 = h4.__PosthogExtensions__;
|
|
28939
28940
|
N(s2) || N(s2.postHogWebVitalsCallbacks) || ({ onLCP: t3, onCLS: e3, onFCP: i2, onINP: r2 } = s2.postHogWebVitalsCallbacks), t3 && e3 && i2 && r2 ? (this.allowedMetrics.indexOf("LCP") > -1 && t3(this.ht.bind(this)), this.allowedMetrics.indexOf("CLS") > -1 && e3(this.ht.bind(this)), this.allowedMetrics.indexOf("FCP") > -1 && i2(this.ht.bind(this)), this.allowedMetrics.indexOf("INP") > -1 && r2(this.ht.bind(this)), this.Ps = true) : qo.error("web vitals callbacks not loaded - not starting");
|
|
28940
28941
|
}
|
|
28941
28942
|
}, this._instance = t2, this.js = !(null == (e2 = this._instance.persistence) || !e2.props[Xe]), this.startIfEnabled();
|
|
@@ -28975,7 +28976,7 @@ var init_module = __esm({
|
|
|
28975
28976
|
}
|
|
28976
28977
|
lr(t2) {
|
|
28977
28978
|
var e2, i2;
|
|
28978
|
-
null != (e2 =
|
|
28979
|
+
null != (e2 = h4.__PosthogExtensions__) && e2.postHogWebVitalsCallbacks ? t2() : null == (i2 = h4.__PosthogExtensions__) || null == i2.loadExternalDependency || i2.loadExternalDependency(this._instance, this.useAttribution ? "web-vitals-with-attribution" : "web-vitals", ((e3) => {
|
|
28979
28980
|
e3 ? qo.error("failed to load script", e3) : t2();
|
|
28980
28981
|
}));
|
|
28981
28982
|
}
|
|
@@ -28993,8 +28994,8 @@ var init_module = __esm({
|
|
|
28993
28994
|
var i2, r2, s2;
|
|
28994
28995
|
this.so = () => {
|
|
28995
28996
|
var e3;
|
|
28996
|
-
if (t && this.isEnabled && null != (e3 =
|
|
28997
|
-
var i3 =
|
|
28997
|
+
if (t && this.isEnabled && null != (e3 = h4.__PosthogExtensions__) && e3.errorWrappingFunctions) {
|
|
28998
|
+
var i3 = h4.__PosthogExtensions__.errorWrappingFunctions.wrapOnError, r3 = h4.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection, s3 = h4.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;
|
|
28998
28999
|
try {
|
|
28999
29000
|
!this.ao && this.qt.capture_unhandled_errors && (this.ao = i3(this.captureException.bind(this))), !this.uo && this.qt.capture_unhandled_rejections && (this.uo = r3(this.captureException.bind(this))), !this.lo && this.qt.capture_console_errors && (this.lo = s3(this.captureException.bind(this)));
|
|
29000
29001
|
} catch (t2) {
|
|
@@ -29015,7 +29016,7 @@ var init_module = __esm({
|
|
|
29015
29016
|
}
|
|
29016
29017
|
lr(t2) {
|
|
29017
29018
|
var e2, i2;
|
|
29018
|
-
null != (e2 =
|
|
29019
|
+
null != (e2 = h4.__PosthogExtensions__) && e2.errorWrappingFunctions && t2(), null == (i2 = h4.__PosthogExtensions__) || null == i2.loadExternalDependency || i2.loadExternalDependency(this._instance, "exception-autocapture", ((e3) => {
|
|
29019
29020
|
if (e3) return zo.error("failed to load script", e3);
|
|
29020
29021
|
t2();
|
|
29021
29022
|
}));
|
|
@@ -29047,9 +29048,9 @@ var init_module = __esm({
|
|
|
29047
29048
|
var l2 = me.test(a2) ? a2.replace(me, "$1") : a2;
|
|
29048
29049
|
if (!l2.match(/\S*Error: /)) {
|
|
29049
29050
|
for (var u2 of i3) {
|
|
29050
|
-
var
|
|
29051
|
-
if (
|
|
29052
|
-
s2.push(
|
|
29051
|
+
var h5 = u2(l2, t3);
|
|
29052
|
+
if (h5) {
|
|
29053
|
+
s2.push(h5);
|
|
29053
29054
|
break;
|
|
29054
29055
|
}
|
|
29055
29056
|
}
|
|
@@ -29185,13 +29186,13 @@ var init_module = __esm({
|
|
|
29185
29186
|
}
|
|
29186
29187
|
lr(t2) {
|
|
29187
29188
|
var e2, i2;
|
|
29188
|
-
null != (e2 =
|
|
29189
|
+
null != (e2 = h4.__PosthogExtensions__) && e2.generateProductTours ? t2() : null == (i2 = h4.__PosthogExtensions__) || null == i2.loadExternalDependency || i2.loadExternalDependency(this._instance, "product-tours", ((e3) => {
|
|
29189
29190
|
e3 ? ta.error("Could not load product tours script", e3) : t2();
|
|
29190
29191
|
}));
|
|
29191
29192
|
}
|
|
29192
29193
|
Po() {
|
|
29193
29194
|
var t2;
|
|
29194
|
-
!this.Eo && null != (t2 =
|
|
29195
|
+
!this.Eo && null != (t2 = h4.__PosthogExtensions__) && t2.generateProductTours && (this.Eo = h4.__PosthogExtensions__.generateProductTours(this._instance, true));
|
|
29195
29196
|
}
|
|
29196
29197
|
getProductTours(t2, e2) {
|
|
29197
29198
|
if (void 0 === e2 && (e2 = false), !M2(this.Mo) || e2) {
|
|
@@ -29268,7 +29269,7 @@ var init_module = __esm({
|
|
|
29268
29269
|
}
|
|
29269
29270
|
get siteAppLoaders() {
|
|
29270
29271
|
var t2;
|
|
29271
|
-
return null == (t2 =
|
|
29272
|
+
return null == (t2 = h4._POSTHOG_REMOTE_CONFIG) || null == (t2 = t2[this._instance.config.token]) ? void 0 : t2.siteApps;
|
|
29272
29273
|
}
|
|
29273
29274
|
initialize() {
|
|
29274
29275
|
if (this.isEnabled) {
|
|
@@ -29281,8 +29282,8 @@ var init_module = __esm({
|
|
|
29281
29282
|
globalsForEvent(t2) {
|
|
29282
29283
|
var e2, i2, r2, s2, n2, o2, a2;
|
|
29283
29284
|
if (!t2) throw new Error("Event payload is required");
|
|
29284
|
-
var l2 = {}, u2 = this._instance.get_property("$groups") || [],
|
|
29285
|
-
for (var [d2, v2] of Object.entries(
|
|
29285
|
+
var l2 = {}, u2 = this._instance.get_property("$groups") || [], h5 = this._instance.get_property("$stored_group_properties") || {};
|
|
29286
|
+
for (var [d2, v2] of Object.entries(h5)) l2[d2] = { id: u2[d2], type: d2, properties: v2 };
|
|
29286
29287
|
var { $set_once: c2, $set: p2 } = t2;
|
|
29287
29288
|
return { event: f({}, _(t2, ea), { properties: f({}, t2.properties, p2 ? { $set: f({}, null !== (e2 = null == (i2 = t2.properties) ? void 0 : i2.$set) && void 0 !== e2 ? e2 : {}, p2) } : {}, c2 ? { $set_once: f({}, null !== (r2 = null == (s2 = t2.properties) ? void 0 : s2.$set_once) && void 0 !== r2 ? r2 : {}, c2) } : {}), elements_chain: null !== (n2 = null == (o2 = t2.properties) ? void 0 : o2.$elements_chain) && void 0 !== n2 ? n2 : "", distinct_id: null == (a2 = t2.properties) ? void 0 : a2.distinct_id }), person: { properties: this._instance.get_property("$stored_person_properties") }, groups: l2 };
|
|
29288
29289
|
}
|
|
@@ -29328,7 +29329,7 @@ var init_module = __esm({
|
|
|
29328
29329
|
if (null == (i2 = this.Lo) || i2.call(this), null != (r2 = t2.siteApps) && r2.length) if (this.isEnabled) {
|
|
29329
29330
|
var n2 = function(t3) {
|
|
29330
29331
|
var e3;
|
|
29331
|
-
|
|
29332
|
+
h4["__$$ph_site_app_" + t3] = s2._instance, null == (e3 = h4.__PosthogExtensions__) || null == e3.loadSiteApp || e3.loadSiteApp(s2._instance, a2, ((e4) => {
|
|
29332
29333
|
if (e4) return ia.error(ra + t3, e4);
|
|
29333
29334
|
}));
|
|
29334
29335
|
};
|
|
@@ -29340,7 +29341,7 @@ var init_module = __esm({
|
|
|
29340
29341
|
constructor(t2) {
|
|
29341
29342
|
this.No = void 0, this.$o = void 0, this.so = () => {
|
|
29342
29343
|
var t3, e2, i2 = this.Do() || [];
|
|
29343
|
-
N(this.No) && (null == (t3 =
|
|
29344
|
+
N(this.No) && (null == (t3 = h4.__PosthogExtensions__) || null == (t3 = t3.tracingHeadersPatchFns) || t3._patchXHR(i2, this._instance.get_distinct_id(), this._instance.sessionManager)), N(this.$o) && (null == (e2 = h4.__PosthogExtensions__) || null == (e2 = e2.tracingHeadersPatchFns) || e2._patchFetch(i2, this._instance.get_distinct_id(), this._instance.sessionManager));
|
|
29344
29345
|
}, this._instance = t2;
|
|
29345
29346
|
}
|
|
29346
29347
|
initialize() {
|
|
@@ -29348,7 +29349,7 @@ var init_module = __esm({
|
|
|
29348
29349
|
}
|
|
29349
29350
|
lr(t2) {
|
|
29350
29351
|
var e2, i2;
|
|
29351
|
-
null != (e2 =
|
|
29352
|
+
null != (e2 = h4.__PosthogExtensions__) && e2.tracingHeadersPatchFns && t2(), null == (i2 = h4.__PosthogExtensions__) || null == i2.loadExternalDependency || i2.loadExternalDependency(this._instance, "tracing-headers", ((e3) => {
|
|
29352
29353
|
if (e3) return Ho.error("failed to load script", e3);
|
|
29353
29354
|
t2();
|
|
29354
29355
|
}));
|
|
@@ -29393,7 +29394,7 @@ var init_module = __esm({
|
|
|
29393
29394
|
else if (this.qt.disable_surveys) Cn.info(ua);
|
|
29394
29395
|
else if (this.qt.cookieless_mode && this._instance.consent.isOptedOut()) Cn.info("Not loading surveys in cookieless mode without consent.");
|
|
29395
29396
|
else {
|
|
29396
|
-
var t2 = null ==
|
|
29397
|
+
var t2 = null == h4 ? void 0 : h4.__PosthogExtensions__;
|
|
29397
29398
|
if (t2) {
|
|
29398
29399
|
if (!N(this.qo) || this.qt.advanced_enable_surveys) {
|
|
29399
29400
|
var e2 = this.qo || this.qt.advanced_enable_surveys;
|
|
@@ -29455,8 +29456,8 @@ var init_module = __esm({
|
|
|
29455
29456
|
return !(null == (e4 = t4.conditions) || null == (e4 = e4.actions) || null == (e4 = e4.values) || !e4.length);
|
|
29456
29457
|
})(t3))));
|
|
29457
29458
|
u2.length > 0 && (null == (a2 = this._surveyEventReceiver) || a2.register(u2)), null == (r3 = this._instance.persistence) || r3.register({ [mi]: l2 });
|
|
29458
|
-
var
|
|
29459
|
-
t2(l2,
|
|
29459
|
+
var h5 = { isLoaded: true };
|
|
29460
|
+
t2(l2, h5), null == i2 || i2({ surveys: l2, context: h5 });
|
|
29460
29461
|
} }));
|
|
29461
29462
|
}
|
|
29462
29463
|
Vo(t2) {
|
|
@@ -29543,11 +29544,11 @@ var init_module = __esm({
|
|
|
29543
29544
|
this.instance = t2;
|
|
29544
29545
|
}
|
|
29545
29546
|
Go(t2) {
|
|
29546
|
-
|
|
29547
|
+
h4.ph_toolbar_state = t2;
|
|
29547
29548
|
}
|
|
29548
29549
|
Qo() {
|
|
29549
29550
|
var t2;
|
|
29550
|
-
return null !== (t2 =
|
|
29551
|
+
return null !== (t2 = h4.ph_toolbar_state) && void 0 !== t2 ? t2 : 0;
|
|
29551
29552
|
}
|
|
29552
29553
|
initialize() {
|
|
29553
29554
|
return this.maybeLoadToolbar();
|
|
@@ -29572,7 +29573,7 @@ var init_module = __esm({
|
|
|
29572
29573
|
}
|
|
29573
29574
|
}
|
|
29574
29575
|
Jo(t2) {
|
|
29575
|
-
var e2 =
|
|
29576
|
+
var e2 = h4.ph_load_toolbar || h4.ph_load_editor;
|
|
29576
29577
|
!H(e2) && D(e2) ? e2(t2, this.instance) : va.warn("No toolbar load function found");
|
|
29577
29578
|
}
|
|
29578
29579
|
loadToolbar(e2) {
|
|
@@ -29582,7 +29583,7 @@ var init_module = __esm({
|
|
|
29582
29583
|
if (t.localStorage.setItem(da, JSON.stringify(f({}, n2, { source: void 0 }))), 2 === this.Qo()) this.Jo(n2);
|
|
29583
29584
|
else if (0 === this.Qo()) {
|
|
29584
29585
|
var o2;
|
|
29585
|
-
this.Go(1), null == (o2 =
|
|
29586
|
+
this.Go(1), null == (o2 = h4.__PosthogExtensions__) || null == o2.loadExternalDependency || o2.loadExternalDependency(this.instance, "toolbar", ((t2) => {
|
|
29586
29587
|
if (t2) return va.error("[Toolbar] Failed to load", t2), void this.Go(0);
|
|
29587
29588
|
this.Go(2), this.Jo(n2);
|
|
29588
29589
|
})), sr(t, "turbolinks:load", (() => {
|
|
@@ -29618,7 +29619,7 @@ var init_module = __esm({
|
|
|
29618
29619
|
}
|
|
29619
29620
|
loadIfEnabled() {
|
|
29620
29621
|
if (!(this._conversationsManager || this.Xo || this._instance.config.disable_conversations || nr(this._instance.config) || this._instance.config.cookieless_mode && this._instance.consent.isOptedOut())) {
|
|
29621
|
-
var t2 = null ==
|
|
29622
|
+
var t2 = null == h4 ? void 0 : h4.__PosthogExtensions__;
|
|
29622
29623
|
if (t2 && !N(this.Yo) && this.Yo) if (this.ea && this.ea.token) {
|
|
29623
29624
|
this.Xo = true;
|
|
29624
29625
|
try {
|
|
@@ -29735,7 +29736,7 @@ var init_module = __esm({
|
|
|
29735
29736
|
}
|
|
29736
29737
|
loadIfEnabled() {
|
|
29737
29738
|
if (this.ia && !this.na) {
|
|
29738
|
-
var t2 = null ==
|
|
29739
|
+
var t2 = null == h4 ? void 0 : h4.__PosthogExtensions__;
|
|
29739
29740
|
if (t2) {
|
|
29740
29741
|
var e2 = t2.loadExternalDependency;
|
|
29741
29742
|
e2 ? e2(this._instance, "logs", ((e3) => {
|
|
@@ -29751,13 +29752,13 @@ var init_module = __esm({
|
|
|
29751
29752
|
var a2 = null !== (e2 = null == (i2 = this._instance.config.logs) ? void 0 : i2.flushIntervalMs) && void 0 !== e2 ? e2 : 3e3, l2 = null !== (r2 = null == (s2 = this._instance.config.logs) ? void 0 : s2.maxLogsPerInterval) && void 0 !== r2 ? r2 : 1e3, u2 = Date.now();
|
|
29752
29753
|
if (a2 > u2 - this.aa || (this.aa = u2, this.oa = 0, this.ua = false), l2 > this.oa) {
|
|
29753
29754
|
this.oa++;
|
|
29754
|
-
var
|
|
29755
|
+
var h5 = (function(t3, e3) {
|
|
29755
29756
|
var i3 = t3.level || "info", { text: r3, number: s3 } = ie[i3] || re, n3 = String(Date.now()) + "000000", o3 = {};
|
|
29756
29757
|
e3.distinctId && (o3.posthogDistinctId = e3.distinctId), e3.sessionId && (o3.sessionId = e3.sessionId), e3.currentUrl && (o3["url.full"] = e3.currentUrl), e3.screenName && (o3["screen.name"] = e3.screenName), e3.appState && (o3["app.state"] = e3.appState), e3.activeFeatureFlags && e3.activeFeatureFlags.length > 0 && (o3.feature_flags = e3.activeFeatureFlags);
|
|
29757
29758
|
var a3 = f({}, o3, t3.attributes || {}), l3 = { timeUnixNano: n3, observedTimeUnixNano: n3, severityNumber: s3, severityText: r3, body: { stringValue: t3.body }, attributes: ne(a3) };
|
|
29758
29759
|
return t3.trace_id && (l3.traceId = t3.trace_id), t3.span_id && (l3.spanId = t3.span_id), N(t3.trace_flags) || (l3.flags = t3.trace_flags), l3;
|
|
29759
29760
|
})(t2, this.la());
|
|
29760
|
-
this.sa.push({ record:
|
|
29761
|
+
this.sa.push({ record: h5 }), (null !== (n2 = null == (o2 = this._instance.config.logs) ? void 0 : o2.maxBufferSize) && void 0 !== n2 ? n2 : 100) > this.sa.length ? this.ha() : this.flushLogs();
|
|
29761
29762
|
} else this.ua || (this.Gt.warn("captureLog dropping logs: exceeded " + l2 + " logs per " + a2 + "ms"), this.ua = true);
|
|
29762
29763
|
} else this.Gt.warn("captureLog requires a body");
|
|
29763
29764
|
}
|
|
@@ -29786,7 +29787,7 @@ var init_module = __esm({
|
|
|
29786
29787
|
var { sessionId: i2 } = this._instance.sessionManager.checkAndGetSessionAndWindowId(true);
|
|
29787
29788
|
e2.sessionId = i2;
|
|
29788
29789
|
}
|
|
29789
|
-
if (null !=
|
|
29790
|
+
if (null != h4 && null != (t2 = h4.location) && t2.href && (e2.currentUrl = h4.location.href), this._instance.featureFlags) {
|
|
29790
29791
|
var r2 = this._instance.featureFlags.getFlags();
|
|
29791
29792
|
r2 && r2.length > 0 && (e2.activeFeatureFlags = r2);
|
|
29792
29793
|
}
|
|
@@ -32608,6 +32609,1410 @@ var CommandSeparator = React11__namespace.forwardRef(
|
|
|
32608
32609
|
);
|
|
32609
32610
|
CommandSeparator.displayName = "CommandSeparator";
|
|
32610
32611
|
|
|
32612
|
+
// ../conversation/dist/index.js
|
|
32613
|
+
function byTime(a2, b2) {
|
|
32614
|
+
return a2.timestamp.getTime() - b2.timestamp.getTime();
|
|
32615
|
+
}
|
|
32616
|
+
function findMessage(messages, id) {
|
|
32617
|
+
return messages.find((m2) => m2.id === id);
|
|
32618
|
+
}
|
|
32619
|
+
function rootIdOf(messages, id) {
|
|
32620
|
+
const m2 = findMessage(messages, id);
|
|
32621
|
+
if (!m2) return id;
|
|
32622
|
+
return m2.parentId ?? m2.id;
|
|
32623
|
+
}
|
|
32624
|
+
function selectRoots(messages) {
|
|
32625
|
+
return messages.filter((m2) => !m2.parentId).sort(byTime);
|
|
32626
|
+
}
|
|
32627
|
+
function selectReplies(messages, rootId) {
|
|
32628
|
+
return messages.filter((m2) => m2.parentId === rootId).sort(byTime);
|
|
32629
|
+
}
|
|
32630
|
+
function selectThreadMessages(messages, rootId) {
|
|
32631
|
+
const root = findMessage(messages, rootId);
|
|
32632
|
+
const replies = selectReplies(messages, rootId);
|
|
32633
|
+
return root ? [root, ...replies] : replies;
|
|
32634
|
+
}
|
|
32635
|
+
function getReplyCount(messages, rootId) {
|
|
32636
|
+
return messages.reduce((n2, m2) => m2.parentId === rootId ? n2 + 1 : n2, 0);
|
|
32637
|
+
}
|
|
32638
|
+
function selectMainTimeline(messages, mode) {
|
|
32639
|
+
if (mode === "panel") return selectRoots(messages);
|
|
32640
|
+
return [...messages].sort(byTime);
|
|
32641
|
+
}
|
|
32642
|
+
function selectTimelineFromState(state) {
|
|
32643
|
+
return selectMainTimeline(state.messages, state.threadingMode);
|
|
32644
|
+
}
|
|
32645
|
+
var DEFAULT_ASSISTANT = { id: "assistant", name: "Assistant" };
|
|
32646
|
+
var DEFAULT_USER = { id: "user", name: "You" };
|
|
32647
|
+
var DEFAULT_TITLE = "New conversation";
|
|
32648
|
+
function defaultGenerateTitle(firstMessage) {
|
|
32649
|
+
const firstLine = firstMessage.split("\n", 1)[0].trim();
|
|
32650
|
+
if (firstLine.length <= 48) return firstLine || DEFAULT_TITLE;
|
|
32651
|
+
return `${firstLine.slice(0, 47).trimEnd()}\u2026`;
|
|
32652
|
+
}
|
|
32653
|
+
function createConversation(config = {}) {
|
|
32654
|
+
const assistant = config.assistant ?? DEFAULT_ASSISTANT;
|
|
32655
|
+
const currentUser = config.currentUser ?? DEFAULT_USER;
|
|
32656
|
+
const generateTitle = config.generateTitle ?? defaultGenerateTitle;
|
|
32657
|
+
let transport = config.transport;
|
|
32658
|
+
let threadingMode = config.threadingMode ?? "inline";
|
|
32659
|
+
const conversations = /* @__PURE__ */ new Map();
|
|
32660
|
+
const messagesByConv = /* @__PURE__ */ new Map();
|
|
32661
|
+
let activeConversationId = config.activeConversationId ?? null;
|
|
32662
|
+
let openThreadRootId = null;
|
|
32663
|
+
let status = "idle";
|
|
32664
|
+
let error = null;
|
|
32665
|
+
let abortController = null;
|
|
32666
|
+
for (const c2 of config.conversations ?? []) {
|
|
32667
|
+
conversations.set(c2.id, c2);
|
|
32668
|
+
messagesByConv.set(c2.id, []);
|
|
32669
|
+
}
|
|
32670
|
+
for (const [conversationId, msgs] of Object.entries(config.messages ?? {})) {
|
|
32671
|
+
messagesByConv.set(conversationId, [...msgs]);
|
|
32672
|
+
}
|
|
32673
|
+
if (activeConversationId === null && config.conversations?.length) {
|
|
32674
|
+
activeConversationId = config.conversations[0].id;
|
|
32675
|
+
}
|
|
32676
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
32677
|
+
let snapshot = buildSnapshot();
|
|
32678
|
+
function buildSnapshot() {
|
|
32679
|
+
return {
|
|
32680
|
+
conversations: orderedConversations(),
|
|
32681
|
+
activeConversationId,
|
|
32682
|
+
messages: activeConversationId ? messagesByConv.get(activeConversationId) ?? [] : [],
|
|
32683
|
+
openThreadRootId,
|
|
32684
|
+
threadingMode,
|
|
32685
|
+
status,
|
|
32686
|
+
error
|
|
32687
|
+
};
|
|
32688
|
+
}
|
|
32689
|
+
function emit2() {
|
|
32690
|
+
snapshot = buildSnapshot();
|
|
32691
|
+
for (const l2 of listeners) l2();
|
|
32692
|
+
}
|
|
32693
|
+
function orderedConversations() {
|
|
32694
|
+
return [...conversations.values()].sort(
|
|
32695
|
+
(a2, b2) => b2.updatedAt.getTime() - a2.updatedAt.getTime()
|
|
32696
|
+
);
|
|
32697
|
+
}
|
|
32698
|
+
function touch(conversationId) {
|
|
32699
|
+
const c2 = conversations.get(conversationId);
|
|
32700
|
+
if (c2) conversations.set(conversationId, { ...c2, updatedAt: /* @__PURE__ */ new Date() });
|
|
32701
|
+
}
|
|
32702
|
+
function ensureActiveConversation(opts) {
|
|
32703
|
+
if (opts?.conversationId) {
|
|
32704
|
+
if (!conversations.has(opts.conversationId)) createConversationInternal({}, opts.conversationId);
|
|
32705
|
+
return opts.conversationId;
|
|
32706
|
+
}
|
|
32707
|
+
if (activeConversationId && conversations.has(activeConversationId)) return activeConversationId;
|
|
32708
|
+
return createConversationInternal({}).id;
|
|
32709
|
+
}
|
|
32710
|
+
function createConversationInternal(opts, id) {
|
|
32711
|
+
const now = /* @__PURE__ */ new Date();
|
|
32712
|
+
const conversation = {
|
|
32713
|
+
id: id ?? generateId("rfr-conv"),
|
|
32714
|
+
title: opts.title ?? DEFAULT_TITLE,
|
|
32715
|
+
createdAt: now,
|
|
32716
|
+
updatedAt: now,
|
|
32717
|
+
metadata: opts.metadata
|
|
32718
|
+
};
|
|
32719
|
+
conversations.set(conversation.id, conversation);
|
|
32720
|
+
messagesByConv.set(conversation.id, []);
|
|
32721
|
+
activeConversationId = conversation.id;
|
|
32722
|
+
return conversation;
|
|
32723
|
+
}
|
|
32724
|
+
async function streamReply(conversationId, assistantMsg, userMsg, history) {
|
|
32725
|
+
abortController = new AbortController();
|
|
32726
|
+
status = "streaming";
|
|
32727
|
+
emit2();
|
|
32728
|
+
try {
|
|
32729
|
+
const stream = transport.send({
|
|
32730
|
+
conversationId,
|
|
32731
|
+
message: userMsg,
|
|
32732
|
+
history,
|
|
32733
|
+
parentId: assistantMsg.parentId,
|
|
32734
|
+
signal: abortController.signal
|
|
32735
|
+
});
|
|
32736
|
+
for await (const chunk of stream) {
|
|
32737
|
+
if (chunk.content !== void 0) assistantMsg.content = chunk.content;
|
|
32738
|
+
if (chunk.delta) assistantMsg.content += chunk.delta;
|
|
32739
|
+
if (chunk.metadata) {
|
|
32740
|
+
assistantMsg.metadata = { ...assistantMsg.metadata, ...chunk.metadata };
|
|
32741
|
+
}
|
|
32742
|
+
emit2();
|
|
32743
|
+
if (abortController.signal.aborted) break;
|
|
32744
|
+
}
|
|
32745
|
+
assistantMsg.status = "sent";
|
|
32746
|
+
status = "idle";
|
|
32747
|
+
error = null;
|
|
32748
|
+
} catch (err) {
|
|
32749
|
+
if (abortController.signal.aborted) {
|
|
32750
|
+
assistantMsg.status = "sent";
|
|
32751
|
+
status = "idle";
|
|
32752
|
+
} else {
|
|
32753
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
32754
|
+
assistantMsg.status = "error";
|
|
32755
|
+
assistantMsg.error = message;
|
|
32756
|
+
status = "error";
|
|
32757
|
+
error = message;
|
|
32758
|
+
}
|
|
32759
|
+
} finally {
|
|
32760
|
+
abortController = null;
|
|
32761
|
+
touch(conversationId);
|
|
32762
|
+
emit2();
|
|
32763
|
+
}
|
|
32764
|
+
}
|
|
32765
|
+
function historyFor(list, parentId) {
|
|
32766
|
+
const scope = parentId ? selectThreadMessages(list, parentId) : selectRoots(list);
|
|
32767
|
+
return scope.filter((m2) => m2.status !== "error");
|
|
32768
|
+
}
|
|
32769
|
+
const api = {
|
|
32770
|
+
getState() {
|
|
32771
|
+
return snapshot;
|
|
32772
|
+
},
|
|
32773
|
+
subscribe(listener) {
|
|
32774
|
+
listeners.add(listener);
|
|
32775
|
+
return () => listeners.delete(listener);
|
|
32776
|
+
},
|
|
32777
|
+
newConversation(opts) {
|
|
32778
|
+
const conversation = createConversationInternal(opts ?? {});
|
|
32779
|
+
openThreadRootId = null;
|
|
32780
|
+
emit2();
|
|
32781
|
+
return conversation;
|
|
32782
|
+
},
|
|
32783
|
+
selectConversation(conversationId) {
|
|
32784
|
+
if (!conversations.has(conversationId) || activeConversationId === conversationId) return;
|
|
32785
|
+
activeConversationId = conversationId;
|
|
32786
|
+
openThreadRootId = null;
|
|
32787
|
+
emit2();
|
|
32788
|
+
},
|
|
32789
|
+
deleteConversation(conversationId) {
|
|
32790
|
+
if (!conversations.has(conversationId)) return;
|
|
32791
|
+
conversations.delete(conversationId);
|
|
32792
|
+
messagesByConv.delete(conversationId);
|
|
32793
|
+
if (activeConversationId === conversationId) {
|
|
32794
|
+
activeConversationId = orderedConversations()[0]?.id ?? null;
|
|
32795
|
+
openThreadRootId = null;
|
|
32796
|
+
}
|
|
32797
|
+
emit2();
|
|
32798
|
+
},
|
|
32799
|
+
renameConversation(conversationId, title) {
|
|
32800
|
+
const c2 = conversations.get(conversationId);
|
|
32801
|
+
if (!c2) return;
|
|
32802
|
+
conversations.set(conversationId, { ...c2, title });
|
|
32803
|
+
emit2();
|
|
32804
|
+
},
|
|
32805
|
+
appendMessage(message) {
|
|
32806
|
+
const list = messagesByConv.get(message.conversationId);
|
|
32807
|
+
if (!list) return;
|
|
32808
|
+
list.push(message);
|
|
32809
|
+
touch(message.conversationId);
|
|
32810
|
+
emit2();
|
|
32811
|
+
},
|
|
32812
|
+
editMessage(messageId, content) {
|
|
32813
|
+
if (!activeConversationId) return;
|
|
32814
|
+
const list = messagesByConv.get(activeConversationId);
|
|
32815
|
+
const msg = list.find((m2) => m2.id === messageId);
|
|
32816
|
+
if (!msg) return;
|
|
32817
|
+
msg.content = content;
|
|
32818
|
+
msg.edited = true;
|
|
32819
|
+
emit2();
|
|
32820
|
+
},
|
|
32821
|
+
deleteMessage(messageId) {
|
|
32822
|
+
if (!activeConversationId) return;
|
|
32823
|
+
const list = messagesByConv.get(activeConversationId);
|
|
32824
|
+
const msg = list.find((m2) => m2.id === messageId);
|
|
32825
|
+
if (!msg) return;
|
|
32826
|
+
const removeIds = /* @__PURE__ */ new Set([messageId]);
|
|
32827
|
+
if (!msg.parentId) {
|
|
32828
|
+
for (const r2 of list) if (r2.parentId === messageId) removeIds.add(r2.id);
|
|
32829
|
+
}
|
|
32830
|
+
const next = list.filter((m2) => !removeIds.has(m2.id));
|
|
32831
|
+
messagesByConv.set(activeConversationId, next);
|
|
32832
|
+
if (openThreadRootId && removeIds.has(openThreadRootId)) openThreadRootId = null;
|
|
32833
|
+
emit2();
|
|
32834
|
+
},
|
|
32835
|
+
react(messageId, emoji) {
|
|
32836
|
+
if (!activeConversationId) return;
|
|
32837
|
+
const list = messagesByConv.get(activeConversationId);
|
|
32838
|
+
const msg = list.find((m2) => m2.id === messageId);
|
|
32839
|
+
if (!msg) return;
|
|
32840
|
+
const reactions = [...msg.reactions ?? []];
|
|
32841
|
+
const idx = reactions.findIndex((r2) => r2.emoji === emoji);
|
|
32842
|
+
if (idx === -1) {
|
|
32843
|
+
reactions.push({ emoji, count: 1, userReacted: true });
|
|
32844
|
+
} else {
|
|
32845
|
+
const r2 = reactions[idx];
|
|
32846
|
+
if (r2.userReacted) {
|
|
32847
|
+
const count = r2.count - 1;
|
|
32848
|
+
if (count <= 0) reactions.splice(idx, 1);
|
|
32849
|
+
else reactions[idx] = { ...r2, count, userReacted: false };
|
|
32850
|
+
} else {
|
|
32851
|
+
reactions[idx] = { ...r2, count: r2.count + 1, userReacted: true };
|
|
32852
|
+
}
|
|
32853
|
+
}
|
|
32854
|
+
msg.reactions = reactions;
|
|
32855
|
+
emit2();
|
|
32856
|
+
},
|
|
32857
|
+
async sendMessage(content, opts) {
|
|
32858
|
+
const trimmed = content.trim();
|
|
32859
|
+
if (!trimmed && !opts?.attachments?.length) return;
|
|
32860
|
+
const conversationId = ensureActiveConversation(opts);
|
|
32861
|
+
const list = messagesByConv.get(conversationId);
|
|
32862
|
+
const parentId = opts?.replyTo ? rootIdOf(list, opts.replyTo) : void 0;
|
|
32863
|
+
const isFirstRoot = !parentId && selectRoots(list).length === 0;
|
|
32864
|
+
const userMsg = {
|
|
32865
|
+
id: generateId("rfr-msg"),
|
|
32866
|
+
conversationId,
|
|
32867
|
+
role: "user",
|
|
32868
|
+
author: currentUser,
|
|
32869
|
+
content: trimmed,
|
|
32870
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
32871
|
+
status: "sent",
|
|
32872
|
+
parentId,
|
|
32873
|
+
attachments: opts?.attachments,
|
|
32874
|
+
metadata: opts?.metadata
|
|
32875
|
+
};
|
|
32876
|
+
list.push(userMsg);
|
|
32877
|
+
const conversation = conversations.get(conversationId);
|
|
32878
|
+
if (isFirstRoot && conversation.title === DEFAULT_TITLE) {
|
|
32879
|
+
conversations.set(conversationId, { ...conversation, title: generateTitle(trimmed) });
|
|
32880
|
+
}
|
|
32881
|
+
touch(conversationId);
|
|
32882
|
+
if (!transport) {
|
|
32883
|
+
status = "idle";
|
|
32884
|
+
emit2();
|
|
32885
|
+
return;
|
|
32886
|
+
}
|
|
32887
|
+
const history = historyFor(list, parentId).filter((m2) => m2.id !== userMsg.id);
|
|
32888
|
+
const assistantMsg = {
|
|
32889
|
+
id: generateId("rfr-msg"),
|
|
32890
|
+
conversationId,
|
|
32891
|
+
role: "assistant",
|
|
32892
|
+
author: assistant,
|
|
32893
|
+
content: "",
|
|
32894
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
32895
|
+
status: "streaming",
|
|
32896
|
+
parentId
|
|
32897
|
+
};
|
|
32898
|
+
list.push(assistantMsg);
|
|
32899
|
+
await streamReply(conversationId, assistantMsg, userMsg, history);
|
|
32900
|
+
},
|
|
32901
|
+
async retryLast() {
|
|
32902
|
+
if (!activeConversationId || !transport) return;
|
|
32903
|
+
const list = messagesByConv.get(activeConversationId);
|
|
32904
|
+
const last = list[list.length - 1];
|
|
32905
|
+
const parentId = last?.parentId;
|
|
32906
|
+
if (last && last.role === "assistant" && last.status === "error") list.pop();
|
|
32907
|
+
const scope = parentId ? selectThreadMessages(list, parentId) : selectRoots(list);
|
|
32908
|
+
const lastUser = [...scope].reverse().find((m2) => m2.role === "user");
|
|
32909
|
+
if (!lastUser) return;
|
|
32910
|
+
const history = historyFor(list, parentId);
|
|
32911
|
+
const assistantMsg = {
|
|
32912
|
+
id: generateId("rfr-msg"),
|
|
32913
|
+
conversationId: activeConversationId,
|
|
32914
|
+
role: "assistant",
|
|
32915
|
+
author: assistant,
|
|
32916
|
+
content: "",
|
|
32917
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
32918
|
+
status: "streaming",
|
|
32919
|
+
parentId
|
|
32920
|
+
};
|
|
32921
|
+
list.push(assistantMsg);
|
|
32922
|
+
await streamReply(activeConversationId, assistantMsg, lastUser, history);
|
|
32923
|
+
},
|
|
32924
|
+
stop() {
|
|
32925
|
+
abortController?.abort();
|
|
32926
|
+
},
|
|
32927
|
+
openThread(rootId) {
|
|
32928
|
+
openThreadRootId = rootId;
|
|
32929
|
+
emit2();
|
|
32930
|
+
},
|
|
32931
|
+
closeThread() {
|
|
32932
|
+
if (openThreadRootId === null) return;
|
|
32933
|
+
openThreadRootId = null;
|
|
32934
|
+
emit2();
|
|
32935
|
+
},
|
|
32936
|
+
setThreadingMode(mode) {
|
|
32937
|
+
if (threadingMode === mode) return;
|
|
32938
|
+
threadingMode = mode;
|
|
32939
|
+
emit2();
|
|
32940
|
+
},
|
|
32941
|
+
setTransport(next) {
|
|
32942
|
+
transport = next;
|
|
32943
|
+
}
|
|
32944
|
+
};
|
|
32945
|
+
return api;
|
|
32946
|
+
}
|
|
32947
|
+
|
|
32948
|
+
// ../markdown-renderer/dist/index.js
|
|
32949
|
+
function escapeHtml(text) {
|
|
32950
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
32951
|
+
}
|
|
32952
|
+
function parseInline(text, linkResolver) {
|
|
32953
|
+
let result = escapeHtml(text);
|
|
32954
|
+
result = result.replace(/`([^`]+)`/g, "<code>$1</code>");
|
|
32955
|
+
result = result.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
|
|
32956
|
+
result = result.replace(/__([^_]+)__/g, "<strong>$1</strong>");
|
|
32957
|
+
result = result.replace(/\*([^*]+)\*/g, "<em>$1</em>");
|
|
32958
|
+
result = result.replace(/_([^_]+)_/g, "<em>$1</em>");
|
|
32959
|
+
result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_match, text2, url) => {
|
|
32960
|
+
if (/^\s*javascript\s*:/i.test(url)) {
|
|
32961
|
+
return text2;
|
|
32962
|
+
}
|
|
32963
|
+
const resolvedUrl = linkResolver ? linkResolver(url) : url;
|
|
32964
|
+
return `<a href="${resolvedUrl}">${text2}</a>`;
|
|
32965
|
+
});
|
|
32966
|
+
return result;
|
|
32967
|
+
}
|
|
32968
|
+
function parseMarkdown(content, linkResolver) {
|
|
32969
|
+
const lines = content.split("\n");
|
|
32970
|
+
const outputLines = [];
|
|
32971
|
+
let inCodeBlock = false;
|
|
32972
|
+
let codeBlockContent = [];
|
|
32973
|
+
let codeBlockLang = "";
|
|
32974
|
+
let inList = null;
|
|
32975
|
+
let inBlockquote = false;
|
|
32976
|
+
function closeList() {
|
|
32977
|
+
if (inList) {
|
|
32978
|
+
outputLines.push(inList === "ul" ? "</ul>" : "</ol>");
|
|
32979
|
+
inList = null;
|
|
32980
|
+
}
|
|
32981
|
+
}
|
|
32982
|
+
function closeBlockquote() {
|
|
32983
|
+
if (inBlockquote) {
|
|
32984
|
+
outputLines.push("</blockquote>");
|
|
32985
|
+
inBlockquote = false;
|
|
32986
|
+
}
|
|
32987
|
+
}
|
|
32988
|
+
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
32989
|
+
const line = lines[i2];
|
|
32990
|
+
if (line.trimStart().startsWith("```")) {
|
|
32991
|
+
if (inCodeBlock) {
|
|
32992
|
+
outputLines.push(`<pre><code${codeBlockLang ? ` class="language-${escapeHtml(codeBlockLang)}"` : ""}>${escapeHtml(codeBlockContent.join("\n"))}</code></pre>`);
|
|
32993
|
+
codeBlockContent = [];
|
|
32994
|
+
codeBlockLang = "";
|
|
32995
|
+
inCodeBlock = false;
|
|
32996
|
+
} else {
|
|
32997
|
+
closeList();
|
|
32998
|
+
closeBlockquote();
|
|
32999
|
+
inCodeBlock = true;
|
|
33000
|
+
codeBlockLang = line.trimStart().slice(3).trim();
|
|
33001
|
+
}
|
|
33002
|
+
continue;
|
|
33003
|
+
}
|
|
33004
|
+
if (inCodeBlock) {
|
|
33005
|
+
codeBlockContent.push(line);
|
|
33006
|
+
continue;
|
|
33007
|
+
}
|
|
33008
|
+
if (/^(\s*[-*_]\s*){3,}$/.test(line)) {
|
|
33009
|
+
closeList();
|
|
33010
|
+
closeBlockquote();
|
|
33011
|
+
outputLines.push("<hr />");
|
|
33012
|
+
continue;
|
|
33013
|
+
}
|
|
33014
|
+
const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
33015
|
+
if (headingMatch) {
|
|
33016
|
+
closeList();
|
|
33017
|
+
closeBlockquote();
|
|
33018
|
+
const level = headingMatch[1].length;
|
|
33019
|
+
const text = parseInline(headingMatch[2], linkResolver);
|
|
33020
|
+
outputLines.push(`<h${level}>${text}</h${level}>`);
|
|
33021
|
+
continue;
|
|
33022
|
+
}
|
|
33023
|
+
const blockquoteMatch = line.match(/^>\s?(.*)$/);
|
|
33024
|
+
if (blockquoteMatch) {
|
|
33025
|
+
closeList();
|
|
33026
|
+
if (!inBlockquote) {
|
|
33027
|
+
inBlockquote = true;
|
|
33028
|
+
outputLines.push("<blockquote>");
|
|
33029
|
+
}
|
|
33030
|
+
const text = blockquoteMatch[1].trim();
|
|
33031
|
+
if (text) {
|
|
33032
|
+
outputLines.push(`<p>${parseInline(text, linkResolver)}</p>`);
|
|
33033
|
+
}
|
|
33034
|
+
continue;
|
|
33035
|
+
} else if (inBlockquote) {
|
|
33036
|
+
closeBlockquote();
|
|
33037
|
+
}
|
|
33038
|
+
const ulMatch = line.match(/^[\s]*[-*+]\s+(.+)$/);
|
|
33039
|
+
if (ulMatch) {
|
|
33040
|
+
closeBlockquote();
|
|
33041
|
+
if (inList !== "ul") {
|
|
33042
|
+
closeList();
|
|
33043
|
+
inList = "ul";
|
|
33044
|
+
outputLines.push("<ul>");
|
|
33045
|
+
}
|
|
33046
|
+
outputLines.push(`<li>${parseInline(ulMatch[1], linkResolver)}</li>`);
|
|
33047
|
+
continue;
|
|
33048
|
+
}
|
|
33049
|
+
const olMatch = line.match(/^[\s]*\d+\.\s+(.+)$/);
|
|
33050
|
+
if (olMatch) {
|
|
33051
|
+
closeBlockquote();
|
|
33052
|
+
if (inList !== "ol") {
|
|
33053
|
+
closeList();
|
|
33054
|
+
inList = "ol";
|
|
33055
|
+
outputLines.push("<ol>");
|
|
33056
|
+
}
|
|
33057
|
+
outputLines.push(`<li>${parseInline(olMatch[1], linkResolver)}</li>`);
|
|
33058
|
+
continue;
|
|
33059
|
+
}
|
|
33060
|
+
if (inList) {
|
|
33061
|
+
closeList();
|
|
33062
|
+
}
|
|
33063
|
+
if (line.trim() === "") {
|
|
33064
|
+
continue;
|
|
33065
|
+
}
|
|
33066
|
+
outputLines.push(`<p>${parseInline(line, linkResolver)}</p>`);
|
|
33067
|
+
}
|
|
33068
|
+
if (inCodeBlock) {
|
|
33069
|
+
outputLines.push(`<pre><code${codeBlockLang ? ` class="language-${escapeHtml(codeBlockLang)}"` : ""}>${escapeHtml(codeBlockContent.join("\n"))}</code></pre>`);
|
|
33070
|
+
}
|
|
33071
|
+
closeList();
|
|
33072
|
+
closeBlockquote();
|
|
33073
|
+
return outputLines.join("\n");
|
|
33074
|
+
}
|
|
33075
|
+
function extractComponents(content, components) {
|
|
33076
|
+
if (!components) return [];
|
|
33077
|
+
const extracted = [];
|
|
33078
|
+
for (const [name, def] of Object.entries(components)) {
|
|
33079
|
+
const matches = Array.from(content.matchAll(def.pattern));
|
|
33080
|
+
matches.forEach(() => {
|
|
33081
|
+
extracted.push({
|
|
33082
|
+
name,
|
|
33083
|
+
props: { ...def.props }
|
|
33084
|
+
});
|
|
33085
|
+
});
|
|
33086
|
+
}
|
|
33087
|
+
return extracted;
|
|
33088
|
+
}
|
|
33089
|
+
function createMarkdownRenderer(props) {
|
|
33090
|
+
const { content, components, linkResolver } = props;
|
|
33091
|
+
const html = parseMarkdown(content, linkResolver);
|
|
33092
|
+
const extractedComponents = extractComponents(content, components);
|
|
33093
|
+
const ariaProps = {
|
|
33094
|
+
role: "document",
|
|
33095
|
+
"aria-label": "Rendered markdown content"
|
|
33096
|
+
};
|
|
33097
|
+
return {
|
|
33098
|
+
html,
|
|
33099
|
+
components: extractedComponents,
|
|
33100
|
+
ariaProps
|
|
33101
|
+
};
|
|
33102
|
+
}
|
|
33103
|
+
var markdownRendererTokens = {
|
|
33104
|
+
name: "markdown-renderer",
|
|
33105
|
+
tokens: {
|
|
33106
|
+
bg: { variable: "--rfr-markdown-bg", fallback: "hsl(var(--background))" },
|
|
33107
|
+
fg: { variable: "--rfr-markdown-fg", fallback: "hsl(var(--foreground))" },
|
|
33108
|
+
codeBg: { variable: "--rfr-markdown-code-bg", fallback: "hsl(var(--muted))" },
|
|
33109
|
+
linkColor: { variable: "--rfr-markdown-link", fallback: "hsl(var(--primary))" },
|
|
33110
|
+
borderColor: { variable: "--rfr-markdown-border", fallback: "hsl(var(--border))" }
|
|
33111
|
+
}
|
|
33112
|
+
};
|
|
33113
|
+
var proseVariants = cva({
|
|
33114
|
+
base: "prose max-w-none text-foreground leading-relaxed",
|
|
33115
|
+
variants: {
|
|
33116
|
+
size: {
|
|
33117
|
+
sm: "prose-sm text-sm",
|
|
33118
|
+
default: "prose-base text-base",
|
|
33119
|
+
lg: "prose-lg text-lg"
|
|
33120
|
+
},
|
|
33121
|
+
theme: {
|
|
33122
|
+
light: "bg-white text-gray-900",
|
|
33123
|
+
dark: "bg-gray-900 text-gray-100"
|
|
33124
|
+
}
|
|
33125
|
+
},
|
|
33126
|
+
defaultVariants: {
|
|
33127
|
+
size: "default"
|
|
33128
|
+
}
|
|
33129
|
+
});
|
|
33130
|
+
function sanitizeHtml(html) {
|
|
33131
|
+
let sanitized = html;
|
|
33132
|
+
sanitized = sanitized.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "");
|
|
33133
|
+
sanitized = sanitized.replace(/<\/?script[^>]*>/gi, "");
|
|
33134
|
+
sanitized = sanitized.replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "");
|
|
33135
|
+
sanitized = sanitized.replace(/(href|src)\s*=\s*["']?\s*javascript\s*:[^"'>]*/gi, '$1=""');
|
|
33136
|
+
return sanitized;
|
|
33137
|
+
}
|
|
33138
|
+
var MarkdownRenderer = React11__namespace.forwardRef(
|
|
33139
|
+
({ content, components, linkResolver, className, size }, ref) => {
|
|
33140
|
+
const coreProps = { content, components, linkResolver };
|
|
33141
|
+
const api = createMarkdownRenderer(coreProps);
|
|
33142
|
+
const classes = cn(proseVariants({ size }), className);
|
|
33143
|
+
const sanitizedHtml = sanitizeHtml(api.html);
|
|
33144
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
33145
|
+
"div",
|
|
33146
|
+
{
|
|
33147
|
+
ref,
|
|
33148
|
+
className: classes,
|
|
33149
|
+
...api.ariaProps,
|
|
33150
|
+
dangerouslySetInnerHTML: { __html: sanitizedHtml }
|
|
33151
|
+
}
|
|
33152
|
+
);
|
|
33153
|
+
}
|
|
33154
|
+
);
|
|
33155
|
+
MarkdownRenderer.displayName = "MarkdownRenderer";
|
|
33156
|
+
|
|
33157
|
+
// ../thread-view/dist/index.js
|
|
33158
|
+
function formatTimestamp(date) {
|
|
33159
|
+
const hours = date.getHours();
|
|
33160
|
+
const minutes = date.getMinutes();
|
|
33161
|
+
const ampm = hours >= 12 ? "PM" : "AM";
|
|
33162
|
+
const displayHours = hours % 12 || 12;
|
|
33163
|
+
const displayMinutes = minutes < 10 ? `0${minutes}` : `${minutes}`;
|
|
33164
|
+
return `${displayHours}:${displayMinutes} ${ampm}`;
|
|
33165
|
+
}
|
|
33166
|
+
function formatRelativeTime(date, now) {
|
|
33167
|
+
const reference = now ?? /* @__PURE__ */ new Date();
|
|
33168
|
+
const diffMs = reference.getTime() - date.getTime();
|
|
33169
|
+
const diffSeconds = Math.floor(diffMs / 1e3);
|
|
33170
|
+
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
33171
|
+
const diffHours = Math.floor(diffMinutes / 60);
|
|
33172
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
33173
|
+
if (diffSeconds < 60) return "just now";
|
|
33174
|
+
if (diffMinutes < 60) return `${diffMinutes} minute${diffMinutes === 1 ? "" : "s"} ago`;
|
|
33175
|
+
if (diffHours < 24) return `${diffHours} hour${diffHours === 1 ? "" : "s"} ago`;
|
|
33176
|
+
if (diffDays < 7) return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
|
|
33177
|
+
return date.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
|
33178
|
+
}
|
|
33179
|
+
function createThreadView(props) {
|
|
33180
|
+
const { messages, onReply, onReact, currentUserId } = props;
|
|
33181
|
+
let replyingTo = null;
|
|
33182
|
+
const threadId = generateId("rfr-thread");
|
|
33183
|
+
const labelId = generateId("rfr-thread-label");
|
|
33184
|
+
function startReply(messageId) {
|
|
33185
|
+
replyingTo = messageId;
|
|
33186
|
+
}
|
|
33187
|
+
function cancelReply() {
|
|
33188
|
+
replyingTo = null;
|
|
33189
|
+
}
|
|
33190
|
+
function reply(messageId, content) {
|
|
33191
|
+
onReply?.(messageId, content);
|
|
33192
|
+
replyingTo = null;
|
|
33193
|
+
}
|
|
33194
|
+
function react(messageId, emoji) {
|
|
33195
|
+
onReact?.(messageId, emoji);
|
|
33196
|
+
}
|
|
33197
|
+
const ariaProps = {
|
|
33198
|
+
role: "log",
|
|
33199
|
+
"aria-label": "Message thread",
|
|
33200
|
+
"aria-live": "polite",
|
|
33201
|
+
id: threadId
|
|
33202
|
+
};
|
|
33203
|
+
function getMessageAriaProps(message) {
|
|
33204
|
+
const isOwn = currentUserId && message.author.id === currentUserId;
|
|
33205
|
+
return {
|
|
33206
|
+
role: "article",
|
|
33207
|
+
"aria-label": `Message from ${message.author.name}${isOwn ? " (you)" : ""} at ${formatTimestamp(message.timestamp)}`
|
|
33208
|
+
};
|
|
33209
|
+
}
|
|
33210
|
+
function getReplyButtonAriaProps(_messageId) {
|
|
33211
|
+
return {
|
|
33212
|
+
role: "button",
|
|
33213
|
+
"aria-label": `Reply to message`
|
|
33214
|
+
};
|
|
33215
|
+
}
|
|
33216
|
+
return {
|
|
33217
|
+
state: {
|
|
33218
|
+
messages,
|
|
33219
|
+
get replyingTo() {
|
|
33220
|
+
return replyingTo;
|
|
33221
|
+
}
|
|
33222
|
+
},
|
|
33223
|
+
startReply,
|
|
33224
|
+
cancelReply,
|
|
33225
|
+
reply,
|
|
33226
|
+
react,
|
|
33227
|
+
formatTimestamp,
|
|
33228
|
+
formatRelativeTime,
|
|
33229
|
+
ariaProps,
|
|
33230
|
+
getMessageAriaProps,
|
|
33231
|
+
getReplyButtonAriaProps,
|
|
33232
|
+
ids: {
|
|
33233
|
+
thread: threadId,
|
|
33234
|
+
label: labelId
|
|
33235
|
+
}
|
|
33236
|
+
};
|
|
33237
|
+
}
|
|
33238
|
+
var threadContainerStyles = "flex flex-col gap-1";
|
|
33239
|
+
var threadMessageStyles = "flex gap-3 px-4 py-2 hover:bg-accent/50 rounded-md transition-colors group";
|
|
33240
|
+
var threadAvatarStyles = "h-9 w-9 rounded-full bg-muted flex items-center justify-center text-sm font-medium overflow-hidden flex-shrink-0";
|
|
33241
|
+
var threadContentStyles = "flex-1 min-w-0";
|
|
33242
|
+
var threadAuthorStyles = "font-semibold text-sm";
|
|
33243
|
+
var threadTimestampStyles = "text-xs text-muted-foreground ml-2";
|
|
33244
|
+
var threadBodyStyles = "text-sm mt-0.5 whitespace-pre-wrap break-words";
|
|
33245
|
+
var threadReactionsStyles = "flex flex-wrap gap-1 mt-1";
|
|
33246
|
+
var threadReplyIndicatorStyles = "flex items-center gap-1 mt-1 text-xs text-primary cursor-pointer hover:underline";
|
|
33247
|
+
var threadActionsStyles = "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity";
|
|
33248
|
+
var threadAttachmentStyles = "flex items-center gap-2 mt-1 p-2 rounded border text-xs bg-muted/50";
|
|
33249
|
+
var threadEditedStyles = "text-xs text-muted-foreground ml-1";
|
|
33250
|
+
|
|
33251
|
+
// ../react-conversation/dist/index.js
|
|
33252
|
+
function useConversation(config) {
|
|
33253
|
+
const apiRef = React11__namespace.useRef(null);
|
|
33254
|
+
if (apiRef.current === null) {
|
|
33255
|
+
apiRef.current = createConversation(config);
|
|
33256
|
+
}
|
|
33257
|
+
const api = apiRef.current;
|
|
33258
|
+
const state = React11__namespace.useSyncExternalStore(api.subscribe, api.getState, api.getState);
|
|
33259
|
+
const transport = config?.transport;
|
|
33260
|
+
React11__namespace.useEffect(() => {
|
|
33261
|
+
if (transport) api.setTransport(transport);
|
|
33262
|
+
}, [api, transport]);
|
|
33263
|
+
return {
|
|
33264
|
+
state,
|
|
33265
|
+
api,
|
|
33266
|
+
sendMessage: api.sendMessage,
|
|
33267
|
+
newConversation: api.newConversation,
|
|
33268
|
+
selectConversation: api.selectConversation,
|
|
33269
|
+
deleteConversation: api.deleteConversation,
|
|
33270
|
+
renameConversation: api.renameConversation,
|
|
33271
|
+
editMessage: api.editMessage,
|
|
33272
|
+
deleteMessage: api.deleteMessage,
|
|
33273
|
+
react: api.react,
|
|
33274
|
+
retryLast: api.retryLast,
|
|
33275
|
+
stop: api.stop,
|
|
33276
|
+
openThread: api.openThread,
|
|
33277
|
+
closeThread: api.closeThread,
|
|
33278
|
+
setThreadingMode: api.setThreadingMode
|
|
33279
|
+
};
|
|
33280
|
+
}
|
|
33281
|
+
var h = React11__namespace.createElement;
|
|
33282
|
+
var EMOJI = {
|
|
33283
|
+
smile: "\u{1F604}",
|
|
33284
|
+
grin: "\u{1F601}",
|
|
33285
|
+
joy: "\u{1F602}",
|
|
33286
|
+
rofl: "\u{1F923}",
|
|
33287
|
+
wink: "\u{1F609}",
|
|
33288
|
+
heart_eyes: "\u{1F60D}",
|
|
33289
|
+
thinking: "\u{1F914}",
|
|
33290
|
+
neutral: "\u{1F610}",
|
|
33291
|
+
sob: "\u{1F62D}",
|
|
33292
|
+
scream: "\u{1F631}",
|
|
33293
|
+
tada: "\u{1F389}",
|
|
33294
|
+
fire: "\u{1F525}",
|
|
33295
|
+
heart: "\u2764\uFE0F",
|
|
33296
|
+
thumbsup: "\u{1F44D}",
|
|
33297
|
+
thumbsdown: "\u{1F44E}",
|
|
33298
|
+
clap: "\u{1F44F}",
|
|
33299
|
+
pray: "\u{1F64F}",
|
|
33300
|
+
eyes: "\u{1F440}",
|
|
33301
|
+
rocket: "\u{1F680}",
|
|
33302
|
+
sparkles: "\u2728",
|
|
33303
|
+
star: "\u2B50",
|
|
33304
|
+
check: "\u2705",
|
|
33305
|
+
x: "\u274C",
|
|
33306
|
+
warning: "\u26A0\uFE0F",
|
|
33307
|
+
bulb: "\u{1F4A1}",
|
|
33308
|
+
bug: "\u{1F41B}",
|
|
33309
|
+
wave: "\u{1F44B}",
|
|
33310
|
+
ok_hand: "\u{1F44C}",
|
|
33311
|
+
muscle: "\u{1F4AA}",
|
|
33312
|
+
"100": "\u{1F4AF}",
|
|
33313
|
+
poop: "\u{1F4A9}",
|
|
33314
|
+
ghost: "\u{1F47B}",
|
|
33315
|
+
robot: "\u{1F916}",
|
|
33316
|
+
cat: "\u{1F431}",
|
|
33317
|
+
dog: "\u{1F436}",
|
|
33318
|
+
coffee: "\u2615",
|
|
33319
|
+
pizza: "\u{1F355}",
|
|
33320
|
+
beer: "\u{1F37A}",
|
|
33321
|
+
sun: "\u2600\uFE0F",
|
|
33322
|
+
moon: "\u{1F319}",
|
|
33323
|
+
zap: "\u26A1"
|
|
33324
|
+
};
|
|
33325
|
+
function detectTrigger(text, caret) {
|
|
33326
|
+
const before = text.slice(0, caret);
|
|
33327
|
+
const m2 = before.match(/(?:^|\s)([/@:])([\w+-]*)$/);
|
|
33328
|
+
if (!m2) return null;
|
|
33329
|
+
const type = m2[1];
|
|
33330
|
+
const query = m2[2] ?? "";
|
|
33331
|
+
return { type, query, start: caret - query.length - 1, end: caret };
|
|
33332
|
+
}
|
|
33333
|
+
function Composer({
|
|
33334
|
+
placeholder = "Type a message\u2026 (/ commands, @ mentions, : emoji)",
|
|
33335
|
+
busy = false,
|
|
33336
|
+
slashCommands = [],
|
|
33337
|
+
mentions,
|
|
33338
|
+
toolbar = true,
|
|
33339
|
+
emoji = true,
|
|
33340
|
+
attachments = true,
|
|
33341
|
+
onSubmit,
|
|
33342
|
+
onStop,
|
|
33343
|
+
onSlashCommand,
|
|
33344
|
+
autoFocus
|
|
33345
|
+
}) {
|
|
33346
|
+
const [value, setValue2] = React11__namespace.useState("");
|
|
33347
|
+
const [pending, setPending] = React11__namespace.useState([]);
|
|
33348
|
+
const [trigger, setTrigger] = React11__namespace.useState(null);
|
|
33349
|
+
const [active, setActive] = React11__namespace.useState(0);
|
|
33350
|
+
const [mentionItems, setMentionItems] = React11__namespace.useState([]);
|
|
33351
|
+
const ref = React11__namespace.useRef(null);
|
|
33352
|
+
const fileRef = React11__namespace.useRef(null);
|
|
33353
|
+
React11__namespace.useEffect(() => {
|
|
33354
|
+
if (trigger?.type !== "@" || !mentions) {
|
|
33355
|
+
setMentionItems([]);
|
|
33356
|
+
return;
|
|
33357
|
+
}
|
|
33358
|
+
if (Array.isArray(mentions)) {
|
|
33359
|
+
const q2 = trigger.query.toLowerCase();
|
|
33360
|
+
setMentionItems(mentions.filter((m2) => m2.label.toLowerCase().includes(q2)).slice(0, 8));
|
|
33361
|
+
return;
|
|
33362
|
+
}
|
|
33363
|
+
let cancelled = false;
|
|
33364
|
+
Promise.resolve(mentions(trigger.query)).then((res) => {
|
|
33365
|
+
if (!cancelled) setMentionItems(res.slice(0, 8));
|
|
33366
|
+
});
|
|
33367
|
+
return () => {
|
|
33368
|
+
cancelled = true;
|
|
33369
|
+
};
|
|
33370
|
+
}, [trigger, mentions]);
|
|
33371
|
+
const items = React11__namespace.useMemo(() => {
|
|
33372
|
+
if (!trigger) return [];
|
|
33373
|
+
const q2 = trigger.query.toLowerCase();
|
|
33374
|
+
if (trigger.type === "/") {
|
|
33375
|
+
return slashCommands.filter((c2) => c2.label.toLowerCase().includes(q2) || c2.id.toLowerCase().includes(q2)).slice(0, 8).map((c2) => ({ key: c2.id, primary: c2.label, secondary: c2.description, icon: c2.icon, apply: c2.insertText ?? "", runCmd: c2 }));
|
|
33376
|
+
}
|
|
33377
|
+
if (trigger.type === "@") {
|
|
33378
|
+
return mentionItems.map((m2) => ({ key: m2.id, primary: m2.label, icon: m2.avatarUrl ? "" : "@", apply: `@${m2.label} ` }));
|
|
33379
|
+
}
|
|
33380
|
+
if (trigger.type === ":" && emoji) {
|
|
33381
|
+
return Object.entries(EMOJI).filter(([name]) => name.includes(q2)).slice(0, 8).map(([name, char]) => ({ key: name, primary: `${char} :${name}:`, apply: char }));
|
|
33382
|
+
}
|
|
33383
|
+
return [];
|
|
33384
|
+
}, [trigger, slashCommands, mentionItems, emoji]);
|
|
33385
|
+
const menuOpen = trigger !== null && items.length > 0;
|
|
33386
|
+
React11__namespace.useEffect(() => setActive(0), [trigger?.type, trigger?.query]);
|
|
33387
|
+
function syncFromTextarea(el) {
|
|
33388
|
+
setValue2(el.value);
|
|
33389
|
+
setTrigger(detectTrigger(el.value, el.selectionStart ?? el.value.length));
|
|
33390
|
+
}
|
|
33391
|
+
function selectItem(i2) {
|
|
33392
|
+
const item = items[i2];
|
|
33393
|
+
if (!item || !trigger) return;
|
|
33394
|
+
if (trigger.type === "/" && !item.apply && item.runCmd) {
|
|
33395
|
+
const next2 = value.slice(0, trigger.start) + value.slice(trigger.end);
|
|
33396
|
+
setValue2(next2);
|
|
33397
|
+
setTrigger(null);
|
|
33398
|
+
onSlashCommand?.(item.runCmd);
|
|
33399
|
+
queueCaret(trigger.start);
|
|
33400
|
+
return;
|
|
33401
|
+
}
|
|
33402
|
+
const next = value.slice(0, trigger.start) + item.apply + value.slice(trigger.end);
|
|
33403
|
+
setValue2(next);
|
|
33404
|
+
setTrigger(null);
|
|
33405
|
+
queueCaret(trigger.start + item.apply.length);
|
|
33406
|
+
}
|
|
33407
|
+
function queueCaret(pos) {
|
|
33408
|
+
requestAnimationFrame(() => {
|
|
33409
|
+
const el = ref.current;
|
|
33410
|
+
if (!el) return;
|
|
33411
|
+
el.focus();
|
|
33412
|
+
el.setSelectionRange(pos, pos);
|
|
33413
|
+
});
|
|
33414
|
+
}
|
|
33415
|
+
function format(kind) {
|
|
33416
|
+
const el = ref.current;
|
|
33417
|
+
if (!el) return;
|
|
33418
|
+
const start = el.selectionStart ?? 0;
|
|
33419
|
+
const end = el.selectionEnd ?? 0;
|
|
33420
|
+
const sel = value.slice(start, end);
|
|
33421
|
+
let replacement = sel;
|
|
33422
|
+
let caretOffset = 0;
|
|
33423
|
+
if (kind === "bold") replacement = `**${sel || "bold"}**`;
|
|
33424
|
+
else if (kind === "italic") replacement = `*${sel || "italic"}*`;
|
|
33425
|
+
else if (kind === "code") replacement = sel.includes("\n") ? `
|
|
33426
|
+
\`\`\`
|
|
33427
|
+
${sel}
|
|
33428
|
+
\`\`\`
|
|
33429
|
+
` : `\`${sel || "code"}\``;
|
|
33430
|
+
else if (kind === "link") {
|
|
33431
|
+
replacement = `[${sel || "text"}](url)`;
|
|
33432
|
+
caretOffset = replacement.length - 4;
|
|
33433
|
+
} else if (kind === "quote" || kind === "ul" || kind === "ol") {
|
|
33434
|
+
const prefix = kind === "quote" ? "> " : kind === "ul" ? "- " : "1. ";
|
|
33435
|
+
const block = (sel || "item").split("\n").map((l2) => prefix + l2).join("\n");
|
|
33436
|
+
replacement = (start > 0 && value[start - 1] !== "\n" ? "\n" : "") + block;
|
|
33437
|
+
}
|
|
33438
|
+
const next = value.slice(0, start) + replacement + value.slice(end);
|
|
33439
|
+
setValue2(next);
|
|
33440
|
+
const caret = caretOffset ? start + caretOffset : start + replacement.length;
|
|
33441
|
+
queueCaret(caret);
|
|
33442
|
+
}
|
|
33443
|
+
function submit() {
|
|
33444
|
+
const text = value.trim();
|
|
33445
|
+
if (!text && pending.length === 0 || busy) return;
|
|
33446
|
+
onSubmit(text, pending.length ? pending : void 0);
|
|
33447
|
+
setValue2("");
|
|
33448
|
+
setPending([]);
|
|
33449
|
+
setTrigger(null);
|
|
33450
|
+
}
|
|
33451
|
+
function onFiles(files) {
|
|
33452
|
+
if (!files) return;
|
|
33453
|
+
setPending((p2) => [
|
|
33454
|
+
...p2,
|
|
33455
|
+
...Array.from(files).map((f2) => ({
|
|
33456
|
+
id: `${f2.name}-${f2.size}-${f2.lastModified}`,
|
|
33457
|
+
name: f2.name,
|
|
33458
|
+
url: URL.createObjectURL(f2),
|
|
33459
|
+
type: f2.type || "application/octet-stream",
|
|
33460
|
+
size: f2.size
|
|
33461
|
+
}))
|
|
33462
|
+
]);
|
|
33463
|
+
}
|
|
33464
|
+
function onKeyDown(e2) {
|
|
33465
|
+
if (menuOpen) {
|
|
33466
|
+
if (e2.key === "ArrowDown") return e2.preventDefault(), setActive((a2) => (a2 + 1) % items.length);
|
|
33467
|
+
if (e2.key === "ArrowUp") return e2.preventDefault(), setActive((a2) => (a2 - 1 + items.length) % items.length);
|
|
33468
|
+
if (e2.key === "Enter" || e2.key === "Tab") return e2.preventDefault(), selectItem(active);
|
|
33469
|
+
if (e2.key === "Escape") return e2.preventDefault(), setTrigger(null);
|
|
33470
|
+
}
|
|
33471
|
+
const mod = e2.metaKey || e2.ctrlKey;
|
|
33472
|
+
if (mod && e2.key.toLowerCase() === "b") return e2.preventDefault(), format("bold");
|
|
33473
|
+
if (mod && e2.key.toLowerCase() === "i") return e2.preventDefault(), format("italic");
|
|
33474
|
+
if (mod && e2.key.toLowerCase() === "e") return e2.preventDefault(), format("code");
|
|
33475
|
+
if (mod && e2.key.toLowerCase() === "k") return e2.preventDefault(), format("link");
|
|
33476
|
+
if (e2.key === "Enter" && !e2.shiftKey) {
|
|
33477
|
+
e2.preventDefault();
|
|
33478
|
+
submit();
|
|
33479
|
+
}
|
|
33480
|
+
}
|
|
33481
|
+
const toolbarBtn = (label, title, kind) => h(
|
|
33482
|
+
"button",
|
|
33483
|
+
{
|
|
33484
|
+
key: kind,
|
|
33485
|
+
type: "button",
|
|
33486
|
+
title,
|
|
33487
|
+
className: "rounded px-1.5 py-0.5 text-xs text-muted-foreground hover:bg-accent hover:text-foreground",
|
|
33488
|
+
onMouseDown: (e2) => e2.preventDefault(),
|
|
33489
|
+
// keep textarea selection
|
|
33490
|
+
onClick: () => format(kind)
|
|
33491
|
+
},
|
|
33492
|
+
label
|
|
33493
|
+
);
|
|
33494
|
+
return h(
|
|
33495
|
+
"div",
|
|
33496
|
+
{ className: "border-t border-border" },
|
|
33497
|
+
// attachment chips
|
|
33498
|
+
pending.length > 0 ? h(
|
|
33499
|
+
"div",
|
|
33500
|
+
{ className: "flex flex-wrap gap-2 px-3 pt-2" },
|
|
33501
|
+
...pending.map(
|
|
33502
|
+
(a2) => h(
|
|
33503
|
+
"span",
|
|
33504
|
+
{ key: a2.id, className: "inline-flex items-center gap-1 rounded bg-muted px-2 py-0.5 text-xs" },
|
|
33505
|
+
a2.name,
|
|
33506
|
+
h(
|
|
33507
|
+
"button",
|
|
33508
|
+
{
|
|
33509
|
+
type: "button",
|
|
33510
|
+
className: "text-muted-foreground hover:text-destructive",
|
|
33511
|
+
onClick: () => setPending((p2) => p2.filter((x2) => x2.id !== a2.id))
|
|
33512
|
+
},
|
|
33513
|
+
"\u2715"
|
|
33514
|
+
)
|
|
33515
|
+
)
|
|
33516
|
+
)
|
|
33517
|
+
) : null,
|
|
33518
|
+
// toolbar
|
|
33519
|
+
toolbar ? h(
|
|
33520
|
+
"div",
|
|
33521
|
+
{ className: "flex items-center gap-0.5 px-2 pt-2" },
|
|
33522
|
+
toolbarBtn("B", "Bold (\u2318B)", "bold"),
|
|
33523
|
+
toolbarBtn("\u{1D456}", "Italic (\u2318I)", "italic"),
|
|
33524
|
+
toolbarBtn("</>", "Code (\u2318E)", "code"),
|
|
33525
|
+
toolbarBtn("\u{1F517}", "Link (\u2318K)", "link"),
|
|
33526
|
+
toolbarBtn("\u275D", "Quote", "quote"),
|
|
33527
|
+
toolbarBtn("\u2022", "Bulleted list", "ul"),
|
|
33528
|
+
toolbarBtn("1.", "Numbered list", "ol")
|
|
33529
|
+
) : null,
|
|
33530
|
+
// input row (relative for the popup menu)
|
|
33531
|
+
h(
|
|
33532
|
+
"div",
|
|
33533
|
+
{ className: "relative flex items-end gap-2 p-3" },
|
|
33534
|
+
menuOpen ? h(
|
|
33535
|
+
"div",
|
|
33536
|
+
{
|
|
33537
|
+
className: "absolute bottom-full left-3 z-20 mb-1 w-72 overflow-hidden rounded-lg border border-border bg-popover shadow-lg",
|
|
33538
|
+
role: "listbox"
|
|
33539
|
+
},
|
|
33540
|
+
h(
|
|
33541
|
+
"div",
|
|
33542
|
+
{ className: "border-b border-border px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground" },
|
|
33543
|
+
trigger?.type === "/" ? "Commands" : trigger?.type === "@" ? "Mentions" : "Emoji"
|
|
33544
|
+
),
|
|
33545
|
+
...items.map(
|
|
33546
|
+
(it2, i2) => h(
|
|
33547
|
+
"button",
|
|
33548
|
+
{
|
|
33549
|
+
key: it2.key,
|
|
33550
|
+
type: "button",
|
|
33551
|
+
role: "option",
|
|
33552
|
+
"aria-selected": i2 === active,
|
|
33553
|
+
className: cn(
|
|
33554
|
+
"flex w-full items-center gap-2 px-2 py-1.5 text-left text-sm",
|
|
33555
|
+
i2 === active ? "bg-accent" : "hover:bg-accent/50"
|
|
33556
|
+
),
|
|
33557
|
+
onMouseEnter: () => setActive(i2),
|
|
33558
|
+
onMouseDown: (e2) => e2.preventDefault(),
|
|
33559
|
+
onClick: () => selectItem(i2)
|
|
33560
|
+
},
|
|
33561
|
+
it2.icon ? h("span", { className: "w-4 text-center text-muted-foreground" }, it2.icon) : null,
|
|
33562
|
+
h("span", { className: "flex-1 truncate" }, it2.primary),
|
|
33563
|
+
it2.secondary ? h("span", { className: "truncate text-xs text-muted-foreground" }, it2.secondary) : null
|
|
33564
|
+
)
|
|
33565
|
+
)
|
|
33566
|
+
) : null,
|
|
33567
|
+
attachments ? h(
|
|
33568
|
+
React11__namespace.Fragment,
|
|
33569
|
+
null,
|
|
33570
|
+
h("input", {
|
|
33571
|
+
ref: fileRef,
|
|
33572
|
+
type: "file",
|
|
33573
|
+
accept: "image/*",
|
|
33574
|
+
multiple: true,
|
|
33575
|
+
className: "hidden",
|
|
33576
|
+
onChange: (e2) => {
|
|
33577
|
+
onFiles(e2.target.files);
|
|
33578
|
+
e2.target.value = "";
|
|
33579
|
+
}
|
|
33580
|
+
}),
|
|
33581
|
+
h(
|
|
33582
|
+
"button",
|
|
33583
|
+
{
|
|
33584
|
+
type: "button",
|
|
33585
|
+
className: "rounded-md border border-border px-2 py-2 text-sm hover:bg-accent",
|
|
33586
|
+
"aria-label": "Attach image or GIF",
|
|
33587
|
+
onClick: () => fileRef.current?.click()
|
|
33588
|
+
},
|
|
33589
|
+
"\u{1F4CE}"
|
|
33590
|
+
)
|
|
33591
|
+
) : null,
|
|
33592
|
+
h("textarea", {
|
|
33593
|
+
ref,
|
|
33594
|
+
className: "max-h-40 flex-1 resize-none rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary",
|
|
33595
|
+
rows: 1,
|
|
33596
|
+
value,
|
|
33597
|
+
placeholder,
|
|
33598
|
+
autoFocus,
|
|
33599
|
+
"aria-label": "Message",
|
|
33600
|
+
onChange: (e2) => syncFromTextarea(e2.target),
|
|
33601
|
+
onClick: (e2) => syncFromTextarea(e2.currentTarget),
|
|
33602
|
+
onKeyUp: (e2) => syncFromTextarea(e2.currentTarget),
|
|
33603
|
+
onKeyDown,
|
|
33604
|
+
onBlur: () => setTimeout(() => setTrigger(null), 120)
|
|
33605
|
+
}),
|
|
33606
|
+
busy ? h(
|
|
33607
|
+
"button",
|
|
33608
|
+
{
|
|
33609
|
+
type: "button",
|
|
33610
|
+
className: "rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground",
|
|
33611
|
+
onClick: () => onStop?.()
|
|
33612
|
+
},
|
|
33613
|
+
"Stop"
|
|
33614
|
+
) : h(
|
|
33615
|
+
"button",
|
|
33616
|
+
{
|
|
33617
|
+
type: "button",
|
|
33618
|
+
className: "rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",
|
|
33619
|
+
disabled: !value.trim() && pending.length === 0,
|
|
33620
|
+
onClick: submit
|
|
33621
|
+
},
|
|
33622
|
+
"Send"
|
|
33623
|
+
)
|
|
33624
|
+
)
|
|
33625
|
+
);
|
|
33626
|
+
}
|
|
33627
|
+
var h2 = React11__namespace.createElement;
|
|
33628
|
+
var QUICK_EMOJIS = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}", "\u{1F440}", "\u{1F64F}"];
|
|
33629
|
+
var chatMd = cn(
|
|
33630
|
+
"max-w-none text-sm",
|
|
33631
|
+
"[&_p]:my-1 [&_p:first-child]:mt-0 [&_p:last-child]:mb-0",
|
|
33632
|
+
"[&_pre]:my-2 [&_pre]:rounded-md [&_pre]:text-xs [&_pre]:leading-relaxed",
|
|
33633
|
+
"[&_ul]:my-1 [&_ol]:my-1 [&_li]:my-0.5",
|
|
33634
|
+
"[&_h1]:text-base [&_h1]:font-semibold [&_h1]:mt-2 [&_h1]:mb-1",
|
|
33635
|
+
"[&_h2]:text-sm [&_h2]:font-semibold [&_h2]:mt-2 [&_h2]:mb-1",
|
|
33636
|
+
"[&_h3]:text-sm [&_h3]:font-semibold",
|
|
33637
|
+
"[&_blockquote]:my-1 [&_blockquote]:border-l-2 [&_blockquote]:pl-2 [&_blockquote]:not-italic [&_blockquote]:text-muted-foreground",
|
|
33638
|
+
"[&_img]:my-1 [&_img]:max-h-60 [&_img]:rounded-md",
|
|
33639
|
+
"[&_code]:text-[0.85em]"
|
|
33640
|
+
);
|
|
33641
|
+
function Avatar({ name, avatarUrl, size = 8 }) {
|
|
33642
|
+
return h2(
|
|
33643
|
+
"div",
|
|
33644
|
+
{
|
|
33645
|
+
className: cn(
|
|
33646
|
+
"flex-shrink-0 overflow-hidden rounded-full bg-muted flex items-center justify-center text-xs font-medium",
|
|
33647
|
+
size === 8 ? "h-8 w-8" : "h-7 w-7"
|
|
33648
|
+
)
|
|
33649
|
+
},
|
|
33650
|
+
avatarUrl ? h2("img", { src: avatarUrl, alt: name, className: "h-full w-full object-cover" }) : (name.charAt(0) || "?").toUpperCase()
|
|
33651
|
+
);
|
|
33652
|
+
}
|
|
33653
|
+
function TypingDots() {
|
|
33654
|
+
return h2(
|
|
33655
|
+
"div",
|
|
33656
|
+
{ className: "flex items-center gap-1 py-1.5", "aria-label": "Assistant is typing" },
|
|
33657
|
+
...[0, 150, 300].map(
|
|
33658
|
+
(delay) => h2("span", {
|
|
33659
|
+
key: delay,
|
|
33660
|
+
className: "h-1.5 w-1.5 rounded-full bg-muted-foreground/60 animate-bounce",
|
|
33661
|
+
style: { animationDelay: `${delay}ms` }
|
|
33662
|
+
})
|
|
33663
|
+
)
|
|
33664
|
+
);
|
|
33665
|
+
}
|
|
33666
|
+
function Attachments({ attachments }) {
|
|
33667
|
+
return h2(
|
|
33668
|
+
"div",
|
|
33669
|
+
{ className: "mt-2 flex flex-wrap gap-2" },
|
|
33670
|
+
...attachments.map(
|
|
33671
|
+
(a2) => a2.type.startsWith("image/") ? h2("img", { key: a2.id, src: a2.url, alt: a2.name, className: "max-h-60 rounded-md border border-border object-contain" }) : h2(
|
|
33672
|
+
"a",
|
|
33673
|
+
{
|
|
33674
|
+
key: a2.id,
|
|
33675
|
+
href: a2.url,
|
|
33676
|
+
target: "_blank",
|
|
33677
|
+
rel: "noreferrer",
|
|
33678
|
+
className: "inline-flex items-center gap-2 rounded-md border border-border bg-background/60 px-2 py-1 text-xs"
|
|
33679
|
+
},
|
|
33680
|
+
"\u{1F4CE} ",
|
|
33681
|
+
a2.name
|
|
33682
|
+
)
|
|
33683
|
+
)
|
|
33684
|
+
);
|
|
33685
|
+
}
|
|
33686
|
+
function MessageBody({ message }) {
|
|
33687
|
+
if (message.status === "streaming" && message.content === "") return h2(TypingDots);
|
|
33688
|
+
return h2(
|
|
33689
|
+
React11__namespace.Fragment,
|
|
33690
|
+
null,
|
|
33691
|
+
message.content ? h2(MarkdownRenderer, { content: message.content, size: "sm", className: chatMd }) : null,
|
|
33692
|
+
message.attachments && message.attachments.length > 0 ? h2(Attachments, { attachments: message.attachments }) : null,
|
|
33693
|
+
message.status === "error" ? h2("div", { className: "mt-1 text-xs text-destructive", role: "alert" }, message.error ?? "Failed to send.") : null
|
|
33694
|
+
);
|
|
33695
|
+
}
|
|
33696
|
+
function Reactions({ message, onReact, align }) {
|
|
33697
|
+
if (!message.reactions || message.reactions.length === 0) return null;
|
|
33698
|
+
return h2(
|
|
33699
|
+
"div",
|
|
33700
|
+
{ className: cn("mt-1 flex flex-wrap gap-1", align === "end" && "justify-end") },
|
|
33701
|
+
...message.reactions.map(
|
|
33702
|
+
(r2) => h2(
|
|
33703
|
+
"button",
|
|
33704
|
+
{
|
|
33705
|
+
key: r2.emoji,
|
|
33706
|
+
type: "button",
|
|
33707
|
+
onClick: () => onReact(r2.emoji),
|
|
33708
|
+
className: cn(
|
|
33709
|
+
"inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs",
|
|
33710
|
+
r2.userReacted ? "border-primary bg-primary/10" : "border-border bg-background"
|
|
33711
|
+
)
|
|
33712
|
+
},
|
|
33713
|
+
`${r2.emoji} ${r2.count}`
|
|
33714
|
+
)
|
|
33715
|
+
)
|
|
33716
|
+
);
|
|
33717
|
+
}
|
|
33718
|
+
function QuotedParent({ parent, onClick }) {
|
|
33719
|
+
const snippet = parent.content.length > 80 ? `${parent.content.slice(0, 80)}\u2026` : parent.content;
|
|
33720
|
+
return h2(
|
|
33721
|
+
"button",
|
|
33722
|
+
{
|
|
33723
|
+
type: "button",
|
|
33724
|
+
onClick,
|
|
33725
|
+
className: "mb-1 flex max-w-full items-start gap-2 rounded-md border-l-2 border-primary/50 bg-muted/50 px-2 py-1 text-left text-xs text-muted-foreground hover:bg-muted"
|
|
33726
|
+
},
|
|
33727
|
+
h2("span", { className: "font-medium" }, parent.author.name),
|
|
33728
|
+
h2("span", { className: "truncate" }, snippet)
|
|
33729
|
+
);
|
|
33730
|
+
}
|
|
33731
|
+
function HoverActions({
|
|
33732
|
+
message,
|
|
33733
|
+
conversation,
|
|
33734
|
+
isOwn,
|
|
33735
|
+
onEdit,
|
|
33736
|
+
onToggleEmojis,
|
|
33737
|
+
align
|
|
33738
|
+
}) {
|
|
33739
|
+
const { state, openThread, deleteMessage } = conversation;
|
|
33740
|
+
return h2(
|
|
33741
|
+
"div",
|
|
33742
|
+
{
|
|
33743
|
+
className: cn(
|
|
33744
|
+
"mt-1 flex items-center gap-3 text-xs text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",
|
|
33745
|
+
align === "end" && "justify-end"
|
|
33746
|
+
)
|
|
33747
|
+
},
|
|
33748
|
+
h2("button", { type: "button", className: "hover:text-foreground", onClick: () => openThread(rootIdOf(state.messages, message.id)) }, "Reply"),
|
|
33749
|
+
h2("button", { type: "button", className: "hover:text-foreground", onClick: onToggleEmojis }, "React"),
|
|
33750
|
+
isOwn ? h2("button", { type: "button", className: "hover:text-foreground", onClick: onEdit }, "Edit") : null,
|
|
33751
|
+
isOwn ? h2("button", { type: "button", className: "hover:text-destructive", onClick: () => deleteMessage(message.id) }, "Delete") : null
|
|
33752
|
+
);
|
|
33753
|
+
}
|
|
33754
|
+
function EmojiRow({ onPick, align }) {
|
|
33755
|
+
return h2(
|
|
33756
|
+
"div",
|
|
33757
|
+
{ className: cn("mt-1 flex gap-1", align === "end" && "justify-end") },
|
|
33758
|
+
...QUICK_EMOJIS.map(
|
|
33759
|
+
(emoji) => h2("button", { key: emoji, type: "button", className: "rounded px-1 text-base hover:bg-accent", onClick: () => onPick(emoji) }, emoji)
|
|
33760
|
+
)
|
|
33761
|
+
);
|
|
33762
|
+
}
|
|
33763
|
+
function EditField({ message, conversation, onDone }) {
|
|
33764
|
+
const [draft, setDraft] = React11__namespace.useState(message.content);
|
|
33765
|
+
function save() {
|
|
33766
|
+
const t2 = draft.trim();
|
|
33767
|
+
if (t2 && t2 !== message.content) conversation.editMessage(message.id, t2);
|
|
33768
|
+
onDone();
|
|
33769
|
+
}
|
|
33770
|
+
return h2(
|
|
33771
|
+
"div",
|
|
33772
|
+
{ className: "mt-1" },
|
|
33773
|
+
h2("textarea", {
|
|
33774
|
+
className: "w-full resize-none rounded-md border border-border bg-background px-2 py-1 text-sm",
|
|
33775
|
+
value: draft,
|
|
33776
|
+
autoFocus: true,
|
|
33777
|
+
onChange: (e2) => setDraft(e2.target.value),
|
|
33778
|
+
onKeyDown: (e2) => {
|
|
33779
|
+
if (e2.key === "Enter" && !e2.shiftKey) {
|
|
33780
|
+
e2.preventDefault();
|
|
33781
|
+
save();
|
|
33782
|
+
}
|
|
33783
|
+
if (e2.key === "Escape") onDone();
|
|
33784
|
+
}
|
|
33785
|
+
}),
|
|
33786
|
+
h2(
|
|
33787
|
+
"div",
|
|
33788
|
+
{ className: "mt-1 flex gap-2 text-xs" },
|
|
33789
|
+
h2("button", { type: "button", className: "text-primary", onClick: save }, "Save"),
|
|
33790
|
+
h2("button", { type: "button", className: "text-muted-foreground", onClick: onDone }, "Cancel")
|
|
33791
|
+
)
|
|
33792
|
+
);
|
|
33793
|
+
}
|
|
33794
|
+
function MessageRow({
|
|
33795
|
+
message,
|
|
33796
|
+
conversation,
|
|
33797
|
+
currentUserId,
|
|
33798
|
+
showThreadAffordance,
|
|
33799
|
+
quotedParent
|
|
33800
|
+
}) {
|
|
33801
|
+
const { state, react, openThread } = conversation;
|
|
33802
|
+
const [showEmojis, setShowEmojis] = React11__namespace.useState(false);
|
|
33803
|
+
const [editing, setEditing] = React11__namespace.useState(false);
|
|
33804
|
+
const isUser = currentUserId ? message.author.id === currentUserId : message.role === "user";
|
|
33805
|
+
const replyCount = getReplyCount(state.messages, message.id);
|
|
33806
|
+
const align = isUser ? "end" : "start";
|
|
33807
|
+
const inner = h2(
|
|
33808
|
+
React11__namespace.Fragment,
|
|
33809
|
+
null,
|
|
33810
|
+
quotedParent ? h2(QuotedParent, { parent: quotedParent, onClick: () => openThread(quotedParent.id) }) : null,
|
|
33811
|
+
editing ? h2(EditField, { message, conversation, onDone: () => setEditing(false) }) : isUser ? h2("div", { className: "inline-block rounded-2xl rounded-br-sm bg-primary/10 px-3 py-2 text-left" }, h2(MessageBody, { message })) : h2(MessageBody, { message }),
|
|
33812
|
+
h2(Reactions, { message, onReact: (e2) => react(message.id, e2), align }),
|
|
33813
|
+
showThreadAffordance && replyCount > 0 ? h2(
|
|
33814
|
+
"button",
|
|
33815
|
+
{ type: "button", className: cn("mt-1 text-xs font-medium text-primary hover:underline", align === "end" && "self-end"), onClick: () => openThread(message.id) },
|
|
33816
|
+
`\u{1F4AC} ${replyCount} ${replyCount === 1 ? "reply" : "replies"}`
|
|
33817
|
+
) : null,
|
|
33818
|
+
h2(HoverActions, { message, conversation, isOwn: isUser, onEdit: () => setEditing(true), onToggleEmojis: () => setShowEmojis((v2) => !v2), align }),
|
|
33819
|
+
showEmojis ? h2(EmojiRow, {
|
|
33820
|
+
onPick: (e2) => {
|
|
33821
|
+
react(message.id, e2);
|
|
33822
|
+
setShowEmojis(false);
|
|
33823
|
+
},
|
|
33824
|
+
align
|
|
33825
|
+
}) : null
|
|
33826
|
+
);
|
|
33827
|
+
if (!isUser) {
|
|
33828
|
+
return h2(
|
|
33829
|
+
"div",
|
|
33830
|
+
{ className: "group flex gap-3 rounded-md px-3 py-2 hover:bg-accent/30", role: "article", "aria-label": `Message from ${message.author.name}`, "data-message-id": message.id },
|
|
33831
|
+
h2(Avatar, { name: message.author.name, avatarUrl: message.author.avatarUrl }),
|
|
33832
|
+
h2(
|
|
33833
|
+
"div",
|
|
33834
|
+
{ className: "min-w-0 flex-1" },
|
|
33835
|
+
h2(
|
|
33836
|
+
"div",
|
|
33837
|
+
{ className: "flex items-baseline gap-2" },
|
|
33838
|
+
h2("span", { className: "text-sm font-semibold" }, message.author.name),
|
|
33839
|
+
h2("span", { className: "text-xs text-muted-foreground", title: message.timestamp.toLocaleString() }, formatTimestamp(message.timestamp)),
|
|
33840
|
+
message.edited ? h2("span", { className: "text-xs text-muted-foreground" }, "(edited)") : null
|
|
33841
|
+
),
|
|
33842
|
+
inner
|
|
33843
|
+
)
|
|
33844
|
+
);
|
|
33845
|
+
}
|
|
33846
|
+
return h2(
|
|
33847
|
+
"div",
|
|
33848
|
+
{ className: "group flex flex-col items-end px-3 py-1.5", role: "article", "aria-label": `Message from ${message.author.name}`, "data-message-id": message.id },
|
|
33849
|
+
h2(
|
|
33850
|
+
"div",
|
|
33851
|
+
{ className: "flex items-baseline gap-2" },
|
|
33852
|
+
message.edited ? h2("span", { className: "text-xs text-muted-foreground" }, "(edited)") : null,
|
|
33853
|
+
h2("span", { className: "text-xs text-muted-foreground", title: message.timestamp.toLocaleString() }, formatTimestamp(message.timestamp)),
|
|
33854
|
+
h2("span", { className: "text-sm font-semibold" }, message.author.name)
|
|
33855
|
+
),
|
|
33856
|
+
h2("div", { className: "mt-0.5 flex max-w-[80%] flex-col items-end" }, inner)
|
|
33857
|
+
);
|
|
33858
|
+
}
|
|
33859
|
+
function ConversationSidebar({ conversation }) {
|
|
33860
|
+
const { state, newConversation, selectConversation, deleteConversation } = conversation;
|
|
33861
|
+
return h2(
|
|
33862
|
+
"aside",
|
|
33863
|
+
{ className: "flex w-56 flex-col gap-1 overflow-y-auto border-r border-border bg-muted/20 p-2", "aria-label": "Conversations" },
|
|
33864
|
+
h2(
|
|
33865
|
+
"button",
|
|
33866
|
+
{ type: "button", className: "mb-1 w-full rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90", onClick: () => newConversation() },
|
|
33867
|
+
"+ New chat"
|
|
33868
|
+
),
|
|
33869
|
+
...state.conversations.map(
|
|
33870
|
+
(conv) => h2(
|
|
33871
|
+
"div",
|
|
33872
|
+
{
|
|
33873
|
+
key: conv.id,
|
|
33874
|
+
role: "button",
|
|
33875
|
+
"aria-current": conv.id === state.activeConversationId,
|
|
33876
|
+
onClick: () => selectConversation(conv.id),
|
|
33877
|
+
className: cn(
|
|
33878
|
+
"group flex items-center justify-between gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent/60",
|
|
33879
|
+
conv.id === state.activeConversationId && "bg-accent font-medium"
|
|
33880
|
+
)
|
|
33881
|
+
},
|
|
33882
|
+
h2(
|
|
33883
|
+
"div",
|
|
33884
|
+
{ className: "min-w-0" },
|
|
33885
|
+
h2("div", { className: "truncate" }, conv.title),
|
|
33886
|
+
h2("div", { className: "truncate text-xs text-muted-foreground" }, formatRelativeTime(conv.updatedAt))
|
|
33887
|
+
),
|
|
33888
|
+
h2(
|
|
33889
|
+
"button",
|
|
33890
|
+
{
|
|
33891
|
+
type: "button",
|
|
33892
|
+
className: "text-xs text-muted-foreground opacity-0 hover:text-destructive group-hover:opacity-100",
|
|
33893
|
+
"aria-label": `Delete ${conv.title}`,
|
|
33894
|
+
onClick: (e2) => {
|
|
33895
|
+
e2.stopPropagation();
|
|
33896
|
+
deleteConversation(conv.id);
|
|
33897
|
+
}
|
|
33898
|
+
},
|
|
33899
|
+
"\u2715"
|
|
33900
|
+
)
|
|
33901
|
+
)
|
|
33902
|
+
)
|
|
33903
|
+
);
|
|
33904
|
+
}
|
|
33905
|
+
function ThreadPanel({ conversation, currentUserId, composer }) {
|
|
33906
|
+
const { state } = conversation;
|
|
33907
|
+
const rootId = state.openThreadRootId;
|
|
33908
|
+
if (!rootId) return null;
|
|
33909
|
+
const messages = selectThreadMessages(state.messages, rootId);
|
|
33910
|
+
return h2(
|
|
33911
|
+
"aside",
|
|
33912
|
+
{ className: "flex w-80 flex-col border-l border-border", "aria-label": "Thread" },
|
|
33913
|
+
h2(
|
|
33914
|
+
"div",
|
|
33915
|
+
{ className: "flex items-center justify-between border-b border-border px-3 py-2" },
|
|
33916
|
+
h2("span", { className: "text-sm font-semibold" }, "Thread"),
|
|
33917
|
+
h2("button", { type: "button", className: "text-muted-foreground hover:text-foreground", "aria-label": "Close thread", onClick: () => conversation.closeThread() }, "\u2715")
|
|
33918
|
+
),
|
|
33919
|
+
h2(
|
|
33920
|
+
"div",
|
|
33921
|
+
{ className: "flex-1 overflow-y-auto p-1" },
|
|
33922
|
+
...messages.map((m2) => h2(MessageRow, { key: m2.id, message: m2, conversation, currentUserId, showThreadAffordance: false }))
|
|
33923
|
+
),
|
|
33924
|
+
composer
|
|
33925
|
+
);
|
|
33926
|
+
}
|
|
33927
|
+
function ModeToggle({ conversation }) {
|
|
33928
|
+
const { state, setThreadingMode } = conversation;
|
|
33929
|
+
const opt = (mode, label) => h2(
|
|
33930
|
+
"button",
|
|
33931
|
+
{
|
|
33932
|
+
type: "button",
|
|
33933
|
+
onClick: () => setThreadingMode(mode),
|
|
33934
|
+
className: cn("rounded px-2 py-0.5 text-xs", state.threadingMode === mode ? "bg-background shadow-sm" : "text-muted-foreground")
|
|
33935
|
+
},
|
|
33936
|
+
label
|
|
33937
|
+
);
|
|
33938
|
+
return h2(
|
|
33939
|
+
"div",
|
|
33940
|
+
{ className: "inline-flex rounded-md bg-muted p-0.5", role: "group", "aria-label": "Threading mode" },
|
|
33941
|
+
opt("inline", "Inline"),
|
|
33942
|
+
opt("panel", "Threads")
|
|
33943
|
+
);
|
|
33944
|
+
}
|
|
33945
|
+
function Chat({
|
|
33946
|
+
conversation,
|
|
33947
|
+
showConversationList = true,
|
|
33948
|
+
showModeToggle = true,
|
|
33949
|
+
placeholder,
|
|
33950
|
+
currentUserId,
|
|
33951
|
+
emptyState,
|
|
33952
|
+
className,
|
|
33953
|
+
slashCommands,
|
|
33954
|
+
mentions,
|
|
33955
|
+
onSlashCommand,
|
|
33956
|
+
composerToolbar = true
|
|
33957
|
+
}) {
|
|
33958
|
+
const { state, sendMessage } = conversation;
|
|
33959
|
+
const timeline = selectMainTimeline(state.messages, state.threadingMode);
|
|
33960
|
+
const activeConv = state.conversations.find((c2) => c2.id === state.activeConversationId);
|
|
33961
|
+
const busy = state.status === "sending" || state.status === "streaming";
|
|
33962
|
+
const mainComposer = h2(Composer, {
|
|
33963
|
+
placeholder,
|
|
33964
|
+
busy,
|
|
33965
|
+
slashCommands,
|
|
33966
|
+
mentions,
|
|
33967
|
+
onSlashCommand,
|
|
33968
|
+
toolbar: composerToolbar,
|
|
33969
|
+
onSubmit: (content, atts) => void sendMessage(content, { attachments: atts }),
|
|
33970
|
+
onStop: () => conversation.stop()
|
|
33971
|
+
});
|
|
33972
|
+
const threadComposer = state.openThreadRootId ? h2(Composer, {
|
|
33973
|
+
placeholder: "Reply\u2026",
|
|
33974
|
+
busy,
|
|
33975
|
+
slashCommands,
|
|
33976
|
+
mentions,
|
|
33977
|
+
onSlashCommand,
|
|
33978
|
+
toolbar: composerToolbar,
|
|
33979
|
+
onSubmit: (content, atts) => void sendMessage(content, { replyTo: state.openThreadRootId, attachments: atts }),
|
|
33980
|
+
onStop: () => conversation.stop()
|
|
33981
|
+
}) : null;
|
|
33982
|
+
const body = timeline.length === 0 ? h2("div", { className: "flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground" }, emptyState ?? "No messages yet. Say hello \u{1F44B}") : h2(
|
|
33983
|
+
"div",
|
|
33984
|
+
{ className: "flex-1 space-y-0.5 overflow-y-auto p-2" },
|
|
33985
|
+
...timeline.map(
|
|
33986
|
+
(m2) => h2(MessageRow, {
|
|
33987
|
+
key: m2.id,
|
|
33988
|
+
message: m2,
|
|
33989
|
+
conversation,
|
|
33990
|
+
currentUserId,
|
|
33991
|
+
showThreadAffordance: state.threadingMode === "panel",
|
|
33992
|
+
quotedParent: state.threadingMode === "inline" && m2.parentId ? findMessage(state.messages, m2.parentId) : void 0
|
|
33993
|
+
})
|
|
33994
|
+
)
|
|
33995
|
+
);
|
|
33996
|
+
return h2(
|
|
33997
|
+
"div",
|
|
33998
|
+
{ className: cn("flex h-full min-h-0 overflow-hidden rounded-xl border border-border bg-background", className) },
|
|
33999
|
+
showConversationList ? h2(ConversationSidebar, { conversation }) : null,
|
|
34000
|
+
h2(
|
|
34001
|
+
"div",
|
|
34002
|
+
{ className: "flex min-w-0 flex-1 flex-col" },
|
|
34003
|
+
h2(
|
|
34004
|
+
"div",
|
|
34005
|
+
{ className: "flex items-center justify-between border-b border-border px-3 py-2" },
|
|
34006
|
+
h2("span", { className: "truncate text-sm font-semibold" }, activeConv?.title ?? "Chat"),
|
|
34007
|
+
showModeToggle ? h2(ModeToggle, { conversation }) : null
|
|
34008
|
+
),
|
|
34009
|
+
body,
|
|
34010
|
+
mainComposer
|
|
34011
|
+
),
|
|
34012
|
+
h2(ThreadPanel, { conversation, currentUserId, composer: threadComposer })
|
|
34013
|
+
);
|
|
34014
|
+
}
|
|
34015
|
+
|
|
32611
34016
|
// ../content-protection/dist/index.js
|
|
32612
34017
|
function createContentProtection(props = {}) {
|
|
32613
34018
|
const {
|
|
@@ -32726,6 +34131,224 @@ var ContentProtection = React11__namespace.forwardRef(
|
|
|
32726
34131
|
);
|
|
32727
34132
|
ContentProtection.displayName = "ContentProtection";
|
|
32728
34133
|
|
|
34134
|
+
// ../cookie-consent/dist/index.js
|
|
34135
|
+
var DEFAULT_KEY = "rfr-cookie-consent";
|
|
34136
|
+
var DEFAULT_CATEGORIES = [
|
|
34137
|
+
{ id: "necessary", label: "Strictly necessary", description: "Required for the site to function. Always on.", required: true },
|
|
34138
|
+
{ id: "preferences", label: "Preferences", description: "Remembers your settings and choices." },
|
|
34139
|
+
{ id: "analytics", label: "Analytics", description: "Helps us understand how the site is used." },
|
|
34140
|
+
{ id: "marketing", label: "Marketing", description: "Used to personalize ads and measure campaigns." }
|
|
34141
|
+
];
|
|
34142
|
+
function baseline(categories) {
|
|
34143
|
+
const p2 = {};
|
|
34144
|
+
for (const c2 of categories) p2[c2.id] = !!c2.required;
|
|
34145
|
+
return p2;
|
|
34146
|
+
}
|
|
34147
|
+
function createCookieConsent(config = {}) {
|
|
34148
|
+
const categories = config.categories ?? DEFAULT_CATEGORIES;
|
|
34149
|
+
const storage = config.storage;
|
|
34150
|
+
const key = config.storageKey ?? DEFAULT_KEY;
|
|
34151
|
+
const version2 = config.version;
|
|
34152
|
+
let preferences = baseline(categories);
|
|
34153
|
+
let consented = false;
|
|
34154
|
+
const raw = storage?.get(key) ?? null;
|
|
34155
|
+
if (raw) {
|
|
34156
|
+
try {
|
|
34157
|
+
const parsed = JSON.parse(raw);
|
|
34158
|
+
if ((parsed.version ?? void 0) === version2) {
|
|
34159
|
+
preferences = { ...baseline(categories), ...parsed.preferences };
|
|
34160
|
+
for (const c2 of categories) if (c2.required) preferences[c2.id] = true;
|
|
34161
|
+
consented = true;
|
|
34162
|
+
}
|
|
34163
|
+
} catch {
|
|
34164
|
+
}
|
|
34165
|
+
}
|
|
34166
|
+
let open = !consented;
|
|
34167
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
34168
|
+
let snapshot = build();
|
|
34169
|
+
function build() {
|
|
34170
|
+
return { consented, preferences: { ...preferences }, open, categories };
|
|
34171
|
+
}
|
|
34172
|
+
function emit2() {
|
|
34173
|
+
snapshot = build();
|
|
34174
|
+
for (const l2 of listeners) l2();
|
|
34175
|
+
}
|
|
34176
|
+
function persist() {
|
|
34177
|
+
storage?.set(key, JSON.stringify({ version: version2, preferences }));
|
|
34178
|
+
config.onChange?.({ ...preferences });
|
|
34179
|
+
}
|
|
34180
|
+
function save(next) {
|
|
34181
|
+
const merged = { ...baseline(categories), ...next };
|
|
34182
|
+
for (const c2 of categories) if (c2.required) merged[c2.id] = true;
|
|
34183
|
+
preferences = merged;
|
|
34184
|
+
consented = true;
|
|
34185
|
+
open = false;
|
|
34186
|
+
persist();
|
|
34187
|
+
emit2();
|
|
34188
|
+
}
|
|
34189
|
+
return {
|
|
34190
|
+
getState() {
|
|
34191
|
+
return snapshot;
|
|
34192
|
+
},
|
|
34193
|
+
subscribe(listener) {
|
|
34194
|
+
listeners.add(listener);
|
|
34195
|
+
return () => listeners.delete(listener);
|
|
34196
|
+
},
|
|
34197
|
+
acceptAll() {
|
|
34198
|
+
const all = {};
|
|
34199
|
+
for (const c2 of categories) all[c2.id] = true;
|
|
34200
|
+
save(all);
|
|
34201
|
+
},
|
|
34202
|
+
rejectAll() {
|
|
34203
|
+
save(baseline(categories));
|
|
34204
|
+
},
|
|
34205
|
+
savePreferences(prefs) {
|
|
34206
|
+
save(prefs);
|
|
34207
|
+
},
|
|
34208
|
+
setPreference(id, value) {
|
|
34209
|
+
const cat = categories.find((c2) => c2.id === id);
|
|
34210
|
+
if (!cat || cat.required) return;
|
|
34211
|
+
preferences = { ...preferences, [id]: value };
|
|
34212
|
+
emit2();
|
|
34213
|
+
},
|
|
34214
|
+
reset() {
|
|
34215
|
+
storage?.remove(key);
|
|
34216
|
+
preferences = baseline(categories);
|
|
34217
|
+
consented = false;
|
|
34218
|
+
open = true;
|
|
34219
|
+
emit2();
|
|
34220
|
+
},
|
|
34221
|
+
openSettings() {
|
|
34222
|
+
if (open) return;
|
|
34223
|
+
open = true;
|
|
34224
|
+
emit2();
|
|
34225
|
+
},
|
|
34226
|
+
close() {
|
|
34227
|
+
if (!open) return;
|
|
34228
|
+
open = false;
|
|
34229
|
+
emit2();
|
|
34230
|
+
}
|
|
34231
|
+
};
|
|
34232
|
+
}
|
|
34233
|
+
|
|
34234
|
+
// ../react-cookie-consent/dist/index.js
|
|
34235
|
+
var localStorageAdapter = {
|
|
34236
|
+
get(k2) {
|
|
34237
|
+
try {
|
|
34238
|
+
return typeof localStorage !== "undefined" ? localStorage.getItem(k2) : null;
|
|
34239
|
+
} catch {
|
|
34240
|
+
return null;
|
|
34241
|
+
}
|
|
34242
|
+
},
|
|
34243
|
+
set(k2, v2) {
|
|
34244
|
+
try {
|
|
34245
|
+
localStorage?.setItem(k2, v2);
|
|
34246
|
+
} catch {
|
|
34247
|
+
}
|
|
34248
|
+
},
|
|
34249
|
+
remove(k2) {
|
|
34250
|
+
try {
|
|
34251
|
+
localStorage?.removeItem(k2);
|
|
34252
|
+
} catch {
|
|
34253
|
+
}
|
|
34254
|
+
}
|
|
34255
|
+
};
|
|
34256
|
+
function useCookieConsent(config) {
|
|
34257
|
+
const apiRef = React11__namespace.useRef(null);
|
|
34258
|
+
if (apiRef.current === null) {
|
|
34259
|
+
apiRef.current = createCookieConsent({ storage: localStorageAdapter, ...config });
|
|
34260
|
+
}
|
|
34261
|
+
const api = apiRef.current;
|
|
34262
|
+
const state = React11__namespace.useSyncExternalStore(api.subscribe, api.getState, api.getState);
|
|
34263
|
+
return {
|
|
34264
|
+
state,
|
|
34265
|
+
api,
|
|
34266
|
+
acceptAll: api.acceptAll,
|
|
34267
|
+
rejectAll: api.rejectAll,
|
|
34268
|
+
savePreferences: api.savePreferences,
|
|
34269
|
+
setPreference: api.setPreference,
|
|
34270
|
+
reset: api.reset,
|
|
34271
|
+
openSettings: api.openSettings,
|
|
34272
|
+
close: api.close
|
|
34273
|
+
};
|
|
34274
|
+
}
|
|
34275
|
+
var h3 = React11__namespace.createElement;
|
|
34276
|
+
var btnPrimary = "rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:opacity-90";
|
|
34277
|
+
var btnGhost = "rounded-md border border-border px-3 py-1.5 text-sm hover:bg-accent";
|
|
34278
|
+
var btnLink = "text-sm text-muted-foreground underline hover:text-foreground";
|
|
34279
|
+
function CookieConsent({
|
|
34280
|
+
consent,
|
|
34281
|
+
position = "bottom",
|
|
34282
|
+
title = "We use cookies",
|
|
34283
|
+
description = "We use cookies to run the site, remember your preferences, and measure traffic. Choose which categories to allow.",
|
|
34284
|
+
policyUrl,
|
|
34285
|
+
policyLabel = "Cookie policy",
|
|
34286
|
+
className
|
|
34287
|
+
}) {
|
|
34288
|
+
const { state, acceptAll, rejectAll, savePreferences, setPreference } = consent;
|
|
34289
|
+
const [settings, setSettings] = React11__namespace.useState(false);
|
|
34290
|
+
if (!state.open) return null;
|
|
34291
|
+
const wrapper = cn(
|
|
34292
|
+
"fixed inset-x-0 z-50 p-4",
|
|
34293
|
+
position === "bottom" ? "bottom-0" : "top-0",
|
|
34294
|
+
className
|
|
34295
|
+
);
|
|
34296
|
+
const panel = "mx-auto max-w-3xl rounded-xl border border-border bg-background p-4 shadow-lg";
|
|
34297
|
+
const header = h3(
|
|
34298
|
+
"div",
|
|
34299
|
+
null,
|
|
34300
|
+
h3("h2", { className: "text-base font-semibold" }, title),
|
|
34301
|
+
h3("p", { className: "mt-1 text-sm text-muted-foreground" }, description),
|
|
34302
|
+
policyUrl ? h3("a", { href: policyUrl, target: "_blank", rel: "noreferrer", className: cn(btnLink, "mt-1 inline-block") }, policyLabel) : null
|
|
34303
|
+
);
|
|
34304
|
+
const promptActions = h3(
|
|
34305
|
+
"div",
|
|
34306
|
+
{ className: "mt-3 flex flex-wrap items-center gap-2" },
|
|
34307
|
+
h3("button", { type: "button", className: btnPrimary, onClick: () => acceptAll() }, "Accept all"),
|
|
34308
|
+
h3("button", { type: "button", className: btnGhost, onClick: () => rejectAll() }, "Reject all"),
|
|
34309
|
+
h3("button", { type: "button", className: cn(btnGhost, "ml-auto"), onClick: () => setSettings(true) }, "Manage preferences")
|
|
34310
|
+
);
|
|
34311
|
+
const settingsView = h3(
|
|
34312
|
+
"div",
|
|
34313
|
+
{ className: "mt-3 space-y-2" },
|
|
34314
|
+
...state.categories.map(
|
|
34315
|
+
(cat) => h3(
|
|
34316
|
+
"label",
|
|
34317
|
+
{
|
|
34318
|
+
key: cat.id,
|
|
34319
|
+
className: "flex items-start justify-between gap-3 rounded-md border border-border p-3"
|
|
34320
|
+
},
|
|
34321
|
+
h3(
|
|
34322
|
+
"span",
|
|
34323
|
+
{ className: "min-w-0" },
|
|
34324
|
+
h3("span", { className: "block text-sm font-medium" }, cat.label, cat.required ? " (required)" : ""),
|
|
34325
|
+
cat.description ? h3("span", { className: "block text-xs text-muted-foreground" }, cat.description) : null
|
|
34326
|
+
),
|
|
34327
|
+
h3("input", {
|
|
34328
|
+
type: "checkbox",
|
|
34329
|
+
className: "mt-0.5 h-4 w-4 accent-[hsl(var(--primary))]",
|
|
34330
|
+
checked: !!state.preferences[cat.id],
|
|
34331
|
+
disabled: cat.required,
|
|
34332
|
+
"aria-label": cat.label,
|
|
34333
|
+
onChange: (e2) => setPreference(cat.id, e2.target.checked)
|
|
34334
|
+
})
|
|
34335
|
+
)
|
|
34336
|
+
),
|
|
34337
|
+
h3(
|
|
34338
|
+
"div",
|
|
34339
|
+
{ className: "flex flex-wrap items-center gap-2 pt-1" },
|
|
34340
|
+
h3("button", { type: "button", className: btnPrimary, onClick: () => savePreferences(state.preferences) }, "Save preferences"),
|
|
34341
|
+
h3("button", { type: "button", className: btnGhost, onClick: () => acceptAll() }, "Accept all"),
|
|
34342
|
+
h3("button", { type: "button", className: cn(btnLink, "ml-auto"), onClick: () => setSettings(false) }, "Back")
|
|
34343
|
+
)
|
|
34344
|
+
);
|
|
34345
|
+
return h3(
|
|
34346
|
+
"div",
|
|
34347
|
+
{ className: wrapper, role: "dialog", "aria-label": "Cookie consent", "aria-modal": false },
|
|
34348
|
+
h3("div", { className: panel }, header, settings ? settingsView : promptActions)
|
|
34349
|
+
);
|
|
34350
|
+
}
|
|
34351
|
+
|
|
32729
34352
|
// ../data-table/dist/index.js
|
|
32730
34353
|
function createDataTable(props) {
|
|
32731
34354
|
const {
|
|
@@ -34496,215 +36119,6 @@ var InstallPrompt = React11__namespace.forwardRef(
|
|
|
34496
36119
|
);
|
|
34497
36120
|
InstallPrompt.displayName = "InstallPrompt";
|
|
34498
36121
|
|
|
34499
|
-
// ../markdown-renderer/dist/index.js
|
|
34500
|
-
function escapeHtml(text) {
|
|
34501
|
-
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
34502
|
-
}
|
|
34503
|
-
function parseInline(text, linkResolver) {
|
|
34504
|
-
let result = escapeHtml(text);
|
|
34505
|
-
result = result.replace(/`([^`]+)`/g, "<code>$1</code>");
|
|
34506
|
-
result = result.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
|
|
34507
|
-
result = result.replace(/__([^_]+)__/g, "<strong>$1</strong>");
|
|
34508
|
-
result = result.replace(/\*([^*]+)\*/g, "<em>$1</em>");
|
|
34509
|
-
result = result.replace(/_([^_]+)_/g, "<em>$1</em>");
|
|
34510
|
-
result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_match, text2, url) => {
|
|
34511
|
-
if (/^\s*javascript\s*:/i.test(url)) {
|
|
34512
|
-
return text2;
|
|
34513
|
-
}
|
|
34514
|
-
const resolvedUrl = linkResolver ? linkResolver(url) : url;
|
|
34515
|
-
return `<a href="${resolvedUrl}">${text2}</a>`;
|
|
34516
|
-
});
|
|
34517
|
-
return result;
|
|
34518
|
-
}
|
|
34519
|
-
function parseMarkdown(content, linkResolver) {
|
|
34520
|
-
const lines = content.split("\n");
|
|
34521
|
-
const outputLines = [];
|
|
34522
|
-
let inCodeBlock = false;
|
|
34523
|
-
let codeBlockContent = [];
|
|
34524
|
-
let codeBlockLang = "";
|
|
34525
|
-
let inList = null;
|
|
34526
|
-
let inBlockquote = false;
|
|
34527
|
-
function closeList() {
|
|
34528
|
-
if (inList) {
|
|
34529
|
-
outputLines.push(inList === "ul" ? "</ul>" : "</ol>");
|
|
34530
|
-
inList = null;
|
|
34531
|
-
}
|
|
34532
|
-
}
|
|
34533
|
-
function closeBlockquote() {
|
|
34534
|
-
if (inBlockquote) {
|
|
34535
|
-
outputLines.push("</blockquote>");
|
|
34536
|
-
inBlockquote = false;
|
|
34537
|
-
}
|
|
34538
|
-
}
|
|
34539
|
-
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
34540
|
-
const line = lines[i2];
|
|
34541
|
-
if (line.trimStart().startsWith("```")) {
|
|
34542
|
-
if (inCodeBlock) {
|
|
34543
|
-
outputLines.push(`<pre><code${codeBlockLang ? ` class="language-${escapeHtml(codeBlockLang)}"` : ""}>${escapeHtml(codeBlockContent.join("\n"))}</code></pre>`);
|
|
34544
|
-
codeBlockContent = [];
|
|
34545
|
-
codeBlockLang = "";
|
|
34546
|
-
inCodeBlock = false;
|
|
34547
|
-
} else {
|
|
34548
|
-
closeList();
|
|
34549
|
-
closeBlockquote();
|
|
34550
|
-
inCodeBlock = true;
|
|
34551
|
-
codeBlockLang = line.trimStart().slice(3).trim();
|
|
34552
|
-
}
|
|
34553
|
-
continue;
|
|
34554
|
-
}
|
|
34555
|
-
if (inCodeBlock) {
|
|
34556
|
-
codeBlockContent.push(line);
|
|
34557
|
-
continue;
|
|
34558
|
-
}
|
|
34559
|
-
if (/^(\s*[-*_]\s*){3,}$/.test(line)) {
|
|
34560
|
-
closeList();
|
|
34561
|
-
closeBlockquote();
|
|
34562
|
-
outputLines.push("<hr />");
|
|
34563
|
-
continue;
|
|
34564
|
-
}
|
|
34565
|
-
const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
34566
|
-
if (headingMatch) {
|
|
34567
|
-
closeList();
|
|
34568
|
-
closeBlockquote();
|
|
34569
|
-
const level = headingMatch[1].length;
|
|
34570
|
-
const text = parseInline(headingMatch[2], linkResolver);
|
|
34571
|
-
outputLines.push(`<h${level}>${text}</h${level}>`);
|
|
34572
|
-
continue;
|
|
34573
|
-
}
|
|
34574
|
-
const blockquoteMatch = line.match(/^>\s?(.*)$/);
|
|
34575
|
-
if (blockquoteMatch) {
|
|
34576
|
-
closeList();
|
|
34577
|
-
if (!inBlockquote) {
|
|
34578
|
-
inBlockquote = true;
|
|
34579
|
-
outputLines.push("<blockquote>");
|
|
34580
|
-
}
|
|
34581
|
-
const text = blockquoteMatch[1].trim();
|
|
34582
|
-
if (text) {
|
|
34583
|
-
outputLines.push(`<p>${parseInline(text, linkResolver)}</p>`);
|
|
34584
|
-
}
|
|
34585
|
-
continue;
|
|
34586
|
-
} else if (inBlockquote) {
|
|
34587
|
-
closeBlockquote();
|
|
34588
|
-
}
|
|
34589
|
-
const ulMatch = line.match(/^[\s]*[-*+]\s+(.+)$/);
|
|
34590
|
-
if (ulMatch) {
|
|
34591
|
-
closeBlockquote();
|
|
34592
|
-
if (inList !== "ul") {
|
|
34593
|
-
closeList();
|
|
34594
|
-
inList = "ul";
|
|
34595
|
-
outputLines.push("<ul>");
|
|
34596
|
-
}
|
|
34597
|
-
outputLines.push(`<li>${parseInline(ulMatch[1], linkResolver)}</li>`);
|
|
34598
|
-
continue;
|
|
34599
|
-
}
|
|
34600
|
-
const olMatch = line.match(/^[\s]*\d+\.\s+(.+)$/);
|
|
34601
|
-
if (olMatch) {
|
|
34602
|
-
closeBlockquote();
|
|
34603
|
-
if (inList !== "ol") {
|
|
34604
|
-
closeList();
|
|
34605
|
-
inList = "ol";
|
|
34606
|
-
outputLines.push("<ol>");
|
|
34607
|
-
}
|
|
34608
|
-
outputLines.push(`<li>${parseInline(olMatch[1], linkResolver)}</li>`);
|
|
34609
|
-
continue;
|
|
34610
|
-
}
|
|
34611
|
-
if (inList) {
|
|
34612
|
-
closeList();
|
|
34613
|
-
}
|
|
34614
|
-
if (line.trim() === "") {
|
|
34615
|
-
continue;
|
|
34616
|
-
}
|
|
34617
|
-
outputLines.push(`<p>${parseInline(line, linkResolver)}</p>`);
|
|
34618
|
-
}
|
|
34619
|
-
if (inCodeBlock) {
|
|
34620
|
-
outputLines.push(`<pre><code${codeBlockLang ? ` class="language-${escapeHtml(codeBlockLang)}"` : ""}>${escapeHtml(codeBlockContent.join("\n"))}</code></pre>`);
|
|
34621
|
-
}
|
|
34622
|
-
closeList();
|
|
34623
|
-
closeBlockquote();
|
|
34624
|
-
return outputLines.join("\n");
|
|
34625
|
-
}
|
|
34626
|
-
function extractComponents(content, components) {
|
|
34627
|
-
if (!components) return [];
|
|
34628
|
-
const extracted = [];
|
|
34629
|
-
for (const [name, def] of Object.entries(components)) {
|
|
34630
|
-
const matches = Array.from(content.matchAll(def.pattern));
|
|
34631
|
-
matches.forEach(() => {
|
|
34632
|
-
extracted.push({
|
|
34633
|
-
name,
|
|
34634
|
-
props: { ...def.props }
|
|
34635
|
-
});
|
|
34636
|
-
});
|
|
34637
|
-
}
|
|
34638
|
-
return extracted;
|
|
34639
|
-
}
|
|
34640
|
-
function createMarkdownRenderer(props) {
|
|
34641
|
-
const { content, components, linkResolver } = props;
|
|
34642
|
-
const html = parseMarkdown(content, linkResolver);
|
|
34643
|
-
const extractedComponents = extractComponents(content, components);
|
|
34644
|
-
const ariaProps = {
|
|
34645
|
-
role: "document",
|
|
34646
|
-
"aria-label": "Rendered markdown content"
|
|
34647
|
-
};
|
|
34648
|
-
return {
|
|
34649
|
-
html,
|
|
34650
|
-
components: extractedComponents,
|
|
34651
|
-
ariaProps
|
|
34652
|
-
};
|
|
34653
|
-
}
|
|
34654
|
-
var markdownRendererTokens = {
|
|
34655
|
-
name: "markdown-renderer",
|
|
34656
|
-
tokens: {
|
|
34657
|
-
bg: { variable: "--rfr-markdown-bg", fallback: "hsl(var(--background))" },
|
|
34658
|
-
fg: { variable: "--rfr-markdown-fg", fallback: "hsl(var(--foreground))" },
|
|
34659
|
-
codeBg: { variable: "--rfr-markdown-code-bg", fallback: "hsl(var(--muted))" },
|
|
34660
|
-
linkColor: { variable: "--rfr-markdown-link", fallback: "hsl(var(--primary))" },
|
|
34661
|
-
borderColor: { variable: "--rfr-markdown-border", fallback: "hsl(var(--border))" }
|
|
34662
|
-
}
|
|
34663
|
-
};
|
|
34664
|
-
var proseVariants = cva({
|
|
34665
|
-
base: "prose max-w-none text-foreground leading-relaxed",
|
|
34666
|
-
variants: {
|
|
34667
|
-
size: {
|
|
34668
|
-
sm: "prose-sm text-sm",
|
|
34669
|
-
default: "prose-base text-base",
|
|
34670
|
-
lg: "prose-lg text-lg"
|
|
34671
|
-
},
|
|
34672
|
-
theme: {
|
|
34673
|
-
light: "bg-white text-gray-900",
|
|
34674
|
-
dark: "bg-gray-900 text-gray-100"
|
|
34675
|
-
}
|
|
34676
|
-
},
|
|
34677
|
-
defaultVariants: {
|
|
34678
|
-
size: "default"
|
|
34679
|
-
}
|
|
34680
|
-
});
|
|
34681
|
-
function sanitizeHtml(html) {
|
|
34682
|
-
let sanitized = html;
|
|
34683
|
-
sanitized = sanitized.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "");
|
|
34684
|
-
sanitized = sanitized.replace(/<\/?script[^>]*>/gi, "");
|
|
34685
|
-
sanitized = sanitized.replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "");
|
|
34686
|
-
sanitized = sanitized.replace(/(href|src)\s*=\s*["']?\s*javascript\s*:[^"'>]*/gi, '$1=""');
|
|
34687
|
-
return sanitized;
|
|
34688
|
-
}
|
|
34689
|
-
var MarkdownRenderer = React11__namespace.forwardRef(
|
|
34690
|
-
({ content, components, linkResolver, className, size }, ref) => {
|
|
34691
|
-
const coreProps = { content, components, linkResolver };
|
|
34692
|
-
const api = createMarkdownRenderer(coreProps);
|
|
34693
|
-
const classes = cn(proseVariants({ size }), className);
|
|
34694
|
-
const sanitizedHtml = sanitizeHtml(api.html);
|
|
34695
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
34696
|
-
"div",
|
|
34697
|
-
{
|
|
34698
|
-
ref,
|
|
34699
|
-
className: classes,
|
|
34700
|
-
...api.ariaProps,
|
|
34701
|
-
dangerouslySetInnerHTML: { __html: sanitizedHtml }
|
|
34702
|
-
}
|
|
34703
|
-
);
|
|
34704
|
-
}
|
|
34705
|
-
);
|
|
34706
|
-
MarkdownRenderer.displayName = "MarkdownRenderer";
|
|
34707
|
-
|
|
34708
36122
|
// ../mobile-nav/dist/index.js
|
|
34709
36123
|
function createMobileNav(props = {}) {
|
|
34710
36124
|
const isOpen = props.open ?? false;
|
|
@@ -39521,7 +40935,7 @@ var AvatarContext = React11__namespace.createContext({
|
|
|
39521
40935
|
setImageError: () => {
|
|
39522
40936
|
}
|
|
39523
40937
|
});
|
|
39524
|
-
var
|
|
40938
|
+
var Avatar2 = React11__namespace.forwardRef(
|
|
39525
40939
|
({ size = "md", className, children, ...props }, ref) => {
|
|
39526
40940
|
const [imageLoaded, setImageLoaded] = React11__namespace.useState(false);
|
|
39527
40941
|
const [imageError, setImageError] = React11__namespace.useState(false);
|
|
@@ -39539,7 +40953,7 @@ var Avatar = React11__namespace.forwardRef(
|
|
|
39539
40953
|
) });
|
|
39540
40954
|
}
|
|
39541
40955
|
);
|
|
39542
|
-
|
|
40956
|
+
Avatar2.displayName = "Avatar";
|
|
39543
40957
|
var AvatarImage = React11__namespace.forwardRef(
|
|
39544
40958
|
({ className, src, alt = "", onLoad, onError, ...props }, ref) => {
|
|
39545
40959
|
const { setImageLoaded, setImageError } = React11__namespace.useContext(AvatarContext);
|
|
@@ -40132,10 +41546,10 @@ function createDatePicker(props = {}) {
|
|
|
40132
41546
|
closePicker();
|
|
40133
41547
|
}
|
|
40134
41548
|
}
|
|
40135
|
-
function setHours(
|
|
40136
|
-
if (
|
|
41549
|
+
function setHours(h5) {
|
|
41550
|
+
if (h5 < 0 || h5 > 23) return;
|
|
40137
41551
|
const newDate = value ? new Date(value) : /* @__PURE__ */ new Date();
|
|
40138
|
-
newDate.setHours(
|
|
41552
|
+
newDate.setHours(h5);
|
|
40139
41553
|
onChange?.(newDate);
|
|
40140
41554
|
}
|
|
40141
41555
|
function setMinutes(m2) {
|
|
@@ -40327,10 +41741,10 @@ function DatePicker({
|
|
|
40327
41741
|
}
|
|
40328
41742
|
};
|
|
40329
41743
|
const handleHoursChange = (e2) => {
|
|
40330
|
-
const
|
|
40331
|
-
if (isNaN(
|
|
41744
|
+
const h5 = parseInt(e2.target.value, 10);
|
|
41745
|
+
if (isNaN(h5) || h5 < 0 || h5 > 23) return;
|
|
40332
41746
|
const newDate = value ? new Date(value) : /* @__PURE__ */ new Date();
|
|
40333
|
-
newDate.setHours(
|
|
41747
|
+
newDate.setHours(h5);
|
|
40334
41748
|
onChange?.(newDate);
|
|
40335
41749
|
};
|
|
40336
41750
|
const handleMinutesChange = (e2) => {
|
|
@@ -42504,102 +43918,6 @@ var Switch = React11__namespace.forwardRef(
|
|
|
42504
43918
|
}
|
|
42505
43919
|
);
|
|
42506
43920
|
Switch.displayName = "Switch";
|
|
42507
|
-
|
|
42508
|
-
// ../thread-view/dist/index.js
|
|
42509
|
-
function formatTimestamp(date) {
|
|
42510
|
-
const hours = date.getHours();
|
|
42511
|
-
const minutes = date.getMinutes();
|
|
42512
|
-
const ampm = hours >= 12 ? "PM" : "AM";
|
|
42513
|
-
const displayHours = hours % 12 || 12;
|
|
42514
|
-
const displayMinutes = minutes < 10 ? `0${minutes}` : `${minutes}`;
|
|
42515
|
-
return `${displayHours}:${displayMinutes} ${ampm}`;
|
|
42516
|
-
}
|
|
42517
|
-
function formatRelativeTime(date, now) {
|
|
42518
|
-
const reference = now ?? /* @__PURE__ */ new Date();
|
|
42519
|
-
const diffMs = reference.getTime() - date.getTime();
|
|
42520
|
-
const diffSeconds = Math.floor(diffMs / 1e3);
|
|
42521
|
-
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
42522
|
-
const diffHours = Math.floor(diffMinutes / 60);
|
|
42523
|
-
const diffDays = Math.floor(diffHours / 24);
|
|
42524
|
-
if (diffSeconds < 60) return "just now";
|
|
42525
|
-
if (diffMinutes < 60) return `${diffMinutes} minute${diffMinutes === 1 ? "" : "s"} ago`;
|
|
42526
|
-
if (diffHours < 24) return `${diffHours} hour${diffHours === 1 ? "" : "s"} ago`;
|
|
42527
|
-
if (diffDays < 7) return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
|
|
42528
|
-
return date.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
|
42529
|
-
}
|
|
42530
|
-
function createThreadView(props) {
|
|
42531
|
-
const { messages, onReply, onReact, currentUserId } = props;
|
|
42532
|
-
let replyingTo = null;
|
|
42533
|
-
const threadId = generateId("rfr-thread");
|
|
42534
|
-
const labelId = generateId("rfr-thread-label");
|
|
42535
|
-
function startReply(messageId) {
|
|
42536
|
-
replyingTo = messageId;
|
|
42537
|
-
}
|
|
42538
|
-
function cancelReply() {
|
|
42539
|
-
replyingTo = null;
|
|
42540
|
-
}
|
|
42541
|
-
function reply(messageId, content) {
|
|
42542
|
-
onReply?.(messageId, content);
|
|
42543
|
-
replyingTo = null;
|
|
42544
|
-
}
|
|
42545
|
-
function react(messageId, emoji) {
|
|
42546
|
-
onReact?.(messageId, emoji);
|
|
42547
|
-
}
|
|
42548
|
-
const ariaProps = {
|
|
42549
|
-
role: "log",
|
|
42550
|
-
"aria-label": "Message thread",
|
|
42551
|
-
"aria-live": "polite",
|
|
42552
|
-
id: threadId
|
|
42553
|
-
};
|
|
42554
|
-
function getMessageAriaProps(message) {
|
|
42555
|
-
const isOwn = currentUserId && message.author.id === currentUserId;
|
|
42556
|
-
return {
|
|
42557
|
-
role: "article",
|
|
42558
|
-
"aria-label": `Message from ${message.author.name}${isOwn ? " (you)" : ""} at ${formatTimestamp(message.timestamp)}`
|
|
42559
|
-
};
|
|
42560
|
-
}
|
|
42561
|
-
function getReplyButtonAriaProps(_messageId) {
|
|
42562
|
-
return {
|
|
42563
|
-
role: "button",
|
|
42564
|
-
"aria-label": `Reply to message`
|
|
42565
|
-
};
|
|
42566
|
-
}
|
|
42567
|
-
return {
|
|
42568
|
-
state: {
|
|
42569
|
-
messages,
|
|
42570
|
-
get replyingTo() {
|
|
42571
|
-
return replyingTo;
|
|
42572
|
-
}
|
|
42573
|
-
},
|
|
42574
|
-
startReply,
|
|
42575
|
-
cancelReply,
|
|
42576
|
-
reply,
|
|
42577
|
-
react,
|
|
42578
|
-
formatTimestamp,
|
|
42579
|
-
formatRelativeTime,
|
|
42580
|
-
ariaProps,
|
|
42581
|
-
getMessageAriaProps,
|
|
42582
|
-
getReplyButtonAriaProps,
|
|
42583
|
-
ids: {
|
|
42584
|
-
thread: threadId,
|
|
42585
|
-
label: labelId
|
|
42586
|
-
}
|
|
42587
|
-
};
|
|
42588
|
-
}
|
|
42589
|
-
var threadContainerStyles = "flex flex-col gap-1";
|
|
42590
|
-
var threadMessageStyles = "flex gap-3 px-4 py-2 hover:bg-accent/50 rounded-md transition-colors group";
|
|
42591
|
-
var threadAvatarStyles = "h-9 w-9 rounded-full bg-muted flex items-center justify-center text-sm font-medium overflow-hidden flex-shrink-0";
|
|
42592
|
-
var threadContentStyles = "flex-1 min-w-0";
|
|
42593
|
-
var threadAuthorStyles = "font-semibold text-sm";
|
|
42594
|
-
var threadTimestampStyles = "text-xs text-muted-foreground ml-2";
|
|
42595
|
-
var threadBodyStyles = "text-sm mt-0.5 whitespace-pre-wrap break-words";
|
|
42596
|
-
var threadReactionsStyles = "flex flex-wrap gap-1 mt-1";
|
|
42597
|
-
var threadReplyIndicatorStyles = "flex items-center gap-1 mt-1 text-xs text-primary cursor-pointer hover:underline";
|
|
42598
|
-
var threadActionsStyles = "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity";
|
|
42599
|
-
var threadAttachmentStyles = "flex items-center gap-2 mt-1 p-2 rounded border text-xs bg-muted/50";
|
|
42600
|
-
var threadEditedStyles = "text-xs text-muted-foreground ml-1";
|
|
42601
|
-
|
|
42602
|
-
// ../react-thread-view/dist/index.js
|
|
42603
43921
|
function MessageComponent({
|
|
42604
43922
|
message,
|
|
42605
43923
|
api
|
|
@@ -42711,11 +44029,11 @@ ThreadView.displayName = "ThreadView";
|
|
|
42711
44029
|
// ../table-of-contents/dist/index.js
|
|
42712
44030
|
function parseHeadings(container, selectors = "h2, h3, h4") {
|
|
42713
44031
|
const headings = Array.from(container.querySelectorAll(selectors));
|
|
42714
|
-
return headings.map((
|
|
42715
|
-
id:
|
|
42716
|
-
text:
|
|
42717
|
-
level: parseInt(
|
|
42718
|
-
})).filter((
|
|
44032
|
+
return headings.map((h5) => ({
|
|
44033
|
+
id: h5.id || h5.textContent?.toLowerCase().replace(/\s+/g, "-") || "",
|
|
44034
|
+
text: h5.textContent || "",
|
|
44035
|
+
level: parseInt(h5.tagName.charAt(1), 10)
|
|
44036
|
+
})).filter((h5) => h5.id !== "");
|
|
42719
44037
|
}
|
|
42720
44038
|
function observeHeadings(headingIds, callback, options) {
|
|
42721
44039
|
const observer = new IntersectionObserver((entries) => {
|
|
@@ -42742,7 +44060,7 @@ var TableOfContents = React11__namespace.forwardRef(
|
|
|
42742
44060
|
const parsedHeadings = parseHeadings(container, selectors);
|
|
42743
44061
|
setHeadings(parsedHeadings);
|
|
42744
44062
|
if (parsedHeadings.length === 0) return;
|
|
42745
|
-
const disconnect = observeHeadings(parsedHeadings.map((
|
|
44063
|
+
const disconnect = observeHeadings(parsedHeadings.map((h5) => h5.id), (id) => {
|
|
42746
44064
|
setActiveId(id);
|
|
42747
44065
|
onActiveIdChange?.(id);
|
|
42748
44066
|
});
|
|
@@ -43873,7 +45191,7 @@ function resolveStorage(override) {
|
|
|
43873
45191
|
return createMemoryStorage();
|
|
43874
45192
|
}
|
|
43875
45193
|
var DEFAULT_SESSION_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
43876
|
-
var
|
|
45194
|
+
var DEFAULT_KEY2 = "rfx:analytics:session";
|
|
43877
45195
|
var CAMPAIGN_PARAMS = [
|
|
43878
45196
|
"utm_source",
|
|
43879
45197
|
"utm_medium",
|
|
@@ -43904,7 +45222,7 @@ function campaignFingerprint(search) {
|
|
|
43904
45222
|
}
|
|
43905
45223
|
function createSession(config, now = () => Date.now()) {
|
|
43906
45224
|
const storage = resolveStorage(config?.storage);
|
|
43907
|
-
const key = config?.storageKey ??
|
|
45225
|
+
const key = config?.storageKey ?? DEFAULT_KEY2;
|
|
43908
45226
|
const timeoutMs = config?.timeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS;
|
|
43909
45227
|
const resetOnCampaign = config?.resetOnCampaign ?? true;
|
|
43910
45228
|
function read() {
|
|
@@ -43973,10 +45291,10 @@ function createSession(config, now = () => Date.now()) {
|
|
|
43973
45291
|
}
|
|
43974
45292
|
};
|
|
43975
45293
|
}
|
|
43976
|
-
var
|
|
45294
|
+
var DEFAULT_KEY22 = "rfx:analytics:anon";
|
|
43977
45295
|
function createIdentity(config) {
|
|
43978
45296
|
const storage = resolveStorage(config?.storage);
|
|
43979
|
-
const key = config?.storageKey ??
|
|
45297
|
+
const key = config?.storageKey ?? DEFAULT_KEY22;
|
|
43980
45298
|
let userId;
|
|
43981
45299
|
function loadOrMintAnon() {
|
|
43982
45300
|
const existing = storage.get(key);
|
|
@@ -45465,7 +46783,7 @@ exports.AnimatedText = AnimatedText;
|
|
|
45465
46783
|
exports.AppShell = AppShell;
|
|
45466
46784
|
exports.AuthGuard = AuthGuard;
|
|
45467
46785
|
exports.AuthProvider = AuthProvider;
|
|
45468
|
-
exports.Avatar =
|
|
46786
|
+
exports.Avatar = Avatar2;
|
|
45469
46787
|
exports.AvatarFallback = AvatarFallback;
|
|
45470
46788
|
exports.AvatarGroup = AvatarGroup;
|
|
45471
46789
|
exports.AvatarImage = AvatarImage;
|
|
@@ -45493,6 +46811,7 @@ exports.Carousel = Carousel;
|
|
|
45493
46811
|
exports.CarouselContent = CarouselContent;
|
|
45494
46812
|
exports.CarouselItem = CarouselItem;
|
|
45495
46813
|
exports.CarouselTrigger = CarouselTrigger;
|
|
46814
|
+
exports.Chat = Chat;
|
|
45496
46815
|
exports.Checkbox = Checkbox;
|
|
45497
46816
|
exports.CodeBlock = CodeBlock;
|
|
45498
46817
|
exports.CodeBlockContent = CodeBlockContent;
|
|
@@ -45515,7 +46834,10 @@ exports.CommandInput = CommandInput;
|
|
|
45515
46834
|
exports.CommandItem = CommandItem;
|
|
45516
46835
|
exports.CommandList = CommandList;
|
|
45517
46836
|
exports.CommandSeparator = CommandSeparator;
|
|
46837
|
+
exports.Composer = Composer;
|
|
45518
46838
|
exports.ContentProtection = ContentProtection;
|
|
46839
|
+
exports.CookieConsent = CookieConsent;
|
|
46840
|
+
exports.DEFAULT_CATEGORIES = DEFAULT_CATEGORIES;
|
|
45519
46841
|
exports.DEFAULT_VOICE_PILL_POSITION = DEFAULT_VOICE_PILL_POSITION;
|
|
45520
46842
|
exports.DEFAULT_VOICE_PILL_SPEAKER = DEFAULT_VOICE_PILL_SPEAKER;
|
|
45521
46843
|
exports.DEFAULT_WAVEFORM_BAR_COUNT = DEFAULT_WAVEFORM_BAR_COUNT;
|
|
@@ -45690,6 +47012,8 @@ exports.controlsVariants = controlsVariants;
|
|
|
45690
47012
|
exports.createAnalytics = createAnalytics;
|
|
45691
47013
|
exports.createAppInsightsSink = createAppInsightsSink;
|
|
45692
47014
|
exports.createConsoleSink = createConsoleSink;
|
|
47015
|
+
exports.createConversation = createConversation;
|
|
47016
|
+
exports.createCookieConsent = createCookieConsent;
|
|
45693
47017
|
exports.createFaroSink = createFaroSink;
|
|
45694
47018
|
exports.createGA4ClientSdkSink = createGA4ClientSdkSink;
|
|
45695
47019
|
exports.createGA4HttpSink = createGA4HttpSink;
|
|
@@ -45714,6 +47038,7 @@ exports.feedbackDialogVariants = feedbackDialogVariants;
|
|
|
45714
47038
|
exports.fileUploadDropZoneVariants = fileUploadDropZoneVariants;
|
|
45715
47039
|
exports.fileUploadFileItemStyles = fileUploadFileItemStyles;
|
|
45716
47040
|
exports.fileUploadFileListStyles = fileUploadFileListStyles;
|
|
47041
|
+
exports.findMessage = findMessage;
|
|
45717
47042
|
exports.footerVariants = footerVariants;
|
|
45718
47043
|
exports.formatFileSize = formatFileSize;
|
|
45719
47044
|
exports.formatRelativeTime = formatRelativeTime;
|
|
@@ -45722,6 +47047,7 @@ exports.formatTimestamp = formatTimestamp;
|
|
|
45722
47047
|
exports.getAssignableRoles = getAssignableRoles;
|
|
45723
47048
|
exports.getDefaultPortal = getDefaultPortal;
|
|
45724
47049
|
exports.getInitials = getInitials;
|
|
47050
|
+
exports.getReplyCount = getReplyCount;
|
|
45725
47051
|
exports.getVoicePillAriaLabel = getVoicePillAriaLabel;
|
|
45726
47052
|
exports.getVoicePillInitials = getVoicePillInitials;
|
|
45727
47053
|
exports.getVoicePillPosition = getVoicePillPosition;
|
|
@@ -45783,12 +47109,18 @@ exports.resizableDividerVariants = resizableDividerVariants;
|
|
|
45783
47109
|
exports.resizableLayoutTokens = resizableLayoutTokens;
|
|
45784
47110
|
exports.resizableLayoutVariants = resizableLayoutVariants;
|
|
45785
47111
|
exports.resizablePaneVariants = resizablePaneVariants;
|
|
47112
|
+
exports.rootIdOf = rootIdOf;
|
|
45786
47113
|
exports.rowVariants = rowVariants;
|
|
45787
47114
|
exports.scaleWaveformSamples = scaleWaveformSamples;
|
|
45788
47115
|
exports.searchBarVariants = searchBarVariants;
|
|
45789
47116
|
exports.searchResultVariants = searchResultVariants;
|
|
45790
47117
|
exports.selectContentVariants = selectContentVariants;
|
|
45791
47118
|
exports.selectItemVariants = selectItemVariants;
|
|
47119
|
+
exports.selectMainTimeline = selectMainTimeline;
|
|
47120
|
+
exports.selectReplies = selectReplies;
|
|
47121
|
+
exports.selectRoots = selectRoots;
|
|
47122
|
+
exports.selectThreadMessages = selectThreadMessages;
|
|
47123
|
+
exports.selectTimelineFromState = selectTimelineFromState;
|
|
45792
47124
|
exports.selectTokens = selectTokens;
|
|
45793
47125
|
exports.selectTriggerVariants = selectTriggerVariants;
|
|
45794
47126
|
exports.selectorVariants = selectorVariants;
|
|
@@ -45834,6 +47166,8 @@ exports.tooltipContentVariants = tooltipContentVariants;
|
|
|
45834
47166
|
exports.typewriterVariants = typewriterVariants;
|
|
45835
47167
|
exports.useAnalytics = useAnalytics;
|
|
45836
47168
|
exports.useAuth = useAuth;
|
|
47169
|
+
exports.useConversation = useConversation;
|
|
47170
|
+
exports.useCookieConsent = useCookieConsent;
|
|
45837
47171
|
exports.useLogger = useLogger;
|
|
45838
47172
|
exports.useShortcut = useShortcut;
|
|
45839
47173
|
exports.useSpan = useSpan;
|