@norbert_bodziony/bloub 0.2.1 → 0.3.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/README.md CHANGED
@@ -118,10 +118,17 @@ editor, Tailwind, export dialogs, video encoder, or application translations.
118
118
  Solid runtime. The package supports SolidJS 2, starting with `2.0.0-rc.0`.
119
119
 
120
120
  Props: `size`, `shape`, `color`, `expression`, `paper`, `frozenAt`, `cycle`,
121
- `follow`, `gaze`, `ariaLabel`, `block`, `state`, `playing`, and `elapsed`. Each
122
- playback value has a matching `on...Change` callback. See
121
+ `follow`, `gaze`, `ariaLabel`, `block`, `state`, `playing`, `elapsed`, `fps`, and
122
+ `autoPause`. Each playback value has a matching `on...Change` callback. See
123
123
  [BloubBot.tsx](src/components/BloubBot.tsx) for the details.
124
124
 
125
+ An animated bot costs a style recalculation, a layout and a paint per drawn
126
+ frame, so its price is set by how often it draws and by how many of them are on
127
+ screen. `fps` caps the rate — a 40 px avatar in a list is indistinguishable at 30
128
+ from the screen's 120 — and `autoPause`, on by default, stops the loop when the
129
+ bot is off screen or its tab is in the background. Neither changes what the bot
130
+ looks like while someone is watching it.
131
+
125
132
  ## Changes
126
133
 
127
134
  [CHANGELOG.md](CHANGELOG.md), one entry per release — which is how you tell whether the
@@ -139,7 +139,7 @@ var se = w(49383), ce = Array.from({ length: 4 }, (e, t) => {
139
139
  cx: 0,
140
140
  cy: 0
141
141
  };
142
- }), A = .129, le = "#2496e8", j = 1.003, ue = .15, de = 1.14, fe = .054, M = 15.46, N = .186, P = .412, pe = {
142
+ }), A = .129, le = "#2496e8", j = 1.003, ue = .15, de = 1.14, fe = .054, M = 15.46, N = .186, pe = .412, P = {
143
143
  yaw: 28.49,
144
144
  pitch: 28.62,
145
145
  roll: -13
@@ -156,7 +156,7 @@ function I(e, t, n) {
156
156
  t[2] * r - e[2] * i
157
157
  ]];
158
158
  }
