@decentnetwork/beagle 0.1.129 → 0.1.131

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- window.__DK_UI_VERSION="0.1.129";
1
+ window.__DK_UI_VERSION="0.1.131";
2
2
  "use strict";
3
3
  (() => {
4
4
  // packages/beagle-ui/dist/beagle-ui.js
@@ -301,6 +301,94 @@ window.__DK_UI_VERSION="0.1.129";
301
301
  const s = String(text == null ? "" : text).replace(/\s+/g, " ").trim();
302
302
  return s.length > max ? s.slice(0, max - 1) + "\u2026" : s;
303
303
  }
304
+ function hostHasExits(d) {
305
+ if (!d || typeof d !== "object")
306
+ return false;
307
+ if (d.exitsSupported === false)
308
+ return false;
309
+ return !!d.exitFeature && typeof d.exitFeature === "object";
310
+ }
311
+ function desktopPollPath({ wantExits, opened, supported }) {
312
+ if (!wantExits || supported !== true)
313
+ return "/api/desktop";
314
+ return opened ? "/api/desktop?exits=1&open=1" : "/api/desktop?exits=1";
315
+ }
316
+ function exitControls({ exitFeature, routeFallback, exits }) {
317
+ const has = hostHasExits({ exitFeature });
318
+ const list = Array.isArray(exits) ? exits : [];
319
+ const anyFailed = list.some((r) => (r.nodes || []).some((n) => n.status === "failed"));
320
+ return {
321
+ refresh: has && list.length > 0,
322
+ reconnect: has,
323
+ reconnectAll: has && anyFailed,
324
+ noExitNotice: has && exitFeature.available === false,
325
+ fallbackNotice: has && !!(routeFallback && routeFallback.from),
326
+ anyFailed: has && anyFailed
327
+ };
328
+ }
329
+ var VOICE_RE = /^voice-(\d+)(?:-(\d+))?\.(m4a|aac|ogg|oga|opus|mp3|wav|caf|amr)$/i;
330
+ function isVoiceName(name) {
331
+ return VOICE_RE.test(String(name || "").trim());
332
+ }
333
+ function voiceDurationMs(name) {
334
+ const m = VOICE_RE.exec(String(name || "").trim());
335
+ if (!m || !m[2])
336
+ return null;
337
+ const d = Number(m[2]);
338
+ return d > 0 && d < 36e5 ? d : null;
339
+ }
340
+ function formatDuration(ms) {
341
+ if (ms == null || !(ms >= 0))
342
+ return "";
343
+ const s = Math.round(ms / 1e3);
344
+ return Math.floor(s / 60) + ":" + String(s % 60).padStart(2, "0");
345
+ }
346
+ var EXT_KIND = {
347
+ image: ["png", "jpg", "jpeg", "gif", "webp", "svg", "heic", "bmp"],
348
+ video: ["mp4", "mov", "webm", "m4v", "mkv", "avi"],
349
+ audio: ["mp3", "m4a", "aac", "wav", "ogg", "oga", "flac", "opus", "caf", "amr"]
350
+ };
351
+ function fileMediaKind(name, contentType) {
352
+ if (isVoiceName(name))
353
+ return "audio";
354
+ const ct = String(contentType || "").toLowerCase();
355
+ if (/^(image|video|audio)\//.test(ct))
356
+ return ct.split("/")[0];
357
+ const ext = (String(name || "").split(".").pop() || "").toLowerCase();
358
+ for (const kind of Object.keys(EXT_KIND))
359
+ if (EXT_KIND[kind].includes(ext))
360
+ return kind;
361
+ return "file";
362
+ }
363
+ function cgpFile(message) {
364
+ const f = message && typeof message === "object" ? message.file : null;
365
+ if (!f || typeof f !== "object")
366
+ return null;
367
+ const name = typeof f.filename === "string" && f.filename ? f.filename : null;
368
+ if (!name)
369
+ return null;
370
+ const size = Number(f.size);
371
+ const contentType = typeof f.contentType === "string" ? f.contentType : "";
372
+ const voice = isVoiceName(name);
373
+ return {
374
+ name,
375
+ size: Number.isFinite(size) && size >= 0 ? size : null,
376
+ contentType,
377
+ media: fileMediaKind(name, contentType),
378
+ voice,
379
+ durationMs: voice ? voiceDurationMs(name) : null
380
+ };
381
+ }
382
+ function fileLabel(file, T) {
383
+ if (!file)
384
+ return "";
385
+ if (file.voice) {
386
+ const d = formatDuration(file.durationMs);
387
+ return "\u{1F3A4} " + (T && T.voiceMessage || "Voice message") + (d ? " " + d : "");
388
+ }
389
+ const icon = file.media === "image" ? "\u{1F5BC} " : file.media === "video" ? "\u{1F3AC} " : "\u{1F4CE} ";
390
+ return icon + file.name;
391
+ }
304
392
  function dkHash(s) {
305
393
  let h = 2166136261;
306
394
  for (let i = 0; i < s.length; i++) {
@@ -357,15 +445,8 @@ window.__DK_UI_VERSION="0.1.129";
357
445
  }
358
446
  var dkFileUrl = fileUrl;
359
447
  var dkFileDownloadUrl = fileDownloadUrl;
360
- function dkFileMediaKind(name) {
361
- const ext = (String(name || "").split(".").pop() || "").toLowerCase();
362
- if (["png", "jpg", "jpeg", "gif", "webp", "svg", "heic", "bmp"].includes(ext))
363
- return "image";
364
- if (["mp4", "mov", "webm", "m4v", "mkv", "avi"].includes(ext))
365
- return "video";
366
- if (["mp3", "m4a", "aac", "wav", "ogg", "flac", "opus"].includes(ext))
367
- return "audio";
368
- return "file";
448
+ function dkFileMediaKind(name, contentType) {
449
+ return fileMediaKind(name, contentType);
369
450
  }
370
451
  function dkDayLabel(ts) {
371
452
  if (!ts)
@@ -446,6 +527,8 @@ window.__DK_UI_VERSION="0.1.129";
446
527
  // that failed three times in a row are never probed again on their own.
447
528
  reconnectExit: (ip) => dkPost("/api/exits/reconnect", { ip }),
448
529
  reconnectAllExits: () => dkPost("/api/exits/reconnect", { all: true }),
530
+ // Every exit once, now, failed ones included.
531
+ refreshExits: () => dkPost("/api/exits/refresh", {}),
449
532
  // Used by the browser's welcome flow, which also picks an avatar and marks
450
533
  // first run done. Harmless where there is no welcome flow: nothing calls it.
451
534
  setProfileFull: (p) => dkPost("/api/set-profile", p),
@@ -515,6 +598,9 @@ window.__DK_UI_VERSION="0.1.129";
515
598
  size: dkFileSize(m.file.size),
516
599
  dir: m.dir,
517
600
  media: dkFileMediaKind(m.file.name),
601
+ // voice-<ms>-<durMs>.m4a: shown as a voice note with its length.
602
+ voice: isVoiceName(m.file.name),
603
+ durationMs: voiceDurationMs(m.file.name),
518
604
  status: m.file.status,
519
605
  pct: m.file.status === "sending" && m.file.size ? Math.min(100, (m.file.sent || 0) / m.file.size * 100) : void 0,
520
606
  kbps: m.file.kbps
@@ -524,6 +610,8 @@ window.__DK_UI_VERSION="0.1.129";
524
610
  // never went out at all — rendered as delivered.
525
611
  status: m.dir === "out" ? m.status === "queued" || m.status === "sending" || m.status === "failed" || m.status === "sent" ? m.status : "read" : void 0,
526
612
  error: m.error,
613
+ // Real sender of a file relayed by a group (the thread is the group).
614
+ origin: m.origin,
527
615
  // false = went to a live session but nobody acknowledged it (one tick).
528
616
  // Dropped here before, so that state could never render.
529
617
  confirmed: m.confirmed,
@@ -585,6 +673,8 @@ window.__DK_UI_VERSION="0.1.129";
585
673
  const wantExits = !!(opts && opts.exits);
586
674
  const wantExitsRef = React.useRef(wantExits);
587
675
  wantExitsRef.current = wantExits;
676
+ const exitsOpenedRef = React.useRef(false);
677
+ const exitsSupportedRef = React.useRef(null);
588
678
  const [snap, setSnap] = React.useState({
589
679
  me: DK_ME_FALLBACK,
590
680
  peers: [],
@@ -601,7 +691,14 @@ window.__DK_UI_VERSION="0.1.129";
601
691
  const refresh = React.useCallback(async () => {
602
692
  var _a, _b, _c;
603
693
  try {
604
- const d = await dkGet(wantExitsRef.current ? "/api/desktop?exits=1" : "/api/desktop");
694
+ const path = desktopPollPath({
695
+ wantExits: wantExitsRef.current,
696
+ opened: exitsOpenedRef.current,
697
+ supported: exitsSupportedRef.current
698
+ });
699
+ if (path.includes("open=1"))
700
+ exitsOpenedRef.current = false;
701
+ const d = await dkGet(path);
605
702
  if (d && d.locked) {
606
703
  setSnap((s) => ({ ...s, locked: true, loaded: true }));
607
704
  return;
@@ -612,6 +709,13 @@ window.__DK_UI_VERSION="0.1.129";
612
709
  }, 300);
613
710
  return;
614
711
  }
712
+ const had = exitsSupportedRef.current;
713
+ exitsSupportedRef.current = hostHasExits(d);
714
+ if (had !== true && exitsSupportedRef.current && wantExitsRef.current && exitsOpenedRef.current) {
715
+ setTimeout(() => {
716
+ refreshRef.current && refreshRef.current();
717
+ }, 0);
718
+ }
615
719
  setSnap({
616
720
  locked: false,
617
721
  me: d.me || DK_ME_FALLBACK,
@@ -633,8 +737,10 @@ window.__DK_UI_VERSION="0.1.129";
633
737
  return () => clearInterval(t);
634
738
  }, [refresh]);
635
739
  React.useEffect(() => {
636
- if (wantExits)
740
+ if (wantExits) {
741
+ exitsOpenedRef.current = true;
637
742
  refresh();
743
+ }
638
744
  }, [wantExits, refresh]);
639
745
  const inFlight = React.useRef(/* @__PURE__ */ new Set());
640
746
  const cache = React.useRef({});
@@ -1773,6 +1879,165 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
1773
1879
  function isGreetingItem(m) {
1774
1880
  return !!m && m.kind === GREETING_KIND;
1775
1881
  }
1882
+ var PROOF_KEY = { eth: "proof.eth", sol: "proof.sol" };
1883
+ var HEAD = "Beagle wallet binding";
1884
+ var LINE = "I bind this wallet to my Beagle identity.";
1885
+ var ADDRESS_RE = { eth: /^0x[0-9a-fA-F]{40}$/, sol: /^[1-9A-HJ-NP-Za-km-z]{32,44}$/ };
1886
+ var USERID_RE = /^[1-9A-HJ-NP-Za-km-z]{32,48}$/;
1887
+ var ISSUED_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/;
1888
+ function isWalletAddress(chain, address) {
1889
+ const re = ADDRESS_RE[chain];
1890
+ return !!re && typeof address === "string" && re.test(address);
1891
+ }
1892
+ function proofTime(date = /* @__PURE__ */ new Date()) {
1893
+ return new Date(Math.floor(date.getTime() / 1e3) * 1e3).toISOString().replace(".000Z", "Z");
1894
+ }
1895
+ function walletProofMessage({ userid, chain, address, issued }) {
1896
+ if (!USERID_RE.test(String(userid || "")))
1897
+ throw new Error("wallet proof: bad userid");
1898
+ if (!isWalletAddress(chain, address))
1899
+ throw new Error("wallet proof: bad chain or address");
1900
+ if (!ISSUED_RE.test(String(issued || "")))
1901
+ throw new Error("wallet proof: bad issued time");
1902
+ return [HEAD, "", LINE, "", `userid: ${userid}`, `chain: ${chain}`, `address: ${address}`, `issued: ${issued}`].join("\n");
1903
+ }
1904
+ var B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
1905
+ function base58Encode(bytes) {
1906
+ const digits = [];
1907
+ for (const b of bytes) {
1908
+ let carry = b;
1909
+ for (let j = 0; j < digits.length; j++) {
1910
+ carry += digits[j] << 8;
1911
+ digits[j] = carry % 58;
1912
+ carry = carry / 58 | 0;
1913
+ }
1914
+ while (carry > 0) {
1915
+ digits.push(carry % 58);
1916
+ carry = carry / 58 | 0;
1917
+ }
1918
+ }
1919
+ let out = "";
1920
+ for (const b of bytes) {
1921
+ if (b !== 0)
1922
+ break;
1923
+ out += "1";
1924
+ }
1925
+ for (let i = digits.length - 1; i >= 0; i--)
1926
+ out += B58[digits[i]];
1927
+ return out;
1928
+ }
1929
+ function base58Decode(str2) {
1930
+ const bytes = [];
1931
+ for (const c of String(str2)) {
1932
+ let carry = B58.indexOf(c);
1933
+ if (carry < 0)
1934
+ throw new Error("not base58");
1935
+ for (let j = 0; j < bytes.length; j++) {
1936
+ carry += bytes[j] * 58;
1937
+ bytes[j] = carry & 255;
1938
+ carry >>= 8;
1939
+ }
1940
+ while (carry > 0) {
1941
+ bytes.push(carry & 255);
1942
+ carry >>= 8;
1943
+ }
1944
+ }
1945
+ for (const c of String(str2)) {
1946
+ if (c !== "1")
1947
+ break;
1948
+ bytes.push(0);
1949
+ }
1950
+ return Uint8Array.from(bytes.reverse());
1951
+ }
1952
+ var utf8Hex = (s) => "0x" + Array.from(new TextEncoder().encode(s), (b) => b.toString(16).padStart(2, "0")).join("");
1953
+ async function signEthProof(provider, { userid, address, issued = proofTime() }) {
1954
+ const message = walletProofMessage({ userid, chain: "eth", address, issued });
1955
+ const signature = await provider.request({ method: "personal_sign", params: [utf8Hex(message), address] });
1956
+ return { message, signature: String(signature) };
1957
+ }
1958
+ async function signSolProof(wallet, { userid, address, issued = proofTime() }) {
1959
+ const message = walletProofMessage({ userid, chain: "sol", address, issued });
1960
+ const r = await wallet.signMessage(new TextEncoder().encode(message), "utf8");
1961
+ const sig = r && r.signature ? r.signature : r;
1962
+ return { message, signature: base58Encode(Uint8Array.from(sig)) };
1963
+ }
1964
+ function stripNul(text) {
1965
+ return String(text == null ? "" : text).replace(/\0+$/u, "");
1966
+ }
1967
+ function parseBeagleContact(raw) {
1968
+ const text = stripNul(raw);
1969
+ const shape = (j) => ({
1970
+ name: j.name || "",
1971
+ ens: j.ens || "",
1972
+ userid: j.userid || j.userId || "",
1973
+ address: j.address || "",
1974
+ avatar: j.avatar || j.avatarUrl || "",
1975
+ description: j.description || "",
1976
+ kind: j.kind || ""
1977
+ });
1978
+ const fence = /```\s*beagle-contact\s*\n([\s\S]*?)\n```/i.exec(text);
1979
+ if (fence) {
1980
+ try {
1981
+ const j = JSON.parse(fence[1].trim());
1982
+ if (j && (j.type === "beagle_contact" || j.type === "beagle-contact"))
1983
+ return shape(j);
1984
+ } catch (e) {
1985
+ }
1986
+ }
1987
+ if (/^\s*BCR1\s+/i.test(text)) {
1988
+ try {
1989
+ const j = JSON.parse(text.replace(/^\s*BCR1\s+/i, "").trim());
1990
+ if (j && j.type === "beagle_contact")
1991
+ return shape(j);
1992
+ } catch (e) {
1993
+ }
1994
+ }
1995
+ return null;
1996
+ }
1997
+ function isCarrierAddress(addr) {
1998
+ const s = String(addr || "").trim();
1999
+ if (s.length < 48 || s.length > 56)
2000
+ return false;
2001
+ let b;
2002
+ try {
2003
+ b = base58Decode(s);
2004
+ } catch (e) {
2005
+ return false;
2006
+ }
2007
+ if (b.length !== 38)
2008
+ return false;
2009
+ const c = [0, 0];
2010
+ for (let i = 0; i < 36; i++)
2011
+ c[i % 2] ^= b[i];
2012
+ return b[36] === c[0] && b[37] === c[1];
2013
+ }
2014
+ function isUserId(id) {
2015
+ const s = String(id || "").trim();
2016
+ if (s.length < 40 || s.length > 46)
2017
+ return false;
2018
+ try {
2019
+ return base58Decode(s).length === 32;
2020
+ } catch (e) {
2021
+ return false;
2022
+ }
2023
+ }
2024
+ function cardFriend(card, peers) {
2025
+ if (!card)
2026
+ return null;
2027
+ const ids = [card.userid, card.address].filter(Boolean);
2028
+ if (!ids.length)
2029
+ return null;
2030
+ return (peers || []).find((p) => p && !p.pending && (ids.includes(p.userId) || p.address && ids.includes(p.address))) || null;
2031
+ }
2032
+ function nameCardView(card, peers) {
2033
+ const c = card || {};
2034
+ const address = isCarrierAddress(c.address) ? String(c.address).trim() : "";
2035
+ const userid = c.userid || (!address && isUserId(c.address) ? String(c.address).trim() : "");
2036
+ const isGroup = c.kind === "group" || c.type === "group";
2037
+ const friend = cardFriend(c, peers);
2038
+ const action = friend ? "chat" : address ? isGroup ? "join" : "add" : null;
2039
+ return { userid, address, isGroup, friend, action };
2040
+ }
1776
2041
  var DK_CMD_HIST_KEY = "beagle.assistant.history";
1777
2042
  var DK_CMD_HIST_MAX = 50;
1778
2043
  function RequestsBlock({ T, requests, onAct }) {
@@ -1960,7 +2225,7 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
1960
2225
  textOverflow: "ellipsis",
1961
2226
  flex: 1,
1962
2227
  minWidth: 0
1963
- } }, dkRowPreview(row.preview)))), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-end", gap: 4, flexShrink: 0 } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 10.5, color: "var(--faint)" } }, row.lastTime), peer.app ? null : row.unread ? /* @__PURE__ */ React.createElement(Unread, { n: row.unread }) : peer.pending ? /* @__PURE__ */ React.createElement(Icon, { name: "clock", size: 11, stroke: 2.2, color: "var(--warn, #d29922)", title: "friend request pending" }) : /* @__PURE__ */ React.createElement(StatusDot, { online: peer.online })));
2228
+ } }, dkRowPreview(row.preview, T)))), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-end", gap: 4, flexShrink: 0 } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 10.5, color: "var(--faint)" } }, row.lastTime), peer.app ? null : row.unread ? /* @__PURE__ */ React.createElement(Unread, { n: row.unread }) : peer.pending ? /* @__PURE__ */ React.createElement(Icon, { name: "clock", size: 11, stroke: 2.2, color: "var(--warn, #d29922)", title: "friend request pending" }) : /* @__PURE__ */ React.createElement(StatusDot, { online: peer.online })));
1964
2229
  }
