@minicode-dev/chat 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -77,8 +77,8 @@ var st = () => {}, ct = Object.freeze({
77
77
  enabled: !0,
78
78
  sound: !0,
79
79
  volume: .35,
80
- autoPlay: !1,
81
- cooldownMs: 3e4,
80
+ autoPlay: !0,
81
+ cooldownMs: 5e3,
82
82
  maxAgeMs: 1e4,
83
83
  allowGroups: !1
84
84
  }),
@@ -2236,7 +2236,24 @@ function Fi(e, { volume: t = .4, onBlocked: n } = {}) {
2236
2236
  };
2237
2237
  }
2238
2238
  // src/effects/EffectPlayer.jsx
2239
- function Ii() {
2239
+ var Ii = Array.from({ length: 220 }, (e, t) => ({
2240
+ left: `${(t * 61.8034 % 100).toFixed(2)}%`,
2241
+ top: `${t * 43 % 100}%`,
2242
+ color: [
2243
+ "#ff72ad",
2244
+ "#9380ff",
2245
+ "#ffd65c",
2246
+ "#37d7b0",
2247
+ "#6fcaff",
2248
+ "#ff9b59"
2249
+ ][t % 6],
2250
+ width: `${6 + t * 7 % 8}px`,
2251
+ height: `${8 + t * 11 % 14}px`,
2252
+ duration: `${2.2 + t % 13 * .1}s`,
2253
+ delay: `${-(t * 137 % 3e3) / 1e3}s`,
2254
+ drift: `${t * 23 % 180 - 90}px`
2255
+ }));
2256
+ function Li() {
2240
2257
  return /* @__PURE__ */ z("svg", {
2241
2258
  className: "lira-effect-pig",
2242
2259
  viewBox: "0 0 240 250",
@@ -2340,9 +2357,14 @@ function Ii() {
2340
2357
  })]
2341
2358
  });
2342
2359
  }
