@celljs/ta-rooms 4.16.0 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/web/index.js CHANGED
@@ -161,6 +161,16 @@ var RelayIdentityUtil;
161
161
  // ../ta-relay/esm/common/relay-protocol.js
162
162
  var RELAY_FRAME_CSP = "default-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' https: data: blob:; style-src 'unsafe-inline' https: data:; img-src https: data: blob:; font-src https: data:; media-src https: data: blob:; connect-src 'none'; form-action 'none'";
163
163
  var RELAY_FRAME_HEADER_CSP = `${RELAY_FRAME_CSP}; frame-ancestors 'self'; sandbox allow-scripts allow-popups allow-popups-to-escape-sandbox`;
164
+ var OPEN_IN_TA = `<p><a id="open" style="display:inline-block;padding:10px 18px;border-radius:20px;background:#111;color:#fff;text-decoration:none;font-weight:600">Open in Ta · 在 Ta 中打开</a></p>
165
+ <script>document.getElementById('open').href='ta://open?link='+encodeURIComponent(location.href)</script>`;
166
+ var RELAY_PAIR_PAGE = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Ta</title>
167
+ <body style="font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em">
168
+ <h1>Ta</h1><p>Open this link in the Ta app, or paste it there, to reach your Ta from this device.</p>
169
+ <p>打开 Ta 应用,粘贴这个链接,就能从这台设备连到你的 Ta。</p>${OPEN_IN_TA}</body>`;
170
+ var RELAY_SHARE_PAGE = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Ta</title>
171
+ <body style="font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em">
172
+ <h1>Ta</h1><p>Someone shared an extension of Ta. Scan the code in the Ta app, or paste this link in its Quick open, to open it.</p>
173
+ <p>有人分享了一个 Ta 扩展。在 Ta 应用里扫码,或把这个链接粘贴到“快捷打开”,就能打开它。</p>${OPEN_IN_TA}</body>`;
164
174
  var RELAY_SHARE_MAX_BYTES = 8 * 1024 * 1024;
165
175
  var RELAY_SHARE_CHUNK_BYTES = 192 * 1024;
166
176
  var RELAY_CONTENT_MAX_BYTES = 8 * 1024 * 1024;