1965
2230
  function dkActivityTs(p, isProtocol, fix) {
1966
2231
  const row = rosterRow(p, isProtocol || (() => false), fix);
@@ -2159,41 +2424,7 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2159
2424
  return out;
2160
2425
  }
2161
2426
  function dkParseBeagleContact(raw) {
2162
- const text = String(raw == null ? "" : raw);
2163
- const fence = /```\s*beagle-contact\s*\n([\s\S]*?)\n```/i.exec(text);
2164
- if (fence) {
2165
- try {
2166
- const j = JSON.parse(fence[1].trim());
2167
- if (j && (j.type === "beagle_contact" || j.type === "beagle-contact")) {
2168
- return {
2169
- name: j.name || "",
2170
- ens: j.ens || "",
2171
- userid: j.userid || j.userId || "",
2172
- address: j.address || "",
2173
- avatar: j.avatar || j.avatarUrl || "",
2174
- description: j.description || ""
2175
- };
2176
- }
2177
- } catch (e) {
2178
- }
2179
- }
2180
- if (/^\s*BCR1\s+/i.test(text)) {
2181
- try {
2182
- const j = JSON.parse(text.replace(/^\s*BCR1\s+/i, "").trim());
2183
- if (j && j.type === "beagle_contact") {
2184
- return {
2185
- name: j.name || "",
2186
- ens: j.ens || "",
2187
- userid: j.userid || j.userId || "",
2188
- address: j.address || "",
2189
- avatar: j.avatar || "",
2190
- description: j.description || ""
2191
- };
2192
- }
2193
- } catch (e) {
2194
- }
2195
- }
2196
- return null;
2427
+ return parseBeagleContact(raw);
2197
2428
  }