2343
- function Li({ effectId: e, onClose: t, sound: n = !0, volume: r = .4, targetRef: i }) {
2344
- let a = Ni(e), o = j(t), [s, c] = M(!1);
2345
- if (o.current = t, O(() => {
2360
+ function Ri({ effectId: e, onClose: t, sound: n = !0, volume: r = .4, targetRef: i }) {
2361
+ let a = Ni(e), o = j(t), [s, c] = M(!1), [l, u] = M(900);
2362
+ if (O(() => {
2363
+ let e = i?.current, t = () => u((e?.clientHeight || 800) + 100);
2364
+ if (t(), !e || typeof ResizeObserver > "u") return;
2365
+ let n = new ResizeObserver(t);
2366
+ return n.observe(e), () => n.disconnect();
2367
+ }, [i]), o.current = t, O(() => {
2346
2368
  if (!a) return;
2347
2369
  let e = setTimeout(() => o.current?.(), a.durationMs), t = (e) => {
2348
2370
  e.key === "Escape" && o.current?.();
@@ -2362,17 +2384,18 @@ function Li({ effectId: e, onClose: t, sound: n = !0, volume: r = .4, targetRef:
2362
2384
  n,
2363
2385
  r
2364
2386
  ]), !a) return null;
2365
- let l = /* @__PURE__ */ z("div", {
2387
+ let d = /* @__PURE__ */ z("div", {
2366
2388
  className: `lira-effect-player lira-effect-${a.id}`,
2367
2389
  role: "region",
2368
2390
  "aria-label": `Efecto: ${a.label}`,
2391
+ style: { "--confetti-fall": `${l}px` },
2369
2392
  children: [
2370
2393
  /* @__PURE__ */ R("div", {
2371
2394
  className: "lira-effect-scene",
2372
2395
  "aria-hidden": "true",
2373
2396
  children: a.id === "pig-disco" ? /* @__PURE__ */ z(L, { children: [
2374
2397
  /* @__PURE__ */ R("div", { className: "lira-effect-disco-ball" }),
2375
- /* @__PURE__ */ R(Ii, {}),
2398
+ /* @__PURE__ */ R(Li, {}),
2376
2399
  /* @__PURE__ */ R("span", {
2377
2400
  className: "lira-effect-note",
2378
2401
  children: "♪"
@@ -2384,16 +2407,17 @@ function Li({ effectId: e, onClose: t, sound: n = !0, volume: r = .4, targetRef:
2384
2407
  ] }) : a.id === "nudge" ? /* @__PURE__ */ R("span", {
2385
2408
  className: "lira-effect-bolt",
2386
2409
  children: "⚡"
2387
- }) : Array.from({ length: 32 }, (e, t) => /* @__PURE__ */ R("i", {
2388
- className: "lira-effect-confetti-piece",
2410
+ }) : Ii.map((e, t) => /* @__PURE__ */ R("i", {
2411
+ className: `lira-effect-confetti-piece lira-effect-confetti-piece--${t % 3}`,
2389
2412
  style: {
2390
- "--piece": t,
2391
- "--color": [
2392
- "#f871a8",
2393
- "#7b6ff6",
2394
- "#ffd65c",
2395
- "#37d7b0"
2396
- ][t % 4]
2413
+ left: e.left,
2414
+ "--static-top": e.top,
2415
+ "--color": e.color,
2416
+ width: e.width,
2417
+ height: e.height,
2418
+ "--duration": e.duration,
2419
+ "--delay": e.delay,
2420
+ "--drift": e.drift
2397
2421
  }
2398
2422
  }, t))
2399
2423
  }),
@@ -2411,14 +2435,14 @@ function Li({ effectId: e, onClose: t, sound: n = !0, volume: r = .4, targetRef:
2411
2435
  })
2412
2436
  ]
2413
2437
  });
2414
- return i?.current ? B(l, i.current) : /* @__PURE__ */ R("div", {
2438
+ return i?.current ? B(d, i.current) : /* @__PURE__ */ R("div", {
2415
2439
  className: "lira-effect-standalone",
2416
- children: l
2440
+ children: d
2417
2441
  });
2418
2442
  }
2419
2443
  // src/effects/ChatEffects.jsx
2420
- var Ri = C(null);
2421
- function zi(e, t) {
2444
+ var zi = C(null);
2445
+ function Bi(e, t) {
2422
2446
  try {
2423
2447
  let n = `minicode-effects-seen:${e}`, r = JSON.parse(localStorage.getItem(n) || "[]"), i = Array.isArray(r) ? r.filter((e) => Array.isArray(e) && Date.now() - e[1] < 6e4).slice(-100) : [];
2424
2448
  if (i.some((e) => e[0] === t)) return !1;
@@ -2426,8 +2450,8 @@ function zi(e, t) {
2426
2450
  } catch {}
2427
2451
  return !0;
2428
2452
  }
2429
- function Bi({ children: e, roomId: t, scope: n, identityScope: r = n, messages: i = [], currentUserIds: a = [], config: o = {}, visible: s = !0, targetRef: c }) {
2430
- let l = N(Pn, Gn, () => !1), [u, d] = M(null), [f, p] = M(o.sound !== !1), [m, h] = M(o.autoPlay === !0), g = j({
2453
+ function Vi({ children: e, roomId: t, scope: n, identityScope: r = n, messages: i = [], currentUserIds: a = [], config: o = {}, visible: s = !0, targetRef: c }) {
2454
+ let l = N(Pn, Gn, () => !1), [u, d] = M(null), [f, p] = M(o.sound !== !1), [m, h] = M(o.autoPlay !== !1), g = j({
2431
2455
  room: null,
2432
2456
  seen: /* @__PURE__ */ new Set(),
2433
2457
  since: Date.now()
@@ -2438,7 +2462,7 @@ function Bi({ children: e, roomId: t, scope: n, identityScope: r = n, messages:
2438
2462
  }));
2439
2463
  };
2440
2464
  return O(() => {
2441
- p(o.sound !== !1), h(o.autoPlay === !0);
2465
+ p(o.sound !== !1), h(o.autoPlay !== !1);
2442
2466
  }, [o.sound, o.autoPlay]), O(() => {
2443
2467
  let e = `${n}:${t}`, c = g.current.room !== e;
2444
2468
  c && (g.current = {
@@ -2451,7 +2475,7 @@ function Bi({ children: e, roomId: t, scope: n, identityScope: r = n, messages:
2451
2475
  if (!n || g.current.seen.has(n.id)) continue;
2452
2476
  g.current.seen.add(n.id);
2453
2477
  let i = Date.now() - n.sentAt;
2454
- !c && m && s && document.visibilityState === "visible" && document.hasFocus() && !a.includes(String(t.user_id)) && !t.localOnly && !t.history && !t.is_history && !t.replay && !t.optimistic && t.user_id != null && n.sentAt >= g.current.since && i >= 0 && i <= (o.maxAgeMs ?? 1e4) && Date.now() - (v.current.get(e) ?? 0) >= (o.cooldownMs ?? 3e4) && !_.current && zi(r, n.id) && (v.current.set(e, Date.now()), y(n.effectId));
2478
+ !c && m && s && document.visibilityState === "visible" && !a.includes(String(t.user_id)) && !t.localOnly && !t.history && !t.is_history && !t.replay && !t.optimistic && t.user_id != null && n.sentAt >= g.current.since && i >= 0 && i <= (o.maxAgeMs ?? 1e4) && Date.now() - (v.current.get(e) ?? 0) >= (o.cooldownMs ?? 5e3) && Bi(r, n.id) && (v.current.set(e, Date.now()), y(n.effectId, { replace: !0 }));
2455
2479
  }
2456
2480
  g.current.seen.size > 5e3 && (g.current.seen = new Set([...g.current.seen].slice(-2500)));
2457
2481
  }, [
@@ -2462,10 +2486,12 @@ function Bi({ children: e, roomId: t, scope: n, identityScope: r = n, messages:
2462
2486
  s,
2463
2487
  o.enabled,
2464
2488
  o.maxAgeMs,
2489
+ o.cooldownMs,
2490
+ r,
2465
2491
  a
2466
2492
  ]), O(() => {
2467
2493
  s && o.enabled !== !1 || (_.current = !1, d(null));
2468
- }, [s, o.enabled]), /* @__PURE__ */ z(Ri.Provider, {
2494
+ }, [s, o.enabled]), /* @__PURE__ */ z(zi.Provider, {
2469
2495
  value: o.enabled === !1 ? null : {
2470
2496
  play: y,
2471
2497
  sound: f,
@@ -2478,7 +2504,7 @@ function Bi({ children: e, roomId: t, scope: n, identityScope: r = n, messages:
2478
2504
  },
2479
2505
  sessionKey: `${n}:${t}`
2480
2506
  },
2481
- children: [e, u && s && /* @__PURE__ */ R(Li, {
2507
+ children: [e, u && s && /* @__PURE__ */ R(Ri, {
2482
2508
  effectId: u.effectId,
2483
2509
  sound: f && l,
2484
2510
  volume: o.volume ?? .35,
@@ -2489,8 +2515,8 @@ function Bi({ children: e, roomId: t, scope: n, identityScope: r = n, messages:
2489
2515
  }, u.key)]
2490
2516
  });
2491
2517
  }
2492
- function Vi({ effect: e }) {
2493
- let t = D(Ri), n = Mi.find((t) => t.id === e.effectId);
2518
+ function Hi({ effect: e }) {
2519
+ let t = D(zi), n = Mi.find((t) => t.id === e.effectId);
2494
2520
  return /* @__PURE__ */ z("div", {
2495
2521
  className: "chat-effect-card",
2496
2522
  children: [
@@ -2510,8 +2536,8 @@ function Vi({ effect: e }) {
2510
2536
  ]
2511
2537
  });
2512
2538
  }
2513
- function Hi({ onSend: e, disabled: t, onClose: n }) {
2514
- let r = D(Ri), [i, a] = M(null), [o, s] = M(null), c = j(!1), l = j(!0), u = j(null), d = j(r);
2539
+ function Ui({ onSend: e, disabled: t, onClose: n }) {
2540
+ let r = D(zi), [i, a] = M(null), [o, s] = M(null), c = j(!1), l = j(!0), u = j(null), d = j(r);
2515
2541
  d.current = r, O(() => {
2516
2542
  s(null);
2517
2543
  }, [r?.sessionKey]), O(() => {
@@ -2653,10 +2679,10 @@ function Hi({ onSend: e, disabled: t, onClose: n }) {
2653
2679
  });
2654
2680
  }
2655
2681
  // src/media/emoji/customEmojis.js
2656
- var Ui = [], Wi = /^[a-z0-9_+-]{1,32}$/, Gi = /^data:image\/(png|gif|jpeg|webp);base64,[a-z0-9+/]+=*$/i;
2657
- function Ki(e) {
2682
+ var Wi = [], Gi = /^[a-z0-9_+-]{1,32}$/, Ki = /^data:image\/(png|gif|jpeg|webp);base64,[a-z0-9+/]+=*$/i;
2683
+ function qi(e) {
2658
2684
  if (typeof e != "string" || e.length > 36e4 || /[\u0000-\u0020\\]/.test(e)) return !1;
2659
- if (Gi.test(e) || /^\/(?!\/)/.test(e) || /^\.\.?\//.test(e)) return !0;
2685
+ if (Ki.test(e) || /^\/(?!\/)/.test(e) || /^\.\.?\//.test(e)) return !0;
2660
2686
  try {
2661
2687
  let t = new URL(e);
2662
2688
  if (t.protocol === "blob:") {
@@ -2669,10 +2695,10 @@ function Ki(e) {
2669
2695
  return !1;
2670
2696
  }
2671
2697
  }
2672
- function qi(e) {
2698
+ function Ji(e) {
2673
2699
  if (!Array.isArray(e)) return [];
2674
2700
  let t = /* @__PURE__ */ new Set();
2675
- return e.slice(0, 100).flatMap((e) => !e || typeof e.shortcode != "string" || !Wi.test(e.shortcode) || t.has(e.shortcode) || !Ki(e.url) ? [] : (t.add(e.shortcode), [{
2701
+ return e.slice(0, 100).flatMap((e) => !e || typeof e.shortcode != "string" || !Gi.test(e.shortcode) || t.has(e.shortcode) || !qi(e.url) ? [] : (t.add(e.shortcode), [{
2676
2702
  shortcode: e.shortcode,
2677
2703
  url: e.url,
2678
2704
  label: String(e.label || e.shortcode).slice(0, 100),
@@ -2682,17 +2708,17 @@ function qi(e) {
2682
2708
  category: "custom"
2683
2709
  }]));
2684
2710
  }
2685
- function Ji(e, t) {
2711
+ function Yi(e, t) {
2686
2712
  let n = (e) => String(e).normalize("NFD").replace(/\p{M}/gu, "").toLowerCase(), r = n(t).replace(/^:|:$/g, "").trim();
2687
2713
  return e.filter((e) => n(`${e.shortcode} ${e.label}`).includes(r));
2688
2714
  }
2689
2715
  // src/media/emoji/useCustomEmojis.js
2690
- function Yi() {
2716
+ function Xi() {
2691
2717
  let e = D(sr)?.config?.media?.emoji?.custom;
2692
- return A(() => qi(e ?? Ui), [e]);
2718
+ return A(() => Ji(e ?? Wi), [e]);
2693
2719
  }
2694
2720
  // src/ui/components/MessageText.jsx
2695
- function Xi({ item: e }) {
2721
+ function Zi({ item: e }) {
2696
2722
  let [t, n] = M(!1);
2697
2723
  return t ? `:${e.shortcode}:` : /* @__PURE__ */ R("img", {
2698
2724
  className: "chat-inline-emoji",
@@ -2702,23 +2728,23 @@ function Xi({ item: e }) {
2702
2728
  onError: () => n(!0)
2703
2729
  });
2704
2730
  }
2705
- function Zi({ text: e }) {
2706
- let t = Yi();
2731
+ function Qi({ text: e }) {
2732
+ let t = Xi();
2707
2733
  return String(e).split(/(:[a-z0-9_+-]+:)/g).map((e, n) => {
2708
2734
  let r = t.find((t) => `:${t.shortcode}:` === e);
2709
- return r ? /* @__PURE__ */ R(Xi, { item: r }, `${n}-${r.url}`) : e;
2735
+ return r ? /* @__PURE__ */ R(Zi, { item: r }, `${n}-${r.url}`) : e;
2710
2736
  });
2711
2737
  }
2712
2738
  // src/ui/components/MediaPreview.jsx
2713
- var Qi = (e) => {
2739
+ var $i = (e) => {
2714
2740
  if (typeof e == "string") try {
2715
2741
  let t = new URL(e);
2716
2742
  return ["https:", "blob:"].includes(t.protocol) && !t.username && !t.password ? t.href : void 0;
2717
2743
  } catch {
2718
2744
  return;
2719
2745
  }
2720
- }, $i = (e) => Number.isFinite(e) && e >= 0 ? e < 1048576 ? `${Math.ceil(e / 1024)} KB` : `${(e / 1048576).toFixed(1)} MB` : "", ea = (e) => Number.isFinite(e) ? `${Math.floor(e / 60)}:${String(Math.floor(e % 60)).padStart(2, "0")}` : "0:00";
2721
- function ta({ url: e, onError: t }) {
2746
+ }, ea = (e) => Number.isFinite(e) && e >= 0 ? e < 1048576 ? `${Math.ceil(e / 1024)} KB` : `${(e / 1048576).toFixed(1)} MB` : "", ta = (e) => Number.isFinite(e) ? `${Math.floor(e / 60)}:${String(Math.floor(e % 60)).padStart(2, "0")}` : "0:00";
2747
+ function na({ url: e, onError: t }) {
2722
2748
  let n = j(null), [r, i] = M(!1), [a, o] = M(0), [s, c] = M(0), [l, u] = M(""), d = () => {
2723
2749
  let e = n.current;
2724
2750
  if (!e) return;
@@ -2773,14 +2799,14 @@ function ta({ url: e, onError: t }) {
2773
2799
  value: Math.min(a, s || 1),
2774
2800
  disabled: !s,
2775
2801
  "aria-label": "Posición del audio",
2776
- "aria-valuetext": `${ea(a)} de ${ea(s)}`,
2802
+ "aria-valuetext": `${ta(a)} de ${ta(s)}`,
2777
2803
  onChange: (e) => {
2778
2804
  n.current.currentTime = Number(e.target.value), o(Number(e.target.value));
2779
2805
  }
2780
2806
  }),
2781
2807
  /* @__PURE__ */ z("span", {
2782
2808
  className: "chat-audio-time",
2783
- children: [ea(a), s > 0 ? ` / ${ea(s)}` : ""]
2809
+ children: [ta(a), s > 0 ? ` / ${ta(s)}` : ""]
2784
2810
  }),
2785
2811
  l && /* @__PURE__ */ R("small", {
2786
2812
  role: "status",
@@ -2791,8 +2817,8 @@ function ta({ url: e, onError: t }) {
2791
2817
  ]
2792
2818
  });
2793
2819
  }
2794
- function na({ item: e, onRemove: t, history: n, onExpand: r }) {
2795
- let [i, a] = M(!1), o = Qi(e.preview) || Qi(e.url), s = typeof e.type == "string" ? e.type.toLowerCase() : "", c = e.kind || s.split("/")[0], l = Jt(e), u = l ? Yt(e) : e.name || "Archivo adjunto", d = c === "image" || c === "gif", f = !!o && !i, p = u.includes(".") ? u.split(".").pop().slice(0, 8).toUpperCase() : "ARCHIVO", m = /zip|compressed|archive/.test(s) ? de : /sheet|excel|csv/.test(s) ? fe : /pdf|text|word|document/.test(s) ? pe : ue;
2820
+ function ra({ item: e, onRemove: t, history: n, onExpand: r }) {
2821
+ let [i, a] = M(!1), o = $i(e.preview) || $i(e.url), s = typeof e.type == "string" ? e.type.toLowerCase() : "", c = e.kind || s.split("/")[0], l = Jt(e), u = l ? Yt(e) : e.name || "Archivo adjunto", d = c === "image" || c === "gif", f = !!o && !i, p = u.includes(".") ? u.split(".").pop().slice(0, 8).toUpperCase() : "ARCHIVO", m = /zip|compressed|archive/.test(s) ? de : /sheet|excel|csv/.test(s) ? fe : /pdf|text|word|document/.test(s) ? pe : ue;
2796
2822
  return l && n ? /* @__PURE__ */ R("div", {
2797
2823
  className: `chat-media-card chat-attachment--sticker chat-media-card--${f ? "visual" : "unavailable"}`,
2798
2824
  children: f ? /* @__PURE__ */ z("button", {
@@ -2851,7 +2877,7 @@ function na({ item: e, onRemove: t, history: n, onExpand: r }) {
2851
2877
  preload: "metadata",
2852
2878
  "aria-label": u,
2853
2879
  onError: () => a(!0)
2854
- }) : f && c === "audio" ? /* @__PURE__ */ R(ta, {
2880
+ }) : f && c === "audio" ? /* @__PURE__ */ R(na, {
2855
2881
  url: o,
2856
2882
  onError: () => a(!0)
2857
2883
  }) : /* @__PURE__ */ R("div", {
@@ -2864,7 +2890,7 @@ function na({ item: e, onRemove: t, history: n, onExpand: r }) {
2864
2890
  className: "chat-file-name",
2865
2891
  title: u,
2866
2892
  children: n && c === "audio" ? "Audio" : u
2867
- }), /* @__PURE__ */ R("small", { children: f ? [!d && c !== "audio" && c !== "video" ? p : "", e.size > 0 ? $i(e.size) : ""].filter(Boolean).join(" · ") : "Archivo no disponible en esta ventana" })]
2893
+ }), /* @__PURE__ */ R("small", { children: f ? [!d && c !== "audio" && c !== "video" ? p : "", e.size > 0 ? ea(e.size) : ""].filter(Boolean).join(" · ") : "Archivo no disponible en esta ventana" })]
2868
2894
  }),
2869
2895
  f && /* @__PURE__ */ R("a", {
2870
2896
  className: "chat-file-download",
@@ -2886,7 +2912,7 @@ function na({ item: e, onRemove: t, history: n, onExpand: r }) {
2886
2912
  ]
2887
2913
  });
2888
2914
  }
2889
- function ra({ items: e = [], onRemove: t, history: n = !1 }) {
2915
+ function ia({ items: e = [], onRemove: t, history: n = !1 }) {
2890
2916
  let [r, i] = M(null), a = j(null);
2891
2917
  return O(() => {
2892
2918
  if (!r) return;
@@ -2900,7 +2926,7 @@ function ra({ items: e = [], onRemove: t, history: n = !1 }) {
2900
2926
  };
2901
2927
  }, [r]), !Array.isArray(e) || !e.length ? null : /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("div", {
2902
2928
  className: `chat-media-grid ${n ? "chat-media-grid--history" : "chat-media-grid--draft"}`,
2903
- children: e.map((e, r) => e && typeof e == "object" ? /* @__PURE__ */ R(na, {
2929
+ children: e.map((e, r) => e && typeof e == "object" ? /* @__PURE__ */ R(ra, {
2904
2930
  item: e,
2905
2931
  history: n,
2906
2932
  onRemove: t ? () => t(r) : void 0,
@@ -2931,7 +2957,7 @@ function ra({ items: e = [], onRemove: t, history: n = !1 }) {
2931
2957
  }), document.body)] });
2932
2958
  }
2933
2959
  // src/media/youtube/youtubeLinks.js
2934
- var ia = /^[A-Za-z0-9_-]{11}$/, aa = /* @__PURE__ */ new Set([
2960
+ var aa = /^[A-Za-z0-9_-]{11}$/, oa = /* @__PURE__ */ new Set([
2935
2961
  "youtube.com",
2936
2962
  "www.youtube.com",
2937
2963
  "m.youtube.com",
@@ -2939,24 +2965,24 @@ var ia = /^[A-Za-z0-9_-]{11}$/, aa = /* @__PURE__ */ new Set([
2939
2965
  "youtube-nocookie.com",
2940
2966
  "www.youtube-nocookie.com"
2941
2967
  ]);
2942
- function oa(e) {
2968
+ function sa(e) {
2943
2969
  if (!e) return 0;
2944
2970
  if (/^\d+$/.test(e)) return Math.min(Number(e), 604800);
2945
2971
  let t = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(e);
2946
2972
  return t ? Math.min(Number(t[1] || 0) * 3600 + Number(t[2] || 0) * 60 + Number(t[3] || 0), 604800) : 0;
2947
2973
  }
2948
- function sa(e) {
2974
+ function ca(e) {
2949
2975
  if (typeof e != "string" || /[\s\\]/.test(e)) return null;
2950
2976
  try {
2951
2977
  let t = new URL(/^[a-z][a-z\d+.-]*:/i.test(e) ? e : `https://${e}`);
2952
2978
  if (!["https:", "http:"].includes(t.protocol) || t.username || t.password || t.port) return null;
2953
2979
  let n = t.hostname.toLowerCase(), r = t.pathname.split("/").filter(Boolean), i;
2954
- if (n === "youtu.be" || n === "www.youtu.be" ? i = r.length === 1 ? r[0] : null : aa.has(n) && (t.pathname === "/watch" ? i = t.searchParams.get("v") : [
2980
+ if (n === "youtu.be" || n === "www.youtu.be" ? i = r.length === 1 ? r[0] : null : oa.has(n) && (t.pathname === "/watch" ? i = t.searchParams.get("v") : [
2955
2981
  "shorts",
2956
2982
  "embed",
2957
2983
  "live"
2958
- ].includes(r[0]) && r.length === 2 && (i = r[1])), !ia.test(i ?? "")) return null;
2959
- let a = oa(t.searchParams.get("start") || t.searchParams.get("t") || new URLSearchParams(t.hash.slice(1)).get("t")), o = a ? `&start=${a}` : "";
2984
+ ].includes(r[0]) && r.length === 2 && (i = r[1])), !aa.test(i ?? "")) return null;
2985
+ let a = sa(t.searchParams.get("start") || t.searchParams.get("t") || new URLSearchParams(t.hash.slice(1)).get("t")), o = a ? `&start=${a}` : "";
2960
2986
  return {
2961
2987
  id: i,
2962
2988
  start: a,
@@ -2967,18 +2993,18 @@ function sa(e) {
2967
2993
  return null;
2968
2994
  }
2969
2995
  }
2970
- function ca(e) {
2996
+ function la(e) {
2971
2997
  if (typeof e != "string") return null;
2972
2998
  let t = e.matchAll(/(?:^|[\s(<])((?:https?:\/\/|www\.|(?:youtube\.com|youtu\.be)\/)[^\s<>"']+)/gi);
2973
2999
  for (let [, e] of t) {
2974
- let t = sa(e.replace(/[).,!?;:\]}]+$/, ""));
3000
+ let t = ca(e.replace(/[).,!?;:\]}]+$/, ""));
2975
3001
  if (t) return t;
2976
3002
  }
2977
3003
  return null;
2978
3004
  }
2979
3005
  // src/ui/components/YouTubePreview.jsx
2980
- function la({ text: e }) {
2981
- let t = D(sr), n = A(() => ca(e), [e]);
3006
+ function ua({ text: e }) {
3007
+ let t = D(sr), n = A(() => la(e), [e]);
2982
3008
  return !n || t?.config?.features === !1 || t?.config?.features?.youtube === !1 ? null : /* @__PURE__ */ z("div", {
2983
3009
  className: "chat-youtube-preview",
2984
3010
  children: [/* @__PURE__ */ R("iframe", {
@@ -2997,14 +3023,14 @@ function la({ text: e }) {
2997
3023
  });
2998
3024
  }
2999
3025
  // src/media/emoji/emojiShortcodes.js
3000
- var ua = () => Promise.all([
3026
+ var da = () => Promise.all([
3001
3027
  import("emojibase-data/en/compact.json"),
3002
3028
  import("emojibase-data/es/compact.json"),
3003
3029
  import("emojibase-data/en/shortcodes/github.json"),
3004
3030
  import("emojibase-data/en/shortcodes/emojibase.json"),
3005
3031
  import("emojibase-data/en/shortcodes/iamcal.json"),
3006
3032
  import("emojibase-data/es/messages.json")
3007
- ]).then((e) => e.map((e) => e.default ?? e)), da = {
3033
+ ]).then((e) => e.map((e) => e.default ?? e)), fa = {
3008
3034
  grin: "😀",
3009
3035
  smile: "😄",
3010
3036
  smiley: "😃",
@@ -3618,7 +3644,7 @@ var ua = () => Promise.all([
3618
3644
  flag_vn: "🇻🇳",
3619
3645
  flag_my: "🇲🇾",
3620
3646
  flag_sg: "🇸🇬"
3621
- }, fa = {
3647
+ }, pa = {
3622
3648
  "❤️": [
3623
3649
  "corazon",
3624
3650
  "amor",
@@ -3690,7 +3716,7 @@ var ua = () => Promise.all([
3690
3716
  "👀": ["mirar", "ojos"],
3691
3717
  "🚀": ["cohete"],
3692
3718
  "💰": ["dinero", "plata"]
3693
- }, pa = (e) => String(e ?? "").normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().replace(/:/g, "").replace(/_/g, " ").replace(/\s+/g, " ").trim(), ma = /[\u{1F3FB}-\u{1F3FF}]/gu, ha = (e) => String(e).replace(/️/g, ""), ga = (e) => ha(e).replace(ma, ""), _a = (e) => Array.isArray(e) ? e : e ? [e] : [], va = (e) => e && e.charAt(0).toUpperCase() + e.slice(1), ya = (e) => e.replace(/ /g, ""), ba = 2, xa = [
3719
+ }, ma = (e) => String(e ?? "").normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().replace(/:/g, "").replace(/_/g, " ").replace(/\s+/g, " ").trim(), ha = /[\u{1F3FB}-\u{1F3FF}]/gu, ga = (e) => String(e).replace(/️/g, ""), _a = (e) => ga(e).replace(ha, ""), va = (e) => Array.isArray(e) ? e : e ? [e] : [], ya = (e) => e && e.charAt(0).toUpperCase() + e.slice(1), ba = (e) => e.replace(/ /g, ""), xa = 2, Sa = [
3694
3720
  {
3695
3721
  tone: 0,
3696
3722
  label: "Predeterminado",
@@ -3721,18 +3747,18 @@ var ua = () => Promise.all([
3721
3747
  label: "Oscuro",
3722
3748
  swatch: "✋🏿"
3723
3749
  }
3724
- ], Sa = (e) => [["all", "Todos"], ...e.groups.filter((e) => e.order !== ba).map((e) => [String(e.order), va(e.message)])], Ca = [["all", "Todos"]], wa = /* @__PURE__ */ new Map();
3725
- for (let [e, t] of Object.entries(da)) {
3726
- let n = ha(t);
3727
- wa.has(n) || wa.set(n, []), wa.get(n).push(e);
3750
+ ], Ca = (e) => [["all", "Todos"], ...e.groups.filter((e) => e.order !== xa).map((e) => [String(e.order), ya(e.message)])], wa = [["all", "Todos"]], Ta = /* @__PURE__ */ new Map();
3751
+ for (let [e, t] of Object.entries(fa)) {
3752
+ let n = ga(t);
3753
+ Ta.has(n) || Ta.set(n, []), Ta.get(n).push(e);
3728
3754
  }
3729
- var Ta = new Map(Object.entries(fa).map(([e, t]) => [ha(e), t])), Ea = (e) => {
3755
+ var Ea = new Map(Object.entries(pa).map(([e, t]) => [ga(e), t])), Da = (e) => {
3730
3756
  let t = e.split("-").filter((e) => /^1F3F[B-F]$/.test(e));
3731
3757
  return !t.length || t.some((e) => e !== t[0]) ? 0 : parseInt(t[0].slice(-1), 16) - 10;
3732
- }, Da = (e) => {
3758
+ }, Oa = (e) => {
3733
3759
  let t = /* @__PURE__ */ new Map();
3734
3760
  for (let n of e || []) {
3735
- let e = Ea(n.hexcode);
3761
+ let e = Da(n.hexcode);
3736
3762
  e && !t.has(e) && t.set(e, {
3737
3763
  tone: e,
3738
3764
  emoji: n.unicode
@@ -3740,85 +3766,85 @@ var Ta = new Map(Object.entries(fa).map(([e, t]) => [ha(e), t])), Ea = (e) => {
3740
3766
  }
3741
3767
  return t.size ? [...t.values()].sort((e, t) => e.tone - t.tone) : void 0;
3742
3768
  };
3743
- function Oa({ english: e, spanish: t, githubShortcodes: n, emojibaseShortcodes: r, iamcalShortcodes: i }) {
3769
+ function ka({ english: e, spanish: t, githubShortcodes: n, emojibaseShortcodes: r, iamcalShortcodes: i }) {
3744
3770
  let a = new Map(t.map((e) => [e.hexcode, e]));
3745
- return e.filter((e) => e.group != null && e.group !== ba).map((e) => {
3746
- let t = a.get(e.hexcode), o = ha(e.unicode), s = [...wa.get(o) || [], ..._a(n[e.hexcode])], c = [..._a(r[e.hexcode]), ..._a(i[e.hexcode])], l = Ta.get(o) || [], u = [.../* @__PURE__ */ new Set([
3771
+ return e.filter((e) => e.group != null && e.group !== xa).map((e) => {
3772
+ let t = a.get(e.hexcode), o = ga(e.unicode), s = [...Ta.get(o) || [], ...va(n[e.hexcode])], c = [...va(r[e.hexcode]), ...va(i[e.hexcode])], l = Ea.get(o) || [], u = [.../* @__PURE__ */ new Set([
3747
3773
  ...s,
3748
3774
  ...c,
3749
3775
  ...l.map((e) => e.replace(/ /g, "_"))
3750
3776
  ])], d = u[0] || e.label.replace(/[^a-z0-9]+/gi, "_").replace(/^_|_$/g, "").toLowerCase();
3751
3777
  u.length || u.push(d);
3752
- let f = t?.label || e.label, p = [...new Set([...t?.tags || [], ...e.tags || []].map(pa).filter(Boolean))];
3778
+ let f = t?.label || e.label, p = [...new Set([...t?.tags || [], ...e.tags || []].map(ma).filter(Boolean))];
3753
3779
  return {
3754
3780
  emoji: e.unicode,
3755
3781
  hexcode: e.hexcode,
3756
3782
  shortcode: d,
3757
3783
  shortcodes: u,
3758
- label: va(f),
3784
+ label: ya(f),
3759
3785
  labelEn: e.label,
3760
3786
  source: "unicode",
3761
3787
  category: String(e.group),
3762
3788
  keywords: p,
3763
- skins: Da(e.skins),
3789
+ skins: Oa(e.skins),
3764
3790
  order: e.order ?? 0,
3765
3791
  terms: [...new Set([
3766
3792
  ...u,
3767
3793
  f,
3768
3794
  e.label,
3769
3795
  ...p
3770
- ].map(pa).filter(Boolean))],
3796
+ ].map(ma).filter(Boolean))],
3771
3797
  _primary: [...s, ...l]
3772
3798
  };
3773
3799
  }).sort((e, t) => e.order - t.order);
3774
3800
  }
3775
- var ka = Ui.map((e, t) => ({
3801
+ var Aa = Wi.map((e, t) => ({
3776
3802
  ...e,
3777
3803
  emoji: `:${e.shortcode}:`,
3778
3804
  shortcodes: [e.shortcode, ...e.shortcodes || []],
3779
- label: va(e.label || e.shortcode),
3805
+ label: ya(e.label || e.shortcode),
3780
3806
  labelEn: e.label || e.shortcode,
3781
3807
  source: "custom",
3782
3808
  category: "custom",
3783
- keywords: (e.keywords || []).map(pa).filter(Boolean),
3809
+ keywords: (e.keywords || []).map(ma).filter(Boolean),
3784
3810
  skins: void 0,
3785
3811
  order: 1e5 + t,
3786
3812
  terms: [...new Set([
3787
3813
  e.shortcode,
3788
3814
  e.label,
3789
3815
  ...e.keywords || []
3790
- ].filter(Boolean).map(pa))]
3791
- })), Aa = (e) => e.split(" ").filter(Boolean), ja = (e, t, n) => {
3816
+ ].filter(Boolean).map(ma))]
3817
+ })), ja = (e) => e.split(" ").filter(Boolean), Ma = (e, t, n) => {
3792
3818
  t && !e.has(t) && e.set(t, n);
3793
3819
  };
3794
- function Ma(e) {
3820
+ function Na(e) {
3795
3821
  let t = /* @__PURE__ */ new Map();
3796
- for (let n of e) t.set(n, n._primary.map(pa)), delete n._primary;
3797
- let n = [...e, ...ka], r = n.map((e) => {
3798
- let t = [...new Set(e.shortcodes.map(pa).filter(Boolean))], n = [...new Set([e.label, e.labelEn].filter(Boolean).map(pa))];
3822
+ for (let n of e) t.set(n, n._primary.map(ma)), delete n._primary;
3823
+ let n = [...e, ...Aa], r = n.map((e) => {
3824
+ let t = [...new Set(e.shortcodes.map(ma).filter(Boolean))], n = [...new Set([e.label, e.labelEn].filter(Boolean).map(ma))];
3799
3825
  return {
3800
3826
  record: e,
3801
3827
  aliases: t,
3802
- aliasCompact: t.map(ya),
3803
- aliasWords: t.flatMap((e) => Aa(e).map((t) => [t, e.length])),
3828
+ aliasCompact: t.map(ba),
3829
+ aliasWords: t.flatMap((e) => ja(e).map((t) => [t, e.length])),
3804
3830
  labels: n,
3805
- labelWords: n.flatMap((e) => Aa(e).map((t) => [t, e.length])),
3831
+ labelWords: n.flatMap((e) => ja(e).map((t) => [t, e.length])),
3806
3832
  keywords: e.keywords,
3807
- keywordWords: e.keywords.flatMap((e) => Aa(e).map((t) => [t, e.length])),
3833
+ keywordWords: e.keywords.flatMap((e) => ja(e).map((t) => [t, e.length])),
3808
3834
  terms: e.terms
3809
3835
  };
3810
3836
  }), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
3811
3837
  for (let n of e) {
3812
- ja(i, ha(n.emoji), n);
3813
- for (let e of n.skins || []) ja(i, ha(e.emoji), n);
3814
- for (let e of t.get(n)) ja(a, e, n);
3838
+ Ma(i, ga(n.emoji), n);
3839
+ for (let e of n.skins || []) Ma(i, ga(e.emoji), n);
3840
+ for (let e of t.get(n)) Ma(a, e, n);
3815
3841
  }
3816
3842
  for (let e of r) if (e.record.source === "unicode") {
3817
- for (let t of e.aliases) ja(a, t, e.record), ja(a, ya(t), e.record);
3818
- for (let t of e.labels) ja(o, t, e.record);
3819
- for (let t of e.terms) ja(s, t, e.record);
3843
+ for (let t of e.aliases) Ma(a, t, e.record), Ma(a, ba(t), e.record);
3844
+ for (let t of e.labels) Ma(o, t, e.record);
3845
+ for (let t of e.terms) Ma(s, t, e.record);
3820
3846
  }
3821
- for (let t of e) ja(i, ga(t.emoji), t);
3847
+ for (let t of e) Ma(i, _a(t.emoji), t);
3822
3848
  return {
3823
3849
  index: n,
3824
3850
  searchData: r,
@@ -3828,189 +3854,189 @@ function Ma(e) {
3828
3854
  termMap: s
3829
3855
  };
3830
3856
  }
3831
- var Na = new Map(ka.map((e) => [pa(e.shortcode), e])), Pa = Ma([]), Fa = !1, Ia = null, La = /* @__PURE__ */ new Set();
3832
- function Ra() {
3833
- return Fa;
3857
+ var Pa = new Map(Aa.map((e) => [ma(e.shortcode), e])), Fa = Na([]), Ia = !1, La = null, Ra = /* @__PURE__ */ new Set();
3858
+ function za() {
3859
+ return Ia;
3834
3860
  }
3835
- function za(e) {
3836
- return La.add(e), () => {
3837
- La.delete(e);
3861
+ function Ba(e) {
3862
+ return Ra.add(e), () => {
3863
+ Ra.delete(e);
3838
3864
  };
3839
3865
  }
3840
- function Ba() {
3841
- return Fa ? Promise.resolve(!0) : (Ia || (Ia = ua().then(([e, t, n, r, i, a]) => {
3842
- Pa = Ma(Oa({
3866
+ function Va() {
3867
+ return Ia ? Promise.resolve(!0) : (La || (La = da().then(([e, t, n, r, i, a]) => {
3868
+ Fa = Na(ka({
3843
3869
  english: e,
3844
3870
  spanish: t,
3845
3871
  githubShortcodes: n,
3846
3872
  emojibaseShortcodes: r,
3847
3873
  iamcalShortcodes: i
3848
- })), Ca = Sa(a), Fa = !0;
3849
- for (let e of [...La]) try {
3874
+ })), wa = Ca(a), Ia = !0;
3875
+ for (let e of [...Ra]) try {
3850
3876
  e();
3851
3877
  } catch (e) {
3852
3878
  console.error("[chat] emoji data listener failed", e);
3853
3879
  }
3854
3880
  return !0;
3855
- }).catch((e) => (Ia = null, console.warn("[chat] could not load emojibase-data", e), !1))), Ia);
3881
+ }).catch((e) => (La = null, console.warn("[chat] could not load emojibase-data", e), !1))), La);
3856
3882
  }
3857
- var Va = () => {
3858
- !Fa && !Ia && Ba();
3859
- }, Ha = 1e4, Ua = Infinity;
3860
- function Wa(e, t) {
3883
+ var Ha = () => {
3884
+ !Ia && !La && Va();
3885
+ }, Ua = 1e4, Wa = Infinity;
3886
+ function Ga(e, t) {
3861
3887
  if (e.aliases.includes(t) || e.aliasCompact.includes(t) || e.labels.includes(t)) return t.length;
3862
- let n = Ua;
3863
- for (let r = 0; r < e.aliases.length; r += 1) (e.aliases[r].startsWith(t) || e.aliasCompact[r].startsWith(t)) && (n = Math.min(n, Ha + e.aliases[r].length));
3864
- if (n !== Ua) return n;
3865
- for (let r of e.labels) r.startsWith(t) && (n = Math.min(n, 2 * Ha + r.length));
3866
- for (let [r, i] of e.labelWords) r.startsWith(t) && (n = Math.min(n, 2 * Ha + i));
3867
- for (let [r, i] of e.aliasWords) r.startsWith(t) && (n = Math.min(n, 2 * Ha + i));
3868
- if (n !== Ua) return n;
3869
- for (let r of e.keywords) r.startsWith(t) && (n = Math.min(n, 3 * Ha + r.length));
3870
- for (let [r, i] of e.keywordWords) r.startsWith(t) && (n = Math.min(n, 3 * Ha + i));
3871
- if (n !== Ua) return n;
3872
- for (let r of e.terms) r.includes(t) && (n = Math.min(n, 4 * Ha + r.length));
3888
+ let n = Wa;
3889
+ for (let r = 0; r < e.aliases.length; r += 1) (e.aliases[r].startsWith(t) || e.aliasCompact[r].startsWith(t)) && (n = Math.min(n, Ua + e.aliases[r].length));
3890
+ if (n !== Wa) return n;
3891
+ for (let r of e.labels) r.startsWith(t) && (n = Math.min(n, 2 * Ua + r.length));
3892
+ for (let [r, i] of e.labelWords) r.startsWith(t) && (n = Math.min(n, 2 * Ua + i));
3893
+ for (let [r, i] of e.aliasWords) r.startsWith(t) && (n = Math.min(n, 2 * Ua + i));
3894
+ if (n !== Wa) return n;
3895
+ for (let r of e.keywords) r.startsWith(t) && (n = Math.min(n, 3 * Ua + r.length));
3896
+ for (let [r, i] of e.keywordWords) r.startsWith(t) && (n = Math.min(n, 3 * Ua + i));
3897
+ if (n !== Wa) return n;
3898
+ for (let r of e.terms) r.includes(t) && (n = Math.min(n, 4 * Ua + r.length));
3873
3899
  return n;
3874
3900
  }
3875
- function Ga(e, t, n) {
3876
- let r = Wa(e, t);
3877
- if (n.length > 1 && r >= Ha) {
3901
+ function Ka(e, t, n) {
3902
+ let r = Ga(e, t);
3903
+ if (n.length > 1 && r >= Ua) {
3878
3904
  let t = 0;
3879
- for (let r of n) if (t = Math.max(t, Wa(e, r)), t === Ua) break;
3905
+ for (let r of n) if (t = Math.max(t, Ga(e, r)), t === Wa) break;
3880
3906
  r = Math.min(r, t);
3881
3907
  }
3882
3908
  return r;
3883
3909
  }
3884
- function Ka(e, { limit: t = 10, source: n, category: r } = {}) {
3885
- Va();
3886
- let i = pa(e), a = ha(String(e ?? "").trim()), o = Aa(i), s = [];
3887
- for (let e of Pa.searchData) {
3910
+ function qa(e, { limit: t = 10, source: n, category: r } = {}) {
3911
+ Ha();
3912
+ let i = ma(e), a = ga(String(e ?? "").trim()), o = ja(i), s = [];
3913
+ for (let e of Fa.searchData) {
3888
3914
  let { record: t } = e;
3889
3915
  if (n && t.source !== n || r && r !== "all" && t.category !== r) continue;
3890
3916
  let c;
3891
- c = i ? a && (ha(t.emoji) === a || t.skins?.some((e) => ha(e.emoji) === a)) ? 0 : Ga(e, i, o) : 0, c !== Ua && s.push({
3917
+ c = i ? a && (ga(t.emoji) === a || t.skins?.some((e) => ga(e.emoji) === a)) ? 0 : Ka(e, i, o) : 0, c !== Wa && s.push({
3892
3918
  record: t,
3893
3919
  score: c
3894
3920
  });
3895
3921
  }
3896
3922
  return s.sort((e, t) => e.score - t.score || e.record.order - t.record.order), s.slice(0, t).map(({ record: e }) => e);
3897
3923
  }
3898
- function qa(e) {
3899
- return Va(), !e || e === "all" ? Pa.index : Pa.index.filter((t) => t.category === e);
3900
- }
3901
3924
  function Ja(e) {
3925
+ return Ha(), !e || e === "all" ? Fa.index : Fa.index.filter((t) => t.category === e);
3926
+ }
3927
+ function Ya(e) {
3902
3928
  if (e == null) return null;
3903
- Va();
3929
+ Ha();
3904
3930
  let t = String(e).trim();
3905
3931
  if (/^:[^:\s]+:$/.test(t)) {
3906
- let e = pa(t);
3907
- return Na.get(e) || Pa.aliasMap.get(e) || null;
3932
+ let e = ma(t);
3933
+ return Pa.get(e) || Fa.aliasMap.get(e) || null;
3908
3934
  }
3909
- return Pa.byEmoji.get(ha(t)) || Pa.byEmoji.get(ga(t)) || null;
3935
+ return Fa.byEmoji.get(ga(t)) || Fa.byEmoji.get(_a(t)) || null;
3910
3936
  }
3911
- function Ya(e, t) {
3912
- let n = typeof e == "string" ? Ja(e) : e?.skins ? e : Ja(e?.emoji), r = typeof e == "string" ? e : e?.emoji ?? null;
3937
+ function Xa(e, t) {
3938
+ let n = typeof e == "string" ? Ya(e) : e?.skins ? e : Ya(e?.emoji), r = typeof e == "string" ? e : e?.emoji ?? null;
3913
3939
  if (!n) return r;
3914
3940
  let i = Number(t) || 0;
3915
3941
  return !i || !n.skins ? n.emoji : n.skins.find((e) => e.tone === i)?.emoji || n.emoji;
3916
3942
  }
3917
- function Xa(e) {
3943
+ function Za(e) {
3918
3944
  let t = String(e).toLowerCase();
3919
- if (Object.prototype.hasOwnProperty.call(da, t)) return da[t];
3920
- let n = pa(e);
3945
+ if (Object.prototype.hasOwnProperty.call(fa, t)) return fa[t];
3946
+ let n = ma(e);
3921
3947
  if (!n) return null;
3922
- Va();
3923
- let { aliasMap: r, labelMap: i, termMap: a } = Pa;
3924
- return (r.get(n) || r.get(ya(n)) || i.get(n) || a.get(n))?.emoji || null;
3925
- }
3926
- var Za = "lira-emoji-preferences:v1", Qa = "lira-chat-recent-emojis", $a = 64, eo = typeof window < "u", to = /[\u0000-\u001F\u007F-\u009F]/;
3927
- function no(e) {
3928
- return typeof e != "string" || !e || e.length > $a || to.test(e) ? null : e;
3948
+ Ha();
3949
+ let { aliasMap: r, labelMap: i, termMap: a } = Fa;
3950
+ return (r.get(n) || r.get(ba(n)) || i.get(n) || a.get(n))?.emoji || null;
3929
3951
  }
3952
+ var Qa = "lira-emoji-preferences:v1", $a = "lira-chat-recent-emojis", eo = 64, to = typeof window < "u", no = /[\u0000-\u001F\u007F-\u009F]/;
3930
3953
  function ro(e) {
3954
+ return typeof e != "string" || !e || e.length > eo || no.test(e) ? null : e;
3955
+ }
3956
+ function io(e) {
3931
3957
  return Number.isInteger(e) && e >= 0 && e <= 5 ? e : 0;
3932
3958
  }
3933
- function io(e, t) {
3959
+ function ao(e, t) {
3934
3960
  if (!Array.isArray(e)) return [];
3935
3961
  let n = /* @__PURE__ */ new Set(), r = [];
3936
3962
  for (let i of e) {
3937
- let e = no(i);
3963
+ let e = ro(i);
3938
3964
  if (e && !n.has(e) && (n.add(e), r.push(e), r.length >= t)) break;
3939
3965
  }
3940
3966
  return r;
3941
3967
  }
3942
- var ao = {
3968
+ var oo = {
3943
3969
  recents: [],
3944
3970
  favorites: [],
3945
3971
  skinTone: 0
3946
3972
  };
3947
- function oo(e) {
3973
+ function so(e) {
3948
3974
  return {
3949
- recents: io(e?.recents, 32),
3950
- favorites: io(e?.favorites, 60),
3951
- skinTone: ro(e?.skinTone)
3975
+ recents: ao(e?.recents, 32),
3976
+ favorites: ao(e?.favorites, 60),
3977
+ skinTone: io(e?.skinTone)
3952
3978
  };
3953
3979
  }
3954
- function so() {
3955
- if (!eo) return { ...ao };
3980
+ function co() {
3981
+ if (!to) return { ...oo };
3956
3982
  try {
3957
- let e = window.localStorage.getItem(Za);
3958
- return e ? oo(JSON.parse(e)) : { ...ao };
3983
+ let e = window.localStorage.getItem(Qa);
3984
+ return e ? so(JSON.parse(e)) : { ...oo };
3959
3985
  } catch {
3960
- return { ...ao };
3986
+ return { ...oo };
3961
3987
  }
3962
3988
  }
3963
- function co({ recents: e, favorites: t, skinTone: n }) {
3964
- if (eo) try {
3965
- window.localStorage.setItem(Za, JSON.stringify({
3989
+ function lo({ recents: e, favorites: t, skinTone: n }) {
3990
+ if (to) try {
3991
+ window.localStorage.setItem(Qa, JSON.stringify({
3966
3992
  recents: e,
3967
3993
  favorites: t,
3968
3994
  skinTone: n
3969
3995
  }));
3970
3996
  } catch {}
3971
3997
  }
3972
- function lo() {
3973
- if (!eo) return !1;
3998
+ function uo() {
3999
+ if (!to) return !1;
3974
4000
  let e = !1;
3975
4001
  try {
3976
- let t = window.localStorage.getItem(Qa);
4002
+ let t = window.localStorage.getItem($a);
3977
4003
  if (t == null) return !1;
3978
- if (!window.localStorage.getItem(Za)) {
4004
+ if (!window.localStorage.getItem(Qa)) {
3979
4005
  let n = null;
3980
4006
  try {
3981
4007
  n = JSON.parse(t);
3982
4008
  } catch {
3983
4009
  n = null;
3984
4010
  }
3985
- let r = io(Array.isArray(n) ? n : n?.recents, 32);
3986
- co({
3987
- ...ao,
4011
+ let r = ao(Array.isArray(n) ? n : n?.recents, 32);
4012
+ lo({
4013
+ ...oo,
3988
4014
  recents: r
3989
4015
  }), e = !0;
3990
4016
  }
3991
- window.localStorage.removeItem(Qa);
4017
+ window.localStorage.removeItem($a);
3992
4018
  } catch {}
3993
4019
  return e;
3994
4020
  }
3995
- function uo() {
4021
+ function fo() {
3996
4022
  let e = P((e, t) => {
3997
4023
  let n = (n) => {
3998
- e(n), co(t());
4024
+ e(n), lo(t());
3999
4025
  };
4000
4026
  return {
4001
- ...so(),
4027
+ ...co(),
4002
4028
  isFavorite: (e) => {
4003
- let n = no(e);
4029
+ let n = ro(e);
4004
4030
  return n ? t().favorites.includes(n) : !1;
4005
4031
  },
4006
4032
  toggleFavorite: (e) => {
4007
- let r = no(e);
4033
+ let r = ro(e);
4008
4034
  if (!r) return;
4009
4035
  let { favorites: i } = t();
4010
4036
  i.includes(r) ? n({ favorites: i.filter((e) => e !== r) }) : n({ favorites: [r, ...i].slice(0, 60) });
4011
4037
  },
4012
4038
  addRecent: (e) => {
4013
- let r = no(e);
4039
+ let r = ro(e);
4014
4040
  if (!r) return;
4015
4041
  let i = t().recents.filter((e) => e !== r);
4016
4042
  n({ recents: [r, ...i].slice(0, 32) });
@@ -4021,10 +4047,10 @@ function uo() {
4021
4047
  clearRecents: () => n({ recents: [] })
4022
4048
  };
4023
4049
  }), t = 0, n = !1, r = (t) => {
4024
- (t.key === Za || t.key === null) && e.setState(so());
4050
+ (t.key === Qa || t.key === null) && e.setState(co());
4025
4051
  };
4026
4052
  return e.startSync = () => {
4027
- if (!eo || (n || (n = !0, lo() && e.setState(so())), typeof window.addEventListener != "function")) return () => {};
4053
+ if (!to || (n || (n = !0, uo() && e.setState(co())), typeof window.addEventListener != "function")) return () => {};
4028
4054
  t === 0 && window.addEventListener("storage", r), t += 1;
4029
4055
  let i = !1;
4030
4056
  return function() {
@@ -4032,23 +4058,23 @@ function uo() {
4032
4058
  };
4033
4059
  }, e;
4034
4060
  }
4035
- var fo = uo(), po = Object.assign((e) => I(fo, e), {
4036
- getState: fo.getState,
4037
- setState: fo.setState,
4038
- subscribe: fo.subscribe
4061
+ var po = fo(), mo = Object.assign((e) => I(po, e), {
4062
+ getState: po.getState,
4063
+ setState: po.setState,
4064
+ subscribe: po.subscribe
4039
4065
  });
4040
- function mo(e = fo) {
4041
- return (e === po ? fo : e).startSync();
4066
+ function ho(e = po) {
4067
+ return (e === mo ? po : e).startSync();
4042
4068
  }
4043
4069
  // src/media/emoji/useEmojiData.js
4044
- function ho() {
4045
- let e = N(za, Ra, Ra);
4070
+ function go() {
4071
+ let e = N(Ba, za, za);
4046
4072
  return O(() => {
4047
- e || Ba();
4073
+ e || Va();
4048
4074
  }, [e]), e;
4049
4075
  }
4050
4076
  // src/ui/components/EmojiPicker.jsx
4051
- var go = {
4077
+ var _o = {
4052
4078
  recent: ce,
4053
4079
  favorites: Xe,
4054
4080
  0: Ke,
@@ -4062,16 +4088,16 @@ var go = {
4062
4088
  8: Ce,
4063
4089
  9: me,
4064
4090
  custom: Je
4065
- }, _o = 40, vo = 9, yo = 500;
4066
- function bo(e, t) {
4067
- return t.find((t) => t.emoji === e) || Ja(e) || {
4091
+ }, vo = 40, yo = 9, bo = 500;
4092
+ function xo(e, t) {
4093
+ return t.find((t) => t.emoji === e) || Ya(e) || {
4068
4094
  emoji: e,
4069
4095
  shortcode: "",
4070
4096
  label: e,
4071
4097
  source: "unicode"
4072
4098
  };
4073
4099
  }
4074
- var xo = T(function({ record: e, value: t, favorite: n, disabled: r, onPick: i, onToggleFavorite: a, onPreview: o }) {
4100
+ var So = T(function({ record: e, value: t, favorite: n, disabled: r, onPick: i, onToggleFavorite: a, onPreview: o }) {
4075
4101
  let s = j(null), c = j(!1), l = () => {
4076
4102
  s.current && (clearTimeout(s.current), s.current = null);
4077
4103
  };
@@ -4093,7 +4119,7 @@ var xo = T(function({ record: e, value: t, favorite: n, disabled: r, onPick: i,
4093
4119
  onTouchStart: () => {
4094
4120
  c.current = !1, l(), s.current = setTimeout(() => {
4095
4121
  c.current = !0, s.current = null, r || a(e);
4096
- }, yo);
4122
+ }, bo);
4097
4123
  },
4098
4124
  onTouchMove: l,
4099
4125
  onTouchEnd: l,
@@ -4101,10 +4127,10 @@ var xo = T(function({ record: e, value: t, favorite: n, disabled: r, onPick: i,
4101
4127
  onClick: (e) => {
4102
4128
  c.current ? (e.preventDefault(), c.current = !1) : i(t);
4103
4129
  },
4104
- children: /* @__PURE__ */ R(Zi, { text: t })
4130
+ children: /* @__PURE__ */ R(Qi, { text: t })
4105
4131
  });
4106
4132
  });
4107
- function So({ id: e, title: t, items: n, lazy: r, rootRef: i, children: a, ...o }) {
4133
+ function Co({ id: e, title: t, items: n, lazy: r, rootRef: i, children: a, ...o }) {
4108
4134
  let s = j(null), [c, l] = M(!r);
4109
4135
  O(() => {
4110
4136
  if (c || !s.current) return;
@@ -4120,7 +4146,7 @@ function So({ id: e, title: t, items: n, lazy: r, rootRef: i, children: a, ...o
4120
4146
  });
4121
4147
  return e.observe(s.current), () => e.disconnect();
4122
4148
  }, [c, i]);
4123
- let u = c ? void 0 : Math.ceil(n.length / vo) * _o;
4149
+ let u = c ? void 0 : Math.ceil(n.length / yo) * vo;
4124
4150
  return /* @__PURE__ */ z("section", {
4125
4151
  ref: s,
4126
4152
  className: "chat-emoji-section",
@@ -4137,7 +4163,7 @@ function So({ id: e, title: t, items: n, lazy: r, rootRef: i, children: a, ...o
4137
4163
  role: "listbox",
4138
4164
  "aria-label": t,
4139
4165
  style: u ? { minHeight: u } : void 0,
4140
- children: c && n.map(({ record: e, value: t }) => /* @__PURE__ */ R(xo, {
4166
+ children: c && n.map(({ record: e, value: t }) => /* @__PURE__ */ R(So, {
4141
4167
  record: e,
4142
4168
  value: t,
4143
4169
  favorite: o.favoriteSet.has(e.emoji),
@@ -4151,8 +4177,8 @@ function So({ id: e, title: t, items: n, lazy: r, rootRef: i, children: a, ...o
4151
4177
  ]
4152
4178
  });
4153
4179
  }
4154
- function Co({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4155
- let i = Yi(), a = po((e) => e.recents), o = po((e) => e.favorites), s = po((e) => e.skinTone), c = po((e) => e.addRecent), l = po((e) => e.toggleFavorite), u = po((e) => e.setSkinTone), d = ho(), [f, p] = M(""), [m, h] = M(!1), [g, _] = M(null), [v, y] = M(null), b = j(null), x = j(null), S = j(0), C = A(() => new Set(o || []), [o]), w = E((e) => e.source === "custom" ? e.emoji : Ya(e, s), [s]), T = f.trim(), D = A(() => {
4180
+ function wo({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4181
+ let i = Xi(), a = mo((e) => e.recents), o = mo((e) => e.favorites), s = mo((e) => e.skinTone), c = mo((e) => e.addRecent), l = mo((e) => e.toggleFavorite), u = mo((e) => e.setSkinTone), d = go(), [f, p] = M(""), [m, h] = M(!1), [g, _] = M(null), [v, y] = M(null), b = j(null), x = j(null), S = j(0), C = A(() => new Set(o || []), [o]), w = E((e) => e.source === "custom" ? e.emoji : Xa(e, s), [s]), T = f.trim(), D = A(() => {
4156
4182
  let e = (e) => {
4157
4183
  let t = /* @__PURE__ */ new Set();
4158
4184
  return e.map((e) => ({
@@ -4163,7 +4189,7 @@ function Co({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4163
4189
  if (T) return [{
4164
4190
  id: "results",
4165
4191
  title: "Resultados",
4166
- items: e([...Ji(i, f), ...Ka(f, { limit: 120 })].slice(0, 120)),
4192
+ items: e([...Yi(i, f), ...qa(f, { limit: 120 })].slice(0, 120)),
4167
4193
  lazy: !1
4168
4194
  }];
4169
4195
  let t = [];
@@ -4174,7 +4200,7 @@ function Co({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4174
4200
  title: "Recientes",
4175
4201
  lazy: !1,
4176
4202
  items: a.filter((t) => !e.has(t) && e.add(t)).map((e) => ({
4177
- record: bo(e, i),
4203
+ record: xo(e, i),
4178
4204
  value: e
4179
4205
  }))
4180
4206
  });
@@ -4183,9 +4209,9 @@ function Co({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4183
4209
  id: "favorites",
4184
4210
  title: "Favoritos",
4185
4211
  lazy: !1,
4186
- items: e(o.map((e) => bo(e, i)))
4187
- }), Ca.filter(([e]) => e !== "all").forEach(([n, r], i) => {
4188
- let a = qa(n) || [];
4212
+ items: e(o.map((e) => xo(e, i)))
4213
+ }), wa.filter(([e]) => e !== "all").forEach(([n, r], i) => {
4214
+ let a = Ja(n) || [];
4189
4215
  a.length && t.push({
4190
4216
  id: n,
4191
4217
  title: r,
@@ -4294,10 +4320,10 @@ function Co({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4294
4320
  e.preventDefault(), H(u);
4295
4321
  };
4296
4322
  if (!t) return null;
4297
- let G = xa.find((e) => e.tone === s) || xa[0], K = [
4323
+ let G = Sa.find((e) => e.tone === s) || Sa[0], K = [
4298
4324
  ...a?.length ? [["recent", "Recientes"]] : [],
4299
4325
  ...o?.length ? [["favorites", "Favoritos"]] : [],
4300
- ...Ca.filter(([e]) => e !== "all" && (qa(e) || []).length),
4326
+ ...wa.filter(([e]) => e !== "all" && (Ja(e) || []).length),
4301
4327
  ...i.length ? [["custom", "Personalizados"]] : []
4302
4328
  ], q = N ? C.has(N.record.emoji) : !1, ee = N?.record.shortcode ? `:${N.record.shortcode}:` : "";
4303
4329
  return /* @__PURE__ */ z("div", {
@@ -4345,7 +4371,7 @@ function Co({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4345
4371
  className: "chat-emoji-tone-menu",
4346
4372
  role: "menu",
4347
4373
  "aria-label": "Tono de piel",
4348
- children: xa.map((e) => /* @__PURE__ */ R("button", {
4374
+ children: Sa.map((e) => /* @__PURE__ */ R("button", {
4349
4375
  type: "button",
4350
4376
  role: "menuitemradio",
4351
4377
  className: "chat-emoji-tone-option",
@@ -4377,7 +4403,7 @@ function Co({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4377
4403
  role: "tablist",
4378
4404
  "aria-label": "Categorías de emojis",
4379
4405
  children: K.map(([e, t]) => {
4380
- let n = go[e] || Ke;
4406
+ let n = _o[e] || Ke;
4381
4407
  return /* @__PURE__ */ R("button", {
4382
4408
  type: "button",
4383
4409
  role: "tab",
@@ -4404,7 +4430,7 @@ function Co({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4404
4430
  className: "chat-emoji-empty",
4405
4431
  role: "status",
4406
4432
  children: "No se encontraron emojis"
4407
- }, "empty") : /* @__PURE__ */ R(So, {
4433
+ }, "empty") : /* @__PURE__ */ R(Co, {
4408
4434
  ...e,
4409
4435
  rootRef: b,
4410
4436
  favoriteSet: C,
@@ -4421,7 +4447,7 @@ function Co({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4421
4447
  /* @__PURE__ */ R("span", {
4422
4448
  className: "chat-emoji-preview-emoji",
4423
4449
  "aria-hidden": "true",
4424
- children: /* @__PURE__ */ R(Zi, { text: N.value })
4450
+ children: /* @__PURE__ */ R(Qi, { text: N.value })
4425
4451
  }),
4426
4452
  /* @__PURE__ */ z("span", {
4427
4453
  className: "chat-emoji-preview-info",
@@ -4452,7 +4478,7 @@ function Co({ onSelect: e, isOpen: t, onClose: n, disabled: r }) {
4452
4478
  });
4453
4479
  }
4454
4480
  // src/ui/components/ReactionPicker.jsx
4455
- var wo = [
4481
+ var To = [
4456
4482
  ["👍", "Me gusta"],
4457
4483
  ["❤️", "Me encanta"],
4458
4484
  ["😂", "Me divierte"],
@@ -4460,7 +4486,7 @@ var wo = [
4460
4486
  ["😢", "Me entristece"],
4461
4487
  ["🙏", "Gracias"]
4462
4488
  ];
4463
- function To({ onSelect: e, onClose: t, align: n = "start" }) {
4489
+ function Eo({ onSelect: e, onClose: t, align: n = "start" }) {
4464
4490
  let [r, i] = M(!1), a = j(null), o = j(null), s = j(t);
4465
4491
  s.current = t, O(() => {
4466
4492
  o.current?.querySelector(".chat-reaction-picker__option")?.focus();
@@ -4481,7 +4507,7 @@ function To({ onSelect: e, onClose: t, align: n = "start" }) {
4481
4507
  onKeyDown: (e) => {
4482
4508
  e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), t());
4483
4509
  },
4484
- children: r ? /* @__PURE__ */ R(Co, {
4510
+ children: r ? /* @__PURE__ */ R(wo, {
4485
4511
  isOpen: !0,
4486
4512
  onSelect: c,
4487
4513
  onClose: t
@@ -4500,14 +4526,14 @@ function To({ onSelect: e, onClose: t, align: n = "start" }) {
4500
4526
  let t = [...e.currentTarget.querySelectorAll("button")], n = t.indexOf(document.activeElement);
4501
4527
  n < 0 || !t.length || (e.preventDefault(), e.stopPropagation(), t[e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (n + (e.key === "ArrowRight" ? 1 : -1) + t.length) % t.length].focus());
4502
4528
  },
4503
- children: [wo.map(([e, t]) => /* @__PURE__ */ R("button", {
4529
+ children: [To.map(([e, t]) => /* @__PURE__ */ R("button", {
4504
4530
  type: "button",
4505
4531
  className: "chat-reaction-picker__option",
4506
4532
  title: t,
4507
4533
  "aria-label": t,
4508
4534
  onMouseDown: (e) => e.preventDefault(),
4509
4535
  onClick: () => c(e),
4510
- children: /* @__PURE__ */ R(Zi, { text: e })
4536
+ children: /* @__PURE__ */ R(Qi, { text: e })
4511
4537
  }, e)), /* @__PURE__ */ R("button", {
4512
4538
  type: "button",
4513
4539
  className: "chat-reaction-picker__more",
@@ -4523,16 +4549,16 @@ function To({ onSelect: e, onClose: t, align: n = "start" }) {
4523
4549
  });
4524
4550
  }
4525
4551
  // src/ui/chatPeopleContext.js
4526
- var Eo = C({
4552
+ var Do = C({
4527
4553
  ownIds: [],
4528
4554
  resolveName: () => null
4529
- }), Do = () => D(Eo), Oo = 10, ko = 300, Ao = () => typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
4530
- function jo({ reactions: e = [], onToggle: t, disabled: n }) {
4531
- let { ownIds: r, resolveName: i } = Do(), [a, o] = M(() => /* @__PURE__ */ new Set()), s = j(null), c = j({});
4555
+ }), Oo = () => D(Do), ko = 10, Ao = 300, jo = () => typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
4556
+ function Mo({ reactions: e = [], onToggle: t, disabled: n }) {
4557
+ let { ownIds: r, resolveName: i } = Oo(), [a, o] = M(() => /* @__PURE__ */ new Set()), s = j(null), c = j({});
4532
4558
  if (O(() => {
4533
4559
  let t = {}, n = [];
4534
4560
  for (let { emoji: r, count: i } of e) t[r] = i, s.current && i > (s.current[r] ?? 0) && n.push(r);
4535
- if (s.current = t, n.length && !Ao()) {
4561
+ if (s.current = t, n.length && !jo()) {
4536
4562
  o((e) => /* @__PURE__ */ new Set([...e, ...n]));
4537
4563
  for (let e of n) clearTimeout(c.current[e]), c.current[e] = setTimeout(() => {
4538
4564
  delete c.current[e], o((t) => {
@@ -4540,14 +4566,14 @@ function jo({ reactions: e = [], onToggle: t, disabled: n }) {
4540
4566
  let n = new Set(t);
4541
4567
  return n.delete(e), n;
4542
4568
  });
4543
- }, ko);
4569
+ }, Ao);
4544
4570
  }
4545
4571
  }, [e]), O(() => () => Object.values(c.current).forEach(clearTimeout), []), !e.length) return null;
4546
4572
  let l = new Set((r || []).map(String)), u = (e) => {
4547
4573
  let t = String(e);
4548
4574
  return l.has(t) ? "Tú" : i?.(t) || "Usuario";
4549
4575
  }, d = (e = []) => {
4550
- let t = e.slice(0, Oo).map(u), n = e.length - t.length;
4576
+ let t = e.slice(0, ko).map(u), n = e.length - t.length;
4551
4577
  return n > 0 ? `${t.join(", ")} y ${n} más` : t.join(", ");
4552
4578
  };
4553
4579
  return /* @__PURE__ */ R("div", {
@@ -4564,7 +4590,7 @@ function jo({ reactions: e = [], onToggle: t, disabled: n }) {
4564
4590
  onClick: () => t?.(e),
4565
4591
  children: [/* @__PURE__ */ R("span", {
4566
4592
  className: "chat-reaction-chip__emoji",
4567
- children: /* @__PURE__ */ R(Zi, { text: e })
4593
+ children: /* @__PURE__ */ R(Qi, { text: e })
4568
4594
  }), /* @__PURE__ */ R("span", {
4569
4595
  className: "chat-reaction-chip__count",
4570
4596
  children: r
@@ -4572,9 +4598,9 @@ function jo({ reactions: e = [], onToggle: t, disabled: n }) {
4572
4598
  }, e))
4573
4599
  });
4574
4600
  }
4575
- var Mo = T(jo);
4601
+ var No = T(Mo);
4576
4602
  // src/ui/components/MessageBubble.jsx
4577
- function No({ message: e, isMine: t, senderName: n, timestamp: r, onCopy: i, onReply: a, onJumpQuote: o, onReact: s, onEdit: c, isEditing: l }) {
4603
+ function Po({ message: e, isMine: t, senderName: n, timestamp: r, onCopy: i, onReply: a, onJumpQuote: o, onReact: s, onEdit: c, isEditing: l }) {
4578
4604
  let [u, d] = M(!1), [f, p] = M(""), [m, h] = M(!1), g = j(null), _ = e.message ?? e.text ?? "", v = /^> ([^\n]{1,240})\n\n/.exec(_), y = v ? _.slice(v[0].length) : _, b = Ai(y), x = Array.isArray(e.attachments) ? e.attachments : e.attachment ? [e.attachment] : [], S = r == null ? null : new Date(r), C = S && Number.isFinite(S.getTime()), w = !_.trim() && x.length > 0 && x.every(Jt), T = !!e.reactionGroups?.length, E = () => {
4579
4605
  h(!1), g.current?.focus();
4580
4606
  }, D = [
@@ -4608,22 +4634,22 @@ function No({ message: e, isMine: t, senderName: n, timestamp: r, onCopy: i, onR
4608
4634
  className: "chat-quote-link",
4609
4635
  title: "Buscar cita de texto en los mensajes disponibles",
4610
4636
  onClick: () => d(!o?.(v[1])),
4611
- children: /* @__PURE__ */ R(Zi, { text: v[1] })
4637
+ children: /* @__PURE__ */ R(Qi, { text: v[1] })
4612
4638
  }), u && /* @__PURE__ */ R("small", {
4613
4639
  role: "status",
4614
4640
  children: "Original no disponible o cita ambigua"
4615
4641
  })]
4616
4642
  }),
4617
- b ? /* @__PURE__ */ R(Vi, { effect: b }) : y && /* @__PURE__ */ R("div", {
4643
+ b ? /* @__PURE__ */ R(Hi, { effect: b }) : y && /* @__PURE__ */ R("div", {
4618
4644
  className: "message-content",
4619
- children: /* @__PURE__ */ R(Zi, { text: y })
4645
+ children: /* @__PURE__ */ R(Qi, { text: y })
4620
4646
  }),
4621
- !b && /* @__PURE__ */ R(la, { text: y }),
4622
- /* @__PURE__ */ R(ra, {
4647
+ !b && /* @__PURE__ */ R(ua, { text: y }),
4648
+ /* @__PURE__ */ R(ia, {
4623
4649
  items: x,
4624
4650
  history: !0
4625
4651
  }),
4626
- /* @__PURE__ */ R(Mo, {
4652
+ /* @__PURE__ */ R(No, {
4627
4653
  reactions: e.reactionGroups,
4628
4654
  onToggle: (t) => s?.(e, t),
4629
4655
  disabled: !s
@@ -4680,7 +4706,7 @@ function No({ message: e, isMine: t, senderName: n, timestamp: r, onCopy: i, onR
4680
4706
  }),
4681
4707
  m && s && /* @__PURE__ */ R("div", {
4682
4708
  className: "message-reaction-popover",
4683
- children: /* @__PURE__ */ R(To, {
4709
+ children: /* @__PURE__ */ R(Eo, {
4684
4710
  align: t ? "end" : "start",
4685
4711
  onClose: E,
4686
4712
  onSelect: (t) => {
@@ -4717,7 +4743,7 @@ function No({ message: e, isMine: t, senderName: n, timestamp: r, onCopy: i, onR
4717
4743
  });
4718
4744
  }
4719
4745
  // src/games/shared/useGamePanelStore.js
4720
- function Po() {
4746
+ function Fo() {
4721
4747
  return P((e) => ({
4722
4748
  panels: {},
4723
4749
  setMinimized: (t, n) => e((e) => ({ panels: {
@@ -4738,14 +4764,14 @@ function Po() {
4738
4764
  reset: () => e({ panels: {} })
4739
4765
  }));
4740
4766
  }
4741
- var Fo = Po(), Io = (e) => I(Fo, e);
4742
- Object.assign(Io, {
4743
- getState: Fo.getState,
4744
- setState: Fo.setState,
4745
- subscribe: Fo.subscribe
4767
+ var Io = Fo(), Lo = (e) => I(Io, e);
4768
+ Object.assign(Lo, {
4769
+ getState: Io.getState,
4770
+ setState: Io.setState,
4771
+ subscribe: Io.subscribe
4746
4772
  });
4747
4773
  // src/games/connect4/GameCard.jsx
4748
- function Lo({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
4774
+ function Ro({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
4749
4775
  return e?.status === "requesting" ? /* @__PURE__ */ R("div", {
4750
4776
  className: "chat-game-sync",
4751
4777
  role: "status",
@@ -4772,7 +4798,7 @@ function Lo({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
4772
4798
  ]
4773
4799
  });
4774
4800
  }
4775
- function Ro({ game: e, currentUserId: t, onAccept: n, onDecline: r, onMove: i, onClose: a, onRetry: o, onDropSettled: s, onMinimize: c, onDismiss: l, onResync: d, onAdoptOffer: f, soundControls: m, variant: g, connected: _ = !0 }) {
4801
+ function zo({ game: e, currentUserId: t, onAccept: n, onDecline: r, onMove: i, onClose: a, onRetry: o, onDropSettled: s, onMinimize: c, onDismiss: l, onResync: d, onAdoptOffer: f, soundControls: m, variant: g, connected: _ = !0 }) {
4776
4802
  let v = u(t, e.hostId), y = u(t, e.guestId), b = v || y, x = e.status === "active" && u(t, e.turnId), S = !_ || e.pending || !!e.pendingEvent, C = x && !S && !e.error, w = p(e), T = e.board || Array.from({ length: 6 }, () => Array(7).fill(null)), E = h(e, t);
4777
4803
  return /* @__PURE__ */ z("section", {
4778
4804
  className: `chat-game-card${x ? " chat-game-card--my-turn" : ""}${g ? ` chat-game-card--${g}` : ""}`,
@@ -4898,7 +4924,7 @@ function Ro({ game: e, currentUserId: t, onAccept: n, onDecline: r, onMove: i, o
4898
4924
  children: "Rechazar"
4899
4925
  })]
4900
4926
  }),
4901
- e.status === "conflict" && b && /* @__PURE__ */ R(Lo, {
4927
+ e.status === "conflict" && b && /* @__PURE__ */ R(Ro, {
4902
4928
  sync: e.sync,
4903
4929
  connected: _,
4904
4930
  onResync: d,
@@ -4922,35 +4948,35 @@ function Ro({ game: e, currentUserId: t, onAccept: n, onDecline: r, onMove: i, o
4922
4948
  ]
4923
4949
  });
4924
4950
  }
4925
- var zo = T(Ro);
4951
+ var Bo = T(zo);
4926
4952
  // \0@oxc-project+runtime@0.155.0/helpers/esm/typeof.js
4927
- function Bo(e) {
4953
+ function Vo(e) {
4928
4954
  "@babel/helpers - typeof";
4929
- return Bo = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
4955
+ return Vo = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
4930
4956
  return typeof e;
4931
4957
  } : function(e) {
4932
4958
  return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
4933
- }, Bo(e);
4959
+ }, Vo(e);
4934
4960
  }
4935
4961
  // \0@oxc-project+runtime@0.155.0/helpers/esm/toPrimitive.js
4936
- function Vo(e, t) {
4937
- if (Bo(e) != "object" || !e) return e;
4962
+ function Ho(e, t) {
4963
+ if (Vo(e) != "object" || !e) return e;
4938
4964
  var n = e[Symbol.toPrimitive];
4939
4965
  if (n !== void 0) {
4940
4966
  var r = n.call(e, t || "default");
4941
- if (Bo(r) != "object") return r;
4967
+ if (Vo(r) != "object") return r;
4942
4968
  throw TypeError("@@toPrimitive must return a primitive value.");
4943
4969
  }
4944
4970
  return (t === "string" ? String : Number)(e);
4945
4971
  }
4946
4972
  // \0@oxc-project+runtime@0.155.0/helpers/esm/toPropertyKey.js
4947
- function Ho(e) {
4948
- var t = Vo(e, "string");
4949
- return Bo(t) == "symbol" ? t : t + "";
4973
+ function Uo(e) {
4974
+ var t = Ho(e, "string");
4975
+ return Vo(t) == "symbol" ? t : t + "";
4950
4976
  }
4951
4977
  // \0@oxc-project+runtime@0.155.0/helpers/esm/defineProperty.js
4952
- function Uo(e, t, n) {
4953
- return (t = Ho(t)) in e ? Object.defineProperty(e, t, {
4978
+ function Wo(e, t, n) {
4979
+ return (t = Uo(t)) in e ? Object.defineProperty(e, t, {
4954
4980
  value: n,
4955
4981
  enumerable: !0,
4956
4982
  configurable: !0,
@@ -4958,8 +4984,8 @@ function Uo(e, t, n) {
4958
4984
  }) : e[t] = n, e;
4959
4985
  }
4960
4986
  // src/games/shared/ConnectedGameCard.jsx
4961
- var Wo = () => w(() => import("./chunks/BattleshipGameCard-CW_A8Nim.js")), Go = Wo();
4962
- function Ko() {
4987
+ var Go = () => w(() => import("./chunks/BattleshipGameCard-CW_A8Nim.js")), Ko = Go();
4988
+ function qo() {
4963
4989
  return /* @__PURE__ */ R("section", {
4964
4990
  className: "chat-game-card",
4965
4991
  "aria-busy": "true",
@@ -4971,9 +4997,9 @@ function Ko() {
4971
4997
  })
4972
4998
  });
4973
4999
  }
4974
- var qo = class extends x {
5000
+ var Jo = class extends x {
4975
5001
  constructor(...e) {
4976
- super(...e), Uo(this, "state", { failed: !1 });
5002
+ super(...e), Wo(this, "state", { failed: !1 });
4977
5003
  }
4978
5004
  static getDerivedStateFromError() {
4979
5005
  return { failed: !0 };
@@ -4990,21 +5016,21 @@ var qo = class extends x {
4990
5016
  type: "button",
4991
5017
  className: "chat-btn",
4992
5018
  onClick: () => {
4993
- Go = Wo(), this.setState({ failed: !1 });
5019
+ Ko = Go(), this.setState({ failed: !1 });
4994
5020
  },
4995
5021
  children: "Reintentar"
4996
5022
  })]
4997
5023
  }) : this.props.children;
4998
5024
  }
4999
5025
  };
5000
- function Jo({ gameKey: n, currentUserId: r, variant: a = "panel", onMinimize: o, onDismiss: s }) {
5026
+ function Yo({ gameKey: n, currentUserId: r, variant: a = "panel", onMinimize: o, onDismiss: s }) {
5001
5027
  let c = e((e) => e.games[n]), l = t() === "connected", u = i(c);
5002
5028
  if (O(() => {
5003
5029
  u || g.preload();
5004
5030
  }, [u]), !c) return null;
5005
- if (u) return /* @__PURE__ */ R(qo, { children: /* @__PURE__ */ R(S, {
5006
- fallback: /* @__PURE__ */ R(Ko, {}),
5007
- children: /* @__PURE__ */ R(Go, {
5031
+ if (u) return /* @__PURE__ */ R(Jo, { children: /* @__PURE__ */ R(S, {
5032
+ fallback: /* @__PURE__ */ R(qo, {}),
5033
+ children: /* @__PURE__ */ R(Ko, {
5008
5034
  gameKey: n,
5009
5035
  currentUserId: r,
5010
5036
  variant: a,
@@ -5017,7 +5043,7 @@ function Jo({ gameKey: n, currentUserId: r, variant: a = "panel", onMinimize: o,
5017
5043
  }, p = (t) => () => {
5018
5044
  Promise.resolve(e.getState()[t]?.(n)).catch(() => {});
5019
5045
  };
5020
- return /* @__PURE__ */ R(zo, {
5046
+ return /* @__PURE__ */ R(Bo, {
5021
5047
  game: c,
5022
5048
  currentUserId: r,
5023
5049
  connected: l,
@@ -5037,14 +5063,14 @@ function Jo({ gameKey: n, currentUserId: r, variant: a = "panel", onMinimize: o,
5037
5063
  } : void 0
5038
5064
  });
5039
5065
  }
5040
- var Yo = T(Jo);
5066
+ var Xo = T(Yo);
5041
5067
  // src/games/shared/GameTimelineEntry.jsx
5042
- function Xo({ gameKey: t, currentUserId: n, inPanel: i }) {
5068
+ function Zo({ gameKey: t, currentUserId: n, inPanel: i }) {
5043
5069
  let a = e((e) => e.games[t]);
5044
5070
  return a ? i ? /* @__PURE__ */ z("button", {
5045
5071
  type: "button",
5046
5072
  className: "chat-game-placeholder",
5047
- onClick: () => Io.getState().setMinimized(t, !1),
5073
+ onClick: () => Lo.getState().setMinimized(t, !1),
5048
5074
  children: [
5049
5075
  /* @__PURE__ */ R(_e, {
5050
5076
  size: 15,
@@ -5058,15 +5084,15 @@ function Xo({ gameKey: t, currentUserId: n, inPanel: i }) {
5058
5084
  ] }),
5059
5085
  /* @__PURE__ */ R("strong", { children: "Ver tablero" })
5060
5086
  ]
5061
- }) : /* @__PURE__ */ R(Yo, {
5087
+ }) : /* @__PURE__ */ R(Xo, {
5062
5088
  gameKey: t,
5063
5089
  currentUserId: n,
5064
5090
  variant: "history"
5065
5091
  }) : null;
5066
5092
  }
5067
5093
  // src/ui/components/MessageList.jsx
5068
- var Zo = (e) => e != null && e !== "" && at(e).isValid();
5069
- function Qo({ messages: e = [], currentUserId: t, onCopy: n, onReply: r, panelGameKey: i, onReact: a, onEditMessage: o, editingId: s }) {
5094
+ var Qo = (e) => e != null && e !== "" && at(e).isValid();
5095
+ function $o({ messages: e = [], currentUserId: t, onCopy: n, onReply: r, panelGameKey: i, onReact: a, onEditMessage: o, editingId: s }) {
5070
5096
  let c = j(null), l = j(!0), [u, d] = M(!1), f = () => {
5071
5097
  let e = c.current;
5072
5098
  e && (e.scrollTop = e.scrollHeight), l.current = !0, d(!1);
@@ -5130,7 +5156,7 @@ function Qo({ messages: e = [], currentUserId: t, onCopy: n, onReply: r, panelGa
5130
5156
  })
5131
5157
  ]
5132
5158
  }), e.map((l, u) => {
5133
- let d = e[u - 1], f = Zo(l.timestamp), p = d && Zo(d.timestamp), h = f && p && at(l.timestamp).isSame(at(d.timestamp), "day"), g = h ? at(l.timestamp).diff(at(d.timestamp), "minute", !0) : Infinity, _ = d && d.user_id != null && l.user_id != null && String(d.user_id) === String(l.user_id) && !d.gameKey && !l.gameKey && h && g >= 0 && g <= 5, v = String(l.id ?? l.message_id ?? `${l.room_id}:${l.user_id}:${l.timestamp ?? ""}:${l.message ?? ""}`), y = m.get(v) || 0;
5159
+ let d = e[u - 1], f = Qo(l.timestamp), p = d && Qo(d.timestamp), h = f && p && at(l.timestamp).isSame(at(d.timestamp), "day"), g = h ? at(l.timestamp).diff(at(d.timestamp), "minute", !0) : Infinity, _ = d && d.user_id != null && l.user_id != null && String(d.user_id) === String(l.user_id) && !d.gameKey && !l.gameKey && h && g >= 0 && g <= 5, v = String(l.id ?? l.message_id ?? `${l.room_id}:${l.user_id}:${l.timestamp ?? ""}:${l.message ?? ""}`), y = m.get(v) || 0;
5134
5160
  m.set(v, y + 1);
5135
5161
  let b = Zt(l), x = !!l.localOnly || l.user_id != null && t != null && String(l.user_id) === String(t), S = l.message ?? l.text;
5136
5162
  return /* @__PURE__ */ z("div", {
@@ -5141,11 +5167,11 @@ function Qo({ messages: e = [], currentUserId: t, onCopy: n, onReply: r, panelGa
5141
5167
  children: [f && !h && /* @__PURE__ */ R("div", {
5142
5168
  className: "message-date-divider",
5143
5169
  children: /* @__PURE__ */ R("span", { children: at(l.timestamp).format("DD MMM YYYY") })
5144
- }), l.gameKey ? /* @__PURE__ */ R(Xo, {
5170
+ }), l.gameKey ? /* @__PURE__ */ R(Zo, {
5145
5171
  gameKey: l.gameKey,
5146
5172
  currentUserId: t,
5147
5173
  inPanel: String(l.gameKey) === String(i)
5148
- }) : /* @__PURE__ */ R(No, {
5174
+ }) : /* @__PURE__ */ R(Po, {
5149
5175
  message: l,
5150
5176
  isMine: x,
5151
5177
  onReact: l.localOnly || !b ? void 0 : a,
@@ -5183,8 +5209,8 @@ function Qo({ messages: e = [], currentUserId: t, onCopy: n, onReply: r, panelGa
5183
5209
  });
5184
5210
  }
5185
5211
  // src/ui/hooks/useVoiceRecorder.js
5186
- var $o = 120;
5187
- function es(e) {
5212
+ var es = 120;
5213
+ function ts(e) {
5188
5214
  let [t, n] = M("idle"), [r, i] = M(0), [a, o] = M(""), s = j(null), c = j(!0), l = j(e);
5189
5215
  l.current = e;
5190
5216
  let u = E((e) => {
@@ -5234,7 +5260,7 @@ function es(e) {
5234
5260
  e.cancelled = !0, u(e), s.current === e && (s.current = null), c.current && (n("idle"), o("No se pudo completar la grabación."));
5235
5261
  }, a.start(250), e.startedAt = Date.now(), i(0), n("recording"), e.timer = setInterval(() => {
5236
5262
  let t = Math.floor((Date.now() - e.startedAt) / 1e3);
5237
- c.current && i(Math.min(t, $o)), t >= $o && d();
5263
+ c.current && i(Math.min(t, es)), t >= es && d();
5238
5264
  }, 250);
5239
5265
  } catch (t) {
5240
5266
  if (u(e), s.current === e && (s.current = null), !c.current || e.cancelled) return;
@@ -5253,7 +5279,7 @@ function es(e) {
5253
5279
  };
5254
5280
  }
5255
5281
  // src/media/gif-search/gifQueryExpansion.js
5256
- var ts = 4, ns = /* @__PURE__ */ new Set(/* @__PURE__ */ "el.la.los.las.lo.un.una.unos.unas.de.del.al.y.e.o.u.a.en.con.por.para.mi.mis.su.sus.the.an.of.to.and.or.in.on.for.my.is".split(".")), rs = /* @__PURE__ */ new Set(/* @__PURE__ */ "futbol.soccer.football.gol.golazo.goal.messi.ronaldo.cr7.nba.nfl.mlb.fifa.mundial.beisbol.baseball.pelota.basket.baloncesto.basketball.lebron.deporte.deportes.sports.partido.jugador.player.licey.aguilas.escogido.champions.liga".split(".")), is = [
5282
+ var ns = 4, rs = /* @__PURE__ */ new Set(/* @__PURE__ */ "el.la.los.las.lo.un.una.unos.unas.de.del.al.y.e.o.u.a.en.con.por.para.mi.mis.su.sus.the.an.of.to.and.or.in.on.for.my.is".split(".")), is = /* @__PURE__ */ new Set(/* @__PURE__ */ "futbol.soccer.football.gol.golazo.goal.messi.ronaldo.cr7.nba.nfl.mlb.fifa.mundial.beisbol.baseball.pelota.basket.baloncesto.basketball.lebron.deporte.deportes.sports.partido.jugador.player.licey.aguilas.escogido.champions.liga".split(".")), as = [
5257
5283
  "football",
5258
5284
  "soccer",
5259
5285
  "futbol",
@@ -5268,7 +5294,7 @@ var ts = 4, ns = /* @__PURE__ */ new Set(/* @__PURE__ */ "el.la.los.las.lo.un.un
5268
5294
  "match",
5269
5295
  "team",
5270
5296
  "jersey"
5271
- ], as = [
5297
+ ], os = [
5272
5298
  {
5273
5299
  k: ["cuanta bendicion", "cuanta bendicion meme"],
5274
5300
  q: [
@@ -6727,7 +6753,7 @@ var ts = 4, ns = /* @__PURE__ */ new Set(/* @__PURE__ */ "el.la.los.las.lo.un.un
6727
6753
  ],
6728
6754
  sports: !0
6729
6755
  }
6730
- ], os = {
6756
+ ], ss = {
6731
6757
  triste: "sad",
6732
6758
  feliz: "happy",
6733
6759
  contento: "happy",
@@ -6844,7 +6870,7 @@ var ts = 4, ns = /* @__PURE__ */ new Set(/* @__PURE__ */ "el.la.los.las.lo.un.un
6844
6870
  fuego: "fire",
6845
6871
  diablo: "devil",
6846
6872
  angel: "angel"
6847
- }, ss = new Set(Object.values(os).flatMap((e) => e.split(" ")).concat([
6873
+ }, cs = new Set(Object.values(ss).flatMap((e) => e.split(" ")).concat([
6848
6874
  "meme",
6849
6875
  "reaction",
6850
6876
  "funny",
@@ -6861,15 +6887,15 @@ var ts = 4, ns = /* @__PURE__ */ new Set(/* @__PURE__ */ "el.la.los.las.lo.un.un
6861
6887
  "i",
6862
6888
  "me"
6863
6889
  ]));
6864
- function cs(e) {
6890
+ function ls(e) {
6865
6891
  return String(e ?? "").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[\p{Extended_Pictographic}\u{1F1E6}-\u{1F1FF}\u{1F3FB}-\u{1F3FF}‍️⃣]/gu, " ").replace(/[^\p{L}\p{N}\s]/gu, " ").replace(/\s+/g, " ").trim();
6866
6892
  }
6867
- function ls(e) {
6868
- let t = cs(e).split(" ").filter(Boolean), n = t.filter((e) => !ns.has(e));
6893
+ function us(e) {
6894
+ let t = ls(e).split(" ").filter(Boolean), n = t.filter((e) => !rs.has(e));
6869
6895
  return n.length ? n : t;
6870
6896
  }
6871
- var us = (e) => e.replace(/(.)\1+/g, "$1");
6872
- function ds(e, t, n = 1) {
6897
+ var ds = (e) => e.replace(/(.)\1+/g, "$1");
6898
+ function fs(e, t, n = 1) {
6873
6899
  if (Math.abs(e.length - t.length) > n) return n + 1;
6874
6900
  let r = Array.from({ length: t.length + 1 }, (e, t) => t);
6875
6901
  for (let i = 1; i <= e.length; i++) {
@@ -6880,30 +6906,30 @@ function ds(e, t, n = 1) {
6880
6906
  }
6881
6907
  return r[t.length];
6882
6908
  }
6883
- var fs = as.map((e) => ({
6909
+ var ps = os.map((e) => ({
6884
6910
  ...e,
6885
- sk: e.k.map((e) => us(cs(e)))
6911
+ sk: e.k.map((e) => ds(ls(e)))
6886
6912
  }));
6887
- function ps(e) {
6888
- let t = us(e), n = ` ${t} `, r = null, i = 0;
6889
- for (let a of fs) if (a.re?.test(e)) 1e3 > i && (r = a, i = 1e3);
6913
+ function ms(e) {
6914
+ let t = ds(e), n = ` ${t} `, r = null, i = 0;
6915
+ for (let a of ps) if (a.re?.test(e)) 1e3 > i && (r = a, i = 1e3);
6890
6916
  else for (let e of a.sk) {
6891
6917
  let o = 0;
6892
- t === e ? o = 1e3 + e.length : (e.length > 3 || e.includes(" ")) && n.includes(` ${e} `) ? o = 500 + e.length : t.length >= 4 && e.startsWith(t) ? o = 300 + t.length : t.length >= 5 && e.length >= 5 && ds(t, e) <= 1 && (o = 200 + e.length), o > i && (r = a, i = o);
6918
+ t === e ? o = 1e3 + e.length : (e.length > 3 || e.includes(" ")) && n.includes(` ${e} `) ? o = 500 + e.length : t.length >= 4 && e.startsWith(t) ? o = 300 + t.length : t.length >= 5 && e.length >= 5 && fs(t, e) <= 1 && (o = 200 + e.length), o > i && (r = a, i = o);
6893
6919
  }
6894
6920
  return r ? {
6895
6921
  rule: r,
6896
6922
  exact: i >= 1e3
6897
6923
  } : null;
6898
6924
  }
6899
- function ms(e) {
6900
- if (os[e]) return os[e];
6925
+ function hs(e) {
6926
+ if (ss[e]) return ss[e];
6901
6927
  let t = e.endsWith("es") ? e.slice(0, -2) : e.endsWith("s") ? e.slice(0, -1) : e;
6902
- return os[t] ? os[t] : t.endsWith("a") && os[`${t.slice(0, -1)}o`] ? os[`${t.slice(0, -1)}o`] : null;
6928
+ return ss[t] ? ss[t] : t.endsWith("a") && ss[`${t.slice(0, -1)}o`] ? ss[`${t.slice(0, -1)}o`] : null;
6903
6929
  }
6904
- var hs = (e) => [...new Set(e.filter(Boolean))];
6905
- function gs(e) {
6906
- let t = String(e ?? "").trim(), n = cs(t), r = ls(t), i = {
6930
+ var gs = (e) => [...new Set(e.filter(Boolean))];
6931
+ function _s(e) {
6932
+ let t = String(e ?? "").trim(), n = ls(t), r = us(t), i = {
6907
6933
  original: t,
6908
6934
  normalized: n,
6909
6935
  variants: [],
@@ -6912,9 +6938,9 @@ function gs(e) {
6912
6938
  isPhrase: !1
6913
6939
  };
6914
6940
  if (!n) return i;
6915
- let a = r.every((e) => ss.has(e)), o = r.map(ms), s = o.filter(Boolean).length, c = !a && s && s * 2 >= r.length ? r.map((e, t) => o[t] || e).join(" ") : null, l = [], u = /* @__PURE__ */ new Set(), d = (e, t, n, r) => {
6916
- let i = cs(e);
6917
- !i || u.has(i) || l.length >= ts || (u.add(i), l.push({
6941
+ let a = r.every((e) => cs.has(e)), o = r.map(hs), s = o.filter(Boolean).length, c = !a && s && s * 2 >= r.length ? r.map((e, t) => o[t] || e).join(" ") : null, l = [], u = /* @__PURE__ */ new Set(), d = (e, t, n, r) => {
6942
+ let i = ls(e);
6943
+ !i || u.has(i) || l.length >= ns || (u.add(i), l.push({
6918
6944
  q: e,
6919
6945
  weight: t,
6920
6946
  lang: n,
@@ -6922,13 +6948,13 @@ function gs(e) {
6922
6948
  }));
6923
6949
  };
6924
6950
  d(t, 1, a ? "en" : "es", "original");
6925
- let f = ps(n), p = [], m = r.some((e) => rs.has(e));
6951
+ let f = ms(n), p = [], m = r.some((e) => is.has(e));
6926
6952
  if (f) {
6927
6953
  let { rule: e, exact: t } = f, n = t ? 1 : .9;
6928
6954
  e.q.forEach((e, r) => {
6929
6955
  let i = e.startsWith("en:");
6930
6956
  d(i ? e.slice(3) : e, +((.9 - r * .1) * n).toFixed(2), i ? "en" : "es", t ? "phrase-rule" : "phrase-rule-partial");
6931
- }), p = e.i.map(cs), m = m || !!e.sports;
6957
+ }), p = e.i.map(ls), m = m || !!e.sports;
6932
6958
  } else {
6933
6959
  let e = r.includes("meme");
6934
6960
  e || d(`${n} meme`, .8, a ? "en" : "es", r.length > 1 ? "phrase-meme" : "word-meme"), c && d(c, .6, "en", "translation"), c && !e && d(`${c} reaction`, .5, "en", "translation-reaction");
@@ -6937,26 +6963,26 @@ function gs(e) {
6937
6963
  original: t,
6938
6964
  normalized: n,
6939
6965
  variants: l,
6940
- intentTerms: hs([
6966
+ intentTerms: gs([
6941
6967
  ...p,
6942
6968
  ...r,
6943
6969
  ...o,
6944
6970
  ...c ? [c] : []
6945
6971
  ]).filter((e) => e !== "meme" || p.includes("meme")).slice(0, 24),
6946
- avoidTerms: m ? [] : is.slice(),
6972
+ avoidTerms: m ? [] : as.slice(),
6947
6973
  isPhrase: r.length > 1 || !!f
6948
6974
  };
6949
6975
  }
6950
6976
  // src/media/gif-search/gifRelevance.js
6951
- var _s = .08, vs = 1.2, ys = .9, bs = .6, xs = .4, Ss = .25, Cs = .8, ws = .15, Ts = 4, Es = 2, Ds = (e) => cs(String(e || "").replace(/[-_]+/g, " ")) || "", Os = (e) => e?.id ?? e?.url ?? e?.slug;
6952
- function ks(e = [], t = []) {
6977
+ var vs = .08, ys = 1.2, bs = .9, xs = .6, Ss = .4, Cs = .25, ws = .8, Ts = .15, Es = 4, Ds = 2, Os = (e) => ls(String(e || "").replace(/[-_]+/g, " ")) || "", ks = (e) => e?.id ?? e?.url ?? e?.slug;
6978
+ function As(e = [], t = []) {
6953
6979
  let n = (e) => {
6954
6980
  let t = /* @__PURE__ */ new Set(), n = [];
6955
6981
  for (let r of e || []) {
6956
- let e = Ds(r);
6982
+ let e = Os(r);
6957
6983
  if (!e || t.has(e)) continue;
6958
6984
  t.add(e);
6959
- let i = ls(e);
6985
+ let i = us(e);
6960
6986
  n.push({
6961
6987
  text: e,
6962
6988
  padded: ` ${e} `,
@@ -6971,54 +6997,54 @@ function ks(e = [], t = []) {
6971
6997
  avoid: n(t)
6972
6998
  };
6973
6999
  }
6974
- function As(e) {
6975
- let t = Ds(e?.title), n = Array.isArray(e?.tags) ? e.tags.map(Ds).filter(Boolean) : [], r = n.join(" ");
7000
+ function js(e) {
7001
+ let t = Os(e?.title), n = Array.isArray(e?.tags) ? e.tags.map(Os).filter(Boolean) : [], r = n.join(" ");
6976
7002
  return {
6977
7003
  title: t,
6978
7004
  titlePadded: ` ${t} `,
6979
7005
  tagsPadded: n.map((e) => ` ${e} `),
6980
- titleTokens: new Set(ls(t)),
6981
- tagTokens: new Set(ls(r)),
7006
+ titleTokens: new Set(us(t)),
7007
+ tagTokens: new Set(us(r)),
6982
7008
  all: ` ${t} ${r} `,
6983
7009
  empty: !t && !n.length
6984
7010
  };
6985
7011
  }
6986
- function js(e, t) {
7012
+ function Ms(e, t) {
6987
7013
  let n = 0, r = !1;
6988
7014
  for (let i of t) if (i.phrase) {
6989
- if (e.titlePadded.includes(i.padded)) n += vs, r = !0;
6990
- else if (e.tagsPadded.some((e) => e.includes(i.padded))) n += ys, r = !0;
7015
+ if (e.titlePadded.includes(i.padded)) n += ys, r = !0;
7016
+ else if (e.tagsPadded.some((e) => e.includes(i.padded))) n += bs, r = !0;
6991
7017
  else {
6992
7018
  let t = 0;
6993
7019
  for (let n of i.tokens) (e.titleTokens.has(n) || e.tagTokens.has(n)) && t++;
6994
- t && (n += Ss * (t / i.tokens.length)), t === i.tokens.length && (r = !0);
7020
+ t && (n += Cs * (t / i.tokens.length)), t === i.tokens.length && (r = !0);
6995
7021
  }
6996
- } else e.titleTokens.has(i.text) ? (n += bs, r = !0) : e.tagTokens.has(i.text) && (n += xs, r = !0);
7022
+ } else e.titleTokens.has(i.text) ? (n += xs, r = !0) : e.tagTokens.has(i.text) && (n += Ss, r = !0);
6997
7023
  return {
6998
7024
  bonus: n,
6999
7025
  matched: r
7000
7026
  };
7001
7027
  }
7002
- function Ms(e, t, n = 1, r = 0) {
7003
- let i = As(e), a = 1 / (1 + Math.max(0, r) * _s) * n;
7028
+ function Ns(e, t, n = 1, r = 0) {
7029
+ let i = js(e), a = 1 / (1 + Math.max(0, r) * vs) * n;
7004
7030
  if (i.empty) return {
7005
- score: a - ws,
7031
+ score: a - Ts,
7006
7032
  matched: !1
7007
7033
  };
7008
- let { bonus: o, matched: s } = js(i, t.intent), c = a + o;
7009
- return !s && t.avoid.some((e) => i.all.includes(e.padded)) && (c -= Cs), {
7034
+ let { bonus: o, matched: s } = Ms(i, t.intent), c = a + o;
7035
+ return !s && t.avoid.some((e) => i.all.includes(e.padded)) && (c -= ws), {
7010
7036
  score: c,
7011
7037
  matched: s
7012
7038
  };
7013
7039
  }
7014
- function Ns(e, t = {}) {
7015
- let n = ks(t?.intentTerms, t?.avoidTerms), r = n.intent.length === 0, i = /* @__PURE__ */ new Map(), a = 0;
7040
+ function Ps(e, t = {}) {
7041
+ let n = As(t?.intentTerms, t?.avoidTerms), r = n.intent.length === 0, i = /* @__PURE__ */ new Map(), a = 0;
7016
7042
  (e || []).forEach((e, t) => {
7017
7043
  let o = e?.variant?.weight ?? 1;
7018
7044
  (e?.items || []).forEach((e, s) => {
7019
- let c = Os(e);
7045
+ let c = ks(e);
7020
7046
  if (c == null) return;
7021
- let { score: l, matched: u } = Ms(e, n, o, s), d = i.get(c), f = t === 0 && s < Ts && (u || r) ? s : -1;
7047
+ let { score: l, matched: u } = Ns(e, n, o, s), d = i.get(c), f = t === 0 && s < Es && (u || r) ? s : -1;
7022
7048
  d ? (l > d.score && (d.score = l, d.item = e), f >= 0 && d.protectedRank < 0 && (d.protectedRank = f)) : i.set(c, {
7023
7049
  item: e,
7024
7050
  score: l,
@@ -7029,20 +7055,20 @@ function Ns(e, t = {}) {
7029
7055
  });
7030
7056
  let o = [...i.values()].sort((e, t) => t.score - e.score || e.order - t.order), s = o.filter((e) => e.protectedRank >= 0).sort((e, t) => e.protectedRank - t.protectedRank);
7031
7057
  for (let e of s) {
7032
- let t = o.indexOf(e), n = e.protectedRank + Es;
7058
+ let t = o.indexOf(e), n = e.protectedRank + Ds;
7033
7059
  t > n && (o.splice(t, 1), o.splice(n, 0, e));
7034
7060
  }
7035
7061
  return o.map((e) => e.item);
7036
7062
  }
7037
- function Ps(e, t, { min: n = 6 } = {}) {
7038
- let r = e || [], i = ks(t?.intentTerms, []);
7063
+ function Fs(e, t, { min: n = 6 } = {}) {
7064
+ let r = e || [], i = As(t?.intentTerms, []);
7039
7065
  if (!i.intent.length) return r.length >= n;
7040
7066
  let a = 0;
7041
- for (let e of r) if (js(As(e), i.intent).matched && ++a >= n) return !0;
7067
+ for (let e of r) if (Ms(js(e), i.intent).matched && ++a >= n) return !0;
7042
7068
  return !1;
7043
7069
  }
7044
- var Fs = "lira-gif-library:v1", Is = typeof window < "u";
7045
- function Ls(e) {
7070
+ var Is = "lira-gif-library:v1", Ls = typeof window < "u";
7071
+ function Rs(e) {
7046
7072
  if (typeof e != "string" || e.length > 2048 || !Hr(e)) return null;
7047
7073
  try {
7048
7074
  let t = new URL(e);
@@ -7051,121 +7077,121 @@ function Ls(e) {
7051
7077
  return null;
7052
7078
  }
7053
7079
  }
7054
- var Rs = (e, t = 256) => typeof e == "string" ? e.slice(0, t) : "", zs = (e) => Number.isFinite(e) && e > 0 ? Math.round(e) : 0;
7055
- function Bs(e, t) {
7080
+ var zs = (e, t = 256) => typeof e == "string" ? e.slice(0, t) : "", Bs = (e) => Number.isFinite(e) && e > 0 ? Math.round(e) : 0;
7081
+ function Vs(e, t) {
7056
7082
  if (!e || typeof e != "object") return null;
7057
7083
  let { id: n } = e;
7058
7084
  if (!(typeof n == "string" && n || typeof n == "number" && Number.isFinite(n))) return null;
7059
- let r = Ls(e.url), i = Ls(e.preview);
7085
+ let r = Rs(e.url), i = Rs(e.preview);
7060
7086
  if (!r || !i) return null;
7061
7087
  let a = t ?? e.savedAt;
7062
7088
  return {
7063
7089
  id: String(n).slice(0, 128),
7064
- slug: Rs(e.slug),
7065
- title: Rs(e.title),
7090
+ slug: zs(e.slug),
7091
+ title: zs(e.title),
7066
7092
  preview: i,
7067
7093
  url: r,
7068
- width: zs(e.width),
7069
- height: zs(e.height),
7094
+ width: Bs(e.width),
7095
+ height: Bs(e.height),
7070
7096
  savedAt: Number.isFinite(a) && a >= 0 ? a : 0
7071
7097
  };
7072
7098
  }
7073
- function Vs(e, t) {
7099
+ function Hs(e, t) {
7074
7100
  if (!Array.isArray(e)) return [];
7075
7101
  let n = /* @__PURE__ */ new Set(), r = [];
7076
7102
  for (let i of e) {
7077
- let e = Bs(i);
7103
+ let e = Vs(i);
7078
7104
  if (e && !n.has(e.id) && (n.add(e.id), r.push(e), r.length >= t)) break;
7079
7105
  }
7080
7106
  return r;
7081
7107
  }
7082
- function Hs() {
7108
+ function Us() {
7083
7109
  let e = {
7084
7110
  favorites: [],
7085
7111
  recents: []
7086
7112
  };
7087
- if (!Is) return e;
7113
+ if (!Ls) return e;
7088
7114
  try {
7089
- let t = window.localStorage.getItem(Fs);
7115
+ let t = window.localStorage.getItem(Is);
7090
7116
  if (!t) return e;
7091
7117
  let n = JSON.parse(t);
7092
7118
  return {
7093
- favorites: Vs(n?.favorites, 200),
7094
- recents: Vs(n?.recents, 40)
7119
+ favorites: Hs(n?.favorites, 200),
7120
+ recents: Hs(n?.recents, 40)
7095
7121
  };
7096
7122
  } catch {
7097
7123
  return e;
7098
7124
  }
7099
7125
  }
7100
- function Us({ favorites: e, recents: t }) {
7101
- if (Is) try {
7102
- window.localStorage.setItem(Fs, JSON.stringify({
7126
+ function Ws({ favorites: e, recents: t }) {
7127
+ if (Ls) try {
7128
+ window.localStorage.setItem(Is, JSON.stringify({
7103
7129
  favorites: e,
7104
7130
  recents: t
7105
7131
  }));
7106
7132
  } catch {}
7107
7133
  }
7108
- var Ws = (e) => e == null ? "" : String(e);
7109
- function Gs() {
7134
+ var Gs = (e) => e == null ? "" : String(e);
7135
+ function Ks() {
7110
7136
  let e = P((e, t) => {
7111
7137
  let n = (n) => {
7112
7138
  e(n);
7113
7139
  let { favorites: r, recents: i } = t();
7114
- Us({
7140
+ Ws({
7115
7141
  favorites: r,
7116
7142
  recents: i
7117
7143
  });
7118
7144
  };
7119
7145
  return {
7120
- ...Hs(),
7146
+ ...Us(),
7121
7147
  isFavorite: (e) => {
7122
- let n = Ws(e);
7148
+ let n = Gs(e);
7123
7149
  return t().favorites.some((e) => e.id === n);
7124
7150
  },
7125
7151
  toggleFavorite: (e) => {
7126
- let r = Ws(e?.id), { favorites: i } = t();
7152
+ let r = Gs(e?.id), { favorites: i } = t();
7127
7153
  if (i.some((e) => e.id === r)) {
7128
7154
  n({ favorites: i.filter((e) => e.id !== r) });
7129
7155
  return;
7130
7156
  }
7131
- let a = Bs(e, Date.now());
7157
+ let a = Vs(e, Date.now());
7132
7158
  a && n({ favorites: [a, ...i].slice(0, 200) });
7133
7159
  },
7134
7160
  addRecent: (e) => {
7135
- let r = Bs(e, Date.now());
7161
+ let r = Vs(e, Date.now());
7136
7162
  if (!r) return;
7137
7163
  let i = t().recents.filter((e) => e.id !== r.id);
7138
7164
  n({ recents: [r, ...i].slice(0, 40) });
7139
7165
  },
7140
7166
  removeRecent: (e) => {
7141
- let r = Ws(e);
7167
+ let r = Gs(e);
7142
7168
  n({ recents: t().recents.filter((e) => e.id !== r) });
7143
7169
  },
7144
7170
  clearRecents: () => n({ recents: [] })
7145
7171
  };
7146
7172
  }), t = 0, n = (t) => {
7147
- (t.key === Fs || t.key === null) && e.setState(Hs());
7173
+ (t.key === Is || t.key === null) && e.setState(Us());
7148
7174
  };
7149
7175
  return e.startSync = () => {
7150
- if (!Is || typeof window.addEventListener != "function") return () => {};
7151
- t === 0 && (window.addEventListener("storage", n), e.setState(Hs())), t += 1;
7176
+ if (!Ls || typeof window.addEventListener != "function") return () => {};
7177
+ t === 0 && (window.addEventListener("storage", n), e.setState(Us())), t += 1;
7152
7178
  let r = !1;
7153
7179
  return function() {
7154
7180
  r || (r = !0, --t, t === 0 && window.removeEventListener("storage", n));
7155
7181
  };
7156
7182
  }, e;
7157
7183
  }
7158
- var Ks = Gs(), qs = Object.assign((e) => I(Ks, e), {
7159
- getState: Ks.getState,
7160
- setState: Ks.setState,
7161
- subscribe: Ks.subscribe
7184
+ var qs = Ks(), Js = Object.assign((e) => I(qs, e), {
7185
+ getState: qs.getState,
7186
+ setState: qs.setState,
7187
+ subscribe: qs.subscribe
7162
7188
  });
7163
- function Js(e = Ks) {
7164
- return (e === qs ? Ks : e).startSync();
7189
+ function Ys(e = qs) {
7190
+ return (e === Js ? qs : e).startSync();
7165
7191
  }
7166
7192
  // src/media/gif-search/gifSearchEngine.js
7167
- var Ys = 3e5, Xs = 150, Zs = 3, Qs = 2, $s = "Mostrando resultados aproximados", ec = /* @__PURE__ */ new Map(), tc = /* @__PURE__ */ new Map();
7168
- function nc() {
7193
+ var Xs = 3e5, Zs = 150, Qs = 3, $s = 2, ec = "Mostrando resultados aproximados", tc = /* @__PURE__ */ new Map(), nc = /* @__PURE__ */ new Map();
7194
+ function rc() {
7169
7195
  try {
7170
7196
  return new DOMException("Aborted", "AbortError");
7171
7197
  } catch {
@@ -7173,41 +7199,41 @@ function nc() {
7173
7199
  return e.name = "AbortError", e;
7174
7200
  }
7175
7201
  }
7176
- var rc = (e) => e?.name === "AbortError";
7177
- function ic(e) {
7178
- let t = ec.get(e);
7202
+ var ic = (e) => e?.name === "AbortError";
7203
+ function ac(e) {
7204
+ let t = tc.get(e);
7179
7205
  if (t) {
7180
- if (t.expires <= Date.now()) ec.delete(e);
7181
- else return ec.delete(e), ec.set(e, t), t.value;
7206
+ if (t.expires <= Date.now()) tc.delete(e);
7207
+ else return tc.delete(e), tc.set(e, t), t.value;
7182
7208
  }
7183
7209
  }
7184
- function ac(e, t) {
7185
- for (ec.delete(e), ec.set(e, {
7210
+ function oc(e, t) {
7211
+ for (tc.delete(e), tc.set(e, {
7186
7212
  value: t,
7187
- expires: Date.now() + Ys
7188
- }); ec.size > Xs;) ec.delete(ec.keys().next().value);
7213
+ expires: Date.now() + Xs
7214
+ }); tc.size > Zs;) tc.delete(tc.keys().next().value);
7189
7215
  }
7190
- function oc(e, t, n) {
7191
- if (n?.aborted) return Promise.reject(nc());
7192
- let r = ic(e);
7216
+ function sc(e, t, n) {
7217
+ if (n?.aborted) return Promise.reject(rc());
7218
+ let r = ac(e);
7193
7219
  if (r !== void 0) return Promise.resolve(r);
7194
- let i = tc.get(e);
7220
+ let i = nc.get(e);
7195
7221
  if (!i) {
7196
7222
  let n = new AbortController();
7197
7223
  i = {
7198
- promise: Promise.resolve().then(() => t(n.signal)).then((t) => (ac(e, t), t)).finally(() => {
7199
- tc.get(e) === i && tc.delete(e);
7224
+ promise: Promise.resolve().then(() => t(n.signal)).then((t) => (oc(e, t), t)).finally(() => {
7225
+ nc.get(e) === i && nc.delete(e);
7200
7226
  }),
7201
7227
  controller: n,
7202
7228
  refs: 0
7203
- }, tc.set(e, i);
7229
+ }, nc.set(e, i);
7204
7230
  }
7205
7231
  let a = i;
7206
7232
  return a.refs += 1, new Promise((t, r) => {
7207
7233
  let i = !1, o = () => {
7208
- --a.refs, a.refs <= 0 && (tc.get(e) === a && tc.delete(e), a.controller.abort());
7234
+ --a.refs, a.refs <= 0 && (nc.get(e) === a && nc.delete(e), a.controller.abort());
7209
7235
  }, s = () => {
7210
- i || (i = !0, o(), r(nc()));
7236
+ i || (i = !0, o(), r(rc()));
7211
7237
  };
7212
7238
  n?.addEventListener("abort", s, { once: !0 }), a.promise.then((e) => {
7213
7239
  i || (i = !0, --a.refs, n?.removeEventListener("abort", s), t(e));
@@ -7216,31 +7242,31 @@ function oc(e, t, n) {
7216
7242
  });
7217
7243
  });
7218
7244
  }
7219
- var sc = (e, t, n, r, i) => `${e}|${t}|${n}|${r}|${i}`, cc = (e) => ({
7245
+ var cc = (e, t, n, r, i) => `${e}|${t}|${n}|${r}|${i}`, lc = (e) => ({
7220
7246
  items: Array.isArray(e?.items) ? e.items : [],
7221
7247
  hasMore: !!e?.hasMore
7222
7248
  });
7223
- function lc({ page: e, perPage: t, signal: n }) {
7224
- return oc(sc("trending", "", zr(), e, t), (n) => Zr({
7249
+ function uc({ page: e, perPage: t, signal: n }) {
7250
+ return sc(cc("trending", "", zr(), e, t), (n) => Zr({
7225
7251
  page: e,
7226
7252
  perPage: t,
7227
7253
  locale: zr(),
7228
7254
  signal: n
7229
- }).then(cc), n).then((e) => ({
7255
+ }).then(lc), n).then((e) => ({
7230
7256
  ...e,
7231
7257
  notice: null
7232
7258
  }));
7233
7259
  }
7234
- function uc(e, t, n, r) {
7235
- return oc(sc("search", cs(e.q), zr(), t, n), (r) => Qr({
7260
+ function dc(e, t, n, r) {
7261
+ return sc(cc("search", ls(e.q), zr(), t, n), (r) => Qr({
7236
7262
  query: e.q,
7237
7263
  page: t,
7238
7264
  perPage: n,
7239
7265
  locale: zr(),
7240
7266
  signal: r
7241
- }).then(cc), r);
7267
+ }).then(lc), r);
7242
7268
  }
7243
- function dc(e, t) {
7269
+ function fc(e, t) {
7244
7270
  let n = Array.isArray(e?.variants) ? [...e.variants] : [];
7245
7271
  n.length || n.push({
7246
7272
  q: e?.original || e?.normalized || "",
@@ -7251,9 +7277,9 @@ function dc(e, t) {
7251
7277
  let r = n.map((e, t) => ({
7252
7278
  v: e,
7253
7279
  i: t
7254
- })).sort((e, t) => (t.v.weight ?? 0) - (e.v.weight ?? 0) || e.i - t.i).map(({ v: e }) => e), i = r.slice(0, t), a = cs(e?.original || "");
7255
- if (a && !i.some((e) => cs(e.q) === a)) {
7256
- let n = r.find((e) => cs(e.q) === a) || {
7280
+ })).sort((e, t) => (t.v.weight ?? 0) - (e.v.weight ?? 0) || e.i - t.i).map(({ v: e }) => e), i = r.slice(0, t), a = ls(e?.original || "");
7281
+ if (a && !i.some((e) => ls(e.q) === a)) {
7282
+ let n = r.find((e) => ls(e.q) === a) || {
7257
7283
  q: e.original,
7258
7284
  weight: 1,
7259
7285
  lang: null,
@@ -7263,9 +7289,9 @@ function dc(e, t) {
7263
7289
  }
7264
7290
  return i;
7265
7291
  }
7266
- async function fc({ query: e, page: t, perPage: n, signal: r }) {
7267
- let i = gs(e), a = dc(i, t > 1 ? Qs : Zs), o = await Promise.allSettled(a.map((e) => uc(e, t, n, r)));
7268
- if (r?.aborted) throw nc();
7292
+ async function pc({ query: e, page: t, perPage: n, signal: r }) {
7293
+ let i = _s(e), a = fc(i, t > 1 ? $s : Qs), o = await Promise.allSettled(a.map((e) => dc(e, t, n, r)));
7294
+ if (r?.aborted) throw rc();
7269
7295
  let s = [], c = null;
7270
7296
  if (o.forEach((e, t) => {
7271
7297
  e.status === "fulfilled" ? s.push({
@@ -7273,17 +7299,17 @@ async function fc({ query: e, page: t, perPage: n, signal: r }) {
7273
7299
  variant: a[t],
7274
7300
  items: e.value.items,
7275
7301
  hasMore: e.value.hasMore
7276
- }) : (!c || rc(c)) && (c = e.reason);
7302
+ }) : (!c || ic(c)) && (c = e.reason);
7277
7303
  }), !s.length) throw c || /* @__PURE__ */ Error("GIF search failed");
7278
- let l = Ns(s, i) || [], u = s.some((e) => e.hasMore), d = null;
7279
- return t === 1 && l.length && !Ps(l, i) && (d = $s), {
7304
+ let l = Ps(s, i) || [], u = s.some((e) => e.hasMore), d = null;
7305
+ return t === 1 && l.length && !Fs(l, i) && (d = ec), {
7280
7306
  items: l,
7281
7307
  hasMore: u,
7282
7308
  notice: d
7283
7309
  };
7284
7310
  }
7285
- async function pc({ page: e, perPage: t, signal: n }) {
7286
- let r = qs.getState().recents || [];
7311
+ async function mc({ page: e, perPage: t, signal: n }) {
7312
+ let r = Js.getState().recents || [];
7287
7313
  return r.length ? e === 1 ? {
7288
7314
  items: r.slice(),
7289
7315
  hasMore: !1,
@@ -7293,42 +7319,42 @@ async function pc({ page: e, perPage: t, signal: n }) {
7293
7319
  hasMore: !1,
7294
7320
  notice: null
7295
7321
  } : {
7296
- ...await oc(sc("recent", "", "", e, t), (n) => $r({
7322
+ ...await sc(cc("recent", "", "", e, t), (n) => $r({
7297
7323
  page: e,
7298
7324
  perPage: t,
7299
7325
  signal: n
7300
- }).then(cc), n),
7326
+ }).then(lc), n),
7301
7327
  notice: null
7302
7328
  };
7303
7329
  }
7304
- function mc({ page: e }) {
7305
- let t = qs.getState().favorites || [];
7330
+ function hc({ page: e }) {
7331
+ let t = Js.getState().favorites || [];
7306
7332
  return Promise.resolve({
7307
7333
  items: e === 1 ? t.slice() : [],
7308
7334
  hasMore: !1,
7309
7335
  notice: null
7310
7336
  });
7311
7337
  }
7312
- async function hc({ source: e, query: t, page: n = 1, perPage: r = 24, signal: i } = {}) {
7313
- if (i?.aborted) throw nc();
7338
+ async function gc({ source: e, query: t, page: n = 1, perPage: r = 24, signal: i } = {}) {
7339
+ if (i?.aborted) throw rc();
7314
7340
  switch (e) {
7315
- case "search": return String(t ?? "").trim() ? fc({
7341
+ case "search": return String(t ?? "").trim() ? pc({
7316
7342
  query: t,
7317
7343
  page: n,
7318
7344
  perPage: r,
7319
7345
  signal: i
7320
- }) : lc({
7346
+ }) : uc({
7321
7347
  page: n,
7322
7348
  perPage: r,
7323
7349
  signal: i
7324
7350
  });
7325
- case "recent": return pc({
7351
+ case "recent": return mc({
7326
7352
  page: n,
7327
7353
  perPage: r,
7328
7354
  signal: i
7329
7355
  });
7330
- case "favorites": return mc({ page: n });
7331
- default: return lc({
7356
+ case "favorites": return hc({ page: n });
7357
+ default: return uc({
7332
7358
  page: n,
7333
7359
  perPage: r,
7334
7360
  signal: i
@@ -7336,7 +7362,7 @@ async function hc({ source: e, query: t, page: n = 1, perPage: r = 24, signal: i
7336
7362
  }
7337
7363
  }
7338
7364
  // src/media/gif-search/gifCategories.js
7339
- var gc = "trending", _c = Object.freeze([
7365
+ var _c = "trending", vc = Object.freeze([
7340
7366
  {
7341
7367
  id: "trending",
7342
7368
  label: "Tendencias",
@@ -7435,7 +7461,7 @@ var gc = "trending", _c = Object.freeze([
7435
7461
  source: "search",
7436
7462
  query: "bailar"
7437
7463
  }
7438
- ].map((e) => Object.freeze(e))), vc = {
7464
+ ].map((e) => Object.freeze(e))), yc = {
7439
7465
  memes: [
7440
7466
  "memes",
7441
7467
  "meme",
@@ -7510,22 +7536,22 @@ var gc = "trending", _c = Object.freeze([
7510
7536
  "dance",
7511
7537
  "dancing"
7512
7538
  ]
7513
- }, yc = (e) => typeof e == "string" ? cs(e) : "";
7514
- function bc(e) {
7515
- let t = /* @__PURE__ */ new Set([yc(e.label), yc(e.query)]);
7516
- for (let n of vc[e.id] || []) t.add(yc(n));
7539
+ }, bc = (e) => typeof e == "string" ? ls(e) : "";
7540
+ function xc(e) {
7541
+ let t = /* @__PURE__ */ new Set([bc(e.label), bc(e.query)]);
7542
+ for (let n of yc[e.id] || []) t.add(bc(n));
7517
7543
  return t.delete(""), t;
7518
7544
  }
7519
- function xc(e, t) {
7520
- let n = bc(e);
7521
- return t.find((e) => !e || typeof e != "object" ? !1 : n.has(yc(e.category)) || n.has(yc(e.query)));
7522
- }
7523
7545
  function Sc(e, t) {
7524
- let n = Array.isArray(e) ? e : _c, r = Array.isArray(t) ? t : [];
7546
+ let n = xc(e);
7547
+ return t.find((e) => !e || typeof e != "object" ? !1 : n.has(bc(e.category)) || n.has(bc(e.query)));
7548
+ }
7549
+ function Cc(e, t) {
7550
+ let n = Array.isArray(e) ? e : vc, r = Array.isArray(t) ? t : [];
7525
7551
  return n.map((e) => {
7526
7552
  let t = { ...e };
7527
7553
  if (e.source !== "search" || r.length === 0) return t;
7528
- let n = xc(e, r);
7554
+ let n = Sc(e, r);
7529
7555
  if (!n) return t;
7530
7556
  n.preview && (t.preview = n.preview);
7531
7557
  let i = n.query || n.category;
@@ -7533,8 +7559,8 @@ function Sc(e, t) {
7533
7559
  });
7534
7560
  }
7535
7561
  // src/ui/components/GifCategoryBar.jsx
7536
- var Cc = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
7537
- function wc({ categories: e = [], activeId: t, onSelect: n, disabled: r }) {
7562
+ var wc = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
7563
+ function Tc({ categories: e = [], activeId: t, onSelect: n, disabled: r }) {
7538
7564
  let i = j(null), a = j(/* @__PURE__ */ new Map()), [o, s] = M(!1), [c, l] = M(!1), u = E(() => {
7539
7565
  let e = i.current;
7540
7566
  if (!e) return;
@@ -7565,14 +7591,14 @@ function wc({ categories: e = [], activeId: t, onSelect: n, disabled: r }) {
7565
7591
  e && typeof e.scrollIntoView == "function" && e.scrollIntoView({
7566
7592
  block: "nearest",
7567
7593
  inline: "nearest",
7568
- behavior: Cc() ? "auto" : "smooth"
7594
+ behavior: wc() ? "auto" : "smooth"
7569
7595
  });
7570
7596
  }, [t]);
7571
7597
  let d = (e) => {
7572
7598
  let t = i.current;
7573
7599
  t && t.scrollBy({
7574
7600
  left: e * t.clientWidth * .7,
7575
- behavior: Cc() ? "auto" : "smooth"
7601
+ behavior: wc() ? "auto" : "smooth"
7576
7602
  });
7577
7603
  }, f = (i) => {
7578
7604
  if (r || !e.length) return;
@@ -7660,7 +7686,7 @@ function wc({ categories: e = [], activeId: t, onSelect: n, disabled: r }) {
7660
7686
  ]
7661
7687
  });
7662
7688
  }
7663
- var Tc = T(wc), Ec = 420, Dc = 350, Oc = [
7689
+ var Ec = T(Tc), Dc = 420, Oc = 350, kc = [
7664
7690
  1.3,
7665
7691
  .75,
7666
7692
  1,
@@ -7674,11 +7700,11 @@ var Tc = T(wc), Ec = 420, Dc = 350, Oc = [
7674
7700
  1,
7675
7701
  .85
7676
7702
  ];
7677
- function kc(e) {
7703
+ function Ac(e) {
7678
7704
  let t = Number(e?.width), n = Number(e?.height);
7679
7705
  return t > 0 && n > 0 ? n / t : 1;
7680
7706
  }
7681
- function Ac(e, t, n) {
7707
+ function jc(e, t, n) {
7682
7708
  let r = Array.from({ length: t }, () => []), i = Array(t).fill(0);
7683
7709
  return e.forEach((e, a) => {
7684
7710
  let o = 0;
@@ -7689,27 +7715,27 @@ function Ac(e, t, n) {
7689
7715
  }), i[o] += n(e);
7690
7716
  }), r;
7691
7717
  }
7692
- function jc() {
7718
+ function Mc() {
7693
7719
  try {
7694
7720
  return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
7695
7721
  } catch {
7696
7722
  return !1;
7697
7723
  }
7698
7724
  }
7699
- function Mc(e) {
7725
+ function Nc(e) {
7700
7726
  try {
7701
7727
  return e.matches(":focus-visible");
7702
7728
  } catch {
7703
7729
  return !0;
7704
7730
  }
7705
7731
  }
7706
- var Nc = T(function({ item: e, fav: t, disabled: n, onSelect: r, onToggleFavorite: i }) {
7732
+ var Pc = T(function({ item: e, fav: t, disabled: n, onSelect: r, onToggleFavorite: i }) {
7707
7733
  let [a, o] = M(!1), [s, c] = M(!1), [l, u] = M(!1), [d, f] = M(!1), p = j(null), m = Number(e.width), h = Number(e.height), g = m > 0 && h > 0 ? `${m} / ${h}` : "1 / 1", _ = e.title || "GIF", v = !!e.url && e.url !== e.preview && !d, y = l && v && !s, b = () => {
7708
7734
  p.current && (clearTimeout(p.current), p.current = null);
7709
7735
  };
7710
7736
  O(() => b, []);
7711
7737
  let x = (e) => {
7712
- v && !jc() && (b(), e ? u(!0) : p.current = setTimeout(() => u(!0), Dc));
7738
+ v && !Mc() && (b(), e ? u(!0) : p.current = setTimeout(() => u(!0), Oc));
7713
7739
  }, S = () => {
7714
7740
  b(), u(!1);
7715
7741
  };
@@ -7727,7 +7753,7 @@ var Nc = T(function({ item: e, fav: t, disabled: n, onSelect: r, onToggleFavorit
7727
7753
  disabled: n,
7728
7754
  onClick: () => r(e),
7729
7755
  onFocus: (e) => {
7730
- Mc(e.currentTarget) && x(!0);
7756
+ Nc(e.currentTarget) && x(!0);
7731
7757
  },
7732
7758
  onBlur: S,
7733
7759
  children: /* @__PURE__ */ R("span", {
@@ -7764,7 +7790,7 @@ var Nc = T(function({ item: e, fav: t, disabled: n, onSelect: r, onToggleFavorit
7764
7790
  })]
7765
7791
  });
7766
7792
  });
7767
- function Pc(e, t, n) {
7793
+ function Fc(e, t, n) {
7768
7794
  let r = Array.from(e.querySelectorAll(".chat-gif-tile__pick:not(:disabled)")), i = t.getBoundingClientRect(), a = i.left + i.width / 2, o = i.top + i.height / 2, s = null, c = Infinity;
7769
7795
  return r.forEach((e) => {
7770
7796
  if (e === t) return;
@@ -7774,7 +7800,7 @@ function Pc(e, t, n) {
7774
7800
  m < c && (c = m, s = e);
7775
7801
  }), s;
7776
7802
  }
7777
- function Fc({ items: e, loading: t, hasMore: n, error: r, onLoadMore: i, onRetry: a, onSelect: o, onToggleFavorite: s, isFavorite: c, empty: l, disabled: u, scrollKey: d }) {
7803
+ function Ic({ items: e, loading: t, hasMore: n, error: r, onLoadMore: i, onRetry: a, onSelect: o, onToggleFavorite: s, isFavorite: c, empty: l, disabled: u, scrollKey: d }) {
7778
7804
  let f = e || [], p = j(null), m = j(null), [h, g] = M(2), _ = j({
7779
7805
  onSelect: o,
7780
7806
  onToggleFavorite: s,
@@ -7804,7 +7830,7 @@ function Fc({ items: e, loading: t, hasMore: n, error: r, onLoadMore: i, onRetry
7804
7830
  if (!e || typeof ResizeObserver > "u") return;
7805
7831
  let t = new ResizeObserver((t) => {
7806
7832
  let n = t[0]?.contentRect?.width ?? e.clientWidth;
7807
- g(n >= Ec ? 3 : 2);
7833
+ g(n >= Dc ? 3 : 2);
7808
7834
  });
7809
7835
  return t.observe(e), () => t.disconnect();
7810
7836
  }, []), O(() => {
@@ -7831,7 +7857,7 @@ function Fc({ items: e, loading: t, hasMore: n, error: r, onLoadMore: i, onRetry
7831
7857
  f.length,
7832
7858
  C
7833
7859
  ]);
7834
- let w = A(() => Ac(f, h, kc), [f, h]), T = A(() => Ac(Oc, h, (e) => e), [h]), D = (e) => {
7860
+ let w = A(() => jc(f, h, Ac), [f, h]), T = A(() => jc(kc, h, (e) => e), [h]), D = (e) => {
7835
7861
  if (![
7836
7862
  "ArrowUp",
7837
7863
  "ArrowDown",
@@ -7840,7 +7866,7 @@ function Fc({ items: e, loading: t, hasMore: n, error: r, onLoadMore: i, onRetry
7840
7866
  ].includes(e.key)) return;
7841
7867
  let t = e.target;
7842
7868
  if (!(t instanceof Element) || !t.classList.contains("chat-gif-tile__pick")) return;
7843
- let n = Pc(p.current, t, e.key);
7869
+ let n = Fc(p.current, t, e.key);
7844
7870
  e.preventDefault(), n && (n.focus(), n.scrollIntoView?.({ block: "nearest" }));
7845
7871
  }, k = t && f.length === 0, N = !t && !r && f.length === 0, P = l?.icon;
7846
7872
  return /* @__PURE__ */ z(L, { children: [r && /* @__PURE__ */ z("div", {
@@ -7873,7 +7899,7 @@ function Fc({ items: e, loading: t, hasMore: n, error: r, onLoadMore: i, onRetry
7873
7899
  }, `sk-${t}`)),
7874
7900
  !k && f.length > 0 && w.map((e, t) => /* @__PURE__ */ R("div", {
7875
7901
  className: "chat-gif-col",
7876
- children: e.map(({ entry: e }) => /* @__PURE__ */ R(Nc, {
7902
+ children: e.map(({ entry: e }) => /* @__PURE__ */ R(Pc, {
7877
7903
  item: e,
7878
7904
  fav: !!c?.(e),
7879
7905
  disabled: u,
@@ -7913,7 +7939,7 @@ function Fc({ items: e, loading: t, hasMore: n, error: r, onLoadMore: i, onRetry
7913
7939
  })] });
7914
7940
  }
7915
7941
  // src/ui/components/GifPicker.jsx
7916
- var Ic = 24, Lc = 300, Rc = (e) => !!e?.id && Hr(e.url) && Hr(e.preview), zc = (e, t) => e === "search" ? {
7942
+ var Lc = 24, Rc = 300, zc = (e) => !!e?.id && Hr(e.url) && Hr(e.preview), Bc = (e, t) => e === "search" ? {
7917
7943
  icon: We,
7918
7944
  title: `Sin resultados para “${t}”`,
7919
7945
  hint: "Prueba con otra palabra o una expresión (ej. “no puede ser”)"
@@ -7929,15 +7955,15 @@ var Ic = 24, Lc = 300, Rc = (e) => !!e?.id && Hr(e.url) && Hr(e.preview), zc = (
7929
7955
  icon: we,
7930
7956
  title: "No se encontraron GIFs"
7931
7957
  };
7932
- function Bc({ onSelect: e, onClose: t, disabled: n }) {
7933
- let [r, i] = M(""), [a, o] = M(gc), [s, c] = M([]), [l, u] = M([]), [d, f] = M(!1), [p, m] = M(1), [h, g] = M(!1), [_, v] = M(""), [y, b] = M(""), x = j(null), S = j(0), C = qs((e) => e.favorites), w = qs((e) => e.recents), T = qs((e) => e.toggleFavorite), D = A(() => new Set((C || []).map((e) => e?.id)), [C]), k = E((e) => D.has(typeof e == "object" ? e?.id : e), [D]);
7958
+ function Vc({ onSelect: e, onClose: t, disabled: n }) {
7959
+ let [r, i] = M(""), [a, o] = M(_c), [s, c] = M([]), [l, u] = M([]), [d, f] = M(!1), [p, m] = M(1), [h, g] = M(!1), [_, v] = M(""), [y, b] = M(""), x = j(null), S = j(0), C = Js((e) => e.favorites), w = Js((e) => e.recents), T = Js((e) => e.toggleFavorite), D = A(() => new Set((C || []).map((e) => e?.id)), [C]), k = E((e) => D.has(typeof e == "object" ? e?.id : e), [D]);
7934
7960
  O(() => {
7935
7961
  let e = new AbortController();
7936
7962
  return ei({ signal: e.signal }).then((t) => {
7937
7963
  !e.signal.aborted && Array.isArray(t) && c(t);
7938
7964
  }).catch(() => {}), () => e.abort();
7939
7965
  }, []);
7940
- let N = A(() => Sc(_c, s), [s]), P = A(() => N.find((e) => e.id === a) ?? N[0], [N, a]), F = r.trim(), I = F ? "search" : P?.source ?? "trending", L = F || P?.query || "", B = I === "favorites" ? C?.length ?? 0 : I === "recent" ? w?.length ?? 0 : 0, V = j({
7966
+ let N = A(() => Cc(vc, s), [s]), P = A(() => N.find((e) => e.id === a) ?? N[0], [N, a]), F = r.trim(), I = F ? "search" : P?.source ?? "trending", L = F || P?.query || "", B = I === "favorites" ? C?.length ?? 0 : I === "recent" ? w?.length ?? 0 : 0, V = j({
7941
7967
  source: I,
7942
7968
  query: L
7943
7969
  });
@@ -7952,15 +7978,15 @@ function Bc({ onSelect: e, onClose: t, disabled: n }) {
7952
7978
  let r = ++S.current, { source: i, query: a } = V.current;
7953
7979
  f(!0), v("");
7954
7980
  try {
7955
- let o = await hc({
7981
+ let o = await gc({
7956
7982
  source: i,
7957
7983
  query: a,
7958
7984
  page: e,
7959
- perPage: Ic,
7985
+ perPage: Lc,
7960
7986
  signal: n.signal
7961
7987
  });
7962
7988
  if (r !== S.current) return;
7963
- let s = (o?.items || []).filter(Rc);
7989
+ let s = (o?.items || []).filter(zc);
7964
7990
  u((e) => [...new Map([...t ? e : [], ...s].map((e) => [e.id, e])).values()]), g(!!o?.hasMore), b(o?.notice || ""), m(e);
7965
7991
  } catch (e) {
7966
7992
  e?.name !== "AbortError" && r === S.current && v("Error cargando GIFs. Intenta de nuevo.");
@@ -7970,7 +7996,7 @@ function Bc({ onSelect: e, onClose: t, disabled: n }) {
7970
7996
  }, []);
7971
7997
  O(() => {
7972
7998
  x.current?.abort(), S.current++, u([]), g(!1), v(""), b(""), f(!0);
7973
- let e = setTimeout(() => H(1, !1), I === "search" ? Lc : 0);
7999
+ let e = setTimeout(() => H(1, !1), I === "search" ? Rc : 0);
7974
8000
  return () => {
7975
8001
  clearTimeout(e), x.current?.abort();
7976
8002
  };
@@ -8010,10 +8036,10 @@ function Bc({ onSelect: e, onClose: t, disabled: n }) {
8010
8036
  type: "image/gif",
8011
8037
  size: 0,
8012
8038
  shareQuery: I === "search" ? F : I === "trending" ? "" : L
8013
- }), qs.getState().addRecent(r), t?.());
8039
+ }), Js.getState().addRecent(r), t?.());
8014
8040
  }, ee = E((e) => {
8015
8041
  !n && e && T(e);
8016
- }, [n, T]), te = zc(I, F);
8042
+ }, [n, T]), te = Bc(I, F);
8017
8043
  return /* @__PURE__ */ z("div", {
8018
8044
  className: "chat-gif-picker chat-gif-picker--smart",
8019
8045
  role: "dialog",
@@ -8061,7 +8087,7 @@ function Bc({ onSelect: e, onClose: t, disabled: n }) {
8061
8087
  })
8062
8088
  ]
8063
8089
  }),
8064
- /* @__PURE__ */ R(Tc, {
8090
+ /* @__PURE__ */ R(Ec, {
8065
8091
  categories: N,
8066
8092
  activeId: F ? null : P?.id ?? null,
8067
8093
  onSelect: G,
@@ -8072,7 +8098,7 @@ function Bc({ onSelect: e, onClose: t, disabled: n }) {
8072
8098
  role: "status",
8073
8099
  children: y
8074
8100
  }),
8075
- /* @__PURE__ */ R(Fc, {
8101
+ /* @__PURE__ */ R(Ic, {
8076
8102
  items: l,
8077
8103
  loading: d,
8078
8104
  hasMore: h,
@@ -8099,28 +8125,28 @@ function Bc({ onSelect: e, onClose: t, disabled: n }) {
8099
8125
  });
8100
8126
  }
8101
8127
  // src/media/klipy/klipyStickers.js
8102
- var Vc = () => `${Nr()}/stickers`, Hc = [
8128
+ var Hc = () => `${Nr()}/stickers`, Uc = [
8103
8129
  "sm",
8104
8130
  "xs",
8105
8131
  "md",
8106
8132
  "hd"
8107
- ], Uc = [
8133
+ ], Wc = [
8108
8134
  "md",
8109
8135
  "hd",
8110
8136
  "sm"
8111
- ], Wc = ["gif", "webp"], Gc = "Error consultando KLIPY", Kc = null;
8112
- function qc() {
8137
+ ], Gc = ["gif", "webp"], Kc = "Error consultando KLIPY", qc = null;
8138
+ function Jc() {
8113
8139
  return kr();
8114
8140
  }
8115
- var Jc = (e, t) => {
8116
- for (let n of t) for (let t of Wc) {
8141
+ var Yc = (e, t) => {
8142
+ for (let n of t) for (let t of Gc) {
8117
8143
  let r = e?.[n]?.[t];
8118
8144
  if (Hr(r?.url)) return r;
8119
8145
  }
8120
8146
  return null;
8121
- }, Yc = (e) => {
8147
+ }, Xc = (e) => {
8122
8148
  if (!e || e.type === "ad") return null;
8123
- let t = Jc(e.file, Uc), n = Jc(e.file, Hc) || t;
8149
+ let t = Yc(e.file, Wc), n = Yc(e.file, Uc) || t;
8124
8150
  return !t || !n ? null : {
8125
8151
  id: e.id,
8126
8152
  slug: e.slug,
@@ -8130,44 +8156,44 @@ var Jc = (e, t) => {
8130
8156
  width: Number(t.width) || null,
8131
8157
  height: Number(t.height) || null
8132
8158
  };
8133
- }, Xc = async (e, t, n) => {
8134
- let r = t ? `?${new URLSearchParams(t)}` : "", i = await fetch(`${Vc()}${e}${r}`, { signal: n });
8135
- if (!i.ok) throw Error(Gc);
8159
+ }, Zc = async (e, t, n) => {
8160
+ let r = t ? `?${new URLSearchParams(t)}` : "", i = await fetch(`${Hc()}${e}${r}`, { signal: n });
8161
+ if (!i.ok) throw Error(Kc);
8136
8162
  return i.json();
8137
- }, Zc = (e, t) => {
8138
- let n = Array.isArray(e?.data?.data) ? e.data.data : [], r = n.map(Yc).filter(Boolean), i = e?.data?.has_next;
8163
+ }, Qc = (e, t) => {
8164
+ let n = Array.isArray(e?.data?.data) ? e.data.data : [], r = n.map(Xc).filter(Boolean), i = e?.data?.has_next;
8139
8165
  return {
8140
8166
  items: r,
8141
8167
  hasMore: typeof i == "boolean" ? i : n.length >= t
8142
8168
  };
8143
- }, Qc = (e, t) => ({
8169
+ }, $c = (e, t) => ({
8144
8170
  page: String(e),
8145
8171
  per_page: String(t)
8146
8172
  });
8147
- async function $c({ page: e = 1, perPage: t = 24, signal: n } = {}) {
8148
- return Zc(await Xc("/trending", {
8149
- ...Qc(e, t),
8150
- customer_id: qc()
8173
+ async function el({ page: e = 1, perPage: t = 24, signal: n } = {}) {
8174
+ return Qc(await Zc("/trending", {
8175
+ ...$c(e, t),
8176
+ customer_id: Jc()
8151
8177
  }, n), t);
8152
8178
  }
8153
- async function el({ query: e, page: t = 1, perPage: n = 24, signal: r } = {}) {
8179
+ async function tl({ query: e, page: t = 1, perPage: n = 24, signal: r } = {}) {
8154
8180
  let i = String(e ?? "").trim();
8155
- return i ? Zc(await Xc("/search", {
8156
- ...Qc(t, n),
8181
+ return i ? Qc(await Zc("/search", {
8182
+ ...$c(t, n),
8157
8183
  q: i,
8158
- customer_id: qc()
8159
- }, r), n) : $c({
8184
+ customer_id: Jc()
8185
+ }, r), n) : el({
8160
8186
  page: t,
8161
8187
  perPage: n,
8162
8188
  signal: r
8163
8189
  });
8164
8190
  }
8165
- async function tl({ page: e = 1, perPage: t = 24, signal: n } = {}) {
8166
- return Zc(await Xc(`/recent/${encodeURIComponent(qc())}`, Qc(e, t), n), t);
8191
+ async function nl({ page: e = 1, perPage: t = 24, signal: n } = {}) {
8192
+ return Qc(await Zc(`/recent/${encodeURIComponent(Jc())}`, $c(e, t), n), t);
8167
8193
  }
8168
- async function nl({ signal: e } = {}) {
8169
- if (Kc) return Kc;
8170
- let t = await Xc("/categories", null, e), n = t?.data?.categories ?? t?.data?.data ?? t?.data ?? [], r = (Array.isArray(n) ? n : []).map((e) => {
8194
+ async function rl({ signal: e } = {}) {
8195
+ if (qc) return qc;
8196
+ let t = await Zc("/categories", null, e), n = t?.data?.categories ?? t?.data?.data ?? t?.data ?? [], r = (Array.isArray(n) ? n : []).map((e) => {
8171
8197
  if (typeof e == "string") {
8172
8198
  let t = e.trim();
8173
8199
  return t ? {
@@ -8185,13 +8211,13 @@ async function nl({ signal: e } = {}) {
8185
8211
  preview: Hr(r) ? r : null
8186
8212
  };
8187
8213
  }).filter(Boolean);
8188
- return Kc = r, r;
8214
+ return qc = r, r;
8189
8215
  }
8190
- async function rl(e, { query: t } = {}) {
8216
+ async function il(e, { query: t } = {}) {
8191
8217
  if (!e) return !1;
8192
8218
  try {
8193
- let n = { customer_id: qc() }, r = String(t ?? "").trim();
8194
- return r && (n.q = r), (await fetch(`${Vc()}/share/${encodeURIComponent(e)}`, {
8219
+ let n = { customer_id: Jc() }, r = String(t ?? "").trim();
8220
+ return r && (n.q = r), (await fetch(`${Hc()}/share/${encodeURIComponent(e)}`, {
8195
8221
  method: "POST",
8196
8222
  headers: { "Content-Type": "application/json" },
8197
8223
  body: JSON.stringify(n)
@@ -8200,7 +8226,7 @@ async function rl(e, { query: t } = {}) {
8200
8226
  return !1;
8201
8227
  }
8202
8228
  }
8203
- function il(e) {
8229
+ function al(e) {
8204
8230
  return {
8205
8231
  kind: "gif",
8206
8232
  id: e.id,
@@ -8215,26 +8241,26 @@ function il(e) {
8215
8241
  };
8216
8242
  }
8217
8243
  // src/ui/components/StickerPicker.jsx
8218
- var al = 24, ol = 300, sl = {
8244
+ var ol = 24, sl = 300, cl = {
8219
8245
  trending: "No hay stickers en tendencia",
8220
8246
  recent: "No hay stickers recientes todavía",
8221
8247
  category: "No se encontraron stickers",
8222
8248
  search: "No se encontraron stickers"
8223
- }, cl = (e, t, n, r) => e === "recent" ? tl({
8249
+ }, ll = (e, t, n, r) => e === "recent" ? nl({
8224
8250
  page: n,
8225
- perPage: al,
8251
+ perPage: ol,
8226
8252
  signal: r
8227
- }) : e === "trending" ? $c({
8253
+ }) : e === "trending" ? el({
8228
8254
  page: n,
8229
- perPage: al,
8255
+ perPage: ol,
8230
8256
  signal: r
8231
- }) : el({
8257
+ }) : tl({
8232
8258
  query: t,
8233
8259
  page: n,
8234
- perPage: al,
8260
+ perPage: ol,
8235
8261
  signal: r
8236
8262
  });
8237
- function ll({ onSelect: e, onClose: t, disabled: n }) {
8263
+ function ul({ onSelect: e, onClose: t, disabled: n }) {
8238
8264
  let [r, i] = M(""), [a, o] = M("trending"), [s, c] = M(null), [l, u] = M([]), [d, f] = M([]), [p, m] = M(!1), [h, g] = M(1), [_, v] = M(!1), [y, b] = M(""), [x, S] = M(null), C = j(null), w = j(null), T = j(0), D = j(null), k = j({
8239
8265
  mode: "trending",
8240
8266
  category: null
@@ -8245,7 +8271,7 @@ function ll({ onSelect: e, onClose: t, disabled: n }) {
8245
8271
  let a = ++T.current;
8246
8272
  m(!0), b("");
8247
8273
  try {
8248
- let { items: o = [], hasMore: s = !1 } = await cl(e, t, n, i.signal) || {};
8274
+ let { items: o = [], hasMore: s = !1 } = await ll(e, t, n, i.signal) || {};
8249
8275
  if (a !== T.current) return;
8250
8276
  f((e) => [...new Map([...r ? e : [], ...o].map((e) => [e.id, e])).values()]), v(!!s && o.length > 0), g(n);
8251
8277
  } catch (t) {
@@ -8256,14 +8282,14 @@ function ll({ onSelect: e, onClose: t, disabled: n }) {
8256
8282
  }, []);
8257
8283
  O(() => {
8258
8284
  let e = new AbortController();
8259
- return nl({ signal: e.signal }).then((e) => {
8285
+ return rl({ signal: e.signal }).then((e) => {
8260
8286
  Array.isArray(e) && u(e.filter((e) => e?.query));
8261
8287
  }).catch(() => {}), () => e.abort();
8262
8288
  }, []), O(() => {
8263
8289
  w.current?.abort(), T.current++, f([]), v(!1), S(null), b(""), m(!0);
8264
8290
  let e = setTimeout(() => {
8265
8291
  C.current?.scrollTo({ top: 0 }), N(a, A, 1, !1);
8266
- }, a === "search" ? ol : 0);
8292
+ }, a === "search" ? sl : 0);
8267
8293
  return () => {
8268
8294
  clearTimeout(e), w.current?.abort();
8269
8295
  };
@@ -8298,7 +8324,7 @@ function ll({ onSelect: e, onClose: t, disabled: n }) {
8298
8324
  i(""), c(t), o(e);
8299
8325
  }, I = (r) => {
8300
8326
  !n && r && (e?.({
8301
- ...il(r),
8327
+ ...al(r),
8302
8328
  shareQuery: A || ""
8303
8329
  }), t?.());
8304
8330
  }, B = (e) => {
@@ -8431,7 +8457,7 @@ function ll({ onSelect: e, onClose: t, disabled: n }) {
8431
8457
  }),
8432
8458
  !d.length && !p && !y && /* @__PURE__ */ R("p", {
8433
8459
  className: "chat-gif-empty",
8434
- children: sl[a]
8460
+ children: cl[a]
8435
8461
  })
8436
8462
  ]
8437
8463
  }),
@@ -8459,8 +8485,8 @@ function ll({ onSelect: e, onClose: t, disabled: n }) {
8459
8485
  });
8460
8486
  }
8461
8487
  // src/ui/components/EmojiAutocomplete.jsx
8462
- var ul = 8, dl = 48, fl = (e) => typeof e == "string" ? e : e?.emoji || "", pl = (e) => String(e || "").replace(/️/g, "");
8463
- function ml(e, t) {
8488
+ var dl = 8, fl = 48, pl = (e) => typeof e == "string" ? e : e?.emoji || "", ml = (e) => String(e || "").replace(/️/g, "");
8489
+ function hl(e, t) {
8464
8490
  let n = t - 1;
8465
8491
  for (; n >= 0;) {
8466
8492
  if (e[n] === ":") {
@@ -8476,9 +8502,9 @@ function ml(e, t) {
8476
8502
  }
8477
8503
  return null;
8478
8504
  }
8479
- var hl = (e) => String(e).normalize("NFD").replace(/\p{M}/gu, "").toLowerCase();
8480
- function gl({ shortcode: e, query: t }) {
8481
- let n = hl(e), r = hl(t);
8505
+ var gl = (e) => String(e).normalize("NFD").replace(/\p{M}/gu, "").toLowerCase();
8506
+ function _l({ shortcode: e, query: t }) {
8507
+ let n = gl(e), r = gl(t);
8482
8508
  if (r && n.startsWith(r)) return /* @__PURE__ */ z(L, { children: [
8483
8509
  ":",
8484
8510
  /* @__PURE__ */ R("mark", {
@@ -8504,30 +8530,30 @@ function gl({ shortcode: e, query: t }) {
8504
8530
  ":"
8505
8531
  ] });
8506
8532
  }
8507
- function _l({ textareaRef: e, value: t, onInsert: n, onClose: r, isOpen: i }) {
8508
- let a = Yi(), [o, s] = M([]), [c, l] = M(0), [u, d] = M(""), f = j(null), p = j(-1), { skinTone: m, recents: h, addRecent: g } = po() || {}, _ = ho(), v = `chat-emoji-ac-${k().replace(/:/g, "")}`, y = (e) => `${v}-opt-${e}`, b = E((e) => e.source === "custom" ? e.emoji : Ya(e, m) || e.emoji, [m]), x = A(() => Array.isArray(h) ? h.map(fl).filter(Boolean) : [], [h]);
8533
+ function vl({ textareaRef: e, value: t, onInsert: n, onClose: r, isOpen: i }) {
8534
+ let a = Xi(), [o, s] = M([]), [c, l] = M(0), [u, d] = M(""), f = j(null), p = j(-1), { skinTone: m, recents: h, addRecent: g } = mo() || {}, _ = go(), v = `chat-emoji-ac-${k().replace(/:/g, "")}`, y = (e) => `${v}-opt-${e}`, b = E((e) => e.source === "custom" ? e.emoji : Xa(e, m) || e.emoji, [m]), x = A(() => Array.isArray(h) ? h.map(pl).filter(Boolean) : [], [h]);
8509
8535
  O(() => {
8510
8536
  if (!i || !e.current) {
8511
8537
  s([]);
8512
8538
  return;
8513
8539
  }
8514
- let n = e.current.selectionStart, o = ml(t, n);
8540
+ let n = e.current.selectionStart, o = hl(t, n);
8515
8541
  if (!o || o.shortcode.length === 0) {
8516
8542
  s([]), r();
8517
8543
  return;
8518
8544
  }
8519
- let c = (e, t) => [...Ji(a, e), ...Ka(e, { limit: t })].slice(0, t), u;
8545
+ let c = (e, t) => [...Yi(a, e), ...qa(e, { limit: t })].slice(0, t), u;
8520
8546
  if (o.shortcode.length === 1 && x.length) {
8521
- let e = c(o.shortcode, dl), t = (e) => {
8522
- let t = [pl(e.emoji), pl(b(e))], n = x.findIndex((e) => t.includes(pl(e)));
8547
+ let e = c(o.shortcode, fl), t = (e) => {
8548
+ let t = [ml(e.emoji), ml(b(e))], n = x.findIndex((e) => t.includes(ml(e)));
8523
8549
  return n === -1 ? Infinity : n;
8524
8550
  }, n = e.map((e, n) => ({
8525
8551
  record: e,
8526
8552
  order: n,
8527
8553
  recent: t(e)
8528
8554
  }));
8529
- n.sort((e, t) => e.recent === t.recent ? e.order - t.order : e.recent - t.recent), u = n.slice(0, ul).map(({ record: e }) => e);
8530
- } else u = c(o.shortcode, ul);
8555
+ n.sort((e, t) => e.recent === t.recent ? e.order - t.order : e.recent - t.recent), u = n.slice(0, dl).map(({ record: e }) => e);
8556
+ } else u = c(o.shortcode, dl);
8531
8557
  u.length ? (p.current = o.start, d(o.shortcode), s(u), l(0)) : (s([]), r());
8532
8558
  }, [
8533
8559
  t,
@@ -8656,12 +8682,12 @@ function _l({ textareaRef: e, value: t, onInsert: n, onClose: r, isOpen: i }) {
8656
8682
  children: [/* @__PURE__ */ R("span", {
8657
8683
  className: "chat-emoji-autocomplete-emoji",
8658
8684
  "aria-hidden": "true",
8659
- children: /* @__PURE__ */ R(Zi, { text: r })
8685
+ children: /* @__PURE__ */ R(Qi, { text: r })
8660
8686
  }), /* @__PURE__ */ z("span", {
8661
8687
  className: "chat-emoji-autocomplete-text",
8662
8688
  children: [/* @__PURE__ */ R("span", {
8663
8689
  className: "chat-emoji-autocomplete-shortcode",
8664
- children: /* @__PURE__ */ R(gl, {
8690
+ children: /* @__PURE__ */ R(_l, {
8665
8691
  shortcode: e.shortcode,
8666
8692
  query: u
8667
8693
  })
@@ -8676,8 +8702,8 @@ function _l({ textareaRef: e, value: t, onInsert: n, onClose: r, isOpen: i }) {
8676
8702
  }) : null;
8677
8703
  }
8678
8704
  // src/ui/components/MessageComposer.jsx
8679
- function vl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, attachments: a = [], attachmentError: o, sending: s = !1, onAddAttachment: c, onRemoveAttachment: l, reply: u, onCancelReply: d, onInviteGame: f, gameInviteDisabled: p, onOpenBattleshipPreview: m, editing: h = null, onStartEditLast: g, onCancelEdit: _ }) {
8680
- let v = Yi(), y = j(null), b = j(null), [x, S] = M(520), [C, w] = M(520), T = j(null), D = j(null), k = j(null), A = j(null), [N, P] = M(null), [F, I] = M(!1), B = E(() => I(!1), []), V = E((e) => n(e), [n]), U = es(c), W = U.status !== "idle", G = a[0], K = Jt(G) ? "Enviando sticker…" : G?.kind === "gif" ? "Enviando GIF…" : G?.type?.startsWith("audio/") ? "Enviando audio…" : G ? "Enviando archivo…" : "Enviando mensaje…";
8705
+ function yl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, attachments: a = [], attachmentError: o, sending: s = !1, onAddAttachment: c, onRemoveAttachment: l, reply: u, onCancelReply: d, onInviteGame: f, gameInviteDisabled: p, onOpenBattleshipPreview: m, editing: h = null, onStartEditLast: g, onCancelEdit: _ }) {
8706
+ let v = Xi(), y = j(null), b = j(null), [x, S] = M(520), [C, w] = M(520), T = j(null), D = j(null), k = j(null), A = j(null), [N, P] = M(null), [F, I] = M(!1), B = E(() => I(!1), []), V = E((e) => n(e), [n]), U = ts(c), W = U.status !== "idle", G = a[0], K = Jt(G) ? "Enviando sticker…" : G?.kind === "gif" ? "Enviando GIF…" : G?.type?.startsWith("audio/") ? "Enviando audio…" : G ? "Enviando archivo…" : "Enviando mensaje…";
8681
8707
  O(() => {
8682
8708
  s && (P(null), I(!1));
8683
8709
  }, [s]);
@@ -8759,7 +8785,7 @@ function vl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
8759
8785
  }, [c]), ce = E((e) => {
8760
8786
  let t = e.target.value, r = e.target.selectionStart, i = /(^|[^\p{L}\p{N}_]):([\p{L}\p{N}\p{M}_+-]{1,64})(:| )$/u.exec(t.slice(0, r));
8761
8787
  if (!e.nativeEvent.isComposing && i && e.nativeEvent.inputType !== "insertFromPaste") {
8762
- let e = v.find((e) => e.shortcode === i[2].toLowerCase())?.emoji || Xa(i[2]);
8788
+ let e = v.find((e) => e.shortcode === i[2].toLowerCase())?.emoji || Za(i[2]);
8763
8789
  if (e) {
8764
8790
  let a = i.index + i[1].length, o = i[3] === " " ? " " : "";
8765
8791
  n(t.slice(0, a) + e + o + t.slice(r)), I(!1), P(null), requestAnimationFrame(() => y.current?.setSelectionRange(a + e.length + o.length, a + e.length + o.length));
@@ -8874,7 +8900,7 @@ function vl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
8874
8900
  children: /* @__PURE__ */ R(rt, { size: 16 })
8875
8901
  })]
8876
8902
  }),
8877
- /* @__PURE__ */ R(ra, {
8903
+ /* @__PURE__ */ R(ia, {
8878
8904
  items: a,
8879
8905
  onRemove: s ? void 0 : l
8880
8906
  }),
@@ -9072,7 +9098,7 @@ function vl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
9072
9098
  }), /* @__PURE__ */ R("span", { children: "Vista previa 3D (sin rival)" })]
9073
9099
  })] })]
9074
9100
  }),
9075
- N === "effects" && /* @__PURE__ */ R(Hi, {
9101
+ N === "effects" && /* @__PURE__ */ R(Ui, {
9076
9102
  onSend: e,
9077
9103
  disabled: i || !!h,
9078
9104
  onClose: () => P(null)
@@ -9081,7 +9107,7 @@ function vl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
9081
9107
  onKeyDownCapture: (e) => {
9082
9108
  e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), P(null), y.current?.focus());
9083
9109
  },
9084
- children: /* @__PURE__ */ R(Co, {
9110
+ children: /* @__PURE__ */ R(wo, {
9085
9111
  isOpen: !0,
9086
9112
  disabled: i,
9087
9113
  onSelect: (e) => {
@@ -9132,13 +9158,13 @@ function vl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
9132
9158
  ].includes(e.key) && (e.preventDefault(), e.stopPropagation(), S((t) => Math.min(C, Math.max(220, e.key === "End" ? C : e.key === "Home" ? 220 : Math.min(t, C) + (e.key === "ArrowUp" ? 30 : -30)))));
9133
9159
  },
9134
9160
  children: /* @__PURE__ */ R(ye, { size: 18 })
9135
- }), ne === "sticker" ? /* @__PURE__ */ R(ll, {
9161
+ }), ne === "sticker" ? /* @__PURE__ */ R(ul, {
9136
9162
  onSelect: (e) => {
9137
9163
  c?.(e), y.current?.focus();
9138
9164
  },
9139
9165
  onClose: () => P(null),
9140
9166
  disabled: i
9141
- }) : /* @__PURE__ */ R(Bc, {
9167
+ }) : /* @__PURE__ */ R(Vc, {
9142
9168
  onSelect: (e) => {
9143
9169
  c?.(e), y.current?.focus();
9144
9170
  },
@@ -9146,7 +9172,7 @@ function vl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
9146
9172
  disabled: i
9147
9173
  })]
9148
9174
  }),
9149
- /* @__PURE__ */ R(_l, {
9175
+ /* @__PURE__ */ R(vl, {
9150
9176
  textareaRef: y,
9151
9177
  value: t,
9152
9178
  onInsert: V,
@@ -9157,10 +9183,10 @@ function vl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
9157
9183
  });
9158
9184
  }
9159
9185
  // src/games/shared/ChatGamePanel.jsx
9160
- function yl({ gameKey: t, currentUserId: n }) {
9161
- let i = e((e) => e.games[t]), a = Io((e) => !!e.panels[t]?.minimized);
9186
+ function bl({ gameKey: t, currentUserId: n }) {
9187
+ let i = e((e) => e.games[t]), a = Lo((e) => !!e.panels[t]?.minimized);
9162
9188
  if (!i) return null;
9163
- let { setMinimized: o, dismiss: s } = Io.getState(), c = i.status === "active" && u(n, i.turnId), d = r(i), f = p(i) && !i.pendingEvent;
9189
+ let { setMinimized: o, dismiss: s } = Lo.getState(), c = i.status === "active" && u(n, i.turnId), d = r(i), f = p(i) && !i.pendingEvent;
9164
9190
  return /* @__PURE__ */ R("section", {
9165
9191
  className: `chat-game-panel${a ? " chat-game-panel--minimized" : ""}`,
9166
9192
  "aria-label": `Partida activa de ${d}`,
@@ -9184,7 +9210,7 @@ function yl({ gameKey: t, currentUserId: n }) {
9184
9210
  "aria-hidden": "true"
9185
9211
  })
9186
9212
  ]
9187
- }) : /* @__PURE__ */ R(Yo, {
9213
+ }) : /* @__PURE__ */ R(Xo, {
9188
9214
  gameKey: t,
9189
9215
  currentUserId: n,
9190
9216
  variant: "panel",
@@ -9194,7 +9220,7 @@ function yl({ gameKey: t, currentUserId: n }) {
9194
9220
  });
9195
9221
  }
9196
9222
  // src/ui/components/ChatWindow.jsx
9197
- function bl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEffect: r, effectError: i, BattleshipPreviewComponent: a = null, placement: o = "floating", theme: s, standalone: c, onDetach: l, onInstall: u, installHelp: d, onDismissInstallHelp: f, title: p, subtitle: m, headerType: h, headerSecondary: g, headerPresence: _, currentUserName: v, myPresence: y, onSetPresence: b, isOpen: x, isMaximized: C, isMinimized: w, onClose: T, onMinimize: E, onToggleMaximize: D, rooms: k, users: A, messages: N, onInviteGame: P, gameInviteDisabled: F, gameError: I, gamePanelKey: B, currentUserId: V, currentUserIds: H, onSelectRoom: U, onSelectUser: W, selectedId: K, inputValue: q, onInputChange: ee, onSend: te, attachments: ne, onAddAttachment: J, onRemoveAttachment: re, status: ie, disabled: ae, onSearch: oe, searchResults: Y, searchStatus: se, searchQuery: ce, presenceStatus: X, onCreateGroup: Z, attachmentError: Q, sending: le, reply: ue, onReply: de, onCancelReply: fe, privateRooms: pe, knownUsers: me, unreadCounts: he, onlineUsers: ge, editing: _e, onStartEditLast: ye, onCancelEdit: be, onEditMessage: xe, onReact: Se }) {
9223
+ function xl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEffect: r, effectError: i, BattleshipPreviewComponent: a = null, placement: o = "floating", theme: s, standalone: c, onDetach: l, onInstall: u, installHelp: d, onDismissInstallHelp: f, title: p, subtitle: m, headerType: h, headerSecondary: g, headerPresence: _, currentUserName: v, myPresence: y, onSetPresence: b, isOpen: x, isMaximized: C, isMinimized: w, onClose: T, onMinimize: E, onToggleMaximize: D, rooms: k, users: A, messages: N, onInviteGame: P, gameInviteDisabled: F, gameError: I, gamePanelKey: B, currentUserId: V, currentUserIds: H, onSelectRoom: U, onSelectUser: W, selectedId: K, inputValue: q, onInputChange: ee, onSend: te, attachments: ne, onAddAttachment: J, onRemoveAttachment: re, status: ie, disabled: ae, onSearch: oe, searchResults: Y, searchStatus: se, searchQuery: ce, presenceStatus: X, onCreateGroup: Z, attachmentError: Q, sending: le, reply: ue, onReply: de, onCancelReply: fe, privateRooms: pe, knownUsers: me, unreadCounts: he, onlineUsers: ge, editing: _e, onStartEditLast: ye, onCancelEdit: be, onEditMessage: xe, onReact: Se }) {
9198
9224
  let [Ce, we] = ai(), Te = j(null), [Ee, De] = M(!0), [Oe, ke] = M(!1);
9199
9225
  O(() => {
9200
9226
  ke(!1);
@@ -9260,7 +9286,7 @@ function bl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEf
9260
9286
  },
9261
9287
  children: p?.charAt(0).toUpperCase()
9262
9288
  })
9263
- }) : x ? /* @__PURE__ */ R(Bi, {
9289
+ }) : x ? /* @__PURE__ */ R(Vi, {
9264
9290
  roomId: K,
9265
9291
  scope: t,
9266
9292
  identityScope: n,
@@ -9365,7 +9391,7 @@ function bl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEf
9365
9391
  "aria-hidden": "true"
9366
9392
  }), /* @__PURE__ */ R("span", { children: "Conversaciones" })]
9367
9393
  }),
9368
- /* @__PURE__ */ R(Qo, {
9394
+ /* @__PURE__ */ R($o, {
9369
9395
  messages: N,
9370
9396
  currentUserId: V,
9371
9397
  onReply: de,
@@ -9374,7 +9400,7 @@ function bl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEf
9374
9400
  onEditMessage: xe,
9375
9401
  editingId: _e?.messageId
9376
9402
  }, `messages:${K}`),
9377
- B && !Oe && /* @__PURE__ */ R(yl, {
9403
+ B && !Oe && /* @__PURE__ */ R(bl, {
9378
9404
  gameKey: B,
9379
9405
  currentUserId: V
9380
9406
  }, B),
@@ -9407,7 +9433,7 @@ function bl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEf
9407
9433
  role: "alert",
9408
9434
  children: I
9409
9435
  }),
9410
- /* @__PURE__ */ R(vl, {
9436
+ /* @__PURE__ */ R(yl, {
9411
9437
  onSendEffect: r,
9412
9438
  onInviteGame: P,
9413
9439
  gameInviteDisabled: F,
@@ -9435,31 +9461,31 @@ function bl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEf
9435
9461
  }) : null;
9436
9462
  }
9437
9463
  // src/pwa/chatApp.js
9438
- var xl = null, Sl = () => typeof window < "u", Cl = () => {
9439
- Sl() && window.dispatchEvent(new Event("chat-install-change"));
9440
- }, wl = 0, Tl = null;
9441
- function El() {
9442
- if (!Sl()) return () => {};
9443
- if (wl++ === 0) {
9464
+ var Sl = null, Cl = () => typeof window < "u", wl = () => {
9465
+ Cl() && window.dispatchEvent(new Event("chat-install-change"));
9466
+ }, Tl = 0, El = null;
9467
+ function Dl() {
9468
+ if (!Cl()) return () => {};
9469
+ if (Tl++ === 0) {
9444
9470
  let e = (e) => {
9445
- e.preventDefault(), xl = e, Cl();
9471
+ e.preventDefault(), Sl = e, wl();
9446
9472
  }, t = () => {
9447
- xl = null, Cl();
9473
+ Sl = null, wl();
9448
9474
  };
9449
- window.addEventListener("beforeinstallprompt", e), window.addEventListener("appinstalled", t), Tl = () => {
9475
+ window.addEventListener("beforeinstallprompt", e), window.addEventListener("appinstalled", t), El = () => {
9450
9476
  window.removeEventListener("beforeinstallprompt", e), window.removeEventListener("appinstalled", t);
9451
9477
  };
9452
9478
  }
9453
9479
  let e = !1;
9454
9480
  return function() {
9455
- e || (e = !0, --wl === 0 && (Tl?.(), Tl = null, xl = null));
9481
+ e || (e = !0, --Tl === 0 && (El?.(), El = null, Sl = null));
9456
9482
  };
9457
9483
  }
9458
- function Dl() {
9459
- let e = () => Sl() && (window.matchMedia("(display-mode: standalone)").matches || !!navigator.standalone), [t, n] = M(e), [r, i] = M(!!xl), [a, o] = M("");
9484
+ function Ol() {
9485
+ let e = () => Cl() && (window.matchMedia("(display-mode: standalone)").matches || !!navigator.standalone), [t, n] = M(e), [r, i] = M(!!Sl), [a, o] = M("");
9460
9486
  return O(() => {
9461
9487
  let t = window.matchMedia("(display-mode: standalone)"), r = () => {
9462
- n(e()), i(!!xl);
9488
+ n(e()), i(!!Sl);
9463
9489
  };
9464
9490
  return window.addEventListener("chat-install-change", r), t.addEventListener("change", r), () => {
9465
9491
  window.removeEventListener("chat-install-change", r), t.removeEventListener("change", r);
@@ -9472,12 +9498,12 @@ function Dl() {
9472
9498
  o("Para instalar el chat, abre la aplicación mediante HTTPS o localhost.");
9473
9499
  return;
9474
9500
  }
9475
- if (!xl) {
9501
+ if (!Sl) {
9476
9502
  o("Abre el menú del navegador y elige “Instalar LIRA Chat” o “Añadir al Dock / pantalla de inicio”. Si no aparece, abre esta ventana de chat en una pestaña del navegador.");
9477
9503
  return;
9478
9504
  }
9479
- let e = xl;
9480
- xl = null, Cl();
9505
+ let e = Sl;
9506
+ Sl = null, wl();
9481
9507
  try {
9482
9508
  await e.prompt(), await e.userChoice;
9483
9509
  } catch {
@@ -9488,19 +9514,19 @@ function Dl() {
9488
9514
  dismissInstallHelp: () => o("")
9489
9515
  };
9490
9516
  }
9491
- var Ol = null;
9492
- function kl({ path: e = "/chat", windowName: t = "lira-independent-chat" } = {}) {
9493
- if (Ol && !Ol.closed) return Ol.focus(), !0;
9517
+ var kl = null;
9518
+ function Al({ path: e = "/chat", windowName: t = "lira-independent-chat" } = {}) {
9519
+ if (kl && !kl.closed) return kl.focus(), !0;
9494
9520
  let n = Math.min(520, window.screen.availWidth), r = Math.min(800, window.screen.availHeight);
9495
- return Ol = window.open(e, t, `popup=yes,width=${n},height=${r},resizable=yes,scrollbars=yes`), Ol ? (Ol.opener = null, Ol.focus(), !0) : !1;
9521
+ return kl = window.open(e, t, `popup=yes,width=${n},height=${r},resizable=yes,scrollbars=yes`), kl ? (kl.opener = null, kl.focus(), !0) : !1;
9496
9522
  }
9497
- function Al({ enabled: e = !0, path: t = "/chat", swUrl: n = "/chat-sw.js" } = {}) {
9498
- e && Sl() && "serviceWorker" in navigator && window.isSecureContext && window.location.pathname === t && navigator.serviceWorker.register(n, { scope: t }).catch((e) => console.warn("Chat service worker:", e));
9523
+ function jl({ enabled: e = !0, path: t = "/chat", swUrl: n = "/chat-sw.js" } = {}) {
9524
+ e && Cl() && "serviceWorker" in navigator && window.isSecureContext && window.location.pathname === t && navigator.serviceWorker.register(n, { scope: t }).catch((e) => console.warn("Chat service worker:", e));
9499
9525
  }
9500
9526
  // src/ui/connected/useChatController.js
9501
- var jl = 10485760;
9502
- function Ml({ isOpen: t = !1, isMinimized: n = !1 } = {}) {
9503
- let r = Dl(), { effects: i } = fr(), o = i === !1 ? { enabled: !1 } : i ?? {}, s = j(/* @__PURE__ */ new Map()), c = j(!1), [l, u] = M(""), { chatMessages: d, chatState: f, onlineUsers: m, rawPrivateRooms: h, userSearchQuery: g, userSearchResults: _, userSearchStatus: y, presenceStatus: b, rawKnownUsers: x, myPresence: S } = hr(ot((e) => ({
9527
+ var Ml = 10485760;
9528
+ function Nl({ isOpen: t = !1, isMinimized: n = !1 } = {}) {
9529
+ let r = Ol(), { effects: i } = fr(), o = i === !1 ? { enabled: !1 } : i ?? {}, s = j(/* @__PURE__ */ new Map()), c = j(!1), [l, u] = M(""), { chatMessages: d, chatState: f, onlineUsers: m, rawPrivateRooms: h, userSearchQuery: g, userSearchResults: _, userSearchStatus: y, presenceStatus: b, rawKnownUsers: x, myPresence: S } = hr(ot((e) => ({
9504
9530
  chatMessages: e.chatMessages,
9505
9531
  chatState: e.chatState,
9506
9532
  onlineUsers: e.onlineUsers,
@@ -9553,7 +9579,7 @@ function Ml({ isOpen: t = !1, isMinimized: n = !1 } = {}) {
9553
9579
  "placement",
9554
9580
  "active",
9555
9581
  "conflict"
9556
- ].includes(e.status) || !!e.pendingEvent))), me = Io((e) => e.panels), he = e((e) => {
9582
+ ].includes(e.status) || !!e.pendingEvent))), me = Lo((e) => e.panels), he = e((e) => {
9557
9583
  let t = Object.values(e.games).filter((e) => e.scope === ue && String(e.roomId) === String(Q)), n = t.find(a);
9558
9584
  if (n) return n.key;
9559
9585
  let r = t.filter(p).sort((e, t) => (Date.parse(t.createdAt) || 0) - (Date.parse(e.createdAt) || 0))[0];
@@ -9712,7 +9738,7 @@ function Ml({ isOpen: t = !1, isMinimized: n = !1 } = {}) {
9712
9738
  try {
9713
9739
  let n = H ? `> ${String(H.username || "Usuario").replace(/[\r\n]/g, " ").slice(0, 50)}: ${String(H.message || H.text || "[Archivo adjunto]").replace(/\s+/g, " ").slice(0, 180)}\n\n` : "";
9714
9740
  await P(Q, n + t, e), e.forEach((e) => {
9715
- e.kind === "gif" && e.slug && (Jt(e) ? rl(e.slug, { query: e.shareQuery || "" }) : ti(e.slug, { query: e.shareQuery || "" }));
9741
+ e.kind === "gif" && e.slug && (Jt(e) ? il(e.slug, { query: e.shareQuery || "" }) : ti(e.slug, { query: e.shareQuery || "" }));
9716
9742
  }), U(null), e.forEach((e) => {
9717
9743
  e.preview?.startsWith("blob:") && (URL.revokeObjectURL(e.preview), se.current.delete(e.preview));
9718
9744
  }), Z.current = [], ie([]), J("");
@@ -9742,7 +9768,7 @@ function Ml({ isOpen: t = !1, isMinimized: n = !1 } = {}) {
9742
9768
  return;
9743
9769
  }
9744
9770
  else {
9745
- if (!(e instanceof Blob) || !e.size || e.size > jl) {
9771
+ if (!(e instanceof Blob) || !e.size || e.size > Ml) {
9746
9772
  X("Máximo 10 MB por archivo.");
9747
9773
  return;
9748
9774
  }
@@ -9785,7 +9811,7 @@ function Ml({ isOpen: t = !1, isMinimized: n = !1 } = {}) {
9785
9811
  ok: !1,
9786
9812
  error: "No se puede enviar un efecto ahora."
9787
9813
  };
9788
- let t = `${C.scope}:${Q}`, n = s.current.get(t) ?? 0, r = (o.cooldownMs ?? 3e4) - (Date.now() - n);
9814
+ let t = `${C.scope}:${Q}`, n = s.current.get(t) ?? 0, r = (o.cooldownMs ?? 5e3) - (Date.now() - n);
9789
9815
  if (r > 0) {
9790
9816
  let e = `Espera ${Math.ceil(r / 1e3)} s para enviar otro efecto.`;
9791
9817
  return u(e), {
@@ -9887,14 +9913,14 @@ function Ml({ isOpen: t = !1, isMinimized: n = !1 } = {}) {
9887
9913
  };
9888
9914
  }
9889
9915
  // src/ui/connected/chatUiStore.js
9890
- var Nl = F((e) => ({
9916
+ var Pl = F((e) => ({
9891
9917
  isOpen: !1,
9892
9918
  open: () => e({ isOpen: !0 }),
9893
9919
  close: () => e({ isOpen: !1 }),
9894
9920
  toggle: () => e((e) => ({ isOpen: !e.isOpen }))
9895
- })), Pl = (e) => e, Fl = (e = Pl) => I(Nl, e), Il = (e) => !e || e === document || e === document.body || document.documentElement === e || typeof e.closest == "function" && !!e.closest(".chat-window");
9896
- function Ll({ mode: e = "floating", open: t, onOpenChange: n } = {}) {
9897
- let r = fr(), i = e === "embedded" || e === "page", a = t !== void 0, o = Fl((e) => e.isOpen), s = i || !!(a ? t : o), [c, l] = M(!1), [u, d] = M(!1), f = j({});
9921
+ })), Fl = (e) => e, Il = (e = Fl) => I(Pl, e), Ll = (e) => !e || e === document || e === document.body || document.documentElement === e || typeof e.closest == "function" && !!e.closest(".chat-window");
9922
+ function Rl({ mode: e = "floating", open: t, onOpenChange: n } = {}) {
9923
+ let r = fr(), i = e === "embedded" || e === "page", a = t !== void 0, o = Il((e) => e.isOpen), s = i || !!(a ? t : o), [c, l] = M(!1), [u, d] = M(!1), f = j({});
9898
9924
  f.current = {
9899
9925
  controlled: a,
9900
9926
  onOpenChange: n,
@@ -9902,7 +9928,7 @@ function Ll({ mode: e = "floating", open: t, onOpenChange: n } = {}) {
9902
9928
  };
9903
9929
  let p = E((e) => {
9904
9930
  let { controlled: t, onOpenChange: n, onConfigOpenChange: r } = f.current;
9905
- t || Nl.setState({ isOpen: e }), n?.(e), r?.(e);
9931
+ t || Pl.setState({ isOpen: e }), n?.(e), r?.(e);
9906
9932
  }, []);
9907
9933
  O(() => {
9908
9934
  s && d(!1);
@@ -9919,14 +9945,14 @@ function Ll({ mode: e = "floating", open: t, onOpenChange: n } = {}) {
9919
9945
  u,
9920
9946
  g,
9921
9947
  h
9922
- ]), y = E(() => l((e) => !e), []), b = r?.pwa, x = E(() => kl({
9948
+ ]), y = E(() => l((e) => !e), []), b = r?.pwa, x = E(() => Al({
9923
9949
  path: b?.path,
9924
9950
  windowName: b?.windowName
9925
9951
  }) ? (d(!1), p(!1), !0) : !1, [b, p]);
9926
9952
  return O(() => {
9927
9953
  if (!s || i) return;
9928
9954
  let e = (e) => {
9929
- e.key === "Escape" && !e.defaultPrevented && Il(e.target) && (e.preventDefault(), m ? h() : _());
9955
+ e.key === "Escape" && !e.defaultPrevented && Ll(e.target) && (e.preventDefault(), m ? h() : _());
9930
9956
  };
9931
9957
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
9932
9958
  }, [
@@ -9952,8 +9978,8 @@ function Ll({ mode: e = "floating", open: t, onOpenChange: n } = {}) {
9952
9978
  };
9953
9979
  }
9954
9980
  // src/ui/connected/ChatWindow.jsx
9955
- var Rl = "El navegador bloqueó la ventana. Permite ventanas emergentes para este sitio.", zl = (e) => typeof document > "u" ? null : (typeof e?.portalContainer == "function" ? e.portalContainer() : e?.portalContainer) || document.body;
9956
- function Bl({ open: e, onClose: t, theme: n, children: r }) {
9981
+ var zl = "El navegador bloqueó la ventana. Permite ventanas emergentes para este sitio.", Bl = (e) => typeof document > "u" ? null : (typeof e?.portalContainer == "function" ? e.portalContainer() : e?.portalContainer) || document.body;
9982
+ function Vl({ open: e, onClose: t, theme: n, children: r }) {
9957
9983
  let i = j(null), a = si(i, {
9958
9984
  active: e,
9959
9985
  autoFocus: e
@@ -9972,15 +9998,15 @@ function Bl({ open: e, onClose: t, theme: n, children: r }) {
9972
9998
  })
9973
9999
  }) : null;
9974
10000
  }
9975
- function Vl({ placement: e = "floating", open: t, onOpenChange: n, theme: r, className: i, BattleshipPreviewComponent: a = null }) {
9976
- let o = fr(), s = e === "modal" || e === "embedded" ? e : "floating", c = Ll({
10001
+ function Hl({ placement: e = "floating", open: t, onOpenChange: n, theme: r, className: i, BattleshipPreviewComponent: a = null }) {
10002
+ let o = fr(), s = e === "modal" || e === "embedded" ? e : "floating", c = Rl({
9977
10003
  mode: s,
9978
10004
  open: t,
9979
10005
  onOpenChange: n
9980
- }), l = Ml({
10006
+ }), l = Nl({
9981
10007
  isOpen: c.isOpen,
9982
10008
  isMinimized: c.isMinimized
9983
- }), u = s === "floating", d = u && o?.features?.detach !== !1, f = /* @__PURE__ */ R(bl, {
10009
+ }), u = s === "floating", d = u && o?.features?.detach !== !1, f = /* @__PURE__ */ R(xl, {
9984
10010
  ...l.windowProps,
9985
10011
  BattleshipPreviewComponent: a,
9986
10012
  placement: s,
@@ -9989,12 +10015,12 @@ function Vl({ placement: e = "floating", open: t, onOpenChange: n, theme: r, cla
9989
10015
  isMaximized: u && c.isMaximized,
9990
10016
  isMinimized: c.isMinimized,
9991
10017
  onDetach: d ? () => {
9992
- c.detach() || l.setAttachmentError(Rl);
10018
+ c.detach() || l.setAttachmentError(zl);
9993
10019
  } : void 0,
9994
10020
  onClose: s === "embedded" ? void 0 : c.close,
9995
10021
  onMinimize: u ? c.toggleMinimize : void 0,
9996
10022
  onToggleMaximize: u ? c.toggleMaximize : void 0
9997
- }, l.identity), p = /* @__PURE__ */ R(Eo.Provider, {
10023
+ }, l.identity), p = /* @__PURE__ */ R(Do.Provider, {
9998
10024
  value: l.people,
9999
10025
  children: f
10000
10026
  });
@@ -10002,8 +10028,8 @@ function Vl({ placement: e = "floating", open: t, onOpenChange: n, theme: r, cla
10002
10028
  className: `mc-chat-embedded${i ? ` ${i}` : ""}`,
10003
10029
  children: p
10004
10030
  });
10005
- let m = zl(o);
10006
- return m ? B(s === "modal" ? /* @__PURE__ */ R(Bl, {
10031
+ let m = Bl(o);
10032
+ return m ? B(s === "modal" ? /* @__PURE__ */ R(Vl, {
10007
10033
  open: c.isOpen,
10008
10034
  onClose: c.close,
10009
10035
  theme: r,
@@ -10017,15 +10043,15 @@ function Vl({ placement: e = "floating", open: t, onOpenChange: n, theme: r, cla
10017
10043
  }) : p, m) : null;
10018
10044
  }
10019
10045
  // src/ui/connected/ChatPage.jsx
10020
- function Hl({ theme: e, className: t, BattleshipPreviewComponent: n = null }) {
10021
- let r = fr(), i = Ll({ mode: "page" }), a = Ml({
10046
+ function Ul({ theme: e, className: t, BattleshipPreviewComponent: n = null }) {
10047
+ let r = fr(), i = Rl({ mode: "page" }), a = Nl({
10022
10048
  isOpen: !0,
10023
10049
  isMinimized: !1
10024
10050
  });
10025
10051
  if (typeof document > "u") return null;
10026
- let o = (typeof r?.portalContainer == "function" ? r.portalContainer() : r?.portalContainer) || document.body, s = /* @__PURE__ */ R(Eo.Provider, {
10052
+ let o = (typeof r?.portalContainer == "function" ? r.portalContainer() : r?.portalContainer) || document.body, s = /* @__PURE__ */ R(Do.Provider, {
10027
10053
  value: a.people,
10028
- children: /* @__PURE__ */ R(bl, {
10054
+ children: /* @__PURE__ */ R(xl, {
10029
10055
  ...a.windowProps,
10030
10056
  BattleshipPreviewComponent: n,
10031
10057
  placement: "page",
@@ -10042,13 +10068,13 @@ function Hl({ theme: e, className: t, BattleshipPreviewComponent: n = null }) {
10042
10068
  }) : s, o);
10043
10069
  }
10044
10070
  // src/ui/connected/ChatButton.jsx
10045
- function Ul({ className: e, label: t = "Chat", onClick: n, pressed: r, badgeClassName: i, iconSize: a = 17 }) {
10046
- let o = Bt(Mt), s = Fl((e) => e.isOpen), c = r ?? (n ? void 0 : s);
10071
+ function Wl({ className: e, label: t = "Chat", onClick: n, pressed: r, badgeClassName: i, iconSize: a = 17 }) {
10072
+ let o = Bt(Mt), s = Il((e) => e.isOpen), c = r ?? (n ? void 0 : s);
10047
10073
  return /* @__PURE__ */ z("button", {
10048
10074
  type: "button",
10049
10075
  className: e ?? "mc-chat mc-chat-button",
10050
10076
  onClick: (e) => {
10051
- n ? n(e) : Nl.getState().toggle();
10077
+ n ? n(e) : Pl.getState().toggle();
10052
10078
  },
10053
10079
  "aria-label": o ? `${t}, ${o} mensajes nuevos` : t,
10054
10080
  "aria-pressed": c,
@@ -10063,19 +10089,19 @@ function Ul({ className: e, label: t = "Chat", onClick: n, pressed: r, badgeClas
10063
10089
  });
10064
10090
  }
10065
10091
  // src/notifications/appBadge.js
10066
- var Wl = /* @__PURE__ */ new WeakMap(), Gl = (e, t, n, ...r) => {
10092
+ var Gl = /* @__PURE__ */ new WeakMap(), Kl = (e, t, n, ...r) => {
10067
10093
  try {
10068
10094
  let i = e[t](...r);
10069
10095
  i && typeof i.catch == "function" && i.catch(n);
10070
10096
  } catch {
10071
10097
  n();
10072
10098
  }
10073
- }, Kl = (e = Bt) => Wl.has(e);
10074
- function ql({ store: e = Bt, nav: t = globalThis.navigator, schedule: n = queueMicrotask } = {}) {
10075
- if (Wl.has(e)) return Wl.get(e);
10099
+ }, ql = (e = Bt) => Gl.has(e);
10100
+ function Jl({ store: e = Bt, nav: t = globalThis.navigator, schedule: n = queueMicrotask } = {}) {
10101
+ if (Gl.has(e)) return Gl.get(e);
10076
10102
  if (!t || !("setAppBadge" in t)) {
10077
10103
  let t = () => {};
10078
- return Wl.set(e, t), t;
10104
+ return Gl.set(e, t), t;
10079
10105
  }
10080
10106
  let r, i = !1, a = () => {
10081
10107
  i = !1;
@@ -10085,33 +10111,33 @@ function ql({ store: e = Bt, nav: t = globalThis.navigator, schedule: n = queueM
10085
10111
  let o = () => {
10086
10112
  r === a && (r = void 0);
10087
10113
  };
10088
- a > 0 ? Gl(t, "setAppBadge", o, a) : "clearAppBadge" in t ? Gl(t, "clearAppBadge", o) : Gl(t, "setAppBadge", o, 0);
10114
+ a > 0 ? Kl(t, "setAppBadge", o, a) : "clearAppBadge" in t ? Kl(t, "clearAppBadge", o) : Kl(t, "setAppBadge", o, 0);
10089
10115
  };
10090
10116
  a();
10091
10117
  let o = e.subscribe(() => {
10092
10118
  i || (i = !0, n(a));
10093
10119
  }), s = () => {
10094
- o(), Wl.delete(e);
10120
+ o(), Gl.delete(e);
10095
10121
  };
10096
- return Wl.set(e, s), s;
10122
+ return Gl.set(e, s), s;
10097
10123
  }
10098
10124
  // src/ui/connected/ChatNotifications.jsx
10099
- function Jl() {
10125
+ function Yl() {
10100
10126
  let e = fr()?.notifications, t = e !== !1, n = t && e?.desktop !== !1, r = t && e?.appBadge !== !1, i = t && e?.sound !== !1;
10101
10127
  return O(() => n ? Dn() : void 0, [n]), O(() => {
10102
- if (r && !Kl()) return ql();
10128
+ if (r && !ql()) return Jl();
10103
10129
  }, [r]), O(() => {
10104
10130
  if (i && (Hn(), !d())) return c();
10105
10131
  }, [i]), null;
10106
10132
  }
10107
10133
  // src/core/relay/fileRelay.js
10108
- var Yl = 10485760, Xl = /* @__PURE__ */ new WeakMap(), Zl = (e) => (Xl.has(e) || Xl.set(e, {
10134
+ var Xl = 10485760, Zl = /* @__PURE__ */ new WeakMap(), Ql = (e) => (Zl.has(e) || Zl.set(e, {
10109
10135
  pending: /* @__PURE__ */ new Map(),
10110
10136
  files: /* @__PURE__ */ new Map()
10111
- }), Xl.get(e));
10112
- function Ql(e, t, n) {
10137
+ }), Zl.get(e));
10138
+ function $l(e, t, n) {
10113
10139
  if (e?.readyState !== WebSocket.OPEN) return Promise.reject(/* @__PURE__ */ Error("Sin conexión"));
10114
- let r = Zl(e), i = crypto.randomUUID();
10140
+ let r = Ql(e), i = crypto.randomUUID();
10115
10141
  return new Promise((a, o) => {
10116
10142
  let s = setTimeout(() => {
10117
10143
  r.pending.delete(i), o(/* @__PURE__ */ Error("El servidor no confirmó el envío. Conservamos el borrador."));
@@ -10129,8 +10155,8 @@ function Ql(e, t, n) {
10129
10155
  }));
10130
10156
  });
10131
10157
  }
10132
- function $l(e, t) {
10133
- let n = Zl(e), r = t.data || t.payload || {};
10158
+ function eu(e, t) {
10159
+ let n = Ql(e), r = t.data || t.payload || {};
10134
10160
  if (t.event === "CHAT_ACK" || t.event === "ERROR" || t.type === "ERROR") {
10135
10161
  let e = n.pending.get(r.request_id);
10136
10162
  return e ? (clearTimeout(e.timer), n.pending.delete(r.request_id), t.event === "CHAT_ACK" ? e.resolve() : e.reject(Error(r.message || "No se pudo enviar")), !0) : !1;
@@ -10138,7 +10164,7 @@ function $l(e, t) {
10138
10164
  if (t.event !== "CHAT_FILE") return !1;
10139
10165
  let i = Date.now();
10140
10166
  for (let [e, t] of n.files) i - t.created > 6e4 && n.files.delete(e);
10141
- if (!Number.isInteger(r.size) || r.size <= 0 || r.size > Yl) return !0;
10167
+ if (!Number.isInteger(r.size) || r.size <= 0 || r.size > Xl) return !0;
10142
10168
  if (r.index === 0) {
10143
10169
  if (n.files.size >= 4) return !0;
10144
10170
  n.files.set(r.id, {
@@ -10155,8 +10181,8 @@ function $l(e, t) {
10155
10181
  let o = atob(r.chunk), s = Uint8Array.from(o, (e) => e.charCodeAt(0));
10156
10182
  return a.bytes += s.length, a.bytes > r.size || s.length > 32768 ? (n.files.delete(r.id), !0) : (a.parts.push(s), a.index++, r.final && a.bytes === r.size && (a.blob = new Blob(a.parts, { type: r.type })), !0);
10157
10183
  }
10158
- function eu(e, t) {
10159
- let n = Zl(e);
10184
+ function tu(e, t) {
10185
+ let n = Ql(e);
10160
10186
  return {
10161
10187
  ...t,
10162
10188
  attachments: (t.attachments || []).map((e) => {
@@ -10172,13 +10198,13 @@ function eu(e, t) {
10172
10198
  })
10173
10199
  };
10174
10200
  }
10175
- function tu(e) {
10176
- let t = Xl.get(e);
10201
+ function nu(e) {
10202
+ let t = Zl.get(e);
10177
10203
  t && (t.pending.forEach(({ reject: e, timer: t }) => {
10178
10204
  clearTimeout(t), e(/* @__PURE__ */ Error("Conexión interrumpida. Reintenta el envío."));
10179
10205
  }), t.pending.clear(), t.files.clear());
10180
10206
  }
10181
- async function nu(e, t, n, r = []) {
10207
+ async function ru(e, t, n, r = []) {
10182
10208
  if (r.length > 1) throw Error("Envía un archivo o GIF por mensaje.");
10183
10209
  let i = [];
10184
10210
  for (let n of r) {
@@ -10191,11 +10217,11 @@ async function nu(e, t, n, r = []) {
10191
10217
  continue;
10192
10218
  }
10193
10219
  let r = n.file;
10194
- if (!(r instanceof Blob) || !r.size || r.size > Yl) throw Error("El archivo debe pesar entre 1 byte y 10 MB.");
10220
+ if (!(r instanceof Blob) || !r.size || r.size > Xl) throw Error("El archivo debe pesar entre 1 byte y 10 MB.");
10195
10221
  let a = crypto.randomUUID();
10196
10222
  for (let i = 0, o = 0; i < r.size; i += 32768, o++) {
10197
10223
  let s = new Uint8Array(await r.slice(i, i + 32768).arrayBuffer()), c = btoa(String.fromCharCode(...s));
10198
- await Ql(e, "CHAT_FILE", {
10224
+ await $l(e, "CHAT_FILE", {
10199
10225
  id: a,
10200
10226
  room_id: t,
10201
10227
  size: r.size,
@@ -10207,14 +10233,14 @@ async function nu(e, t, n, r = []) {
10207
10233
  }
10208
10234
  i.push({ id: a });
10209
10235
  }
10210
- await Ql(e, "CHAT_MESSAGE", {
10236
+ await $l(e, "CHAT_MESSAGE", {
10211
10237
  room_id: t,
10212
10238
  message: n,
10213
10239
  attachments: i
10214
10240
  });
10215
10241
  }
10216
10242
  // src/index.js
10217
- var ru = "0.1.0", iu = () => import("./chunks/BattleshipPrototype-Duz-S1JE.js");
10218
- export { Ul as ChatButton, sr as ChatContext, Jl as ChatNotifications, Hl as ChatPage, Eo as ChatPeopleContext, Vl as ChatWindow, bl as ChatWindowShell, ct as DEFAULT_CONFIG, Ht as EDIT_PREFIX, Mi as EFFECT_CATALOG, Ei as EFFECT_PREFIX, Co as EmojiPicker, Bc as GifPicker, lr as LiraChatProvider, qn as MAX_CHAT_MESSAGES, ru as MINICODE_CHAT_VERSION, No as MessageBubble, vl as MessageComposer, Qo as MessageList, Ut as REACT_PREFIX, qt as STICKER_NAME_PREFIX, ll as StickerPicker, Cr as TRANSPORT_STATUSES, Tr as assertTransport, s as chatConnectionStore, y as chatGamesStore, Nl as chatUiStore, tu as closeRelay, jr as configureKlipy, $l as consumeRelayEvent, or as createChatStore, xt as createStandaloneTransport, Ai as decodeEffect, Qt as encodeEdit, ki as encodeEffect, $t as encodeReaction, b as getChatAssetsBaseUrl, Ni as getChatEffect, an as groupReactions, eu as hydrateRelayMessage, Xt as isMessageAction, Jt as isStickerAttachment, iu as loadBattleshipPreview, mt as normalizeConfig, ut as normalizeUser, kl as openChatWindow, en as parseMessageAction, Al as registerChatWorker, nu as sendRelayMessage, n as setChatAssetsBaseUrl, o as setChatConnectionStatus, ql as startAppBadge, El as startChatApp, c as startConnect4Sounds, Dn as startDesktopNotifications, mo as startEmojiPreferencesSync, Js as startGifLibrarySync, Vt as startUnreadStorageSync, Mt as totalUnread, Dt as unreadScope, fr as useChatConfig, yr as useChatConnection, t as useChatConnectionStatus, cr as useChatContext, e as useChatGames, Sr as useChatIdentity, Dl as useChatInstall, hr as useChatStore, gr as useChatStoreApi, pr as useChatTransport, Fl as useChatUi, Bt as useChatUnread, xr as useChatUnreadTotal };
10243
+ var iu = "0.1.0", au = () => import("./chunks/BattleshipPrototype-Duz-S1JE.js");
10244
+ export { Wl as ChatButton, sr as ChatContext, Yl as ChatNotifications, Ul as ChatPage, Do as ChatPeopleContext, Hl as ChatWindow, xl as ChatWindowShell, ct as DEFAULT_CONFIG, Ht as EDIT_PREFIX, Mi as EFFECT_CATALOG, Ei as EFFECT_PREFIX, wo as EmojiPicker, Vc as GifPicker, lr as LiraChatProvider, qn as MAX_CHAT_MESSAGES, iu as MINICODE_CHAT_VERSION, Po as MessageBubble, yl as MessageComposer, $o as MessageList, Ut as REACT_PREFIX, qt as STICKER_NAME_PREFIX, ul as StickerPicker, Cr as TRANSPORT_STATUSES, Tr as assertTransport, s as chatConnectionStore, y as chatGamesStore, Pl as chatUiStore, nu as closeRelay, jr as configureKlipy, eu as consumeRelayEvent, or as createChatStore, xt as createStandaloneTransport, Ai as decodeEffect, Qt as encodeEdit, ki as encodeEffect, $t as encodeReaction, b as getChatAssetsBaseUrl, Ni as getChatEffect, an as groupReactions, tu as hydrateRelayMessage, Xt as isMessageAction, Jt as isStickerAttachment, au as loadBattleshipPreview, mt as normalizeConfig, ut as normalizeUser, Al as openChatWindow, en as parseMessageAction, jl as registerChatWorker, ru as sendRelayMessage, n as setChatAssetsBaseUrl, o as setChatConnectionStatus, Jl as startAppBadge, Dl as startChatApp, c as startConnect4Sounds, Dn as startDesktopNotifications, ho as startEmojiPreferencesSync, Ys as startGifLibrarySync, Vt as startUnreadStorageSync, Mt as totalUnread, Dt as unreadScope, fr as useChatConfig, yr as useChatConnection, t as useChatConnectionStatus, cr as useChatContext, e as useChatGames, Sr as useChatIdentity, Ol as useChatInstall, hr as useChatStore, gr as useChatStoreApi, pr as useChatTransport, Il as useChatUi, Bt as useChatUnread, xr as useChatUnreadTotal };
10219
10245
 
10220
10246
  //# sourceMappingURL=index.js.map