@@ -331,6 +341,28 @@ ${d}`, s)) {
331
341
  RelayHubUtil2.openAnswer = openAnswer;
332
342
  })(RelayHubUtil || (RelayHubUtil = {}));
333
343
 
344
+ // ../ta-web/esm/browser/extension/share-sheet-compat.js
345
+ function ShareSheetCompat({ pi, ...props }) {
346
+ const h = pi.React.createElement;
347
+ if (pi.ui.ShareSheet) {
348
+ return h(pi.ui.ShareSheet, props);
349
+ }
350
+ const { title, link, error, name, gets, notes, password, own, onClose, children } = props;
351
+ const quiet = { margin: 0, opacity: 0.7, textAlign: "center" };
352
+ return h(pi.ui.Dialog, { title, onClose }, h("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: 12 } }, error !== undefined ? h("p", { role: "alert" }, error) : [
353
+ name || gets ? h("p", { key: "who", style: { margin: 0, textAlign: "center" } }, [name, gets].filter(Boolean).join(" · ")) : null,
354
+ link && !own ? h(pi.ui.QrCode, { key: "qr", text: link, label: name || title }) : null,
355
+ h("code", { key: "link", style: { maxWidth: "100%", overflowWrap: "anywhere", userSelect: "all" } }, link !== null && link !== undefined ? link : "…"),
356
+ password ? h("code", { key: "password", style: { userSelect: "all" } }, password) : null,
357
+ link ? h("button", { key: "copy", type: "button", className: "ta-button ta-primary", onClick: () => {
358
+ var _a;
359
+ return void ((_a = navigator.clipboard) === null || _a === undefined ? undefined : _a.writeText(link));
360
+ } }, "Copy") : null,
361
+ children,
362
+ ...(notes !== null && notes !== undefined ? notes : []).filter(Boolean).map((line) => h("p", { key: String(line), style: quiet }, line))
363
+ ]));
364
+ }
365
+
334
366
  // ../ta-protocol/esm/common/language.js
335
367
  var TaLanguageUtil;
336
368
  (function(TaLanguageUtil2) {
@@ -727,10 +759,18 @@ var GRANT_HOURS = [1, 24, 24 * 7];
727
759
 
728
760
  // web-src/i18n.ts
729
761
  var EN = {
730
- roomsTitle: "Rooms",
762
+ friendShareTitle: "From {name}",
763
+ friendShareLine: "{name} sent you this",
764
+ friendShareRow: "[Link] {title}",
765
+ friendShareNote: "It opens as any link of Ta: Ta asks you before it adds, joins or imports anything.",
766
+ friendShareOpen: "Open",
767
+ friendShareDelete: "Delete",
768
+ myCodeGets: "They ask to be your friend; you are friends once you both agree",
769
+ inviteGets: "They ask to join; you let them in",
770
+ roomsTitle: "Group chats",
731
771
  add: "New",
732
- me: "Your name in rooms",
733
- meLine: "In rooms you are “{name}”",
772
+ me: "Your name in group chats",
773
+ meLine: "In group chats you are “{name}”",
734
774
  rename: "Change",
735
775
  renamePlaceholder: "What others see",
736
776
  requests: "Asking to join",
@@ -741,14 +781,14 @@ var EN = {
741
781
  requestGuest: "They ask from a browser, without Ta: let in, they only chat.",
742
782
  accept: "Let in",
743
783
  refuse: "Refuse",
744
- requestBody: "{name} wants to join your room “{title}”.",
745
- requestsBody: "{n} people ask to join your rooms.",
784
+ requestBody: "{name} wants to join your group chat “{title}”.",
785
+ requestsBody: "{n} people ask to join your group chats.",
746
786
  requestFriend: "They are your friend.",
747
787
  requestNew: "They are not your friend: let in only someone you know.",
748
- requestWhat: "Once in, they see the messages and the shared state of the room: in a game, where everyone is and what is built.",
788
+ requestWhat: "Once in, they see the messages and the shared state of the group chat: in a game, where everyone is and what is built.",
749
789
  later: "Later",
750
- ownRoom: "Your room",
751
- roomOf: "A room of {name}",
790
+ ownRoom: "Your group chat",
791
+ roomOf: "A group chat of {name}",
752
792
  people: "{n} people · {online} online",
753
793
  othersOnline: "{n} more online",
754
794
  nobodyOnline: "Nobody else online",
@@ -764,18 +804,12 @@ var EN = {
764
804
  inviteLine: "A link or a QR code; you let them in",
765
805
  inviteTitle: "Invite into “{title}”",
766
806
  inviteHint: "Send the link: opened in a browser, it asks to chat as a web guest; in the Ta app (scan or paste), to join with Ta. You let in who asks; the link works for 7 days, and a new one stops it.",
767
- newLink: "New link",
768
- making: "Making the link…",
769
- copy: "Copy link",
770
- copied: "Copied",
771
- send: "Send…",
772
- qr: "QR code of the invitation",
773
807
  members: "Members",
774
808
  memberCount: "{n} members",
775
809
  onlineCount: "{n} online",
776
- membersTitle: "Members of the room",
810
+ membersTitle: "About the group chat",
777
811
  membersCount: "{n} members · {online} online",
778
- noRoomOpen: "Open a room to see who is in it",
812
+ noRoomOpen: "Open a group chat to see who is in it",
779
813
  you: "You",
780
814
  owner: "Owner",
781
815
  online: "Online",
@@ -783,12 +817,12 @@ var EN = {
783
817
  remove: "Take out",
784
818
  removeTitle: "Take {name} out of “{title}”?",
785
819
  removeHint: "They are disconnected at once, and come back only by a new invitation.",
786
- leave: "Leave the room",
820
+ leave: "Leave the group chat",
787
821
  leaveTitle: "Leave “{title}”?",
788
822
  leaveHint: "You come back only by a new invitation.",
789
- close: "Close the room",
823
+ close: "Close the group chat",
790
824
  closeTitle: "Close “{title}” for everyone?",
791
- closeHint: "Everyone is taken out, and the relay deletes all the room kept.",
825
+ closeHint: "Everyone is taken out, and the relay deletes all the group chat kept.",
792
826
  forget: "Remove",
793
827
  friends: "Friends",
794
828
  friendsCount: "{n}",
@@ -798,7 +832,6 @@ var EN = {
798
832
  removeFriendTitle: "Remove {name} from your friends?",
799
833
  removeFriendHint: "You are no longer friends on both sides: neither sees the other’s posts, nor what is shared with friends. The rooms you share stay as they are.",
800
834
  addFriend: "Add friend",
801
- addFriendHint: "Let them scan this code, or send them the link. Once you both agree, you are friends: you see each other’s posts and may share with each other.",
802
835
  addFriendExpires: "Works for {days} more days",
803
836
  addFriendAction: "Add as friend",
804
837
  addFriendBody: "Ask {name} to be your friend? They see your name and answer in their Ta. Once both agree, you see each other’s posts and may share with each other.",
@@ -813,43 +846,70 @@ var EN = {
813
846
  friendAccept: "Agree",
814
847
  friendRequestNote: "Once friends, you see each other’s posts, and they may share with you. Agree only to someone you know.",
815
848
  friendsEmpty: "No friends yet",
816
- friendsEmptyHint: "Add a friend by a code or a link, or from the members of a room you are both in.",
817
- scanFriend: "Scan",
818
- pasteFriend: "Paste a link",
819
- emptyTitle: "No rooms yet",
849
+ friendsEmptyHint: "Add a friend by a code or a link, or from the members of a group chat you are both in.",
850
+ myCode: "My QR code",
851
+ addFriendPaste: "Paste a link someone sent you",
852
+ addFriendOpen: "Open",
853
+ addFriendScan: "The QR code of a friend or a group chat",
854
+ addFriendNearby: "Add those beside you, or make a group chat with them",
855
+ addFriendInGroup: "In a group chat, its members can be added as friends too. A link to a group chat pasted above joins it.",
856
+ emptyTitle: "No group chats yet",
820
857
  emptyListHint: "Make one with +, or open a link of invitation",
821
- pickRoom: "Pick a room to chat in",
858
+ pickRoom: "Pick a group chat to chat in",
822
859
  joinTitle: "Join “{title}”?",
823
- joinBody: "A room of {by}. They let you in first, and your name “{name}” goes to them.",
860
+ joinBody: "A group chat of {by}. They let you in first, and your name “{name}” goes to them.",
824
861
  joinAction: "Ask to join",
825
862
  joinByLink: "Join by a link",
826
863
  joinByLinkPlaceholder: "Paste the link of the invitation",
827
864
  scan: "Scan a code",
828
- scanHint: "Scan the QR code of an invitation",
829
- notInvite: "That is not a link that invites into a room.",
865
+ scanHint: "Scan the QR code of a friend or a group chat",
866
+ notInvite: "That is not a link of Ta.",
830
867
  asked: "Asked {by}: you are in once they let you in.",
831
868
  admitted: "You are in “{title}”.",
832
869
  refusedNotice: "{by} did not let you into “{title}”.",
833
870
  removedNotice: "You were taken out of “{title}”.",
834
871
  closedNotice: "“{title}” was closed by its owner.",
835
- oldApp: "Update the Ta app to use rooms.",
836
- room: "Room",
837
- newRoom: "New room",
872
+ oldApp: "Update the Ta app to use group chats.",
873
+ room: "Group chat",
874
+ newRoom: "New group chat",
838
875
  newRoomPlaceholder: "Its name, which those you invite see",
839
- roomOfName: "{name}’s room",
876
+ roomOfName: "{name}’s group chat",
840
877
  back: "Back",
841
878
  openPage: "Open {name}",
842
- pageLine: "A room of {name}: play in it together",
843
- chatEmpty: "Nothing said yet. Only those in the room read it: the relay keeps it sealed.",
879
+ apps: "Apps of the group chat",
880
+ pageLine: "A group chat of {name}: play in it together",
881
+ chatEmpty: "Nothing said yet. Only those in the group chat read it: the relay keeps it sealed.",
844
882
  chatPlaceholder: "Message",
845
- showOnHome: "Show rooms on the double's home",
846
- showOnHomeHint: "With rooms, the double's home has a Rooms section, beside members and channels."
883
+ showOnHome: "Show group chats on the double's home",
884
+ showOnHomeHint: "With group chats, the double's home has a Group chats section, beside members and channels.",
885
+ friendsDetail: "{n} friends",
886
+ friendsAsking: "{n} asking to be your friend",
887
+ inviteFriends: "Invite friends",
888
+ inviteFriendsLine: "They find it in their Ta, and are in once they join",
889
+ inviteFriendsTitle: "Invite friends into “{title}”",
890
+ inviteFriendsLead: "Each friend you tap finds the group chat in their Ta: once they join, they are in, without your saying yes again.",
891
+ inviteFriendsNone: "All your friends are in, or you have none yet",
892
+ inviteFriendsOld: "Update Ta on this computer to invite friends",
893
+ invitedFriend: "Invited",
894
+ groupInviteTitle: "Invited to a group chat",
895
+ groupInviteLine: "{name} invites you",
896
+ groupInviteNote: "Once in, you see what is said in it, and its members see you. You may leave any time.",
897
+ groupInviteIgnore: "Ignore",
898
+ groupInviteJoin: "Join"
847
899
  };
848
900
  var ZH = {
849
- roomsTitle: "房间",
901
+ friendShareTitle: "{name} 发来的",
902
+ friendShareLine: "{name} 发给你",
903
+ friendShareRow: "[链接] {title}",
904
+ friendShareNote: "打开后和任何 Ta 链接一样:添加、加入、导入之前 Ta 都会先问你。",
905
+ friendShareOpen: "打开",
906
+ friendShareDelete: "删除",
907
+ myCodeGets: "对方申请加你为好友,双方同意后成为好友",
908
+ inviteGets: "对方申请加入,你同意后进群",
909
+ roomsTitle: "群聊",
850
910
  add: "新建",
851
- me: "我在房间里的名字",
852
- meLine: "你在房间里叫「{name}」",
911
+ me: "我在群里的名字",
912
+ meLine: "你在群里叫「{name}」",
853
913
  rename: "修改",
854
914
  renamePlaceholder: "别人看到的名字",
855
915
  requests: "加入申请",
@@ -860,14 +920,14 @@ var ZH = {
860
920
  requestGuest: "对方是用浏览器申请的,没有装 Ta:进来后只能聊天。",
861
921
  accept: "同意",
862
922
  refuse: "拒绝",
863
- requestBody: "「{name}」想加入你的房间「{title}」。",
864
- requestsBody: "有 {n} 人申请加入你的房间。",
923
+ requestBody: "「{name}」想加入你的群聊「{title}」。",
924
+ requestsBody: "有 {n} 人申请加入你的群聊。",
865
925
  requestFriend: "对方是你的好友。",
866
926
  requestNew: "对方不是你的好友:只让认识的人进来。",
867
- requestWhat: "进来后,对方能看到房间里的消息和共享的内容;在游戏里就是大家的位置和搭的东西。",
927
+ requestWhat: "进来后,对方能看到群里的消息和共享的内容;在游戏里就是大家的位置和搭的东西。",
868
928
  later: "稍后",
869
- ownRoom: "我建的房间",
870
- roomOf: "{name}的房间",
929
+ ownRoom: "我建的群聊",
930
+ roomOf: "{name}的群聊",
871
931
  people: "{n} 人 · {online} 人在线",
872
932
  othersOnline: "另有 {n} 人在线",
873
933
  nobodyOnline: "其他人都不在线",
@@ -875,7 +935,7 @@ var ZH = {
875
935
  yesterday: "昨天",
876
936
  waiting: "等{name}同意",
877
937
  refused: "{name}没有同意",
878
- closed: "房主已解散",
938
+ closed: "群主已解散",
879
939
  removed: "你已被移出",
880
940
  inviteGone: "邀请已失效",
881
941
  connecting: "连接中…",
@@ -883,31 +943,25 @@ var ZH = {
883
943
  inviteLine: "发链接或二维码,由你同意进入",
884
944
  inviteTitle: "邀请加入「{title}」",
885
945
  inviteHint: "把链接发给对方:在浏览器里打开,可以作为网页访客申请聊天;在 Ta 应用里扫码或粘贴,就用 Ta 加入。都要你同意;链接 7 天内有效,换新链接后旧的作废。",
886
- newLink: "换一个链接",
887
- making: "正在生成链接…",
888
- copy: "复制链接",
889
- copied: "已复制",
890
- send: "发送…",
891
- qr: "邀请二维码",
892
946
  members: "成员",
893
947
  memberCount: "{n} 位成员",
894
948
  onlineCount: "{n} 人在线",
895
- membersTitle: "房间成员",
949
+ membersTitle: "群聊信息",
896
950
  membersCount: "{n} 位成员 · {online} 人在线",
897
- noRoomOpen: "打开一个房间,这里显示它的成员",
951
+ noRoomOpen: "打开一个群聊,这里显示它的成员",
898
952
  you: "我",
899
- owner: "房主",
953
+ owner: "群主",
900
954
  online: "在线",
901
955
  offline: "离线",
902
956
  remove: "移出",
903
957
  removeTitle: "把「{name}」移出「{title}」?",
904
958
  removeHint: "对方会立刻断开,只有新的邀请才能再进来。",
905
- leave: "退出房间",
959
+ leave: "退出群聊",
906
960
  leaveTitle: "退出「{title}」?",
907
961
  leaveHint: "退出后要有新的邀请才能再进来。",
908
- close: "解散房间",
962
+ close: "解散群聊",
909
963
  closeTitle: "解散「{title}」?",
910
- closeHint: "所有人都会被移出,中继会删除房间保存的全部内容。",
964
+ closeHint: "所有人都会被移出,中继会删除群聊保存的全部内容。",
911
965
  forget: "删除",
912
966
  friends: "好友",
913
967
  friendsCount: "{n} 位",
@@ -915,9 +969,8 @@ var ZH = {
915
969
  friendAdding: "等对方同意",
916
970
  removeFriend: "删除",
917
971
  removeFriendTitle: "删除好友「{name}」?",
918
- removeFriendHint: "两边同时不再是好友:互相看不到动态,也收不到只给好友的分享。一起所在的房间不受影响。",
972
+ removeFriendHint: "两边同时不再是好友:互相看不到动态,也收不到只给好友的分享。一起所在的群聊不受影响。",
919
973
  addFriend: "加好友",
920
- addFriendHint: "让对方扫这个码,或把链接发给对方。双方都同意后就是好友:互相看到动态,也能互相分享。",
921
974
  addFriendExpires: "还能用 {days} 天",
922
975
  addFriendAction: "加为好友",
923
976
  addFriendBody: "请「{name}」加你为好友?对方会看到你的名字,在自己的 Ta 里同意。双方同意后互相看到动态,也能互相分享。",
@@ -932,43 +985,70 @@ var ZH = {
932
985
  friendAccept: "同意",
933
986
  friendRequestNote: "成为好友后互相看到动态,对方也能给你分享东西。只同意认识的人。",
934
987
  friendsEmpty: "还没有好友",
935
- friendsEmptyHint: "用二维码或链接加好友,也可以在一起所在房间的成员里加。",
936
- scanFriend: "扫一扫",
937
- pasteFriend: "粘贴链接",
938
- emptyTitle: "还没有房间",
988
+ friendsEmptyHint: "用二维码或链接加好友,也可以在一起所在群聊的成员里加。",
989
+ myCode: "我的二维码",
990
+ addFriendPaste: "粘贴别人发来的链接",
991
+ addFriendOpen: "打开",
992
+ addFriendScan: "扫好友或群聊的二维码",
993
+ addFriendNearby: "加身边的人为好友,或一起建群聊",
994
+ addFriendInGroup: "在群聊的成员里也能加好友。群聊的邀请链接粘贴到上面,就能申请加入。",
995
+ emptyTitle: "还没有群聊",
939
996
  emptyListHint: "点 + 新建一个,或打开别人发来的邀请链接",
940
- pickRoom: "选一个房间开始聊天",
997
+ pickRoom: "选一个群聊开始聊天",
941
998
  joinTitle: "加入「{title}」?",
942
- joinBody: "这是{by}的房间。房主同意后你才能进去,你的名字「{name}」会发给对方。",
999
+ joinBody: "这是{by}的群聊。群主同意后你才能进去,你的名字「{name}」会发给对方。",
943
1000
  joinAction: "申请加入",
944
1001
  joinByLink: "用邀请链接加入",
945
1002
  joinByLinkPlaceholder: "粘贴别人发来的邀请链接",
946
1003
  scan: "扫一扫",
947
- scanHint: "扫描房间的邀请二维码",
948
- notInvite: "这不是房间的邀请链接。",
1004
+ scanHint: "扫好友或群聊的二维码",
1005
+ notInvite: "这不是 Ta 的链接。",
949
1006
  asked: "已向{by}发出申请,对方同意后就能进入。",
950
1007
  admitted: "已加入「{title}」。",
951
1008
  refusedNotice: "{by}没有同意你加入「{title}」。",
952
1009
  removedNotice: "你已被移出「{title}」。",
953
- closedNotice: "「{title}」已被房主解散。",
954
- oldApp: "请更新 Ta 应用后再使用房间。",
955
- room: "房间",
956
- newRoom: "新建房间",
957
- newRoomPlaceholder: "房间名,受邀的人能看到",
958
- roomOfName: "{name}的房间",
1010
+ closedNotice: "「{title}」已被群主解散。",
1011
+ oldApp: "请更新 Ta 应用后再使用群聊。",
1012
+ room: "群聊",
1013
+ newRoom: "新建群聊",
1014
+ newRoomPlaceholder: "群聊名,受邀的人能看到",
1015
+ roomOfName: "{name}的群聊",
959
1016
  back: "返回",
960
1017
  openPage: "打开{name}",
961
- pageLine: "{name}的房间,大家可以一起玩",
962
- chatEmpty: "还没有人说话。只有房间里的人能看到,中继保存的是密文。",
1018
+ apps: "群聊应用",
1019
+ pageLine: "{name}的群聊,大家可以一起玩",
1020
+ chatEmpty: "还没有人说话。只有群里的人能看到,中继保存的是密文。",
963
1021
  chatPlaceholder: "发消息",
964
- showOnHome: "在分身首页显示房间",
965
- showOnHomeHint: "有房间时,分身首页多一个“房间”分类,和成员、频道放在一起。"
1022
+ showOnHome: "在分身首页显示群聊",
1023
+ showOnHomeHint: "有群聊时,分身首页多一个“群聊”分类,和成员、频道放在一起。",
1024
+ friendsDetail: "{n} 位好友",
1025
+ friendsAsking: "{n} 个新的好友申请",
1026
+ inviteFriends: "邀请好友",
1027
+ inviteFriendsLine: "对方在自己的 Ta 里看到,点加入就进来",
1028
+ inviteFriendsTitle: "邀请好友进「{title}」",
1029
+ inviteFriendsLead: "点一位好友,对方就会在自己的 Ta 里看到这个群聊;对方点加入就直接进来,不用你再同意。",
1030
+ inviteFriendsNone: "好友都在群里了,或者还没有好友",
1031
+ inviteFriendsOld: "先把这台电脑上的 Ta 更新到新版,才能邀请好友",
1032
+ invitedFriend: "已邀请",
1033
+ groupInviteTitle: "群聊邀请",
1034
+ groupInviteLine: "{name} 邀请你加入",
1035
+ groupInviteNote: "进来后能看到群里的聊天,群成员也能看到你。随时可以退出。",
1036
+ groupInviteIgnore: "忽略",
1037
+ groupInviteJoin: "加入"
966
1038
  };
967
1039
  var ZH_TW = {
968
- roomsTitle: "房間",
1040
+ friendShareTitle: "{name} 傳來的",
1041
+ friendShareLine: "{name} 傳給你",
1042
+ friendShareRow: "[連結] {title}",
1043
+ friendShareNote: "開啟後和任何 Ta 連結一樣:新增、加入、匯入之前 Ta 都會先問你。",
1044
+ friendShareOpen: "開啟",
1045
+ friendShareDelete: "刪除",
1046
+ myCodeGets: "對方申請加你為好友,雙方同意後成為好友",
1047
+ inviteGets: "對方申請加入,你同意後進群",
1048
+ roomsTitle: "群聊",
969
1049
  add: "新建",
970
- me: "我在房間裡的名字",
971
- meLine: "你在房間裡叫「{name}」",
1050
+ me: "我在群裡的名字",
1051
+ meLine: "你在群裡叫「{name}」",
972
1052
  rename: "修改",
973
1053
  renamePlaceholder: "別人看到的名字",
974
1054
  requests: "加入申請",
@@ -979,14 +1059,14 @@ var ZH_TW = {
979
1059
  requestGuest: "對方是用瀏覽器申請的,沒有裝 Ta:進來後只能聊天。",
980
1060
  accept: "同意",
981
1061
  refuse: "拒絕",
982
- requestBody: "「{name}」想加入你的房間「{title}」。",
983
- requestsBody: "有 {n} 人申請加入你的房間。",
1062
+ requestBody: "「{name}」想加入你的群聊「{title}」。",
1063
+ requestsBody: "有 {n} 人申請加入你的群聊。",
984
1064
  requestFriend: "對方是你的好友。",
985
1065
  requestNew: "對方不是你的好友:只讓認識的人進來。",
986
- requestWhat: "進來後,對方能看到房間裡的訊息和共享的內容;在遊戲裡就是大家的位置和搭的東西。",
1066
+ requestWhat: "進來後,對方能看到群裡的訊息和共享的內容;在遊戲裡就是大家的位置和搭的東西。",
987
1067
  later: "稍後",
988
- ownRoom: "我建的房間",
989
- roomOf: "{name}的房間",
1068
+ ownRoom: "我建的群聊",
1069
+ roomOf: "{name}的群聊",
990
1070
  people: "{n} 人 · {online} 人線上",
991
1071
  othersOnline: "另有 {n} 人線上",
992
1072
  nobodyOnline: "其他人都不線上",
@@ -994,7 +1074,7 @@ var ZH_TW = {
994
1074
  yesterday: "昨天",
995
1075
  waiting: "等{name}同意",
996
1076
  refused: "{name}沒有同意",
997
- closed: "房主已解散",
1077
+ closed: "群主已解散",
998
1078
  removed: "你已被移出",
999
1079
  inviteGone: "邀請已失效",
1000
1080
  connecting: "連線中…",
@@ -1002,31 +1082,25 @@ var ZH_TW = {
1002
1082
  inviteLine: "發連結或QR 碼,由你同意進入",
1003
1083
  inviteTitle: "邀請加入「{title}」",
1004
1084
  inviteHint: "把連結發給對方:在瀏覽器裡開啟,可以作為網頁訪客申請聊天;在 Ta 應用裡掃碼或貼上,就用 Ta 加入。都要你同意;連結 7 天內有效,換新連結後舊的作廢。",
1005
- newLink: "換一個連結",
1006
- making: "正在生成連結…",
1007
- copy: "複製連結",
1008
- copied: "已複製",
1009
- send: "傳送…",
1010
- qr: "邀請QR 碼",
1011
1085
  members: "成員",
1012
1086
  memberCount: "{n} 位成員",
1013
1087
  onlineCount: "{n} 人線上",
1014
- membersTitle: "房間成員",
1088
+ membersTitle: "群聊資訊",
1015
1089
  membersCount: "{n} 位成員 · {online} 人線上",
1016
- noRoomOpen: "開啟一個房間,這裡顯示它的成員",
1090
+ noRoomOpen: "開啟一個群聊,這裡顯示它的成員",
1017
1091
  you: "我",
1018
- owner: "房主",
1092
+ owner: "群主",
1019
1093
  online: "線上",
1020
1094
  offline: "離線",
1021
1095
  remove: "移出",
1022
1096
  removeTitle: "把「{name}」移出「{title}」?",
1023
1097
  removeHint: "對方會立刻斷開,只有新的邀請才能再進來。",
1024
- leave: "退出房間",
1098
+ leave: "退出群聊",
1025
1099
  leaveTitle: "退出「{title}」?",
1026
1100
  leaveHint: "退出後要有新的邀請才能再進來。",
1027
- close: "解散房間",
1101
+ close: "解散群聊",
1028
1102
  closeTitle: "解散「{title}」?",
1029
- closeHint: "所有人都會被移出,中繼會刪除房間儲存的全部內容。",
1103
+ closeHint: "所有人都會被移出,中繼會刪除群聊儲存的全部內容。",
1030
1104
  forget: "刪除",
1031
1105
  friends: "好友",
1032
1106
  friendsCount: "{n} 位",
@@ -1034,9 +1108,8 @@ var ZH_TW = {
1034
1108
  friendAdding: "等對方同意",
1035
1109
  removeFriend: "刪除",
1036
1110
  removeFriendTitle: "刪除好友「{name}」?",
1037
- removeFriendHint: "兩邊同時不再是好友:互相看不到動態,也收不到只給好友的分享。一起所在的房間不受影響。",
1111
+ removeFriendHint: "兩邊同時不再是好友:互相看不到動態,也收不到只給好友的分享。一起所在的群聊不受影響。",
1038
1112
  addFriend: "加好友",
1039
- addFriendHint: "讓對方掃這個碼,或把連結發給對方。雙方都同意後就是好友:互相看到動態,也能互相分享。",
1040
1113
  addFriendExpires: "還能用 {days} 天",
1041
1114
  addFriendAction: "加為好友",
1042
1115
  addFriendBody: "請「{name}」加你為好友?對方會看到你的名字,在自己的 Ta 裡同意。雙方同意後互相看到動態,也能互相分享。",
@@ -1051,43 +1124,70 @@ var ZH_TW = {
1051
1124
  friendAccept: "同意",
1052
1125
  friendRequestNote: "成為好友後互相看到動態,對方也能給你分享東西。只同意認識的人。",
1053
1126
  friendsEmpty: "還沒有好友",
1054
- friendsEmptyHint: "用QR 碼或連結加好友,也可以在一起所在房間的成員里加。",
1055
- scanFriend: "掃一掃",
1056
- pasteFriend: "貼上連結",
1057
- emptyTitle: "還沒有房間",
1127
+ friendsEmptyHint: "用QR 碼或連結加好友,也可以在一起所在群聊的成員里加。",
1128
+ myCode: "我的 QR 碼",
1129
+ addFriendPaste: "貼上別人發來的連結",
1130
+ addFriendOpen: "開啟",
1131
+ addFriendScan: "掃好友或群聊的 QR 碼",
1132
+ addFriendNearby: "加身邊的人為好友,或一起建群聊",
1133
+ addFriendInGroup: "在群聊的成員裡也能加好友。群聊的邀請連結貼到上面,就能申請加入。",
1134
+ emptyTitle: "還沒有群聊",
1058
1135
  emptyListHint: "點 + 新建一個,或開啟別人發來的邀請連結",
1059
- pickRoom: "選一個房間開始聊天",
1136
+ pickRoom: "選一個群聊開始聊天",
1060
1137
  joinTitle: "加入「{title}」?",
1061
- joinBody: "這是{by}的房間。房主同意後你才能進去,你的名字「{name}」會發給對方。",
1138
+ joinBody: "這是{by}的群聊。群主同意後你才能進去,你的名字「{name}」會發給對方。",
1062
1139
  joinAction: "申請加入",
1063
1140
  joinByLink: "用邀請連結加入",
1064
1141
  joinByLinkPlaceholder: "貼上別人發來的邀請連結",
1065
1142
  scan: "掃一掃",
1066
- scanHint: "掃描房間的邀請QR 碼",
1067
- notInvite: "這不是房間的邀請連結。",
1143
+ scanHint: "掃好友或群聊的 QR 碼",
1144
+ notInvite: "這不是 Ta 的連結。",
1068
1145
  asked: "已向{by}發出申請,對方同意後就能進入。",
1069
1146
  admitted: "已加入「{title}」。",
1070
1147
  refusedNotice: "{by}沒有同意你加入「{title}」。",
1071
1148
  removedNotice: "你已被移出「{title}」。",
1072
- closedNotice: "「{title}」已被房主解散。",
1073
- oldApp: "請更新 Ta 應用後再使用房間。",
1074
- room: "房間",
1075
- newRoom: "新建房間",
1076
- newRoomPlaceholder: "房間名,受邀的人能看到",
1077
- roomOfName: "{name}的房間",
1149
+ closedNotice: "「{title}」已被群主解散。",
1150
+ oldApp: "請更新 Ta 應用後再使用群聊。",
1151
+ room: "群聊",
1152
+ newRoom: "新建群聊",
1153
+ newRoomPlaceholder: "群聊名,受邀的人能看到",
1154
+ roomOfName: "{name}的群聊",
1078
1155
  back: "返回",
1079
1156
  openPage: "開啟{name}",
1080
- pageLine: "{name}的房間,大家可以一起玩",
1081
- chatEmpty: "還沒有人說話。只有房間裡的人能看到,中繼儲存的是密文。",
1157
+ apps: "群聊應用",
1158
+ pageLine: "{name}的群聊,大家可以一起玩",
1159
+ chatEmpty: "還沒有人說話。只有群裡的人能看到,中繼儲存的是密文。",
1082
1160
  chatPlaceholder: "發訊息",
1083
- showOnHome: "在分身首頁顯示房間",
1084
- showOnHomeHint: "有房間時,分身首頁多一個「房間」分類,和成員、頻道放在一起。"
1161
+ showOnHome: "在分身首頁顯示群聊",
1162
+ showOnHomeHint: "有群聊時,分身首頁多一個「群聊」分類,和成員、頻道放在一起。",
1163
+ friendsDetail: "{n} 位好友",
1164
+ friendsAsking: "{n} 個新的好友申請",
1165
+ inviteFriends: "邀請好友",
1166
+ inviteFriendsLine: "對方在自己的 Ta 裡看到,點加入就進來",
1167
+ inviteFriendsTitle: "邀請好友進「{title}」",
1168
+ inviteFriendsLead: "點一位好友,對方就會在自己的 Ta 裡看到這個群聊;對方點加入就直接進來,不用你再同意。",
1169
+ inviteFriendsNone: "好友都在群裡了,或者還沒有好友",
1170
+ inviteFriendsOld: "先把這台電腦上的 Ta 更新到新版,才能邀請好友",
1171
+ invitedFriend: "已邀請",
1172
+ groupInviteTitle: "群聊邀請",
1173
+ groupInviteLine: "{name} 邀請你加入",
1174
+ groupInviteNote: "進來後能看到群裡的聊天,群成員也能看到你。隨時可以退出。",
1175
+ groupInviteIgnore: "忽略",
1176
+ groupInviteJoin: "加入"
1085
1177
  };
1086
1178
  var JA = {
1087
- roomsTitle: "ルーム",
1179
+ friendShareTitle: "{name} から",
1180
+ friendShareLine: "{name} から届きました",
1181
+ friendShareRow: "[リンク] {title}",
1182
+ friendShareNote: "ほかの Ta のリンクと同じく、追加・参加・インポートの前に Ta が確認します。",
1183
+ friendShareOpen: "開く",
1184
+ friendShareDelete: "削除",
1185
+ myCodeGets: "相手から友だち申請が届き、双方が同意すると友だちになります",
1186
+ inviteGets: "相手が参加を申請し、あなたが許可すると参加します",
1187
+ roomsTitle: "グループチャット",
1088
1188
  add: "新規作成",
1089
- me: "ルーム内での私の名前",
1090
- meLine: "ルーム内で「{name}」と呼ばれています",
1189
+ me: "グループ内での私の名前",
1190
+ meLine: "グループ内で「{name}」と呼ばれています",
1091
1191
  rename: "変更",
1092
1192
  renamePlaceholder: "他の人に見える名前",
1093
1193
  requests: "参加リクエスト",
@@ -1098,14 +1198,14 @@ var JA = {
1098
1198
  requestGuest: "相手はブラウザから申請しており、Ta をインストールしていません:参加後はチャットのみ可能です。",
1099
1199
  accept: "了承",
1100
1200
  refuse: "拒否",
1101
- requestBody: "「{name}」があなたのルーム「{title}」に参加したいと言っています。",
1102
- requestsBody: "{n} 人がルームへの参加をリクエストしています。",
1201
+ requestBody: "「{name}」があなたのグループチャット「{title}」に参加したいと言っています。",
1202
+ requestsBody: "{n} 人がグループチャットへの参加をリクエストしています。",
1103
1203
  requestFriend: "相手はあなたの友だちです。",
1104
1204
  requestNew: "相手はあなたの友だちではありません:知っている人だけを参加させてください。",
1105
- requestWhat: "参加すると、相手はルーム内のメッセージと共有されたコンテンツを見ることができます:ゲームでは、みんなの位置と作られたものです。",
1205
+ requestWhat: "参加すると、相手はグループ内のメッセージと共有されたコンテンツを見ることができます:ゲームでは、みんなの位置と作られたものです。",
1106
1206
  later: "後で",
1107
- ownRoom: "私が作ったルーム",
1108
- roomOf: "{name}のルーム",
1207
+ ownRoom: "私が作ったグループチャット",
1208
+ roomOf: "{name}のグループチャット",
1109
1209
  people: "{n} 人 · {online} 人がオンライン",
1110
1210
  othersOnline: "さらに {n} 人がオンライン",
1111
1211
  nobodyOnline: "他に誰もオンラインではありません",
@@ -1121,18 +1221,12 @@ var JA = {
1121
1221
  inviteLine: "リンクまたは QR コードを送信します。参加を許可するのはあなたです",
1122
1222
  inviteTitle: "「{title}」に招待",
1123
1223
  inviteHint: "リンクを相手に送信します:ブラウザで開くと、ウェブゲストとしてチャットをリクエストできます。Ta アプリでスキャンまたは貼り付けると、Ta で参加できます。どちらの場合も参加を許可するのはあなたです。リンクは 7 日間有効で、新しいリンクを作成すると古いリンクは無効になります。",
1124
- newLink: "新しいリンクを作成",
1125
- making: "リンクを生成中…",
1126
- copy: "リンクをコピー",
1127
- copied: "コピーしました",
1128
- send: "送信…",
1129
- qr: "招待用 QR コード",
1130
1224
  members: "メンバー",
1131
1225
  memberCount: "{n} 人のメンバー",
1132
1226
  onlineCount: "{n} 人がオンライン",
1133
- membersTitle: "ルームのメンバー",
1227
+ membersTitle: "グループチャット情報",
1134
1228
  membersCount: "{n} 人のメンバー · {online} 人がオンライン",
1135
- noRoomOpen: "ルームを開いて、メンバーを確認します",
1229
+ noRoomOpen: "グループチャットを開いて、メンバーを確認します",
1136
1230
  you: "私",
1137
1231
  owner: "オーナー",
1138
1232
  online: "オンライン",
@@ -1140,12 +1234,12 @@ var JA = {
1140
1234
  remove: "削除",
1141
1235
  removeTitle: "「{name}」を「{title}」から削除しますか?",
1142
1236
  removeHint: "相手はすぐに切断され、新しい招待でのみ戻ることができます。",
1143
- leave: "ルームを退出",
1237
+ leave: "グループチャットを退出",
1144
1238
  leaveTitle: "「{title}」を退出しますか?",
1145
1239
  leaveHint: "新しい招待を受け取ってのみ戻ることができます。",
1146
- close: "ルームを閉鎖",
1240
+ close: "グループチャットを閉鎖",
1147
1241
  closeTitle: "「{title}」をすべてのユーザーに対して閉鎖しますか?",
1148
- closeHint: "すべてのユーザーが削除され、リレーはルームに保存されているすべてを削除します。",
1242
+ closeHint: "すべてのユーザーが削除され、リレーはグループチャットに保存されているすべてを削除します。",
1149
1243
  forget: "削除",
1150
1244
  friends: "友だち",
1151
1245
  friendsCount: "{n} 人",
@@ -1153,9 +1247,8 @@ var JA = {
1153
1247
  friendAdding: "ユーザーが同意するのを待機中",
1154
1248
  removeFriend: "削除",
1155
1249
  removeFriendTitle: "友だち「{name}」を削除しますか?",
1156
- removeFriendHint: "両側で友だちではなくなります:お互いの投稿が見えなくなり、友だちのみとの共有も受け取れません。共有しているルームは影響を受けません。",
1250
+ removeFriendHint: "両側で友だちではなくなります:お互いの投稿が見えなくなり、友だちのみとの共有も受け取れません。共有しているグループチャットは影響を受けません。",
1157
1251
  addFriend: "友だち追加",
1158
- addFriendHint: "このコードをスキャンしてもらうか、リンクを送信します。双方が同意すると友だちになります:お互いの投稿が見え、共有できます。",
1159
1252
  addFriendExpires: "あと {days} 日間利用可能",
1160
1253
  addFriendAction: "友だち追加",
1161
1254
  addFriendBody: "「{name}」を友だち追加しますか?相手はあなたの名前を見て、自分の Ta で返答できます。双方が同意するとお互いの投稿が見え、共有できます。",
@@ -1170,37 +1263,56 @@ var JA = {
1170
1263
  friendAccept: "同意",
1171
1264
  friendRequestNote: "友だちになると、お互いの投稿が見え、相手があなたと共有できるようになります。知っている人だけに同意してください。",
1172
1265
  friendsEmpty: "まだ友だちがいません",
1173
- friendsEmptyHint: "コードまたはリンクで友だちを追加するか、共有するルームのメンバーから追加します。",
1174
- scanFriend: "スキャン",
1175
- pasteFriend: "リンクを貼り付け",
1176
- emptyTitle: "まだルームがありません",
1266
+ friendsEmptyHint: "コードまたはリンクで友だちを追加するか、共有するグループチャットのメンバーから追加します。",
1267
+ myCode: "マイQRコード",
1268
+ addFriendPaste: "届いたリンクを貼り付け",
1269
+ addFriendOpen: "開く",
1270
+ addFriendScan: "友だちやグループチャットのQRコード",
1271
+ addFriendNearby: "近くの人を友だちに追加、または一緒にグループチャットを作成",
1272
+ addFriendInGroup: "グループチャットのメンバーからも友だち追加できます。グループチャットの招待リンクを上に貼り付けると参加を申請します。",
1273
+ emptyTitle: "まだグループチャットがありません",
1177
1274
  emptyListHint: "+ で新しく作成するか、招待リンクを開きます",
1178
- pickRoom: "チャットするルームを選択します",
1275
+ pickRoom: "チャットするグループチャットを選択します",
1179
1276
  joinTitle: "「{title}」に参加しますか?",
1180
- joinBody: "{by} のルーム。オーナーが許可すると参加できます。あなたの名前「{name}」は相手に送信されます。",
1277
+ joinBody: "{by} のグループチャット。オーナーが許可すると参加できます。あなたの名前「{name}」は相手に送信されます。",
1181
1278
  joinAction: "参加をリクエスト",
1182
1279
  joinByLink: "リンクで参加",
1183
1280
  joinByLinkPlaceholder: "招待リンクを貼り付けます",
1184
1281
  scan: "スキャン",
1185
- scanHint: "招待の QR コードをスキャン",
1186
- notInvite: "これはルーム招待リンクではありません。",
1282
+ scanHint: "友だちやグループチャットのQRコードをスキャン",
1283
+ notInvite: "これは Ta のリンクではありません。",
1187
1284
  asked: "{by} にリクエストを送信しました:相手が許可すると参加できます。",
1188
1285
  admitted: "「{title}」に参加しました。",
1189
1286
  refusedNotice: "{by} はあなたの「{title}」への参加を許可しませんでした。",
1190
1287
  removedNotice: "「{title}」から削除されました。",
1191
1288
  closedNotice: "「{title}」はオーナーによって閉鎖されました。",
1192
- oldApp: "ルームを使用するには Ta アプリを更新してください。",
1193
- room: "ルーム",
1194
- newRoom: "新しいルームを作成",
1195
- newRoomPlaceholder: "ルーム名。招待された人が見ます",
1196
- roomOfName: "{name}のルーム",
1289
+ oldApp: "グループチャットを使用するには Ta アプリを更新してください。",
1290
+ room: "グループチャット",
1291
+ newRoom: "新しいグループチャット",
1292
+ newRoomPlaceholder: "グループチャット名。招待された人が見ます",
1293
+ roomOfName: "{name}のグループチャット",
1197
1294
  back: "戻る",
1198
1295
  openPage: "{name} を開く",
1199
- pageLine: "{name} のルーム:一緒にプレイします",
1200
- chatEmpty: "まだ何も言われていません。ルーム内の人だけが見ることができます。リレーは暗号化されて保存します。",
1296
+ apps: "グループチャットのアプリ",
1297
+ pageLine: "{name} のグループチャット:一緒にプレイします",
1298
+ chatEmpty: "まだ何も言われていません。グループ内の人だけが見ることができます。リレーは暗号化されて保存します。",
1201
1299
  chatPlaceholder: "メッセージ",
1202
- showOnHome: "分身のホームにルームを表示",
1203
- showOnHomeHint: "ルームがあると、分身のホームに「ルーム」セクションが追加され、メンバーとチャンネルと一緒に表示されます。"
1300
+ showOnHome: "分身のホームにグループチャットを表示",
1301
+ showOnHomeHint: "グループチャットがあると、分身のホームに「グループチャット」セクションが追加され、メンバーとチャンネルと一緒に表示されます。",
1302
+ friendsDetail: "友だち {n} 人",
1303
+ friendsAsking: "友だち申請 {n} 件",
1304
+ inviteFriends: "友だちを招待",
1305
+ inviteFriendsLine: "相手の Ta に届き、参加するとすぐ入れます",
1306
+ inviteFriendsTitle: "「{title}」に友だちを招待",
1307
+ inviteFriendsLead: "友だちをタップすると、その人の Ta にこのグループチャットが届きます。参加すれば、あなたの承認なしで入れます。",
1308
+ inviteFriendsNone: "友だちは全員参加済みか、まだ友だちがいません",
1309
+ inviteFriendsOld: "友だちを招待するには、このコンピュータの Ta を更新してください",
1310
+ invitedFriend: "招待済み",
1311
+ groupInviteTitle: "グループチャットへの招待",
1312
+ groupInviteLine: "{name} からの招待",
1313
+ groupInviteNote: "参加するとチャットが見え、メンバーからもあなたが見えます。いつでも退出できます。",
1314
+ groupInviteIgnore: "無視",
1315
+ groupInviteJoin: "参加"
1204
1316
  };
1205
1317
  var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
1206
1318
  var RoomWords;
@@ -1221,6 +1333,26 @@ function bind(react) {
1221
1333
  React = react;
1222
1334
  }
1223
1335
 
1336
+ // web-src/room-seen.ts
1337
+ var RoomSeenUtil;
1338
+ ((RoomSeenUtil) => {
1339
+ function parse(value) {
1340
+ return value && typeof value === "object" ? Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "number")) : {};
1341
+ }
1342
+ RoomSeenUtil.parse = parse;
1343
+ function merge(a, b) {
1344
+ const later = Object.entries(b).filter(([room, at]) => at > (a[room] ?? 0));
1345
+ return later.length ? { ...a, ...Object.fromEntries(later) } : a;
1346
+ }
1347
+ RoomSeenUtil.merge = merge;
1348
+ })(RoomSeenUtil ||= {});
1349
+ function unseen(room, lines, seen) {
1350
+ const self = room.members.find((member) => member.self)?.member;
1351
+ const since = seen[room.id] ?? room.joinedAt ?? room.createdAt;
1352
+ const last = lines[lines.length - 1];
1353
+ return !!last && last.at > since && last.from !== self;
1354
+ }
1355
+
1224
1356
  // web-src/page.tsx
1225
1357
  var ROOMS_KIND = "ta-rooms";
1226
1358
  var ROOMS_VIEW = "@celljs/ta-rooms/rooms";
@@ -1246,7 +1378,7 @@ function rooms() {
1246
1378
  }
1247
1379
 
1248
1380
  class RoomBook {
1249
- state = { requests: [], friendRequests: [], seen: {} };
1381
+ state = { requests: [], friendRequests: [], groupInvites: [], seen: {} };
1250
1382
  listeners = new Set;
1251
1383
  chats = new Map;
1252
1384
  agentStates = new Map;
@@ -1273,7 +1405,7 @@ class RoomBook {
1273
1405
  }
1274
1406
  const server = rooms();
1275
1407
  if (!server) {
1276
- this.set({ rooms: [], friends: [], friendRequests: [] });
1408
+ this.set({ rooms: [], friends: [], friendRequests: [], groupInvites: [] });
1277
1409
  return Promise.resolve();
1278
1410
  }
1279
1411
  this.readSeen();
@@ -1284,11 +1416,20 @@ class RoomBook {
1284
1416
  }),
1285
1417
  server.listRequests().catch(() => this.state.requests),
1286
1418
  server.listFriends().catch(() => this.state.friends ?? []),
1287
- server.listFriendRequests ? server.listFriendRequests().catch(() => this.state.friendRequests) : Promise.resolve([])
1288
- ]).then(([identity, all, requests, friends, friendRequests]) => {
1419
+ server.listFriendRequests ? server.listFriendRequests().catch(() => this.state.friendRequests) : Promise.resolve([]),
1420
+ server.listGroupInvites ? server.listGroupInvites().catch(() => this.state.groupInvites) : Promise.resolve([])
1421
+ ]).then(([identity, all, requests, friends, friendRequests, groupInvites]) => {
1289
1422
  const unlisted = new Set((all ?? []).filter((room) => room.unlisted).map((room) => room.id));
1290
1423
  const list = all ? all.filter((room) => !unlisted.has(room.id)) : this.state.rooms ?? [];
1291
- this.read({ ...this.state, identity, rooms: list, requests: requests.filter((request) => !unlisted.has(request.room)), friends, friendRequests });
1424
+ this.read({
1425
+ ...this.state,
1426
+ identity,
1427
+ rooms: list,
1428
+ requests: requests.filter((request) => !unlisted.has(request.room)),
1429
+ friends,
1430
+ friendRequests,
1431
+ groupInvites
1432
+ });
1292
1433
  }).finally(() => {
1293
1434
  this.loading = undefined;
1294
1435
  if (this.again) {
@@ -1504,26 +1645,8 @@ function useAgents(room) {
1504
1645
  function useJoining(room) {
1505
1646
  return React.useSyncExternalStore((listener) => book.subscribe(listener), () => book.joining(room.id));
1506
1647
  }
1507
- var RoomSeenUtil;
1508
- ((RoomSeenUtil) => {
1509
- function parse(value) {
1510
- return value && typeof value === "object" ? Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "number")) : {};
1511
- }
1512
- RoomSeenUtil.parse = parse;
1513
- function merge(a, b) {
1514
- const later = Object.entries(b).filter(([room, at]) => at > (a[room] ?? 0));
1515
- return later.length ? { ...a, ...Object.fromEntries(later) } : a;
1516
- }
1517
- RoomSeenUtil.merge = merge;
1518
- })(RoomSeenUtil ||= {});
1519
- function unseen(room, lines, seen) {
1520
- const self = room.members.find((member) => member.self)?.member;
1521
- const since = seen[room.id] ?? room.joinedAt ?? room.createdAt;
1522
- const last = lines[lines.length - 1];
1523
- return !!last && last.at > since && last.from !== self;
1524
- }
1525
1648
  function openRoom(id, direct = false) {
1526
- book.set({ opened: id, direct });
1649
+ book.set({ opened: id, direct: direct || !!pi.ui.doubleInChats });
1527
1650
  pi.ui.showView(ROOMS_VIEW);
1528
1651
  }
1529
1652
  function useOpened() {
@@ -1541,6 +1664,69 @@ function usePageOf(room) {
1541
1664
  }
1542
1665
  return pages.find((page) => page.id === view) ?? pages.find((page) => page.onOpen && view.startsWith(`${page.id}/`));
1543
1666
  }
1667
+ function useRoomApps(room) {
1668
+ const entries = pi.ui.useRoomAddons?.() ?? [];
1669
+ const page = usePageOf(room ?? { view: undefined });
1670
+ const [, redraw] = React.useReducer((n) => n + 1, 0);
1671
+ React.useEffect(() => {
1672
+ const stops = entries.map(({ addon }) => addon.subscribe?.(redraw));
1673
+ return () => {
1674
+ for (const stop of stops) {
1675
+ stop?.();
1676
+ }
1677
+ };
1678
+ }, [entries]);
1679
+ if (room?.status !== "member") {
1680
+ return { apps: [], lines: [] };
1681
+ }
1682
+ const safe = (read) => {
1683
+ try {
1684
+ return read();
1685
+ } catch (error) {
1686
+ console.error("An app of the rooms failed:", error);
1687
+ return;
1688
+ }
1689
+ };
1690
+ const apps = [];
1691
+ const lines = [];
1692
+ if (page && room.view) {
1693
+ const view = room.view;
1694
+ const app = { id: view, label: page.title, icon: page.icon ?? icon("ExternalLink"), open: () => void pi.ui.showView(view) };
1695
+ apps.push(app);
1696
+ lines.push({ id: view, text: t("pageLine", { name: page.title }), icon: app.icon, app });
1697
+ }
1698
+ for (const { id, addon } of entries) {
1699
+ const tile = safe(() => addon.tile?.(room));
1700
+ const line = safe(() => addon.line?.(room));
1701
+ if (!tile && !line) {
1702
+ continue;
1703
+ }
1704
+ const app = {
1705
+ id,
1706
+ label: tile?.label ?? "",
1707
+ icon: icon(tile?.icon ?? line?.icon ?? "Sparkles"),
1708
+ ...tile?.status ? { status: tile.status } : {},
1709
+ ...tile?.attention ? { attention: true } : {},
1710
+ ...addon.page ? { page: addon.page } : {},
1711
+ ...addon.open ? { open: () => addon.open?.(room) } : {}
1712
+ };
1713
+ if (tile) {
1714
+ apps.push(app);
1715
+ }
1716
+ if (line) {
1717
+ lines.push({ id, text: line.text, icon: icon(line.icon ?? tile?.icon ?? "Sparkles"), app });
1718
+ }
1719
+ }
1720
+ return { apps, lines };
1721
+ }
1722
+ function openApp(room, app) {
1723
+ if (app.page) {
1724
+ book.set({ sub: { room: room.id, app: app.id } });
1725
+ pi.ui.showView(MEMBERS_VIEW);
1726
+ } else {
1727
+ app.open?.();
1728
+ }
1729
+ }
1544
1730
  function statusLine(room) {
1545
1731
  switch (room.status) {
1546
1732
  case "waiting":
@@ -1766,10 +1952,10 @@ var ZH2 = {
1766
1952
  mentionLabel: "问分身",
1767
1953
  mentionDetail: "问 TA 的分身",
1768
1954
  answersHere: "我的分身在这里回答",
1769
- answersHint: "有人 @ 你的分身时,它会在这个房间里回答。默认只能聊天和读房间里的内容,你允许后才能替某人做更多事。",
1955
+ answersHint: "有人 @ 你的分身时,它会在这个群里回答。默认只能聊天和读群里的内容,你允许后才能替某人做更多事。",
1770
1956
  permissions: "授权分身替 TA 做事",
1771
1957
  grantTitle: "让分身替{name}做事",
1772
- grantLead: "{name}在房间里问你的分身时,它还可以在你的电脑上:",
1958
+ grantLead: "{name}在群里问你的分身时,它还可以在你的电脑上:",
1773
1959
  files: "读写文件",
1774
1960
  filesHint: "只限下面这个目录。",
1775
1961
  commands: "运行命令",
@@ -1805,7 +1991,7 @@ var ZH2 = {
1805
1991
  stop: "停掉",
1806
1992
  logTitle: "分身记录",
1807
1993
  logEmpty: "还没有记录",
1808
- logEmptyHint: "分身在房间里替别人做的事会列在这里",
1994
+ logEmptyHint: "分身在群里替别人做的事会列在这里",
1809
1995
  asked: "{name}问",
1810
1996
  answered: "已回答",
1811
1997
  failed: "失败",
@@ -1816,25 +2002,25 @@ var ZH2 = {
1816
2002
  noGrants: "分身只替别人聊天",
1817
2003
  log: "分身记录",
1818
2004
  noPermission: "还没有授权",
1819
- oldServer: "请先更新电脑上的 Ta,再在房间里使用分身。",
2005
+ oldServer: "请先更新电脑上的 Ta,再在群里使用分身。",
1820
2006
  agentTag: "智能体",
1821
2007
  myAgent: "我的智能体",
1822
2008
  agentOf: "{name}的智能体",
1823
2009
  agentsTitle: "智能体",
1824
2010
  inviteAgent: "邀请智能体",
1825
- inviteAgentLine: "让你的智能体在房间里帮忙",
2011
+ inviteAgentLine: "让你的智能体在群里帮忙",
1826
2012
  pickAgentTitle: "邀请智能体进「{title}」",
1827
- pickAgentLead: "房间里的人 @ 它就能找它帮忙。你自己问它时,它像平常一样在自己的目录里用工具做事;别人问它时,和分身一样只能聊天,除非你授权。",
2013
+ pickAgentLead: "群里的人 @ 它就能找它帮忙。你自己问它时,它像平常一样在自己的目录里用工具做事;别人问它时,和分身一样只能聊天,除非你授权。",
1828
2014
  noAgents: "还没有智能体",
1829
2015
  noAgentsHint: "先在分身侧栏新建一个智能体。",
1830
- inRoom: "已在房间里",
2016
+ inRoom: "已在群里",
1831
2017
  joining: "正在加入…",
1832
- joiningRoom: "{name}正在加入房间…",
2018
+ joiningRoom: "{name}正在加入群聊…",
1833
2019
  inviteFailed: "没能邀请{name}:{error}",
1834
- dismiss: "请出房间",
2020
+ dismiss: "请出群聊",
1835
2021
  dismissTitle: "让{name}离开「{title}」?",
1836
- dismissHint: "它会在房间里道别,之后不再回答这里的问题。",
1837
- tryAlone: "邀请一个你的智能体进来,一个人也能试试房间。",
2022
+ dismissHint: "它会在群里道别,之后不再回答这里的问题。",
2023
+ tryAlone: "邀请一个你的智能体进来,一个人也能试试群聊。",
1838
2024
  agentAsked: "{name}问{agent}",
1839
2025
  taskTag: "任务",
1840
2026
  taskSent: "已交出",
@@ -1851,9 +2037,9 @@ var ZH2 = {
1851
2037
  taskWaitsFor: "等{name}授权",
1852
2038
  stopTask: "停止任务",
1853
2039
  cancelTask: "取消任务",
1854
- openTaskRoom: "打开房间",
2040
+ openTaskRoom: "打开群聊",
1855
2041
  forgetTask: "删除",
1856
- forgetTaskHint: "只删除这条记录,房间里说过的话还在。",
2042
+ forgetTaskHint: "只删除这条记录,群里说过的话还在。",
1857
2043
  taskResult: "交给{name}的分身的任务",
1858
2044
  taskLog: "{name}交来任务"
1859
2045
  };
@@ -1864,10 +2050,10 @@ var ZH_TW2 = {
1864
2050
  mentionLabel: "問分身",
1865
2051
  mentionDetail: "問 TA 的分身",
1866
2052
  answersHere: "我的分身在這裡回答",
1867
- answersHint: "有人 @ 你的分身時,它會在這個房間裡回答。預設只能聊天和讀房間裡的內容,你允許後才能替某人做更多事。",
2053
+ answersHint: "有人 @ 你的分身時,它會在這個群裡回答。預設只能聊天和讀群裡的內容,你允許後才能替某人做更多事。",
1868
2054
  permissions: "授權分身替 TA 做事",
1869
2055
  grantTitle: "讓分身替{name}做事",
1870
- grantLead: "{name}在房間裡問你的分身時,它還可以在你的電腦上:",
2056
+ grantLead: "{name}在群裡問你的分身時,它還可以在你的電腦上:",
1871
2057
  files: "讀寫檔案",
1872
2058
  filesHint: "只限下面這個目錄。",
1873
2059
  commands: "執行命令",
@@ -1903,7 +2089,7 @@ var ZH_TW2 = {
1903
2089
  stop: "停掉",
1904
2090
  logTitle: "分身記錄",
1905
2091
  logEmpty: "還沒有記錄",
1906
- logEmptyHint: "分身在房間裡替別人做的事會列在這裡",
2092
+ logEmptyHint: "分身在群裡替別人做的事會列在這裡",
1907
2093
  asked: "{name}問",
1908
2094
  answered: "已回答",
1909
2095
  failed: "失敗",
@@ -1914,25 +2100,25 @@ var ZH_TW2 = {
1914
2100
  noGrants: "分身只替別人聊天",
1915
2101
  log: "分身記錄",
1916
2102
  noPermission: "還沒有授權",
1917
- oldServer: "請先更新電腦上的 Ta,再在房間裡使用分身。",
2103
+ oldServer: "請先更新電腦上的 Ta,再在群裡使用分身。",
1918
2104
  agentTag: "智慧體",
1919
2105
  myAgent: "我的智慧體",
1920
2106
  agentOf: "{name}的智慧體",
1921
2107
  agentsTitle: "智慧體",
1922
2108
  inviteAgent: "邀請智慧體",
1923
- inviteAgentLine: "讓你的智慧體在房間裡幫忙",
2109
+ inviteAgentLine: "讓你的智慧體在群裡幫忙",
1924
2110
  pickAgentTitle: "邀請智慧體進「{title}」",
1925
- pickAgentLead: "房間裡的人 @ 它就能找它幫忙。你自己問它時,它像平常一樣在自己的目錄裡用工具做事;別人問它時,和分身一樣只能聊天,除非你授權。",
2111
+ pickAgentLead: "群裡的人 @ 它就能找它幫忙。你自己問它時,它像平常一樣在自己的目錄裡用工具做事;別人問它時,和分身一樣只能聊天,除非你授權。",
1926
2112
  noAgents: "還沒有智慧體",
1927
2113
  noAgentsHint: "先在分身側欄新建一個智慧體。",
1928
- inRoom: "已在房間裡",
2114
+ inRoom: "已在群裡",
1929
2115
  joining: "正在加入…",
1930
- joiningRoom: "{name}正在加入房間…",
2116
+ joiningRoom: "{name}正在加入群聊…",
1931
2117
  inviteFailed: "沒能邀請{name}:{error}",
1932
- dismiss: "請出房間",
2118
+ dismiss: "請出群聊",
1933
2119
  dismissTitle: "讓{name}離開「{title}」?",
1934
- dismissHint: "它會在房間裡道別,之後不再回答這裡的問題。",
1935
- tryAlone: "邀請一個你的智慧體進來,一個人也能試試房間。",
2120
+ dismissHint: "它會在群裡道別,之後不再回答這裡的問題。",
2121
+ tryAlone: "邀請一個你的智慧體進來,一個人也能試試群聊。",
1936
2122
  agentAsked: "{name}問{agent}",
1937
2123
  taskTag: "任務",
1938
2124
  taskSent: "已交出",
@@ -1949,9 +2135,9 @@ var ZH_TW2 = {
1949
2135
  taskWaitsFor: "等{name}授權",
1950
2136
  stopTask: "停止任務",
1951
2137
  cancelTask: "取消任務",
1952
- openTaskRoom: "開啟房間",
2138
+ openTaskRoom: "開啟群聊",
1953
2139
  forgetTask: "刪除",
1954
- forgetTaskHint: "只刪除這條記錄,房間裡說過的話還在。",
2140
+ forgetTaskHint: "只刪除這條記錄,群裡說過的話還在。",
1955
2141
  taskResult: "交給{name}的分身的任務",
1956
2142
  taskLog: "{name}交來任務"
1957
2143
  };
@@ -1962,10 +2148,10 @@ var JA2 = {
1962
2148
  mentionLabel: "分身に質問",
1963
2149
  mentionDetail: "彼らの分身に質問",
1964
2150
  answersHere: "私の分身がここで返答します",
1965
- answersHint: "@で分身に尋ねられると、このルーム内で返答します。デフォルトではチャットとルーム内容の読み取りのみが可能で、許可後は誰かの代わりにより多くのことを実行できます。",
2151
+ answersHint: "@で分身に尋ねられると、このグループ内で返答します。デフォルトではチャットとグループ内容の読み取りのみが可能で、許可後は誰かの代わりにより多くのことを実行できます。",
1966
2152
  permissions: "分身に代行を許可",
1967
2153
  grantTitle: "分身に {name} の代わりに作業させる",
1968
- grantLead: "{name} がルーム内で分身に質問すると、コンピュータ上で次のことも実行できます:",
2154
+ grantLead: "{name} がグループ内で分身に質問すると、コンピュータ上で次のことも実行できます:",
1969
2155
  files: "ファイルの読み書き",
1970
2156
  filesHint: "下記のディレクトリのみ。",
1971
2157
  commands: "コマンドの実行",
@@ -2001,7 +2187,7 @@ var JA2 = {
2001
2187
  stop: "停止",
2002
2188
  logTitle: "分身の記録",
2003
2189
  logEmpty: "まだ記録がありません",
2004
- logEmptyHint: "ルーム内で分身が他の人のために実行したアクションが記録されます",
2190
+ logEmptyHint: "グループ内で分身が他の人のために実行したアクションが記録されます",
2005
2191
  asked: "{name} が質問",
2006
2192
  answered: "返答済み",
2007
2193
  failed: "失敗",
@@ -2012,25 +2198,25 @@ var JA2 = {
2012
2198
  noGrants: "分身は他の人とのチャットのみ",
2013
2199
  log: "分身の記録",
2014
2200
  noPermission: "まだ設定されていません",
2015
- oldServer: "ルーム内で分身を使用する前に、コンピュータ上の Ta を更新してください。",
2201
+ oldServer: "グループ内で分身を使用する前に、コンピュータ上の Ta を更新してください。",
2016
2202
  agentTag: "エージェント",
2017
2203
  myAgent: "私のエージェント",
2018
2204
  agentOf: "{name} のエージェント",
2019
2205
  agentsTitle: "エージェント",
2020
2206
  inviteAgent: "エージェントを招待",
2021
- inviteAgentLine: "ルーム内でエージェントをサポート",
2207
+ inviteAgentLine: "グループ内でエージェントをサポート",
2022
2208
  pickAgentTitle: "「{title}」にエージェントを招待",
2023
- pickAgentLead: "ルーム内の誰もが @ で質問できます。自分が質問するとき、いつものようにディレクトリ内のツールで動作します;他の人が質問するとき、分身と同じくチャットのみが可能です。許可後はより多くを実行できます。",
2209
+ pickAgentLead: "グループ内の誰もが @ で質問できます。自分が質問するとき、いつものようにディレクトリ内のツールで動作します;他の人が質問するとき、分身と同じくチャットのみが可能です。許可後はより多くを実行できます。",
2024
2210
  noAgents: "エージェントがまだありません",
2025
2211
  noAgentsHint: "分身のサイドバーでエージェントを新規作成してください。",
2026
- inRoom: "ルームに参加済み",
2212
+ inRoom: "グループチャットに参加済み",
2027
2213
  joining: "参加中…",
2028
- joiningRoom: "{name} がルームに参加中…",
2214
+ joiningRoom: "{name} がグループチャットに参加中…",
2029
2215
  inviteFailed: "{name} を招待できませんでした:{error}",
2030
- dismiss: "ルームを出るようにリクエスト",
2216
+ dismiss: "グループチャットを出るようにリクエスト",
2031
2217
  dismissTitle: "{name} に「{title}」を出るようにリクエストしますか?",
2032
- dismissHint: "ルーム内でさようならを言い、その後、このルームの質問には応答しません。",
2033
- tryAlone: "エージェントを招待します:自分でルームを試すことができます。",
2218
+ dismissHint: "グループ内でさようならを言い、その後、このグループチャットの質問には応答しません。",
2219
+ tryAlone: "エージェントを招待します:自分でグループチャットを試すことができます。",
2034
2220
  agentAsked: "{name} が {agent} に質問",
2035
2221
  taskTag: "タスク",
2036
2222
  taskSent: "送信済み",
@@ -2047,9 +2233,9 @@ var JA2 = {
2047
2233
  taskWaitsFor: "{name} の許可を待機中",
2048
2234
  stopTask: "タスクを停止",
2049
2235
  cancelTask: "キャンセル",
2050
- openTaskRoom: "ルームを開く",
2236
+ openTaskRoom: "グループチャットを開く",
2051
2237
  forgetTask: "削除",
2052
- forgetTaskHint: "エントリのみが削除されます。ルーム内の会話は保持されます。",
2238
+ forgetTaskHint: "エントリのみが削除されます。グループ内の会話は保持されます。",
2053
2239
  taskResult: "{name} の分身のタスク",
2054
2240
  taskLog: "{name} がタスクを送信"
2055
2241
  };
@@ -2223,6 +2409,7 @@ function saidHello(chat, hello) {
2223
2409
  });
2224
2410
  }
2225
2411
  function AgentPicker({ room, close }) {
2412
+ const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
2226
2413
  const [agents, setAgents] = React.useState();
2227
2414
  const [error, setError] = React.useState();
2228
2415
  const inRoom = useAgents(room);
@@ -2243,9 +2430,7 @@ function AgentPicker({ room, close }) {
2243
2430
  className: "trm-dialog"
2244
2431
  }, /* @__PURE__ */ React.createElement("p", {
2245
2432
  className: "trm-note"
2246
- }, dt("pickAgentLead")), !agents && !error && pi.ui.Skeleton && /* @__PURE__ */ React.createElement(pi.ui.Skeleton, {
2247
- rows: 3
2248
- }), agents?.length === 0 && /* @__PURE__ */ React.createElement(pi.ui.Empty, {
2433
+ }, dt("pickAgentLead")), !agents && !error && Loading && /* @__PURE__ */ React.createElement(Loading, null), agents?.length === 0 && /* @__PURE__ */ React.createElement(pi.ui.Empty, {
2249
2434
  title: dt("noAgents"),
2250
2435
  hint: dt("noAgentsHint"),
2251
2436
  compact: true
@@ -2928,29 +3113,43 @@ function RoomHead({ room }) {
2928
3113
  onClick: () => void pi.ui.showView(MEMBERS_VIEW)
2929
3114
  }));
2930
3115
  }
2931
- function PageLine({ room }) {
2932
- const page = usePageOf(room);
2933
- if (!page || !room.view) {
3116
+ function AppStrip({ room }) {
3117
+ const { lines } = useRoomApps(room);
3118
+ const Chevron = icon("ChevronRight");
3119
+ if (!lines.length) {
2934
3120
  return null;
2935
3121
  }
2936
- const Icon = page.icon ?? icon("ExternalLink");
2937
- const Chevron = icon("ChevronRight");
2938
- const view = room.view;
2939
- return /* @__PURE__ */ React.createElement("button", {
3122
+ if (lines.length === 1) {
3123
+ const [line] = lines;
3124
+ return /* @__PURE__ */ React.createElement("button", {
3125
+ type: "button",
3126
+ className: "trm-page-line",
3127
+ onClick: () => openApp(room, line.app)
3128
+ }, /* @__PURE__ */ React.createElement("span", {
3129
+ className: "trm-page-line-icon"
3130
+ }, /* @__PURE__ */ React.createElement(line.icon, {
3131
+ size: 15
3132
+ })), /* @__PURE__ */ React.createElement("span", {
3133
+ className: "trm-page-line-text"
3134
+ }, line.text), /* @__PURE__ */ React.createElement("span", {
3135
+ className: "trm-page-line-chevron"
3136
+ }, /* @__PURE__ */ React.createElement(Chevron, {
3137
+ size: 15
3138
+ })));
3139
+ }
3140
+ return /* @__PURE__ */ React.createElement("div", {
3141
+ className: "trm-app-chips"
3142
+ }, lines.map((line) => /* @__PURE__ */ React.createElement("button", {
3143
+ key: line.id,
2940
3144
  type: "button",
2941
- className: "trm-page-line",
2942
- onClick: () => void pi.ui.showView(view)
2943
- }, /* @__PURE__ */ React.createElement("span", {
2944
- className: "trm-page-line-icon"
2945
- }, /* @__PURE__ */ React.createElement(Icon, {
2946
- size: 15
2947
- })), /* @__PURE__ */ React.createElement("span", {
2948
- className: "trm-page-line-text"
2949
- }, t("pageLine", { name: page.title })), /* @__PURE__ */ React.createElement("span", {
2950
- className: "trm-page-line-open"
2951
- }, t("openPage", { name: page.title }), /* @__PURE__ */ React.createElement(Chevron, {
3145
+ className: "trm-app-chip",
3146
+ title: line.text,
3147
+ onClick: () => openApp(room, line.app)
3148
+ }, /* @__PURE__ */ React.createElement(line.icon, {
2952
3149
  size: 14
2953
- })));
3150
+ }), /* @__PURE__ */ React.createElement("span", {
3151
+ className: "trm-ellipsis"
3152
+ }, line.app.label ? `${line.app.label}${line.app.status ? ` · ${line.app.status}` : ""}` : line.text))));
2954
3153
  }
2955
3154
  function RoomView({ room, head, onBack }) {
2956
3155
  const Back = icon("ArrowLeft");
@@ -3006,7 +3205,7 @@ function RoomView({ room, head, onBack }) {
3006
3205
  size: 18
3007
3206
  })), /* @__PURE__ */ React.createElement(RoomHead, {
3008
3207
  room
3009
- })), /* @__PURE__ */ React.createElement(PageLine, {
3208
+ })), /* @__PURE__ */ React.createElement(AppStrip, {
3010
3209
  room
3011
3210
  }), /* @__PURE__ */ React.createElement("div", {
3012
3211
  className: "trm-chat ta-conversation",
@@ -3079,6 +3278,7 @@ function RoomView({ room, head, onBack }) {
3079
3278
  className: "trm-chat-bottom"
3080
3279
  }, /* @__PURE__ */ React.createElement(pi.ui.Composer, {
3081
3280
  placeholder: t("chatPlaceholder"),
3281
+ draft: room.id,
3082
3282
  onSend: say,
3083
3283
  mentions,
3084
3284
  mentionLabel: dt("mentionLabel")
@@ -3164,6 +3364,7 @@ function FriendRow({ friend }) {
3164
3364
  })));
3165
3365
  }
3166
3366
  function FriendsPage() {
3367
+ const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
3167
3368
  const { friends, friendRequests } = useBook();
3168
3369
  const Add = icon("UserPlus");
3169
3370
  if (!rooms()) {
@@ -3191,9 +3392,7 @@ function FriendsPage() {
3191
3392
  size: 14
3192
3393
  }), " ", t("addFriend"))) : /* @__PURE__ */ React.createElement("section", {
3193
3394
  className: "trm-section"
3194
- }, !!friends?.length && /* @__PURE__ */ React.createElement("h3", null, `${t("friends")} · ${friends.length}`), friends === undefined ? pi.ui.Skeleton ? /* @__PURE__ */ React.createElement(pi.ui.Skeleton, {
3195
- rows: 3
3196
- }) : null : /* @__PURE__ */ React.createElement("ul", {
3395
+ }, !!friends?.length && /* @__PURE__ */ React.createElement("h3", null, `${t("friends")} · ${friends.length}`), friends === undefined ? Loading ? /* @__PURE__ */ React.createElement(Loading, null) : null : /* @__PURE__ */ React.createElement("ul", {
3197
3396
  className: "trm-rooms"
3198
3397
  }, friends.map((friend) => /* @__PURE__ */ React.createElement(FriendRow, {
3199
3398
  key: friend.id,
@@ -3241,70 +3440,9 @@ function FriendsEntry() {
3241
3440
  size: 16
3242
3441
  }));
3243
3442
  }
3244
- function AddFriendDialog({ close }) {
3245
- const [link, setLink] = React.useState();
3246
- const [error, setError] = React.useState();
3247
- const [copied, setCopied] = React.useState(false);
3248
- const make = React.useCallback((renew) => {
3249
- setError(undefined);
3250
- setCopied(false);
3251
- rooms()?.friendLink(renew).then(setLink).catch((failure) => setError(message(failure)));
3252
- }, []);
3253
- React.useEffect(() => make(false), [make]);
3254
- const canSend = typeof navigator !== "undefined" && typeof navigator.share === "function";
3255
- const days = link ? Math.max(1, Math.round((link.expiresAt - Date.now()) / 86400000)) : 0;
3256
- const other = (read) => () => {
3257
- close();
3258
- read().then((text) => text && openFriendLink(text));
3259
- };
3260
- return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
3261
- title: t("addFriend"),
3262
- onClose: close
3263
- }, /* @__PURE__ */ React.createElement("div", {
3264
- className: "trm-dialog trm-invite"
3265
- }, link ? /* @__PURE__ */ React.createElement(React.Fragment, null, pi.ui.QrCode && /* @__PURE__ */ React.createElement("div", {
3266
- className: "trm-qr"
3267
- }, /* @__PURE__ */ React.createElement(pi.ui.QrCode, {
3268
- text: link.link,
3269
- label: t("qr")
3270
- })), /* @__PURE__ */ React.createElement("p", {
3271
- className: "trm-hint"
3272
- }, t("addFriendHint")), /* @__PURE__ */ React.createElement("p", {
3273
- className: "trm-hint trm-quiet"
3274
- }, t("addFriendExpires", { days })), /* @__PURE__ */ React.createElement("div", {
3275
- className: "trm-actions trm-center"
3276
- }, /* @__PURE__ */ React.createElement("button", {
3277
- type: "button",
3278
- className: "ta-button ta-primary",
3279
- onClick: () => void navigator.clipboard?.writeText(link.link).then(() => setCopied(true))
3280
- }, copied ? t("copied") : t("copy")), canSend && /* @__PURE__ */ React.createElement("button", {
3281
- type: "button",
3282
- className: "ta-button",
3283
- onClick: () => void navigator.share({ title: t("addFriend"), url: link.link }).catch(() => {
3284
- return;
3285
- })
3286
- }, t("send")), /* @__PURE__ */ React.createElement("button", {
3287
- type: "button",
3288
- className: "ta-button",
3289
- onClick: () => make(true)
3290
- }, t("newLink")))) : error ? /* @__PURE__ */ React.createElement("p", {
3291
- className: "trm-error"
3292
- }, error) : /* @__PURE__ */ React.createElement("p", {
3293
- className: "trm-hint"
3294
- }, t("making")), /* @__PURE__ */ React.createElement("div", {
3295
- className: "trm-actions trm-center trm-friends-other"
3296
- }, pi.ui.scanCode && /* @__PURE__ */ React.createElement("button", {
3297
- type: "button",
3298
- className: "trm-link",
3299
- onClick: other(async () => (await pi.ui.scanCode?.(t("scanHint")))?.trim())
3300
- }, t("scanFriend")), /* @__PURE__ */ React.createElement("button", {
3301
- type: "button",
3302
- className: "trm-link",
3303
- onClick: other(async () => (await pi.ui.input(t("pasteFriend"), t("joinByLinkPlaceholder")))?.trim())
3304
- }, t("pasteFriend")))));
3305
- }
3443
+ var ADD_FRIEND_VIEW = "@celljs/ta-rooms/add-friend";
3306
3444
  function openAddFriend() {
3307
- show(AddFriendDialog);
3445
+ pi.ui.showView(ADD_FRIEND_VIEW);
3308
3446
  }
3309
3447
  function FriendLinkDialog({ text, close }) {
3310
3448
  const link = RelayHubUtil.parse(text);
@@ -3348,9 +3486,6 @@ function FriendLinkDialog({ text, close }) {
3348
3486
  }
3349
3487
  function openFriendLink(text) {
3350
3488
  if (!isFriendLink(text)) {
3351
- if (!RelayHubUtil.is(text)) {
3352
- pi.ui.notify(t("notInvite"), "warning");
3353
- }
3354
3489
  return false;
3355
3490
  }
3356
3491
  show(({ close }) => /* @__PURE__ */ React.createElement(FriendLinkDialog, {
@@ -3359,6 +3494,53 @@ function openFriendLink(text) {
3359
3494
  }));
3360
3495
  return true;
3361
3496
  }
3497
+ function FriendDialog({ id, close }) {
3498
+ const { friends } = useBook();
3499
+ const friend = friends?.find((each) => each.id === id);
3500
+ React.useEffect(() => {
3501
+ if (friends && !friend) {
3502
+ close();
3503
+ }
3504
+ }, [friends, friend, close]);
3505
+ if (!friend) {
3506
+ return null;
3507
+ }
3508
+ const line = friend.status === "adding" ? t("friendAdding") : friend.online ? t("online") : undefined;
3509
+ const remove = () => void confirmThen(t("removeFriendTitle", { name: friend.name }), t("removeFriendHint"), t("removeFriend"), async () => {
3510
+ await rooms()?.removeFriend(friend.id);
3511
+ close();
3512
+ await book.load();
3513
+ });
3514
+ return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
3515
+ title: t("friends"),
3516
+ onClose: close
3517
+ }, /* @__PURE__ */ React.createElement("div", {
3518
+ className: "trm-dialog"
3519
+ }, /* @__PURE__ */ React.createElement("div", {
3520
+ className: "trm-join"
3521
+ }, /* @__PURE__ */ React.createElement(Face, {
3522
+ id: friend.id,
3523
+ name: friend.name,
3524
+ size: 56,
3525
+ online: friend.status === "friend" ? friend.online : undefined
3526
+ }), /* @__PURE__ */ React.createElement("strong", {
3527
+ className: "trm-join-name"
3528
+ }, friend.name), line && /* @__PURE__ */ React.createElement("p", {
3529
+ className: "trm-lead"
3530
+ }, line)), /* @__PURE__ */ React.createElement("div", {
3531
+ className: "trm-actions trm-center"
3532
+ }, /* @__PURE__ */ React.createElement("button", {
3533
+ type: "button",
3534
+ className: "ta-button ta-danger",
3535
+ onClick: remove
3536
+ }, t("removeFriend")))));
3537
+ }
3538
+ function openFriend(id) {
3539
+ show(({ close }) => /* @__PURE__ */ React.createElement(FriendDialog, {
3540
+ id,
3541
+ close
3542
+ }));
3543
+ }
3362
3544
  function FriendRequestsDialog({ close }) {
3363
3545
  const { friendRequests } = useBook();
3364
3546
  const seen = React.useRef(false);
@@ -3562,49 +3744,26 @@ function JoinDialog({ link, text, close }) {
3562
3744
  function InviteDialog({ room, close }) {
3563
3745
  const [link, setLink] = React.useState();
3564
3746
  const [error, setError] = React.useState();
3565
- const [copied, setCopied] = React.useState(false);
3566
3747
  const make = React.useCallback((renew) => {
3567
3748
  setError(undefined);
3568
- setCopied(false);
3569
3749
  rooms()?.invite(room.id, renew ? { renew } : undefined).then((made) => setLink(made.link)).catch((failure) => setError(message(failure)));
3570
3750
  }, [room.id]);
3571
3751
  React.useEffect(() => make(false), [make]);
3572
- const canSend = typeof navigator !== "undefined" && typeof navigator.share === "function";
3573
- return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
3752
+ return /* @__PURE__ */ React.createElement(ShareSheetCompat, {
3753
+ pi,
3574
3754
  title: t("inviteTitle", { title: room.title }),
3755
+ link,
3756
+ error,
3757
+ face: /* @__PURE__ */ React.createElement(RoomFace, {
3758
+ room,
3759
+ size: 44
3760
+ }),
3761
+ name: room.title,
3762
+ gets: t("inviteGets"),
3763
+ notes: [t("inviteHint")],
3764
+ onRenew: () => make(true),
3575
3765
  onClose: close
3576
- }, /* @__PURE__ */ React.createElement("div", {
3577
- className: "trm-dialog trm-invite"
3578
- }, link ? /* @__PURE__ */ React.createElement(React.Fragment, null, pi.ui.QrCode && /* @__PURE__ */ React.createElement("div", {
3579
- className: "trm-qr"
3580
- }, /* @__PURE__ */ React.createElement(pi.ui.QrCode, {
3581
- text: link,
3582
- label: t("qr")
3583
- })), /* @__PURE__ */ React.createElement("p", {
3584
- className: "trm-hint"
3585
- }, t("inviteHint")), /* @__PURE__ */ React.createElement("div", {
3586
- className: "trm-link-box"
3587
- }, link), /* @__PURE__ */ React.createElement("div", {
3588
- className: "trm-actions trm-center"
3589
- }, /* @__PURE__ */ React.createElement("button", {
3590
- type: "button",
3591
- className: "ta-button ta-primary",
3592
- onClick: () => void navigator.clipboard?.writeText(link).then(() => setCopied(true))
3593
- }, copied ? t("copied") : t("copy")), canSend && /* @__PURE__ */ React.createElement("button", {
3594
- type: "button",
3595
- className: "ta-button",
3596
- onClick: () => void navigator.share({ title: room.title, url: link }).catch(() => {
3597
- return;
3598
- })
3599
- }, t("send")), /* @__PURE__ */ React.createElement("button", {
3600
- type: "button",
3601
- className: "ta-button",
3602
- onClick: () => make(true)
3603
- }, t("newLink")))) : error ? /* @__PURE__ */ React.createElement("p", {
3604
- className: "trm-error"
3605
- }, error) : /* @__PURE__ */ React.createElement("p", {
3606
- className: "trm-hint"
3607
- }, t("making"))));
3766
+ });
3608
3767
  }
3609
3768
  function openInvite(room) {
3610
3769
  show(({ close }) => /* @__PURE__ */ React.createElement(InviteDialog, {
@@ -3618,20 +3777,26 @@ function openJoin(text) {
3618
3777
  return;
3619
3778
  }
3620
3779
  const link = RelayHubUtil.parse(text);
3621
- const known = book.get().rooms?.find((room) => room.id === link.room && room.status === "member");
3622
- if (known) {
3623
- if (known.view) {
3624
- pi.ui.showView(known.view);
3780
+ const known = () => book.get().rooms?.find((room) => room.id === link.room && room.status === "member");
3781
+ const go = () => {
3782
+ const room = known();
3783
+ if (!room) {
3784
+ show(({ close }) => /* @__PURE__ */ React.createElement(JoinDialog, {
3785
+ link,
3786
+ text,
3787
+ close
3788
+ }));
3789
+ } else if (room.view) {
3790
+ pi.ui.showView(room.view);
3625
3791
  } else {
3626
- openRoom(known.id);
3792
+ openRoom(room.id);
3627
3793
  }
3628
- return;
3794
+ };
3795
+ if (known()) {
3796
+ go();
3797
+ } else {
3798
+ book.load().then(go, go);
3629
3799
  }
3630
- show(({ close }) => /* @__PURE__ */ React.createElement(JoinDialog, {
3631
- link,
3632
- text,
3633
- close
3634
- }));
3635
3800
  }
3636
3801
  async function createRoom() {
3637
3802
  const name = book.get().identity?.name;
@@ -3655,22 +3820,31 @@ async function pasteLink() {
3655
3820
  if (!text) {
3656
3821
  return;
3657
3822
  }
3658
- if (!RelayHubUtil.is(text)) {
3823
+ await openPasted(text);
3824
+ }
3825
+ async function openPasted(text) {
3826
+ const opened = pi.openLink ? await pi.openLink(text, { onlyTa: true }) : openHub(text);
3827
+ if (opened === false) {
3659
3828
  pi.ui.notify(t("notInvite"), "warning");
3660
- return;
3661
3829
  }
3662
- openJoin(text);
3830
+ }
3831
+ function openHub(text) {
3832
+ if (!RelayHubUtil.is(text)) {
3833
+ return false;
3834
+ }
3835
+ if (isFriendLink(text)) {
3836
+ openFriendLink(text);
3837
+ } else {
3838
+ openJoin(text);
3839
+ }
3840
+ return true;
3663
3841
  }
3664
3842
  async function scanLink() {
3665
3843
  const text = (await pi.ui.scanCode?.(t("scanHint")))?.trim();
3666
3844
  if (!text) {
3667
3845
  return;
3668
3846
  }
3669
- if (!RelayHubUtil.is(text)) {
3670
- pi.ui.notify(t("notInvite"), "warning");
3671
- return;
3672
- }
3673
- openJoin(text);
3847
+ await openPasted(text);
3674
3848
  }
3675
3849
  async function rename() {
3676
3850
  const identity = book.get().identity;
@@ -3684,6 +3858,296 @@ async function rename() {
3684
3858
  }
3685
3859
  }
3686
3860
 
3861
+ // web-src/add-friend-view.tsx
3862
+ var NEARBY_VIEW = "@celljs/ta-nearby/nearby";
3863
+ function MyCodeDialog({ close }) {
3864
+ const [link, setLink] = React.useState();
3865
+ const [error, setError] = React.useState();
3866
+ const { identity } = useBook();
3867
+ const make = React.useCallback((renew) => {
3868
+ setError(undefined);
3869
+ rooms()?.friendLink(renew).then(setLink).catch((failure) => setError(message(failure)));
3870
+ }, []);
3871
+ React.useEffect(() => make(false), [make]);
3872
+ const days = link ? Math.max(1, Math.round((link.expiresAt - Date.now()) / 86400000)) : 0;
3873
+ return /* @__PURE__ */ React.createElement(ShareSheetCompat, {
3874
+ pi,
3875
+ title: t("myCode"),
3876
+ link: link?.link,
3877
+ error,
3878
+ face: identity ? /* @__PURE__ */ React.createElement(Face, {
3879
+ id: identity.id,
3880
+ name: identity.name,
3881
+ size: 44
3882
+ }) : undefined,
3883
+ name: identity?.name,
3884
+ gets: t("myCodeGets"),
3885
+ notes: [link && t("addFriendExpires", { days })],
3886
+ onRenew: () => make(true),
3887
+ onClose: close
3888
+ });
3889
+ }
3890
+ function Way({ name, tint: tint2, title, line, onClick }) {
3891
+ const Icon = icon(name);
3892
+ const Chevron = icon("ChevronRight");
3893
+ return /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("button", {
3894
+ type: "button",
3895
+ className: "trm-add-way",
3896
+ onClick
3897
+ }, /* @__PURE__ */ React.createElement("span", {
3898
+ className: `trm-add-way-icon trm-app-tint-${tint2}`
3899
+ }, /* @__PURE__ */ React.createElement(Icon, {
3900
+ size: 18
3901
+ })), /* @__PURE__ */ React.createElement("span", {
3902
+ className: "trm-row-text"
3903
+ }, /* @__PURE__ */ React.createElement("span", {
3904
+ className: "trm-row-title"
3905
+ }, title), /* @__PURE__ */ React.createElement("span", {
3906
+ className: "trm-row-line"
3907
+ }, line)), /* @__PURE__ */ React.createElement(Chevron, {
3908
+ size: 16
3909
+ })));
3910
+ }
3911
+ function AddFriendPage() {
3912
+ const [text, setText] = React.useState("");
3913
+ const pages = pi.ui.usePages();
3914
+ const nearby = pages.find((page) => page.id === NEARBY_VIEW);
3915
+ const LinkIcon = icon("Link");
3916
+ const QrCode = icon("QrCode");
3917
+ if (!rooms()) {
3918
+ return /* @__PURE__ */ React.createElement(pi.ui.Empty, {
3919
+ title: t("oldApp")
3920
+ });
3921
+ }
3922
+ const submit = (value) => {
3923
+ const link = value.trim();
3924
+ if (link) {
3925
+ setText("");
3926
+ openPasted(link);
3927
+ }
3928
+ };
3929
+ const scan = async () => {
3930
+ const code = (await pi.ui.scanCode?.(t("scanHint")))?.trim();
3931
+ if (code) {
3932
+ openPasted(code);
3933
+ }
3934
+ };
3935
+ return /* @__PURE__ */ React.createElement("div", {
3936
+ className: "trm-list trm-friends-page trm-add"
3937
+ }, /* @__PURE__ */ React.createElement("form", {
3938
+ className: "trm-add-box",
3939
+ onSubmit: (event) => {
3940
+ event.preventDefault();
3941
+ submit(text);
3942
+ }
3943
+ }, /* @__PURE__ */ React.createElement(LinkIcon, {
3944
+ size: 15
3945
+ }), /* @__PURE__ */ React.createElement("input", {
3946
+ value: text,
3947
+ placeholder: t("addFriendPaste"),
3948
+ "aria-label": t("addFriendPaste"),
3949
+ enterKeyHint: "go",
3950
+ onChange: (event) => setText(event.target.value),
3951
+ onPaste: (event) => {
3952
+ const pasted = event.clipboardData.getData("text").trim();
3953
+ if (/^(https?|ta):\/\/\S+$/i.test(pasted)) {
3954
+ event.preventDefault();
3955
+ submit(pasted);
3956
+ }
3957
+ }
3958
+ }), text.trim() && /* @__PURE__ */ React.createElement("button", {
3959
+ type: "submit",
3960
+ className: "trm-link"
3961
+ }, t("addFriendOpen"))), /* @__PURE__ */ React.createElement("button", {
3962
+ type: "button",
3963
+ className: "trm-add-mine",
3964
+ onClick: () => show(MyCodeDialog)
3965
+ }, t("myCode"), /* @__PURE__ */ React.createElement(QrCode, {
3966
+ size: 15
3967
+ })), (pi.ui.scanCode || nearby) && /* @__PURE__ */ React.createElement("ul", {
3968
+ className: "trm-card trm-add-ways"
3969
+ }, pi.ui.scanCode && /* @__PURE__ */ React.createElement(Way, {
3970
+ name: "ScanLine",
3971
+ tint: 0,
3972
+ title: t("scan"),
3973
+ line: t("addFriendScan"),
3974
+ onClick: () => void scan()
3975
+ }), nearby && /* @__PURE__ */ React.createElement(Way, {
3976
+ name: "Radar",
3977
+ tint: 1,
3978
+ title: nearby.title,
3979
+ line: t("addFriendNearby"),
3980
+ onClick: () => void pi.ui.showView(NEARBY_VIEW)
3981
+ })), /* @__PURE__ */ React.createElement("p", {
3982
+ className: "trm-note"
3983
+ }, t("addFriendInGroup")));
3984
+ }
3985
+ function AddFriendHead() {
3986
+ return /* @__PURE__ */ React.createElement("div", {
3987
+ className: "trm-head trm-head-center"
3988
+ }, /* @__PURE__ */ React.createElement("span", {
3989
+ className: "trm-head-title"
3990
+ }, t("addFriend")));
3991
+ }
3992
+
3993
+ // web-src/group-invites.tsx
3994
+ function invitable(room, friends) {
3995
+ const inside = new Set(room.members.map((member) => member.id));
3996
+ return (friends ?? []).filter((friend) => friend.status === "friend" && !inside.has(friend.id));
3997
+ }
3998
+ function FriendPicker({ room, close }) {
3999
+ const { friends } = useBook();
4000
+ const [invited, setInvited] = React.useState([]);
4001
+ const [busy, setBusy] = React.useState();
4002
+ const [error, setError] = React.useState();
4003
+ const list = invitable(room, friends);
4004
+ const Plus = icon("Plus");
4005
+ const Check = icon("Check");
4006
+ const invite = (friend) => {
4007
+ const server = rooms();
4008
+ if (!server?.inviteFriends) {
4009
+ setError(t("inviteFriendsOld"));
4010
+ return;
4011
+ }
4012
+ setBusy(friend.id);
4013
+ setError(undefined);
4014
+ server.inviteFriends(room.id, [friend.id]).then(() => {
4015
+ setInvited((before) => [...before, friend.id]);
4016
+ setBusy(undefined);
4017
+ }, (failure) => {
4018
+ setError(message(failure));
4019
+ setBusy(undefined);
4020
+ });
4021
+ };
4022
+ return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
4023
+ title: t("inviteFriendsTitle", { title: room.title }),
4024
+ onClose: close
4025
+ }, /* @__PURE__ */ React.createElement("div", {
4026
+ className: "trm-dialog"
4027
+ }, /* @__PURE__ */ React.createElement("p", {
4028
+ className: "trm-note"
4029
+ }, t("inviteFriendsLead")), list.length === 0 && /* @__PURE__ */ React.createElement(pi.ui.Empty, {
4030
+ title: t("inviteFriendsNone"),
4031
+ compact: true
4032
+ }), list.length > 0 && /* @__PURE__ */ React.createElement("ul", {
4033
+ className: "trm-rows trm-agent-pick"
4034
+ }, list.map((friend) => {
4035
+ const done = invited.includes(friend.id);
4036
+ return /* @__PURE__ */ React.createElement("li", {
4037
+ key: friend.id
4038
+ }, /* @__PURE__ */ React.createElement("button", {
4039
+ type: "button",
4040
+ className: "trm-member",
4041
+ disabled: done || !!busy,
4042
+ onClick: () => invite(friend)
4043
+ }, /* @__PURE__ */ React.createElement(Face, {
4044
+ id: friend.id,
4045
+ name: friend.name,
4046
+ size: 34
4047
+ }), /* @__PURE__ */ React.createElement("span", {
4048
+ className: "trm-member-text"
4049
+ }, /* @__PURE__ */ React.createElement("span", {
4050
+ className: "trm-member-name trm-ellipsis"
4051
+ }, friend.name), /* @__PURE__ */ React.createElement("span", {
4052
+ className: "trm-member-detail trm-ellipsis"
4053
+ }, done ? t("invitedFriend") : t("friendTag"))), busy === friend.id ? /* @__PURE__ */ React.createElement("span", {
4054
+ className: "ta-spinner"
4055
+ }) : done ? /* @__PURE__ */ React.createElement(Check, {
4056
+ size: 16
4057
+ }) : /* @__PURE__ */ React.createElement(Plus, {
4058
+ size: 16
4059
+ })));
4060
+ })), error && /* @__PURE__ */ React.createElement("p", {
4061
+ className: "trm-error"
4062
+ }, error)));
4063
+ }
4064
+ function openFriendPicker(room) {
4065
+ show(({ close }) => /* @__PURE__ */ React.createElement(FriendPicker, {
4066
+ room,
4067
+ close
4068
+ }));
4069
+ }
4070
+ function InviteDialog2({ invite, close }) {
4071
+ const [busy, setBusy] = React.useState(false);
4072
+ const [error, setError] = React.useState();
4073
+ const answer = (accept) => {
4074
+ setBusy(true);
4075
+ setError(undefined);
4076
+ Promise.resolve(rooms()?.answerGroupInvite?.(invite.room, accept)).then(async () => {
4077
+ await book.load();
4078
+ close();
4079
+ if (accept) {
4080
+ openRoom(invite.room, true);
4081
+ }
4082
+ }).catch((failure) => {
4083
+ setError(message(failure));
4084
+ setBusy(false);
4085
+ });
4086
+ };
4087
+ return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
4088
+ title: t("groupInviteTitle"),
4089
+ onClose: close
4090
+ }, /* @__PURE__ */ React.createElement("div", {
4091
+ className: "trm-dialog"
4092
+ }, /* @__PURE__ */ React.createElement("div", {
4093
+ className: "trm-invite-who"
4094
+ }, /* @__PURE__ */ React.createElement(Face, {
4095
+ id: invite.by.id,
4096
+ name: invite.by.name,
4097
+ size: 44
4098
+ }), /* @__PURE__ */ React.createElement("span", {
4099
+ className: "trm-member-text"
4100
+ }, /* @__PURE__ */ React.createElement("span", {
4101
+ className: "trm-member-name trm-ellipsis"
4102
+ }, invite.title), /* @__PURE__ */ React.createElement("span", {
4103
+ className: "trm-member-detail trm-ellipsis"
4104
+ }, t("groupInviteLine", { name: invite.by.name })))), /* @__PURE__ */ React.createElement("p", {
4105
+ className: "trm-note"
4106
+ }, t("groupInviteNote")), error && /* @__PURE__ */ React.createElement("p", {
4107
+ className: "trm-error"
4108
+ }, error), /* @__PURE__ */ React.createElement("div", {
4109
+ className: "trm-actions"
4110
+ }, /* @__PURE__ */ React.createElement("button", {
4111
+ type: "button",
4112
+ className: "ta-button",
4113
+ disabled: busy,
4114
+ onClick: () => answer(false)
4115
+ }, t("groupInviteIgnore")), /* @__PURE__ */ React.createElement("button", {
4116
+ type: "button",
4117
+ className: "ta-button ta-primary",
4118
+ disabled: busy,
4119
+ onClick: () => answer(true)
4120
+ }, busy ? /* @__PURE__ */ React.createElement("span", {
4121
+ className: "ta-spinner"
4122
+ }) : t("groupInviteJoin")))));
4123
+ }
4124
+ function GroupInviteRow({ invite }) {
4125
+ return /* @__PURE__ */ React.createElement("li", {
4126
+ className: "trm-row"
4127
+ }, /* @__PURE__ */ React.createElement(Face, {
4128
+ id: invite.by.id,
4129
+ name: invite.by.name
4130
+ }), /* @__PURE__ */ React.createElement("div", {
4131
+ className: "trm-row-text"
4132
+ }, /* @__PURE__ */ React.createElement("span", {
4133
+ className: "trm-row-title"
4134
+ }, invite.title), /* @__PURE__ */ React.createElement("span", {
4135
+ className: "trm-row-line"
4136
+ }, t("groupInviteLine", { name: invite.by.name }))), /* @__PURE__ */ React.createElement("div", {
4137
+ className: "trm-answers"
4138
+ }, /* @__PURE__ */ React.createElement("button", {
4139
+ type: "button",
4140
+ className: "ta-button ta-primary",
4141
+ onClick: () => openGroupInvite(invite)
4142
+ }, t("groupInviteJoin"))));
4143
+ }
4144
+ function openGroupInvite(invite) {
4145
+ show(({ close }) => /* @__PURE__ */ React.createElement(InviteDialog2, {
4146
+ invite,
4147
+ close
4148
+ }));
4149
+ }
4150
+
3687
4151
  // web-src/members-view.tsx
3688
4152
  function MemberRow({ room, member }) {
3689
4153
  const Remove = icon("X");
@@ -3758,12 +4222,53 @@ function SettingRow({ label, value, onClick }) {
3758
4222
  size: 15
3759
4223
  }));
3760
4224
  }
4225
+ function AppTiles({ room, apps }) {
4226
+ return /* @__PURE__ */ React.createElement("div", {
4227
+ className: "trm-apps"
4228
+ }, apps.map((app, index) => /* @__PURE__ */ React.createElement("button", {
4229
+ key: app.id,
4230
+ type: "button",
4231
+ className: "trm-app",
4232
+ onClick: () => openApp(room, app)
4233
+ }, /* @__PURE__ */ React.createElement("span", {
4234
+ className: `trm-app-icon trm-app-tint-${index % 3}`
4235
+ }, /* @__PURE__ */ React.createElement(app.icon, {
4236
+ size: 20
4237
+ }), app.attention && /* @__PURE__ */ React.createElement("span", {
4238
+ className: "trm-app-dot"
4239
+ })), /* @__PURE__ */ React.createElement("span", {
4240
+ className: "trm-app-label trm-ellipsis"
4241
+ }, app.label), /* @__PURE__ */ React.createElement("span", {
4242
+ className: `trm-app-status trm-ellipsis${app.attention ? " trm-app-status-on" : ""}`
4243
+ }, app.status ?? ""))));
4244
+ }
4245
+ function SubPage({ title, onBack, children }) {
4246
+ const Back = icon("ArrowLeft");
4247
+ return /* @__PURE__ */ React.createElement("div", {
4248
+ className: "trm-sub"
4249
+ }, /* @__PURE__ */ React.createElement("div", {
4250
+ className: "trm-sub-head"
4251
+ }, /* @__PURE__ */ React.createElement("button", {
4252
+ type: "button",
4253
+ className: "trm-icon",
4254
+ title: t("back"),
4255
+ "aria-label": t("back"),
4256
+ onClick: onBack
4257
+ }, /* @__PURE__ */ React.createElement(Back, {
4258
+ size: 18
4259
+ })), /* @__PURE__ */ React.createElement("span", {
4260
+ className: "trm-sub-title trm-ellipsis"
4261
+ }, title)), /* @__PURE__ */ React.createElement("div", {
4262
+ className: "trm-sub-body"
4263
+ }, children));
4264
+ }
3761
4265
  function MembersView() {
3762
4266
  const { identity } = useBook();
3763
4267
  const room = useOpened();
3764
- const page = usePageOf(room ?? { view: undefined });
3765
4268
  const agents = useAgents(room ?? { status: "gone" });
3766
4269
  const joining = useJoining(room ?? { id: "", status: "gone", members: [] });
4270
+ const { apps } = useRoomApps(room);
4271
+ const { sub } = useBook();
3767
4272
  if (!room) {
3768
4273
  return /* @__PURE__ */ React.createElement("div", {
3769
4274
  className: "trm-panel"
@@ -3771,8 +4276,26 @@ function MembersView() {
3771
4276
  title: t("noRoomOpen")
3772
4277
  }));
3773
4278
  }
4279
+ const pushed = sub?.room === room.id ? sub.app : undefined;
4280
+ const back = () => book.set({ sub: undefined });
4281
+ if (pushed === "doubles") {
4282
+ return /* @__PURE__ */ React.createElement(SubPage, {
4283
+ title: dt("log"),
4284
+ onBack: back
4285
+ }, /* @__PURE__ */ React.createElement(DoublesView, null));
4286
+ }
4287
+ const app = pushed ? apps.find((each) => each.id === pushed && each.page) : undefined;
4288
+ if (app?.page) {
4289
+ return /* @__PURE__ */ React.createElement(SubPage, {
4290
+ title: app.label,
4291
+ onBack: back
4292
+ }, /* @__PURE__ */ React.createElement(app.page, {
4293
+ room
4294
+ }));
4295
+ }
3774
4296
  const Plus = icon("Plus");
3775
4297
  const Bot = icon("Bot");
4298
+ const Contact = icon("Contact");
3776
4299
  const online = room.members.filter((member) => member.online).length;
3777
4300
  const self = room.members.find((member) => member.self)?.member;
3778
4301
  return /* @__PURE__ */ React.createElement("div", {
@@ -3790,11 +4313,30 @@ function MembersView() {
3790
4313
  className: "trm-ellipsis"
3791
4314
  }, room.title), /* @__PURE__ */ React.createElement("span", {
3792
4315
  className: "trm-ellipsis"
3793
- }, room.owner ? t("ownRoom") : t("roomOf", { name: room.ownerName })))), /* @__PURE__ */ React.createElement("div", {
4316
+ }, room.owner ? t("ownRoom") : t("roomOf", { name: room.ownerName })))), apps.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
4317
+ className: "trm-panel-label"
4318
+ }, t("apps")), /* @__PURE__ */ React.createElement(AppTiles, {
4319
+ room,
4320
+ apps
4321
+ })), /* @__PURE__ */ React.createElement("div", {
3794
4322
  className: "trm-panel-label"
3795
4323
  }, t("membersCount", { n: room.members.length, online })), /* @__PURE__ */ React.createElement("ul", {
3796
4324
  className: "trm-panel-members"
3797
- }, room.owner && /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("button", {
4325
+ }, room.owner && !!pi.rooms && /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("button", {
4326
+ type: "button",
4327
+ className: "trm-member trm-member-add",
4328
+ onClick: () => openFriendPicker(room)
4329
+ }, /* @__PURE__ */ React.createElement("span", {
4330
+ className: "trm-member-plus"
4331
+ }, /* @__PURE__ */ React.createElement(Contact, {
4332
+ size: 16
4333
+ })), /* @__PURE__ */ React.createElement("span", {
4334
+ className: "trm-member-text"
4335
+ }, /* @__PURE__ */ React.createElement("span", {
4336
+ className: "trm-member-name"
4337
+ }, t("inviteFriends")), /* @__PURE__ */ React.createElement("span", {
4338
+ className: "trm-member-detail"
4339
+ }, t("inviteFriendsLine"))))), room.owner && /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("button", {
3798
4340
  type: "button",
3799
4341
  className: "trm-member trm-member-add",
3800
4342
  onClick: () => openInvite(room)
@@ -3843,12 +4385,9 @@ function MembersView() {
3843
4385
  room
3844
4386
  }), /* @__PURE__ */ React.createElement(SettingRow, {
3845
4387
  label: dt("log"),
3846
- onClick: () => void pi.ui.showView(DOUBLES_VIEW)
4388
+ onClick: () => book.set({ sub: { room: room.id, app: "doubles" } })
3847
4389
  }), /* @__PURE__ */ React.createElement("div", {
3848
4390
  className: "trm-panel-sep"
3849
- }), page && room.view && /* @__PURE__ */ React.createElement(SettingRow, {
3850
- label: t("openPage", { name: page.title }),
3851
- onClick: () => void pi.ui.showView(room.view)
3852
4391
  }), /* @__PURE__ */ React.createElement(SettingRow, {
3853
4392
  label: t("me"),
3854
4393
  value: identity?.name,
@@ -3862,7 +4401,94 @@ function MembersView() {
3862
4401
  }, room.owner ? t("close") : t("leave"))));
3863
4402
  }
3864
4403
 
4404
+ // web-src/friend-shares.tsx
4405
+ var FriendShares;
4406
+ ((FriendShares) => {
4407
+ let list = [];
4408
+ const listeners = new Set;
4409
+ FriendShares.get = () => list;
4410
+ function subscribe(listener) {
4411
+ listeners.add(listener);
4412
+ return () => listeners.delete(listener);
4413
+ }
4414
+ FriendShares.subscribe = subscribe;
4415
+ async function load() {
4416
+ const server = rooms();
4417
+ if (!server?.listFriendShares) {
4418
+ return;
4419
+ }
4420
+ list = await server.listFriendShares().catch(() => list);
4421
+ for (const listener of listeners) {
4422
+ listener();
4423
+ }
4424
+ }
4425
+ FriendShares.load = load;
4426
+ function start() {
4427
+ load();
4428
+ return pi.onRoomEvent?.((event) => event.type === "rooms" && void load(), { messages: false }) ?? (() => {
4429
+ return;
4430
+ });
4431
+ }
4432
+ FriendShares.start = start;
4433
+ })(FriendShares ||= {});
4434
+ function FriendShareDialog({ share, close }) {
4435
+ const [busy, setBusy] = React.useState(false);
4436
+ const answer = (keep) => {
4437
+ setBusy(true);
4438
+ Promise.resolve(rooms()?.answerFriendShare(share.id, keep)).then(() => {
4439
+ close();
4440
+ if (keep) {
4441
+ pi.openLink?.(share.link);
4442
+ }
4443
+ }).catch((failure) => {
4444
+ pi.ui.notify(message(failure), "error");
4445
+ setBusy(false);
4446
+ });
4447
+ };
4448
+ return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
4449
+ title: t("friendShareTitle", { name: share.by.name }),
4450
+ onClose: close
4451
+ }, /* @__PURE__ */ React.createElement("div", {
4452
+ className: "trm-dialog"
4453
+ }, /* @__PURE__ */ React.createElement("div", {
4454
+ className: "trm-invite-who"
4455
+ }, /* @__PURE__ */ React.createElement(Face, {
4456
+ id: share.by.id,
4457
+ name: share.by.name,
4458
+ size: 44
4459
+ }), /* @__PURE__ */ React.createElement("span", {
4460
+ className: "trm-member-text"
4461
+ }, /* @__PURE__ */ React.createElement("span", {
4462
+ className: "trm-member-name trm-ellipsis"
4463
+ }, share.title || share.link), /* @__PURE__ */ React.createElement("span", {
4464
+ className: "trm-member-detail trm-ellipsis"
4465
+ }, t("friendShareLine", { name: share.by.name })))), /* @__PURE__ */ React.createElement("p", {
4466
+ className: "trm-note"
4467
+ }, t("friendShareNote")), /* @__PURE__ */ React.createElement("div", {
4468
+ className: "trm-actions"
4469
+ }, /* @__PURE__ */ React.createElement("button", {
4470
+ type: "button",
4471
+ className: "ta-button ta-danger",
4472
+ disabled: busy,
4473
+ onClick: () => answer(false)
4474
+ }, t("friendShareDelete")), /* @__PURE__ */ React.createElement("button", {
4475
+ type: "button",
4476
+ className: "ta-button ta-primary",
4477
+ disabled: busy,
4478
+ onClick: () => answer(true)
4479
+ }, t("friendShareOpen")))));
4480
+ }
4481
+ function openFriendShare(share) {
4482
+ show(({ close }) => /* @__PURE__ */ React.createElement(FriendShareDialog, {
4483
+ share,
4484
+ close
4485
+ }));
4486
+ }
4487
+
3865
4488
  // web-src/rooms-page.tsx
4489
+ function partners() {
4490
+ return !!pi.ui.doubleInChats;
4491
+ }
3866
4492
  function plain(text) {
3867
4493
  return text.replace(/```[\s\S]*?(```|$)/g, " ").replace(/[*_~`>#]+/g, "").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\s+/g, " ").trim();
3868
4494
  }