2198
2429
  function dkEncodeBeagleContact(p) {
2199
2430
  const j = {
@@ -2211,7 +2442,7 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2211
2442
  const link = "\n\n[Open name card](https://app.beagle.chat/#/chat?address=" + encodeURIComponent(p.address || "") + ")";
2212
2443
  return head + bio + link + "\n\n```beagle-contact\n" + JSON.stringify(j) + "\n```\n";
2213
2444
  }
2214
- function dkRowPreview(text) {
2445
+ function dkRowPreview(text, T) {
2215
2446
  const card = dkContactPreview(text);
2216
2447
  if (card)
2217
2448
  return card;
@@ -2219,7 +2450,7 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2219
2450
  const mine = /^you:\s*/i.test(s);
2220
2451
  const cgp = dkParseCGP1(s.replace(/^you:\s*/i, ""));
2221
2452
  if (cgp)
2222
- return (mine ? "you: " : "") + cgp.sender + ": " + cgp.body.replace(/\s+/g, " ");
2453
+ return (mine ? "you: " : "") + cgp.sender + ": " + (cgp.file ? fileLabel(cgp.file, T) : cgp.body.replace(/\s+/g, " "));
2223
2454
  return s;
2224
2455
  }
2225
2456
  function dkContactPreview(text) {
@@ -2365,7 +2596,8 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2365
2596
  const senderId = origin.userid || origin.friendid || null;
2366
2597
  const sender = origin.nickname || origin.user_info && origin.user_info.name || (senderId ? senderId.slice(0, 10) : "member");
2367
2598
  const body = j.message && j.message.text || j.render && j.render.plain || "";
2368
- return { sender, senderId, body: String(body), ts: null, strong: true };
2599
+ const file = cgpFile(j.message);
2600
+ return { sender, senderId, body: String(body), ts: null, strong: true, file };
2369
2601
  }
2370
2602
  function dkGroupParse(text) {
2371
2603
  const cgp = dkParseCGP1(text);
@@ -2682,11 +2914,44 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2682
2914
  return /* @__PURE__ */ React.createElement(DkGreetingMsg, { m: props.m, peer: props.peer, T: props.T });
2683
2915
  return /* @__PURE__ */ React.createElement(DkMsgBody, { ...props });
2684
2916
  }
2917
+ function DkGroupFileCard({ file, T, offline }) {
2918
+ const voice = file.voice;
2919
+ const label = voice ? (T && T.voiceMessage || "Voice message") + (file.durationMs ? " \xB7 " + formatDuration(file.durationMs) : "") : file.name;
2920
+ return /* @__PURE__ */ React.createElement("div", { style: {
2921
+ display: "flex",
2922
+ alignItems: "center",
2923
+ gap: 10,
2924
+ padding: "9px 12px",
2925
+ borderRadius: 12,
2926
+ maxWidth: 320,
2927
+ background: offline ? "rgba(245,158,11,0.16)" : "var(--bub-them)",
2928
+ border: "1px solid " + (offline ? "rgba(245,158,11,0.55)" : "var(--line)")
2929
+ } }, /* @__PURE__ */ React.createElement("span", { style: {
2930
+ width: 34,
2931
+ height: 34,
2932
+ borderRadius: 17,
2933
+ flexShrink: 0,
2934
+ display: "inline-flex",
2935
+ alignItems: "center",
2936
+ justifyContent: "center",
2937
+ background: "var(--panel-2)",
2938
+ border: "1px solid var(--line)"
2939
+ } }, /* @__PURE__ */ React.createElement(Icon, { name: voice ? "mic" : file.media === "image" ? "image" : file.media === "video" ? "video" : "file", size: 17, stroke: 2, color: "var(--faint)" })), /* @__PURE__ */ React.createElement("span", { style: { display: "flex", flexDirection: "column", minWidth: 0, gap: 2 } }, /* @__PURE__ */ React.createElement("span", { style: {
2940
+ fontFamily: voice ? "var(--ui)" : "var(--mono)",
2941
+ fontSize: 12.5,
2942
+ fontWeight: 600,
2943
+ color: "var(--text)",
2944
+ whiteSpace: "nowrap",
2945
+ overflow: "hidden",
2946
+ textOverflow: "ellipsis"
2947
+ } }, label), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 11, color: "var(--faint)", lineHeight: 1.35 } }, file.size != null ? dkFileSize(file.size) + " \xB7 " : "", T && T.groupFileNotDelivered || "Not delivered to this device: the group sends agents only a description of files.")));
2948
+ }
2685
2949
  function DkMsgBody({ m, peer, T, lang, onTheater, onDelete, onCancel, onRetry, onRetryMsg, onReveal, onOpenFile, onCall, onFormSubmit, onNameCard, onAssistantRemove, onAssistantAdopt, answered, selMode, selected, onToggleSel, busy, isGroup }) {
2686
2950
  const mine = m.from === "me";
2687
2951
  const nativeMedia = !m.file ? dkNativeMediaFromText(m.text) : null;
2688
2952
  const grp = isGroup && m.dir !== "out" && !m.file && !nativeMedia ? dkGroupParse(m.text) : null;
2689
- const grpSender = grp || (nativeMedia && nativeMedia.sender ? { sender: nativeMedia.sender, senderId: null } : null);
2953
+ const fileSender = !mine && m.file && m.origin && (m.origin.userid || m.origin.nickname) ? { sender: m.origin.nickname || (m.origin.userid || "").slice(0, 10), senderId: m.origin.userid || null } : null;
2954
+ const grpSender = grp || fileSender || (nativeMedia && nativeMedia.sender ? { sender: nativeMedia.sender, senderId: null } : null);
2690
2955
  const read = window.ChatComponents ? window.ChatComponents.readMessage((grp ? grp.body : m.text) || "") : { text: grp ? grp.body : m.text, form: null, interaction: null };
2691
2956
  const submitted = read.form && answered ? answered.get(read.form.custom_id) : null;
2692
2957
  const rtcFile = !mine && !m.file ? dkRtcFileFromText(peer.userId || peer.id, m.text) : null;
@@ -2785,7 +3050,10 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2785
3050
  style: mediaBtnStyle
2786
3051
  },
2787
3052
  /* @__PURE__ */ React.createElement(Icon, { name: "maximize", size: 16, stroke: 2, color: "#fff" })
2788
- ))), rtcFile.media === "audio" && /* @__PURE__ */ React.createElement("audio", { src: rtcFile.url, controls: true, style: { width: "100%" } }), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8, padding: "0 2px" } }, /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, rtcFile.name), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)", flexShrink: 0 } }, dkFileSize(rtcFile.size)), /* @__PURE__ */ React.createElement("a", { href: rtcFile.url, download: rtcFile.name, title: "download", style: { display: "inline-flex", flexShrink: 0 } }, /* @__PURE__ */ React.createElement(Icon, { name: "download", size: 15, stroke: 2, color: "var(--accent)" })))) : m.file ? (
3053
+ ))), rtcFile.media === "audio" && /* @__PURE__ */ React.createElement("audio", { src: rtcFile.url, controls: true, style: { width: "100%" } }), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8, padding: "0 2px" } }, /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, rtcFile.name), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)", flexShrink: 0 } }, dkFileSize(rtcFile.size)), /* @__PURE__ */ React.createElement("a", { href: rtcFile.url, download: rtcFile.name, title: "download", style: { display: "inline-flex", flexShrink: 0 } }, /* @__PURE__ */ React.createElement(Icon, { name: "download", size: 15, stroke: 2, color: "var(--accent)" })))) : m.file ? /* @__PURE__ */ React.createElement(
3054
+ React.Fragment,
3055
+ null,
3056
+ fileSender && /* @__PURE__ */ React.createElement(DkGroupSender, { grp: fileSender, T }),
2789
3057
  // Inline preview/player. Received media: as soon as it's saved.
2790
3058
  // Sent media: once it's fully delivered ('sent') — the daemon keeps a
2791
3059
  // local copy so it plays on the sender's side too.
@@ -2849,7 +3117,7 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2849
3117
  style: mediaBtnStyle
2850
3118
  },
2851
3119
  /* @__PURE__ */ React.createElement(Icon, { name: "maximize", size: 16, stroke: 2, color: "#fff" })
2852
- ))), m.file.media === "audio" && /* @__PURE__ */ React.createElement("audio", { src: dkFileUrl(m.file.name), controls: true, style: { width: "100%" } }), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8, padding: "0 2px" } }, /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, m.file.name), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)", flexShrink: 0 } }, m.file.size), onReveal && /* @__PURE__ */ React.createElement(
3120
+ ))), m.file.media === "audio" && m.file.voice && /* @__PURE__ */ React.createElement("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, padding: "0 2px", fontFamily: "var(--ui)", fontSize: 12, color: "var(--dim)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "mic", size: 14, stroke: 2, color: "var(--accent)" }), T && T.voiceMessage || "Voice message", m.file.durationMs ? " \xB7 " + formatDuration(m.file.durationMs) : ""), m.file.media === "audio" && /* @__PURE__ */ React.createElement("audio", { src: dkFileUrl(m.file.name), controls: true, style: { width: "100%" } }), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8, padding: "0 2px" } }, /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, m.file.name), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)", flexShrink: 0 } }, m.file.size), onReveal && /* @__PURE__ */ React.createElement(
2853
3121
  "button",
2854
3122
  {
2855
3123
  title: T.revealInFinder || "\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u663E\u793A / Show in file manager",
@@ -2992,7 +3260,7 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2992
3260
  }
2993
3261
  }
2994
3262
  }
