@convokit/widget 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as rt, jsx as R } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as pe, useContext as mt, useMemo as gn, Fragment as Ho, createElement as Wa, useRef as Tt, useInsertionEffect as Go, useCallback as
|
|
2
|
+
import { createContext as pe, useContext as mt, useMemo as gn, Fragment as Ho, createElement as Wa, useRef as Tt, useInsertionEffect as Go, useCallback as Ko, useLayoutEffect as Ha, useEffect as Mt, forwardRef as Ga, useId as Ka, Component as za, useState as xt } from "react";
|
|
3
3
|
/* empty css */
|
|
4
4
|
function bi(t, e) {
|
|
5
5
|
t.indexOf(e) === -1 && t.push(e);
|
|
@@ -22,8 +22,8 @@ typeof process < "u" && ((Wo = process.env) == null ? void 0 : Wo.NODE_ENV) !==
|
|
|
22
22
|
if (!t)
|
|
23
23
|
throw new Error(qn(e, n));
|
|
24
24
|
});
|
|
25
|
-
const Ht = {},
|
|
26
|
-
function
|
|
25
|
+
const Ht = {}, zo = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);
|
|
26
|
+
function $o(t) {
|
|
27
27
|
return typeof t == "object" && t !== null;
|
|
28
28
|
}
|
|
29
29
|
const Yo = (t) => /^0[^.\s]+$/u.test(t);
|
|
@@ -32,7 +32,7 @@ function xi(t) {
|
|
|
32
32
|
let e;
|
|
33
33
|
return () => (e === void 0 && (e = t()), e);
|
|
34
34
|
}
|
|
35
|
-
const wt = /* @__NO_SIDE_EFFECTS__ */ (t) => t,
|
|
35
|
+
const wt = /* @__NO_SIDE_EFFECTS__ */ (t) => t, $a = (t, e) => (n) => e(t(n)), Ue = (...t) => t.reduce($a), Ve = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
|
|
36
36
|
const i = e - t;
|
|
37
37
|
return i === 0 ? 1 : (n - t) / i;
|
|
38
38
|
};
|
|
@@ -178,7 +178,7 @@ function ur(t, e) {
|
|
|
178
178
|
};
|
|
179
179
|
return { schedule: Ze.reduce((w, E) => {
|
|
180
180
|
const P = o[E];
|
|
181
|
-
return w[E] = (
|
|
181
|
+
return w[E] = (_, O = !1, M = !1) => (n || S(), P.schedule(_, O, M)), w;
|
|
182
182
|
}, {}), cancel: (w) => {
|
|
183
183
|
for (let E = 0; E < Ze.length; E++)
|
|
184
184
|
o[Ze[E]].cancel(w);
|
|
@@ -247,7 +247,7 @@ const Zn = {
|
|
|
247
247
|
test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1,
|
|
248
248
|
parse: parseFloat,
|
|
249
249
|
transform: (e) => `${e}${t}`
|
|
250
|
-
}),
|
|
250
|
+
}), zt = /* @__PURE__ */ We("deg"), Vt = /* @__PURE__ */ We("%"), b = /* @__PURE__ */ We("px"), ul = /* @__PURE__ */ We("vh"), fl = /* @__PURE__ */ We("vw"), Ts = {
|
|
251
251
|
...Vt,
|
|
252
252
|
parse: (t) => Vt.parse(t) / 100,
|
|
253
253
|
transform: (t) => Vt.transform(t * 100)
|
|
@@ -327,7 +327,7 @@ function vl({ hue: t, saturation: e, lightness: n, alpha: i }) {
|
|
|
327
327
|
function cn(t, e) {
|
|
328
328
|
return (n) => n > 0 ? e : t;
|
|
329
329
|
}
|
|
330
|
-
const U = (t, e, n) => t + (e - t) * n,
|
|
330
|
+
const U = (t, e, n) => t + (e - t) * n, _n = (t, e, n) => {
|
|
331
331
|
const i = t * t, s = n * (e * e - i) + i;
|
|
332
332
|
return s < 0 ? 0 : Math.sqrt(s);
|
|
333
333
|
}, wl = [Zn, te, le], Sl = (t) => wl.find((e) => e.test(t));
|
|
@@ -343,7 +343,7 @@ const Ss = (t, e) => {
|
|
|
343
343
|
if (!n || !i)
|
|
344
344
|
return cn(t, e);
|
|
345
345
|
const s = { ...n };
|
|
346
|
-
return (r) => (s.red =
|
|
346
|
+
return (r) => (s.red = _n(n.red, i.red, r), s.green = _n(n.green, i.green, r), s.blue = _n(n.blue, i.blue, r), s.alpha = U(n.alpha, i.alpha, r), te.transform(s));
|
|
347
347
|
}, Jn = /* @__PURE__ */ new Set(["none", "hidden"]);
|
|
348
348
|
function bl(t, e) {
|
|
349
349
|
return Jn.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
|
|
@@ -351,11 +351,11 @@ function bl(t, e) {
|
|
|
351
351
|
function Al(t, e) {
|
|
352
352
|
return (n) => U(t, e, n);
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function _i(t) {
|
|
355
355
|
return typeof t == "number" ? Al : typeof t == "string" ? Mi(t) ? cn : Y.test(t) ? Ss : Pl : Array.isArray(t) ? Tr : typeof t == "object" ? Y.test(t) ? Ss : xl : cn;
|
|
356
356
|
}
|
|
357
357
|
function Tr(t, e) {
|
|
358
|
-
const n = [...t], i = n.length, s = t.map((r, o) =>
|
|
358
|
+
const n = [...t], i = n.length, s = t.map((r, o) => _i(r)(r, e[o]));
|
|
359
359
|
return (r) => {
|
|
360
360
|
for (let o = 0; o < i; o++)
|
|
361
361
|
n[o] = s[o](r);
|
|
@@ -365,7 +365,7 @@ function Tr(t, e) {
|
|
|
365
365
|
function xl(t, e) {
|
|
366
366
|
const n = { ...t, ...e }, i = {};
|
|
367
367
|
for (const s in n)
|
|
368
|
-
t[s] !== void 0 && e[s] !== void 0 && (i[s] =
|
|
368
|
+
t[s] !== void 0 && e[s] !== void 0 && (i[s] = _i(t[s])(t[s], e[s]));
|
|
369
369
|
return (s) => {
|
|
370
370
|
for (const r in i)
|
|
371
371
|
n[r] = i[r](s);
|
|
@@ -385,7 +385,7 @@ const Pl = (t, e) => {
|
|
|
385
385
|
return i.indexes.var.length === s.indexes.var.length && i.indexes.color.length === s.indexes.color.length && i.indexes.number.length >= s.indexes.number.length ? Jn.has(t) && !s.values.length || Jn.has(e) && !i.values.length ? bl(t, e) : Ue(Tr(El(i, s), s.values), n) : (ge(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different"), cn(t, e));
|
|
386
386
|
};
|
|
387
387
|
function vr(t, e, n) {
|
|
388
|
-
return typeof t == "number" && typeof e == "number" && typeof n == "number" ? U(t, e, n) :
|
|
388
|
+
return typeof t == "number" && typeof e == "number" && typeof n == "number" ? U(t, e, n) : _i(t)(t, e);
|
|
389
389
|
}
|
|
390
390
|
const Dl = (t) => {
|
|
391
391
|
const e = ({ timestamp: n }) => t(n);
|
|
@@ -488,17 +488,17 @@ function Rl({ duration: t = B.duration, bounce: e = B.bounce, velocity: n = B.ve
|
|
|
488
488
|
};
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
const
|
|
491
|
+
const _l = 12;
|
|
492
492
|
function Il(t, e, n) {
|
|
493
493
|
let i = n;
|
|
494
|
-
for (let s = 1; s <
|
|
494
|
+
for (let s = 1; s < _l; s++)
|
|
495
495
|
i = i - t(i) / e(i);
|
|
496
496
|
return i;
|
|
497
497
|
}
|
|
498
498
|
function Qn(t, e) {
|
|
499
499
|
return t * Math.sqrt(1 - e * e);
|
|
500
500
|
}
|
|
501
|
-
const
|
|
501
|
+
const Ll = ["duration", "bounce"], kl = ["stiffness", "damping", "mass"];
|
|
502
502
|
function bs(t, e) {
|
|
503
503
|
return e.some((n) => t[n] !== void 0);
|
|
504
504
|
}
|
|
@@ -511,7 +511,7 @@ function Vl(t) {
|
|
|
511
511
|
isResolvedFromDuration: !1,
|
|
512
512
|
...t
|
|
513
513
|
};
|
|
514
|
-
if (!bs(t, kl) && bs(t,
|
|
514
|
+
if (!bs(t, kl) && bs(t, Ll))
|
|
515
515
|
if (t.visualDuration) {
|
|
516
516
|
const n = t.visualDuration, i = 2 * Math.PI / (n * 1.2), s = i * i, r = 2 * Ot(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(s);
|
|
517
517
|
e = {
|
|
@@ -545,36 +545,36 @@ function fn(t = B.visualDuration, e = B.bounce) {
|
|
|
545
545
|
let w;
|
|
546
546
|
if (y < 1) {
|
|
547
547
|
const P = Qn(T, y);
|
|
548
|
-
w = (
|
|
549
|
-
const O = Math.exp(-y * T *
|
|
550
|
-
return o - O * ((m + y * T * S) / P * Math.sin(P *
|
|
548
|
+
w = (_) => {
|
|
549
|
+
const O = Math.exp(-y * T * _);
|
|
550
|
+
return o - O * ((m + y * T * S) / P * Math.sin(P * _) + S * Math.cos(P * _));
|
|
551
551
|
};
|
|
552
552
|
} else if (y === 1)
|
|
553
553
|
w = (P) => o - Math.exp(-T * P) * (S + (m + T * S) * P);
|
|
554
554
|
else {
|
|
555
555
|
const P = T * Math.sqrt(y * y - 1);
|
|
556
|
-
w = (
|
|
557
|
-
const O = Math.exp(-y * T *
|
|
556
|
+
w = (_) => {
|
|
557
|
+
const O = Math.exp(-y * T * _), M = Math.min(P * _, 300);
|
|
558
558
|
return o - O * ((m + y * T * S) * Math.sinh(M) + P * S * Math.cosh(M)) / P;
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
561
|
const E = {
|
|
562
562
|
calculatedDuration: p && f || null,
|
|
563
563
|
next: (P) => {
|
|
564
|
-
const
|
|
564
|
+
const _ = w(P);
|
|
565
565
|
if (p)
|
|
566
566
|
a.done = P >= f;
|
|
567
567
|
else {
|
|
568
568
|
let O = P === 0 ? m : 0;
|
|
569
|
-
y < 1 && (O = P === 0 ? /* @__PURE__ */ kt(m) : Sr(w, P,
|
|
570
|
-
const M = Math.abs(O) <= i, N = Math.abs(o -
|
|
569
|
+
y < 1 && (O = P === 0 ? /* @__PURE__ */ kt(m) : Sr(w, P, _));
|
|
570
|
+
const M = Math.abs(O) <= i, N = Math.abs(o - _) <= s;
|
|
571
571
|
a.done = M && N;
|
|
572
572
|
}
|
|
573
|
-
return a.value = a.done ? o :
|
|
573
|
+
return a.value = a.done ? o : _, a;
|
|
574
574
|
},
|
|
575
575
|
toString: () => {
|
|
576
|
-
const P = Math.min(Ii(E), un),
|
|
577
|
-
return P + "ms " +
|
|
576
|
+
const P = Math.min(Ii(E), un), _ = wr((O) => E.next(P * O).value, P, 30);
|
|
577
|
+
return P + "ms " + _;
|
|
578
578
|
},
|
|
579
579
|
toTransition: () => {
|
|
580
580
|
}
|
|
@@ -597,9 +597,9 @@ function ti({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: i = 3
|
|
|
597
597
|
const N = v(M), F = w(M);
|
|
598
598
|
d.done = Math.abs(N) <= u, d.value = d.done ? T : F;
|
|
599
599
|
};
|
|
600
|
-
let P,
|
|
600
|
+
let P, _;
|
|
601
601
|
const O = (M) => {
|
|
602
|
-
p(d.value) && (P = M,
|
|
602
|
+
p(d.value) && (P = M, _ = fn({
|
|
603
603
|
keyframes: [d.value, m(d.value)],
|
|
604
604
|
velocity: Sr(w, M, d.value),
|
|
605
605
|
// TODO: This should be passing * 1000
|
|
@@ -613,7 +613,7 @@ function ti({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: i = 3
|
|
|
613
613
|
calculatedDuration: null,
|
|
614
614
|
next: (M) => {
|
|
615
615
|
let N = !1;
|
|
616
|
-
return !
|
|
616
|
+
return !_ && P === void 0 && (N = !0, E(M), O(M)), P !== void 0 && M >= P ? _.next(M - P) : (!N && E(M), d);
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
619
|
}
|
|
@@ -684,7 +684,7 @@ function ce({ duration: t = 300, keyframes: e, times: n, ease: i = "easeInOut" }
|
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
686
|
const Wl = (t) => t !== null;
|
|
687
|
-
function
|
|
687
|
+
function Li(t, { repeat: e, repeatType: n = "loop" }, i, s = 1) {
|
|
688
688
|
const r = t.filter(Wl), a = s < 0 || e && n !== "loop" && e % 2 === 1 ? 0 : r.length - 1;
|
|
689
689
|
return !a || i === void 0 ? r[a] : i;
|
|
690
690
|
}
|
|
@@ -767,10 +767,10 @@ class Vi extends ki {
|
|
|
767
767
|
}
|
|
768
768
|
const P = v ? { done: !1, value: c[0] } : E.next(w);
|
|
769
769
|
r && (P.value = r(P.value));
|
|
770
|
-
let { done:
|
|
771
|
-
!v && l !== null && (
|
|
772
|
-
const O = this.holdTime === null && (this.state === "finished" || this.state === "running" &&
|
|
773
|
-
return O && m !== ti && (P.value =
|
|
770
|
+
let { done: _ } = P;
|
|
771
|
+
!v && l !== null && (_ = this.playbackSpeed >= 0 ? this.currentTime >= s : this.currentTime <= 0);
|
|
772
|
+
const O = this.holdTime === null && (this.state === "finished" || this.state === "running" && _);
|
|
773
|
+
return O && m !== ti && (P.value = Li(c, this.options, S, this.speed)), y && y(P.value), O && this.finish(), P;
|
|
774
774
|
}
|
|
775
775
|
/**
|
|
776
776
|
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
@@ -839,14 +839,14 @@ class Vi extends ki {
|
|
|
839
839
|
return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), (n = this.driver) == null || n.stop(), e.observe(this);
|
|
840
840
|
}
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function Kl(t) {
|
|
843
843
|
for (let e = 1; e < t.length; e++)
|
|
844
844
|
t[e] ?? (t[e] = t[e - 1]);
|
|
845
845
|
}
|
|
846
846
|
const ee = (t) => t * 180 / Math.PI, ei = (t) => {
|
|
847
847
|
const e = ee(Math.atan2(t[1], t[0]));
|
|
848
848
|
return ni(e);
|
|
849
|
-
},
|
|
849
|
+
}, zl = {
|
|
850
850
|
x: 4,
|
|
851
851
|
y: 5,
|
|
852
852
|
translateX: 4,
|
|
@@ -859,7 +859,7 @@ const ee = (t) => t * 180 / Math.PI, ei = (t) => {
|
|
|
859
859
|
skewX: (t) => ee(Math.atan(t[1])),
|
|
860
860
|
skewY: (t) => ee(Math.atan(t[2])),
|
|
861
861
|
skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2
|
|
862
|
-
}, ni = (t) => (t = t % 360, t < 0 && (t += 360), t), As = ei, xs = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), Es = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]),
|
|
862
|
+
}, ni = (t) => (t = t % 360, t < 0 && (t += 360), t), As = ei, xs = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), Es = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), $l = {
|
|
863
863
|
x: 12,
|
|
864
864
|
y: 13,
|
|
865
865
|
z: 14,
|
|
@@ -886,10 +886,10 @@ function si(t, e) {
|
|
|
886
886
|
const n = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
|
|
887
887
|
let i, s;
|
|
888
888
|
if (n)
|
|
889
|
-
i =
|
|
889
|
+
i = $l, s = n;
|
|
890
890
|
else {
|
|
891
891
|
const a = t.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
|
892
|
-
i =
|
|
892
|
+
i = zl, s = a;
|
|
893
893
|
}
|
|
894
894
|
if (!s)
|
|
895
895
|
return ii(e);
|
|
@@ -929,7 +929,7 @@ function Jl(t) {
|
|
|
929
929
|
i !== void 0 && (e.push([n, i.get()]), i.set(n.startsWith("scale") ? 1 : 0));
|
|
930
930
|
}), e;
|
|
931
931
|
}
|
|
932
|
-
const
|
|
932
|
+
const $t = {
|
|
933
933
|
// Dimensions
|
|
934
934
|
width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
|
|
935
935
|
height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
|
|
@@ -941,8 +941,8 @@ const Kt = {
|
|
|
941
941
|
x: (t, { transform: e }) => si(e, "x"),
|
|
942
942
|
y: (t, { transform: e }) => si(e, "y")
|
|
943
943
|
};
|
|
944
|
-
|
|
945
|
-
|
|
944
|
+
$t.translateX = $t.x;
|
|
945
|
+
$t.translateY = $t.y;
|
|
946
946
|
const ne = /* @__PURE__ */ new Set();
|
|
947
947
|
let oi = !1, ri = !1, ai = !1;
|
|
948
948
|
function Ar() {
|
|
@@ -991,7 +991,7 @@ class Oi {
|
|
|
991
991
|
}
|
|
992
992
|
e[0] === void 0 && (e[0] = o), s && r === void 0 && s.set(e[0]);
|
|
993
993
|
}
|
|
994
|
-
|
|
994
|
+
Kl(e);
|
|
995
995
|
}
|
|
996
996
|
setFinalKeyframe() {
|
|
997
997
|
}
|
|
@@ -1074,7 +1074,7 @@ class ac extends ki {
|
|
|
1074
1074
|
const u = rc(e);
|
|
1075
1075
|
this.animation = oc(n, i, s, u, r), u.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
|
|
1076
1076
|
if (this.finishedTime = this.time, !r) {
|
|
1077
|
-
const c =
|
|
1077
|
+
const c = Li(s, this.options, a, this.speed);
|
|
1078
1078
|
this.updateMotionValue ? this.updateMotionValue(c) : ec(n, i, c), this.animation.cancel();
|
|
1079
1079
|
}
|
|
1080
1080
|
l == null || l(), this.notifyFinished();
|
|
@@ -1172,7 +1172,7 @@ function lc(t) {
|
|
|
1172
1172
|
function cc(t) {
|
|
1173
1173
|
typeof t.ease == "string" && lc(t.ease) && (t.ease = Mr[t.ease]);
|
|
1174
1174
|
}
|
|
1175
|
-
const
|
|
1175
|
+
const Ln = 10;
|
|
1176
1176
|
class uc extends ac {
|
|
1177
1177
|
constructor(e) {
|
|
1178
1178
|
cc(e), br(e), super(e), e.startTime !== void 0 && (this.startTime = e.startTime), this.options = e;
|
|
@@ -1196,7 +1196,7 @@ class uc extends ac {
|
|
|
1196
1196
|
const a = new Vi({
|
|
1197
1197
|
...o,
|
|
1198
1198
|
autoplay: !1
|
|
1199
|
-
}), l = Math.max(
|
|
1199
|
+
}), l = Math.max(Ln, ct.now() - this.startTime), u = Ot(0, Ln, l - Ln);
|
|
1200
1200
|
n.setWithVelocity(a.sample(Math.max(0, l - u)).value, a.sample(l).value, u), a.stop();
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
@@ -1269,7 +1269,7 @@ class yc extends ki {
|
|
|
1269
1269
|
var S, T;
|
|
1270
1270
|
this.keyframeResolver = void 0;
|
|
1271
1271
|
const { name: r, type: o, velocity: a, delay: l, isHandoff: u, onUpdate: c } = i;
|
|
1272
|
-
this.resolvedAt = ct.now(), hc(e, r, o, a) || ((Ht.instantAnimations || !l) && (c == null || c(
|
|
1272
|
+
this.resolvedAt = ct.now(), hc(e, r, o, a) || ((Ht.instantAnimations || !l) && (c == null || c(Li(e, i, n))), e[0] = e[e.length - 1], li(i), i.repeat = 0);
|
|
1273
1273
|
const d = {
|
|
1274
1274
|
startTime: s ? this.resolvedAt ? this.resolvedAt - this.createdAt > gc ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
|
|
1275
1275
|
finalKeyframe: n,
|
|
@@ -1359,7 +1359,7 @@ function Rr(t, e, n = 1) {
|
|
|
1359
1359
|
const r = window.getComputedStyle(e).getPropertyValue(i);
|
|
1360
1360
|
if (r) {
|
|
1361
1361
|
const o = r.trim();
|
|
1362
|
-
return
|
|
1362
|
+
return zo(o) ? parseFloat(o) : o;
|
|
1363
1363
|
}
|
|
1364
1364
|
return Mi(s) ? Rr(s, e, n + 1) : s;
|
|
1365
1365
|
}
|
|
@@ -1445,7 +1445,7 @@ function de(t, e, n) {
|
|
|
1445
1445
|
const i = t.getProps();
|
|
1446
1446
|
return Bi(i, e, n !== void 0 ? n : i.custom, t);
|
|
1447
1447
|
}
|
|
1448
|
-
const
|
|
1448
|
+
const _r = /* @__PURE__ */ new Set([
|
|
1449
1449
|
"width",
|
|
1450
1450
|
"height",
|
|
1451
1451
|
"top",
|
|
@@ -1660,19 +1660,19 @@ function me(t, e) {
|
|
|
1660
1660
|
return new Rc(t, e);
|
|
1661
1661
|
}
|
|
1662
1662
|
const ci = (t) => Array.isArray(t);
|
|
1663
|
-
function
|
|
1663
|
+
function _c(t, e, n) {
|
|
1664
1664
|
t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, me(n));
|
|
1665
1665
|
}
|
|
1666
1666
|
function Ic(t) {
|
|
1667
1667
|
return ci(t) ? t[t.length - 1] || 0 : t;
|
|
1668
1668
|
}
|
|
1669
|
-
function
|
|
1669
|
+
function Lc(t, e) {
|
|
1670
1670
|
const n = de(t, e);
|
|
1671
1671
|
let { transitionEnd: i = {}, transition: s = {}, ...r } = n || {};
|
|
1672
1672
|
r = { ...r, ...i };
|
|
1673
1673
|
for (const o in r) {
|
|
1674
1674
|
const a = Ic(r[o]);
|
|
1675
|
-
|
|
1675
|
+
_c(t, o, a);
|
|
1676
1676
|
}
|
|
1677
1677
|
}
|
|
1678
1678
|
const at = (t) => !!(t && t.getVelocity);
|
|
@@ -1692,7 +1692,7 @@ function Ui(t) {
|
|
|
1692
1692
|
return t.replace(/([A-Z])/g, (e) => `-${e.toLowerCase()}`);
|
|
1693
1693
|
}
|
|
1694
1694
|
const Vc = "framerAppearId", Ir = "data-" + Ui(Vc);
|
|
1695
|
-
function
|
|
1695
|
+
function Lr(t) {
|
|
1696
1696
|
return t.props[Ir];
|
|
1697
1697
|
}
|
|
1698
1698
|
function Oc({ protectedKeys: t, needsAnimating: e }, n) {
|
|
@@ -1715,19 +1715,19 @@ function kr(t, e, { delay: n = 0, transitionOverride: i, type: s } = {}) {
|
|
|
1715
1715
|
continue;
|
|
1716
1716
|
let y = !1;
|
|
1717
1717
|
if (window.MotionHandoffAnimation) {
|
|
1718
|
-
const T =
|
|
1718
|
+
const T = Lr(t);
|
|
1719
1719
|
if (T) {
|
|
1720
1720
|
const v = window.MotionHandoffAnimation(T, c, k);
|
|
1721
1721
|
v !== null && (p.startTime = v, y = !0);
|
|
1722
1722
|
}
|
|
1723
1723
|
}
|
|
1724
|
-
ui(t, c), f.start(Fi(c, f, d, t.shouldReduceMotion &&
|
|
1724
|
+
ui(t, c), f.start(Fi(c, f, d, t.shouldReduceMotion && _r.has(c) ? { type: !1 } : p, t, y));
|
|
1725
1725
|
const S = f.animation;
|
|
1726
1726
|
S && l.push(S);
|
|
1727
1727
|
}
|
|
1728
1728
|
return o && Promise.all(l).then(() => {
|
|
1729
1729
|
k.update(() => {
|
|
1730
|
-
o &&
|
|
1730
|
+
o && Lc(t, o);
|
|
1731
1731
|
});
|
|
1732
1732
|
}), l;
|
|
1733
1733
|
}
|
|
@@ -1774,7 +1774,7 @@ function Fc(t, e, n = {}) {
|
|
|
1774
1774
|
const Bc = {
|
|
1775
1775
|
test: (t) => t === "auto",
|
|
1776
1776
|
parse: (t) => t
|
|
1777
|
-
}, Vr = (t) => (e) => e.test(t), Or = [ye, b, Vt,
|
|
1777
|
+
}, Vr = (t) => (e) => e.test(t), Or = [ye, b, Vt, zt, fl, ul, Bc], _s = (t) => Or.find(Vr(t));
|
|
1778
1778
|
function Uc(t) {
|
|
1779
1779
|
return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || Yo(t) : !0;
|
|
1780
1780
|
}
|
|
@@ -1800,17 +1800,17 @@ const Hc = /\b([a-z-]*)\(.*?\)/gu, hi = {
|
|
|
1800
1800
|
...ye,
|
|
1801
1801
|
transform: Math.round
|
|
1802
1802
|
}, Gc = {
|
|
1803
|
-
rotate:
|
|
1804
|
-
rotateX:
|
|
1805
|
-
rotateY:
|
|
1806
|
-
rotateZ:
|
|
1803
|
+
rotate: zt,
|
|
1804
|
+
rotateX: zt,
|
|
1805
|
+
rotateY: zt,
|
|
1806
|
+
rotateZ: zt,
|
|
1807
1807
|
scale: Je,
|
|
1808
1808
|
scaleX: Je,
|
|
1809
1809
|
scaleY: Je,
|
|
1810
1810
|
scaleZ: Je,
|
|
1811
|
-
skew:
|
|
1812
|
-
skewX:
|
|
1813
|
-
skewY:
|
|
1811
|
+
skew: zt,
|
|
1812
|
+
skewX: zt,
|
|
1813
|
+
skewY: zt,
|
|
1814
1814
|
distance: b,
|
|
1815
1815
|
translateX: b,
|
|
1816
1816
|
translateY: b,
|
|
@@ -1885,7 +1885,7 @@ const Hc = /\b([a-z-]*)\(.*?\)/gu, hi = {
|
|
|
1885
1885
|
fillOpacity: Oe,
|
|
1886
1886
|
strokeOpacity: Oe,
|
|
1887
1887
|
numOctaves: Is
|
|
1888
|
-
},
|
|
1888
|
+
}, Kc = {
|
|
1889
1889
|
...ji,
|
|
1890
1890
|
// Color props
|
|
1891
1891
|
color: Y,
|
|
@@ -1901,17 +1901,17 @@ const Hc = /\b([a-z-]*)\(.*?\)/gu, hi = {
|
|
|
1901
1901
|
borderLeftColor: Y,
|
|
1902
1902
|
filter: hi,
|
|
1903
1903
|
WebkitFilter: hi
|
|
1904
|
-
}, Nr = (t) =>
|
|
1904
|
+
}, Nr = (t) => Kc[t];
|
|
1905
1905
|
function Fr(t, e) {
|
|
1906
1906
|
let n = Nr(t);
|
|
1907
1907
|
return n !== hi && (n = Xt), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
|
|
1908
1908
|
}
|
|
1909
|
-
const
|
|
1910
|
-
function
|
|
1909
|
+
const zc = /* @__PURE__ */ new Set(["auto", "none", "0"]);
|
|
1910
|
+
function $c(t, e, n) {
|
|
1911
1911
|
let i = 0, s;
|
|
1912
1912
|
for (; i < t.length && !s; ) {
|
|
1913
1913
|
const r = t[i];
|
|
1914
|
-
typeof r == "string" &&
|
|
1914
|
+
typeof r == "string" && !zc.has(r) && Ne(r).values.length && (s = t[i]), i++;
|
|
1915
1915
|
}
|
|
1916
1916
|
if (s && n)
|
|
1917
1917
|
for (const r of e)
|
|
@@ -1933,10 +1933,10 @@ class Yc extends Oi {
|
|
|
1933
1933
|
d !== void 0 && (e[c] = d), c === e.length - 1 && (this.finalKeyframe = f);
|
|
1934
1934
|
}
|
|
1935
1935
|
}
|
|
1936
|
-
if (this.resolveNoneKeyframes(), !
|
|
1936
|
+
if (this.resolveNoneKeyframes(), !_r.has(i) || e.length !== 2)
|
|
1937
1937
|
return;
|
|
1938
|
-
const [s, r] = e, o =
|
|
1939
|
-
if (l !== u &&
|
|
1938
|
+
const [s, r] = e, o = _s(s), a = _s(r), l = ys(s), u = ys(r);
|
|
1939
|
+
if (l !== u && $t[i]) {
|
|
1940
1940
|
this.needsMeasurement = !0;
|
|
1941
1941
|
return;
|
|
1942
1942
|
}
|
|
@@ -1946,19 +1946,19 @@ class Yc extends Oi {
|
|
|
1946
1946
|
const f = e[c];
|
|
1947
1947
|
typeof f == "string" && (e[c] = parseFloat(f));
|
|
1948
1948
|
}
|
|
1949
|
-
else
|
|
1949
|
+
else $t[i] && (this.needsMeasurement = !0);
|
|
1950
1950
|
}
|
|
1951
1951
|
resolveNoneKeyframes() {
|
|
1952
1952
|
const { unresolvedKeyframes: e, name: n } = this, i = [];
|
|
1953
1953
|
for (let s = 0; s < e.length; s++)
|
|
1954
1954
|
(e[s] === null || Uc(e[s])) && i.push(s);
|
|
1955
|
-
i.length &&
|
|
1955
|
+
i.length && $c(e, i, n);
|
|
1956
1956
|
}
|
|
1957
1957
|
measureInitialState() {
|
|
1958
1958
|
const { element: e, unresolvedKeyframes: n, name: i } = this;
|
|
1959
1959
|
if (!e || !e.current)
|
|
1960
1960
|
return;
|
|
1961
|
-
i === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin =
|
|
1961
|
+
i === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = $t[i](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
|
|
1962
1962
|
const s = n[n.length - 1];
|
|
1963
1963
|
s !== void 0 && e.getValue(i, s).jump(s, !1);
|
|
1964
1964
|
}
|
|
@@ -1970,7 +1970,7 @@ class Yc extends Oi {
|
|
|
1970
1970
|
const s = e.getValue(n);
|
|
1971
1971
|
s && s.jump(this.measuredOrigin, !1);
|
|
1972
1972
|
const r = i.length - 1, o = i[r];
|
|
1973
|
-
i[r] =
|
|
1973
|
+
i[r] = $t[n](e.measureViewportBox(), window.getComputedStyle(e.current)), o !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = o), (a = this.removedTransforms) != null && a.length && this.removedTransforms.forEach(([l, u]) => {
|
|
1974
1974
|
e.getValue(l).set(u);
|
|
1975
1975
|
}), this.resolveNoneKeyframes();
|
|
1976
1976
|
}
|
|
@@ -1987,7 +1987,7 @@ function Xc(t, e, n) {
|
|
|
1987
1987
|
}
|
|
1988
1988
|
const Br = (t, e) => e && typeof t == "number" ? e.transform(t) : t;
|
|
1989
1989
|
function qc(t) {
|
|
1990
|
-
return
|
|
1990
|
+
return $o(t) && "offsetHeight" in t;
|
|
1991
1991
|
}
|
|
1992
1992
|
const { schedule: Wi } = /* @__PURE__ */ ur(queueMicrotask, !1), Pt = {
|
|
1993
1993
|
x: !1,
|
|
@@ -2011,18 +2011,18 @@ function jr(t, e) {
|
|
|
2011
2011
|
};
|
|
2012
2012
|
return [n, s, () => i.abort()];
|
|
2013
2013
|
}
|
|
2014
|
-
function
|
|
2014
|
+
function Ls(t) {
|
|
2015
2015
|
return !(t.pointerType === "touch" || Ur());
|
|
2016
2016
|
}
|
|
2017
2017
|
function Jc(t, e, n = {}) {
|
|
2018
2018
|
const [i, s, r] = jr(t, n), o = (a) => {
|
|
2019
|
-
if (!
|
|
2019
|
+
if (!Ls(a))
|
|
2020
2020
|
return;
|
|
2021
2021
|
const { target: l } = a, u = e(l, a);
|
|
2022
2022
|
if (typeof u != "function" || !l)
|
|
2023
2023
|
return;
|
|
2024
2024
|
const c = (f) => {
|
|
2025
|
-
|
|
2025
|
+
Ls(f) && (u(f), l.removeEventListener("pointerleave", c));
|
|
2026
2026
|
};
|
|
2027
2027
|
l.addEventListener("pointerleave", c, s);
|
|
2028
2028
|
};
|
|
@@ -2087,7 +2087,7 @@ function eu(t, e, n = {}) {
|
|
|
2087
2087
|
}), r;
|
|
2088
2088
|
}
|
|
2089
2089
|
function Gr(t) {
|
|
2090
|
-
return
|
|
2090
|
+
return $o(t) && "ownerSVGElement" in t;
|
|
2091
2091
|
}
|
|
2092
2092
|
function nu(t) {
|
|
2093
2093
|
return Gr(t) && t.tagName === "svg";
|
|
@@ -2103,9 +2103,9 @@ const iu = [...Or, Y, Xt], su = (t) => iu.find(Vr(t)), Os = () => ({
|
|
|
2103
2103
|
}), Ns = () => ({ min: 0, max: 0 }), Z = () => ({
|
|
2104
2104
|
x: Ns(),
|
|
2105
2105
|
y: Ns()
|
|
2106
|
-
}), di = { current: null },
|
|
2106
|
+
}), di = { current: null }, Kr = { current: !1 }, ou = typeof window < "u";
|
|
2107
2107
|
function ru() {
|
|
2108
|
-
if (
|
|
2108
|
+
if (Kr.current = !0, !!ou)
|
|
2109
2109
|
if (window.matchMedia) {
|
|
2110
2110
|
const t = window.matchMedia("(prefers-reduced-motion)"), e = () => di.current = t.matches;
|
|
2111
2111
|
t.addEventListener("change", e), e();
|
|
@@ -2127,11 +2127,11 @@ const Gi = [
|
|
|
2127
2127
|
"whileTap",
|
|
2128
2128
|
"whileDrag",
|
|
2129
2129
|
"exit"
|
|
2130
|
-
],
|
|
2130
|
+
], Ki = ["initial", ...Gi];
|
|
2131
2131
|
function vn(t) {
|
|
2132
|
-
return Tn(t.animate) ||
|
|
2132
|
+
return Tn(t.animate) || Ki.some((e) => Fe(t[e]));
|
|
2133
2133
|
}
|
|
2134
|
-
function
|
|
2134
|
+
function zr(t) {
|
|
2135
2135
|
return !!(vn(t) || t.variants);
|
|
2136
2136
|
}
|
|
2137
2137
|
function lu(t, e, n) {
|
|
@@ -2164,7 +2164,7 @@ const Fs = [
|
|
|
2164
2164
|
"LayoutAnimationComplete"
|
|
2165
2165
|
];
|
|
2166
2166
|
let hn = {};
|
|
2167
|
-
function
|
|
2167
|
+
function $r(t) {
|
|
2168
2168
|
hn = t;
|
|
2169
2169
|
}
|
|
2170
2170
|
function cu() {
|
|
@@ -2189,7 +2189,7 @@ class uu {
|
|
|
2189
2189
|
this.renderScheduledAt < d && (this.renderScheduledAt = d, k.render(this.render, !1, !0));
|
|
2190
2190
|
};
|
|
2191
2191
|
const { latestValues: l, renderState: u } = o;
|
|
2192
|
-
this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = u, this.parent = e, this.props = n, this.presenceContext = i, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = s, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = vn(n), this.isVariantNode =
|
|
2192
|
+
this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = u, this.parent = e, this.props = n, this.presenceContext = i, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = s, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = vn(n), this.isVariantNode = zr(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
|
|
2193
2193
|
const { willChange: c, ...f } = this.scrapeMotionValuesFromProps(n, {}, this);
|
|
2194
2194
|
for (const d in f) {
|
|
2195
2195
|
const p = f[d];
|
|
@@ -2198,7 +2198,7 @@ class uu {
|
|
|
2198
2198
|
}
|
|
2199
2199
|
mount(e) {
|
|
2200
2200
|
var n;
|
|
2201
|
-
this.current = e, au.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((i, s) => this.bindToMotionValue(s, i)), this.reducedMotionConfig === "never" ? this.shouldReduceMotion = !1 : this.reducedMotionConfig === "always" ? this.shouldReduceMotion = !0 : (
|
|
2201
|
+
this.current = e, au.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((i, s) => this.bindToMotionValue(s, i)), this.reducedMotionConfig === "never" ? this.shouldReduceMotion = !1 : this.reducedMotionConfig === "always" ? this.shouldReduceMotion = !0 : (Kr.current || ru(), this.shouldReduceMotion = di.current), process.env.NODE_ENV !== "production" && qo(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), (n = this.parent) == null || n.addChild(this), this.update(this.props, this.presenceContext);
|
|
2202
2202
|
}
|
|
2203
2203
|
unmount() {
|
|
2204
2204
|
var e;
|
|
@@ -2339,7 +2339,7 @@ class uu {
|
|
|
2339
2339
|
*/
|
|
2340
2340
|
readValue(e, n) {
|
|
2341
2341
|
let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
|
|
2342
|
-
return i != null && (typeof i == "string" && (
|
|
2342
|
+
return i != null && (typeof i == "string" && (zo(i) || Yo(i)) ? i = parseFloat(i) : !su(i) && Xt.test(n) && (i = Fr(e, n)), this.setBaseTarget(e, at(i) ? i.get() : i)), at(i) ? i.get() : i;
|
|
2343
2343
|
}
|
|
2344
2344
|
/**
|
|
2345
2345
|
* Set the base target to later animate back to. This is currently
|
|
@@ -2511,7 +2511,7 @@ function yu(t, e, n) {
|
|
|
2511
2511
|
}
|
|
2512
2512
|
return i = i.trim(), n ? i = n(e, s ? "" : i) : s && (i = "none"), i;
|
|
2513
2513
|
}
|
|
2514
|
-
function
|
|
2514
|
+
function zi(t, e, n) {
|
|
2515
2515
|
const { style: i, vars: s, transformOrigin: r } = t;
|
|
2516
2516
|
let o = !1, a = !1;
|
|
2517
2517
|
for (const l in e) {
|
|
@@ -2585,7 +2585,7 @@ const xe = {
|
|
|
2585
2585
|
function ta(t, { layout: e, layoutId: n }) {
|
|
2586
2586
|
return ve.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!gi[t] || t === "opacity");
|
|
2587
2587
|
}
|
|
2588
|
-
function
|
|
2588
|
+
function $i(t, e, n) {
|
|
2589
2589
|
var o;
|
|
2590
2590
|
const i = t.style, s = e == null ? void 0 : e.style, r = {};
|
|
2591
2591
|
if (!i)
|
|
@@ -2614,10 +2614,10 @@ class wu extends Yr {
|
|
|
2614
2614
|
return Jr(e, n);
|
|
2615
2615
|
}
|
|
2616
2616
|
build(e, n, i) {
|
|
2617
|
-
|
|
2617
|
+
zi(e, n, i.transformTemplate);
|
|
2618
2618
|
}
|
|
2619
2619
|
scrapeMotionValuesFromProps(e, n, i) {
|
|
2620
|
-
return
|
|
2620
|
+
return $i(e, n, i);
|
|
2621
2621
|
}
|
|
2622
2622
|
}
|
|
2623
2623
|
const Su = {
|
|
@@ -2650,7 +2650,7 @@ function ea(t, {
|
|
|
2650
2650
|
// This is object creation, which we try to avoid per-frame.
|
|
2651
2651
|
...a
|
|
2652
2652
|
}, l, u, c) {
|
|
2653
|
-
if (
|
|
2653
|
+
if (zi(t, a, u), l) {
|
|
2654
2654
|
t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
|
|
2655
2655
|
return;
|
|
2656
2656
|
}
|
|
@@ -2692,7 +2692,7 @@ function Eu(t, e, n, i) {
|
|
|
2692
2692
|
t.setAttribute(na.has(s) ? s : Ui(s), e.attrs[s]);
|
|
2693
2693
|
}
|
|
2694
2694
|
function sa(t, e, n) {
|
|
2695
|
-
const i =
|
|
2695
|
+
const i = $i(t, e, n);
|
|
2696
2696
|
for (const s in t)
|
|
2697
2697
|
if (at(t[s]) || at(e[s])) {
|
|
2698
2698
|
const r = Te.indexOf(s) !== -1 ? "attr" + s.charAt(0).toUpperCase() + s.substring(1) : s;
|
|
@@ -2727,7 +2727,7 @@ class Pu extends Yr {
|
|
|
2727
2727
|
this.isSVGTag = ia(e.tagName), super.mount(e);
|
|
2728
2728
|
}
|
|
2729
2729
|
}
|
|
2730
|
-
const Du =
|
|
2730
|
+
const Du = Ki.length;
|
|
2731
2731
|
function oa(t) {
|
|
2732
2732
|
if (!t)
|
|
2733
2733
|
return;
|
|
@@ -2737,7 +2737,7 @@ function oa(t) {
|
|
|
2737
2737
|
}
|
|
2738
2738
|
const e = {};
|
|
2739
2739
|
for (let n = 0; n < Du; n++) {
|
|
2740
|
-
const i =
|
|
2740
|
+
const i = Ki[n], s = t.props[i];
|
|
2741
2741
|
(Fe(s) || s === !1) && (e[i] = s);
|
|
2742
2742
|
}
|
|
2743
2743
|
return e;
|
|
@@ -2757,8 +2757,8 @@ const Mu = [...Gi].reverse(), Cu = Gi.length;
|
|
|
2757
2757
|
function Ru(t) {
|
|
2758
2758
|
return (e) => Promise.all(e.map(({ animation: n, options: i }) => Fc(t, n, i)));
|
|
2759
2759
|
}
|
|
2760
|
-
function
|
|
2761
|
-
let e = Ru(t), n =
|
|
2760
|
+
function _u(t) {
|
|
2761
|
+
let e = Ru(t), n = Ks(), i = !0;
|
|
2762
2762
|
const s = (l) => (u, c) => {
|
|
2763
2763
|
var d;
|
|
2764
2764
|
const f = de(t, c, l === "exit" ? (d = t.presenceContext) == null ? void 0 : d.custom : void 0);
|
|
@@ -2777,36 +2777,36 @@ function Lu(t) {
|
|
|
2777
2777
|
for (let S = 0; S < Cu; S++) {
|
|
2778
2778
|
const T = Mu[S], v = n[T], w = u[T] !== void 0 ? u[T] : c[T], E = Fe(w), P = T === l ? v.isActive : null;
|
|
2779
2779
|
P === !1 && (m = S);
|
|
2780
|
-
let
|
|
2781
|
-
if (
|
|
2780
|
+
let _ = w === c[T] && w !== u[T] && E;
|
|
2781
|
+
if (_ && i && t.manuallyAnimateOnMount && (_ = !1), v.protectedKeys = { ...p }, // If it isn't active and hasn't *just* been set as inactive
|
|
2782
2782
|
!v.isActive && P === null || // If we didn't and don't have any defined prop for this animation type
|
|
2783
2783
|
!w && !v.prevProp || // Or if the prop doesn't define an animation
|
|
2784
2784
|
Tn(w) || typeof w == "boolean")
|
|
2785
2785
|
continue;
|
|
2786
2786
|
const O = Iu(v.prevProp, w);
|
|
2787
2787
|
let M = O || // If we're making this variant active, we want to always make it active
|
|
2788
|
-
T === l && v.isActive && !
|
|
2788
|
+
T === l && v.isActive && !_ && E || // If we removed a higher-priority variant (i is in reverse order)
|
|
2789
2789
|
S > m && E, N = !1;
|
|
2790
2790
|
const F = Array.isArray(w) ? w : [w];
|
|
2791
|
-
let
|
|
2792
|
-
P === !1 && (
|
|
2791
|
+
let L = F.reduce(s(T), {});
|
|
2792
|
+
P === !1 && (L = {});
|
|
2793
2793
|
const { prevResolvedValues: pt = {} } = v, Gt = {
|
|
2794
2794
|
...pt,
|
|
2795
|
-
...
|
|
2796
|
-
},
|
|
2795
|
+
...L
|
|
2796
|
+
}, Kt = (G) => {
|
|
2797
2797
|
M = !0, d.has(G) && (N = !0, d.delete(G)), v.needsAnimating[G] = !0;
|
|
2798
2798
|
const J = t.getValue(G);
|
|
2799
2799
|
J && (J.liveStyle = !1);
|
|
2800
2800
|
};
|
|
2801
2801
|
for (const G in Gt) {
|
|
2802
|
-
const J =
|
|
2802
|
+
const J = L[G], nt = pt[G];
|
|
2803
2803
|
if (p.hasOwnProperty(G))
|
|
2804
2804
|
continue;
|
|
2805
2805
|
let bt = !1;
|
|
2806
|
-
ci(J) && ci(nt) ? bt = !ra(J, nt) : bt = J !== nt, bt ? J != null ?
|
|
2806
|
+
ci(J) && ci(nt) ? bt = !ra(J, nt) : bt = J !== nt, bt ? J != null ? Kt(G) : d.add(G) : J !== void 0 && d.has(G) ? Kt(G) : v.protectedKeys[G] = !0;
|
|
2807
2807
|
}
|
|
2808
|
-
v.prevProp = w, v.prevResolvedValues =
|
|
2809
|
-
const Nt =
|
|
2808
|
+
v.prevProp = w, v.prevResolvedValues = L, v.isActive && (p = { ...p, ...L }), i && t.blockInitialAnimation && (M = !1);
|
|
2809
|
+
const Nt = _ && O;
|
|
2810
2810
|
M && (!Nt || N) && f.push(...F.map((G) => {
|
|
2811
2811
|
const J = { type: T };
|
|
2812
2812
|
if (typeof G == "string" && i && !Nt && t.manuallyAnimateOnMount && t.parent) {
|
|
@@ -2855,7 +2855,7 @@ function Lu(t) {
|
|
|
2855
2855
|
setAnimateFunction: r,
|
|
2856
2856
|
getState: () => n,
|
|
2857
2857
|
reset: () => {
|
|
2858
|
-
n =
|
|
2858
|
+
n = Ks();
|
|
2859
2859
|
}
|
|
2860
2860
|
};
|
|
2861
2861
|
}
|
|
@@ -2870,7 +2870,7 @@ function Jt(t = !1) {
|
|
|
2870
2870
|
prevResolvedValues: {}
|
|
2871
2871
|
};
|
|
2872
2872
|
}
|
|
2873
|
-
function
|
|
2873
|
+
function Ks() {
|
|
2874
2874
|
return {
|
|
2875
2875
|
animate: Jt(!0),
|
|
2876
2876
|
whileInView: Jt(),
|
|
@@ -2881,16 +2881,16 @@ function zs() {
|
|
|
2881
2881
|
exit: Jt()
|
|
2882
2882
|
};
|
|
2883
2883
|
}
|
|
2884
|
-
function
|
|
2884
|
+
function zs(t, e) {
|
|
2885
2885
|
t.min = e.min, t.max = e.max;
|
|
2886
2886
|
}
|
|
2887
2887
|
function Et(t, e) {
|
|
2888
|
-
|
|
2888
|
+
zs(t.x, e.x), zs(t.y, e.y);
|
|
2889
2889
|
}
|
|
2890
|
-
function
|
|
2890
|
+
function $s(t, e) {
|
|
2891
2891
|
t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
|
|
2892
2892
|
}
|
|
2893
|
-
const aa = 1e-4,
|
|
2893
|
+
const aa = 1e-4, Lu = 1 - aa, ku = 1 + aa, la = 0.01, Vu = 0 - la, Ou = 0 + la;
|
|
2894
2894
|
function ut(t) {
|
|
2895
2895
|
return t.max - t.min;
|
|
2896
2896
|
}
|
|
@@ -2898,9 +2898,9 @@ function Nu(t, e, n) {
|
|
|
2898
2898
|
return Math.abs(t - e) <= n;
|
|
2899
2899
|
}
|
|
2900
2900
|
function Ys(t, e, n, i = 0.5) {
|
|
2901
|
-
t.origin = i, t.originPoint = U(e.min, e.max, t.origin), t.scale = ut(n) / ut(e), t.translate = U(n.min, n.max, t.origin) - t.originPoint, (t.scale >=
|
|
2901
|
+
t.origin = i, t.originPoint = U(e.min, e.max, t.origin), t.scale = ut(n) / ut(e), t.translate = U(n.min, n.max, t.origin) - t.originPoint, (t.scale >= Lu && t.scale <= ku || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Vu && t.translate <= Ou || isNaN(t.translate)) && (t.translate = 0);
|
|
2902
2902
|
}
|
|
2903
|
-
function
|
|
2903
|
+
function Le(t, e, n, i) {
|
|
2904
2904
|
Ys(t.x, e.x, n.x, i ? i.originX : void 0), Ys(t.y, e.y, n.y, i ? i.originY : void 0);
|
|
2905
2905
|
}
|
|
2906
2906
|
function Xs(t, e, n) {
|
|
@@ -2969,8 +2969,8 @@ function Hu(t, e, n) {
|
|
|
2969
2969
|
return (a !== 1 || l !== 1) && (i += `scale(${a}, ${l})`), i || "none";
|
|
2970
2970
|
}
|
|
2971
2971
|
const fa = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Gu = fa.length, oo = (t) => typeof t == "string" ? parseFloat(t) : t, ro = (t) => typeof t == "number" || b.test(t);
|
|
2972
|
-
function
|
|
2973
|
-
s ? (t.opacity = U(0, n.opacity ?? 1,
|
|
2972
|
+
function Ku(t, e, n, i, s, r) {
|
|
2973
|
+
s ? (t.opacity = U(0, n.opacity ?? 1, zu(i)), t.opacityExit = U(e.opacity ?? 1, 0, $u(i))) : r && (t.opacity = U(e.opacity ?? 1, n.opacity ?? 1, i));
|
|
2974
2974
|
for (let o = 0; o < Gu; o++) {
|
|
2975
2975
|
const a = `border${fa[o]}Radius`;
|
|
2976
2976
|
let l = ao(e, a), u = ao(n, a);
|
|
@@ -2983,7 +2983,7 @@ function zu(t, e, n, i, s, r) {
|
|
|
2983
2983
|
function ao(t, e) {
|
|
2984
2984
|
return t[e] !== void 0 ? t[e] : t.borderRadius;
|
|
2985
2985
|
}
|
|
2986
|
-
const
|
|
2986
|
+
const zu = /* @__PURE__ */ ha(0, 0.5, ir), $u = /* @__PURE__ */ ha(0.5, 0.95, wt);
|
|
2987
2987
|
function ha(t, e, n) {
|
|
2988
2988
|
return (i) => i < t ? 0 : i > e ? 1 : n(/* @__PURE__ */ Ve(t, e, i));
|
|
2989
2989
|
}
|
|
@@ -3096,7 +3096,7 @@ function da(t) {
|
|
|
3096
3096
|
const { visualElement: e } = t.options;
|
|
3097
3097
|
if (!e)
|
|
3098
3098
|
return;
|
|
3099
|
-
const n =
|
|
3099
|
+
const n = Lr(e);
|
|
3100
3100
|
if (window.MotionHasOptimisedAnimation(n, "transform")) {
|
|
3101
3101
|
const { layout: s, layoutId: r } = t.options;
|
|
3102
3102
|
window.MotionCancelOptimisedAnimation(n, "transform", k, !(s || r));
|
|
@@ -3389,7 +3389,7 @@ function ma({ attachResizeListener: t, defaultParent: e, measureScroll: n, check
|
|
|
3389
3389
|
this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
|
|
3390
3390
|
return;
|
|
3391
3391
|
}
|
|
3392
|
-
!this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (
|
|
3392
|
+
!this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : ($s(this.prevProjectionDelta.x, this.projectionDelta.x), $s(this.prevProjectionDelta.y, this.projectionDelta.y)), Le(this.projectionDelta, this.layoutCorrected, p, this.latestValues), (this.treeScale.x !== f || this.treeScale.y !== d || !so(this.projectionDelta.x, this.prevProjectionDelta.x) || !so(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", p));
|
|
3393
3393
|
}
|
|
3394
3394
|
hide() {
|
|
3395
3395
|
this.isVisible = !1;
|
|
@@ -3416,7 +3416,7 @@ function ma({ attachResizeListener: t, defaultParent: e, measureScroll: n, check
|
|
|
3416
3416
|
let w;
|
|
3417
3417
|
this.mixTargetDelta = (E) => {
|
|
3418
3418
|
const P = E / 1e3;
|
|
3419
|
-
fo(f.x, o.x, P), fo(f.y, o.y, P), this.setTargetDelta(f), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (mn(d, this.layout.layoutBox, this.relativeParent.layout.layoutBox), hf(this.relativeTarget, this.relativeTargetOrigin, d, P), w && Wu(this.relativeTarget, w) && (this.isProjectionDirty = !1), w || (w = Z()), Et(w, this.relativeTarget)), y && (this.animationValues = c,
|
|
3419
|
+
fo(f.x, o.x, P), fo(f.y, o.y, P), this.setTargetDelta(f), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (mn(d, this.layout.layoutBox, this.relativeParent.layout.layoutBox), hf(this.relativeTarget, this.relativeTargetOrigin, d, P), w && Wu(this.relativeTarget, w) && (this.isProjectionDirty = !1), w || (w = Z()), Et(w, this.relativeTarget)), y && (this.animationValues = c, Ku(c, u, this.latestValues, P, v, T)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = P;
|
|
3420
3420
|
}, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
|
|
3421
3421
|
}
|
|
3422
3422
|
startAnimation(o) {
|
|
@@ -3456,7 +3456,7 @@ function ma({ attachResizeListener: t, defaultParent: e, measureScroll: n, check
|
|
|
3456
3456
|
const d = ut(this.layout.layoutBox.y);
|
|
3457
3457
|
l.y.min = o.target.y.min, l.y.max = l.y.min + d;
|
|
3458
3458
|
}
|
|
3459
|
-
Et(a, l), he(a, c),
|
|
3459
|
+
Et(a, l), he(a, c), Le(this.projectionDeltaWithTransform, this.layoutCorrected, a, c);
|
|
3460
3460
|
}
|
|
3461
3461
|
}
|
|
3462
3462
|
registerSharedNode(o, a) {
|
|
@@ -3576,9 +3576,9 @@ function nf(t) {
|
|
|
3576
3576
|
d.max = d.min + p, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[f].max = t.relativeTarget[f].min + p);
|
|
3577
3577
|
});
|
|
3578
3578
|
const a = ue();
|
|
3579
|
-
|
|
3579
|
+
Le(a, i, e.layoutBox);
|
|
3580
3580
|
const l = ue();
|
|
3581
|
-
o ?
|
|
3581
|
+
o ? Le(l, t.applyTransform(s, !0), e.measuredBox) : Le(l, i, e.layoutBox);
|
|
3582
3582
|
const u = !ca(a);
|
|
3583
3583
|
let c = !1;
|
|
3584
3584
|
if (!t.resumeFrom) {
|
|
@@ -3726,7 +3726,7 @@ function ya(t, e, n) {
|
|
|
3726
3726
|
function wf({ transformTemplate: t }, e) {
|
|
3727
3727
|
return gn(() => {
|
|
3728
3728
|
const n = Yi();
|
|
3729
|
-
return
|
|
3729
|
+
return zi(n, e, t), Object.assign({}, n.vars, n.style);
|
|
3730
3730
|
}, [e]);
|
|
3731
3731
|
}
|
|
3732
3732
|
function Sf(t, e) {
|
|
@@ -3866,16 +3866,16 @@ function Cf(t) {
|
|
|
3866
3866
|
}
|
|
3867
3867
|
function Rf({ scrapeMotionValuesFromProps: t, createRenderState: e }, n, i, s) {
|
|
3868
3868
|
return {
|
|
3869
|
-
latestValues:
|
|
3869
|
+
latestValues: _f(n, i, s, t),
|
|
3870
3870
|
renderState: e()
|
|
3871
3871
|
};
|
|
3872
3872
|
}
|
|
3873
|
-
function
|
|
3873
|
+
function _f(t, e, n, i) {
|
|
3874
3874
|
const s = {}, r = i(t, {});
|
|
3875
3875
|
for (const d in r)
|
|
3876
3876
|
s[d] = rn(r[d]);
|
|
3877
3877
|
let { initial: o, animate: a } = t;
|
|
3878
|
-
const l = vn(t), u =
|
|
3878
|
+
const l = vn(t), u = zr(t);
|
|
3879
3879
|
e && u && !l && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate));
|
|
3880
3880
|
let c = n ? n.initial === !1 : !1;
|
|
3881
3881
|
c = c || o === !1;
|
|
@@ -3905,9 +3905,9 @@ const wa = (t) => (e, n) => {
|
|
|
3905
3905
|
const i = mt(yn), s = mt(qi), r = () => Rf(t, e, i, s);
|
|
3906
3906
|
return n ? r() : Cf(r);
|
|
3907
3907
|
}, If = /* @__PURE__ */ wa({
|
|
3908
|
-
scrapeMotionValuesFromProps:
|
|
3908
|
+
scrapeMotionValuesFromProps: $i,
|
|
3909
3909
|
createRenderState: Yi
|
|
3910
|
-
}),
|
|
3910
|
+
}), Lf = /* @__PURE__ */ wa({
|
|
3911
3911
|
scrapeMotionValuesFromProps: sa,
|
|
3912
3912
|
createRenderState: Ta
|
|
3913
3913
|
}), Sa = typeof window < "u", To = {
|
|
@@ -3939,7 +3939,7 @@ function kf() {
|
|
|
3939
3939
|
t[e] = {
|
|
3940
3940
|
isEnabled: (n) => To[e].some((i) => !!n[i])
|
|
3941
3941
|
};
|
|
3942
|
-
|
|
3942
|
+
$r(t), vo = !0;
|
|
3943
3943
|
}
|
|
3944
3944
|
function ba() {
|
|
3945
3945
|
return kf(), cu();
|
|
@@ -3951,7 +3951,7 @@ function Vf(t) {
|
|
|
3951
3951
|
...e[n],
|
|
3952
3952
|
...t[n]
|
|
3953
3953
|
};
|
|
3954
|
-
|
|
3954
|
+
$r(e);
|
|
3955
3955
|
}
|
|
3956
3956
|
const Of = Symbol.for("motionComponentSymbol");
|
|
3957
3957
|
function Nf(t, e, n) {
|
|
@@ -3960,7 +3960,7 @@ function Nf(t, e, n) {
|
|
|
3960
3960
|
i.current = n;
|
|
3961
3961
|
});
|
|
3962
3962
|
const s = Tt(null);
|
|
3963
|
-
return
|
|
3963
|
+
return Ko((r) => {
|
|
3964
3964
|
var a;
|
|
3965
3965
|
r && ((a = t.onMount) == null || a.call(t, r)), e && (r ? e.mount(r) : e.unmount());
|
|
3966
3966
|
const o = i.current;
|
|
@@ -3973,7 +3973,7 @@ function Nf(t, e, n) {
|
|
|
3973
3973
|
}, [e]);
|
|
3974
3974
|
}
|
|
3975
3975
|
const Aa = pe({});
|
|
3976
|
-
function
|
|
3976
|
+
function _e(t) {
|
|
3977
3977
|
return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
|
|
3978
3978
|
}
|
|
3979
3979
|
const Ff = Sa ? Ha : Mt;
|
|
@@ -4010,7 +4010,7 @@ function Uf(t, e, n, i) {
|
|
|
4010
4010
|
t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : xa(t.parent)), t.projection.setOptions({
|
|
4011
4011
|
layoutId: s,
|
|
4012
4012
|
layout: r,
|
|
4013
|
-
alwaysMeasureLayout: !!o || a &&
|
|
4013
|
+
alwaysMeasureLayout: !!o || a && _e(a),
|
|
4014
4014
|
visualElement: t,
|
|
4015
4015
|
/**
|
|
4016
4016
|
* TODO: Update options in an effect. This could be tricky as it'll be too late
|
|
@@ -4032,7 +4032,7 @@ function xa(t) {
|
|
|
4032
4032
|
}
|
|
4033
4033
|
function jf(t, { forwardMotionProps: e = !1, type: n } = {}, i, s) {
|
|
4034
4034
|
i && Vf(i);
|
|
4035
|
-
const r = n ? n === "svg" : Xi(t), o = r ?
|
|
4035
|
+
const r = n ? n === "svg" : Xi(t), o = r ? Lf : If;
|
|
4036
4036
|
function a(u, c) {
|
|
4037
4037
|
let f;
|
|
4038
4038
|
const d = {
|
|
@@ -4072,17 +4072,17 @@ function Gf(t) {
|
|
|
4072
4072
|
ProjectionNode: s.ProjectionNode
|
|
4073
4073
|
};
|
|
4074
4074
|
}
|
|
4075
|
-
const
|
|
4075
|
+
const Kf = (t, e) => e.isSVG ?? Xi(t) ? new Pu(e) : new wu(e, {
|
|
4076
4076
|
allowProjection: t !== Ho
|
|
4077
4077
|
});
|
|
4078
|
-
class
|
|
4078
|
+
class zf extends qt {
|
|
4079
4079
|
/**
|
|
4080
4080
|
* We dynamically generate the AnimationState manager as it contains a reference
|
|
4081
4081
|
* to the underlying animation library. We only want to load that if we load this,
|
|
4082
4082
|
* so people can optionally code split it out using the `m` component.
|
|
4083
4083
|
*/
|
|
4084
4084
|
constructor(e) {
|
|
4085
|
-
super(e), e.animationState || (e.animationState =
|
|
4085
|
+
super(e), e.animationState || (e.animationState = _u(e));
|
|
4086
4086
|
}
|
|
4087
4087
|
updateAnimationControlsSubscription() {
|
|
4088
4088
|
const { animate: e } = this.node.getProps();
|
|
@@ -4103,10 +4103,10 @@ class $f extends qt {
|
|
|
4103
4103
|
this.node.animationState.reset(), (e = this.unmountControls) == null || e.call(this);
|
|
4104
4104
|
}
|
|
4105
4105
|
}
|
|
4106
|
-
let
|
|
4106
|
+
let $f = 0;
|
|
4107
4107
|
class Yf extends qt {
|
|
4108
4108
|
constructor() {
|
|
4109
|
-
super(...arguments), this.id =
|
|
4109
|
+
super(...arguments), this.id = $f++;
|
|
4110
4110
|
}
|
|
4111
4111
|
update() {
|
|
4112
4112
|
if (!this.node.presenceContext)
|
|
@@ -4128,7 +4128,7 @@ class Yf extends qt {
|
|
|
4128
4128
|
}
|
|
4129
4129
|
const Xf = {
|
|
4130
4130
|
animation: {
|
|
4131
|
-
Feature:
|
|
4131
|
+
Feature: zf
|
|
4132
4132
|
},
|
|
4133
4133
|
exit: {
|
|
4134
4134
|
Feature: Yf
|
|
@@ -4415,13 +4415,13 @@ class ah {
|
|
|
4415
4415
|
resolveConstraints() {
|
|
4416
4416
|
var r;
|
|
4417
4417
|
const { dragConstraints: e, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (r = this.visualElement.projection) == null ? void 0 : r.layout, s = this.constraints;
|
|
4418
|
-
e &&
|
|
4418
|
+
e && _e(e) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : e && i ? this.constraints = eh(i.layoutBox, e) : this.constraints = !1, this.elastic = oh(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && yt((o) => {
|
|
4419
4419
|
this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = sh(i.layoutBox[o], this.constraints[o]));
|
|
4420
4420
|
});
|
|
4421
4421
|
}
|
|
4422
4422
|
resolveRefConstraints() {
|
|
4423
4423
|
const { dragConstraints: e, onMeasureDragConstraints: n } = this.getProps();
|
|
4424
|
-
if (!e || !
|
|
4424
|
+
if (!e || !_e(e))
|
|
4425
4425
|
return !1;
|
|
4426
4426
|
const i = e.current;
|
|
4427
4427
|
Wt(i !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
|
|
@@ -4505,7 +4505,7 @@ class ah {
|
|
|
4505
4505
|
if (!this.visualElement.current)
|
|
4506
4506
|
return;
|
|
4507
4507
|
const { drag: e, dragConstraints: n } = this.getProps(), { projection: i } = this.visualElement;
|
|
4508
|
-
if (!
|
|
4508
|
+
if (!_e(n) || !i || !this.constraints)
|
|
4509
4509
|
return;
|
|
4510
4510
|
this.stopAnimation();
|
|
4511
4511
|
const s = { x: 0, y: 0 };
|
|
@@ -4533,7 +4533,7 @@ class ah {
|
|
|
4533
4533
|
u && c && !Hr(l.target) && this.start(l);
|
|
4534
4534
|
}), i = () => {
|
|
4535
4535
|
const { dragConstraints: l } = this.getProps();
|
|
4536
|
-
|
|
4536
|
+
_e(l) && l.current && (this.constraints = this.resolveRefConstraints());
|
|
4537
4537
|
}, { projection: s } = this.visualElement, r = s.addEventListener("measure", i);
|
|
4538
4538
|
s && !s.layout && (s.root && s.root.updateScroll(), s.updateLayout()), k.read(i);
|
|
4539
4539
|
const o = Be(window, "resize", () => this.scalePositionWithinConstraints()), a = s.addEventListener("didUpdate", ({ delta: l, hasLayoutChanged: u }) => {
|
|
@@ -4620,16 +4620,16 @@ function fh(t = !0) {
|
|
|
4620
4620
|
const e = mt(qi);
|
|
4621
4621
|
if (e === null)
|
|
4622
4622
|
return [!0, null];
|
|
4623
|
-
const { isPresent: n, onExitComplete: i, register: s } = e, r =
|
|
4623
|
+
const { isPresent: n, onExitComplete: i, register: s } = e, r = Ka();
|
|
4624
4624
|
Mt(() => {
|
|
4625
4625
|
if (t)
|
|
4626
4626
|
return s(r);
|
|
4627
4627
|
}, [t]);
|
|
4628
|
-
const o =
|
|
4628
|
+
const o = Ko(() => t && i && i(r), [r, i, t]);
|
|
4629
4629
|
return !n && i ? [!1, o] : [!0];
|
|
4630
4630
|
}
|
|
4631
4631
|
let jn = !1;
|
|
4632
|
-
class hh extends
|
|
4632
|
+
class hh extends za {
|
|
4633
4633
|
/**
|
|
4634
4634
|
* This only mounts projection nodes for components that
|
|
4635
4635
|
* need measuring, we might want to do it for all components
|
|
@@ -4817,7 +4817,7 @@ const xh = {
|
|
|
4817
4817
|
...Eh
|
|
4818
4818
|
};
|
|
4819
4819
|
function Dh(t, e) {
|
|
4820
|
-
return jf(t, e, Ph,
|
|
4820
|
+
return jf(t, e, Ph, Kf);
|
|
4821
4821
|
}
|
|
4822
4822
|
const Hn = /* @__PURE__ */ Dh("div"), Mh = "https://widget-api.convokit.dev/api/widget/chat", Ro = Mh;
|
|
4823
4823
|
function Ca(t) {
|
|
@@ -4913,7 +4913,7 @@ async function Rh(t, e, n) {
|
|
|
4913
4913
|
reply_length: ((u = l.reply) == null ? void 0 : u.length) || 0
|
|
4914
4914
|
}), l.jwt && typeof window < "u" && (localStorage.setItem("widget_jwt", l.jwt), console.log("[ConvoKit] JWT refreshed")), l;
|
|
4915
4915
|
}
|
|
4916
|
-
function
|
|
4916
|
+
function _h(t, e) {
|
|
4917
4917
|
const n = (t || we()).replace(/\/chat\/?$/, "").replace(/\/api\/widget\/?$/, ""), i = new URL(n);
|
|
4918
4918
|
return i.protocol = i.protocol === "https:" ? "wss:" : "ws:", i.pathname = i.pathname.replace(/\/$/, "") + "/api/widget/ws", i.searchParams.set("token", e), i.toString();
|
|
4919
4919
|
}
|
|
@@ -4934,7 +4934,7 @@ async function Ih(t, e, n) {
|
|
|
4934
4934
|
const a = await o.json();
|
|
4935
4935
|
return { humanConnected: !!a.humanConnected, useWebSocket: a.useWebSocket };
|
|
4936
4936
|
}
|
|
4937
|
-
async function
|
|
4937
|
+
async function _o(t, e, n) {
|
|
4938
4938
|
const r = `${(n || we()).replace(/\/chat\/?$/, "").replace(/\/api\/widget\/?$/, "")}/api/widget/conversation/${t}/messages`, o = await fetch(r, {
|
|
4939
4939
|
method: "GET",
|
|
4940
4940
|
headers: { Authorization: `Bearer ${e}` }
|
|
@@ -4965,7 +4965,7 @@ function Io() {
|
|
|
4965
4965
|
return console.error("[ConvoKit] Failed to decode JWT:", e), !0;
|
|
4966
4966
|
}
|
|
4967
4967
|
}
|
|
4968
|
-
function
|
|
4968
|
+
function Lh() {
|
|
4969
4969
|
typeof window < "u" && (localStorage.removeItem("widget_jwt"), localStorage.removeItem("conversation_id"), console.log("[ConvoKit] Session cleared"));
|
|
4970
4970
|
}
|
|
4971
4971
|
async function kh(t, e) {
|
|
@@ -4995,7 +4995,7 @@ async function kh(t, e) {
|
|
|
4995
4995
|
/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
|
|
4996
4996
|
const {
|
|
4997
4997
|
entries: Ra,
|
|
4998
|
-
setPrototypeOf:
|
|
4998
|
+
setPrototypeOf: Lo,
|
|
4999
4999
|
isFrozen: Vh,
|
|
5000
5000
|
getPrototypeOf: Oh,
|
|
5001
5001
|
getOwnPropertyDescriptor: Nh
|
|
@@ -5024,7 +5024,7 @@ Si || (Si = function(e) {
|
|
|
5024
5024
|
i[s - 1] = arguments[s];
|
|
5025
5025
|
return new e(...i);
|
|
5026
5026
|
});
|
|
5027
|
-
const tn = ht(Array.prototype.forEach), Fh = ht(Array.prototype.lastIndexOf), ko = ht(Array.prototype.pop), Ee = ht(Array.prototype.push), Bh = ht(Array.prototype.splice), ln = ht(String.prototype.toLowerCase), Gn = ht(String.prototype.toString),
|
|
5027
|
+
const tn = ht(Array.prototype.forEach), Fh = ht(Array.prototype.lastIndexOf), ko = ht(Array.prototype.pop), Ee = ht(Array.prototype.push), Bh = ht(Array.prototype.splice), ln = ht(String.prototype.toLowerCase), Gn = ht(String.prototype.toString), Kn = ht(String.prototype.match), Pe = ht(String.prototype.replace), Uh = ht(String.prototype.indexOf), jh = ht(String.prototype.trim), Dt = ht(Object.prototype.hasOwnProperty), lt = ht(RegExp.prototype.test), De = Wh(TypeError);
|
|
5028
5028
|
function ht(t) {
|
|
5029
5029
|
return function(e) {
|
|
5030
5030
|
e instanceof RegExp && (e.lastIndex = 0);
|
|
@@ -5042,7 +5042,7 @@ function Wh(t) {
|
|
|
5042
5042
|
}
|
|
5043
5043
|
function C(t, e) {
|
|
5044
5044
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ln;
|
|
5045
|
-
|
|
5045
|
+
Lo && Lo(t, null);
|
|
5046
5046
|
let i = e.length;
|
|
5047
5047
|
for (; i--; ) {
|
|
5048
5048
|
let s = e[i];
|
|
@@ -5059,10 +5059,10 @@ function Hh(t) {
|
|
|
5059
5059
|
Dt(t, e) || (t[e] = null);
|
|
5060
5060
|
return t;
|
|
5061
5061
|
}
|
|
5062
|
-
function
|
|
5062
|
+
function Lt(t) {
|
|
5063
5063
|
const e = vi(null);
|
|
5064
5064
|
for (const [n, i] of Ra(t))
|
|
5065
|
-
Dt(t, n) && (Array.isArray(i) ? e[n] = Hh(i) : i && typeof i == "object" && i.constructor === Object ? e[n] =
|
|
5065
|
+
Dt(t, n) && (Array.isArray(i) ? e[n] = Hh(i) : i && typeof i == "object" && i.constructor === Object ? e[n] = Lt(i) : e[n] = i);
|
|
5066
5066
|
return e;
|
|
5067
5067
|
}
|
|
5068
5068
|
function Me(t, e) {
|
|
@@ -5081,7 +5081,7 @@ function Me(t, e) {
|
|
|
5081
5081
|
}
|
|
5082
5082
|
return n;
|
|
5083
5083
|
}
|
|
5084
|
-
const Vo = ft(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]),
|
|
5084
|
+
const Vo = ft(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), zn = ft(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), $n = ft(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Gh = ft(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Yn = ft(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Kh = ft(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Oo = ft(["#text"]), No = ft(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Xn = ft(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), Fo = ft(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), en = ft(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), zh = St(/\{\{[\w\W]*|[\w\W]*\}\}/gm), $h = St(/<%[\w\W]*|[\w\W]*%>/gm), Yh = St(/\$\{[\w\W]*/gm), Xh = St(/^data-[\-\w.\u00B7-\uFFFF]+$/), qh = St(/^aria-[\-\w]+$/), _a = St(
|
|
5085
5085
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
5086
5086
|
// eslint-disable-line no-useless-escape
|
|
5087
5087
|
), Zh = St(/^(?:\w+script|data):/i), Jh = St(
|
|
@@ -5095,10 +5095,10 @@ var Bo = /* @__PURE__ */ Object.freeze({
|
|
|
5095
5095
|
CUSTOM_ELEMENT: Qh,
|
|
5096
5096
|
DATA_ATTR: Xh,
|
|
5097
5097
|
DOCTYPE_NAME: Ia,
|
|
5098
|
-
ERB_EXPR:
|
|
5099
|
-
IS_ALLOWED_URI:
|
|
5098
|
+
ERB_EXPR: $h,
|
|
5099
|
+
IS_ALLOWED_URI: _a,
|
|
5100
5100
|
IS_SCRIPT_OR_DATA: Zh,
|
|
5101
|
-
MUSTACHE_EXPR:
|
|
5101
|
+
MUSTACHE_EXPR: zh,
|
|
5102
5102
|
TMPLIT_EXPR: Yh
|
|
5103
5103
|
});
|
|
5104
5104
|
const Ce = {
|
|
@@ -5142,9 +5142,9 @@ const Ce = {
|
|
|
5142
5142
|
uponSanitizeShadowNode: []
|
|
5143
5143
|
};
|
|
5144
5144
|
};
|
|
5145
|
-
function
|
|
5145
|
+
function La() {
|
|
5146
5146
|
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : td();
|
|
5147
|
-
const e = (D) =>
|
|
5147
|
+
const e = (D) => La(D);
|
|
5148
5148
|
if (e.version = "3.3.1", e.removed = [], !t || !t.document || t.document.nodeType !== Ce.document || !t.Element)
|
|
5149
5149
|
return e.isSupported = !1, e;
|
|
5150
5150
|
let {
|
|
@@ -5167,19 +5167,19 @@ function _a() {
|
|
|
5167
5167
|
}
|
|
5168
5168
|
let E, P = "";
|
|
5169
5169
|
const {
|
|
5170
|
-
implementation:
|
|
5170
|
+
implementation: _,
|
|
5171
5171
|
createNodeIterator: O,
|
|
5172
5172
|
createDocumentFragment: M,
|
|
5173
5173
|
getElementsByTagName: N
|
|
5174
5174
|
} = n, {
|
|
5175
5175
|
importNode: F
|
|
5176
5176
|
} = i;
|
|
5177
|
-
let
|
|
5178
|
-
e.isSupported = typeof Ra == "function" && typeof w == "function" &&
|
|
5177
|
+
let L = Uo();
|
|
5178
|
+
e.isSupported = typeof Ra == "function" && typeof w == "function" && _ && _.createHTMLDocument !== void 0;
|
|
5179
5179
|
const {
|
|
5180
5180
|
MUSTACHE_EXPR: pt,
|
|
5181
5181
|
ERB_EXPR: Gt,
|
|
5182
|
-
TMPLIT_EXPR:
|
|
5182
|
+
TMPLIT_EXPR: Kt,
|
|
5183
5183
|
DATA_ATTR: Nt,
|
|
5184
5184
|
ARIA_ATTR: X,
|
|
5185
5185
|
IS_SCRIPT_OR_DATA: G,
|
|
@@ -5189,9 +5189,9 @@ function _a() {
|
|
|
5189
5189
|
let {
|
|
5190
5190
|
IS_ALLOWED_URI: bt
|
|
5191
5191
|
} = Bo, j = null;
|
|
5192
|
-
const Ge = C({}, [...Vo, ...$n, ...
|
|
5192
|
+
const Ge = C({}, [...Vo, ...zn, ...$n, ...Yn, ...Oo]);
|
|
5193
5193
|
let A = null;
|
|
5194
|
-
const
|
|
5194
|
+
const K = C({}, [...No, ...Xn, ...Fo, ...en]);
|
|
5195
5195
|
let I = Object.seal(vi(null, {
|
|
5196
5196
|
tagNameCheck: {
|
|
5197
5197
|
writable: !0,
|
|
@@ -5226,16 +5226,16 @@ function _a() {
|
|
|
5226
5226
|
value: null
|
|
5227
5227
|
}
|
|
5228
5228
|
}));
|
|
5229
|
-
let gt = !0, st = !0, H = !1, Ct = !0, Ft = !1,
|
|
5229
|
+
let gt = !0, st = !0, H = !1, Ct = !0, Ft = !1, z = !0, Rt = !1, At = !1, Se = !1, ie = !1, Ke = !1, ze = !1, Zi = !0, Ji = !1;
|
|
5230
5230
|
const ka = "user-content-";
|
|
5231
|
-
let wn = !0, be = !1, se = {},
|
|
5231
|
+
let wn = !0, be = !1, se = {}, _t = null;
|
|
5232
5232
|
const Sn = C({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
5233
5233
|
let Qi = null;
|
|
5234
5234
|
const ts = C({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
5235
5235
|
let bn = null;
|
|
5236
|
-
const es = C({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]),
|
|
5236
|
+
const es = C({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), $e = "http://www.w3.org/1998/Math/MathML", Ye = "http://www.w3.org/2000/svg", Bt = "http://www.w3.org/1999/xhtml";
|
|
5237
5237
|
let oe = Bt, An = !1, xn = null;
|
|
5238
|
-
const Va = C({}, [
|
|
5238
|
+
const Va = C({}, [$e, Ye, Bt], Gn);
|
|
5239
5239
|
let Xe = C({}, ["mi", "mo", "mn", "ms", "mtext"]), qe = C({}, ["annotation-xml"]);
|
|
5240
5240
|
const Oa = C({}, ["title", "style", "font", "a", "script"]);
|
|
5241
5241
|
let Ae = null;
|
|
@@ -5246,8 +5246,8 @@ function _a() {
|
|
|
5246
5246
|
}, En = function() {
|
|
5247
5247
|
let h = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
5248
5248
|
if (!(re && re === h)) {
|
|
5249
|
-
if ((!h || typeof h != "object") && (h = {}), h =
|
|
5250
|
-
Na.indexOf(h.PARSER_MEDIA_TYPE) === -1 ? Fa : h.PARSER_MEDIA_TYPE, q = Ae === "application/xhtml+xml" ? Gn : ln, j = Dt(h, "ALLOWED_TAGS") ? C({}, h.ALLOWED_TAGS, q) : Ge, A = Dt(h, "ALLOWED_ATTR") ? C({}, h.ALLOWED_ATTR, q) :
|
|
5249
|
+
if ((!h || typeof h != "object") && (h = {}), h = Lt(h), Ae = // eslint-disable-next-line unicorn/prefer-includes
|
|
5250
|
+
Na.indexOf(h.PARSER_MEDIA_TYPE) === -1 ? Fa : h.PARSER_MEDIA_TYPE, q = Ae === "application/xhtml+xml" ? Gn : ln, j = Dt(h, "ALLOWED_TAGS") ? C({}, h.ALLOWED_TAGS, q) : Ge, A = Dt(h, "ALLOWED_ATTR") ? C({}, h.ALLOWED_ATTR, q) : K, xn = Dt(h, "ALLOWED_NAMESPACES") ? C({}, h.ALLOWED_NAMESPACES, Gn) : Va, bn = Dt(h, "ADD_URI_SAFE_ATTR") ? C(Lt(es), h.ADD_URI_SAFE_ATTR, q) : es, Qi = Dt(h, "ADD_DATA_URI_TAGS") ? C(Lt(ts), h.ADD_DATA_URI_TAGS, q) : ts, _t = Dt(h, "FORBID_CONTENTS") ? C({}, h.FORBID_CONTENTS, q) : Sn, Q = Dt(h, "FORBID_TAGS") ? C({}, h.FORBID_TAGS, q) : Lt({}), W = Dt(h, "FORBID_ATTR") ? C({}, h.FORBID_ATTR, q) : Lt({}), se = Dt(h, "USE_PROFILES") ? h.USE_PROFILES : !1, gt = h.ALLOW_ARIA_ATTR !== !1, st = h.ALLOW_DATA_ATTR !== !1, H = h.ALLOW_UNKNOWN_PROTOCOLS || !1, Ct = h.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ft = h.SAFE_FOR_TEMPLATES || !1, z = h.SAFE_FOR_XML !== !1, Rt = h.WHOLE_DOCUMENT || !1, ie = h.RETURN_DOM || !1, Ke = h.RETURN_DOM_FRAGMENT || !1, ze = h.RETURN_TRUSTED_TYPE || !1, Se = h.FORCE_BODY || !1, Zi = h.SANITIZE_DOM !== !1, Ji = h.SANITIZE_NAMED_PROPS || !1, wn = h.KEEP_CONTENT !== !1, be = h.IN_PLACE || !1, bt = h.ALLOWED_URI_REGEXP || _a, oe = h.NAMESPACE || Bt, Xe = h.MATHML_TEXT_INTEGRATION_POINTS || Xe, qe = h.HTML_INTEGRATION_POINTS || qe, I = h.CUSTOM_ELEMENT_HANDLING || {}, h.CUSTOM_ELEMENT_HANDLING && ns(h.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (I.tagNameCheck = h.CUSTOM_ELEMENT_HANDLING.tagNameCheck), h.CUSTOM_ELEMENT_HANDLING && ns(h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (I.attributeNameCheck = h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), h.CUSTOM_ELEMENT_HANDLING && typeof h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (I.allowCustomizedBuiltInElements = h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Ft && (st = !1), Ke && (ie = !0), se && (j = C({}, Oo), A = [], se.html === !0 && (C(j, Vo), C(A, No)), se.svg === !0 && (C(j, zn), C(A, Xn), C(A, en)), se.svgFilters === !0 && (C(j, $n), C(A, Xn), C(A, en)), se.mathMl === !0 && (C(j, Yn), C(A, Fo), C(A, en))), h.ADD_TAGS && (typeof h.ADD_TAGS == "function" ? it.tagCheck = h.ADD_TAGS : (j === Ge && (j = Lt(j)), C(j, h.ADD_TAGS, q))), h.ADD_ATTR && (typeof h.ADD_ATTR == "function" ? it.attributeCheck = h.ADD_ATTR : (A === K && (A = Lt(A)), C(A, h.ADD_ATTR, q))), h.ADD_URI_SAFE_ATTR && C(bn, h.ADD_URI_SAFE_ATTR, q), h.FORBID_CONTENTS && (_t === Sn && (_t = Lt(_t)), C(_t, h.FORBID_CONTENTS, q)), h.ADD_FORBID_CONTENTS && (_t === Sn && (_t = Lt(_t)), C(_t, h.ADD_FORBID_CONTENTS, q)), wn && (j["#text"] = !0), Rt && C(j, ["html", "head", "body"]), j.table && (C(j, ["tbody"]), delete Q.tbody), h.TRUSTED_TYPES_POLICY) {
|
|
5251
5251
|
if (typeof h.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
5252
5252
|
throw De('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
5253
5253
|
if (typeof h.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
@@ -5257,14 +5257,14 @@ function _a() {
|
|
|
5257
5257
|
E === void 0 && (E = ed(p, s)), E !== null && typeof P == "string" && (P = E.createHTML(""));
|
|
5258
5258
|
ft && ft(h), re = h;
|
|
5259
5259
|
}
|
|
5260
|
-
}, is = C({}, [...$n, ...
|
|
5260
|
+
}, is = C({}, [...zn, ...$n, ...Gh]), ss = C({}, [...Yn, ...Kh]), Ua = function(h) {
|
|
5261
5261
|
let g = w(h);
|
|
5262
5262
|
(!g || !g.tagName) && (g = {
|
|
5263
5263
|
namespaceURI: oe,
|
|
5264
5264
|
tagName: "template"
|
|
5265
5265
|
});
|
|
5266
5266
|
const x = ln(h.tagName), V = ln(g.tagName);
|
|
5267
|
-
return xn[h.namespaceURI] ? h.namespaceURI === Ye ? g.namespaceURI === Bt ? x === "svg" : g.namespaceURI ===
|
|
5267
|
+
return xn[h.namespaceURI] ? h.namespaceURI === Ye ? g.namespaceURI === Bt ? x === "svg" : g.namespaceURI === $e ? x === "svg" && (V === "annotation-xml" || Xe[V]) : !!is[x] : h.namespaceURI === $e ? g.namespaceURI === Bt ? x === "math" : g.namespaceURI === Ye ? x === "math" && qe[V] : !!ss[x] : h.namespaceURI === Bt ? g.namespaceURI === Ye && !qe[V] || g.namespaceURI === $e && !Xe[V] ? !1 : !ss[x] && (Oa[x] || !is[x]) : !!(Ae === "application/xhtml+xml" && xn[h.namespaceURI]) : !1;
|
|
5268
5268
|
}, It = function(h) {
|
|
5269
5269
|
Ee(e.removed, {
|
|
5270
5270
|
element: h
|
|
@@ -5287,7 +5287,7 @@ function _a() {
|
|
|
5287
5287
|
});
|
|
5288
5288
|
}
|
|
5289
5289
|
if (g.removeAttribute(h), h === "is")
|
|
5290
|
-
if (ie ||
|
|
5290
|
+
if (ie || Ke)
|
|
5291
5291
|
try {
|
|
5292
5292
|
It(g);
|
|
5293
5293
|
} catch {
|
|
@@ -5302,8 +5302,8 @@ function _a() {
|
|
|
5302
5302
|
if (Se)
|
|
5303
5303
|
h = "<remove></remove>" + h;
|
|
5304
5304
|
else {
|
|
5305
|
-
const
|
|
5306
|
-
x =
|
|
5305
|
+
const $ = Kn(h, /^[\r\n\t ]+/);
|
|
5306
|
+
x = $ && $[0];
|
|
5307
5307
|
}
|
|
5308
5308
|
Ae === "application/xhtml+xml" && oe === Bt && (h = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + h + "</body></html>");
|
|
5309
5309
|
const V = E ? E.createHTML(h) : h;
|
|
@@ -5313,7 +5313,7 @@ function _a() {
|
|
|
5313
5313
|
} catch {
|
|
5314
5314
|
}
|
|
5315
5315
|
if (!g || !g.documentElement) {
|
|
5316
|
-
g =
|
|
5316
|
+
g = _.createDocument(oe, "template", null);
|
|
5317
5317
|
try {
|
|
5318
5318
|
g.documentElement.innerHTML = An ? P : V;
|
|
5319
5319
|
} catch {
|
|
@@ -5341,22 +5341,22 @@ function _a() {
|
|
|
5341
5341
|
}
|
|
5342
5342
|
const ls = function(h) {
|
|
5343
5343
|
let g = null;
|
|
5344
|
-
if (Ut(
|
|
5344
|
+
if (Ut(L.beforeSanitizeElements, h, null), Pn(h))
|
|
5345
5345
|
return It(h), !0;
|
|
5346
5346
|
const x = q(h.nodeName);
|
|
5347
|
-
if (Ut(
|
|
5347
|
+
if (Ut(L.uponSanitizeElement, h, {
|
|
5348
5348
|
tagName: x,
|
|
5349
5349
|
allowedTags: j
|
|
5350
|
-
}),
|
|
5350
|
+
}), z && h.hasChildNodes() && !as(h.firstElementChild) && lt(/<[/\w!]/g, h.innerHTML) && lt(/<[/\w!]/g, h.textContent) || h.nodeType === Ce.progressingInstruction || z && h.nodeType === Ce.comment && lt(/<[/\w]/g, h.data))
|
|
5351
5351
|
return It(h), !0;
|
|
5352
5352
|
if (!(it.tagCheck instanceof Function && it.tagCheck(x)) && (!j[x] || Q[x])) {
|
|
5353
5353
|
if (!Q[x] && us(x) && (I.tagNameCheck instanceof RegExp && lt(I.tagNameCheck, x) || I.tagNameCheck instanceof Function && I.tagNameCheck(x)))
|
|
5354
5354
|
return !1;
|
|
5355
|
-
if (wn && !
|
|
5355
|
+
if (wn && !_t[x]) {
|
|
5356
5356
|
const V = w(h) || h.parentNode, ot = v(h) || h.childNodes;
|
|
5357
5357
|
if (ot && V) {
|
|
5358
|
-
const
|
|
5359
|
-
for (let dt =
|
|
5358
|
+
const $ = ot.length;
|
|
5359
|
+
for (let dt = $ - 1; dt >= 0; --dt) {
|
|
5360
5360
|
const jt = y(ot[dt], !0);
|
|
5361
5361
|
jt.__removalCount = (h.__removalCount || 0) + 1, V.insertBefore(jt, T(h));
|
|
5362
5362
|
}
|
|
@@ -5364,11 +5364,11 @@ function _a() {
|
|
|
5364
5364
|
}
|
|
5365
5365
|
return It(h), !0;
|
|
5366
5366
|
}
|
|
5367
|
-
return h instanceof l && !Ua(h) || (x === "noscript" || x === "noembed" || x === "noframes") && lt(/<\/no(script|embed|frames)/i, h.innerHTML) ? (It(h), !0) : (Ft && h.nodeType === Ce.text && (g = h.textContent, tn([pt, Gt,
|
|
5367
|
+
return h instanceof l && !Ua(h) || (x === "noscript" || x === "noembed" || x === "noframes") && lt(/<\/no(script|embed|frames)/i, h.innerHTML) ? (It(h), !0) : (Ft && h.nodeType === Ce.text && (g = h.textContent, tn([pt, Gt, Kt], (V) => {
|
|
5368
5368
|
g = Pe(g, V, " ");
|
|
5369
5369
|
}), h.textContent !== g && (Ee(e.removed, {
|
|
5370
5370
|
element: h.cloneNode()
|
|
5371
|
-
}), h.textContent = g)), Ut(
|
|
5371
|
+
}), h.textContent = g)), Ut(L.afterSanitizeElements, h, null), !1);
|
|
5372
5372
|
}, cs = function(h, g, x) {
|
|
5373
5373
|
if (Zi && (g === "id" || g === "name") && (x in n || x in Ba))
|
|
5374
5374
|
return !1;
|
|
@@ -5399,9 +5399,9 @@ function _a() {
|
|
|
5399
5399
|
}
|
|
5400
5400
|
return !0;
|
|
5401
5401
|
}, us = function(h) {
|
|
5402
|
-
return h !== "annotation-xml" &&
|
|
5402
|
+
return h !== "annotation-xml" && Kn(h, nt);
|
|
5403
5403
|
}, fs = function(h) {
|
|
5404
|
-
Ut(
|
|
5404
|
+
Ut(L.beforeSanitizeAttributes, h, null);
|
|
5405
5405
|
const {
|
|
5406
5406
|
attributes: g
|
|
5407
5407
|
} = h;
|
|
@@ -5417,35 +5417,35 @@ function _a() {
|
|
|
5417
5417
|
let V = g.length;
|
|
5418
5418
|
for (; V--; ) {
|
|
5419
5419
|
const ot = g[V], {
|
|
5420
|
-
name:
|
|
5420
|
+
name: $,
|
|
5421
5421
|
namespaceURI: dt,
|
|
5422
5422
|
value: jt
|
|
5423
|
-
} = ot, ae = q(
|
|
5424
|
-
let tt =
|
|
5425
|
-
if (x.attrName = ae, x.attrValue = tt, x.keepAttr = !0, x.forceKeepAttr = void 0, Ut(
|
|
5426
|
-
Zt(
|
|
5423
|
+
} = ot, ae = q($), Dn = jt;
|
|
5424
|
+
let tt = $ === "value" ? Dn : jh(Dn);
|
|
5425
|
+
if (x.attrName = ae, x.attrValue = tt, x.keepAttr = !0, x.forceKeepAttr = void 0, Ut(L.uponSanitizeAttribute, h, x), tt = x.attrValue, Ji && (ae === "id" || ae === "name") && (Zt($, h), tt = ka + tt), z && lt(/((--!?|])>)|<\/(style|title|textarea)/i, tt)) {
|
|
5426
|
+
Zt($, h);
|
|
5427
5427
|
continue;
|
|
5428
5428
|
}
|
|
5429
|
-
if (ae === "attributename" &&
|
|
5430
|
-
Zt(
|
|
5429
|
+
if (ae === "attributename" && Kn(tt, "href")) {
|
|
5430
|
+
Zt($, h);
|
|
5431
5431
|
continue;
|
|
5432
5432
|
}
|
|
5433
5433
|
if (x.forceKeepAttr)
|
|
5434
5434
|
continue;
|
|
5435
5435
|
if (!x.keepAttr) {
|
|
5436
|
-
Zt(
|
|
5436
|
+
Zt($, h);
|
|
5437
5437
|
continue;
|
|
5438
5438
|
}
|
|
5439
5439
|
if (!Ct && lt(/\/>/i, tt)) {
|
|
5440
|
-
Zt(
|
|
5440
|
+
Zt($, h);
|
|
5441
5441
|
continue;
|
|
5442
5442
|
}
|
|
5443
|
-
Ft && tn([pt, Gt,
|
|
5443
|
+
Ft && tn([pt, Gt, Kt], (ds) => {
|
|
5444
5444
|
tt = Pe(tt, ds, " ");
|
|
5445
5445
|
});
|
|
5446
5446
|
const hs = q(h.nodeName);
|
|
5447
5447
|
if (!cs(hs, ae, tt)) {
|
|
5448
|
-
Zt(
|
|
5448
|
+
Zt($, h);
|
|
5449
5449
|
continue;
|
|
5450
5450
|
}
|
|
5451
5451
|
if (E && typeof p == "object" && typeof p.getAttributeType == "function" && !dt)
|
|
@@ -5461,18 +5461,18 @@ function _a() {
|
|
|
5461
5461
|
}
|
|
5462
5462
|
if (tt !== Dn)
|
|
5463
5463
|
try {
|
|
5464
|
-
dt ? h.setAttributeNS(dt,
|
|
5464
|
+
dt ? h.setAttributeNS(dt, $, tt) : h.setAttribute($, tt), Pn(h) ? It(h) : ko(e.removed);
|
|
5465
5465
|
} catch {
|
|
5466
|
-
Zt(
|
|
5466
|
+
Zt($, h);
|
|
5467
5467
|
}
|
|
5468
5468
|
}
|
|
5469
|
-
Ut(
|
|
5469
|
+
Ut(L.afterSanitizeAttributes, h, null);
|
|
5470
5470
|
}, ja = function D(h) {
|
|
5471
5471
|
let g = null;
|
|
5472
5472
|
const x = rs(h);
|
|
5473
|
-
for (Ut(
|
|
5474
|
-
Ut(
|
|
5475
|
-
Ut(
|
|
5473
|
+
for (Ut(L.beforeSanitizeShadowDOM, h, null); g = x.nextNode(); )
|
|
5474
|
+
Ut(L.uponSanitizeShadowNode, g, null), ls(g), fs(g), g.content instanceof r && D(g.content);
|
|
5475
|
+
Ut(L.afterSanitizeShadowDOM, h, null);
|
|
5476
5476
|
};
|
|
5477
5477
|
return e.sanitize = function(D) {
|
|
5478
5478
|
let h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = null, x = null, V = null, ot = null;
|
|
@@ -5495,18 +5495,18 @@ function _a() {
|
|
|
5495
5495
|
else {
|
|
5496
5496
|
if (!ie && !Ft && !Rt && // eslint-disable-next-line unicorn/prefer-includes
|
|
5497
5497
|
D.indexOf("<") === -1)
|
|
5498
|
-
return E &&
|
|
5498
|
+
return E && ze ? E.createHTML(D) : D;
|
|
5499
5499
|
if (g = os(D), !g)
|
|
5500
|
-
return ie ? null :
|
|
5500
|
+
return ie ? null : ze ? P : "";
|
|
5501
5501
|
}
|
|
5502
5502
|
g && Se && It(g.firstChild);
|
|
5503
|
-
const
|
|
5504
|
-
for (; V =
|
|
5503
|
+
const $ = rs(be ? D : g);
|
|
5504
|
+
for (; V = $.nextNode(); )
|
|
5505
5505
|
ls(V), fs(V), V.content instanceof r && ja(V.content);
|
|
5506
5506
|
if (be)
|
|
5507
5507
|
return D;
|
|
5508
5508
|
if (ie) {
|
|
5509
|
-
if (
|
|
5509
|
+
if (Ke)
|
|
5510
5510
|
for (ot = M.call(g.ownerDocument); g.firstChild; )
|
|
5511
5511
|
ot.appendChild(g.firstChild);
|
|
5512
5512
|
else
|
|
@@ -5515,9 +5515,9 @@ function _a() {
|
|
|
5515
5515
|
}
|
|
5516
5516
|
let dt = Rt ? g.outerHTML : g.innerHTML;
|
|
5517
5517
|
return Rt && j["!doctype"] && g.ownerDocument && g.ownerDocument.doctype && g.ownerDocument.doctype.name && lt(Ia, g.ownerDocument.doctype.name) && (dt = "<!DOCTYPE " + g.ownerDocument.doctype.name + `>
|
|
5518
|
-
` + dt), Ft && tn([pt, Gt,
|
|
5518
|
+
` + dt), Ft && tn([pt, Gt, Kt], (jt) => {
|
|
5519
5519
|
dt = Pe(dt, jt, " ");
|
|
5520
|
-
}), E &&
|
|
5520
|
+
}), E && ze ? E.createHTML(dt) : dt;
|
|
5521
5521
|
}, e.setConfig = function() {
|
|
5522
5522
|
let D = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
5523
5523
|
En(D), At = !0;
|
|
@@ -5528,20 +5528,20 @@ function _a() {
|
|
|
5528
5528
|
const x = q(D), V = q(h);
|
|
5529
5529
|
return cs(x, V, g);
|
|
5530
5530
|
}, e.addHook = function(D, h) {
|
|
5531
|
-
typeof h == "function" && Ee(
|
|
5531
|
+
typeof h == "function" && Ee(L[D], h);
|
|
5532
5532
|
}, e.removeHook = function(D, h) {
|
|
5533
5533
|
if (h !== void 0) {
|
|
5534
|
-
const g = Fh(
|
|
5535
|
-
return g === -1 ? void 0 : Bh(
|
|
5534
|
+
const g = Fh(L[D], h);
|
|
5535
|
+
return g === -1 ? void 0 : Bh(L[D], g, 1)[0];
|
|
5536
5536
|
}
|
|
5537
|
-
return ko(
|
|
5537
|
+
return ko(L[D]);
|
|
5538
5538
|
}, e.removeHooks = function(D) {
|
|
5539
|
-
|
|
5539
|
+
L[D] = [];
|
|
5540
5540
|
}, e.removeAllHooks = function() {
|
|
5541
|
-
|
|
5541
|
+
L = Uo();
|
|
5542
5542
|
}, e;
|
|
5543
5543
|
}
|
|
5544
|
-
var nd =
|
|
5544
|
+
var nd = La();
|
|
5545
5545
|
function jo(t) {
|
|
5546
5546
|
if (typeof t != "string") return "";
|
|
5547
5547
|
let e = t.replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>").replace(/\*(.*?)\*/g, "<em>$1</em>").replace(/\[(.*?)\]\((.*?)\)/g, '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>').replace(/\n/g, "<br>");
|
|
@@ -5551,7 +5551,7 @@ function jo(t) {
|
|
|
5551
5551
|
});
|
|
5552
5552
|
}
|
|
5553
5553
|
const id = "convokit-widget", sd = ({ config: t }) => {
|
|
5554
|
-
const e = t.widgetId ?? id, [n, i] = xt(!1), [s, r] = xt([]), [o, a] = xt(""), [l, u] = xt(!1), [c, f] = xt(!1), [d, p] = xt(null), [m, y] = xt(null), [S, T] = xt(!1), [v, w] = xt(!1), [E, P] = xt(!1), [
|
|
5554
|
+
const e = t.widgetId ?? id, [n, i] = xt(!1), [s, r] = xt([]), [o, a] = xt(""), [l, u] = xt(!1), [c, f] = xt(!1), [d, p] = xt(null), [m, y] = xt(null), [S, T] = xt(!1), [v, w] = xt(!1), [E, P] = xt(!1), [_, O] = xt(!1), M = Tt(null), N = Tt(null), F = Tt(null), L = Tt(null), pt = Tt(null), Gt = Tt(null), Kt = 5 * 60 * 1e3, Nt = `convokit_messages_${e}`;
|
|
5555
5555
|
Mt(() => {
|
|
5556
5556
|
if (t.persistMessages)
|
|
5557
5557
|
try {
|
|
@@ -5569,8 +5569,8 @@ const id = "convokit-widget", sd = ({ config: t }) => {
|
|
|
5569
5569
|
}
|
|
5570
5570
|
}, [t.persistMessages, s, Nt]), Mt(() => {
|
|
5571
5571
|
(async () => {
|
|
5572
|
-
const
|
|
5573
|
-
if (!
|
|
5572
|
+
const K = t.key;
|
|
5573
|
+
if (!K) return;
|
|
5574
5574
|
const I = `convokit_theme_${e}`;
|
|
5575
5575
|
try {
|
|
5576
5576
|
const W = sessionStorage.getItem(I);
|
|
@@ -5580,7 +5580,7 @@ const id = "convokit-widget", sd = ({ config: t }) => {
|
|
|
5580
5580
|
}
|
|
5581
5581
|
} catch {
|
|
5582
5582
|
}
|
|
5583
|
-
const Q = await kh(
|
|
5583
|
+
const Q = await kh(K, t.apiUrl);
|
|
5584
5584
|
if (Q) {
|
|
5585
5585
|
y(Q);
|
|
5586
5586
|
try {
|
|
@@ -5614,36 +5614,36 @@ const id = "convokit-widget", sd = ({ config: t }) => {
|
|
|
5614
5614
|
}, [s, l]);
|
|
5615
5615
|
const G = 3e4;
|
|
5616
5616
|
Mt(() => {
|
|
5617
|
-
if (!
|
|
5617
|
+
if (!_ || v) {
|
|
5618
5618
|
M.current && (clearInterval(M.current), M.current = null);
|
|
5619
5619
|
return;
|
|
5620
5620
|
}
|
|
5621
|
-
const A = typeof window < "u" ? localStorage.getItem("widget_jwt") : null,
|
|
5622
|
-
if (!A || !
|
|
5621
|
+
const A = typeof window < "u" ? localStorage.getItem("widget_jwt") : null, K = typeof window < "u" ? localStorage.getItem("conversation_id") : null;
|
|
5622
|
+
if (!A || !K) return;
|
|
5623
5623
|
const I = X.apiUrl, Q = async () => {
|
|
5624
5624
|
try {
|
|
5625
|
-
(await Ih(
|
|
5625
|
+
(await Ih(K, A, I)).humanConnected && (w(!0), M.current && (clearInterval(M.current), M.current = null));
|
|
5626
5626
|
} catch {
|
|
5627
5627
|
}
|
|
5628
5628
|
};
|
|
5629
5629
|
return Q(), M.current = setInterval(Q, G), () => {
|
|
5630
5630
|
M.current && (clearInterval(M.current), M.current = null);
|
|
5631
5631
|
};
|
|
5632
|
-
}, [e, X.apiUrl,
|
|
5632
|
+
}, [e, X.apiUrl, _, v]), Mt(() => {
|
|
5633
5633
|
if (!v) {
|
|
5634
5634
|
F.current && (F.current.close(), F.current = null), N.current && (clearInterval(N.current), N.current = null);
|
|
5635
5635
|
return;
|
|
5636
5636
|
}
|
|
5637
|
-
const A = typeof window < "u" ? localStorage.getItem("widget_jwt") : null,
|
|
5638
|
-
if (!A || !
|
|
5639
|
-
const I = X.apiUrl, Q =
|
|
5637
|
+
const A = typeof window < "u" ? localStorage.getItem("widget_jwt") : null, K = typeof window < "u" ? localStorage.getItem("conversation_id") : null;
|
|
5638
|
+
if (!A || !K) return;
|
|
5639
|
+
const I = X.apiUrl, Q = _h(I, A);
|
|
5640
5640
|
let W;
|
|
5641
5641
|
try {
|
|
5642
5642
|
W = new WebSocket(Q);
|
|
5643
5643
|
} catch {
|
|
5644
5644
|
const st = async () => {
|
|
5645
5645
|
try {
|
|
5646
|
-
const { messages: H } = await
|
|
5646
|
+
const { messages: H } = await _o(K, A, I);
|
|
5647
5647
|
H != null && H.length && r(H.map((Ct) => ({
|
|
5648
5648
|
role: Ct.role,
|
|
5649
5649
|
content: Ct.content,
|
|
@@ -5658,14 +5658,14 @@ const id = "convokit-widget", sd = ({ config: t }) => {
|
|
|
5658
5658
|
}
|
|
5659
5659
|
F.current = W;
|
|
5660
5660
|
const it = () => {
|
|
5661
|
-
|
|
5661
|
+
L.current && (clearTimeout(L.current), L.current = null);
|
|
5662
5662
|
}, gt = () => {
|
|
5663
|
-
it(),
|
|
5664
|
-
|
|
5665
|
-
},
|
|
5663
|
+
it(), L.current = setTimeout(() => {
|
|
5664
|
+
L.current = null, F.current && F.current.close();
|
|
5665
|
+
}, Kt);
|
|
5666
5666
|
};
|
|
5667
5667
|
return pt.current = gt, W.onopen = () => {
|
|
5668
|
-
gt(),
|
|
5668
|
+
gt(), _o(K, A, I).then(({ messages: st }) => {
|
|
5669
5669
|
st != null && st.length && r(st.map((H) => ({
|
|
5670
5670
|
role: H.role,
|
|
5671
5671
|
content: H.content,
|
|
@@ -5700,7 +5700,7 @@ const id = "convokit-widget", sd = ({ config: t }) => {
|
|
|
5700
5700
|
};
|
|
5701
5701
|
}, [v, e, X.apiUrl]);
|
|
5702
5702
|
const J = () => i(!n), nt = X.position, bt = () => {
|
|
5703
|
-
const A = { position: "absolute", zIndex: 9999 },
|
|
5703
|
+
const A = { position: "absolute", zIndex: 9999 }, K = {
|
|
5704
5704
|
"bottom-right": { ...A, bottom: 20, right: 20 },
|
|
5705
5705
|
"bottom-left": { ...A, bottom: 20, left: 20 },
|
|
5706
5706
|
"bottom-middle": { ...A, bottom: 20, left: "50%" },
|
|
@@ -5708,7 +5708,7 @@ const id = "convokit-widget", sd = ({ config: t }) => {
|
|
|
5708
5708
|
"top-left": { ...A, top: 20, left: 20 },
|
|
5709
5709
|
"top-middle": { ...A, top: 20, left: "50%" }
|
|
5710
5710
|
};
|
|
5711
|
-
return
|
|
5711
|
+
return K[nt] || K["bottom-right"];
|
|
5712
5712
|
}, j = () => ({
|
|
5713
5713
|
"bottom-right": "bottom right",
|
|
5714
5714
|
"bottom-left": "bottom left",
|
|
@@ -5720,19 +5720,19 @@ const id = "convokit-widget", sd = ({ config: t }) => {
|
|
|
5720
5720
|
var W;
|
|
5721
5721
|
if (A.preventDefault(), !o.trim() || l) return;
|
|
5722
5722
|
v && ((W = pt.current) == null || W.call(pt));
|
|
5723
|
-
const
|
|
5723
|
+
const K = o.trim();
|
|
5724
5724
|
a(""), p(null);
|
|
5725
|
-
const I = { role: "user", content:
|
|
5725
|
+
const I = { role: "user", content: K, timestamp: /* @__PURE__ */ new Date() }, Q = [...s, I];
|
|
5726
5726
|
r(Q), v || u(!0);
|
|
5727
5727
|
try {
|
|
5728
5728
|
const it = s.map((At) => ({ role: At.role, content: At.content })), gt = typeof window < "u" ? localStorage.getItem("widget_jwt") : null, st = typeof window < "u" ? localStorage.getItem("conversation_id") : null, H = X.minTypingDuration ?? 0, Ct = Date.now(), Ft = t.apiUrl;
|
|
5729
|
-
let
|
|
5730
|
-
gt && st && !Io() ?
|
|
5729
|
+
let z;
|
|
5730
|
+
gt && st && !Io() ? z = await Rh(K, it, Ft) : (gt && st && Io() && (Lh(), T(!1), w(!1)), z = await Ch(t.key, K, Ft, e));
|
|
5731
5731
|
const Rt = Date.now() - Ct;
|
|
5732
|
-
if (H > 0 && Rt < H && await new Promise((At) => setTimeout(At, H - Rt)), O(!0),
|
|
5732
|
+
if (H > 0 && Rt < H && await new Promise((At) => setTimeout(At, H - Rt)), O(!0), z != null && z.actionTriggered && T(!0), z != null && z.useWebSocket)
|
|
5733
5733
|
w(!0);
|
|
5734
5734
|
else {
|
|
5735
|
-
const At = typeof (
|
|
5735
|
+
const At = typeof (z == null ? void 0 : z.reply) == "string" ? z.reply : (z == null ? void 0 : z.reply) != null ? String(z.reply) : "";
|
|
5736
5736
|
if (At) {
|
|
5737
5737
|
const Se = { role: "assistant", content: At, timestamp: /* @__PURE__ */ new Date() };
|
|
5738
5738
|
r([...Q, Se]);
|
|
@@ -5829,7 +5829,7 @@ const id = "convokit-widget", sd = ({ config: t }) => {
|
|
|
5829
5829
|
d
|
|
5830
5830
|
] }),
|
|
5831
5831
|
s.length === 0 && /* @__PURE__ */ R("div", { className: "convokit-message convokit-message-assistant", children: /* @__PURE__ */ R("div", { className: "convokit-message-content", dangerouslySetInnerHTML: { __html: jo(X.welcomeMessage) } }) }),
|
|
5832
|
-
s.map((A,
|
|
5832
|
+
s.map((A, K) => /* @__PURE__ */ R("div", { className: `convokit-message convokit-message-${A.role}`, children: /* @__PURE__ */ R("div", { className: "convokit-message-content", dangerouslySetInnerHTML: { __html: jo(A.content) } }) }, K)),
|
|
5833
5833
|
l && /* @__PURE__ */ R("div", { className: "convokit-message convokit-message-assistant", children: /* @__PURE__ */ R("div", { className: "convokit-message-content", children: /* @__PURE__ */ rt("div", { className: "convokit-typing", "aria-hidden": "true", children: [
|
|
5834
5834
|
/* @__PURE__ */ R("span", {}),
|
|
5835
5835
|
/* @__PURE__ */ R("span", {}),
|
|
@@ -5873,6 +5873,17 @@ const id = "convokit-widget", sd = ({ config: t }) => {
|
|
|
5873
5873
|
const e = t.apiKey;
|
|
5874
5874
|
if (!e || typeof e != "string" || e.trim() === "")
|
|
5875
5875
|
return null;
|
|
5876
|
+
if (e.trim().startsWith("sk_live_"))
|
|
5877
|
+
return console.error(
|
|
5878
|
+
`[ConvoKit] Invalid API key: You are using a secret key (sk_live_...) in the browser.
|
|
5879
|
+
Secret keys must only be used in server-side code via the convokit-server SDK.
|
|
5880
|
+
Use a public key (pk_live_...) for the widget — get yours at convokit.dev/dashboard.`
|
|
5881
|
+
), null;
|
|
5882
|
+
if (!e.trim().startsWith("pk_live_"))
|
|
5883
|
+
return console.error(
|
|
5884
|
+
`[ConvoKit] Invalid API key: Expected a public key starting with pk_live_.
|
|
5885
|
+
Get your public key from the ConvoKit dashboard at convokit.dev/dashboard.`
|
|
5886
|
+
), null;
|
|
5876
5887
|
const n = {
|
|
5877
5888
|
...nn,
|
|
5878
5889
|
key: e.trim(),
|