@@ -3936,7 +4562,8 @@ function RoomRow({ room, active, seen, openMenu }) {
3936
4562
  }, preview))));
3937
4563
  }
3938
4564
  function RoomList({ openMenu }) {
3939
- const { identity, rooms: list, requests, opened, seen } = useBook();
4565
+ const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
4566
+ const { identity, rooms: list, requests, groupInvites, opened, seen } = useBook();
3940
4567
  const { asks } = useDoubles();
3941
4568
  const sorted = useSorted(list ?? []);
3942
4569
  return /* @__PURE__ */ React.createElement("div", {
@@ -3948,6 +4575,13 @@ function RoomList({ openMenu }) {
3948
4575
  }, asks.map((ask) => /* @__PURE__ */ React.createElement(AskRow, {
3949
4576
  key: ask.id,
3950
4577
  ask
4578
+ })))), groupInvites.length > 0 && /* @__PURE__ */ React.createElement("section", {
4579
+ className: "trm-section"
4580
+ }, /* @__PURE__ */ React.createElement("h3", null, t("groupInviteTitle")), /* @__PURE__ */ React.createElement("ul", {
4581
+ className: "trm-card"
4582
+ }, groupInvites.map((invite) => /* @__PURE__ */ React.createElement(GroupInviteRow, {
4583
+ key: invite.room,
4584
+ invite
3951
4585
  })))), requests.length > 0 && /* @__PURE__ */ React.createElement("section", {
3952
4586
  className: "trm-section"
3953
4587
  }, /* @__PURE__ */ React.createElement("h3", null, t("requests")), /* @__PURE__ */ React.createElement("ul", {
@@ -3957,9 +4591,7 @@ function RoomList({ openMenu }) {
3957
4591
  request
3958
4592
  })))), /* @__PURE__ */ React.createElement("section", {
3959
4593
  className: "trm-section"
3960
- }, /* @__PURE__ */ React.createElement("h3", null, t("roomsTitle")), list === undefined ? pi.ui.Skeleton ? /* @__PURE__ */ React.createElement(pi.ui.Skeleton, {
3961
- rows: 3
3962
- }) : null : sorted.length === 0 ? /* @__PURE__ */ React.createElement(pi.ui.Empty, {
4594
+ }, /* @__PURE__ */ React.createElement("h3", null, t("roomsTitle")), list === undefined ? Loading ? /* @__PURE__ */ React.createElement(Loading, null) : null : sorted.length === 0 ? /* @__PURE__ */ React.createElement(pi.ui.Empty, {
3963
4595
  compact: true,
3964
4596
  title: t("emptyTitle"),
3965
4597
  hint: t("emptyListHint")
@@ -4007,6 +4639,13 @@ function RoomsHead() {
4007
4639
  }, /* @__PURE__ */ React.createElement(Plus, {
4008
4640
  size: 18
4009
4641
  }));
4642
+ if (partners() && (!compact || opened)) {
4643
+ return /* @__PURE__ */ React.createElement("div", {
4644
+ className: "trm-head"
4645
+ }, opened && /* @__PURE__ */ React.createElement(RoomHead, {
4646
+ room: opened
4647
+ }));
4648
+ }
4010
4649
  if (compact && opened && (pi.ui.Stack || book.get().direct)) {
4011
4650
  return /* @__PURE__ */ React.createElement("div", {
4012
4651
  className: "trm-head"
@@ -4064,6 +4703,15 @@ function RoomsPage() {
4064
4703
  openMenu
4065
4704
  });
4066
4705
  const close = () => book.set({ opened: undefined });
4706
+ if (partners() && (!compact || opened)) {
4707
+ return opened ? /* @__PURE__ */ React.createElement(RoomView, {
4708
+ key: opened.id,
4709
+ room: opened,
4710
+ head: false
4711
+ }) : /* @__PURE__ */ React.createElement(pi.ui.Empty, {
4712
+ title: t("pickRoom")
4713
+ });
4714
+ }
4067
4715
  if (!compact) {
4068
4716
  return /* @__PURE__ */ React.createElement("div", {
4069
4717
  className: "trm-split"
@@ -4125,12 +4773,16 @@ function homeFace(id) {
4125
4773
  }
4126
4774
 
4127
4775
  class RoomsHome {
4776
+ partners;
4128
4777
  current = [];
4129
4778
  signature = "";
4130
4779
  shown = true;
4131
4780
  listeners = new Set;
4132
4781
  chats = new Map;
4133
4782
  faces = new Map;
4783
+ constructor(partners2 = false) {
4784
+ this.partners = partners2;
4785
+ }
4134
4786
  items = () => this.current;
4135
4787
  subscribe = (listener) => {
4136
4788
  this.listeners.add(listener);
@@ -4138,11 +4790,19 @@ class RoomsHome {
4138
4790
  };
4139
4791
  start() {
4140
4792
  const stopBook = book.subscribe(() => this.refresh());
4793
+ const stopShares = this.partners ? FriendShares.subscribe(() => this.refresh()) : () => {
4794
+ return;
4795
+ };
4796
+ const stopSharesLoad = this.partners ? FriendShares.start() : () => {
4797
+ return;
4798
+ };
4141
4799
  const stopStorage = pi.storage.onChange((keys) => keys.includes(HOME_KEY) && this.readShown());
4142
4800
  this.readShown();
4143
4801
  this.refresh();
4144
4802
  return () => {
4145
4803
  stopBook();
4804
+ stopShares();
4805
+ stopSharesLoad();
4146
4806
  stopStorage();
4147
4807
  for (const stop of this.chats.values()) {
4148
4808
  stop();
@@ -4159,16 +4819,33 @@ class RoomsHome {
4159
4819
  });
4160
4820
  }
4161
4821
  refresh() {
4162
- const { rooms: rooms2 = [], seen } = book.get();
4163
- const joined = this.shown ? rooms2.filter((room) => room.status === "member") : [];
4822
+ const { rooms: rooms2 = [], seen, friends, friendRequests, requests, groupInvites } = book.get();
4823
+ const sent = this.partners ? FriendShares.get() : [];
4824
+ const joined = this.shown || this.partners ? rooms2.filter((room) => room.status === "member") : [];
4164
4825
  this.follow(joined);
4165
4826
  const rows = joined.map((room) => ({ room, lines: book.chat(room.id)?.lines ?? [] })).sort((a, b) => lastAt(b.room) - lastAt(a.room));
4166
- const signature = rows.map(({ room, lines }) => [room.id, room.title, lines.at(-1)?.id ?? "", unseen(room, lines, seen) ? 1 : 0, room.connected ? 1 : 0, room.members.length].join(":")).join("|");
4827
+ const signature = [
4828
+ this.partners ? [
4829
+ ...(friends ?? []).map((friend) => [friend.id, friend.name, friend.look, friend.status, friend.online ? 1 : 0].join("/")),
4830
+ ...friendRequests.map((request) => request.id),
4831
+ ...requests.map((request) => `${request.room}/${request.ask}`),
4832
+ ...groupInvites.map((invite) => invite.room),
4833
+ ...sent.map((share) => `${share.id}/${share.seen ? 1 : 0}`)
4834
+ ].join(",") : "",
4835
+ ...rows.map(({ room, lines }) => [room.id, room.title, lines.at(-1)?.id ?? "", unseen(room, lines, seen) ? 1 : 0, room.connected ? 1 : 0, room.members.length].join(":"))
4836
+ ].join("|");
4167
4837
  if (signature === this.signature) {
4168
4838
  return;
4169
4839
  }
4170
4840
  this.signature = signature;
4171
- this.current = rows.map(({ room, lines }) => this.item(room, lines, unseen(room, lines, seen)));
4841
+ this.current = [
4842
+ ...this.partners ? friendRequests.map((request) => this.askingFriend(request)) : [],
4843
+ ...this.partners ? requests.map((request) => this.asking(request)) : [],
4844
+ ...this.partners ? groupInvites.map((invite) => this.invited(invite)) : [],
4845
+ ...sent.map((share) => this.sharedBy(share)),
4846
+ ...rows.map(({ room, lines }) => this.item(room, lines, unseen(room, lines, seen))),
4847
+ ...this.partners ? (friends ?? []).map((friend) => this.friend(friend)) : []
4848
+ ];
4172
4849
  for (const listener of this.listeners) {
4173
4850
  listener();
4174
4851
  }
@@ -4186,11 +4863,98 @@ class RoomsHome {
4186
4863
  icon: icon("Users"),
4187
4864
  face,
4188
4865
  section: t("roomsTitle"),
4866
+ ...this.partners ? { place: "groups" } : {},
4189
4867
  at: lastAt(room),
4190
4868
  unseen: fresh,
4191
4869
  open: () => openRoom(room.id, true)
4192
4870
  };
4193
4871
  }
4872
+ askingFriend(request) {
4873
+ return {
4874
+ id: `friend-request:${request.id}`,
4875
+ title: request.name,
4876
+ detail: request.via === "room" && request.room ? t("friendRequestRoom", { room: request.room }) : t("friendRequestLink"),
4877
+ icon: icon("UserPlus"),
4878
+ face: ({ size }) => /* @__PURE__ */ React.createElement(Face, {
4879
+ id: request.id,
4880
+ name: request.name,
4881
+ size
4882
+ }),
4883
+ unseen: true,
4884
+ at: request.at,
4885
+ place: "partners",
4886
+ open: openFriendRequests
4887
+ };
4888
+ }
4889
+ friend(friend) {
4890
+ const online = friend.status === "friend" ? friend.online : undefined;
4891
+ return {
4892
+ id: `friend:${friend.id}`,
4893
+ title: friend.name,
4894
+ ...friend.status === "adding" ? { detail: t("friendAdding") } : {},
4895
+ icon: icon("Contact"),
4896
+ face: ({ size }) => /* @__PURE__ */ React.createElement(Face, {
4897
+ id: friend.id,
4898
+ name: friend.name,
4899
+ size,
4900
+ online
4901
+ }),
4902
+ section: t("friends"),
4903
+ place: "partners",
4904
+ open: () => openFriend(friend.id)
4905
+ };
4906
+ }
4907
+ asking(request) {
4908
+ return {
4909
+ id: `request:${request.room}:${request.ask}`,
4910
+ title: request.name,
4911
+ detail: t("requestLine", { title: request.title }),
4912
+ icon: icon("UserPlus"),
4913
+ face: ({ size }) => /* @__PURE__ */ React.createElement(Face, {
4914
+ id: request.id,
4915
+ name: request.name,
4916
+ size
4917
+ }),
4918
+ unseen: true,
4919
+ at: request.at,
4920
+ place: "groups",
4921
+ open: openRequests
4922
+ };
4923
+ }
4924
+ invited(invite) {
4925
+ return {
4926
+ id: `invite:${invite.room}`,
4927
+ title: invite.title,
4928
+ detail: t("groupInviteLine", { name: invite.by.name }),
4929
+ icon: icon("MessagesSquare"),
4930
+ face: ({ size }) => /* @__PURE__ */ React.createElement(Face, {
4931
+ id: invite.by.id,
4932
+ name: invite.by.name,
4933
+ size
4934
+ }),
4935
+ unseen: true,
4936
+ at: invite.at,
4937
+ place: "groups",
4938
+ open: () => openGroupInvite(invite)
4939
+ };
4940
+ }
4941
+ sharedBy(share) {
4942
+ return {
4943
+ id: `share:${share.id}`,
4944
+ title: share.by.name,
4945
+ detail: t("friendShareRow", { title: share.title || share.link }),
4946
+ icon: icon("Send"),
4947
+ face: ({ size }) => /* @__PURE__ */ React.createElement(Face, {
4948
+ id: share.by.id,
4949
+ name: share.by.name,
4950
+ size
4951
+ }),
4952
+ unseen: !share.seen,
4953
+ at: share.at,
4954
+ place: "partners",
4955
+ open: () => openFriendShare(share)
4956
+ };
4957
+ }
4194
4958
  follow(joined) {
4195
4959
  const ids = new Set(joined.map((room) => room.id));
4196
4960
  for (const [id, stop] of this.chats) {
@@ -4249,6 +5013,7 @@ function roomsSettings() {
4249
5013
  return {
4250
5014
  title: () => t("roomsTitle"),
4251
5015
  icon: icon("Users"),
5016
+ group: "general",
4252
5017
  rows: [{ key: "home", label: () => t("showOnHome"), description: () => t("showOnHomeHint"), render: HomeSwitch }]
4253
5018
  };
4254
5019
  }
@@ -4269,7 +5034,7 @@ var STYLE = `
4269
5034
  .trm-head-room { flex: 1; min-width: 0; display: flex; align-items: center; padding-left: 20px; }
4270
5035
  /* The list, as the sidebar of the double: faces, a name and when, a line under it */
4271
5036
  .trm-page { flex: 1; min-height: 0; height: 100%; overflow-y: auto; overscroll-behavior: none; }
4272
- .trm-page > .trm-list { max-width: 720px; margin: 0 auto; }
5037
+ .trm-page > .trm-list { max-width: var(--ta-page-width); margin: 0 auto; }
4273
5038
  .trm-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 10px calc(24px + env(safe-area-inset-bottom)); box-sizing: border-box; }
4274
5039
  .trm-section h3 { display: flex; align-items: center; height: 30px; margin: 0; padding: 0 10px; font-size: calc(12px * var(--ta-font-scale)); font-weight: 500; letter-spacing: 0.02em; color: var(--ta-muted); }
4275
5040
  .trm-card { margin: 0; padding: 2px 6px; list-style: none; border-radius: 14px; background: var(--ta-raised); }
@@ -4334,6 +5099,32 @@ var STYLE = `
4334
5099
  .trm-page-line-icon { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--ta-tint-3); color: var(--ta-tint-ink-3); }
4335
5100
  .trm-page-line-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-secondary); }
4336
5101
  .trm-page-line-open { display: inline-flex; align-items: center; gap: 2px; flex: none; color: var(--ta-link); font-weight: 500; }
5102
+ .trm-page-line-chevron { display: inline-flex; flex: none; color: var(--ta-muted); }
5103
+ /* Several apps tell something at once: a row of chips that scrolls sideways, never lines stacked over the chat */
5104
+ .trm-app-chips { flex: none; display: flex; gap: 6px; width: calc(100% - 48px); max-width: var(--ta-col); margin: 8px auto 0; overflow-x: auto; scrollbar-width: none; }
5105
+ .trm-app-chips::-webkit-scrollbar { display: none; }
5106
+ .trm-app-chip { display: inline-flex; align-items: center; gap: 6px; flex: none; max-width: 240px; min-height: 30px; padding: 0 12px; border: 1px solid var(--ta-border-muted); border-radius: 999px; background: var(--ta-side); color: var(--ta-secondary); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); cursor: pointer; }
5107
+ .trm-app-chip:hover { background: var(--ta-hover); }
5108
+ .trm-app-chip > svg { flex: none; color: var(--ta-muted); }
5109
+ /* The apps of a room in its panel: tiles, as the apps of a group */
5110
+ .trm-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 2px; padding: 0 2px 4px; }
5111
+ .trm-app { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 10px 4px 8px; border: 0; border-radius: 12px; background: none; color: var(--ta-text); font: inherit; cursor: pointer; }
5112
+ .trm-app:hover { background: var(--ta-hover); }
5113
+ .trm-app-icon { position: relative; display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 2px; border-radius: 12px; }
5114
+ .trm-app-tint-0 { background: var(--ta-tint-3); color: var(--ta-tint-ink-3); }
5115
+ .trm-app-tint-1 { background: var(--ta-tint-5); color: var(--ta-tint-ink-5); }
5116
+ .trm-app-tint-2 { background: var(--ta-tint-0); color: var(--ta-tint-ink-0); }
5117
+ .trm-app-dot { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--ta-link); box-shadow: 0 0 0 2px var(--ta-main); }
5118
+ .trm-app-label { max-width: 100%; font-size: calc(12.5px * var(--ta-font-scale)); }
5119
+ .trm-app-status { max-width: 100%; min-height: calc(15px * var(--ta-font-scale)); color: var(--ta-muted); font-size: calc(11px * var(--ta-font-scale)); line-height: calc(15px * var(--ta-font-scale)); }
5120
+ .trm-app-status-on { color: var(--ta-link); }
5121
+ /* A page pushed in the panel of the room */
5122
+ .trm-sub { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--ta-main); color: var(--ta-text); animation: trm-sub-in 180ms ease-out; }
5123
+ .trm-sub-head { display: flex; align-items: center; gap: 4px; flex: none; height: 44px; padding: 0 8px; border-bottom: 1px solid var(--ta-border-muted); }
5124
+ .trm-sub-title { font-weight: 600; font-size: calc(14px * var(--ta-font-scale)); }
5125
+ .trm-sub-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
5126
+ .trm-sub-body > * { flex: 1; min-height: 0; height: auto; }
5127
+ @keyframes trm-sub-in { from { transform: translateX(20px); opacity: 0; } }
4337
5128
  .trm-chat { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overflow-anchor: none; overscroll-behavior: none; }
4338
5129
  .trm-chat-col { position: relative; display: flex; flex-direction: column; gap: 4px; max-width: calc(var(--ta-col) + 48px); margin: 0 auto; padding: 20px 24px 12px; box-sizing: border-box; }
4339
5130
  .trm-chat-time { align-self: center; margin: 14px 0 6px; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
@@ -4375,8 +5166,8 @@ button.trm-member { cursor: pointer; }
4375
5166
  .trm-setting { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; }
4376
5167
  .trm-setting:hover { background: var(--ta-hover); }
4377
5168
  .trm-setting > svg { flex: none; color: var(--ta-muted); }
4378
- .trm-setting-label { flex: none; }
4379
- .trm-setting-value { flex: 1; text-align: right; color: var(--ta-muted); }
5169
+ .trm-setting-label { flex: 1; min-width: 0; }
5170
+ .trm-setting-value { flex: none; max-width: 55%; text-align: right; color: var(--ta-muted); }
4380
5171
  .trm-panel-foot { display: flex; justify-content: center; flex: none; padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--ta-border-muted); }
4381
5172
  .trm-panel-foot .trm-link { width: 100%; min-height: 36px; border-radius: 10px; font-weight: 500; }
4382
5173
  /* Dialogs */
@@ -4392,10 +5183,10 @@ button.trm-member { cursor: pointer; }
4392
5183
  .trm-hint { text-align: center; color: var(--ta-secondary); }
4393
5184
  .trm-error { margin: 0; color: var(--ta-red); font-size: calc(12.5px * var(--ta-font-scale)); }
4394
5185
  .trm-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
5186
+ .trm-invite-who { display: flex; align-items: center; gap: 12px; }
4395
5187
  .trm-center { justify-content: center; }
4396
5188
  .trm-join { display: flex; align-items: center; gap: 12px; }
4397
- .trm-friends-page { max-width: 720px; margin: 0 auto; width: 100%; overflow-y: auto; height: 100%; }
4398
- .trm-friends-other { gap: 18px; padding-top: 4px; }
5189
+ .trm-friends-page { max-width: var(--ta-page-width); margin: 0 auto; width: 100%; overflow-y: auto; height: 100%; }
4399
5190
  .trm-friends-entry { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--ta-surface, transparent); color: inherit; font: inherit; cursor: pointer; text-align: left; }
4400
5191
  @media (hover: hover) { .trm-friends-entry:hover { background: var(--ta-hover); } }
4401
5192
  .trm-friends-entry-label { font-weight: 500; }
@@ -4404,10 +5195,17 @@ button.trm-member { cursor: pointer; }
4404
5195
  .trm-join-name { font-size: calc(15px * var(--ta-font-scale)); }
4405
5196
  .trm-dialog .trm-join:has(.trm-join-name) { flex-direction: column; text-align: center; gap: 8px; }
4406
5197
  .trm-member-friend { color: var(--ta-muted); }
4407
- .trm-invite { align-items: stretch; }
4408
- .trm-qr { align-self: center; width: 188px; padding: 10px; border-radius: 14px; background: #fff; border: 1px solid var(--ta-border-muted); }
4409
- .trm-qr svg { display: block; width: 100%; height: auto; }
4410
- .trm-link-box { padding: 8px 10px; border-radius: 8px; background: var(--ta-code); font-family: var(--ta-mono); font-size: calc(11.5px * var(--ta-font-scale)); color: var(--ta-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
5198
+ /* Add friend (AddFriendPage): the box for a link, the user's code under it, the ways as rows of a card */
5199
+ .trm-add { gap: 12px; padding-top: 10px; }
5200
+ .trm-add > .trm-note { padding: 0 8px; }
5201
+ .trm-add-box { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 12px; border-radius: 10px; background: var(--ta-raised); color: var(--ta-muted); }
5202
+ .trm-add-box input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: none; color: var(--ta-text); font: inherit; }
5203
+ .trm-add-mine { align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 0; border-radius: 8px; background: none; color: var(--ta-secondary); font: inherit; font-size: calc(13px * var(--ta-font-scale)); cursor: pointer; }
5204
+ .trm-add-ways > li + li { border-top: 1px solid var(--ta-border-muted); }
5205
+ .trm-add-way { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 6px; border: 0; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
5206
+ .trm-add-way > svg:last-child { flex: none; color: var(--ta-muted); }
5207
+ .trm-add-way-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; }
5208
+ @media (hover: hover) { .trm-add-mine:hover { background: var(--ta-hover); } .trm-add-way:hover { border-radius: 10px; background: var(--ta-hover); } }
4411
5209
  .trm-dialog .trm-row { padding: 8px 0; }
4412
5210
  /* The doubles (docs/design/ta-link.md 4): what a double says, its permissions, its log */
4413
5211
  .trm-tag-double { margin-left: 6px; background: var(--ta-tint-3); color: var(--ta-tint-ink-3); }
@@ -4467,9 +5265,9 @@ button.trm-member { cursor: pointer; }
4467
5265
  [data-layout='compact'] .trm-faces.trm-on-icon, [data-layout='compact'] .trm-faces.trm-on-icon .trm-faces-one { background: none; }
4468
5266
  [data-layout='compact'] .trm-chat-col, [data-layout='compact'] .trm-chat-bottom { padding-left: 12px; padding-right: 12px; }
4469
5267
  [data-layout='compact'] .trm-msg-col { max-width: calc(100% - 40px); }
4470
- [data-layout='compact'] .trm-page-line { width: calc(100% - 24px); }
5268
+ [data-layout='compact'] .trm-page-line, [data-layout='compact'] .trm-app-chips { width: calc(100% - 24px); }
4471
5269
  @media (max-width: 480px) { .trm-answers .ta-button { padding-left: 10px; padding-right: 10px; } }
4472
- @media (prefers-reduced-motion: reduce) { .trm-room, .trm-page-line { transition: none; } }
5270
+ @media (prefers-reduced-motion: reduce) { .trm-room, .trm-page-line { transition: none; } .trm-sub { animation: none; } }
4473
5271
  `;
4474
5272
  function injectStyle() {
4475
5273
  const element = document.createElement("style");
@@ -4506,8 +5304,25 @@ function activate(pi2) {
4506
5304
  bind(pi2.React);
4507
5305
  bindPage(pi2);
4508
5306
  const removeStyle = injectStyle();
4509
- pi2.registerView("rooms", { title: () => t("roomsTitle"), icon: icon("Users"), render: RoomsPage, head: RoomsHead, discover: true, order: 81 });
4510
- pi2.registerView("friends", { title: () => t("friends"), icon: icon("Contact"), render: FriendsPage, head: FriendsHead, discover: true, order: 79 });
5307
+ const partners2 = !!pi2.ui.doubleInChats;
5308
+ const place = partners2 ? { navigation: false } : { group: "people" };
5309
+ pi2.registerView("rooms", {
5310
+ title: () => t("roomsTitle"),
5311
+ icon: icon("Users"),
5312
+ render: RoomsPage,
5313
+ head: RoomsHead,
5314
+ ...place,
5315
+ order: 81
5316
+ });
5317
+ pi2.registerView("friends", {
5318
+ title: () => t("friends"),
5319
+ icon: icon("Contact"),
5320
+ render: FriendsPage,
5321
+ head: FriendsHead,
5322
+ ...place,
5323
+ order: 79
5324
+ });
5325
+ pi2.registerView("add-friend", { title: () => t("addFriend"), icon: icon("UserPlus"), render: AddFriendPage, head: AddFriendHead, navigation: false });
4511
5326
  pi2.registerView("members", { title: () => t("membersTitle"), icon: icon("Users"), render: MembersView, location: "panel", order: 90 });
4512
5327
  pi2.registerView(DOUBLES_VIEW.slice(DOUBLES_VIEW.lastIndexOf("/") + 1), {
4513
5328
  title: () => dt("logTitle"),
@@ -4516,8 +5331,10 @@ function activate(pi2) {
4516
5331
  location: "panel",
4517
5332
  order: 91
4518
5333
  });
4519
- pi2.registerSettings(roomsSettings());
4520
- const home = new RoomsHome;
5334
+ if (!partners2) {
5335
+ pi2.registerSettings(roomsSettings());
5336
+ }
5337
+ const home = new RoomsHome(partners2);
4521
5338
  const stopHome = pi2.rooms ? home.start() : () => {
4522
5339
  return;
4523
5340
  };