2995
- ) : nativeMedia.kind === "audio" ? /* @__PURE__ */ React.createElement("audio", { controls: true, src: nativeMedia.url, style: { maxWidth: "100%" } }) : /* @__PURE__ */ React.createElement("video", { controls: true, src: nativeMedia.url, style: { maxWidth: "100%", borderRadius: 12, border: "1px solid var(--line)" } })) : (() => {
3263
+ ) : nativeMedia.kind === "audio" ? /* @__PURE__ */ React.createElement("audio", { controls: true, src: nativeMedia.url, style: { maxWidth: "100%" } }) : /* @__PURE__ */ React.createElement("video", { controls: true, src: nativeMedia.url, style: { maxWidth: "100%", borderRadius: 12, border: "1px solid var(--line)" } })) : grp && grp.file ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DkGroupSender, { grp, T }), /* @__PURE__ */ React.createElement(DkGroupFileCard, { file: grp.file, T, offline: m.via === "offline" })) : (() => {
2996
3264
  const contact = !read.form ? dkParseBeagleContact(read.text) : null;
2997
3265
  return /* @__PURE__ */ React.createElement(React.Fragment, null, grp && /* @__PURE__ */ React.createElement(DkGroupSender, { grp, T }), contact && (contact.address || contact.userid) ? /* @__PURE__ */ React.createElement(DkContactCardMsg, { card: contact, mine, T, onNameCard }) : /* @__PURE__ */ React.createElement("div", { style: {
2998
3266
  padding: "8px 12px",
@@ -3618,16 +3886,18 @@ ${peer.address}`
3618
3886
  ))),
3619
3887
  pubProfile && /* @__PURE__ */ React.createElement(DkPublicProfile, { T, userid: peer.userId, fallbackName: peer.alias, isFriend: true, onClose: () => setPubProfile(false) }),
3620
3888
  nameCardProf && (() => {
3621
- const cardFriend = (peers || []).find((p) => nameCardProf.userid && p.userId === nameCardProf.userid || nameCardProf.address && p.address === nameCardProf.address);
3889
+ const cardFriend2 = cardFriend(nameCardProf, peers);
3622
3890
  return /* @__PURE__ */ React.createElement(
3623
3891
  DkPublicProfile,
3624
3892
  {
3625
3893
  T,
3626
- userid: cardFriend && cardFriend.userId || nameCardProf.userid || nameCardProf.address,
3627
- fallbackName: nameCardProf.name || nameCardProf.ens,
3628
- isFriend: !!cardFriend,
3629
- onMessage: cardFriend && onOpenChat ? () => {
3630
- onOpenChat(cardFriend.id);
3894
+ userid: cardFriend2 && cardFriend2.userId || nameCardProf.userid || nameCardProf.address,
3895
+ fallbackName: cardFriend2 && cardFriend2.alias || nameCardProf.name || nameCardProf.ens,
3896
+ card: nameCardProf,
3897
+ friend: cardFriend2,
3898
+ isFriend: !!cardFriend2,
3899
+ onMessage: cardFriend2 && onOpenChat ? () => {
3900
+ onOpenChat(cardFriend2.id);
3631
3901
  setNameCardProf(null);
3632
3902
  } : void 0,
3633
3903
  onClose: () => setNameCardProf(null)
@@ -3665,65 +3935,6 @@ ${peer.address}`
3665
3935
  return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, display: "flex", minWidth: 0, minHeight: 0 } }, /* @__PURE__ */ React.createElement(PeerSidebar, { T, peers, requests, activeId, onSelect, onAct, onAdd, prefillAddr, onPrefillConsumed, muted, isProtocol, protocolFix }), peer ? /* @__PURE__ */ React.createElement(Conversation, { T, peer, lang, peers, onOpenChat: onSelect, thread, isProtocol, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread, hasEarlier, onLoadEarlier, onAssistantRemove, onAssistantAdopt, muted: !!muted && muted.includes(peer.id), onToggleMute }) : /* @__PURE__ */ React.createElement(ChatEmpty, { T }));
3666
3936
  }
3667
3937
  Object.assign(window, { ChatTab });
3668
- var PROOF_KEY = { eth: "proof.eth", sol: "proof.sol" };
3669
- var HEAD = "Beagle wallet binding";
3670
- var LINE = "I bind this wallet to my Beagle identity.";
3671
- var ADDRESS_RE = { eth: /^0x[0-9a-fA-F]{40}$/, sol: /^[1-9A-HJ-NP-Za-km-z]{32,44}$/ };
3672
- var USERID_RE = /^[1-9A-HJ-NP-Za-km-z]{32,48}$/;
3673
- var ISSUED_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/;
3674
- function isWalletAddress(chain, address) {
3675
- const re = ADDRESS_RE[chain];
3676
- return !!re && typeof address === "string" && re.test(address);
3677
- }
3678
- function proofTime(date = /* @__PURE__ */ new Date()) {
3679
- return new Date(Math.floor(date.getTime() / 1e3) * 1e3).toISOString().replace(".000Z", "Z");
3680
- }
3681
- function walletProofMessage({ userid, chain, address, issued }) {
3682
- if (!USERID_RE.test(String(userid || "")))
3683
- throw new Error("wallet proof: bad userid");
3684
- if (!isWalletAddress(chain, address))
3685
- throw new Error("wallet proof: bad chain or address");
3686
- if (!ISSUED_RE.test(String(issued || "")))
3687
- throw new Error("wallet proof: bad issued time");
3688
- return [HEAD, "", LINE, "", `userid: ${userid}`, `chain: ${chain}`, `address: ${address}`, `issued: ${issued}`].join("\n");
3689
- }
3690
- var B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
3691
- function base58Encode(bytes) {
3692
- const digits = [];
3693
- for (const b of bytes) {
3694
- let carry = b;
3695
- for (let j = 0; j < digits.length; j++) {
3696
- carry += digits[j] << 8;
3697
- digits[j] = carry % 58;
3698
- carry = carry / 58 | 0;
3699
- }
3700
- while (carry > 0) {
3701
- digits.push(carry % 58);
3702
- carry = carry / 58 | 0;
3703
- }
3704
- }
3705
- let out = "";
3706
- for (const b of bytes) {
3707
- if (b !== 0)
3708
- break;
3709
- out += "1";
3710
- }
3711
- for (let i = digits.length - 1; i >= 0; i--)
3712
- out += B58[digits[i]];
3713
- return out;
3714
- }
3715
- var utf8Hex = (s) => "0x" + Array.from(new TextEncoder().encode(s), (b) => b.toString(16).padStart(2, "0")).join("");
3716
- async function signEthProof(provider, { userid, address, issued = proofTime() }) {
3717
- const message = walletProofMessage({ userid, chain: "eth", address, issued });
3718
- const signature = await provider.request({ method: "personal_sign", params: [utf8Hex(message), address] });
3719
- return { message, signature: String(signature) };
3720
- }
3721
- async function signSolProof(wallet, { userid, address, issued = proofTime() }) {
3722
- const message = walletProofMessage({ userid, chain: "sol", address, issued });
3723
- const r = await wallet.signMessage(new TextEncoder().encode(message), "utf8");
3724
- const sig = r && r.signature ? r.signature : r;
3725
- return { message, signature: base58Encode(Uint8Array.from(sig)) };
3726
- }
3727
3938
  function CopyBtn({ value, copiedText = "Copied", copyFailedText = "Copy failed", copyTitle = "Copy" }) {
3728
3939
  const [status, setStatus] = React.useState(null);
3729
3940
  const timer = React.useRef(null);
@@ -3985,7 +4196,20 @@ ${peer.address}`
3985
4196
  /* @__PURE__ */ React.createElement("img", { src: p.image, alt: `punk #${p.id}`, style: { width: "100%", height: "100%", imageRendering: "pixelated", display: "block" } })
3986
4197
  ))))));
3987
4198
  }
3988
- function DkPublicProfile({ T, userid, fallbackName, onClose, isFriend, isMe, onMessage }) {
4199
+ function DkNameCardNoProfile({ T, view, card, onMessage, isMe }) {
4200
+ const [addState, setAddState] = React.useState(null);
4201
+ const lbl = { width: 110, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 };
4202
+ const rowS = { display: "flex", alignItems: "center", gap: 10, padding: "10px 0", borderTop: "1px solid var(--line)" };
4203
+ const cta = { padding: "7px 16px", borderRadius: 9, cursor: "pointer", fontFamily: "var(--ui)", fontSize: 12.5, border: "none", background: "var(--accent)", color: "#fff" };
4204
+ const kvRow = (label, value, head = 8) => /* @__PURE__ */ React.createElement("div", { style: rowS, key: label }, /* @__PURE__ */ React.createElement("span", { style: lbl }, label), /* @__PURE__ */ React.createElement("span", { title: value, style: { flex: 1, minWidth: 0, fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--dim)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, shortKey(value, head, 6)), /* @__PURE__ */ React.createElement(CopyBtn, { value, copiedText: T.copied, copyFailedText: T.copyFailed, copyTitle: T.copy }));
4205
+ const add = () => {
4206
+ setAddState("busy");
4207
+ fetch("/api/add", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ address: view.address }) }).then((r) => r.json()).then((r) => setAddState(r.ok !== false ? "sent" : r.error || T.addFailed || "failed")).catch((e) => setAddState(String(e && e.message || e)));
4208
+ };
4209
+ return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column" } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)", paddingBottom: 10, lineHeight: 1.5 } }, view.friend ? T.cardIsFriend || "Already in your chats." : T.cardNoEns || "No beagles.eth name registered."), card && card.description && /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--dim)", paddingBottom: 10, lineHeight: 1.5 } }, card.description), view.userid && kvRow(T.userId || "user id", view.userid, 10), view.address && kvRow(T.addr || "address", view.address), !isMe && view.action && /* @__PURE__ */ React.createElement("div", { style: { ...rowS, justifyContent: "flex-end", gap: 8 } }, view.action === "chat" ? onMessage && /* @__PURE__ */ React.createElement("button", { onClick: onMessage, style: cta }, T.openChat || "Open chat") : addState === "sent" ? /* @__PURE__ */ React.createElement(Tag, { tone: "accent" }, T.dirSent || "requested") : addState && addState !== "busy" ? /* @__PURE__ */ React.createElement("span", { title: addState, style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--warn, #f59e0b)" } }, T.addFailed || "failed") : /* @__PURE__ */ React.createElement("button", { onClick: add, disabled: addState === "busy", style: { ...cta, opacity: addState === "busy" ? 0.6 : 1 } }, addState === "busy" ? "\u2026" : view.action === "join" ? T.joinGroup || "Join group" : T.dirAdd || "Add")));
4210
+ }
4211
+ function DkPublicProfile({ T, userid, fallbackName, onClose, isFriend, isMe, onMessage, card, friend }) {
4212
+ const view = card ? nameCardView(card, friend ? [friend] : []) : null;
3989
4213
  const [st, setSt] = React.useState({ loading: true });
3990
4214
  const [addState, setAddState] = React.useState(null);
3991
4215
  const [recOpen, setRecOpen] = React.useState(false);
@@ -4036,7 +4260,7 @@ ${peer.address}`
4036
4260
  const links = prof ? Object.entries(prof.links || {}) : [];
4037
4261
  const lbl = { width: 110, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 };
4038
4262
  const rowS = { display: "flex", alignItems: "center", gap: 10, padding: "10px 0", borderTop: "1px solid var(--line)" };
4039
- return /* @__PURE__ */ React.createElement("div", { onClick: onClose, style: { position: "fixed", inset: 0, zIndex: 90, background: "color-mix(in oklab, #000, transparent 38%)", display: "flex", alignItems: "center", justifyContent: "center", padding: 24 } }, /* @__PURE__ */ React.createElement("div", { onClick: (e) => e.stopPropagation(), style: { width: 420, maxWidth: "94vw", background: "var(--panel)", border: "1px solid var(--line)", borderRadius: 16, padding: "20px 22px", display: "flex", flexDirection: "column", gap: 14 } }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 14 } }, prof && prof.avatarUrl ? /* @__PURE__ */ React.createElement(DkImgAvatar, { url: prof.avatarUrl, seed: userid, size: 56, radius: 14 }) : prof && prof.punkId != null ? /* @__PURE__ */ React.createElement(DkPunkAvatar, { id: prof.punkId, size: 56, radius: 14, fallbackSeed: userid }) : /* @__PURE__ */ React.createElement(DkIdenticon, { seed: userid, size: 56, radius: 14 }), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 17, fontWeight: 700, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, prof && prof.displayName || fallbackName || shortKey(userid, 10, 6)), prof && prof.ens && /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 12, color: "var(--accent)", marginTop: 2 } }, prof.ens)), /* @__PURE__ */ React.createElement(Btn, { icon: "x", size: "sm", onClick: onClose })), st.loading ? /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.dirLoading || "loading\u2026") : !prof ? /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.pubNone || "No public profile \u2014 this user has not registered a beagles.eth name.") : /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column" } }, prof.description && /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--dim)", paddingBottom: 12, lineHeight: 1.5 } }, prof.description), links.length > 0 && // Label keeps its column; pills wrap inside their OWN container so
4263
+ return /* @__PURE__ */ React.createElement("div", { onClick: onClose, style: { position: "fixed", inset: 0, zIndex: 90, background: "color-mix(in oklab, #000, transparent 38%)", display: "flex", alignItems: "center", justifyContent: "center", padding: 24 } }, /* @__PURE__ */ React.createElement("div", { onClick: (e) => e.stopPropagation(), style: { width: 420, maxWidth: "94vw", background: "var(--panel)", border: "1px solid var(--line)", borderRadius: 16, padding: "20px 22px", display: "flex", flexDirection: "column", gap: 14 } }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 14 } }, prof && prof.avatarUrl ? /* @__PURE__ */ React.createElement(DkImgAvatar, { url: prof.avatarUrl, seed: userid, size: 56, radius: 14 }) : prof && prof.punkId != null ? /* @__PURE__ */ React.createElement(DkPunkAvatar, { id: prof.punkId, size: 56, radius: 14, fallbackSeed: userid }) : friend ? /* @__PURE__ */ React.createElement(DkAvatar, { peer: friend, size: 56, radius: 14, dot: false }) : card && card.avatar ? /* @__PURE__ */ React.createElement(DkImgAvatar, { url: card.avatar, seed: userid, size: 56, radius: 14 }) : /* @__PURE__ */ React.createElement(DkIdenticon, { seed: userid, size: 56, radius: 14 }), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 17, fontWeight: 700, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, prof && prof.displayName || fallbackName || shortKey(userid, 10, 6)), prof && prof.ens && /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 12, color: "var(--accent)", marginTop: 2 } }, prof.ens)), /* @__PURE__ */ React.createElement(Btn, { icon: "x", size: "sm", onClick: onClose })), st.loading ? /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.dirLoading || "loading\u2026") : !prof && view ? /* @__PURE__ */ React.createElement(DkNameCardNoProfile, { T, view, card, onMessage, isMe }) : !prof ? /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.pubNone || "No public profile \u2014 this user has not registered a beagles.eth name.") : /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column" } }, prof.description && /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--dim)", paddingBottom: 12, lineHeight: 1.5 } }, prof.description), links.length > 0 && // Label keeps its column; pills wrap inside their OWN container so
4040
4264
  // an overflowing pill lands under the first pill, never under the label.
4041
4265
  /* @__PURE__ */ React.createElement("div", { style: { ...rowS, alignItems: "flex-start" } }, /* @__PURE__ */ React.createElement("span", { style: { ...lbl, paddingTop: 5 } }, T.linksCard || "links"), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0, display: "flex", gap: 8, flexWrap: "wrap" } }, links.map(([k, h]) => /* @__PURE__ */ React.createElement(
4042
4266
  "a",
@@ -4075,7 +4299,7 @@ ${peer.address}`
4075
4299
  disabled: addState === "busy",
4076
4300
  style: { ...cta, border: "none", background: "var(--accent)", color: "#fff", opacity: addState === "busy" ? 0.6 : 1 }
4077
4301
  },