159
- function me(e, t, n = M) {
159
+ function L(e, t, n = M) {
160
160
  let r = [
161
161
  0,
162
162
  0,
@@ -185,33 +185,33 @@ function me(e, t, n = M) {
185
185
  };
186
186
  return [o(-1), o(1)];
187
187
  }
188
- var he = w(24301), L = (() => {
188
+ var me = w(24301), he = (() => {
189
189
  let e = [], t = 1.4;
190
- for (; t < 900;) e.push(t), t += 1.9 + he() * 2.7, he() < .18 && (e.push(t), t += .24);
190
+ for (; t < 900;) e.push(t), t += 1.9 + me() * 2.7, me() < .18 && (e.push(t), t += .24);
191
191
  return e;
192
- })(), ge = .18;
193
- function _e(e) {
194
- for (let t = 0; t < L.length; t++) {
195
- let n = L[t];
192
+ })(), R = .18;
193
+ function ge(e) {
194
+ for (let t = 0; t < he.length; t++) {
195
+ let n = he[t];
196
196
  if (e < n) break;
197
- let r = (e - n) / ge;
197
+ let r = (e - n) / R;
198
198
  if (r >= 0 && r <= 1) return r < .45 ? 1 - r / .45 : (r - .45) / .55;
199
199
  }
200
200
  return 1;
201
201
  }
202
- function ve(e, t = {}) {
202
+ function _e(e, t = {}) {
203
203
  let { wander: n = 1, blink: r = !0, float: i = !0 } = t;
204
204
  return {
205
205
  dYaw: (C(e, 11.3, .4) * 5.5 + C(e, 3.7, 2.1) * 1.6) * n,
206
206
  dPitch: (C(e, 9.1, 1.3) * 4.2 + C(e, 4.3, .7) * 1.3) * n,
207
207
  dRoll: C(e, 13.7, 3.2) * 2.2 * n,
208
- lid: r ? _e(e) : 1,
208
+ lid: r ? ge(e) : 1,
209
209
  driftX: i ? C(e, 7.9, 1.9) * .006 : 0,
210
210
  driftY: i ? C(e, 5.3, .3) * .007 : 0,
211
211
  breath: i ? 1 + Math.sin(e / 3.4 * Math.PI * 2) * .005 : 1
212
212
  };
213
213
  }
214
- function R(e) {
214
+ function ve(e) {
215
215
  return .06 + .94 * b(e);
216
216
  }
217
217
  //#endregion
@@ -224,9 +224,9 @@ var z = (e, t, n = 0, r = 1) => ({
224
224
  }), B = (e, t, n = 0, r = 1) => [z(e, t, n, r), z(e, t, -n, r)], ye = [
225
225
  {
226
226
  id: "neutre",
227
- gaze: { ...pe },
227
+ gaze: { ...P },
228
228
  split: M,
229
- eyes: [z(N, P), z(N, P)]
229
+ eyes: [z(N, pe), z(N, pe)]
230
230
  },
231
231
  {
232
232
  id: "attentif",
@@ -597,8 +597,8 @@ var we = {
597
597
  .733,
598
598
  .7528
599
599
  ]
600
- }, Te = Array.from({ length: 64 }, (e, t) => t / 64 * y), Ee = Te.map(Math.cos), De = Te.map(Math.sin);
601
- function Oe(e, t = {}) {
600
+ }, Te = Array.from({ length: 64 }, (e, t) => t / 64 * y), Ee = Te.map(Math.cos), V = Te.map(Math.sin);
601
+ function De(e, t = {}) {
602
602
  return {
603
603
  radii: [...we[e]],
604
604
  rot: 0,
@@ -609,7 +609,7 @@ function Oe(e, t = {}) {
609
609
  ...t
610
610
  };
611
611
  }
612
- function V(e, t = {}) {
612
+ function H(e, t = {}) {
613
613
  return {
614
614
  radii: Array(64).fill(e),
615
615
  rot: 0,
@@ -620,7 +620,7 @@ function V(e, t = {}) {
620
620
  ...t
621
621
  };
622
622
  }
623
- function ke(e, t, n, r) {
623
+ function Oe(e, t, n, r) {
624
624
  let i = r ?? {
625
625
  radii: Array(64),
626
626
  rot: 0,
@@ -635,10 +635,10 @@ function ke(e, t, n, r) {
635
635
  for (; a < -Math.PI;) a += y;
636
636
  return i.rot = e.rot + a * n, i.cx = x(e.cx, t.cx, n), i.cy = x(e.cy, t.cy, n), i.sx = x(e.sx, t.sx, n), i.sy = x(e.sy, t.sy, n), i;
637
637
  }
638
- function H(e, t, n = []) {
638
+ function ke(e, t, n = []) {
639
639
  let r = Math.cos(e.rot), i = Math.sin(e.rot);
640
640
  for (let a = 0; a < 64; a++) {
641
- let o = e.radii[a] ?? 1, s = o * (Ee[a] ?? 0), c = o * (De[a] ?? 0), l = s * r - c * i, u = s * i + c * r, d = n[a] ?? {
641
+ let o = e.radii[a] ?? 1, s = o * (Ee[a] ?? 0), c = o * (V[a] ?? 0), l = s * r - c * i, u = s * i + c * r, d = n[a] ?? {
642
642
  x: 0,
643
643
  y: 0
644
644
  };
@@ -659,7 +659,7 @@ function Ae(e, t = 1 / 6) {
659
659
  function U(e, t, n) {
660
660
  let r = Array(64).fill(0), i = e.length;
661
661
  for (let a = 0; a < 64; a++) {
662
- let o = Ee[a] ?? 0, s = De[a] ?? 0, c = 0;
662
+ let o = Ee[a] ?? 0, s = V[a] ?? 0, c = 0;
663
663
  for (let r = 0; r < i; r++) {
664
664
  let a = e[r], l = e[(r + 1) % i], u = l.x - a.x, d = l.y - a.y, f = o * d - s * u;
665
665
  if (Math.abs(f) < 1e-9) continue;
@@ -692,13 +692,13 @@ function je(e, t) {
692
692
  let n = e.length, r = (t / y % 1 + 1) % 1 * n, i = Math.floor(r);
693
693
  return x(e[i % n] ?? 1, e[(i + 1) % n] ?? 1, r - i);
694
694
  }
695
- function G(e, t = 1, n = 1) {
696
- return Te.map((r, i) => (Math.abs((Ee[i] ?? 0) / t) ** e + Math.abs((De[i] ?? 0) / n) ** e) ** (-1 / e));
695
+ function Me(e, t = 1, n = 1) {
696
+ return Te.map((r, i) => (Math.abs((Ee[i] ?? 0) / t) ** e + Math.abs((V[i] ?? 0) / n) ** e) ** (-1 / e));
697
697
  }
698
- function Me(e) {
698
+ function Ne(e) {
699
699
  let t = Array(64).fill(0);
700
700
  for (let n = 0; n < 64; n++) {
701
- let r = Ee[n] ?? 0, i = De[n] ?? 0, a = 0;
701
+ let r = Ee[n] ?? 0, i = V[n] ?? 0, a = 0;
702
702
  for (let t of e) {
703
703
  let e = r * t.x + i * t.y, n = e * e - (t.x * t.x + t.y * t.y - t.r * t.r);
704
704
  if (n < 0) continue;
@@ -709,7 +709,7 @@ function Me(e) {
709
709
  }
710
710
  return t;
711
711
  }
712
- function Ne(e, t, n = 10) {
712
+ function Pe(e, t, n = 10) {
713
713
  let r = e.length, i = [], a = (e, t) => {
714
714
  let n = t.x - e.x, r = t.y - e.y, i = Math.hypot(n, r) || 1;
715
715
  return Math.atan2(-n / i, r / i);
@@ -728,9 +728,9 @@ function Ne(e, t, n = 10) {
728
728
  }
729
729
  return i;
730
730
  }
731
- function Pe(e, t, n, r = 0) {
731
+ function Fe(e, t, n, r = 0) {
732
732
  let i = r * Math.PI / 180;
733
- return U(Ne(Array.from({ length: e }, (r, a) => {
733
+ return U(Pe(Array.from({ length: e }, (r, a) => {
734
734
  let o = i + a / e * y;
735
735
  return {
736
736
  x: Math.cos(o) * (t - n),
@@ -738,7 +738,7 @@ function Pe(e, t, n, r = 0) {
738
738
  };
739
739
  }), n), 0, 0);
740
740
  }
741
- function Fe(e, t = 1) {
741
+ function Ie(e, t = 1) {
742
742
  if (e.length < 3) return "";
743
743
  let n = "";
744
744
  for (let r = 0; r < e.length; r++) {
@@ -747,19 +747,19 @@ function Fe(e, t = 1) {
747
747
  }
748
748
  return `${n}Z`;
749
749
  }
750
- function Ie(e, t) {
750
+ function Le(e, t) {
751
751
  let n = Math.max(e, .01) / 2, r = Math.max(t, .01) / 2, i = Math.min(n, r);
752
752
  return `M${T(-n)} ${T(-r + i)}A${T(i)} ${T(i)} 0 0 1 ${T(-n + i)} ${T(-r)}L${T(n - i)} ${T(-r)}A${T(i)} ${T(i)} 0 0 1 ${T(n)} ${T(-r + i)}L${T(n)} ${T(r - i)}A${T(i)} ${T(i)} 0 0 1 ${T(n - i)} ${T(r)}L${T(-n + i)} ${T(r)}A${T(i)} ${T(i)} 0 0 1 ${T(-n)} ${T(r - i)}Z`;
753
753
  }
754
754
  //#endregion
755
755
  //#region src/bot/skins.ts
756
- function K(e, t = 1) {
756
+ function G(e, t = 1) {
757
757
  let n = Math.max(...e);
758
758
  if (n <= 0) return e;
759
759
  let r = t / n;
760
760
  return e.map((e) => e * r);
761
761
  }
762
- var Le = K(Array.from({ length: 64 }, (e, t) => t / 64 * Math.PI * 2).map((e) => 1 + .075 * Math.cos(2 * e + .5) + .035 * Math.cos(3 * e + 2.1)), 1.02), q = K(Me([
762
+ var K = G(Array.from({ length: 64 }, (e, t) => t / 64 * Math.PI * 2).map((e) => 1 + .075 * Math.cos(2 * e + .5) + .035 * Math.cos(3 * e + 2.1)), 1.02), Re = G(Ne([
763
763
  {
764
764
  x: -.44,
765
765
  y: .2,
@@ -785,18 +785,18 @@ var Le = K(Array.from({ length: 64 }, (e, t) => t / 64 * Math.PI * 2).map((e) =>
785
785
  y: -.24,
786
786
  r: .44
787
787
  }
788
- ]), 1.02), Re = K(U(W(0, .28, .66, 0, -.96, .05), 0, 0), 1.04), ze = U(W(-.42, 0, .62, .42, 0, .62), 0, 0), J = [
788
+ ]), 1.02), q = G(U(W(0, .28, .66, 0, -.96, .05), 0, 0), 1.04), ze = U(W(-.42, 0, .62, .42, 0, .62), 0, 0), Be = [
789
789
  {
790
790
  id: "cercle",
791
791
  radii: Array(64).fill(1)
792
792
  },
793
793
  {
794
794
  id: "galet",
795
- radii: Le
795
+ radii: K
796
796
  },
797
797
  {
798
798
  id: "squircle",
799
- radii: K(G(4.2), 1.15)
799
+ radii: G(Me(4.2), 1.15)
800
800
  },
801
801
  {
802
802
  id: "capsule",
@@ -804,21 +804,21 @@ var Le = K(Array.from({ length: 64 }, (e, t) => t / 64 * Math.PI * 2).map((e) =>
804
804
  },
805
805
  {
806
806
  id: "triangle",
807
- radii: Pe(3, 1.12, .34, -90)
807
+ radii: Fe(3, 1.12, .34, -90)
808
808
  },
809
809
  {
810
810
  id: "hexagone",
811
- radii: Pe(6, 1.04, .26, 0)
811
+ radii: Fe(6, 1.04, .26, 0)
812
812
  },
813
813
  {
814
814
  id: "nuage",
815
- radii: q
815
+ radii: Re
816
816
  },
817
817
  {
818
818
  id: "goutte",
819
- radii: Re
819
+ radii: q
820
820
  }
821
- ], Be = new Map(J.map((e) => [e.id, e])), Ve = "cercle", He = [
821
+ ], Ve = new Map(Be.map((e) => [e.id, e])), He = "cercle", Ue = [
822
822
  {
823
823
  id: "encre",
824
824
  hex: "#0a0a0c"
@@ -867,8 +867,8 @@ var Le = K(Array.from({ length: 64 }, (e, t) => t / 64 * Math.PI * 2).map((e) =>
867
867
  id: "creme",
868
868
  hex: "#f1efe9"
869
869
  }
870
- ], Ue = new Map(He.map((e) => [e.id, e])), We = "encre";
871
- function Ge(e, t, n) {
870
+ ], We = new Map(Ue.map((e) => [e.id, e])), Ge = "encre";
871
+ function Ke(e, t, n) {
872
872
  let r = (e) => {
873
873
  let t = parseInt(e.slice(1), 16);
874
874
  return [
@@ -881,7 +881,7 @@ function Ge(e, t, n) {
881
881
  }
882
882
  //#endregion
883
883
  //#region src/bot/states.ts
884
- var Y = (e, t) => [{
884
+ var J = (e, t) => [{
885
885
  w: e,
886
886
  h: t,
887
887
  open: 1
@@ -890,14 +890,14 @@ var Y = (e, t) => [{
890
890
  h: t,
891
891
  open: 1
892
892
  }];
893
- function X(e = {}) {
893
+ function Y(e = {}) {
894
894
  return {
895
- sil: V(1),
895
+ sil: H(1),
896
896
  offX: 0,
897
897
  offY: 0,
898
- gaze: { ...pe },
898
+ gaze: { ...P },
899
899
  split: M,
900
- eyes: Y(N, P),
900
+ eyes: J(N, pe),
901
901
  eyeAlpha: 1,
902
902
  bodyAlpha: 1,
903
903
  dots: [],
@@ -907,25 +907,25 @@ function X(e = {}) {
907
907
  ...e
908
908
  };
909
909
  }
910
- var Ke = -.1875, qe = U(W(0, -.505, .132, 0, .13, .075), 0, Ke), Je = U(W(0, -.2535, .1345, 0, .2535, .1345), 0, 0), Ye = (e = {}) => ({
911
- radii: [...qe],
910
+ var qe = -.1875, Je = U(W(0, -.505, .132, 0, .13, .075), 0, qe), X = U(W(0, -.2535, .1345, 0, .2535, .1345), 0, 0), Ye = (e = {}) => ({
911
+ radii: [...Je],
912
912
  rot: 0,
913
913
  cx: 0,
914
- cy: Ke,
914
+ cy: qe,
915
915
  sx: 1,
916
916
  sy: 1,
917
917
  ...e
918
918
  }), Xe = (e = {}) => ({
919
- radii: [...Je],
919
+ radii: [...X],
920
920
  rot: 0,
921
921
  cx: 0,
922
922
  cy: 0,
923
923
  sx: 1,
924
924
  sy: 1,
925
925
  ...e
926
- }), Ze = Fe(W(0, 0, .118, 0, .172, .012)), Qe = .213;
926
+ }), Ze = Ie(W(0, 0, .118, 0, .172, .012)), Qe = .213;
927
927
  function $e(e) {
928
- return Oe("triangle", {
928
+ return De("triangle", {
929
929
  rot: e,
930
930
  cx: -.213 * Math.sin(e),
931
931
  cy: Qe * Math.cos(e)
@@ -943,7 +943,7 @@ var tt = [
943
943
  blinkIn: !1,
944
944
  baseFace: !0,
945
945
  baseBody: !0,
946
- pose: () => X()
946
+ pose: () => Y()
947
947
  },
948
948
  {
949
949
  id: "thinking",
@@ -954,8 +954,8 @@ var tt = [
954
954
  blinkIn: !0,
955
955
  pose: (e) => {
956
956
  let t = et(e, 1), n = .3 + .7 * S.easeOutCubic(b(e / .3));
957
- return X({
958
- sil: V(ne * (1 + (re - 1) * t), { cx: k[1] }),
957
+ return Y({
958
+ sil: H(ne * (1 + (re - 1) * t), { cx: k[1] }),
959
959
  eyeAlpha: 0,
960
960
  dots: [0, 2].map((t) => {
961
961
  let r = et(e, t);
@@ -976,7 +976,7 @@ var tt = [
976
976
  blinkIn: !0,
977
977
  baseFace: !1,
978
978
  baseBody: !0,
979
- pose: () => X({
979
+ pose: () => Y({
980
980
  gaze: {
981
981
  yaw: -5.37,
982
982
  pitch: 4.55,
@@ -1001,14 +1001,14 @@ var tt = [
1001
1001
  blinkIn: !0,
1002
1002
  baseFace: !1,
1003
1003
  baseBody: !0,
1004
- pose: () => X({
1004
+ pose: () => Y({
1005
1005
  gaze: {
1006
1006
  yaw: 6.92,
1007
1007
  pitch: -21.96,
1008
1008
  roll: 11.6
1009
1009
  },
1010
1010
  split: 18.43,
1011
- eyes: Y(.356, .875)
1011
+ eyes: J(.356, .875)
1012
1012
  })
1013
1013
  },
1014
1014
  {
@@ -1021,7 +1021,7 @@ var tt = [
1021
1021
  blinkIn: !1,
1022
1022
  pose: (e) => {
1023
1023
  let t = b(e / 1.5), n = S.easeInOutCubic(t) * .82 - .087, r = e > 1.6 ? b((e - 1.6) / .4) : 0, i = n * (1 - r) + .1 * r, a = Math.sin(e * 2.5 * y) * .005, o = 17.7 * Math.PI / 180;
1024
- return X({
1024
+ return Y({
1025
1025
  sil: Xe({
1026
1026
  rot: o,
1027
1027
  cx: i,
@@ -1048,14 +1048,14 @@ var tt = [
1048
1048
  baseBody: !0,
1049
1049
  pose: (e) => {
1050
1050
  let t = b(e / .45), n = 1 + (de - 1) * Math.sin(t * Math.PI) * (1 - t * .35), r = ue * (t < 1 ? n : 1), i = -42 * Math.PI / 180;
1051
- return X({
1051
+ return Y({
1052
1052
  gaze: {
1053
1053
  yaw: -21.94,
1054
1054
  pitch: -5.82,
1055
1055
  roll: -12.2
1056
1056
  },
1057
1057
  split: 18.89,
1058
- eyes: Y(.505, .498),
1058
+ eyes: J(.505, .498),
1059
1059
  notif: {
1060
1060
  x: Math.cos(i) * j,
1061
1061
  y: Math.sin(i) * j,
@@ -1072,7 +1072,7 @@ var tt = [
1072
1072
  baseFace: !1,
1073
1073
  baseBody: !1,
1074
1074
  blinkIn: !1,
1075
- pose: () => X({
1075
+ pose: () => Y({
1076
1076
  sil: Ye(),
1077
1077
  eyeAlpha: 0,
1078
1078
  dots: [{
@@ -1090,8 +1090,8 @@ var tt = [
1090
1090
  baseFace: !1,
1091
1091
  baseBody: !1,
1092
1092
  blinkIn: !1,
1093
- pose: (e) => X({
1094
- sil: V(.1585, { cy: .11 + Math.sin(y / .6 * e) * .19 }),
1093
+ pose: (e) => Y({
1094
+ sil: H(.1585, { cy: .11 + Math.sin(y / .6 * e) * .19 }),
1095
1095
  eyeAlpha: 0
1096
1096
  })
1097
1097
  },
@@ -1102,15 +1102,15 @@ var tt = [
1102
1102
  baseFace: !1,
1103
1103
  baseBody: !1,
1104
1104
  blinkIn: !0,
1105
- pose: () => X({
1106
- sil: Oe("egg"),
1105
+ pose: () => Y({
1106
+ sil: De("egg"),
1107
1107
  gaze: {
1108
1108
  yaw: 19.97,
1109
1109
  pitch: 26.01,
1110
1110
  roll: -17.1
1111
1111
  },
1112
1112
  split: 11.07,
1113
- eyes: Y(.164, .385)
1113
+ eyes: J(.164, .385)
1114
1114
  })
1115
1115
  },
1116
1116
  {
@@ -1120,15 +1120,15 @@ var tt = [
1120
1120
  baseFace: !1,
1121
1121
  baseBody: !1,
1122
1122
  blinkIn: !0,
1123
- pose: () => X({
1124
- sil: Oe("hexagon"),
1123
+ pose: () => Y({
1124
+ sil: De("hexagon"),
1125
1125
  gaze: {
1126
1126
  yaw: 23.11,
1127
1127
  pitch: 24.42,
1128
1128
  roll: -13.3
1129
1129
  },
1130
1130
  split: 13.37,
1131
- eyes: Y(.177, .411)
1131
+ eyes: J(.177, .411)
1132
1132
  })
1133
1133
  },
1134
1134
  {
@@ -1140,7 +1140,7 @@ var tt = [
1140
1140
  blinkIn: !0,
1141
1141
  pose: (e) => {
1142
1142
  let t = b(e / .35) * b((2.2 - e) / .5);
1143
- return X({
1143
+ return Y({
1144
1144
  sil: $e(0),
1145
1145
  gaze: {
1146
1146
  yaw: 12,
@@ -1148,7 +1148,7 @@ var tt = [
1148
1148
  roll: -6
1149
1149
  },
1150
1150
  split: 15,
1151
- eyes: Y(.18, .34),
1151
+ eyes: J(.18, .34),
1152
1152
  arcs: te.map((n, r) => ({
1153
1153
  id: `sw${r}`,
1154
1154
  seed: {
@@ -1170,7 +1170,7 @@ var tt = [
1170
1170
  baseBody: !1,
1171
1171
  blinkIn: !1,
1172
1172
  pose: (e) => {
1173
- let t = S.easeInOutCubic(b(e / .35)), n = -y * 1.25 * e * t, r = S.easeInOutCubic(b((e - 1.6) / .9)), i = $e(n), a = V(1, { rot: n }), o = {
1173
+ let t = S.easeInOutCubic(b(e / .35)), n = -y * 1.25 * e * t, r = S.easeInOutCubic(b((e - 1.6) / .9)), i = $e(n), a = H(1, { rot: n }), o = {
1174
1174
  radii: i.radii.map((e, t) => e + (a.radii[t] - e) * r),
1175
1175
  rot: n,
1176
1176
  cx: i.cx * (1 - r),
@@ -1178,14 +1178,14 @@ var tt = [
1178
1178
  sx: 1,
1179
1179
  sy: 1
1180
1180
  }, s = b(e / .8) * b((3.6 - e) / .9);
1181
- return X({
1181
+ return Y({
1182
1182
  sil: o,
1183
1183
  gaze: {
1184
- yaw: pe.yaw + Math.sin(e * 6.5) * 65 * (1 - r),
1184
+ yaw: P.yaw + Math.sin(e * 6.5) * 65 * (1 - r),
1185
1185
  pitch: -4 + r * 32,
1186
1186
  roll: -13
1187
1187
  },
1188
- eyes: Y(.18, .34 + r * .07),
1188
+ eyes: J(.18, .34 + r * .07),
1189
1189
  arcs: O.map((t, n) => ({
1190
1190
  id: `rg${n}`,
1191
1191
  seed: t,
@@ -1203,7 +1203,7 @@ var tt = [
1203
1203
  baseFace: !0,
1204
1204
  baseBody: !0,
1205
1205
  blinkIn: !0,
1206
- pose: (e) => X({ arcs: O.slice(0, 3).map((t, n) => ({
1206
+ pose: (e) => Y({ arcs: O.slice(0, 3).map((t, n) => ({
1207
1207
  id: `sw${n}`,
1208
1208
  seed: t,
1209
1209
  t: e,
@@ -1220,8 +1220,8 @@ var tt = [
1220
1220
  blinkIn: !1,
1221
1221
  pose: (e) => {
1222
1222
  let t = 1 - .834 * S.easeOutQuint(b(e / .7)), n = S.easeOutQuint(b((e - 1.7) / .7));
1223
- return X({
1224
- sil: V(t + (1 - t) * n),
1223
+ return Y({
1224
+ sil: H(t + (1 - t) * n),
1225
1225
  eyeAlpha: b((e - 1.85) / .4),
1226
1226
  dots: oe(e, 1),
1227
1227
  dotsBehind: !0
@@ -1238,8 +1238,8 @@ var tt = [
1238
1238
  blinkIn: !1,
1239
1239
  pose: (e) => {
1240
1240
  let t = 1 - (1 - A) * S.easeOutQuint(b(e / .55)), n = S.easeOutQuint(b((e - 1.85) / .6)), r = b((e - .15) / .25) * b((1.95 - e) / .3);
1241
- return X({
1242
- sil: V(t + (1 - t) * n, { cy: Math.sin(b(e / 1.7) * Math.PI) * .035 }),
1241
+ return Y({
1242
+ sil: H(t + (1 - t) * n, { cy: Math.sin(b(e / 1.7) * Math.PI) * .035 }),
1243
1243
  eyeAlpha: b((e - 2) / .35),
1244
1244
  arcs: ce.map((t, n) => ({
1245
1245
  id: `cm${n}`,
@@ -1283,7 +1283,7 @@ var tt = [
1283
1283
  "comet"
1284
1284
  ], Q = 100, it = 7.1, at = 5.5, ot = .006, st = .007;
1285
1285
  function ct(e, t, n) {
1286
- let r = [], i = me(e.gaze, Q, e.split);
1286
+ let r = [], i = L(e.gaze, Q, e.split);
1287
1287
  for (let a = 0; a < 2; a++) {
1288
1288
  let o = i[a];
1289
1289
  if (o.depth <= .02) continue;
@@ -1407,10 +1407,10 @@ function gt(e) {
1407
1407
  function _t(e, t, n) {
1408
1408
  let r = [];
1409
1409
  for (let i of gt(e)) {
1410
- let a = e.pose(i), o = H({
1410
+ let a = e.pose(i), o = ke({
1411
1411
  ...a.sil,
1412
1412
  radii: t
1413
- }, Q), s = H(a.sil, Q), c = ht(e, a, n), l = [];
1413
+ }, Q), s = ke(a.sil, Q), c = ht(e, a, n), l = [];
1414
1414
  for (let e of [-7.1, it]) for (let t of [-5.5, at]) l.push({
1415
1415
  ...c,
1416
1416
  gaze: {
@@ -1433,7 +1433,7 @@ var vt = {
1433
1433
  y: 0
1434
1434
  }, yt = (e, t) => `${e}|${t ?? ""}`;
1435
1435
  function bt() {
1436
- return new Map(J.map((e) => {
1436
+ return new Map(Be.map((e) => {
1437
1437
  let t = /* @__PURE__ */ new Map();
1438
1438
  for (let n of tt) {
1439
1439
  if (!n.baseBody) continue;
@@ -1472,7 +1472,7 @@ var Ct = {
1472
1472
  function Et(e, t, n) {
1473
1473
  let r = 1 - n;
1474
1474
  return {
1475
- sil: ke(e.sil, t.sil, n),
1475
+ sil: Oe(e.sil, t.sil, n),
1476
1476
  offX: x(e.offX, t.offX, n),
1477
1477
  offY: x(e.offY, t.offY, n),
1478
1478
  gaze: {
@@ -1620,27 +1620,27 @@ var Dt = class e {
1620
1620
  };
1621
1621
  }
1622
1622
  }
1623
- let l = a.eyeAlpha > .01, u = this.lookAtTime(e), d = ve(e, {
1623
+ let l = a.eyeAlpha > .01, u = this.lookAtTime(e), d = _e(e, {
1624
1624
  wander: l ? u.wander : 0,
1625
1625
  blink: l
1626
1626
  }), f = {
1627
1627
  yaw: x(a.gaze.yaw, u.yaw, u.mix) + d.dYaw - u.spin,
1628
1628
  pitch: x(a.gaze.pitch, u.pitch, u.mix) + d.dPitch,
1629
1629
  roll: a.gaze.roll + d.dRoll
1630
- }, p = b((e - this.blinkAt) / .2), m = p < 1 ? Math.abs(p * 2 - 1) : 1, h = Math.min(d.lid, m), g = a.offX + d.driftX, _ = a.offY + d.driftY, v = Ae(H({
1630
+ }, p = b((e - this.blinkAt) / .2), m = p < 1 ? Math.abs(p * 2 - 1) : 1, h = Math.min(d.lid, m), g = a.offX + d.driftX, _ = a.offY + d.driftY, v = Ae(ke({
1631
1631
  ...a.sil,
1632
1632
  cx: a.sil.cx + g,
1633
1633
  cy: a.sil.cy + _,
1634
1634
  sy: a.sil.sy * d.breath
1635
1635
  }, t, this.pts)), y = (e, t) => je(a.sil.radii, Math.atan2(t, e) - a.sil.rot), C = [];
1636
1636
  if (a.eyeAlpha > .01) {
1637
- let e = me(f, t, a.split);
1637
+ let e = L(f, t, a.split);
1638
1638
  for (let n = 0; n < 2; n++) {
1639
1639
  let r = e[n];
1640
1640
  if (r.depth <= .02) continue;
1641
- let i = a.eyes[n], s = y(r.x, r.y), c = (i.tilt ?? 0) * Math.PI / 180, l = Math.cos(c), u = Math.sin(c), d = r.a * l + r.c * u, f = r.b * l + r.d * u, p = -r.a * u + r.c * l, m = -r.b * u + r.d * l, v = R(Math.min(h, i.open));
1641
+ let i = a.eyes[n], s = y(r.x, r.y), c = (i.tilt ?? 0) * Math.PI / 180, l = Math.cos(c), u = Math.sin(c), d = r.a * l + r.c * u, f = r.b * l + r.d * u, p = -r.a * u + r.c * l, m = -r.b * u + r.d * l, v = ve(Math.min(h, i.open));
1642
1642
  C.push({
1643
- d: Ie(i.w * t, i.h * t),
1643
+ d: Le(i.w * t, i.h * t),
1644
1644
  matrix: `matrix(${T(d)},${T(f * v)},${T(p)},${T(m * v)},${T(r.x * s + (g + o.x) * t)},${T(r.y * s + (_ + o.y) * t)})`,
1645
1645
  alpha: a.eyeAlpha * b(r.depth / .12)
1646
1646
  });
@@ -1803,13 +1803,14 @@ function $(e, t, n) {
1803
1803
  function ln(l) {
1804
1804
  let y = a({
1805
1805
  size: 320,
1806
- shape: Ve,
1807
- color: We,
1806
+ shape: He,
1807
+ color: Ge,
1808
1808
  expression: xe,
1809
1809
  paper: "#f9f9f9",
1810
1810
  cycle: Vt().blocks,
1811
1811
  follow: !1,
1812
1812
  gaze: null,
1813
+ autoPause: !0,
1813
1814
  ariaLabel: "Animated Bloub avatar"
1814
1815
  }, l), [x, C] = m(0), [w, T] = m("idle"), [E] = m(!1), [ee, D] = m(0), O = () => l.block ?? x(), te = () => l.state ?? w(), k = () => l.playing ?? E(), ne = () => l.elapsed ?? ee();
1815
1816
  function re(e) {
@@ -1821,21 +1822,21 @@ function ln(l) {
1821
1822
  function ae(e) {
1822
1823
  l.elapsed === void 0 && D(e), l.onElapsedChange?.(e);
1823
1824
  }
1824
- let oe = p(() => Be.get(y.shape)?.radii ?? null), se = p(() => Ue.get(y.color)?.hex ?? "#0a0a0c"), ce = p(() => be.get(y.expression) ?? null), A = v(() => new Dt(100, te(), oe(), ce())), [j, ue] = m(v(() => A.sample(y.frozenAt ?? 0)), { equals: !1 }), de = h(), fe = `bot-mask-${de}`, M, N = 0, P = Infinity, pe = 0, F = 0, I = 0, me = 0, he = -1;
1825
- function L(e, t = 0) {
1825
+ let oe = p(() => Ve.get(y.shape)?.radii ?? null), se = p(() => We.get(y.color)?.hex ?? "#0a0a0c"), ce = p(() => be.get(y.expression) ?? null), A = v(() => new Dt(100, te(), oe(), ce())), [j, ue] = m(v(() => A.sample(y.frozenAt ?? 0)), { equals: !1 }), de = h(), fe = `bot-mask-${de}`, M, N = 0, pe = -Infinity, P = Infinity, F = 0, I = 0, L = 0, me = 0, he = -1;
1826
+ function R(e, t = 0) {
1826
1827
  let n = y.cycle[e];
1827
1828
  if (!n) {
1828
1829
  P = Infinity;
1829
1830
  return;
1830
1831
  }
1831
- I = F - t, ae(t), ie(n.state), A.setState(n.state, F), P = k() ? I + n.duration : Infinity;
1832
+ L = I - t, ae(t), ie(n.state), A.setState(n.state, I), P = k() ? L + n.duration : Infinity;
1832
1833
  }
1833
1834
  function ge(e) {
1834
- re(e), L(e);
1835
+ re(e), R(e);
1835
1836
  }
1836
1837
  function _e(e, t = 0) {
1837
1838
  if (O() === e) {
1838
- L(e, t);
1839
+ R(e, t);
1839
1840
  return;
1840
1841
  }
1841
1842
  me = t, re(e);
@@ -1850,84 +1851,106 @@ function ln(l) {
1850
1851
  }
1851
1852
  ue(A.sample(e));
1852
1853
  }
1853
- let R = null, z = !1, B = 0, ye = 0, Se = !1, Ce = 1 / 60;
1854
- function we(e) {
1855
- e.pointerType !== "touch" && (R = {
1854
+ let z = null, B = !1, ye = 0, Se = 0, Ce = !1, we = 1 / 60;
1855
+ function Te(e) {
1856
+ e.pointerType !== "touch" && (z = {
1856
1857
  x: e.clientX,
1857
1858
  y: e.clientY
1858
1859
  });
1859
1860
  }
1860
- function Te() {
1861
- R = null;
1862
- }
1863
1861
  function Ee() {
1864
- z &&= (A.setLook(null, F, Ot), !1);
1862
+ z = null;
1863
+ }
1864
+ function V() {
1865
+ B &&= (A.setLook(null, I, Ot), !1);
1865
1866
  }
1866
1867
  function De() {
1867
1868
  if (!Z.get(te())?.baseFace) {
1868
- Ee();
1869
+ V();
1869
1870
  return;
1870
1871
  }
1871
1872
  let e = M?.getBoundingClientRect();
1872
1873
  if (!e || e.width === 0 || e.height === 0) return;
1873
- z || (B = F);
1874
+ B || (ye = I);
1874
1875
  let t = Math.max(1, window.innerWidth / 2), n = Math.max(1, window.innerHeight / 2);
1875
1876
  A.setLook(jt({
1876
- nx: R ? b((R.x - (e.left + e.width / 2)) / t, -1, 1) : 0,
1877
- ny: R ? b((R.y - (e.top + e.height / 2)) / n, -1, 1) : 0,
1878
- tour: S.easeOutQuint(b((F - B) / Ot)),
1879
- pointer: R !== null
1880
- }), F), z = !0;
1877
+ nx: z ? b((z.x - (e.left + e.width / 2)) / t, -1, 1) : 0,
1878
+ ny: z ? b((z.y - (e.top + e.height / 2)) / n, -1, 1) : 0,
1879
+ tour: S.easeOutQuint(b((I - ye) / Ot)),
1880
+ pointer: z !== null
1881
+ }), I), B = !0;
1881
1882
  }
1882
- function Oe(e) {
1883
- A.setLook(e(F - ye), F, Ce);
1883
+ function H(e) {
1884
+ A.setLook(e(I - Se), I, we);
1884
1885
  }
1885
- function V() {
1886
- window.removeEventListener("pointermove", we), document.removeEventListener("pointerleave", Te);
1886
+ function Oe() {
1887
+ window.removeEventListener("pointermove", Te), document.removeEventListener("pointerleave", Ee);
1887
1888
  }
1888
1889
  function ke(e) {
1889
1890
  N = requestAnimationFrame(ke);
1890
- let t = pe ? Math.min((e - pe) / 1e3, .064) : 0;
1891
- pe = e, F += t, k() && (F >= P && y.cycle.length ? ge((O() + 1) % y.cycle.length) : ae(F - I)), y.follow ? De() : y.gaze && Oe(y.gaze), ue(A.sample(F));
1891
+ let t = F ? Math.min((e - F) / 1e3, .064) : 0;
1892
+ F = e, I += t;
1893
+ let n = y.fps && y.fps > 0 ? 1 / y.fps : 0;
1894
+ I - pe < n || (pe = I, k() && (I >= P && y.cycle.length ? ge((O() + 1) % y.cycle.length) : ae(I - L)), y.follow ? De() : y.gaze && H(y.gaze), ue(A.sample(I)));
1892
1895
  }
1893
- function H() {
1896
+ function Ae() {
1894
1897
  y.frozenAt !== void 0 && ue(A.sample(y.frozenAt));
1895
1898
  }
1896
1899
  $(() => y.gaze, (e) => {
1897
- e ? (ye = F, Se = !0, A.setLook(e(0), F - Ce, Ce)) : Se &&= (A.setLook(null, F), !1);
1900
+ e ? (Se = I, Ce = !0, A.setLook(e(0), I - we, we)) : Ce &&= (A.setLook(null, I), !1);
1898
1901
  }), $(O, (e) => {
1899
- L(e, me), me = 0;
1902
+ R(e, me), me = 0;
1900
1903
  }, { defer: !0 }), $(te, (e) => {
1901
- A.state !== e && (A.setState(e, F), H());
1904
+ A.state !== e && (A.setState(e, I), Ae());
1902
1905
  }, { defer: !0 }), $(k, (e) => {
1903
- e ? L(O(), ne()) : P = Infinity;
1906
+ e ? R(O(), ne()) : P = Infinity;
1904
1907
  }, { defer: !0 }), $(() => y.cycle, (e) => {
1905
1908
  if (!e.length) {
1906
1909
  P = Infinity;
1907
1910
  return;
1908
1911
  }
1909
1912
  let t = Math.min(O(), e.length - 1);
1910
- t === O() ? P = k() ? I + e[t].duration : Infinity : ge(t);
1913
+ t === O() ? P = k() ? L + e[t].duration : Infinity : ge(t);
1911
1914
  }, { defer: !0 }), $(oe, (e) => {
1912
- A.setShape(e, F), H();
1915
+ A.setShape(e, I), Ae();
1913
1916
  }, { defer: !0 }), $(ce, (e) => {
1914
- A.setExpression(e, F), H();
1915
- }, { defer: !0 }), $(() => y.frozenAt, H, { defer: !0 }), f(() => y.follow && y.frozenAt === void 0, (e) => {
1916
- e ? (window.addEventListener("pointermove", we), document.addEventListener("pointerleave", Te)) : (V(), Ee());
1917
+ A.setExpression(e, I), Ae();
1918
+ }, { defer: !0 }), $(() => y.frozenAt, Ae, { defer: !0 }), f(() => y.follow && y.frozenAt === void 0, (e) => {
1919
+ e ? (window.addEventListener("pointermove", Te), document.addEventListener("pointerleave", Ee)) : (Oe(), V());
1920
+ });
1921
+ function U() {
1922
+ N || typeof requestAnimationFrame > "u" || (F = 0, N = requestAnimationFrame(ke));
1923
+ }
1924
+ function W() {
1925
+ N &&= (typeof cancelAnimationFrame < "u" && cancelAnimationFrame(N), 0);
1926
+ }
1927
+ let [je, Me] = m(!0), [Ne, Pe] = m(!0), [Fe, Ie] = m(!1);
1928
+ f(() => Fe() && y.frozenAt === void 0 && (!y.autoPause || je() && Ne()), (e) => {
1929
+ e ? U() : W();
1917
1930
  }), _(() => {
1918
- l.ref?.({
1931
+ if (l.ref?.({
1919
1932
  get svg() {
1920
1933
  return M;
1921
1934
  },
1922
1935
  seek: _e,
1923
1936
  renderAt: ve
1924
- }), y.frozenAt === void 0 && (L(O(), ne()), N = requestAnimationFrame(ke));
1937
+ }), y.frozenAt !== void 0) return;
1938
+ R(O(), ne());
1939
+ let e = () => Pe(document.visibilityState !== "hidden");
1940
+ document.addEventListener("visibilitychange", e), e();
1941
+ let t = typeof IntersectionObserver > "u" ? null : new IntersectionObserver((e) => {
1942
+ let t = e[e.length - 1];
1943
+ t && Me(t.isIntersecting);
1944
+ });
1945
+ return t?.observe(M), Ie(!0), () => {
1946
+ document.removeEventListener("visibilitychange", e), t?.disconnect();
1947
+ };
1925
1948
  }), g(() => {
1926
- typeof cancelAnimationFrame < "u" && cancelAnimationFrame(N), typeof window < "u" && V();
1949
+ W(), typeof window < "u" && Oe();
1927
1950
  });
1928
- function Ae(e) {
1951
+ function Le(e) {
1929
1952
  let t = {
1930
- fill: e.color ?? (e.depth === void 0 ? se() : Ge(y.paper, se(), e.depth)),
1953
+ fill: e.color ?? (e.depth === void 0 ? se() : Ke(y.paper, se(), e.depth)),
1931
1954
  opacity: e.opacity
1932
1955
  };
1933
1956
  return e.d ? {
@@ -1941,30 +1964,32 @@ function ln(l) {
1941
1964
  r: e.r
1942
1965
  };
1943
1966
  }
1944
- let U = () => n(u, {
1967
+ let G = () => n(u, {
1945
1968
  get each() {
1946
1969
  return j().dots;
1947
1970
  },
1971
+ keyed: !1,
1948
1972
  children: (t) => n(e, a({ get component() {
1949
- return t.d ? "path" : "circle";
1950
- } }, () => Ae(t)))
1973
+ return t().d ? "path" : "circle";
1974
+ } }, () => Le(t())))
1951
1975
  });
1952
- var W = tn(), je = W.firstChild, G = je.firstChild, Me = G.firstChild, Ne = Me.nextSibling, Pe = Ne.nextSibling, Fe = je.nextSibling, Ie = Fe.nextSibling, K = Ie.firstChild, Le = K.nextSibling, q = Le.firstChild, Re = Ie.nextSibling, ze = Re.nextSibling, J = M;
1953
- return typeof J == "function" || Array.isArray(J) ? o(() => J, W) : M = W, s(W, "viewBox", "-158 -158 316 316"), s(G, "id", fe), s(G, "x", -158), s(G, "y", -158), s(G, "width", 316), s(G, "height", 316), i(G, n(u, {
1976
+ var K = tn(), Re = K.firstChild, q = Re.firstChild, ze = q.firstChild, Be = ze.nextSibling, Ue = Be.nextSibling, J = Re.nextSibling, Y = J.nextSibling, qe = Y.firstChild, Je = qe.nextSibling, X = Je.firstChild, Ye = Y.nextSibling, Xe = Ye.nextSibling, Ze = M;
1977
+ return typeof Ze == "function" || Array.isArray(Ze) ? o(() => Ze, K) : M = K, s(K, "viewBox", "-158 -158 316 316"), s(q, "id", fe), s(q, "x", -158), s(q, "y", -158), s(q, "width", 316), s(q, "height", 316), i(q, n(u, {
1954
1978
  get each() {
1955
1979
  return j().eyes;
1956
1980
  },
1981
+ keyed: !1,
1957
1982
  children: (e) => (() => {
1958
1983
  var t = nn();
1959
1984
  return r(() => ({
1960
- e: e.d,
1961
- t: e.matrix,
1962
- a: e.alpha
1985
+ e: e().d,
1986
+ t: e().matrix,
1987
+ a: e().alpha
1963
1988
  }), ({ e, t: n, a: r }, i) => {
1964
1989
  e !== i?.e && s(t, "d", e), n !== i?.t && s(t, "transform", n), r !== i?.a && s(t, "opacity", r);
1965
1990
  }), t;
1966
1991
  })()
1967
- }), Ne), i(G, n(d, {
1992
+ }), Be), i(q, n(d, {
1968
1993
  get when() {
1969
1994
  return j().notch;
1970
1995
  },
@@ -1978,64 +2003,70 @@ function ln(l) {
1978
2003
  e !== i?.e && s(t, "cx", e), n !== i?.t && s(t, "cy", n), r !== i?.a && s(t, "r", r);
1979
2004
  }), t;
1980
2005
  })()
1981
- }), Pe), i(je, n(u, {
2006
+ }), Ue), i(Re, n(u, {
1982
2007
  get each() {
1983
2008
  return j().arcs;
1984
2009
  },
2010
+ keyed: !1,
1985
2011
  children: (e) => (() => {
1986
2012
  var t = an();
1987
2013
  return i(t, n(u, {
1988
2014
  get each() {
1989
- return e.grad.stops;
2015
+ return e().grad.stops;
1990
2016
  },
2017
+ keyed: !1,
1991
2018
  children: (t, n) => (() => {
1992
2019
  var i = on();
1993
- return s(i, "stop-color", t), r(() => n() / (e.grad.stops.length - 1), (e) => {
1994
- s(i, "offset", e);
2020
+ return r(() => ({
2021
+ e: n / (e().grad.stops.length - 1),
2022
+ t: t()
2023
+ }), ({ e, t }, n) => {
2024
+ e !== n?.e && s(i, "offset", e), t !== n?.t && s(i, "stop-color", t);
1995
2025
  }), i;
1996
2026
  })()
1997
2027
  })), r(() => ({
1998
- e: `${de}-${e.id}`,
1999
- t: e.grad.x1,
2000
- a: e.grad.y1,
2001
- o: e.grad.x2,
2002
- i: e.grad.y2
2028
+ e: `${de}-${e().id}`,
2029
+ t: e().grad.x1,
2030
+ a: e().grad.y1,
2031
+ o: e().grad.x2,
2032
+ i: e().grad.y2
2003
2033
  }), ({ e, t: n, a: r, o: i, i: a }, o) => {
2004
2034
  e !== o?.e && s(t, "id", e), n !== o?.t && s(t, "x1", n), r !== o?.a && s(t, "y1", r), i !== o?.o && s(t, "x2", i), a !== o?.i && s(t, "y2", a);
2005
2035
  }), t;
2006
2036
  })()
2007
- }), null), i(Fe, n(u, {
2037
+ }), null), i(J, n(u, {
2008
2038
  get each() {
2009
2039
  return j().arcs;
2010
2040
  },
2041
+ keyed: !1,
2011
2042
  children: (e) => (() => {
2012
2043
  var t = sn();
2013
2044
  return r(() => ({
2014
- e: e.back,
2015
- t: `url(#${de}-${e.id})`,
2016
- a: e.width,
2017
- o: e.opacity
2045
+ e: e().back,
2046
+ t: `url(#${de}-${e().id})`,
2047
+ a: e().width,
2048
+ o: e().opacity
2018
2049
  }), ({ e, t: n, a: r, o: i }, a) => {
2019
2050
  e !== a?.e && s(t, "d", e), n !== a?.t && s(t, "stroke", n), r !== a?.a && s(t, "stroke-width", r), i !== a?.o && s(t, "opacity", i);
2020
2051
  }), t;
2021
2052
  })()
2022
- })), i(W, n(d, {
2053
+ })), i(K, n(d, {
2023
2054
  get when() {
2024
2055
  return j().dotsBehind;
2025
2056
  },
2026
2057
  get children() {
2027
2058
  var e = en();
2028
- return i(e, n(U, {})), e;
2059
+ return i(e, n(G, {})), e;
2029
2060
  }
2030
- }), Fe.nextSibling), s(Le, "mask", `url(#${fe})`), s(q, "x", -158), s(q, "y", -158), s(q, "width", 316), s(q, "height", 316), i(W, n(d, {
2061
+ }), J.nextSibling), s(Je, "mask", `url(#${fe})`), s(X, "x", -158), s(X, "y", -158), s(X, "width", 316), s(X, "height", 316), i(K, n(d, {
2031
2062
  get when() {
2032
2063
  return !j().dotsBehind;
2033
2064
  },
2034
2065
  get children() {
2035
2066
  var e = en();
2036
- return i(e, n(U, {})), e;
2067
+ return i(e, n(G, {})), e;
2037
2068
  }
2038
- }), Re), i(W, n(d, {
2069
+ }), Ye), i(K, n(d, {
2039
2070
  get when() {
2040
2071
  return j().notif;
2041
2072
  },
@@ -2049,17 +2080,18 @@ function ln(l) {
2049
2080
  e !== i?.e && s(t, "cx", e), n !== i?.t && s(t, "cy", n), r !== i?.a && s(t, "r", r);
2050
2081
  }), t;
2051
2082
  })()
2052
- }), Re.nextSibling), i(ze, n(u, {
2083
+ }), Ye.nextSibling), i(Xe, n(u, {
2053
2084
  get each() {
2054
2085
  return j().arcs;
2055
2086
  },
2087
+ keyed: !1,
2056
2088
  children: (e) => (() => {
2057
2089
  var t = sn();
2058
2090
  return r(() => ({
2059
- e: e.front,
2060
- t: `url(#${de}-${e.id})`,
2061
- a: e.width,
2062
- o: e.opacity
2091
+ e: e().front,
2092
+ t: `url(#${de}-${e().id})`,
2093
+ a: e().width,
2094
+ o: e().opacity
2063
2095
  }), ({ e, t: n, a: r, o: i }, a) => {
2064
2096
  e !== a?.e && s(t, "d", e), n !== a?.t && s(t, "stroke", n), r !== a?.a && s(t, "stroke-width", r), i !== a?.o && s(t, "opacity", i);
2065
2097
  }), t;
@@ -2076,8 +2108,8 @@ function ln(l) {
2076
2108
  r: y.paper,
2077
2109
  d: se()
2078
2110
  }), ({ e, t: n, a: r, o: i, i: a, n: o, s: l, h: u, r: d, d: f }, p) => {
2079
- e !== p?.e && s(W, "width", e), n !== p?.t && s(W, "height", n), r !== p?.a && s(W, "aria-label", r), t(W, i, p?.o), c(W, a, p?.i), o !== p?.n && s(Me, "d", o), l !== p?.s && s(Ie, "opacity", l), u !== p?.h && s(K, "d", u), d !== p?.r && s(K, "fill", d), f !== p?.d && s(q, "fill", f);
2080
- }), W;
2111
+ e !== p?.e && s(K, "width", e), n !== p?.t && s(K, "height", n), r !== p?.a && s(K, "aria-label", r), t(K, i, p?.o), c(K, a, p?.i), o !== p?.n && s(ze, "d", o), l !== p?.s && s(Y, "opacity", l), u !== p?.h && s(qe, "d", u), d !== p?.r && s(qe, "fill", d), f !== p?.d && s(X, "fill", f);
2112
+ }), K;
2081
2113
  }
2082
2114
  //#endregion
2083
- export { ln as BloubBot, Dt as BotEngine, He as COLORS, Ue as COLOR_BY_ID, We as DEFAULT_COLOR, xe as DEFAULT_EXPRESSION, Ve as DEFAULT_SHAPE, $t as DEMI_VIEWBOX, ye as EXPRESSIONS, be as EXPRESSION_BY_ID, Nt as MAX_BLOCK, Pt as MAX_BLOCS, Ft as MAX_CYCLES, Mt as MIN_BLOCK, nt as POSES, Qt as RAYON, rt as SEQUENCE, J as SHAPES, Be as SHAPE_BY_ID, tt as STATES, Z as STATE_BY_ID, It as STEP, kt as TOUR_TIME, Ot as TURN_TIME, Ce as blendExpression, Wt as blockAt, Gt as blocksWith, zt as clampDuration, Vt as defaultCycle, jt as lookTarget, Bt as makeBlock, Rt as minDurationOf, Ge as mixHex, Kt as moveBlock, Jt as nextCycleId, Ut as offsetOf, Zt as parseCycles, Ht as totalDuration, At as tourLook, qt as uniqueName };
2115
+ export { ln as BloubBot, Dt as BotEngine, Ue as COLORS, We as COLOR_BY_ID, Ge as DEFAULT_COLOR, xe as DEFAULT_EXPRESSION, He as DEFAULT_SHAPE, $t as DEMI_VIEWBOX, ye as EXPRESSIONS, be as EXPRESSION_BY_ID, Nt as MAX_BLOCK, Pt as MAX_BLOCS, Ft as MAX_CYCLES, Mt as MIN_BLOCK, nt as POSES, Qt as RAYON, rt as SEQUENCE, Be as SHAPES, Ve as SHAPE_BY_ID, tt as STATES, Z as STATE_BY_ID, It as STEP, kt as TOUR_TIME, Ot as TURN_TIME, Ce as blendExpression, Wt as blockAt, Gt as blocksWith, zt as clampDuration, Vt as defaultCycle, jt as lookTarget, Bt as makeBlock, Rt as minDurationOf, Ke as mixHex, Kt as moveBlock, Jt as nextCycleId, Ut as offsetOf, Zt as parseCycles, Ht as totalDuration, At as tourLook, qt as uniqueName };
@@ -1 +1 @@
1
- import{Dynamic as e,escape as t,mergeProps as n,ssr as r,ssrAttribute as i,ssrClassName as a,ssrGroup as o,ssrHydrationKey as s,ssrStyle as c}from"@solidjs/web";import{For as l,Show as u,createEffect as d,createMemo as f,createSignal as p,createUniqueId as m,onCleanup as h,onSettled as g,untrack as _}from"solid-js";var v=Math.PI*2,y=(e,t=0,n=1)=>e<t?t:e>n?n:e,b=(e,t,n)=>e+(t-e)*n,x={easeOutCubic:e=>1-(1-e)**3,easeInOutCubic:e=>e<.5?4*e**3:1-(-2*e+2)**3/2,easeOutQuint:e=>1-(1-e)**5};function S(e,t,n=0){let r=e/t*v;return .55*Math.sin(r+n)+.3*Math.sin(2*r+n*1.7+1.1)+.15*Math.sin(3*r+n*2.3+2.4)}function C(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}var w=e=>Math.round(e*100)/100;function T(e,t=.55,n=.62){let r=(e%360+360)%360,i=(1-Math.abs(2*n-1))*t,a=i*(1-Math.abs(r/60%2-1)),o=n-i/2,[s,c,l]=r<60?[i,a,0]:r<120?[a,i,0]:r<180?[0,i,a]:r<240?[0,a,i]:r<300?[a,0,i]:[i,0,a],u=e=>Math.round((e+o)*255).toString(16).padStart(2,`0`);return`#${u(s)}${u(c)}${u(l)}`}function ee(e,t,n,r,i=1){let a=e.phase+t*e.speed*v,o=Math.cos(e.tilt),s=Math.sin(e.tilt),c=Math.sqrt(Math.max(0,1-e.k*e.k)),l=e.sweep*v,u=``,d=``,f=null;for(let t=0;t<=64;t++){let r=a+t/64*l,i=Math.cos(r),p=Math.sin(r),m=e.a*(i*o+p*-s*e.k)+e.cx,h=e.a*(i*s+p*o*e.k)+e.cy,g=e.a*p*c<0,_=w(m*n),v=w(h*n),y=g===f?`L`:`M`;g?d+=`${y}${_} ${v}`:u+=`${y}${_} ${v}`,f=g}let p=Math.cos(e.tilt)*e.a*n,m=Math.sin(e.tilt)*e.a*n;return{id:r,front:u,back:d,width:e.width*n,opacity:i,grad:{x1:w(e.cx*n-p),y1:w(e.cy*n-m),x2:w(e.cx*n+p),y2:w(e.cy*n+m),stops:[T(e.hue),T(e.hue+e.hueSpan*.5),T(e.hue+e.hueSpan)]}}}var E=C(659918),te=Array.from({length:6},(e,t)=>({a:1.3+E()*.1,k:.05+E()*.4,tilt:t/6*Math.PI+E()*.5,speed:3+E()*.7,phase:E()*v,sweep:.6+E()*.25,hue:t*360/6+E()*30,hueSpan:60+E()*60,width:.05+E()*.012,cx:0,cy:.1})),ne=Array.from({length:4},(e,t)=>({a:.78+t*.2,k:.05+t*.02,tilt:-.62+t*.05,speed:.3,phase:.06*t,sweep:.4,hue:95+t*62,hueSpan:100,width:.05,cx:0,cy:-.12})),re=[-.557,-.013,.532],D=.165,O=1.25,k=C(48879),ie=Array.from({length:5},(e,t)=>({birth:t*.2,angle:k()*v,rho:.58+k()*.18}));function ae(e,t){let n=[];for(let r of ie){let i=e-r.birth;if(i<0||i>.62)continue;let a=r.rho*.75**(i*10),o=r.angle+i*100*Math.PI/180;n.push({x:Math.cos(o)*a*t,y:Math.sin(o)*a*t,r:(.04+.028*y(i/.55))*t,depth:y(1-a/.8),opacity:y(i/.06)*y((.62-i)/.08)})}return n}var oe=C(49383),se=Array.from({length:4},(e,t)=>{let n=t-1.5;return{a:.85*(1+n*.03),k:.15/.85*(1+n*.16),tilt:34*Math.PI/180+n*.035,speed:210/360,phase:-t*.045+oe()*.012,sweep:.34,hue:t*85+oe()*20,hueSpan:80,width:.095,cx:0,cy:0}}),ce=.129,le=`#2496e8`,ue=1.003,de=.15,A=1.14,j=.054,M=15.46,N=.186,fe=.412,P={yaw:28.49,pitch:28.62,roll:-13},F=e=>e*Math.PI/180;function I(e,t,n){let r=Math.cos(n),i=Math.sin(n);return[[e[0]*r+t[0]*i,e[1]*r+t[1]*i,e[2]*r+t[2]*i],[t[0]*r-e[0]*i,t[1]*r-e[1]*i,t[2]*r-e[2]*i]]}function L(e,t,n=M){let r=[0,0,1],i=[1,0,0],a=[0,1,0];[r,i]=I(r,i,F(e.yaw)),[a,r]=I(a,r,F(e.pitch)),[i,a]=I(i,a,F(e.roll));let o=e=>{let[o,s]=I(r,i,F(n*e));return{x:o[0]*t,y:o[1]*t,a:s[0],b:s[1],c:a[0],d:a[1],depth:o[2]}};return[o(-1),o(1)]}var R=C(24301),z=(()=>{let e=[],t=1.4;for(;t<900;)e.push(t),t+=1.9+R()*2.7,R()<.18&&(e.push(t),t+=.24);return e})(),pe=.18;function B(e){for(let t=0;t<z.length;t++){let n=z[t];if(e<n)break;let r=(e-n)/pe;if(r>=0&&r<=1)return r<.45?1-r/.45:(r-.45)/.55}return 1}function me(e,t={}){let{wander:n=1,blink:r=!0,float:i=!0}=t;return{dYaw:(S(e,11.3,.4)*5.5+S(e,3.7,2.1)*1.6)*n,dPitch:(S(e,9.1,1.3)*4.2+S(e,4.3,.7)*1.3)*n,dRoll:S(e,13.7,3.2)*2.2*n,lid:r?B(e):1,driftX:i?S(e,7.9,1.9)*.006:0,driftY:i?S(e,5.3,.3)*.007:0,breath:i?1+Math.sin(e/3.4*Math.PI*2)*.005:1}}function he(e){return .06+.94*y(e)}var V=(e,t,n=0,r=1)=>({w:e,h:t,tilt:n,open:r}),H=(e,t,n=0,r=1)=>[V(e,t,n,r),V(e,t,-n,r)],U=[{id:`neutre`,gaze:{...P},split:M,eyes:[V(N,fe),V(N,fe)]},{id:`attentif`,gaze:{yaw:4,pitch:5,roll:-4},split:16,eyes:H(.21,.44)},{id:`surpris`,gaze:{yaw:3,pitch:-3,roll:0},split:19,eyes:H(.45,.47)},{id:`excite`,gaze:{yaw:6,pitch:-14,roll:0},split:19.5,eyes:H(.4,.56,-10)},{id:`heureux`,gaze:{yaw:5,pitch:9,roll:0},split:17,eyes:H(.27,.17,14)},{id:`hilare`,gaze:{yaw:4,pitch:14,roll:0},split:18,eyes:H(.34,.13,20)},{id:`colere`,gaze:{yaw:3,pitch:7,roll:0},split:17,eyes:H(.34,.15,30)},{id:`triste`,gaze:{yaw:3,pitch:-13,roll:0},split:16,eyes:H(.22,.4,-28)},{id:`effraye`,gaze:{yaw:2,pitch:-20,roll:0},split:20.5,eyes:H(.4,.6)},{id:`mefiant`,gaze:{yaw:12,pitch:6,roll:-6},split:16,eyes:[V(.21,.4),V(.22,.15)]},{id:`confus`,gaze:{yaw:-14,pitch:3,roll:8},split:16.5,eyes:[V(.2,.44,-18),V(.28,.17,14)]},{id:`curieux`,gaze:{yaw:16,pitch:-9,roll:-15},split:16.5,eyes:[V(.24,.46,-8),V(.2,.38,-8)]},{id:`fier`,gaze:{yaw:5,pitch:17,roll:0},split:17,eyes:H(.3,.15,18)},{id:`timide`,gaze:{yaw:-19,pitch:-14,roll:-7},split:14,eyes:H(.17,.3)},{id:`blase`,gaze:{yaw:-22,pitch:2,roll:0},split:16,eyes:H(.3,.12)},{id:`somnolent`,gaze:{yaw:6,pitch:-9,roll:-3},split:16,eyes:H(.2,.42,0,.42)}],ge=new Map(U.map(e=>[e.id,e])),_e=`neutre`,ve=(e,t,n)=>({w:b(e.w,t.w,n),h:b(e.h,t.h,n),tilt:b(e.tilt??0,t.tilt??0,n),open:b(e.open,t.open,n)});function ye(e,t,n){return{id:t.id,gaze:{yaw:b(e.gaze.yaw,t.gaze.yaw,n),pitch:b(e.gaze.pitch,t.gaze.pitch,n),roll:b(e.gaze.roll,t.gaze.roll,n)},split:b(e.split,t.split,n),eyes:[ve(e.eyes[0],t.eyes[0],n),ve(e.eyes[1],t.eyes[1],n)]}}var be={egg:[.8369,.8424,.8497,.8585,.8674,.8775,.8878,.8983,.9089,.9185,.9288,.9374,.9445,.9504,.9543,.9559,.9555,.9519,.9466,.9389,.9302,.9193,.9085,.8969,.8852,.8734,.8625,.8513,.8411,.8325,.8243,.8179,.8137,.8112,.8102,.8128,.8178,.8262,.8374,.8518,.8702,.8922,.9169,.9446,.9741,1.0023,1.0267,1.0433,1.0481,1.0393,1.0216,.997,.9697,.9418,.9169,.8949,.876,.8604,.849,.8394,.8337,.8314,.8305,.8326],hexagon:[.921,.9282,.9441,.9706,.9984,1.0059,.9896,.9562,.929,.9124,.9047,.9058,.9157,.9349,.9642,.9873,.9882,.9665,.9336,.9105,.8968,.8918,.8955,.908,.9293,.9611,.982,.9812,.959,.9282,.9089,.8978,.8964,.9026,.9189,.9439,.9778,.999,.9964,.9713,.9439,.9274,.9196,.9206,.9308,.9502,.9799,1.0121,1.0226,1.0071,.9752,.951,.9366,.9316,.9351,.9485,.9711,1.0026,1.0213,1.0155,.9863,.9547,.9347,.9232],triangle:[.7819,.8211,.8747,.944,1.0223,1.096,1.1401,1.134,1.0808,1.0047,.9265,.8603,.8104,.773,.745,.7273,.7151,.7118,.7148,.7245,.7427,.768,.8037,.8518,.9148,.9876,1.0583,1.1073,1.1109,1.0667,.994,.9164,.8482,.7948,.7555,.7261,.7056,.6925,.6859,.6869,.6938,.7084,.7305,.7615,.804,.8595,.9311,1.0092,1.0791,1.1171,1.1054,1.0501,.9779,.905,.845,.799,.7656,.7413,.7258,.716,.7146,.7204,.733,.7528]},xe=Array.from({length:64},(e,t)=>t/64*v),W=xe.map(Math.cos),Se=xe.map(Math.sin);function Ce(e,t={}){return{radii:[...be[e]],rot:0,cx:0,cy:0,sx:1,sy:1,...t}}function G(e,t={}){return{radii:Array(64).fill(e),rot:0,cx:0,cy:0,sx:1,sy:1,...t}}function we(e,t,n,r){let i=r??{radii:Array(64),rot:0,cx:0,cy:0,sx:1,sy:1};for(let r=0;r<64;r++)i.radii[r]=b(e.radii[r]??1,t.radii[r]??1,n);let a=t.rot-e.rot;for(;a>Math.PI;)a-=v;for(;a<-Math.PI;)a+=v;return i.rot=e.rot+a*n,i.cx=b(e.cx,t.cx,n),i.cy=b(e.cy,t.cy,n),i.sx=b(e.sx,t.sx,n),i.sy=b(e.sy,t.sy,n),i}function K(e,t,n=[]){let r=Math.cos(e.rot),i=Math.sin(e.rot);for(let a=0;a<64;a++){let o=e.radii[a]??1,s=o*(W[a]??0),c=o*(Se[a]??0),l=s*r-c*i,u=s*i+c*r,d=n[a]??{x:0,y:0};d.x=(l*e.sx+e.cx)*t,d.y=(u*e.sy+e.cy)*t,n[a]=d}return n.length=64,n}function Te(e,t=1/6){let n=e.length;if(n<3)return``;let r=e[0],i=`M${w(r.x)} ${w(r.y)}`;for(let r=0;r<n;r++){let a=e[(r-1+n)%n],o=e[r],s=e[(r+1)%n],c=e[(r+2)%n],l=o.x+(s.x-a.x)*t,u=o.y+(s.y-a.y)*t,d=s.x-(c.x-o.x)*t,f=s.y-(c.y-o.y)*t;i+=`C${w(l)} ${w(u)} ${w(d)} ${w(f)} ${w(s.x)} ${w(s.y)}`}return`${i}Z`}function q(e,t,n){let r=Array(64).fill(0),i=e.length;for(let a=0;a<64;a++){let o=W[a]??0,s=Se[a]??0,c=0;for(let r=0;r<i;r++){let a=e[r],l=e[(r+1)%i],u=l.x-a.x,d=l.y-a.y,f=o*d-s*u;if(Math.abs(f)<1e-9)continue;let p=a.x-t,m=a.y-n,h=(p*d-m*u)/f,g=(p*s-m*o)/f;h>c&&g>=0&&g<=1&&(c=h)}r[a]=c}return r}function J(e,t,n,r,i,a,o=96){let s=r-e,c=i-t,l=Math.hypot(s,c)||1e-6,u=Math.atan2(c,s),d=Math.acos(Math.max(-1,Math.min(1,(n-a)/l))),f=[];for(let r=0;r<=o/2;r++){let i=u+d+(v-2*d)*r/(o/2);f.push({x:e+Math.cos(i)*n,y:t+Math.sin(i)*n})}for(let e=0;e<=o/2;e++){let t=u-d+2*d*e/(o/2);f.push({x:r+Math.cos(t)*a,y:i+Math.sin(t)*a})}return f}function Ee(e,t){let n=e.length,r=(t/v%1+1)%1*n,i=Math.floor(r);return b(e[i%n]??1,e[(i+1)%n]??1,r-i)}function De(e,t=1,n=1){return xe.map((r,i)=>(Math.abs((W[i]??0)/t)**e+Math.abs((Se[i]??0)/n)**e)**(-1/e))}function Oe(e){let t=Array(64).fill(0);for(let n=0;n<64;n++){let r=W[n]??0,i=Se[n]??0,a=0;for(let t of e){let e=r*t.x+i*t.y,n=e*e-(t.x*t.x+t.y*t.y-t.r*t.r);if(n<0)continue;let o=e+Math.sqrt(n);o>a&&(a=o)}t[n]=a}return t}function ke(e,t,n=10){let r=e.length,i=[],a=(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1;return Math.atan2(-n/i,r/i)};for(let o=0;o<r;o++){let s=e[(o-1+r)%r],c=e[o],l=e[(o+1)%r],u=a(s,c),d=a(c,l)-u;for(;d>Math.PI;)d-=v;for(;d<-Math.PI;)d+=v;for(let e=0;e<=n;e++){let r=u+d*e/n;i.push({x:c.x+Math.cos(r)*t,y:c.y+Math.sin(r)*t})}}return i}function Ae(e,t,n,r=0){let i=r*Math.PI/180;return q(ke(Array.from({length:e},(r,a)=>{let o=i+a/e*v;return{x:Math.cos(o)*(t-n),y:Math.sin(o)*(t-n)}}),n),0,0)}function je(e,t=1){if(e.length<3)return``;let n=``;for(let r=0;r<e.length;r++){let i=e[r];n+=`${r===0?`M`:`L`}${w(i.x*t)} ${w(i.y*t)}`}return`${n}Z`}function Me(e,t){let n=Math.max(e,.01)/2,r=Math.max(t,.01)/2,i=Math.min(n,r);return`M${w(-n)} ${w(-r+i)}A${w(i)} ${w(i)} 0 0 1 ${w(-n+i)} ${w(-r)}L${w(n-i)} ${w(-r)}A${w(i)} ${w(i)} 0 0 1 ${w(n)} ${w(-r+i)}L${w(n)} ${w(r-i)}A${w(i)} ${w(i)} 0 0 1 ${w(n-i)} ${w(r)}L${w(-n+i)} ${w(r)}A${w(i)} ${w(i)} 0 0 1 ${w(-n)} ${w(r-i)}Z`}function Ne(e,t=1){let n=Math.max(...e);if(n<=0)return e;let r=t/n;return e.map(e=>e*r)}var Pe=Ne(Array.from({length:64},(e,t)=>t/64*Math.PI*2).map(e=>1+.075*Math.cos(2*e+.5)+.035*Math.cos(3*e+2.1)),1.02),Fe=Ne(Oe([{x:-.44,y:.2,r:.54},{x:.46,y:.2,r:.5},{x:.02,y:.3,r:.6},{x:-.24,y:-.3,r:.48},{x:.3,y:-.24,r:.44}]),1.02),Ie=Ne(q(J(0,.28,.66,0,-.96,.05),0,0),1.04),Le=q(J(-.42,0,.62,.42,0,.62),0,0),Re=[{id:`cercle`,radii:Array(64).fill(1)},{id:`galet`,radii:Pe},{id:`squircle`,radii:Ne(De(4.2),1.15)},{id:`capsule`,radii:Le},{id:`triangle`,radii:Ae(3,1.12,.34,-90)},{id:`hexagone`,radii:Ae(6,1.04,.26,0)},{id:`nuage`,radii:Fe},{id:`goutte`,radii:Ie}],ze=new Map(Re.map(e=>[e.id,e])),Be=`cercle`,Ve=[{id:`encre`,hex:`#0a0a0c`},{id:`brun`,hex:`#8b5e3c`},{id:`rouge`,hex:`#e8483f`},{id:`orange`,hex:`#f08a24`},{id:`ambre`,hex:`#f0b429`},{id:`vert`,hex:`#3ecf8e`},{id:`turquoise`,hex:`#2fbfa0`},{id:`bleu`,hex:`#3b93f0`},{id:`violet`,hex:`#8b5cf6`},{id:`rose`,hex:`#e152b0`},{id:`gris`,hex:`#a3a3a3`},{id:`creme`,hex:`#f1efe9`}],He=new Map(Ve.map(e=>[e.id,e])),Ue=`encre`;function We(e,t,n){let r=e=>{let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]},i=r(e),a=r(t);return`#${i.map((e,t)=>Math.round(e+(a[t]-e)*n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}var Y=(e,t)=>[{w:e,h:t,open:1},{w:e,h:t,open:1}];function X(e={}){return{sil:G(1),offX:0,offY:0,gaze:{...P},split:M,eyes:Y(N,fe),eyeAlpha:1,bodyAlpha:1,dots:[],arcs:[],notif:null,dotsBehind:!1,...e}}var Ge=-.1875,Ke=q(J(0,-.505,.132,0,.13,.075),0,Ge),qe=q(J(0,-.2535,.1345,0,.2535,.1345),0,0),Je=(e={})=>({radii:[...Ke],rot:0,cx:0,cy:Ge,sx:1,sy:1,...e}),Ye=(e={})=>({radii:[...qe],rot:0,cx:0,cy:0,sx:1,sy:1,...e}),Xe=je(J(0,0,.118,0,.172,.012)),Ze=.213;function Qe(e){return Ce(`triangle`,{rot:e,cx:-.213*Math.sin(e),cy:Ze*Math.cos(e)})}function $e(e,t){let n=((e-t*.5)/1.5%1+1)%1;return y((n<.5?.5-.5*Math.cos(n*v):0)*2)}var et=[{id:`idle`,duration:2.4,morph:.45,blinkIn:!1,baseFace:!0,baseBody:!0,pose:()=>X()},{id:`thinking`,duration:2.6,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:e=>{let t=$e(e,1),n=.3+.7*x.easeOutCubic(y(e/.3));return X({sil:G(D*(1+(O-1)*t),{cx:re[1]}),eyeAlpha:0,dots:[0,2].map(t=>{let r=$e(e,t);return{x:re[t]*n,y:0,r:D*(1+(O-1)*r),opacity:.55+.45*r}})})}},{id:`wink`,duration:1.6,morph:.3,blinkIn:!0,baseFace:!1,baseBody:!0,pose:()=>X({gaze:{yaw:-5.37,pitch:4.55,roll:6.7},split:16.25,eyes:[{w:.236,h:.464,open:1},{w:.447,h:.089,open:1}]})},{id:`wide`,duration:1.8,morph:.55,blinkIn:!0,baseFace:!1,baseBody:!0,pose:()=>X({gaze:{yaw:6.92,pitch:-21.96,roll:11.6},split:18.43,eyes:Y(.356,.875)})},{id:`alert`,duration:2.4,minDuration:2,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=y(e/1.5),n=x.easeInOutCubic(t)*.82-.087,r=e>1.6?y((e-1.6)/.4):0,i=n*(1-r)+.1*r,a=Math.sin(e*2.5*v)*.005,o=17.7*Math.PI/180;return X({sil:Ye({rot:o,cx:i,cy:-.325-a}),eyeAlpha:0,dots:[{x:i-Math.sin(o)*.58,y:-.325+Math.cos(o)*.58+a*2.8,r:.118,d:Xe,rot:o*180/Math.PI,opacity:1}]})}},{id:`notify`,duration:2.2,morph:.5,blinkIn:!0,baseFace:!1,baseBody:!0,pose:e=>{let t=y(e/.45),n=1+(A-1)*Math.sin(t*Math.PI)*(1-t*.35),r=de*(t<1?n:1),i=-42*Math.PI/180;return X({gaze:{yaw:-21.94,pitch:-5.82,roll:-12.2},split:18.89,eyes:Y(.505,.498),notif:{x:Math.cos(i)*ue,y:Math.sin(i)*ue,r,notch:r+j}})}},{id:`exclaim`,duration:2,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:()=>X({sil:Je(),eyeAlpha:0,dots:[{x:-.012,y:.526,r:.113,opacity:1}]})},{id:`sleep`,duration:2.4,morph:.5,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>X({sil:G(.1585,{cy:.11+Math.sin(v/.6*e)*.19}),eyeAlpha:0})},{id:`egg`,duration:1.8,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:()=>X({sil:Ce(`egg`),gaze:{yaw:19.97,pitch:26.01,roll:-17.1},split:11.07,eyes:Y(.164,.385)})},{id:`hexagon`,duration:1.6,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:()=>X({sil:Ce(`hexagon`),gaze:{yaw:23.11,pitch:24.42,roll:-13.3},split:13.37,eyes:Y(.177,.411)})},{id:`play`,duration:2,morph:.5,baseFace:!1,baseBody:!1,blinkIn:!0,pose:e=>{let t=y(e/.35)*y((2.2-e)/.5);return X({sil:Qe(0),gaze:{yaw:12,pitch:-8,roll:-6},split:15,eyes:Y(.18,.34),arcs:ne.map((n,r)=>({id:`sw${r}`,seed:{...n,cx:.45-e*.42},t:e,opacity:t}))})}},{id:`orbit`,duration:3.4,minDuration:2.5,morph:.6,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=x.easeInOutCubic(y(e/.35)),n=-v*1.25*e*t,r=x.easeInOutCubic(y((e-1.6)/.9)),i=Qe(n),a=G(1,{rot:n}),o={radii:i.radii.map((e,t)=>e+(a.radii[t]-e)*r),rot:n,cx:i.cx*(1-r),cy:i.cy*(1-r),sx:1,sy:1},s=y(e/.8)*y((3.6-e)/.9);return X({sil:o,gaze:{yaw:P.yaw+Math.sin(e*6.5)*65*(1-r),pitch:-4+r*32,roll:-13},eyes:Y(.18,.34+r*.07),arcs:te.map((t,n)=>({id:`rg${n}`,seed:t,t:e,opacity:s*y((e-n*.13)/.3)}))})}},{id:`swirl`,duration:1.3,minDuration:1.3,morph:.3,baseFace:!0,baseBody:!0,blinkIn:!0,pose:e=>X({arcs:te.slice(0,3).map((t,n)=>({id:`sw${n}`,seed:t,t:e,opacity:y((e-n*.06)/.14)*y((1.22-e)/.34)}))})},{id:`burst`,duration:2.6,minDuration:2.4,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=1-.834*x.easeOutQuint(y(e/.7)),n=x.easeOutQuint(y((e-1.7)/.7));return X({sil:G(t+(1-t)*n),eyeAlpha:y((e-1.85)/.4),dots:ae(e,1),dotsBehind:!0})}},{id:`comet`,duration:2.4,minDuration:2.4,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=1-(1-ce)*x.easeOutQuint(y(e/.55)),n=x.easeOutQuint(y((e-1.85)/.6)),r=y((e-.15)/.25)*y((1.95-e)/.3);return X({sil:G(t+(1-t)*n,{cy:Math.sin(y(e/1.7)*Math.PI)*.035}),eyeAlpha:y((e-2)/.35),arcs:se.map((t,n)=>({id:`cm${n}`,seed:t,t:e,opacity:r}))})}}],Z=new Map(et.map(e=>[e.id,e])),tt={idle:1,thinking:1.1,wink:.8,wide:.8,alert:.75,notify:.9,exclaim:.8,sleep:.45,egg:.8,hexagon:.8,play:.9,orbit:1.2,swirl:.5,burst:.45,comet:1.15},nt=[`idle`,`thinking`,`wink`,`wide`,`alert`,`notify`,`exclaim`,`sleep`,`egg`,`hexagon`,`play`,`orbit`,`burst`,`comet`],Q=100,rt=7.1,it=5.5,at=.006,ot=.007;function st(e,t,n){let r=[],i=L(e.gaze,Q,e.split);for(let a=0;a<2;a++){let o=i[a];if(o.depth<=.02)continue;let s=e.eyes[a],c=(s.tilt??0)*Math.PI/180,l=Math.cos(c),u=Math.sin(c),d=o.a*l+o.c*u,f=o.b*l+o.d*u,p=-o.a*u+o.c*l,m=-o.b*u+o.d*l,h=Math.max(s.w*Q,.01)/2,g=Math.max(s.h*Q,.01)/2,_=Math.min(h,g),v=g>h,y=v?g-_:h-_,b=Ee(n,Math.atan2(o.y,o.x)-t.rot);r.push({x:o.x*b,y:o.y*b,ax:(v?p:d)*y,ay:(v?m:f)*y,r:_,m:[d,f,p,m]})}return r}function ct(e,t,n,r,i){let a=r-t,o=i-n,s=a*a+o*o,c=1/0,l=0,u=0;for(let r=0;r<e.length;r++){let i=e[r],d=s>0?((i.x-t)*a+(i.y-n)*o)/s:0;d=d<0?0:d>1?1:d;let f=t+d*a-i.x,p=n+d*o-i.y,m=f*f+p*p;m<c&&(c=m,l=f,u=p)}let d=Math.sqrt(c);return{d,ux:d>1e-9?l/d:0,uy:d>1e-9?u/d:0}}var lt=Math.hypot(at,ot)*Q;function ut(e,t,n,r){let i=1/0,a=0,o=0;for(let s of t){let t=s.x+n,c=s.y+r,l=ct(e,t-s.ax,c-s.ay,t+s.ax,c+s.ay),[u,d,f,p]=s.m,m=s.r*Math.hypot(u*l.ux+d*l.uy,f*l.ux+p*l.uy)+lt;l.d-m<i&&(i=l.d-m,a=l.ux,o=l.uy)}return{marge:i,ux:a,uy:o}}var dt=12,ft=8;function pt(e){if(!e.length)return{x:0,y:0};let t=(t,n)=>{let r=1/0;for(let i of e)r=Math.min(r,ut(i.contour,i.empreintes,t,n).marge);return r},n=1/0;for(let t of e)n=Math.min(n,ut(t.calContour,t.reference,0,0).marge);let r=0,i=0,a=e[0].empreintes;for(let e of a)r-=e.x/a.length,i-=e.y/a.length;let o=Math.max(.35*Q,Math.hypot(r,i)*1.25);n=Math.min(n,t(r,i));let s=t(0,0);if(s>=n&&s>=0)return{x:0,y:0};let c=Math.max(n,0),l=0,u=0,d=1/0,f=0,p=0,m=s;for(let e=0;e<dt;e++){let n=e/dt*Math.PI*2,r=Math.cos(n),i=Math.sin(n);if(t(r*o,i*o)<c){for(let e of[.3,.6,1]){let n=t(r*o*e,i*o*e);n>m&&(m=n,f=r*o*e,p=i*o*e)}continue}let a=0,s=o;for(let e=0;e<ft;e++){let e=(a+s)/2;t(r*e,i*e)>=c?s=e:a=e}s<d&&(d=s,l=r*s,u=i*s)}let h=d===1/0?f:l,g=d===1/0?p:u;return{x:+(h/Q).toFixed(6),y:+(g/Q).toFixed(6)}}function mt(e,t,n){return e.baseFace&&n?{gaze:n.gaze,split:n.split,eyes:n.eyes}:{gaze:t.gaze,split:t.split,eyes:t.eyes}}function ht(e){let t=e=>JSON.stringify([e.gaze,e.split,e.eyes,e.sil.rot,e.sil.cx,e.sil.cy,e.sil.sx,e.sil.sy]);return t(e.pose(0))===t(e.pose(e.duration))?[0]:Array.from({length:3},(t,n)=>n/2*e.duration)}function gt(e,t,n){let r=[];for(let i of ht(e)){let a=e.pose(i),o=K({...a.sil,radii:t},Q),s=K(a.sil,Q),c=mt(e,a,n),l=[];for(let e of[-7.1,rt])for(let t of[-5.5,it])l.push({...c,gaze:{yaw:c.gaze.yaw+e,pitch:c.gaze.pitch+t,roll:c.gaze.roll}});for(let e of l)r.push({empreintes:st(e,a.sil,t),reference:st(e,a.sil,a.sil.radii),contour:o,calContour:s})}return pt(r)}var _t={x:0,y:0},vt=(e,t)=>`${e}|${t??``}`;function yt(){return new Map(Re.map(e=>{let t=new Map;for(let n of et){if(!n.baseBody)continue;let r=n.baseFace?[null,...U]:[null];for(let i of r)t.set(vt(n.id,i?.id??null),gt(n,e.radii,i))}return[e.radii,t]}))}var bt=yt();function xt(e,t,n){if(!e)return _t;let r=bt.get(e);return r?r.get(vt(t,n))??r.get(vt(t,null))??_t:_t}var St={yaw:0,pitch:0,mix:0,spin:0,wander:1},Ct=(e,t,n)=>({yaw:b(e.yaw,t.yaw,n),pitch:b(e.pitch,t.pitch,n),mix:b(e.mix,t.mix,n),spin:b(e.spin,t.spin,n),wander:b(e.wander,t.wander,n)}),wt=(e,t,n)=>({w:b(e.w,t.w,n),h:b(e.h,t.h,n),open:b(e.open,t.open,n),tilt:b(e.tilt??0,t.tilt??0,n)});function Tt(e,t,n){let r=1-n;return{sil:we(e.sil,t.sil,n),offX:b(e.offX,t.offX,n),offY:b(e.offY,t.offY,n),gaze:{yaw:b(e.gaze.yaw,t.gaze.yaw,n),pitch:b(e.gaze.pitch,t.gaze.pitch,n),roll:b(e.gaze.roll,t.gaze.roll,n)},split:b(e.split,t.split,n),eyes:[wt(e.eyes[0],t.eyes[0],n),wt(e.eyes[1],t.eyes[1],n)],eyeAlpha:b(e.eyeAlpha,t.eyeAlpha,n),bodyAlpha:b(e.bodyAlpha,t.bodyAlpha,n),dots:[...e.dots.map(e=>({...e,opacity:e.opacity*r})),...t.dots.map(e=>({...e,opacity:e.opacity*n}))],arcs:[...e.arcs.map(e=>({...e,id:`a${e.id}`,opacity:e.opacity*r})),...t.arcs.map(e=>({...e,id:`b${e.id}`,opacity:e.opacity*n}))],notif:n<.5?e.notif:t.notif,dotsBehind:n<.5?e.dotsBehind:t.dotsBehind}}var Et=class e{scale;cur;prev=null;departFige=null;tCur=0;tPrev=0;blinkAt=-10;pts=[];shape=null;shapePrev=null;shapeAt=-10;expr=null;exprPrev=null;exprAt=-10;look=St;lookPrev=St;lookAt=-10;lookMorph=.24;static SHAPE_MORPH=.45;static LOOK_MORPH=.24;constructor(e=100,t=`idle`,n=null,r=null){this.scale=e,this.cur=t,this.shape=n,this.expr=r}setExpression(e,t=0){e!==this.expr&&(this.exprPrev=this.expr,this.expr=e,this.exprAt=t)}exprAtTime(t){let n=this.expr,r=this.exprPrev;if(!n||!r)return n;let i=(t-this.exprAt)/e.SHAPE_MORPH;return i>=1?n:ye(r,n,x.easeOutQuint(y(i)))}setShape(e,t=0){e!==this.shape&&(this.shapePrev=this.shape,this.shape=e,this.shapeAt=t)}shapeAtTime(t){let n=this.shape,r=this.shapePrev;if(!n||!r)return n;let i=(t-this.shapeAt)/e.SHAPE_MORPH;if(i>=1)return n;let a=x.easeOutQuint(y(i));return n.map((e,t)=>b(r[t]??e,e,a))}setLook(t,n,r=e.LOOK_MORPH){t&&!Number.isFinite(t.yaw+t.pitch+t.mix+t.spin+t.wander)||(this.lookPrev=this.lookAtTime(n),this.look=t??St,this.lookAt=n,this.lookMorph=r)}lookAtTime(e){let t=(e-this.lookAt)/this.lookMorph;return t>=1?this.look:Ct(this.lookPrev,this.look,x.easeOutQuint(y(t)))}posed(e,t,n,r){let i=e.pose(t);return e.baseBody&&n&&(i={...i,sil:{...i.sil,radii:n}}),e.baseFace&&r&&(i={...i,gaze:r.gaze,split:r.split,eyes:r.eyes}),i}decalageAtTime(t,n){let r=(e,n,r,i)=>{if(r===i)return i;let a=(t-e)/n;if(a>=1)return i;let o=x.easeOutQuint(y(a));return{x:b(r.x,i.x,o),y:b(r.y,i.y,o)}},i=t=>r(this.exprAt,e.SHAPE_MORPH,xt(t,n,this.exprPrev?.id??null),xt(t,n,this.expr?.id??null));return r(this.shapeAt,e.SHAPE_MORPH,i(this.shapePrev),i(this.shape))}get state(){return this.cur}reset(e,t){this.cur=e,this.prev=null,this.departFige=null,this.tCur=t,this.tPrev=t,this.blinkAt=-10}origine(e,t,n){if(this.departFige)return this.departFige;if(!this.prev)return null;let r=Z.get(this.prev);return this.posed(r,Math.max(0,e-this.tPrev),t,n)}poseComposee(e){let t=Z.get(this.cur),n=this.shapeAtTime(e),r=this.exprAtTime(e),i=this.posed(t,Math.max(0,e-this.tCur),n,r),a=e-this.tCur;if(a>=t.morph)return i;let o=this.origine(e,n,r);return o?Tt(o,i,x.easeOutQuint(y(a/t.morph))):i}setState(e,t){if(e===this.cur)return;let n=Z.get(this.cur).morph,r=this.prev!==null&&t-this.tCur<n;this.departFige=r?this.poseComposee(t):null,this.prev=this.cur,this.tPrev=this.tCur,this.cur=e,this.tCur=t,Z.get(e)?.blinkIn&&(this.blinkAt=t)}sample(e){let t=this.scale,n=Z.get(this.cur),r=this.shapeAtTime(e),i=this.exprAtTime(e),a=this.posed(n,Math.max(0,e-this.tCur),r,i),o=this.decalageAtTime(e,this.cur),s=e-this.tCur,c=s<n.morph?this.origine(e,r,i):null;if(c){let t=x.easeOutQuint(y(s/n.morph));a=Tt(c,a,t);let r=this.prev;if(r){let n=this.decalageAtTime(e,r);o={x:b(n.x,o.x,t),y:b(n.y,o.y,t)}}}let l=a.eyeAlpha>.01,u=this.lookAtTime(e),d=me(e,{wander:l?u.wander:0,blink:l}),f={yaw:b(a.gaze.yaw,u.yaw,u.mix)+d.dYaw-u.spin,pitch:b(a.gaze.pitch,u.pitch,u.mix)+d.dPitch,roll:a.gaze.roll+d.dRoll},p=y((e-this.blinkAt)/.2),m=p<1?Math.abs(p*2-1):1,h=Math.min(d.lid,m),g=a.offX+d.driftX,_=a.offY+d.driftY,v=Te(K({...a.sil,cx:a.sil.cx+g,cy:a.sil.cy+_,sy:a.sil.sy*d.breath},t,this.pts)),S=(e,t)=>Ee(a.sil.radii,Math.atan2(t,e)-a.sil.rot),C=[];if(a.eyeAlpha>.01){let e=L(f,t,a.split);for(let n=0;n<2;n++){let r=e[n];if(r.depth<=.02)continue;let i=a.eyes[n],s=S(r.x,r.y),c=(i.tilt??0)*Math.PI/180,l=Math.cos(c),u=Math.sin(c),d=r.a*l+r.c*u,f=r.b*l+r.d*u,p=-r.a*u+r.c*l,m=-r.b*u+r.d*l,v=he(Math.min(h,i.open));C.push({d:Me(i.w*t,i.h*t),matrix:`matrix(${w(d)},${w(f*v)},${w(p)},${w(m*v)},${w(r.x*s+(g+o.x)*t)},${w(r.y*s+(_+o.y)*t)})`,alpha:a.eyeAlpha*y(r.depth/.12)})}}let T=a.dots.filter(e=>e.opacity>.01&&e.r>5e-4).map(e=>({...e,x:(e.x+g)*t,y:(e.y+_)*t,r:e.r*t})),E=a.notif?S(a.notif.x,a.notif.y):1,te=a.notif?(a.notif.x*E+g)*t:0,ne=a.notif?(a.notif.y*E+_)*t:0,re=a.notif?{x:te,y:ne,r:a.notif.r*t}:null,D=a.notif?{x:te,y:ne,r:a.notif.notch*t}:null;return{bodyPath:v,bodyAlpha:a.bodyAlpha,eyes:C,dots:T,dotsBehind:a.dotsBehind,arcs:a.arcs.filter(e=>e.opacity>.01).map(e=>ee(e.seed,e.t,t,e.id,e.opacity)),notif:re,notch:D}}},Dt=1.1,Ot=1.5,kt=e=>({yaw:0,pitch:0,mix:0,spin:360*(1-x.easeInOutCubic(y(e/Ot))),wander:1});function At({nx:e,ny:t,tour:n,pointer:r}){return{yaw:-26+e*16,pitch:10-t*13,mix:n,spin:360*(1-n),wander:+!r}}var jt=Math.max(...et.map(e=>e.morph)),Mt=10,Nt=200,Pt=50,Ft=.1,It=`defaut`;function Lt(e){return Math.max(jt,Z.get(e)?.minDuration??jt)}function Rt(e,t){let n=Math.round(t/Ft)*Ft,r=Math.min(10,Math.max(Lt(e),n));return Math.round(r*100)/100}function zt(e){return{state:e,duration:Rt(e,Z.get(e)?.duration??2)}}function Bt(){return{name:``,id:It,blocks:nt.map(zt)}}function Vt(e){return e.reduce((e,t)=>e+t.duration,0)}function Ht(e,t){let n=0;for(let r=0;r<t&&r<e.length;r++)n+=e[r].duration;return n}function Ut(e,t){let n=Vt(e);if(!e.length||n<=0)return{index:0,elapsed:0};let r=t>=0&&t<n?t:(t%n+n)%n,i=0;for(let t=0;t<e.length;t++){let n=i+e[t].duration;if(r<n)return{index:t,elapsed:r-i};i=n}return{index:e.length-1,elapsed:0}}function Wt(e,t){return e.length>=200?e:[...e,zt(t)]}function Gt(e,t,n){let r=e.slice(),[i]=r.splice(t,1);return i?(r.splice(Math.min(Math.max(n,0),r.length),0,i),r):e}function Kt(e,t){let n=new Set(t.map(e=>e.name));if(!n.has(e))return e;let r=2;for(;n.has(`${e} ${r}`);)r++;return`${e} ${r}`}function qt(e){let t=new Set(e.map(e=>e.id)),n=1;for(;t.has(`c${n}`);)n++;return`c${n}`}function Jt(e){if(typeof e!=`object`||!e)return null;let{state:t,duration:n}=e;return typeof t!=`string`||!nt.includes(t)||typeof n!=`number`||!Number.isFinite(n)?null:{state:t,duration:Rt(t,n)}}function Yt(e,t){if(typeof e!=`object`||!e)return null;let{id:n,name:r,blocks:i}=e;if(typeof n!=`string`||!n||typeof r!=`string`||!Array.isArray(i))return null;let a=i.slice(0,200).map(Jt).filter(e=>e!==null);return!a.length||t.some(e=>e.id===n)?null:{id:n,name:r,blocks:a}}function Xt(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t.slice(0,50)){let t=Yt(e,n);t&&n.push(t)}return n}var Zt=100,Qt=158,$t=[`<g`,`>`,`</g>`],en=`<svg... viewBox="." role="img". class="." style="."><defs><mask. maskUnits="userSpaceOnUse"....><path. fill="#fff"></path><!--$-->.<!--/--><!--$-->.<!--/--></mask><!--$-->.<!--/--></defs><g fill="none" stroke-linecap="round">.</g><!--$-->.<!--/--><g.><path..></path><g mask="."><rect.....></rect></g></g><!--$-->.<!--/--><!--$-->.<!--/--><g fill="none" stroke-linecap="round">.</g></svg>`.split(`.`),tn=[`<path`,``,``,``,` fill="#000"></path>`],nn=[`<circle`,``,``,``,` fill="#000"></circle>`],rn=[`<linearGradient`,` id="`,`" gradientUnits="userSpaceOnUse"`,``,``,``,`>`,`</linearGradient>`],an=[`<stop`,``,``,`></stop>`],on=[`<path`,``,` stroke="`,`"`,``,`></path>`],sn=[`<circle`,``,``,``,``,`></circle>`];function $(e,t,n){d(e,(e,n)=>{_(()=>t(e,n))},n?.defer?{defer:!0}:void 0)}function cn(v){var y,b,x,S;let C=n({size:320,shape:Be,color:Ue,expression:_e,paper:`#f9f9f9`,cycle:Bt().blocks,follow:!1,gaze:null,ariaLabel:`Animated Bloub avatar`},v),[w,T]=p(0),[ee,E]=p(`idle`),[te]=p(!1),[ne,re]=p(0),D=()=>v.block??w(),O=()=>v.state??ee(),k=()=>v.playing??te(),ie=()=>v.elapsed??ne();function ae(e){v.block===void 0&&T(e),v.onBlockChange?.(e)}function oe(e){v.state===void 0&&E(e),v.onStateChange?.(e)}function se(e){v.elapsed===void 0&&re(e),v.onElapsedChange?.(e)}let ce=f(()=>ze.get(C.shape)?.radii??null),ue=f(()=>He.get(C.color)?.hex??`#0a0a0c`),de=f(()=>ge.get(C.expression)??null),A=_(()=>new Et(100,O(),ce(),de())),[j,M]=p(_(()=>A.sample(C.frozenAt??0)),{equals:!1}),N=m(),fe=`bot-mask-${N}`,P=0,F=1/0,I=0,L=0,R=0,z=0,pe=-1;function B(e,t=0){let n=C.cycle[e];if(!n){F=1/0;return}R=L-t,se(t),oe(n.state),A.setState(n.state,L),F=k()?R+n.duration:1/0}function me(e){ae(e),B(e)}function he(e,t=0){if(D()===e){B(e,t);return}z=t,ae(e)}function V(e){let t=C.cycle;if(!t.length)return;let{index:n}=Ut(t,e);if(n!==pe){let e=t[n];oe(e.state),n<pe?A.reset(e.state,Ht(t,n)):A.setState(e.state,Ht(t,n)),pe=n}M(A.sample(e))}let H=!1,U=0,ve=!1,ye=1/60;function be(e){e.pointerType!==`touch`&&(e.clientX,e.clientY)}function xe(){}function W(){H&&=(A.setLook(null,L,Dt),!1)}function Se(){if(!Z.get(O())?.baseFace){W();return}}function Ce(e){A.setLook(e(L-U),L,ye)}function G(){window.removeEventListener(`pointermove`,be),document.removeEventListener(`pointerleave`,xe)}function we(e){P=requestAnimationFrame(we);let t=I?Math.min((e-I)/1e3,.064):0;I=e,L+=t,k()&&(L>=F&&C.cycle.length?me((D()+1)%C.cycle.length):se(L-R)),C.follow?Se():C.gaze&&Ce(C.gaze),M(A.sample(L))}function K(){C.frozenAt!==void 0&&M(A.sample(C.frozenAt))}$(()=>C.gaze,e=>{e?(U=L,ve=!0,A.setLook(e(0),L-ye,ye)):ve&&=(A.setLook(null,L),!1)}),$(D,e=>{B(e,z),z=0},{defer:!0}),$(O,e=>{A.state!==e&&(A.setState(e,L),K())},{defer:!0}),$(k,e=>{e?B(D(),ie()):F=1/0},{defer:!0}),$(()=>C.cycle,e=>{if(!e.length){F=1/0;return}let t=Math.min(D(),e.length-1);t===D()?F=k()?R+e[t].duration:1/0:me(t)},{defer:!0}),$(ce,e=>{A.setShape(e,L),K()},{defer:!0}),$(de,e=>{A.setExpression(e,L),K()},{defer:!0}),$(()=>C.frozenAt,K,{defer:!0}),d(()=>C.follow&&C.frozenAt===void 0,e=>{e?(window.addEventListener(`pointermove`,be),document.addEventListener(`pointerleave`,xe)):(G(),W())}),g(()=>{v.ref?.({get svg(){},seek:he,renderAt:V}),C.frozenAt===void 0&&(B(D(),ie()),P=requestAnimationFrame(we))}),h(()=>{typeof cancelAnimationFrame<`u`&&cancelAnimationFrame(P),typeof window<`u`&&G()});function Te(e){let t={fill:e.color??(e.depth===void 0?ue():We(C.paper,ue(),e.depth)),opacity:e.opacity};return e.d?{...t,d:e.d,transform:`translate(${e.x} ${e.y}) rotate(${e.rot??0}) scale(100)`}:{...t,cx:e.x,cy:e.y,r:e.r}}let q=()=>l({get each(){return j().dots},children:t=>e(n({get component(){return t.d?`path`:`circle`}},()=>Te(t)))});var J=s(),Ee=o(()=>[i(`width`,t(C.size,!0)),i(`height`,t(C.size,!0))],2),De=o(()=>[i(`aria-label`,t(C.ariaLabel,!0)),a(C.class),c(C.style)],3),Oe=()=>i(`d`,t(j().bodyPath,!0)),ke=t(l({get each(){return j().eyes},children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e.d,!0)),i(`transform`,t(e.matrix,!0)),i(`opacity`,t(e.alpha,!0))],3),r(tn,n,a,a,a)}})),Ae=t(u({get when(){return j().notch},children:e=>{var n,a;return n=s(),a=o(()=>[i(`cx`,t(e().x,!0)),i(`cy`,t(e().y,!0)),i(`r`,t(e().r,!0))],3),r(nn,n,a,a,a)}})),je=t(l({get each(){return j().arcs},children:e=>{var n,a,c;return n=s(),a=o(()=>[`${t(N,!0)}-${t(e.id,!0)}`,i(`x1`,t(e.grad.x1,!0)),i(`y1`,t(e.grad.y1,!0)),i(`x2`,t(e.grad.x2,!0)),i(`y2`,t(e.grad.y2,!0))],5),c=t(l({get each(){return e.grad.stops},children:(n,a)=>{var o,c;return o=s(),c=()=>i(`offset`,t(a(),!0)/(t(e.grad.stops.length,!0)-1)),r(an,o,c,i(`stop-color`,t(n,!0)))}})),r(rn,n,a,a,a,a,a,c)}})),Me=t(l({get each(){return j().arcs},children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e.back,!0)),`url(#${t(N,!0)}-${t(e.id,!0)})`,i(`stroke-width`,t(e.width,!0)),i(`opacity`,t(e.opacity,!0))],4),r(on,n,a,a,a,a)}})),Ne=t(u({get when(){return j().dotsBehind},get children(){return y=s(),b=t(q({})),r($t,y,b)}})),Pe=o(()=>[i(`opacity`,t(j().bodyAlpha,!0)),i(`d`,t(j().bodyPath,!0)),i(`fill`,t(C.paper,!0))],3),Fe=()=>i(`fill`,t(ue(),!0)),Ie=t(u({get when(){return!j().dotsBehind},get children(){return x=s(),S=t(q({})),r($t,x,S)}})),Le=t(u({get when(){return j().notif},children:e=>{var n,a;return n=s(),a=o(()=>[i(`cx`,t(e().x,!0)),i(`cy`,t(e().y,!0)),i(`r`,t(e().r,!0))],3),r(sn,n,a,a,a,i(`fill`,t(le,!0)))}})),Re=t(l({get each(){return j().arcs},children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e.front,!0)),`url(#${t(N,!0)}-${t(e.id,!0)})`,i(`stroke-width`,t(e.width,!0)),i(`opacity`,t(e.opacity,!0))],4),r(on,n,a,a,a,a)}}));return r(en,J,Ee,Ee,`-158 -158 ${t(158,!0)*2} ${t(158,!0)*2}`,De,De,De,i(`id`,t(fe,!0)),i(`x`,-158),i(`y`,-158),i(`width`,t(158,!0)*2),i(`height`,t(158,!0)*2),Oe,ke,Ae,je,Me,Ne,Pe,Pe,Pe,`url(#${t(fe,!0)})`,i(`x`,-158),i(`y`,-158),i(`width`,t(158,!0)*2),i(`height`,t(158,!0)*2),Fe,Ie,Le,Re)}export{cn as BloubBot,Et as BotEngine,Ve as COLORS,He as COLOR_BY_ID,Ue as DEFAULT_COLOR,_e as DEFAULT_EXPRESSION,Be as DEFAULT_SHAPE,Qt as DEMI_VIEWBOX,U as EXPRESSIONS,ge as EXPRESSION_BY_ID,Mt as MAX_BLOCK,Nt as MAX_BLOCS,Pt as MAX_CYCLES,jt as MIN_BLOCK,tt as POSES,Zt as RAYON,nt as SEQUENCE,Re as SHAPES,ze as SHAPE_BY_ID,et as STATES,Z as STATE_BY_ID,Ft as STEP,Ot as TOUR_TIME,Dt as TURN_TIME,ye as blendExpression,Ut as blockAt,Wt as blocksWith,Rt as clampDuration,Bt as defaultCycle,At as lookTarget,zt as makeBlock,Lt as minDurationOf,We as mixHex,Gt as moveBlock,qt as nextCycleId,Ht as offsetOf,Xt as parseCycles,Vt as totalDuration,kt as tourLook,Kt as uniqueName};
1
+ import{Dynamic as e,escape as t,mergeProps as n,ssr as r,ssrAttribute as i,ssrClassName as a,ssrGroup as o,ssrHydrationKey as s,ssrStyle as c}from"@solidjs/web";import{For as l,Show as u,createEffect as d,createMemo as f,createSignal as p,createUniqueId as m,onCleanup as h,onSettled as g,untrack as _}from"solid-js";var v=Math.PI*2,y=(e,t=0,n=1)=>e<t?t:e>n?n:e,b=(e,t,n)=>e+(t-e)*n,x={easeOutCubic:e=>1-(1-e)**3,easeInOutCubic:e=>e<.5?4*e**3:1-(-2*e+2)**3/2,easeOutQuint:e=>1-(1-e)**5};function S(e,t,n=0){let r=e/t*v;return .55*Math.sin(r+n)+.3*Math.sin(2*r+n*1.7+1.1)+.15*Math.sin(3*r+n*2.3+2.4)}function C(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}var w=e=>Math.round(e*100)/100;function ee(e,t=.55,n=.62){let r=(e%360+360)%360,i=(1-Math.abs(2*n-1))*t,a=i*(1-Math.abs(r/60%2-1)),o=n-i/2,[s,c,l]=r<60?[i,a,0]:r<120?[a,i,0]:r<180?[0,i,a]:r<240?[0,a,i]:r<300?[a,0,i]:[i,0,a],u=e=>Math.round((e+o)*255).toString(16).padStart(2,`0`);return`#${u(s)}${u(c)}${u(l)}`}function te(e,t,n,r,i=1){let a=e.phase+t*e.speed*v,o=Math.cos(e.tilt),s=Math.sin(e.tilt),c=Math.sqrt(Math.max(0,1-e.k*e.k)),l=e.sweep*v,u=``,d=``,f=null;for(let t=0;t<=64;t++){let r=a+t/64*l,i=Math.cos(r),p=Math.sin(r),m=e.a*(i*o+p*-s*e.k)+e.cx,h=e.a*(i*s+p*o*e.k)+e.cy,g=e.a*p*c<0,_=w(m*n),v=w(h*n),y=g===f?`L`:`M`;g?d+=`${y}${_} ${v}`:u+=`${y}${_} ${v}`,f=g}let p=Math.cos(e.tilt)*e.a*n,m=Math.sin(e.tilt)*e.a*n;return{id:r,front:u,back:d,width:e.width*n,opacity:i,grad:{x1:w(e.cx*n-p),y1:w(e.cy*n-m),x2:w(e.cx*n+p),y2:w(e.cy*n+m),stops:[ee(e.hue),ee(e.hue+e.hueSpan*.5),ee(e.hue+e.hueSpan)]}}}var T=C(659918),E=Array.from({length:6},(e,t)=>({a:1.3+T()*.1,k:.05+T()*.4,tilt:t/6*Math.PI+T()*.5,speed:3+T()*.7,phase:T()*v,sweep:.6+T()*.25,hue:t*360/6+T()*30,hueSpan:60+T()*60,width:.05+T()*.012,cx:0,cy:.1})),ne=Array.from({length:4},(e,t)=>({a:.78+t*.2,k:.05+t*.02,tilt:-.62+t*.05,speed:.3,phase:.06*t,sweep:.4,hue:95+t*62,hueSpan:100,width:.05,cx:0,cy:-.12})),re=[-.557,-.013,.532],D=.165,ie=1.25,O=C(48879),ae=Array.from({length:5},(e,t)=>({birth:t*.2,angle:O()*v,rho:.58+O()*.18}));function oe(e,t){let n=[];for(let r of ae){let i=e-r.birth;if(i<0||i>.62)continue;let a=r.rho*.75**(i*10),o=r.angle+i*100*Math.PI/180;n.push({x:Math.cos(o)*a*t,y:Math.sin(o)*a*t,r:(.04+.028*y(i/.55))*t,depth:y(1-a/.8),opacity:y(i/.06)*y((.62-i)/.08)})}return n}var se=C(49383),ce=Array.from({length:4},(e,t)=>{let n=t-1.5;return{a:.85*(1+n*.03),k:.15/.85*(1+n*.16),tilt:34*Math.PI/180+n*.035,speed:210/360,phase:-t*.045+se()*.012,sweep:.34,hue:t*85+se()*20,hueSpan:80,width:.095,cx:0,cy:0}}),le=.129,ue=`#2496e8`,de=1.003,fe=.15,k=1.14,A=.054,j=15.46,M=.186,N=.412,pe={yaw:28.49,pitch:28.62,roll:-13},P=e=>e*Math.PI/180;function F(e,t,n){let r=Math.cos(n),i=Math.sin(n);return[[e[0]*r+t[0]*i,e[1]*r+t[1]*i,e[2]*r+t[2]*i],[t[0]*r-e[0]*i,t[1]*r-e[1]*i,t[2]*r-e[2]*i]]}function I(e,t,n=j){let r=[0,0,1],i=[1,0,0],a=[0,1,0];[r,i]=F(r,i,P(e.yaw)),[a,r]=F(a,r,P(e.pitch)),[i,a]=F(i,a,P(e.roll));let o=e=>{let[o,s]=F(r,i,P(n*e));return{x:o[0]*t,y:o[1]*t,a:s[0],b:s[1],c:a[0],d:a[1],depth:o[2]}};return[o(-1),o(1)]}var L=C(24301),R=(()=>{let e=[],t=1.4;for(;t<900;)e.push(t),t+=1.9+L()*2.7,L()<.18&&(e.push(t),t+=.24);return e})(),me=.18;function he(e){for(let t=0;t<R.length;t++){let n=R[t];if(e<n)break;let r=(e-n)/me;if(r>=0&&r<=1)return r<.45?1-r/.45:(r-.45)/.55}return 1}function ge(e,t={}){let{wander:n=1,blink:r=!0,float:i=!0}=t;return{dYaw:(S(e,11.3,.4)*5.5+S(e,3.7,2.1)*1.6)*n,dPitch:(S(e,9.1,1.3)*4.2+S(e,4.3,.7)*1.3)*n,dRoll:S(e,13.7,3.2)*2.2*n,lid:r?he(e):1,driftX:i?S(e,7.9,1.9)*.006:0,driftY:i?S(e,5.3,.3)*.007:0,breath:i?1+Math.sin(e/3.4*Math.PI*2)*.005:1}}function z(e){return .06+.94*y(e)}var B=(e,t,n=0,r=1)=>({w:e,h:t,tilt:n,open:r}),V=(e,t,n=0,r=1)=>[B(e,t,n,r),B(e,t,-n,r)],_e=[{id:`neutre`,gaze:{...pe},split:j,eyes:[B(M,N),B(M,N)]},{id:`attentif`,gaze:{yaw:4,pitch:5,roll:-4},split:16,eyes:V(.21,.44)},{id:`surpris`,gaze:{yaw:3,pitch:-3,roll:0},split:19,eyes:V(.45,.47)},{id:`excite`,gaze:{yaw:6,pitch:-14,roll:0},split:19.5,eyes:V(.4,.56,-10)},{id:`heureux`,gaze:{yaw:5,pitch:9,roll:0},split:17,eyes:V(.27,.17,14)},{id:`hilare`,gaze:{yaw:4,pitch:14,roll:0},split:18,eyes:V(.34,.13,20)},{id:`colere`,gaze:{yaw:3,pitch:7,roll:0},split:17,eyes:V(.34,.15,30)},{id:`triste`,gaze:{yaw:3,pitch:-13,roll:0},split:16,eyes:V(.22,.4,-28)},{id:`effraye`,gaze:{yaw:2,pitch:-20,roll:0},split:20.5,eyes:V(.4,.6)},{id:`mefiant`,gaze:{yaw:12,pitch:6,roll:-6},split:16,eyes:[B(.21,.4),B(.22,.15)]},{id:`confus`,gaze:{yaw:-14,pitch:3,roll:8},split:16.5,eyes:[B(.2,.44,-18),B(.28,.17,14)]},{id:`curieux`,gaze:{yaw:16,pitch:-9,roll:-15},split:16.5,eyes:[B(.24,.46,-8),B(.2,.38,-8)]},{id:`fier`,gaze:{yaw:5,pitch:17,roll:0},split:17,eyes:V(.3,.15,18)},{id:`timide`,gaze:{yaw:-19,pitch:-14,roll:-7},split:14,eyes:V(.17,.3)},{id:`blase`,gaze:{yaw:-22,pitch:2,roll:0},split:16,eyes:V(.3,.12)},{id:`somnolent`,gaze:{yaw:6,pitch:-9,roll:-3},split:16,eyes:V(.2,.42,0,.42)}],ve=new Map(_e.map(e=>[e.id,e])),ye=`neutre`,be=(e,t,n)=>({w:b(e.w,t.w,n),h:b(e.h,t.h,n),tilt:b(e.tilt??0,t.tilt??0,n),open:b(e.open,t.open,n)});function xe(e,t,n){return{id:t.id,gaze:{yaw:b(e.gaze.yaw,t.gaze.yaw,n),pitch:b(e.gaze.pitch,t.gaze.pitch,n),roll:b(e.gaze.roll,t.gaze.roll,n)},split:b(e.split,t.split,n),eyes:[be(e.eyes[0],t.eyes[0],n),be(e.eyes[1],t.eyes[1],n)]}}var Se={egg:[.8369,.8424,.8497,.8585,.8674,.8775,.8878,.8983,.9089,.9185,.9288,.9374,.9445,.9504,.9543,.9559,.9555,.9519,.9466,.9389,.9302,.9193,.9085,.8969,.8852,.8734,.8625,.8513,.8411,.8325,.8243,.8179,.8137,.8112,.8102,.8128,.8178,.8262,.8374,.8518,.8702,.8922,.9169,.9446,.9741,1.0023,1.0267,1.0433,1.0481,1.0393,1.0216,.997,.9697,.9418,.9169,.8949,.876,.8604,.849,.8394,.8337,.8314,.8305,.8326],hexagon:[.921,.9282,.9441,.9706,.9984,1.0059,.9896,.9562,.929,.9124,.9047,.9058,.9157,.9349,.9642,.9873,.9882,.9665,.9336,.9105,.8968,.8918,.8955,.908,.9293,.9611,.982,.9812,.959,.9282,.9089,.8978,.8964,.9026,.9189,.9439,.9778,.999,.9964,.9713,.9439,.9274,.9196,.9206,.9308,.9502,.9799,1.0121,1.0226,1.0071,.9752,.951,.9366,.9316,.9351,.9485,.9711,1.0026,1.0213,1.0155,.9863,.9547,.9347,.9232],triangle:[.7819,.8211,.8747,.944,1.0223,1.096,1.1401,1.134,1.0808,1.0047,.9265,.8603,.8104,.773,.745,.7273,.7151,.7118,.7148,.7245,.7427,.768,.8037,.8518,.9148,.9876,1.0583,1.1073,1.1109,1.0667,.994,.9164,.8482,.7948,.7555,.7261,.7056,.6925,.6859,.6869,.6938,.7084,.7305,.7615,.804,.8595,.9311,1.0092,1.0791,1.1171,1.1054,1.0501,.9779,.905,.845,.799,.7656,.7413,.7258,.716,.7146,.7204,.733,.7528]},H=Array.from({length:64},(e,t)=>t/64*v),U=H.map(Math.cos),W=H.map(Math.sin);function G(e,t={}){return{radii:[...Se[e]],rot:0,cx:0,cy:0,sx:1,sy:1,...t}}function K(e,t={}){return{radii:Array(64).fill(e),rot:0,cx:0,cy:0,sx:1,sy:1,...t}}function Ce(e,t,n,r){let i=r??{radii:Array(64),rot:0,cx:0,cy:0,sx:1,sy:1};for(let r=0;r<64;r++)i.radii[r]=b(e.radii[r]??1,t.radii[r]??1,n);let a=t.rot-e.rot;for(;a>Math.PI;)a-=v;for(;a<-Math.PI;)a+=v;return i.rot=e.rot+a*n,i.cx=b(e.cx,t.cx,n),i.cy=b(e.cy,t.cy,n),i.sx=b(e.sx,t.sx,n),i.sy=b(e.sy,t.sy,n),i}function we(e,t,n=[]){let r=Math.cos(e.rot),i=Math.sin(e.rot);for(let a=0;a<64;a++){let o=e.radii[a]??1,s=o*(U[a]??0),c=o*(W[a]??0),l=s*r-c*i,u=s*i+c*r,d=n[a]??{x:0,y:0};d.x=(l*e.sx+e.cx)*t,d.y=(u*e.sy+e.cy)*t,n[a]=d}return n.length=64,n}function Te(e,t=1/6){let n=e.length;if(n<3)return``;let r=e[0],i=`M${w(r.x)} ${w(r.y)}`;for(let r=0;r<n;r++){let a=e[(r-1+n)%n],o=e[r],s=e[(r+1)%n],c=e[(r+2)%n],l=o.x+(s.x-a.x)*t,u=o.y+(s.y-a.y)*t,d=s.x-(c.x-o.x)*t,f=s.y-(c.y-o.y)*t;i+=`C${w(l)} ${w(u)} ${w(d)} ${w(f)} ${w(s.x)} ${w(s.y)}`}return`${i}Z`}function q(e,t,n){let r=Array(64).fill(0),i=e.length;for(let a=0;a<64;a++){let o=U[a]??0,s=W[a]??0,c=0;for(let r=0;r<i;r++){let a=e[r],l=e[(r+1)%i],u=l.x-a.x,d=l.y-a.y,f=o*d-s*u;if(Math.abs(f)<1e-9)continue;let p=a.x-t,m=a.y-n,h=(p*d-m*u)/f,g=(p*s-m*o)/f;h>c&&g>=0&&g<=1&&(c=h)}r[a]=c}return r}function J(e,t,n,r,i,a,o=96){let s=r-e,c=i-t,l=Math.hypot(s,c)||1e-6,u=Math.atan2(c,s),d=Math.acos(Math.max(-1,Math.min(1,(n-a)/l))),f=[];for(let r=0;r<=o/2;r++){let i=u+d+(v-2*d)*r/(o/2);f.push({x:e+Math.cos(i)*n,y:t+Math.sin(i)*n})}for(let e=0;e<=o/2;e++){let t=u-d+2*d*e/(o/2);f.push({x:r+Math.cos(t)*a,y:i+Math.sin(t)*a})}return f}function Ee(e,t){let n=e.length,r=(t/v%1+1)%1*n,i=Math.floor(r);return b(e[i%n]??1,e[(i+1)%n]??1,r-i)}function De(e,t=1,n=1){return H.map((r,i)=>(Math.abs((U[i]??0)/t)**e+Math.abs((W[i]??0)/n)**e)**(-1/e))}function Oe(e){let t=Array(64).fill(0);for(let n=0;n<64;n++){let r=U[n]??0,i=W[n]??0,a=0;for(let t of e){let e=r*t.x+i*t.y,n=e*e-(t.x*t.x+t.y*t.y-t.r*t.r);if(n<0)continue;let o=e+Math.sqrt(n);o>a&&(a=o)}t[n]=a}return t}function ke(e,t,n=10){let r=e.length,i=[],a=(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1;return Math.atan2(-n/i,r/i)};for(let o=0;o<r;o++){let s=e[(o-1+r)%r],c=e[o],l=e[(o+1)%r],u=a(s,c),d=a(c,l)-u;for(;d>Math.PI;)d-=v;for(;d<-Math.PI;)d+=v;for(let e=0;e<=n;e++){let r=u+d*e/n;i.push({x:c.x+Math.cos(r)*t,y:c.y+Math.sin(r)*t})}}return i}function Ae(e,t,n,r=0){let i=r*Math.PI/180;return q(ke(Array.from({length:e},(r,a)=>{let o=i+a/e*v;return{x:Math.cos(o)*(t-n),y:Math.sin(o)*(t-n)}}),n),0,0)}function je(e,t=1){if(e.length<3)return``;let n=``;for(let r=0;r<e.length;r++){let i=e[r];n+=`${r===0?`M`:`L`}${w(i.x*t)} ${w(i.y*t)}`}return`${n}Z`}function Me(e,t){let n=Math.max(e,.01)/2,r=Math.max(t,.01)/2,i=Math.min(n,r);return`M${w(-n)} ${w(-r+i)}A${w(i)} ${w(i)} 0 0 1 ${w(-n+i)} ${w(-r)}L${w(n-i)} ${w(-r)}A${w(i)} ${w(i)} 0 0 1 ${w(n)} ${w(-r+i)}L${w(n)} ${w(r-i)}A${w(i)} ${w(i)} 0 0 1 ${w(n-i)} ${w(r)}L${w(-n+i)} ${w(r)}A${w(i)} ${w(i)} 0 0 1 ${w(-n)} ${w(r-i)}Z`}function Ne(e,t=1){let n=Math.max(...e);if(n<=0)return e;let r=t/n;return e.map(e=>e*r)}var Pe=Ne(Array.from({length:64},(e,t)=>t/64*Math.PI*2).map(e=>1+.075*Math.cos(2*e+.5)+.035*Math.cos(3*e+2.1)),1.02),Fe=Ne(Oe([{x:-.44,y:.2,r:.54},{x:.46,y:.2,r:.5},{x:.02,y:.3,r:.6},{x:-.24,y:-.3,r:.48},{x:.3,y:-.24,r:.44}]),1.02),Ie=Ne(q(J(0,.28,.66,0,-.96,.05),0,0),1.04),Le=q(J(-.42,0,.62,.42,0,.62),0,0),Re=[{id:`cercle`,radii:Array(64).fill(1)},{id:`galet`,radii:Pe},{id:`squircle`,radii:Ne(De(4.2),1.15)},{id:`capsule`,radii:Le},{id:`triangle`,radii:Ae(3,1.12,.34,-90)},{id:`hexagone`,radii:Ae(6,1.04,.26,0)},{id:`nuage`,radii:Fe},{id:`goutte`,radii:Ie}],ze=new Map(Re.map(e=>[e.id,e])),Be=`cercle`,Ve=[{id:`encre`,hex:`#0a0a0c`},{id:`brun`,hex:`#8b5e3c`},{id:`rouge`,hex:`#e8483f`},{id:`orange`,hex:`#f08a24`},{id:`ambre`,hex:`#f0b429`},{id:`vert`,hex:`#3ecf8e`},{id:`turquoise`,hex:`#2fbfa0`},{id:`bleu`,hex:`#3b93f0`},{id:`violet`,hex:`#8b5cf6`},{id:`rose`,hex:`#e152b0`},{id:`gris`,hex:`#a3a3a3`},{id:`creme`,hex:`#f1efe9`}],He=new Map(Ve.map(e=>[e.id,e])),Ue=`encre`;function We(e,t,n){let r=e=>{let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]},i=r(e),a=r(t);return`#${i.map((e,t)=>Math.round(e+(a[t]-e)*n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}var Y=(e,t)=>[{w:e,h:t,open:1},{w:e,h:t,open:1}];function X(e={}){return{sil:K(1),offX:0,offY:0,gaze:{...pe},split:j,eyes:Y(M,N),eyeAlpha:1,bodyAlpha:1,dots:[],arcs:[],notif:null,dotsBehind:!1,...e}}var Ge=-.1875,Ke=q(J(0,-.505,.132,0,.13,.075),0,Ge),qe=q(J(0,-.2535,.1345,0,.2535,.1345),0,0),Je=(e={})=>({radii:[...Ke],rot:0,cx:0,cy:Ge,sx:1,sy:1,...e}),Ye=(e={})=>({radii:[...qe],rot:0,cx:0,cy:0,sx:1,sy:1,...e}),Xe=je(J(0,0,.118,0,.172,.012)),Ze=.213;function Qe(e){return G(`triangle`,{rot:e,cx:-.213*Math.sin(e),cy:Ze*Math.cos(e)})}function $e(e,t){let n=((e-t*.5)/1.5%1+1)%1;return y((n<.5?.5-.5*Math.cos(n*v):0)*2)}var et=[{id:`idle`,duration:2.4,morph:.45,blinkIn:!1,baseFace:!0,baseBody:!0,pose:()=>X()},{id:`thinking`,duration:2.6,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:e=>{let t=$e(e,1),n=.3+.7*x.easeOutCubic(y(e/.3));return X({sil:K(D*(1+(ie-1)*t),{cx:re[1]}),eyeAlpha:0,dots:[0,2].map(t=>{let r=$e(e,t);return{x:re[t]*n,y:0,r:D*(1+(ie-1)*r),opacity:.55+.45*r}})})}},{id:`wink`,duration:1.6,morph:.3,blinkIn:!0,baseFace:!1,baseBody:!0,pose:()=>X({gaze:{yaw:-5.37,pitch:4.55,roll:6.7},split:16.25,eyes:[{w:.236,h:.464,open:1},{w:.447,h:.089,open:1}]})},{id:`wide`,duration:1.8,morph:.55,blinkIn:!0,baseFace:!1,baseBody:!0,pose:()=>X({gaze:{yaw:6.92,pitch:-21.96,roll:11.6},split:18.43,eyes:Y(.356,.875)})},{id:`alert`,duration:2.4,minDuration:2,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=y(e/1.5),n=x.easeInOutCubic(t)*.82-.087,r=e>1.6?y((e-1.6)/.4):0,i=n*(1-r)+.1*r,a=Math.sin(e*2.5*v)*.005,o=17.7*Math.PI/180;return X({sil:Ye({rot:o,cx:i,cy:-.325-a}),eyeAlpha:0,dots:[{x:i-Math.sin(o)*.58,y:-.325+Math.cos(o)*.58+a*2.8,r:.118,d:Xe,rot:o*180/Math.PI,opacity:1}]})}},{id:`notify`,duration:2.2,morph:.5,blinkIn:!0,baseFace:!1,baseBody:!0,pose:e=>{let t=y(e/.45),n=1+(k-1)*Math.sin(t*Math.PI)*(1-t*.35),r=fe*(t<1?n:1),i=-42*Math.PI/180;return X({gaze:{yaw:-21.94,pitch:-5.82,roll:-12.2},split:18.89,eyes:Y(.505,.498),notif:{x:Math.cos(i)*de,y:Math.sin(i)*de,r,notch:r+A}})}},{id:`exclaim`,duration:2,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:()=>X({sil:Je(),eyeAlpha:0,dots:[{x:-.012,y:.526,r:.113,opacity:1}]})},{id:`sleep`,duration:2.4,morph:.5,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>X({sil:K(.1585,{cy:.11+Math.sin(v/.6*e)*.19}),eyeAlpha:0})},{id:`egg`,duration:1.8,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:()=>X({sil:G(`egg`),gaze:{yaw:19.97,pitch:26.01,roll:-17.1},split:11.07,eyes:Y(.164,.385)})},{id:`hexagon`,duration:1.6,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:()=>X({sil:G(`hexagon`),gaze:{yaw:23.11,pitch:24.42,roll:-13.3},split:13.37,eyes:Y(.177,.411)})},{id:`play`,duration:2,morph:.5,baseFace:!1,baseBody:!1,blinkIn:!0,pose:e=>{let t=y(e/.35)*y((2.2-e)/.5);return X({sil:Qe(0),gaze:{yaw:12,pitch:-8,roll:-6},split:15,eyes:Y(.18,.34),arcs:ne.map((n,r)=>({id:`sw${r}`,seed:{...n,cx:.45-e*.42},t:e,opacity:t}))})}},{id:`orbit`,duration:3.4,minDuration:2.5,morph:.6,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=x.easeInOutCubic(y(e/.35)),n=-v*1.25*e*t,r=x.easeInOutCubic(y((e-1.6)/.9)),i=Qe(n),a=K(1,{rot:n}),o={radii:i.radii.map((e,t)=>e+(a.radii[t]-e)*r),rot:n,cx:i.cx*(1-r),cy:i.cy*(1-r),sx:1,sy:1},s=y(e/.8)*y((3.6-e)/.9);return X({sil:o,gaze:{yaw:pe.yaw+Math.sin(e*6.5)*65*(1-r),pitch:-4+r*32,roll:-13},eyes:Y(.18,.34+r*.07),arcs:E.map((t,n)=>({id:`rg${n}`,seed:t,t:e,opacity:s*y((e-n*.13)/.3)}))})}},{id:`swirl`,duration:1.3,minDuration:1.3,morph:.3,baseFace:!0,baseBody:!0,blinkIn:!0,pose:e=>X({arcs:E.slice(0,3).map((t,n)=>({id:`sw${n}`,seed:t,t:e,opacity:y((e-n*.06)/.14)*y((1.22-e)/.34)}))})},{id:`burst`,duration:2.6,minDuration:2.4,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=1-.834*x.easeOutQuint(y(e/.7)),n=x.easeOutQuint(y((e-1.7)/.7));return X({sil:K(t+(1-t)*n),eyeAlpha:y((e-1.85)/.4),dots:oe(e,1),dotsBehind:!0})}},{id:`comet`,duration:2.4,minDuration:2.4,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=1-(1-le)*x.easeOutQuint(y(e/.55)),n=x.easeOutQuint(y((e-1.85)/.6)),r=y((e-.15)/.25)*y((1.95-e)/.3);return X({sil:K(t+(1-t)*n,{cy:Math.sin(y(e/1.7)*Math.PI)*.035}),eyeAlpha:y((e-2)/.35),arcs:ce.map((t,n)=>({id:`cm${n}`,seed:t,t:e,opacity:r}))})}}],Z=new Map(et.map(e=>[e.id,e])),tt={idle:1,thinking:1.1,wink:.8,wide:.8,alert:.75,notify:.9,exclaim:.8,sleep:.45,egg:.8,hexagon:.8,play:.9,orbit:1.2,swirl:.5,burst:.45,comet:1.15},nt=[`idle`,`thinking`,`wink`,`wide`,`alert`,`notify`,`exclaim`,`sleep`,`egg`,`hexagon`,`play`,`orbit`,`burst`,`comet`],Q=100,rt=7.1,it=5.5,at=.006,ot=.007;function st(e,t,n){let r=[],i=I(e.gaze,Q,e.split);for(let a=0;a<2;a++){let o=i[a];if(o.depth<=.02)continue;let s=e.eyes[a],c=(s.tilt??0)*Math.PI/180,l=Math.cos(c),u=Math.sin(c),d=o.a*l+o.c*u,f=o.b*l+o.d*u,p=-o.a*u+o.c*l,m=-o.b*u+o.d*l,h=Math.max(s.w*Q,.01)/2,g=Math.max(s.h*Q,.01)/2,_=Math.min(h,g),v=g>h,y=v?g-_:h-_,b=Ee(n,Math.atan2(o.y,o.x)-t.rot);r.push({x:o.x*b,y:o.y*b,ax:(v?p:d)*y,ay:(v?m:f)*y,r:_,m:[d,f,p,m]})}return r}function ct(e,t,n,r,i){let a=r-t,o=i-n,s=a*a+o*o,c=1/0,l=0,u=0;for(let r=0;r<e.length;r++){let i=e[r],d=s>0?((i.x-t)*a+(i.y-n)*o)/s:0;d=d<0?0:d>1?1:d;let f=t+d*a-i.x,p=n+d*o-i.y,m=f*f+p*p;m<c&&(c=m,l=f,u=p)}let d=Math.sqrt(c);return{d,ux:d>1e-9?l/d:0,uy:d>1e-9?u/d:0}}var lt=Math.hypot(at,ot)*Q;function ut(e,t,n,r){let i=1/0,a=0,o=0;for(let s of t){let t=s.x+n,c=s.y+r,l=ct(e,t-s.ax,c-s.ay,t+s.ax,c+s.ay),[u,d,f,p]=s.m,m=s.r*Math.hypot(u*l.ux+d*l.uy,f*l.ux+p*l.uy)+lt;l.d-m<i&&(i=l.d-m,a=l.ux,o=l.uy)}return{marge:i,ux:a,uy:o}}var dt=12,ft=8;function pt(e){if(!e.length)return{x:0,y:0};let t=(t,n)=>{let r=1/0;for(let i of e)r=Math.min(r,ut(i.contour,i.empreintes,t,n).marge);return r},n=1/0;for(let t of e)n=Math.min(n,ut(t.calContour,t.reference,0,0).marge);let r=0,i=0,a=e[0].empreintes;for(let e of a)r-=e.x/a.length,i-=e.y/a.length;let o=Math.max(.35*Q,Math.hypot(r,i)*1.25);n=Math.min(n,t(r,i));let s=t(0,0);if(s>=n&&s>=0)return{x:0,y:0};let c=Math.max(n,0),l=0,u=0,d=1/0,f=0,p=0,m=s;for(let e=0;e<dt;e++){let n=e/dt*Math.PI*2,r=Math.cos(n),i=Math.sin(n);if(t(r*o,i*o)<c){for(let e of[.3,.6,1]){let n=t(r*o*e,i*o*e);n>m&&(m=n,f=r*o*e,p=i*o*e)}continue}let a=0,s=o;for(let e=0;e<ft;e++){let e=(a+s)/2;t(r*e,i*e)>=c?s=e:a=e}s<d&&(d=s,l=r*s,u=i*s)}let h=d===1/0?f:l,g=d===1/0?p:u;return{x:+(h/Q).toFixed(6),y:+(g/Q).toFixed(6)}}function mt(e,t,n){return e.baseFace&&n?{gaze:n.gaze,split:n.split,eyes:n.eyes}:{gaze:t.gaze,split:t.split,eyes:t.eyes}}function ht(e){let t=e=>JSON.stringify([e.gaze,e.split,e.eyes,e.sil.rot,e.sil.cx,e.sil.cy,e.sil.sx,e.sil.sy]);return t(e.pose(0))===t(e.pose(e.duration))?[0]:Array.from({length:3},(t,n)=>n/2*e.duration)}function gt(e,t,n){let r=[];for(let i of ht(e)){let a=e.pose(i),o=we({...a.sil,radii:t},Q),s=we(a.sil,Q),c=mt(e,a,n),l=[];for(let e of[-7.1,rt])for(let t of[-5.5,it])l.push({...c,gaze:{yaw:c.gaze.yaw+e,pitch:c.gaze.pitch+t,roll:c.gaze.roll}});for(let e of l)r.push({empreintes:st(e,a.sil,t),reference:st(e,a.sil,a.sil.radii),contour:o,calContour:s})}return pt(r)}var _t={x:0,y:0},vt=(e,t)=>`${e}|${t??``}`;function yt(){return new Map(Re.map(e=>{let t=new Map;for(let n of et){if(!n.baseBody)continue;let r=n.baseFace?[null,..._e]:[null];for(let i of r)t.set(vt(n.id,i?.id??null),gt(n,e.radii,i))}return[e.radii,t]}))}var bt=yt();function xt(e,t,n){if(!e)return _t;let r=bt.get(e);return r?r.get(vt(t,n))??r.get(vt(t,null))??_t:_t}var St={yaw:0,pitch:0,mix:0,spin:0,wander:1},Ct=(e,t,n)=>({yaw:b(e.yaw,t.yaw,n),pitch:b(e.pitch,t.pitch,n),mix:b(e.mix,t.mix,n),spin:b(e.spin,t.spin,n),wander:b(e.wander,t.wander,n)}),wt=(e,t,n)=>({w:b(e.w,t.w,n),h:b(e.h,t.h,n),open:b(e.open,t.open,n),tilt:b(e.tilt??0,t.tilt??0,n)});function Tt(e,t,n){let r=1-n;return{sil:Ce(e.sil,t.sil,n),offX:b(e.offX,t.offX,n),offY:b(e.offY,t.offY,n),gaze:{yaw:b(e.gaze.yaw,t.gaze.yaw,n),pitch:b(e.gaze.pitch,t.gaze.pitch,n),roll:b(e.gaze.roll,t.gaze.roll,n)},split:b(e.split,t.split,n),eyes:[wt(e.eyes[0],t.eyes[0],n),wt(e.eyes[1],t.eyes[1],n)],eyeAlpha:b(e.eyeAlpha,t.eyeAlpha,n),bodyAlpha:b(e.bodyAlpha,t.bodyAlpha,n),dots:[...e.dots.map(e=>({...e,opacity:e.opacity*r})),...t.dots.map(e=>({...e,opacity:e.opacity*n}))],arcs:[...e.arcs.map(e=>({...e,id:`a${e.id}`,opacity:e.opacity*r})),...t.arcs.map(e=>({...e,id:`b${e.id}`,opacity:e.opacity*n}))],notif:n<.5?e.notif:t.notif,dotsBehind:n<.5?e.dotsBehind:t.dotsBehind}}var Et=class e{scale;cur;prev=null;departFige=null;tCur=0;tPrev=0;blinkAt=-10;pts=[];shape=null;shapePrev=null;shapeAt=-10;expr=null;exprPrev=null;exprAt=-10;look=St;lookPrev=St;lookAt=-10;lookMorph=.24;static SHAPE_MORPH=.45;static LOOK_MORPH=.24;constructor(e=100,t=`idle`,n=null,r=null){this.scale=e,this.cur=t,this.shape=n,this.expr=r}setExpression(e,t=0){e!==this.expr&&(this.exprPrev=this.expr,this.expr=e,this.exprAt=t)}exprAtTime(t){let n=this.expr,r=this.exprPrev;if(!n||!r)return n;let i=(t-this.exprAt)/e.SHAPE_MORPH;return i>=1?n:xe(r,n,x.easeOutQuint(y(i)))}setShape(e,t=0){e!==this.shape&&(this.shapePrev=this.shape,this.shape=e,this.shapeAt=t)}shapeAtTime(t){let n=this.shape,r=this.shapePrev;if(!n||!r)return n;let i=(t-this.shapeAt)/e.SHAPE_MORPH;if(i>=1)return n;let a=x.easeOutQuint(y(i));return n.map((e,t)=>b(r[t]??e,e,a))}setLook(t,n,r=e.LOOK_MORPH){t&&!Number.isFinite(t.yaw+t.pitch+t.mix+t.spin+t.wander)||(this.lookPrev=this.lookAtTime(n),this.look=t??St,this.lookAt=n,this.lookMorph=r)}lookAtTime(e){let t=(e-this.lookAt)/this.lookMorph;return t>=1?this.look:Ct(this.lookPrev,this.look,x.easeOutQuint(y(t)))}posed(e,t,n,r){let i=e.pose(t);return e.baseBody&&n&&(i={...i,sil:{...i.sil,radii:n}}),e.baseFace&&r&&(i={...i,gaze:r.gaze,split:r.split,eyes:r.eyes}),i}decalageAtTime(t,n){let r=(e,n,r,i)=>{if(r===i)return i;let a=(t-e)/n;if(a>=1)return i;let o=x.easeOutQuint(y(a));return{x:b(r.x,i.x,o),y:b(r.y,i.y,o)}},i=t=>r(this.exprAt,e.SHAPE_MORPH,xt(t,n,this.exprPrev?.id??null),xt(t,n,this.expr?.id??null));return r(this.shapeAt,e.SHAPE_MORPH,i(this.shapePrev),i(this.shape))}get state(){return this.cur}reset(e,t){this.cur=e,this.prev=null,this.departFige=null,this.tCur=t,this.tPrev=t,this.blinkAt=-10}origine(e,t,n){if(this.departFige)return this.departFige;if(!this.prev)return null;let r=Z.get(this.prev);return this.posed(r,Math.max(0,e-this.tPrev),t,n)}poseComposee(e){let t=Z.get(this.cur),n=this.shapeAtTime(e),r=this.exprAtTime(e),i=this.posed(t,Math.max(0,e-this.tCur),n,r),a=e-this.tCur;if(a>=t.morph)return i;let o=this.origine(e,n,r);return o?Tt(o,i,x.easeOutQuint(y(a/t.morph))):i}setState(e,t){if(e===this.cur)return;let n=Z.get(this.cur).morph,r=this.prev!==null&&t-this.tCur<n;this.departFige=r?this.poseComposee(t):null,this.prev=this.cur,this.tPrev=this.tCur,this.cur=e,this.tCur=t,Z.get(e)?.blinkIn&&(this.blinkAt=t)}sample(e){let t=this.scale,n=Z.get(this.cur),r=this.shapeAtTime(e),i=this.exprAtTime(e),a=this.posed(n,Math.max(0,e-this.tCur),r,i),o=this.decalageAtTime(e,this.cur),s=e-this.tCur,c=s<n.morph?this.origine(e,r,i):null;if(c){let t=x.easeOutQuint(y(s/n.morph));a=Tt(c,a,t);let r=this.prev;if(r){let n=this.decalageAtTime(e,r);o={x:b(n.x,o.x,t),y:b(n.y,o.y,t)}}}let l=a.eyeAlpha>.01,u=this.lookAtTime(e),d=ge(e,{wander:l?u.wander:0,blink:l}),f={yaw:b(a.gaze.yaw,u.yaw,u.mix)+d.dYaw-u.spin,pitch:b(a.gaze.pitch,u.pitch,u.mix)+d.dPitch,roll:a.gaze.roll+d.dRoll},p=y((e-this.blinkAt)/.2),m=p<1?Math.abs(p*2-1):1,h=Math.min(d.lid,m),g=a.offX+d.driftX,_=a.offY+d.driftY,v=Te(we({...a.sil,cx:a.sil.cx+g,cy:a.sil.cy+_,sy:a.sil.sy*d.breath},t,this.pts)),S=(e,t)=>Ee(a.sil.radii,Math.atan2(t,e)-a.sil.rot),C=[];if(a.eyeAlpha>.01){let e=I(f,t,a.split);for(let n=0;n<2;n++){let r=e[n];if(r.depth<=.02)continue;let i=a.eyes[n],s=S(r.x,r.y),c=(i.tilt??0)*Math.PI/180,l=Math.cos(c),u=Math.sin(c),d=r.a*l+r.c*u,f=r.b*l+r.d*u,p=-r.a*u+r.c*l,m=-r.b*u+r.d*l,v=z(Math.min(h,i.open));C.push({d:Me(i.w*t,i.h*t),matrix:`matrix(${w(d)},${w(f*v)},${w(p)},${w(m*v)},${w(r.x*s+(g+o.x)*t)},${w(r.y*s+(_+o.y)*t)})`,alpha:a.eyeAlpha*y(r.depth/.12)})}}let ee=a.dots.filter(e=>e.opacity>.01&&e.r>5e-4).map(e=>({...e,x:(e.x+g)*t,y:(e.y+_)*t,r:e.r*t})),T=a.notif?S(a.notif.x,a.notif.y):1,E=a.notif?(a.notif.x*T+g)*t:0,ne=a.notif?(a.notif.y*T+_)*t:0,re=a.notif?{x:E,y:ne,r:a.notif.r*t}:null,D=a.notif?{x:E,y:ne,r:a.notif.notch*t}:null;return{bodyPath:v,bodyAlpha:a.bodyAlpha,eyes:C,dots:ee,dotsBehind:a.dotsBehind,arcs:a.arcs.filter(e=>e.opacity>.01).map(e=>te(e.seed,e.t,t,e.id,e.opacity)),notif:re,notch:D}}},Dt=1.1,Ot=1.5,kt=e=>({yaw:0,pitch:0,mix:0,spin:360*(1-x.easeInOutCubic(y(e/Ot))),wander:1});function At({nx:e,ny:t,tour:n,pointer:r}){return{yaw:-26+e*16,pitch:10-t*13,mix:n,spin:360*(1-n),wander:+!r}}var jt=Math.max(...et.map(e=>e.morph)),Mt=10,Nt=200,Pt=50,Ft=.1,It=`defaut`;function Lt(e){return Math.max(jt,Z.get(e)?.minDuration??jt)}function Rt(e,t){let n=Math.round(t/Ft)*Ft,r=Math.min(10,Math.max(Lt(e),n));return Math.round(r*100)/100}function zt(e){return{state:e,duration:Rt(e,Z.get(e)?.duration??2)}}function Bt(){return{name:``,id:It,blocks:nt.map(zt)}}function Vt(e){return e.reduce((e,t)=>e+t.duration,0)}function Ht(e,t){let n=0;for(let r=0;r<t&&r<e.length;r++)n+=e[r].duration;return n}function Ut(e,t){let n=Vt(e);if(!e.length||n<=0)return{index:0,elapsed:0};let r=t>=0&&t<n?t:(t%n+n)%n,i=0;for(let t=0;t<e.length;t++){let n=i+e[t].duration;if(r<n)return{index:t,elapsed:r-i};i=n}return{index:e.length-1,elapsed:0}}function Wt(e,t){return e.length>=200?e:[...e,zt(t)]}function Gt(e,t,n){let r=e.slice(),[i]=r.splice(t,1);return i?(r.splice(Math.min(Math.max(n,0),r.length),0,i),r):e}function Kt(e,t){let n=new Set(t.map(e=>e.name));if(!n.has(e))return e;let r=2;for(;n.has(`${e} ${r}`);)r++;return`${e} ${r}`}function qt(e){let t=new Set(e.map(e=>e.id)),n=1;for(;t.has(`c${n}`);)n++;return`c${n}`}function Jt(e){if(typeof e!=`object`||!e)return null;let{state:t,duration:n}=e;return typeof t!=`string`||!nt.includes(t)||typeof n!=`number`||!Number.isFinite(n)?null:{state:t,duration:Rt(t,n)}}function Yt(e,t){if(typeof e!=`object`||!e)return null;let{id:n,name:r,blocks:i}=e;if(typeof n!=`string`||!n||typeof r!=`string`||!Array.isArray(i))return null;let a=i.slice(0,200).map(Jt).filter(e=>e!==null);return!a.length||t.some(e=>e.id===n)?null:{id:n,name:r,blocks:a}}function Xt(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t.slice(0,50)){let t=Yt(e,n);t&&n.push(t)}return n}var Zt=100,Qt=158,$t=[`<g`,`>`,`</g>`],en=`<svg... viewBox="." role="img". class="." style="."><defs><mask. maskUnits="userSpaceOnUse"....><path. fill="#fff"></path><!--$-->.<!--/--><!--$-->.<!--/--></mask><!--$-->.<!--/--></defs><g fill="none" stroke-linecap="round">.</g><!--$-->.<!--/--><g.><path..></path><g mask="."><rect.....></rect></g></g><!--$-->.<!--/--><!--$-->.<!--/--><g fill="none" stroke-linecap="round">.</g></svg>`.split(`.`),tn=[`<path`,``,``,``,` fill="#000"></path>`],nn=[`<circle`,``,``,``,` fill="#000"></circle>`],rn=[`<linearGradient`,` id="`,`" gradientUnits="userSpaceOnUse"`,``,``,``,`>`,`</linearGradient>`],an=[`<stop`,``,``,`></stop>`],on=[`<path`,``,` stroke="`,`"`,``,`></path>`],sn=[`<circle`,``,``,``,``,`></circle>`];function $(e,t,n){d(e,(e,n)=>{_(()=>t(e,n))},n?.defer?{defer:!0}:void 0)}function cn(v){var y,b,x,S;let C=n({size:320,shape:Be,color:Ue,expression:ye,paper:`#f9f9f9`,cycle:Bt().blocks,follow:!1,gaze:null,autoPause:!0,ariaLabel:`Animated Bloub avatar`},v),[w,ee]=p(0),[te,T]=p(`idle`),[E]=p(!1),[ne,re]=p(0),D=()=>v.block??w(),ie=()=>v.state??te(),O=()=>v.playing??E(),ae=()=>v.elapsed??ne();function oe(e){v.block===void 0&&ee(e),v.onBlockChange?.(e)}function se(e){v.state===void 0&&T(e),v.onStateChange?.(e)}function ce(e){v.elapsed===void 0&&re(e),v.onElapsedChange?.(e)}let le=f(()=>ze.get(C.shape)?.radii??null),de=f(()=>He.get(C.color)?.hex??`#0a0a0c`),fe=f(()=>ve.get(C.expression)??null),k=_(()=>new Et(100,ie(),le(),fe())),[A,j]=p(_(()=>k.sample(C.frozenAt??0)),{equals:!1}),M=m(),N=`bot-mask-${M}`,pe,P=0,F=-1/0,I=1/0,L=0,R=0,me=0,he=0,ge=-1;function z(e,t=0){let n=C.cycle[e];if(!n){I=1/0;return}me=R-t,ce(t),se(n.state),k.setState(n.state,R),I=O()?me+n.duration:1/0}function B(e){oe(e),z(e)}function V(e,t=0){if(D()===e){z(e,t);return}he=t,oe(e)}function _e(e){let t=C.cycle;if(!t.length)return;let{index:n}=Ut(t,e);if(n!==ge){let e=t[n];se(e.state),n<ge?k.reset(e.state,Ht(t,n)):k.setState(e.state,Ht(t,n)),ge=n}j(k.sample(e))}let be=!1,xe=0,Se=!1,H=1/60;function U(e){e.pointerType!==`touch`&&(e.clientX,e.clientY)}function W(){}function G(){be&&=(k.setLook(null,R,Dt),!1)}function K(){if(!Z.get(ie())?.baseFace){G();return}}function Ce(e){k.setLook(e(R-xe),R,H)}function we(){window.removeEventListener(`pointermove`,U),document.removeEventListener(`pointerleave`,W)}function Te(e){P=requestAnimationFrame(Te);let t=L?Math.min((e-L)/1e3,.064):0;L=e,R+=t;let n=C.fps&&C.fps>0?1/C.fps:0;R-F<n||(F=R,O()&&(R>=I&&C.cycle.length?B((D()+1)%C.cycle.length):ce(R-me)),C.follow?K():C.gaze&&Ce(C.gaze),j(k.sample(R)))}function q(){C.frozenAt!==void 0&&j(k.sample(C.frozenAt))}$(()=>C.gaze,e=>{e?(xe=R,Se=!0,k.setLook(e(0),R-H,H)):Se&&=(k.setLook(null,R),!1)}),$(D,e=>{z(e,he),he=0},{defer:!0}),$(ie,e=>{k.state!==e&&(k.setState(e,R),q())},{defer:!0}),$(O,e=>{e?z(D(),ae()):I=1/0},{defer:!0}),$(()=>C.cycle,e=>{if(!e.length){I=1/0;return}let t=Math.min(D(),e.length-1);t===D()?I=O()?me+e[t].duration:1/0:B(t)},{defer:!0}),$(le,e=>{k.setShape(e,R),q()},{defer:!0}),$(fe,e=>{k.setExpression(e,R),q()},{defer:!0}),$(()=>C.frozenAt,q,{defer:!0}),d(()=>C.follow&&C.frozenAt===void 0,e=>{e?(window.addEventListener(`pointermove`,U),document.addEventListener(`pointerleave`,W)):(we(),G())});function J(){P||typeof requestAnimationFrame>`u`||(L=0,P=requestAnimationFrame(Te))}function Ee(){P&&=(typeof cancelAnimationFrame<`u`&&cancelAnimationFrame(P),0)}let[De,Oe]=p(!0),[ke,Ae]=p(!0),[je,Me]=p(!1);d(()=>je()&&C.frozenAt===void 0&&(!C.autoPause||De()&&ke()),e=>{e?J():Ee()}),g(()=>{if(v.ref?.({get svg(){},seek:V,renderAt:_e}),C.frozenAt!==void 0)return;z(D(),ae());let e=()=>Ae(document.visibilityState!==`hidden`);document.addEventListener(`visibilitychange`,e),e();let t=typeof IntersectionObserver>`u`?null:new IntersectionObserver(e=>{let t=e[e.length-1];t&&Oe(t.isIntersecting)});return t?.observe(pe),Me(!0),()=>{document.removeEventListener(`visibilitychange`,e),t?.disconnect()}}),h(()=>{Ee(),typeof window<`u`&&we()});function Ne(e){let t={fill:e.color??(e.depth===void 0?de():We(C.paper,de(),e.depth)),opacity:e.opacity};return e.d?{...t,d:e.d,transform:`translate(${e.x} ${e.y}) rotate(${e.rot??0}) scale(100)`}:{...t,cx:e.x,cy:e.y,r:e.r}}let Pe=()=>l({get each(){return A().dots},keyed:!1,children:t=>e(n({get component(){return t().d?`path`:`circle`}},()=>Ne(t())))});var Fe=s(),Ie=o(()=>[i(`width`,t(C.size,!0)),i(`height`,t(C.size,!0))],2),Le=o(()=>[i(`aria-label`,t(C.ariaLabel,!0)),a(C.class),c(C.style)],3),Re=()=>i(`d`,t(A().bodyPath,!0)),Ve=t(l({get each(){return A().eyes},keyed:!1,children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e().d,!0)),i(`transform`,t(e().matrix,!0)),i(`opacity`,t(e().alpha,!0))],3),r(tn,n,a,a,a)}})),Y=t(u({get when(){return A().notch},children:e=>{var n,a;return n=s(),a=o(()=>[i(`cx`,t(e().x,!0)),i(`cy`,t(e().y,!0)),i(`r`,t(e().r,!0))],3),r(nn,n,a,a,a)}})),X=t(l({get each(){return A().arcs},keyed:!1,children:e=>{var n,a,c;return n=s(),a=o(()=>[`${t(M,!0)}-${t(e().id,!0)}`,i(`x1`,t(e().grad.x1,!0)),i(`y1`,t(e().grad.y1,!0)),i(`x2`,t(e().grad.x2,!0)),i(`y2`,t(e().grad.y2,!0))],5),c=t(l({get each(){return e().grad.stops},keyed:!1,children:(n,a)=>{var c,l;return c=s(),l=o(()=>[i(`offset`,t(a,!0)/(t(e().grad.stops.length,!0)-1)),i(`stop-color`,t(n(),!0))],2),r(an,c,l,l)}})),r(rn,n,a,a,a,a,a,c)}})),Ge=t(l({get each(){return A().arcs},keyed:!1,children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e().back,!0)),`url(#${t(M,!0)}-${t(e().id,!0)})`,i(`stroke-width`,t(e().width,!0)),i(`opacity`,t(e().opacity,!0))],4),r(on,n,a,a,a,a)}})),Ke=t(u({get when(){return A().dotsBehind},get children(){return y=s(),b=t(Pe({})),r($t,y,b)}})),qe=o(()=>[i(`opacity`,t(A().bodyAlpha,!0)),i(`d`,t(A().bodyPath,!0)),i(`fill`,t(C.paper,!0))],3),Je=()=>i(`fill`,t(de(),!0)),Ye=t(u({get when(){return!A().dotsBehind},get children(){return x=s(),S=t(Pe({})),r($t,x,S)}})),Xe=t(u({get when(){return A().notif},children:e=>{var n,a;return n=s(),a=o(()=>[i(`cx`,t(e().x,!0)),i(`cy`,t(e().y,!0)),i(`r`,t(e().r,!0))],3),r(sn,n,a,a,a,i(`fill`,t(ue,!0)))}})),Ze=t(l({get each(){return A().arcs},keyed:!1,children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e().front,!0)),`url(#${t(M,!0)}-${t(e().id,!0)})`,i(`stroke-width`,t(e().width,!0)),i(`opacity`,t(e().opacity,!0))],4),r(on,n,a,a,a,a)}}));return r(en,Fe,Ie,Ie,`-158 -158 ${t(158,!0)*2} ${t(158,!0)*2}`,Le,Le,Le,i(`id`,t(N,!0)),i(`x`,-158),i(`y`,-158),i(`width`,t(158,!0)*2),i(`height`,t(158,!0)*2),Re,Ve,Y,X,Ge,Ke,qe,qe,qe,`url(#${t(N,!0)})`,i(`x`,-158),i(`y`,-158),i(`width`,t(158,!0)*2),i(`height`,t(158,!0)*2),Je,Ye,Xe,Ze)}export{cn as BloubBot,Et as BotEngine,Ve as COLORS,He as COLOR_BY_ID,Ue as DEFAULT_COLOR,ye as DEFAULT_EXPRESSION,Be as DEFAULT_SHAPE,Qt as DEMI_VIEWBOX,_e as EXPRESSIONS,ve as EXPRESSION_BY_ID,Mt as MAX_BLOCK,Nt as MAX_BLOCS,Pt as MAX_CYCLES,jt as MIN_BLOCK,tt as POSES,Zt as RAYON,nt as SEQUENCE,Re as SHAPES,ze as SHAPE_BY_ID,et as STATES,Z as STATE_BY_ID,Ft as STEP,Ot as TOUR_TIME,Dt as TURN_TIME,xe as blendExpression,Ut as blockAt,Wt as blocksWith,Rt as clampDuration,Bt as defaultCycle,At as lookTarget,zt as makeBlock,Lt as minDurationOf,We as mixHex,Gt as moveBlock,qt as nextCycleId,Ht as offsetOf,Xt as parseCycles,Vt as totalDuration,kt as tourLook,Kt as uniqueName};
@@ -22,6 +22,22 @@ export interface BloubBotProps {
22
22
  state?: StateId;
23
23
  playing?: boolean;
24
24
  elapsed?: number;
25
+ /**
26
+ * Cadence maximale de rendu, en images par seconde. Sans elle le bot dessine a
27
+ * la cadence de l'ecran : sur un 120 Hz c'est deux fois le travail d'un 60 Hz
28
+ * pour la meme animation. Le rendu tombe sur le plus grand diviseur de la
29
+ * cadence de l'ecran qui ne depasse pas `fps`, donc l'intervalle reste
30
+ * regulier — un bot bride a 30 sur un ecran a 75 Hz dessine a 25.
31
+ */
32
+ fps?: number;
33
+ /**
34
+ * Suspend la boucle quand personne ne peut voir le bot : onglet en arriere-plan,
35
+ * element sorti du viewport, ancetre `display: none`. L'horloge s'arrete avec
36
+ * elle, donc l'animation reprend sur la pose qu'elle avait — elle ne saute pas.
37
+ * A mettre a `false` seulement si le SVG est lu hors ecran par autre chose que
38
+ * `renderAt` (l'export, lui, passe par `frozenAt` et n'a jamais de boucle).
39
+ */
40
+ autoPause?: boolean;
25
41
  onBlockChange?: (value: number) => void;
26
42
  onStateChange?: (value: StateId) => void;
27
43
  onPlayingChange?: (value: boolean) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@norbert_bodziony/bloub",
3
3
  "private": false,
4
- "version": "0.2.1",
4
+ "version": "0.3.0",
5
5
  "type": "module",
6
6
  "description": "SVG recreation of the x.ai bot avatar. One shape morphing through 14 states, measured off the reference video frame by frame.",
7
7
  "license": "MIT",