4078
- addState === "busy" ? "\u2026" : T.dirAdd || "Add"
4302
+ addState === "busy" ? "\u2026" : view && view.isGroup ? T.joinGroup || "Join group" : T.dirAdd || "Add"
4079
4303
  )));
4080
4304
  })(), recOpen && /* @__PURE__ */ React.createElement("div", { style: { borderTop: "1px solid var(--line)", paddingTop: 10, display: "flex", flexDirection: "column", gap: 4, maxHeight: 200, overflowY: "auto" } }, /* @__PURE__ */ React.createElement("span", { style: { ...lbl, width: "auto", paddingBottom: 4 } }, T.pubRecTitle || "send this card to\u2026"), !recPeers ? /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 12, color: "var(--faint)" } }, T.dirLoading || "loading\u2026") : recPeers.length === 0 ? /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 12, color: "var(--faint)" } }, T.dirEmpty || "nobody") : recPeers.map((p) => /* @__PURE__ */ React.createElement(
4081
4305
  "button",
@@ -5199,13 +5423,89 @@ ${peer.address}`
5199
5423
  };
5200
5424
  }
5201
5425
  Object.assign(window, { dkRtcSignalBus, makeDaemonSignaling });
5426
+ var CALL_END_STATES = /* @__PURE__ */ new Set(["noAnswer", "unreachable", "failed", "busy", "declined"]);
5427
+ var CALL_END_LINGER_MS = 3500;
5428
+ var EN = {
5429
+ calling: "calling\u2026",
5430
+ remoteRinging: "ringing\u2026",
5431
+ connecting: "connecting\u2026",
5432
+ reconnecting: "reconnecting\u2026",
5433
+ noAnswer: "No answer",
5434
+ cantReach: "Can't reach {name}",
5435
+ callFailed: "Call failed",
5436
+ busy: "Busy",
5437
+ declined: "Declined"
5438
+ };
5439
+ function str(T, key) {
5440
+ return T && T[key] || EN[key];
5441
+ }
5442
+ function callStateLabel(state, T, name) {
5443
+ switch (state) {
5444
+ case "ringing":
5445
+ return str(T, "calling");
5446
+ case "remoteRinging":
5447
+ case "remoteOnline":
5448
+ return str(T, "remoteRinging");
5449
+ case "connecting":
5450
+ return str(T, "connecting");
5451
+ case "disconnected":
5452
+ return str(T, "reconnecting");
5453
+ case "noAnswer":
5454
+ return str(T, "noAnswer");
5455
+ case "unreachable":
5456
+ return str(T, "cantReach").replace("{name}", name || "");
5457
+ case "failed":
5458
+ return str(T, "callFailed");
5459
+ case "busy":
5460
+ return str(T, "busy");
5461
+ case "declined":
5462
+ return str(T, "declined");
5463
+ default:
5464
+ return state || "";
5465
+ }
5466
+ }
5467
+ function callStateTone(state) {
5468
+ if (state === "connected")
5469
+ return "ok";
5470
+ if (CALL_END_STATES.has(state))
5471
+ return "danger";
5472
+ return "warn";
5473
+ }
5474
+ function endStateFor(reason, error) {
5475
+ if (reason === "noAnswer" || reason === "unreachable" || reason === "busy" || reason === "declined")
5476
+ return reason;
5477
+ if (reason === "failed")
5478
+ return "failed";
5479
+ if (error)
5480
+ return error.sendFailed ? "unreachable" : "failed";
5481
+ return null;
5482
+ }
5202
5483
  function useCallController(selfId, onCallLog) {
5203
5484
  const [incoming, setIncoming] = React.useState(null);
5204
5485
  const [active, setActive] = React.useState(null);
5205
5486
  const [localStream, setLocalStream] = React.useState(null);
5206
5487
  const [remoteStream, setRemoteStream] = React.useState(null);
5207
5488
  const [sharing, setSharing] = React.useState(false);
5489
+ const [notice, setNotice] = React.useState(null);
5208
5490
  const engineRef = React.useRef(null);
5491
+ const lingerTimer = React.useRef(null);
5492
+ const noticeTimer = React.useRef(null);
5493
+ const endWithReason = React.useCallback((match, state) => {
5494
+ setActive((a) => a && !a.ended && match(a) ? { ...a, state, ended: true } : a);
5495
+ clearTimeout(lingerTimer.current);
5496
+ lingerTimer.current = setTimeout(() => {
5497
+ setActive((a) => a && a.ended ? null : a);
5498
+ }, CALL_END_LINGER_MS);
5499
+ }, []);
5500
+ const flashNotice = React.useCallback((text) => {
5501
+ setNotice(text);
5502
+ clearTimeout(noticeTimer.current);
5503
+ noticeTimer.current = setTimeout(() => setNotice(null), 4e3);
5504
+ }, []);
5505
+ React.useEffect(() => () => {
5506
+ clearTimeout(lingerTimer.current);
5507
+ clearTimeout(noticeTimer.current);
5508
+ }, []);
5209
5509
  const onCallLogRef = React.useRef(onCallLog);
5210
5510
  React.useEffect(() => {
5211
5511
  onCallLogRef.current = onCallLog;
@@ -5259,7 +5559,7 @@ ${peer.address}`
5259
5559
  if (onCallLogRef.current)
5260
5560
  onCallLogRef.current(info.peerId, !!info.video, "incoming");
5261
5561
  });
5262
- engine.on("stateChanged", (info, state) => setActive((a) => a && a.callId === info.callId ? { ...a, state } : a));
5562
+ engine.on("stateChanged", (info, state) => setActive((a) => a && !a.ended && a.callId === info.callId ? { ...a, state } : a));
5263
5563
  engine.on("localStream", (id, s) => {
5264
5564
  setLocalStream(s);
5265
5565
  try {
@@ -5268,8 +5568,14 @@ ${peer.address}`
5268
5568
  }
5269
5569
  });
5270
5570
  engine.on("remoteStream", (id, s) => setRemoteStream(s));
5271
- engine.on("ended", (id) => {
5272
- setActive((a) => a && a.callId === id ? null : a);
5571
+ engine.on("ended", (id, reason) => {
5572
+ const endState = endStateFor(reason);
5573
+ const a0 = activeRef.current;
5574
+ if (endState && a0 && a0.callId === id && a0.direction === "outgoing" && CALL_END_STATES.has(endState)) {
5575
+ endWithReason((a) => a.callId === id, endState);
5576
+ } else {
5577
+ setActive((a) => a && a.callId === id ? null : a);
5578
+ }
5273
5579
  setIncoming((i) => i && i.callId === id ? null : i);
5274
5580
  setLocalStream(null);
5275
5581
  setRemoteStream(null);
@@ -5302,15 +5608,20 @@ ${peer.address}`
5302
5608
  setActive({ callId: null, peerId, video: !!video, direction: "outgoing", state: "ringing" });
5303
5609
  if (onCallLogRef.current)
5304
5610
  onCallLogRef.current(peerId, !!video, "outgoing");
5611
+ let engine = null;
5305
5612
  waitEngine().then((eng) => {
5306
5613
  if (!eng)
5307
5614
  throw new Error("Calls unavailable (engine not ready)");
5615
+ engine = eng;
5308
5616
  return eng.call(peerId, { audio: true, video: !!video });
5309
- }).then((callId) => setActive((a) => a && a.peerId === peerId && a.callId === null ? { ...a, callId } : a)).catch((e) => {
5310
- setActive((a) => a && a.peerId === peerId ? null : a);
5311
- alert("Could not start call: " + (e && e.message || e));
5617
+ }).then((callId) => {
5618
+ const info = (engine && engine.calls || []).find((c) => c.callId === callId);
5619
+ setActive((a) => a && a.peerId === peerId && a.callId === null && !a.ended ? { ...a, callId, state: info && info.state || a.state } : a);
5620
+ }).catch((e) => {
5621
+ console.warn("[call] could not start call:", e && e.message || e);
5622
+ endWithReason((a) => a.peerId === peerId && a.callId === null, endStateFor(null, e || {}));
5312
5623
  });
5313
- }, [waitEngine]);
5624
+ }, [waitEngine, endWithReason]);
5314
5625
  const incomingRef = React.useRef(null);
5315
5626
  React.useEffect(() => {
5316
5627
  incomingRef.current = incoming;
@@ -5371,8 +5682,11 @@ ${peer.address}`
5371
5682
  if (!eng)
5372
5683
  throw new Error("Calls unavailable (engine not ready)");
5373
5684
  return eng.accept(pending.callId);
5374
- }).catch((e) => alert("Accept failed: " + (e && e.message || e)));
5375
- }, [waitEngine]);
5685
+ }).catch((e) => {
5686
+ console.warn("[call] accept failed:", e && e.message || e);
5687
+ endWithReason((a) => a.callId === pending.callId, "failed");
5688
+ });
5689
+ }, [waitEngine, endWithReason]);
5376
5690
  const reject = React.useCallback(() => {
5377
5691
  const eng = engineRef.current;
5378
5692
  const inc = incomingRef.current;
@@ -5385,7 +5699,8 @@ ${peer.address}`
5385
5699
  const hangup = React.useCallback(() => {
5386
5700
  const eng = engineRef.current;
5387
5701
  const a = activeRef.current;
5388
- if (eng && a && a.callId)
5702
+ clearTimeout(lingerTimer.current);
5703
+ if (eng && a && a.callId && !a.ended)
5389
5704
  eng.hangup(a.callId);
5390
5705
  setActive(null);
5391
5706
  setLocalStream(null);
@@ -5406,16 +5721,18 @@ ${peer.address}`
5406
5721
  else
5407
5722
  await eng.shareScreen(a.callId);
5408
5723
  } catch (e) {
5409
- if (e && e.name !== "NotAllowedError")
5410
- alert("Screen share failed: " + (e && e.message || e));
5724
+ if (e && e.name !== "NotAllowedError") {
5725
+ console.warn("[call] screen share failed:", e && e.message || e);
5726
+ flashNotice("shareFailed");
5727
+ }
5411
5728
  }
5412
- }, [active]);
5729
+ }, [active, flashNotice]);
5413
5730
  const setVideoOn = React.useCallback((v) => {
5414
5731
  const eng = engineRef.current, a = active;
5415
5732
  if (eng && a && a.callId)
5416
5733
  eng.setLocalTrackEnabled(a.callId, "video", v);
5417
5734
  }, [active]);
5418
- return { incoming, active, localStream, remoteStream, sharing, start, accept, reject, hangup, setMuted, setVideoOn, toggleShare };
5735
+ return { incoming, active, localStream, remoteStream, sharing, notice, start, accept, reject, hangup, setMuted, setVideoOn, toggleShare };
5419
5736
  }
5420
5737
  function VideoSurface({ stream, muted, style }) {
5421
5738
  const ref = React.useCallback((el) => {
@@ -5516,7 +5833,7 @@ ${peer.address}`
5516
5833
  const [secs, setSecs] = React.useState(0);
5517
5834
  const [muted, setMuted] = React.useState(false);
5518
5835
  const [featured, setFeatured] = React.useState("remote");
5519
- const connected = call && call.state === "connected";
5836
+ const connected = call && call.state === "connected" && !call.ended;
5520
5837
  React.useEffect(() => {
5521
5838
  if (!connected)
5522
5839
  return;
@@ -5537,7 +5854,8 @@ ${peer.address}`
5537
5854
  const video = call.video || ctl.sharing || streamHasVideo(ctl.remoteStream) || streamHasVideo(ctl.localStream);
5538
5855
  const mm = String(Math.floor(secs / 60)).padStart(2, "0");
5539
5856
  const ss = String(secs % 60).padStart(2, "0");
5540
- const stateLabel = connected ? mm + ":" + ss : call.state === "ringing" ? T && T.ringing || "ringing\u2026" : call.state === "connecting" ? T && T.connecting || "connecting\u2026" : call.state;
5857
+ const stateLabel = connected ? mm + ":" + ss : callStateLabel(call.state, T, name);
5858
+ const noticeText = ctl.notice === "shareFailed" ? T && T.shareFailed || "Screen share failed" : null;
5541
5859
  const toggleMute = () => {
5542
5860
  const n = !muted;
5543
5861
  setMuted(n);
@@ -5545,7 +5863,7 @@ ${peer.address}`
5545
5863
  };
5546
5864
  const canShare = connected && typeof navigator !== "undefined" && navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia;
5547
5865
  const controls = /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 18, alignItems: "flex-start" } }, /* @__PURE__ */ React.createElement(CallBtn, { icon: muted ? "micFill" : "mic", label: muted ? T && T.unmute || "unmute" : T && T.mute || "mute", active: muted, onClick: toggleMute }), canShare && /* @__PURE__ */ React.createElement(CallBtn, { icon: "monitor", label: ctl.sharing ? T && T.stopShare || "stop share" : T && T.share || "share", active: ctl.sharing, onClick: ctl.toggleShare }), /* @__PURE__ */ React.createElement(CallBtn, { icon: "phone", label: T && T.endCall || "end", danger: true, wide: true, onClick: ctl.hangup }));
5548
- return /* @__PURE__ */ React.createElement("div", { style: { position: "fixed", inset: 0, zIndex: 70, background: "var(--bg)", display: "flex", flexDirection: "column" } }, ctl.remoteStream && /* @__PURE__ */ React.createElement(AudioSink, { stream: ctl.remoteStream }), /* @__PURE__ */ React.createElement("div", { style: { height: 52, flexShrink: 0, display: "flex", alignItems: "center", gap: 10, padding: "0 18px", borderBottom: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement(Icon, { name: video ? "video" : "phone", size: 16, color: "var(--accent)", stroke: 2 }), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 13, fontWeight: 700, color: "var(--text)" } }, name), /* @__PURE__ */ React.createElement(Tag, { tone: connected ? "ok" : "warn" }, stateLabel), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), connected && /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 14, fontWeight: 700, color: "var(--text)", letterSpacing: 1 } }, mm, ":", ss)), video ? (() => {
5866
+ return /* @__PURE__ */ React.createElement("div", { style: { position: "fixed", inset: 0, zIndex: 70, background: "var(--bg)", display: "flex", flexDirection: "column" } }, ctl.remoteStream && /* @__PURE__ */ React.createElement(AudioSink, { stream: ctl.remoteStream }), /* @__PURE__ */ React.createElement("div", { style: { height: 52, flexShrink: 0, display: "flex", alignItems: "center", gap: 10, padding: "0 18px", borderBottom: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement(Icon, { name: video ? "video" : "phone", size: 16, color: "var(--accent)", stroke: 2 }), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 13, fontWeight: 700, color: "var(--text)" } }, name), /* @__PURE__ */ React.createElement(Tag, { tone: callStateTone(call.ended ? call.state : connected ? "connected" : call.state) }, stateLabel), noticeText && /* @__PURE__ */ React.createElement(Tag, { tone: "danger" }, noticeText), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), connected && /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 14, fontWeight: 700, color: "var(--text)", letterSpacing: 1 } }, mm, ":", ss)), video ? (() => {
5549
5867
  const tiles = [
5550
5868
  { key: "remote", stream: ctl.remoteStream, label: name, mirror: false },
5551
5869
  { key: "local", stream: ctl.localStream, label: ctl.sharing ? T && T.yourScreen || "Your screen" : T && T.you || "You", mirror: !ctl.sharing }
@@ -5595,7 +5913,7 @@ ${peer.address}`
5595
5913
  /* @__PURE__ */ React.createElement("span", { style: { position: "absolute", left: 6, bottom: 5, padding: "2px 6px", borderRadius: 6, background: "rgba(0,0,0,.6)", color: "#fff", fontSize: 10, fontFamily: "var(--mono)" } }, t.label)
5596
5914
  )))))
5597
5915
  );
5598
- })() : /* @__PURE__ */ React.createElement("div", { style: { flex: 1, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 22 } }, /* @__PURE__ */ React.createElement("div", { style: { position: "relative", display: "flex", alignItems: "center", justifyContent: "center" } }, !connected && /* @__PURE__ */ React.createElement("span", { style: { position: "absolute", width: 150, height: 150, borderRadius: 999, border: "2px solid var(--accent)", animation: "dkpulse 2s ease-out infinite" } }), /* @__PURE__ */ React.createElement(DkIdenticon, { seed: call.peerId, size: 108, radius: 26 })), /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 22, fontWeight: 700, color: "var(--text)" } }, name), /* @__PURE__ */ React.createElement("div", { style: { marginTop: 8, fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--faint)" } }, stateLabel)), /* @__PURE__ */ React.createElement("div", { style: { marginTop: 18 } }, controls)));
5916
+ })() : /* @__PURE__ */ React.createElement("div", { style: { flex: 1, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 22 } }, /* @__PURE__ */ React.createElement("div", { style: { position: "relative", display: "flex", alignItems: "center", justifyContent: "center" } }, !connected && !call.ended && /* @__PURE__ */ React.createElement("span", { style: { position: "absolute", width: 150, height: 150, borderRadius: 999, border: "2px solid var(--accent)", animation: "dkpulse 2s ease-out infinite" } }), /* @__PURE__ */ React.createElement(DkIdenticon, { seed: call.peerId, size: 108, radius: 26 })), /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 22, fontWeight: 700, color: "var(--text)" } }, name), /* @__PURE__ */ React.createElement("div", { style: { marginTop: 8, fontFamily: "var(--mono)", fontSize: call.ended ? 15 : 12.5, fontWeight: call.ended ? 700 : 400, color: call.ended ? "var(--danger)" : "var(--faint)" } }, stateLabel)), /* @__PURE__ */ React.createElement("div", { style: { marginTop: 18 } }, controls)));
5599
5917
  }
5600
5918
  Object.assign(window, { useCallController, CallOverlay, IncomingCallModal });
5601
5919
  function DkDirAvatar({ p, size }) {
@@ -6169,7 +6487,7 @@ ${peer.address}`
6169
6487
  const stuck = n.online && !n.reachable;
6170
6488
  const failed = n.status === "failed";
6171
6489
  const usable = n.reachable && featureOn !== false;
6172
- return /* @__PURE__ */ React.createElement("div", { key: n.ip, className: "dk-wrap", style: { display: "flex", alignItems: "center", gap: 12, rowGap: 6, padding: "10px 14px", borderBottom: i < region.nodes.length - 1 ? "1px solid var(--line)" : "none", background: active ? "color-mix(in oklab, var(--accent), transparent 92%)" : "transparent" } }, /* @__PURE__ */ React.createElement(StatusDot, { online: n.reachable }), /* @__PURE__ */ React.createElement(Mono, { size: 13, copy: n.ip }, n.ip), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)" } }, n.host), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), n.reachable ? /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: n.ping > 200 ? "var(--warn)" : "var(--dim)" } }, n.ping, "ms") : failed ? /* @__PURE__ */ React.createElement(Tag, { tone: "danger", title: "Failed 3 checks in a row \u2014 no longer checked automatically" }, T.exitFailed || "failed") : n.status === "unknown" ? /* @__PURE__ */ React.createElement(Tag, { tone: "off" }, T.exitNotChecked || "not checked") : stuck ? /* @__PURE__ */ React.createElement(Tag, { tone: "warn", title: "Announces online but IP won't pass \u2014 session desync or NAT-blocked" }, "online \xB7 no route") : n.status === "retrying" ? /* @__PURE__ */ React.createElement(Tag, { tone: "warn", title: "No answer \u2014 will try again shortly" }, T.exitRetrying || "retrying", " \xB7 ", n.fails, "/3") : /* @__PURE__ */ React.createElement(Tag, { tone: "off" }, "offline"), failed ? /* @__PURE__ */ React.createElement(ReconnectBtn, { T, ip: n.ip, onReconnect }) : active ? /* @__PURE__ */ React.createElement(Btn, { tone: "ok", icon: "check", size: "sm", onClick: () => onSetExit(null) }, T.routing) : /* @__PURE__ */ React.createElement(Btn, { size: "sm", icon: "route", disabled: !usable, onClick: () => usable && onSetExit(n.ip), style: { opacity: usable ? 1 : 0.4 } }, T.routeThru));
6490
+ return /* @__PURE__ */ React.createElement("div", { key: n.ip, className: "dk-wrap", style: { display: "flex", alignItems: "center", gap: 12, rowGap: 6, padding: "10px 14px", borderBottom: i < region.nodes.length - 1 ? "1px solid var(--line)" : "none", background: active ? "color-mix(in oklab, var(--accent), transparent 92%)" : "transparent" } }, /* @__PURE__ */ React.createElement(StatusDot, { online: n.reachable }), /* @__PURE__ */ React.createElement(Mono, { size: 13, copy: n.ip }, n.ip), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)" } }, n.host), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), n.reachable ? /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: n.ping > 200 ? "var(--warn)" : "var(--dim)" } }, n.ping, "ms") : failed ? /* @__PURE__ */ React.createElement(Tag, { tone: "danger", title: "Failed 3 checks in a row \u2014 no longer checked; Reconnect to try again" }, T.exitFailed || "failed") : n.status === "unknown" ? /* @__PURE__ */ React.createElement(Tag, { tone: "off" }, T.exitNotChecked || "not checked") : stuck ? /* @__PURE__ */ React.createElement(Tag, { tone: "warn", title: "Announces online but IP won't pass \u2014 session desync or NAT-blocked" }, "online \xB7 no route") : n.status === "down" ? /* @__PURE__ */ React.createElement(Tag, { tone: "warn", title: "No answer \u2014 checked again only when you open this panel or press Refresh; 3 in a row and it is no longer checked" }, T.exitDown || "down", " \xB7 ", n.fails, "/3") : /* @__PURE__ */ React.createElement(Tag, { tone: "off" }, "offline"), failed && onReconnect ? /* @__PURE__ */ React.createElement(ReconnectBtn, { T, ip: n.ip, onReconnect }) : active ? /* @__PURE__ */ React.createElement(Btn, { tone: "ok", icon: "check", size: "sm", onClick: () => onSetExit(null) }, T.routing) : /* @__PURE__ */ React.createElement(Btn, { size: "sm", icon: "route", disabled: !usable, onClick: () => usable && onSetExit(n.ip), style: { opacity: usable ? 1 : 0.4 } }, T.routeThru));
6173
6491
  })));
6174
6492
  }
6175
6493
  function LanEnableCard({ backend, onArm, onCancel }) {
@@ -6273,14 +6591,15 @@ ${peer.address}`
6273
6591
  "\u53D6\u6D88,\u6062\u590D\u6D88\u606F"
6274
6592
  )));
6275
6593
  }
6276
- function NetworkTab({ T, me, peers, exits, activeExit, exitFeature, routeFallback, onReconnectExit, reqCount, onSetExit, onOpenChat, backend, onArmLan, onCancelLan }) {
6277
- const featureOn = !exitFeature || exitFeature.available !== false;
6278
- const anyFailed = (exits || []).some((r) => (r.nodes || []).some((n) => n.status === "failed"));
6594
+ function NetworkTab({ T, me, peers, exits, activeExit, exitFeature, routeFallback, onReconnectExit, onRefreshExits, reqCount, onSetExit, onOpenChat, backend, onArmLan, onCancelLan }) {
6595
+ const ctl = exitControls({ exitFeature, routeFallback, exits });
6596
+ const featureOn = !ctl.noExitNotice;
6597
+ const anyFailed = ctl.anyFailed;
6279
6598
  if (backend && backend.switchable && !backend.hasVirtualLan) {
6280
6599
  return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, overflow: "auto", background: "var(--bg)" } }, /* @__PURE__ */ React.createElement("div", { className: "dk-page", style: { maxWidth: 1040, margin: "0 auto", padding: "24px 28px 60px", display: "flex", flexDirection: "column", gap: 26 } }, /* @__PURE__ */ React.createElement(MyNode, { T, me, activeExit, peers, reqCount }), /* @__PURE__ */ React.createElement(LanEnableCard, { backend, onArm: onArmLan, onCancel: onCancelLan })));
6281
6600
  }
6282
6601
  const lanless = !!backend && backend.hasVirtualLan === false;
6283
- return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, overflow: "auto", background: "var(--bg)" } }, /* @__PURE__ */ React.createElement("div", { className: "dk-page", style: { maxWidth: 1040, margin: "0 auto", padding: "24px 28px 60px", display: "flex", flexDirection: "column", gap: 26 } }, /* @__PURE__ */ React.createElement(MyNode, { T, me, activeExit, peers, reqCount }), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ React.createElement(Section, { label: T.peerRouting, count: peers.length }), /* @__PURE__ */ React.createElement(PeerTable, { T, peers, onOpenChat }), !peers.length && /* @__PURE__ */ React.createElement("div", { style: { padding: "14px 16px", borderRadius: 11, border: "1px dashed var(--line)", fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.noPeersYet || "No friends yet \u2014 add one from Chat and it shows up here with its route.")), lanless ? null : /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ React.createElement(Section, { label: T.exitNodes, trailing: /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 6 } }, anyFailed && onReconnectExit && /* @__PURE__ */ React.createElement(ReconnectBtn, { T, ip: null, onReconnect: onReconnectExit, label: T.exitReconnectAll || "Reconnect all" }), /* @__PURE__ */ React.createElement(Btn, { icon: "plus", size: "sm" }, T.addExit)) }), !featureOn && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "11px 14px", borderRadius: 10, background: "var(--panel-2)", border: "1px dashed var(--line)" } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12.5, fontWeight: 700, color: "var(--text)" } }, T.noExitAvailable || "No exit available \u2014 routing and proxy are off."), anyFailed && /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 12, color: "var(--dim)" } }, T.noExitHint || "Every exit failed 3 times and is no longer checked automatically. Press Reconnect to try one again.")), routeFallback && routeFallback.from && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10, padding: "11px 14px", borderRadius: 10, background: "color-mix(in oklab, var(--warn), transparent 90%)", border: "1px solid color-mix(in oklab, var(--warn), transparent 70%)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "route", size: 17, color: "var(--warn)", stroke: 2 }), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--text)" } }, T.routeFellBack || "Routing fell back to direct: every exit it used failed. Reconnect one to route through it again.")), activeExit && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10, padding: "11px 14px", borderRadius: 10, background: "color-mix(in oklab, var(--warn), transparent 90%)", border: "1px solid color-mix(in oklab, var(--warn), transparent 70%)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "route", size: 17, color: "var(--warn)", stroke: 2 }), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--text)" } }, T.egressVia), /* @__PURE__ */ React.createElement(Mono, { size: 13, copy: activeExit }, activeExit), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ React.createElement(Btn, { tone: "danger", icon: "unlink", size: "sm", onClick: () => onSetExit(null) }, T.stopRouting)), /* @__PURE__ */ React.createElement("div", { className: "dk-grid1", style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 12 } }, exits.map((r) => /* @__PURE__ */ React.createElement(ExitCard, { key: r.region, T, region: r, activeExit, onSetExit, onReconnect: onReconnectExit, featureOn }))))));
6602
+ return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, overflow: "auto", background: "var(--bg)" } }, /* @__PURE__ */ React.createElement("div", { className: "dk-page", style: { maxWidth: 1040, margin: "0 auto", padding: "24px 28px 60px", display: "flex", flexDirection: "column", gap: 26 } }, /* @__PURE__ */ React.createElement(MyNode, { T, me, activeExit, peers, reqCount }), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ React.createElement(Section, { label: T.peerRouting, count: peers.length }), /* @__PURE__ */ React.createElement(PeerTable, { T, peers, onOpenChat }), !peers.length && /* @__PURE__ */ React.createElement("div", { style: { padding: "14px 16px", borderRadius: 11, border: "1px dashed var(--line)", fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.noPeersYet || "No friends yet \u2014 add one from Chat and it shows up here with its route.")), lanless ? null : /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ React.createElement(Section, { label: T.exitNodes, trailing: /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 6 } }, ctl.refresh && onRefreshExits && /* @__PURE__ */ React.createElement(ReconnectBtn, { T, ip: null, onReconnect: () => onRefreshExits(), label: T.exitRefresh || "Refresh" }), ctl.reconnectAll && onReconnectExit && /* @__PURE__ */ React.createElement(ReconnectBtn, { T, ip: null, onReconnect: onReconnectExit, label: T.exitReconnectAll || "Reconnect all" }), /* @__PURE__ */ React.createElement(Btn, { icon: "plus", size: "sm" }, T.addExit)) }), ctl.noExitNotice && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "11px 14px", borderRadius: 10, background: "var(--panel-2)", border: "1px dashed var(--line)" } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12.5, fontWeight: 700, color: "var(--text)" } }, T.noExitAvailable || "No exit available \u2014 routing and proxy are off."), anyFailed && /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 12, color: "var(--dim)" } }, T.noExitHint || "Every exit failed 3 times and is no longer checked automatically. Press Reconnect to try one again.")), ctl.fallbackNotice && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10, padding: "11px 14px", borderRadius: 10, background: "color-mix(in oklab, var(--warn), transparent 90%)", border: "1px solid color-mix(in oklab, var(--warn), transparent 70%)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "route", size: 17, color: "var(--warn)", stroke: 2 }), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--text)" } }, T.routeFellBack || "Routing fell back to direct: every exit it used failed. Reconnect one to route through it again.")), activeExit && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10, padding: "11px 14px", borderRadius: 10, background: "color-mix(in oklab, var(--warn), transparent 90%)", border: "1px solid color-mix(in oklab, var(--warn), transparent 70%)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "route", size: 17, color: "var(--warn)", stroke: 2 }), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--text)" } }, T.egressVia), /* @__PURE__ */ React.createElement(Mono, { size: 13, copy: activeExit }, activeExit), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ React.createElement(Btn, { tone: "danger", icon: "unlink", size: "sm", onClick: () => onSetExit(null) }, T.stopRouting)), /* @__PURE__ */ React.createElement("div", { className: "dk-grid1", style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 12 } }, exits.map((r) => /* @__PURE__ */ React.createElement(ExitCard, { key: r.region, T, region: r, activeExit, onSetExit, onReconnect: ctl.reconnect ? onReconnectExit : null, featureOn }))))));
6284
6603
  }
6285
6604
  Object.assign(window, { NetworkTab });
6286
6605
  var dkAudioCtx = null;
@@ -6697,9 +7016,10 @@ ${peer.address}`
6697
7016
  exitReconnectAll: "Reconnect all",
6698
7017
  exitChecking: "checking\u2026",
6699
7018
  exitNotChecked: "not checked",
6700
- exitRetrying: "retrying",
7019
+ exitDown: "down",
7020
+ exitRefresh: "Refresh",
6701
7021
  noExitAvailable: "No exit available \u2014 routing and proxy are off.",
6702
- noExitHint: "Every exit failed 3 times and is no longer checked automatically. Press Reconnect to try one again.",
7022
+ noExitHint: "Every exit failed 3 checks in a row and is no longer checked. Press Reconnect to try one again.",
6703
7023
  routeFellBack: "Routing fell back to direct: every exit it used failed. Reconnect one to route through it again.",
6704
7024
  identity: "Identity",
6705
7025
  userId: "user id",
@@ -6798,6 +7118,21 @@ ${peer.address}`
6798
7118
  audioOnly: "audio",
6799
7119
  endCall: "end",
6800
7120
  you: "you",
7121
+ calling: "calling\u2026",
7122
+ remoteRinging: "ringing\u2026",
7123
+ connecting: "connecting\u2026",
7124
+ reconnecting: "reconnecting\u2026",
7125
+ noAnswer: "No answer",
7126
+ cantReach: "Can't reach {name}",
7127
+ callFailed: "Call failed",
7128
+ busy: "Busy",
7129
+ declined: "Declined",
7130
+ joinGroup: "Join group",
7131
+ cardIsFriend: "Already in your chats.",
7132
+ cardNoEns: "No beagles.eth name registered.",
7133
+ voiceMessage: "Voice message",
7134
+ groupFileNotDelivered: "Not delivered to this device: the group sends agents only a description of files.",
7135
+ shareFailed: "Screen share failed",
6801
7136
  meeting: "Meeting",
6802
7137
  meetingRooms: "Meeting rooms",
6803
7138
  nextVersion: "next version",
@@ -6908,9 +7243,10 @@ ${peer.address}`
6908
7243
  exitReconnectAll: "\u5168\u90E8\u91CD\u8FDE",
6909
7244
  exitChecking: "\u68C0\u6D4B\u4E2D\u2026",
6910
7245
  exitNotChecked: "\u672A\u68C0\u6D4B",
6911
- exitRetrying: "\u91CD\u8BD5\u4E2D",
7246
+ exitDown: "\u4E0D\u901A",
7247
+ exitRefresh: "\u5237\u65B0",
6912
7248
  noExitAvailable: "\u6CA1\u6709\u53EF\u7528\u7684\u51FA\u53E3 \u2014\u2014 \u8DEF\u7531\u548C\u4EE3\u7406\u5DF2\u5173\u95ED\u3002",
6913
- noExitHint: "\u6240\u6709\u51FA\u53E3\u90FD\u8FDE\u7EED\u5931\u8D25 3 \u6B21,\u5DF2\u4E0D\u518D\u81EA\u52A8\u68C0\u6D4B\u3002\u70B9\u300C\u91CD\u65B0\u8FDE\u63A5\u300D\u518D\u8BD5\u4E00\u6B21\u3002",
7249
+ noExitHint: "\u6240\u6709\u51FA\u53E3\u90FD\u8FDE\u7EED 3 \u6B21\u68C0\u6D4B\u5931\u8D25,\u5DF2\u4E0D\u518D\u68C0\u6D4B\u3002\u70B9\u300C\u91CD\u65B0\u8FDE\u63A5\u300D\u518D\u8BD5\u4E00\u6B21\u3002",
6914
7250
  routeFellBack: "\u8DEF\u7531\u5DF2\u6539\u56DE\u76F4\u8FDE:\u5B83\u4F7F\u7528\u7684\u51FA\u53E3\u5168\u90E8\u5931\u8D25\u3002\u91CD\u65B0\u8FDE\u63A5\u5176\u4E2D\u4E00\u4E2A\u5373\u53EF\u6062\u590D\u3002",
6915
7251
  identity: "\u8EAB\u4EFD",
6916
7252
  userId: "\u7528\u6237 ID",
@@ -7009,6 +7345,21 @@ ${peer.address}`
7009
7345
  audioOnly: "\u8BED\u97F3",
7010
7346
  endCall: "\u6302\u65AD",
7011
7347
  you: "\u6211",
7348
+ calling: "\u547C\u53EB\u4E2D\u2026",
7349
+ remoteRinging: "\u5BF9\u65B9\u54CD\u94C3\u4E2D\u2026",
7350
+ connecting: "\u8FDE\u63A5\u4E2D\u2026",
7351
+ reconnecting: "\u91CD\u65B0\u8FDE\u63A5\u4E2D\u2026",
7352
+ noAnswer: "\u65E0\u4EBA\u63A5\u542C",
7353
+ cantReach: "\u65E0\u6CD5\u8054\u7CFB {name}",
7354
+ callFailed: "\u901A\u8BDD\u5931\u8D25",
7355
+ busy: "\u5BF9\u65B9\u5FD9",
7356
+ declined: "\u5BF9\u65B9\u5DF2\u62D2\u7EDD",
7357
+ joinGroup: "\u52A0\u5165\u7FA4",
7358
+ cardIsFriend: "\u5DF2\u5728\u4F60\u7684\u4F1A\u8BDD\u91CC\u3002",
7359
+ cardNoEns: "\u5BF9\u65B9\u8FD8\u6CA1\u6709\u6CE8\u518C beagles.eth \u540D\u5B57\u3002",
7360
+ voiceMessage: "\u8BED\u97F3\u6D88\u606F",
7361
+ groupFileNotDelivered: "\u672A\u9001\u8FBE\u672C\u8BBE\u5907\uFF1A\u7FA4\u7EC4\u53EA\u5411\u4EE3\u7406\u53D1\u9001\u6587\u4EF6\u8BF4\u660E\uFF0C\u4E0D\u542B\u6587\u4EF6\u5185\u5BB9\u3002",
7362
+ shareFailed: "\u5C4F\u5E55\u5171\u4EAB\u5931\u8D25",
7012
7363
  meeting: "\u4F1A\u8BAE",
7013
7364
  meetingRooms: "\u4F1A\u8BAE\u623F\u95F4",
7014
7365
  nextVersion: "\u4E0B\u4E2A\u7248\u672C",
@@ -7573,6 +7924,10 @@ ${peer.address}`
7573
7924
  data.refresh();
7574
7925
  return r;
7575
7926
  });
7927
+ const onRefreshExits = () => dkApi.refreshExits().then((r) => {
7928
+ data.refresh();
7929
+ return r;
7930
+ });
7576
7931
  const onOpenChat = (id) => {
7577
7932
  setTab("chat");
7578
7933
  openConversation(id);
@@ -7652,7 +8007,7 @@ ${peer.address}`
7652
8007
  fontWeight: 600,
7653
8008
  background: tab === n.id ? "var(--accent)" : "transparent",
7654
8009
  color: tab === n.id ? "#fff" : "var(--dim)"
7655
- } }, /* @__PURE__ */ React.createElement(Icon, { name: n.icon, size: 14, stroke: 2, color: tab === n.id ? "#fff" : "var(--dim)" }), n.label))), tab === "chat" && /* @__PURE__ */ React.createElement(ChatTab, { T, lang: t.lang, phone, isProtocol, protocolFix, onBack: closeConversation, peers, requests, activeId, thread: activeId === ASSISTANT_ID ? assistant.thread : data.threads[activeId], onSelect, onAct, onAdd, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread: () => activeId && data.loadThread(activeId), hasEarlier: !!(activeId && activeId !== ASSISTANT_ID && data.earlier[activeId]), onAssistantRemove: activeId === ASSISTANT_ID ? assistant.removeFriends : null, onAssistantAdopt: activeId === ASSISTANT_ID ? assistant.adoptServicePeers : null, onLoadEarlier: () => activeId && data.loadEarlier(activeId), prefillAddr: pendingAddr, onPrefillConsumed: () => setPendingAddr(""), muted: mutedIds, onToggleMute }), tab === "here" && /* @__PURE__ */ React.createElement(DiscoverTab, { T, kind: "bridge", peers, meId: me.userId, onAdd, onOpenChat }), tab === "recommended" && /* @__PURE__ */ React.createElement(DiscoverTab, { T, kind: "recommended", peers, meId: me.userId, onAdd, onOpenChat }), tab === "registered" && /* @__PURE__ */ React.createElement(DiscoverTab, { T, kind: "registered", peers, meId: me.userId, onAdd, onOpenChat }), tab === "network" && /* @__PURE__ */ React.createElement(NetworkTab, { T, me, peers, exits, activeExit, exitFeature: data.exitFeature, routeFallback: data.routeFallback, onReconnectExit, reqCount: requests.length, onSetExit, onOpenChat, backend, onArmLan: armLan, onCancelLan: cancelLan }), tab === "apps" && /* @__PURE__ */ React.createElement(AppsTab, { T, t, me, peers, phone, setTab }), tabs.map((x) => x.kind === "host" && tab === x.id ? /* @__PURE__ */ React.createElement(HostTabPane, { key: x.id, tab: x, props: { T, t, me, peers, phone, setTab }, lang: t.lang }) : null), tab === "profile" && /* @__PURE__ */ React.createElement(
8010
+ } }, /* @__PURE__ */ React.createElement(Icon, { name: n.icon, size: 14, stroke: 2, color: tab === n.id ? "#fff" : "var(--dim)" }), n.label))), tab === "chat" && /* @__PURE__ */ React.createElement(ChatTab, { T, lang: t.lang, phone, isProtocol, protocolFix, onBack: closeConversation, peers, requests, activeId, thread: activeId === ASSISTANT_ID ? assistant.thread : data.threads[activeId], onSelect, onAct, onAdd, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread: () => activeId && data.loadThread(activeId), hasEarlier: !!(activeId && activeId !== ASSISTANT_ID && data.earlier[activeId]), onAssistantRemove: activeId === ASSISTANT_ID ? assistant.removeFriends : null, onAssistantAdopt: activeId === ASSISTANT_ID ? assistant.adoptServicePeers : null, onLoadEarlier: () => activeId && data.loadEarlier(activeId), prefillAddr: pendingAddr, onPrefillConsumed: () => setPendingAddr(""), muted: mutedIds, onToggleMute }), tab === "here" && /* @__PURE__ */ React.createElement(DiscoverTab, { T, kind: "bridge", peers, meId: me.userId, onAdd, onOpenChat }), tab === "recommended" && /* @__PURE__ */ React.createElement(DiscoverTab, { T, kind: "recommended", peers, meId: me.userId, onAdd, onOpenChat }), tab === "registered" && /* @__PURE__ */ React.createElement(DiscoverTab, { T, kind: "registered", peers, meId: me.userId, onAdd, onOpenChat }), tab === "network" && /* @__PURE__ */ React.createElement(NetworkTab, { T, me, peers, exits, activeExit, exitFeature: data.exitFeature, routeFallback: data.routeFallback, onReconnectExit, onRefreshExits, reqCount: requests.length, onSetExit, onOpenChat, backend, onArmLan: armLan, onCancelLan: cancelLan }), tab === "apps" && /* @__PURE__ */ React.createElement(AppsTab, { T, t, me, peers, phone, setTab }), tabs.map((x) => x.kind === "host" && tab === x.id ? /* @__PURE__ */ React.createElement(HostTabPane, { key: x.id, tab: x, props: { T, t, me, peers, phone, setTab }, lang: t.lang }) : null), tab === "profile" && /* @__PURE__ */ React.createElement(
7656
8011
  ProfileTab,
7657
8012
  {
7658
8013
  T,