@songsid/agend 2.4.0-beta.20 → 2.4.0-beta.22

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.
Files changed (256) hide show
  1. package/dist/agent-cli-instructions.md +1 -1
  2. package/dist/backend/claude-carry.d.ts +11 -0
  3. package/dist/backend/claude-carry.js +88 -6
  4. package/dist/backend/claude-carry.js.map +1 -1
  5. package/dist/backend/claude-code.js +3 -0
  6. package/dist/backend/claude-code.js.map +1 -1
  7. package/dist/build-provenance.json +1 -1
  8. package/dist/cache-ledger.d.ts +23 -21
  9. package/dist/cache-ledger.js +70 -6
  10. package/dist/cache-ledger.js.map +1 -1
  11. package/dist/cache-prices.d.ts +8 -6
  12. package/dist/cache-prices.js +12 -5
  13. package/dist/cache-prices.js.map +1 -1
  14. package/dist/cache-service.d.ts +9 -5
  15. package/dist/cache-service.js +202 -50
  16. package/dist/cache-service.js.map +1 -1
  17. package/dist/channel/mcp-tools.js +6 -4
  18. package/dist/channel/mcp-tools.js.map +1 -1
  19. package/dist/cli-audited.js +2 -1
  20. package/dist/cli-audited.js.map +1 -1
  21. package/dist/cli.js +4 -1
  22. package/dist/cli.js.map +1 -1
  23. package/dist/contact-auth-policy.js +1 -1
  24. package/dist/contact-auth-policy.js.map +1 -1
  25. package/dist/contact-auth-service.js +8 -2
  26. package/dist/contact-auth-service.js.map +1 -1
  27. package/dist/contact-auth-store.d.ts +3 -0
  28. package/dist/contact-auth-store.js +34 -8
  29. package/dist/contact-auth-store.js.map +1 -1
  30. package/dist/contact-auth-types.d.ts +3 -2
  31. package/dist/contact-auth-types.js.map +1 -1
  32. package/dist/contact-change-proposals.d.ts +47 -0
  33. package/dist/contact-change-proposals.js +132 -0
  34. package/dist/contact-change-proposals.js.map +1 -0
  35. package/dist/daemon.d.ts +31 -0
  36. package/dist/daemon.js +149 -2
  37. package/dist/daemon.js.map +1 -1
  38. package/dist/delivery-outbox.d.ts +10 -0
  39. package/dist/delivery-outbox.js +21 -0
  40. package/dist/delivery-outbox.js.map +1 -1
  41. package/dist/fleet-manager.d.ts +65 -1
  42. package/dist/fleet-manager.js +338 -20
  43. package/dist/fleet-manager.js.map +1 -1
  44. package/dist/general-knowledge/skills/concepts/SKILL.md +2 -1
  45. package/dist/general-knowledge/skills/hub/SKILL.md +45 -5
  46. package/dist/general-knowledge/skills/task-board/SKILL.md +4 -0
  47. package/dist/general-knowledge/skills/web-appearance/SKILL.md +1 -1
  48. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -6
  49. package/dist/hub/agent-pictures-model.d.ts +275 -0
  50. package/dist/hub/agent-pictures-model.js +103 -0
  51. package/dist/hub/agent-pictures-model.js.map +1 -0
  52. package/dist/hub/agent-pictures.d.ts +64 -0
  53. package/dist/hub/agent-pictures.js +255 -0
  54. package/dist/hub/agent-pictures.js.map +1 -0
  55. package/dist/hub/client.d.ts +4 -0
  56. package/dist/hub/client.js +23 -2
  57. package/dist/hub/client.js.map +1 -1
  58. package/dist/hub/compose/member.d.ts +14 -3
  59. package/dist/hub/compose/member.js +46 -10
  60. package/dist/hub/compose/member.js.map +1 -1
  61. package/dist/hub/compose/server.d.ts +6 -5
  62. package/dist/hub/compose/server.js +7 -3
  63. package/dist/hub/compose/server.js.map +1 -1
  64. package/dist/hub/direct-posts-model.d.ts +1 -0
  65. package/dist/hub/direct-posts-model.js +2 -0
  66. package/dist/hub/direct-posts-model.js.map +1 -0
  67. package/dist/hub/direct-posts.d.ts +36 -0
  68. package/dist/hub/direct-posts.js +145 -0
  69. package/dist/hub/direct-posts.js.map +1 -0
  70. package/dist/hub/http/compose.d.ts +5 -0
  71. package/dist/hub/http/compose.js +158 -20
  72. package/dist/hub/http/compose.js.map +1 -1
  73. package/dist/hub/http/core.d.ts +9 -1
  74. package/dist/hub/http/core.js +21 -1
  75. package/dist/hub/http/core.js.map +1 -1
  76. package/dist/hub/http/deps.d.ts +1 -0
  77. package/dist/hub/http/schema.js +7 -0
  78. package/dist/hub/http/schema.js.map +1 -1
  79. package/dist/hub/init/text.js +1 -1
  80. package/dist/hub/join/service.d.ts +2 -0
  81. package/dist/hub/join/service.js +7 -3
  82. package/dist/hub/join/service.js.map +1 -1
  83. package/dist/hub/member/agent-pictures.d.ts +76 -0
  84. package/dist/hub/member/agent-pictures.js +196 -0
  85. package/dist/hub/member/agent-pictures.js.map +1 -0
  86. package/dist/hub/member/direct-rooms.d.ts +9 -0
  87. package/dist/hub/member/direct-rooms.js +14 -0
  88. package/dist/hub/member/direct-rooms.js.map +1 -0
  89. package/dist/hub/member/room-ask.d.ts +22 -1
  90. package/dist/hub/member/room-ask.js +99 -5
  91. package/dist/hub/member/room-ask.js.map +1 -1
  92. package/dist/hub/member/room-asker-store.d.ts +48 -0
  93. package/dist/hub/member/room-asker-store.js +181 -0
  94. package/dist/hub/member/room-asker-store.js.map +1 -0
  95. package/dist/hub/member/room-post.d.ts +11 -10
  96. package/dist/hub/member/room-post.js +51 -7
  97. package/dist/hub/member/room-post.js.map +1 -1
  98. package/dist/hub/policy.d.ts +11 -2
  99. package/dist/hub/policy.js +60 -7
  100. package/dist/hub/policy.js.map +1 -1
  101. package/dist/hub/protocol.d.ts +254 -1
  102. package/dist/hub/protocol.js +20 -8
  103. package/dist/hub/protocol.js.map +1 -1
  104. package/dist/hub/representative.d.ts +38 -0
  105. package/dist/hub/representative.js +140 -12
  106. package/dist/hub/representative.js.map +1 -1
  107. package/dist/hub/room-asker-identity-model.d.ts +53 -0
  108. package/dist/hub/room-asker-identity-model.js +14 -0
  109. package/dist/hub/room-asker-identity-model.js.map +1 -0
  110. package/dist/hub/room-asker-identity.d.ts +22 -0
  111. package/dist/hub/room-asker-identity.js +43 -0
  112. package/dist/hub/room-asker-identity.js.map +1 -0
  113. package/dist/hub/rooms/agents.d.ts +2 -0
  114. package/dist/hub/rooms/agents.js +30 -3
  115. package/dist/hub/rooms/agents.js.map +1 -1
  116. package/dist/hub/rooms/asker-identity.d.ts +21 -0
  117. package/dist/hub/rooms/asker-identity.js +86 -0
  118. package/dist/hub/rooms/asker-identity.js.map +1 -0
  119. package/dist/hub/rooms/direct-view.d.ts +3 -2
  120. package/dist/hub/rooms/direct-view.js +23 -8
  121. package/dist/hub/rooms/direct-view.js.map +1 -1
  122. package/dist/hub/rooms/office.d.ts +27 -0
  123. package/dist/hub/rooms/office.js +12 -2
  124. package/dist/hub/rooms/office.js.map +1 -1
  125. package/dist/hub/rooms/service.d.ts +38 -1
  126. package/dist/hub/rooms/service.js +56 -3
  127. package/dist/hub/rooms/service.js.map +1 -1
  128. package/dist/hub/rooms/types.d.ts +5 -2
  129. package/dist/hub/rooms.d.ts +9 -0
  130. package/dist/hub/rooms.js +97 -26
  131. package/dist/hub/rooms.js.map +1 -1
  132. package/dist/hub/runtime.d.ts +1 -1
  133. package/dist/hub/server.js +24 -2
  134. package/dist/hub/server.js.map +1 -1
  135. package/dist/hub/session-directory-transition.d.ts +1 -0
  136. package/dist/hub/session-directory-transition.js +15 -9
  137. package/dist/hub/session-directory-transition.js.map +1 -1
  138. package/dist/hub/session-limits.d.ts +58 -0
  139. package/dist/hub/session-limits.js +121 -0
  140. package/dist/hub/session-limits.js.map +1 -0
  141. package/dist/hub/sessions.d.ts +1 -1
  142. package/dist/hub/sessions.js +13 -7
  143. package/dist/hub/sessions.js.map +1 -1
  144. package/dist/hub/settings-directory-decision.js +1 -1
  145. package/dist/hub/settings-directory-decision.js.map +1 -1
  146. package/dist/hub/types.d.ts +9 -2
  147. package/dist/hub-character-plan.d.ts +47 -0
  148. package/dist/hub-character-plan.js +70 -0
  149. package/dist/hub-character-plan.js.map +1 -0
  150. package/dist/hub-contact-windows.d.ts +13 -1
  151. package/dist/hub-contact-windows.js +35 -2
  152. package/dist/hub-contact-windows.js.map +1 -1
  153. package/dist/hub-picture-reduce.d.ts +34 -0
  154. package/dist/hub-picture-reduce.js +101 -0
  155. package/dist/hub-picture-reduce.js.map +1 -0
  156. package/dist/hub-picture-worker.d.ts +1 -0
  157. package/dist/hub-picture-worker.js +19 -0
  158. package/dist/hub-picture-worker.js.map +1 -0
  159. package/dist/hub-report-target.d.ts +6 -0
  160. package/dist/hub-report-target.js +6 -0
  161. package/dist/hub-report-target.js.map +1 -1
  162. package/dist/locale.js +357 -265
  163. package/dist/locale.js.map +1 -1
  164. package/dist/ls-rows.d.ts +2 -0
  165. package/dist/ls-rows.js.map +1 -1
  166. package/dist/needs-you.d.ts +6 -0
  167. package/dist/needs-you.js +3 -1
  168. package/dist/needs-you.js.map +1 -1
  169. package/dist/outbound-handlers.d.ts +8 -0
  170. package/dist/outbound-handlers.js +53 -6
  171. package/dist/outbound-handlers.js.map +1 -1
  172. package/dist/outbound-schemas.d.ts +2 -0
  173. package/dist/outbound-schemas.js +6 -4
  174. package/dist/outbound-schemas.js.map +1 -1
  175. package/dist/runtime-cli-install.js +4 -4
  176. package/dist/runtime-cli-install.js.map +1 -1
  177. package/dist/task-board-tool.d.ts +17 -0
  178. package/dist/task-board-tool.js +58 -6
  179. package/dist/task-board-tool.js.map +1 -1
  180. package/dist/tips.js +3 -3
  181. package/dist/tool-permissions.js +2 -2
  182. package/dist/tool-permissions.js.map +1 -1
  183. package/dist/ui/agent-export-strings.js +1 -1
  184. package/dist/ui/agent-page-strings.js +5 -5
  185. package/dist/ui/contact-auth-client.js +2 -2
  186. package/dist/ui/contact-tool-groups.js +1 -1
  187. package/dist/ui/fleet-cache.js +5 -5
  188. package/dist/ui/fleet-canvas.js +3 -2
  189. package/dist/ui/fleet-office-card.js +46 -7
  190. package/dist/ui/fleet-office-dialogue.d.ts +6 -3
  191. package/dist/ui/fleet-office-dialogue.js +13 -3
  192. package/dist/ui/fleet-office-layout.js +15 -15
  193. package/dist/ui/fleet-office-model.js +3 -2
  194. package/dist/ui/fleet-office-overview.js +1 -1
  195. package/dist/ui/fleet-office-pack.d.ts +17 -7
  196. package/dist/ui/fleet-office-pack.js +106 -38
  197. package/dist/ui/fleet-office-play.js +11 -4
  198. package/dist/ui/fleet-office-skin.js +41 -11
  199. package/dist/ui/fleet-office-store.js +10 -1
  200. package/dist/ui/fleet-office-talk.js +423 -0
  201. package/dist/ui/fleet-office-view.js +58 -17
  202. package/dist/ui/fleet-office-zones.js +20 -12
  203. package/dist/ui/fleet-office.js +250 -65
  204. package/dist/ui/fleet-org.js +3 -3
  205. package/dist/ui/fleet-task-common.js +3 -3
  206. package/dist/ui/fleet-task-sort.js +88 -0
  207. package/dist/ui/fleet-task-view.js +38 -9
  208. package/dist/ui/fleet-tasks.js +47 -15
  209. package/dist/ui/fleet-usage.js +6 -6
  210. package/dist/ui/hub-admin-overview.js +1 -1
  211. package/dist/ui/hub-chat-store.js +4 -3
  212. package/dist/ui/hub-chat-strings.js +3 -1
  213. package/dist/ui/hub-client.js +3 -0
  214. package/dist/ui/hub-my-agents-strings.js +2 -2
  215. package/dist/ui/hub-my-agents.js +3 -0
  216. package/dist/ui/hub-room-composer.js +24 -4
  217. package/dist/ui/hub-room-members.js +7 -3
  218. package/dist/ui/hub-room-office.js +71 -2
  219. package/dist/ui/hub-room-presence.js +14 -0
  220. package/dist/ui/hub-room-strings.js +18 -2
  221. package/dist/ui/hub-room-thread.js +82 -13
  222. package/dist/ui/hub-room-working.js +37 -0
  223. package/dist/ui/hub-session-limits.js +79 -0
  224. package/dist/ui/panel-fleet.js +5 -5
  225. package/dist/ui/panel-hub.js +41 -6
  226. package/dist/ui/panel-log.js +3 -3
  227. package/dist/ui/panel-needs.js +28 -2
  228. package/dist/ui/panel-runtimes.js +2 -2
  229. package/dist/ui/runtime-cli-install.js +1 -1
  230. package/dist/ui/runtime-update-status.js +1 -1
  231. package/dist/ui/settings-access-strings.js +1 -1
  232. package/dist/ui/settings-hub-setup-strings.js +1 -1
  233. package/dist/ui/settings-layout.js +2 -2
  234. package/dist/ui/settings-named-test.js +16 -16
  235. package/dist/ui/settings-public-session-strings.js +2 -2
  236. package/dist/ui/settings-revoke-strings.js +1 -1
  237. package/dist/ui/settings-shared-strings.js +2 -2
  238. package/dist/ui/settings-strings.js +40 -40
  239. package/dist/ui/shared/app-shell.js +1 -1
  240. package/dist/ui/shared/app.css +106 -6
  241. package/dist/ui/shared/chat-strings.js +9 -9
  242. package/dist/ui/shared/hub-owner.css +5 -0
  243. package/dist/ui/shared/hub-rooms-u2.css +3 -0
  244. package/dist/ui/shared/instance-nav.js +36 -2
  245. package/dist/ui/shared/office-dialogue.css +110 -0
  246. package/dist/ui/shared/task-board.css +103 -7
  247. package/dist/ui/shared/view-strings.js +27 -9
  248. package/dist/web-api.d.ts +5 -0
  249. package/dist/web-api.js +29 -0
  250. package/dist/web-api.js.map +1 -1
  251. package/dist/web-office-skins.d.ts +8 -2
  252. package/dist/web-office-skins.js +33 -14
  253. package/dist/web-office-skins.js.map +1 -1
  254. package/dist/web-office-store.js +5 -3
  255. package/dist/web-office-store.js.map +1 -1
  256. package/package.json +1 -1
@@ -71,23 +71,23 @@ import { nodeText, stateWords } from "./fleet-org.js";
71
71
  import { hits, needle } from "./fleet-canvas-layout.js";
72
72
  import { AUTO_ID, LOBBY, autoLayout, backingScale, coatOf, createFlights, customLayout, deskAt, desksOf, filterOk, lampOf, layoutOk, lightOf, membersOf,
73
73
  officePose, officeRooms, signOf, workOn } from "./fleet-office-model.js";
74
- import { BUILT_IN_SKINS, CHAR_DEPTH, DEFAULT_PAL, PICTURE_SKINS, bubbleBox, pixelSkin, loadBuiltInSkin, loadPackSkin, modeOf, skinFor, tagBox, tagFootprint } from "./fleet-office-skin.js";
74
+ import { BUILT_IN_SKINS, CHAR_DEPTH, DEFAULT_PAL, PICTURE_SKINS, bubbleBox, pixelSkin, loadBuiltInSkin, loadPackSkin, modeOf, skinFor, tagBox, tagFootprint, withCharacters } from "./fleet-office-skin.js";
75
75
  import { CALLING, activeFurniture, bubbleAt, hiddenBy, bubbleRank, NIGHT, WANDER, createMail, createWalkers, isNight, linesFor, npcKey, personAt, placeBubbles, routeStaysInArea, thinBubbles, walkTargets, zonesLayout } from "./fleet-office-zones.js";
76
76
  import { actsOk, createOfficeStore } from "./fleet-office-store.js";
77
77
  import { badgeOf, fixedOf, mergeLevels } from "./fleet-office-levels.js";
78
78
  import { OfficeCard, cardModel } from "./fleet-office-card.js";
79
- import { PLAY, applySeatDrop, clampDropForArea, createHold, createSnackDrag, createSnacks, findSeatDropTarget, playAllowed, playOffForMotion, pruneReactions, reactionAt, scatterWords, seatDropTargets } from "./fleet-office-play.js";
79
+ import { PLAY, applySeatDrop, patLook, clampDropForArea, createHold, createSnackDrag, createSnacks, findSeatDropTarget, playAllowed, playOffForMotion, pruneReactions, reactionAt, scatterWords, seatDropTargets } from "./fleet-office-play.js";
80
80
  import { POLL_MS } from "./fleet-traffic.js";
81
81
  import { OfficeEditor, officeForSave } from "./fleet-office-editor.js";
82
82
  import { LayoutEditor, handlesOf } from "./fleet-office-layout.js";
83
83
  import { ShareButton } from "./office-share-dialog.js";
84
84
  import { Dialog } from "/assets/ui-dialog.js";
85
85
  import { DLG, boxColours, boxLayout, createDialogue, createFaces, drawBox, fitBox, messageOf, onBox, pickFront, portraitSrc, stageOf, talkOf, wrap } from "./fleet-office-dialogue.js";
86
- import { applyOverrides, createClipClocks, fitNight, fitSeatFor, packMaxFps, snackLabel, stripBox } from "./fleet-office-pack.js";
86
+ import { applyOverrides, createClipClocks, fitNight, fitSeatFor, packMaxFps, snackLabel, stripBox, stripDurationMs } from "./fleet-office-pack.js";
87
87
  import { ALL_ID, LOBBY_TILE, OV, createCrossFlights, cropToRooms, fromTile, inTile, labelAt, lobbyNodes, overviewOk, tileAt, tileBox, tileLayout, visibleTiles } from "./fleet-office-overview.js";
88
88
  import { CAROUSEL_ID, INTERVALS, carouselHeld, carouselIdsOk, carouselKey, carouselOk, intervalOk, nextIndex, prevIndex } from "./fleet-office-carousel.js";
89
89
  import { centreOn, gestureState, gestures, miniPoint, toScreen, toWorld, wheelFactor, zoomKey, zoomTo } from "./fleet-canvas-view.js";
90
- import { OK_MAX, OK_MIN, clampPan, desksK, edgeMatte, edgeStrips, fitScene, layerScale, miniBox, miniFrame, openingView, pinchOffice, savedOf, stepK, viewFromSaved,
90
+ import { OK_MAX, cardSpot, clampPan, desksK, minK, edgeMatte, edgeStrips, fitScene, layerScale, miniBox, miniFrame, openingView, pinchOffice, savedOf, stepK, viewFromSaved,
91
91
  wholeInView, zoomLabel, zoomOffice } from "./fleet-office-view.js";
92
92
 
93
93
  register("orgo", {
@@ -106,8 +106,9 @@ register("orgo", {
106
106
  styleForAll: "The whole fleet's style, for everyone: every device and share link", styleHere: "The whole fleet's style in this browser",
107
107
  styleFailed: "The style was not saved for everyone ({0}).", styleBusy: "Too many changes. Try again in a minute.",
108
108
  fit: "Fit the office", overview: "Overview: click to move there", fullscreen: "Fullscreen", exitFullscreen: "Exit fullscreen",
109
- fill: "Fill", fillTitle: "Fill the panel (the scene's overflow is cropped; drag to see it)", zoomLevel: "Zoom {0}",
110
- allOffices: "All offices", labelAll: "All offices: each office is a tile, drawn in its own style. Drag to pan; the wheel, a pinch, + and − zoom, 0 fits, F is fullscreen. Double-click a tile to open that office.",
109
+ fill: "Fill", fillTitle: "Fill the panel (the scene's overflow is cropped; drag to see it)", zoomLevel: "Zoom {0}", view: "View", zoomIn: "Zoom in", zoomOut: "Zoom out", live: "Live",
110
+ allOffices: "All offices", labelAll: "All offices: each office is a tile, drawn in its own style. Drag to pan; the wheel, a pinch, + and − zoom, 0 fits, F is fullscreen. Click a tile to open that office.",
111
+ backAll: "← All offices",
111
112
  key: "Key", keyTitle: "What the items carried between desks are", keyLabel: "Carried between desks",
112
113
  keyTask: "Folder: a task", keySend: "Envelope: a message", keyReport: "Paper: a report", keyBroadcast: "Horn: a broadcast",
113
114
  tileLabel: "{0} ({1})", openOffice: "Open the office {0}", lobbyTile: "Lobby tile (in no office)", lobbyEveryone: "Everyone is in an office", overviewNoEdit: "Pick one office to edit offices or a layout",
@@ -125,8 +126,8 @@ register("orgo", {
125
126
  },
126
127
  "zh-TW": {
127
128
  display: "顯示選項", playMotionOff: "已關閉:系統開了「減少動態效果」",
128
- label: "辦公室:每個 team 是一間房間,每個 Agent 一張桌子;General 和未加入 team 的 Agent 在大廳。拖曳平移;滾輪、雙指、+ 和 − 縮放,0 顯示整個場景,F 切換全螢幕。",
129
- office: "辦公室", allOffice: "整個 fleet", show: "顯示", allTeams: "所有 team", lobby: "大廳(General、未加入 team)", lobbyRoom: "大廳",
129
+ label: "辦公室:每個團隊是一間房間,每個 Agent 一張桌子;General 和未加入團隊的 Agent 在大廳。拖曳平移;滾輪、雙指、+ 和 − 縮放,0 顯示整個場景,F 切換全螢幕。",
130
+ office: "辦公室", allOffice: "整個 fleet", show: "顯示", allTeams: "所有團隊", lobby: "大廳(General、未加入團隊)", lobbyRoom: "大廳",
130
131
  people: "成員", peopleN: "成員({0})", findPerson: "尋找成員", everyone: "顯示全部", nobody: "沒有符合這個篩選的成員。",
131
132
  unseated: "{0} 位沒有座位", skinUnknown: "這裡沒有它的風格「{0}」:以辦公桌顯示。", closed: "休息中", desks: "桌子", tapAgain: "再點一下開啟聊天",
132
133
  capWorking: "埋頭打字中", capIdle: "喝茶休息", capPaused: "睡著了", capNeeds: "在呼叫你", capAway: "空位", capStarting: "剛到座位", capQueued: "等待啟動",
@@ -138,8 +139,9 @@ register("orgo", {
138
139
  styleForAll: "整個 fleet 的風格,所有人共用:每台裝置與分享連結都一樣", styleHere: "這個瀏覽器裡整個 fleet 的風格",
139
140
  styleFailed: "風格沒有替所有人儲存({0})。", styleBusy: "變更太頻繁,請一分鐘後再試。",
140
141
  fit: "顯示整個辦公室", overview: "總覽:點一下移到那裡", fullscreen: "全螢幕", exitFullscreen: "結束全螢幕",
141
- fill: "填滿", fillTitle: "填滿整個面板(超出的部分會被裁切,拖曳即可看到)", zoomLevel: "縮放 {0}",
142
- allOffices: "所有辦公室", labelAll: "所有辦公室:每間辦公室是一格,以它自己的風格顯示。拖曳平移;滾輪、雙指、+ 和 − 縮放,0 顯示全部,F 切換全螢幕。雙擊一格即可開啟那間辦公室。",
142
+ fill: "填滿", fillTitle: "填滿整個面板(超出的部分會被裁切,拖曳即可看到)", zoomLevel: "縮放 {0}", view: "檢視", zoomIn: "放大", zoomOut: "縮小", live: "即時",
143
+ allOffices: "所有辦公室", labelAll: "所有辦公室:每間辦公室是一格,以它自己的風格顯示。拖曳平移;滾輪、雙指、+ 和 − 縮放,0 顯示全部,F 切換全螢幕。點一格即可開啟那間辦公室。",
144
+ backAll: "← 返回全域",
143
145
  key: "圖例", keyTitle: "桌子之間傳遞的物品代表什麼", keyLabel: "桌子之間傳遞的物品",
144
146
  keyTask: "資料夾:任務", keySend: "信封:訊息", keyReport: "紙張:回報", keyBroadcast: "喇叭:廣播",
145
147
  tileLabel: "{0}({1})", openOffice: "開啟辦公室「{0}」", lobbyTile: "大廳格(不在任何辦公室)", lobbyEveryone: "每個成員都已在某間辦公室", overviewNoEdit: "請先選一間辦公室,再編輯辦公室或配置",
@@ -254,6 +256,8 @@ const UP_MS = 1800;
254
256
  const FIND_K = 2;
255
257
  /** #2661: below this stage width (CSS px) the card is a bottom sheet. */
256
258
  const SHEET_W = 560;
259
+ /** M-3633: the corner of an area its name takes (logical units, from the area's top left): a floating card keeps off it. */
260
+ const AREA_LABEL = { w: 320, h: 44 };
257
261
  /**
258
262
  * M-3253 (Argon's phone review): the Office's phone layout — a phone's width (the shell's), or a phone turned sideways (a
259
263
  * coarse pointer in a short window: an iPhone's 956 × 440 is wider than 899 px). There the Office's tools are one ⋯ sheet,
@@ -406,6 +410,8 @@ export function speakerAt(sk, look, at) {
406
410
  }
407
411
  /** The pose an area's seats are for: the first state (asleep, working, calling, idle) the pack sends there. */
408
412
  const GHOST_POSE = [["paused", "paused"], ["stopped", "paused"], ["working", "working"], ["needs", "needs"], ["crashed", "needs"], ["stuck", "needs"], ["idle", "idle"]];
413
+ /** M-3533 R2c: how far inside its area's top edge a room character's speech bubble stays (scene units). */
414
+ const BUBBLE_IN_AREA = 8;
409
415
  /** How faint Edit layout's figures are: seen through, yet readable over a busy picture (a dimmed person is 0.35). */
410
416
  const GHOST_ALPHA = 0.6;
411
417
  /** Edit layout's faint figures: one on each seat no one is on, { x, y, look } (the pack's default set; drawn at GHOST_ALPHA). */
@@ -616,8 +622,12 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
616
622
  const posed = actPosed(p, q.look);
617
623
  const eating = !q.at.walking && p.snacks && ms > 0 ? p.snacks.eatingOf(q.look.name, t) : null;
618
624
  const canEat = !!eating && !CALLING.has(q.look.state) && !ASLEEP.has(q.look.state) && !q.look.night;
625
+ // A pat shows the set's `pat` strip for one full pass of it (pat.until), each pat from frame 0; a set without one keeps its pose.
626
+ const canPat = !q.at.walking && !canEat && ms > 0 && !!p.reacts && !CALLING.has(q.look.state) && !ASLEEP.has(q.look.state) && !q.look.night;
627
+ const patted = canPat ? patLook(posed, p.reacts.get(q.look.name), t) : null;
619
628
  const look = q.at.walking ? { ...q.look, pose: "walk", heading: q.at.heading }
620
- : canEat ? { ...posed, pose: "eat", basePose: posed.pose } : posed;
629
+ : canEat ? { ...posed, pose: "eat", basePose: posed.pose }
630
+ : patted || posed;
621
631
  sk.drawCharacter(ctx, box, look, ms, env);
622
632
  if (canEat && eating.snackId && p.snacksById && sk.drawSnack) {
623
633
  const sdef = p.snacksById.get(eating.snackId);
@@ -763,9 +773,12 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
763
773
  }
764
774
  // Speech bubbles: a short line for the state, now and then (typed out; whole at once when still), placed so no two
765
775
  // overlap (placeBubbles; #2431).
766
- const bubbles = [];
767
- for (const sp of speakers) {
776
+ const bubbles = [], rp = p.reply, tSaid = Date.now(), replies = [];
777
+ for (let sp of speakers) {
768
778
  if (sp.look.dim || sp.look.pose === "away") continue;
779
+ // Talk "Over their head": a live reply, in full (wrapped), in place of the state's line.
780
+ const said = rp ? rp.chat.recent(sp.look.name, tSaid) : null;
781
+ if (said) { replies.push({ sp, said }); continue; }
769
782
  const says = sp.look.night ? "paused" : sp.look.state; // asleep at night: its "Zzz…" lines
770
783
  // What an agent says itself (office_set, #2578): whole, kept over the area's thinning like a call.
771
784
  const act = p.acts && p.acts.get(sp.look.name), ra = reacting && reacting.has(sp.look.name) ? reactionAt(reacting.get(sp.look.name), t0, p.lang) : null;
@@ -779,22 +792,57 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
779
792
  const b = own ? { text: own, shown: [...own].length }
780
793
  : scText ? { text: scText, shown: [...scText].length }
781
794
  : bubbleAt(sp.look.name, says, ms, linesFor(says, p.lang, sk.pack, p.lines, sp.look.name)); // #3681: theirs, their set's, the pack's
795
+ // M-3533 R2c (Lumen): a room's own characters stand taller than the style's figures; their bubble stays inside the
796
+ // area's box, as a figure's does (the Fleet's own office is unchanged).
797
+ const ar = b && sk.ownCharacters && p.zones && sp.area != null ? p.L.areas && p.L.areas[sp.area] : null;
798
+ if (ar && ar.rect) { const bx = bubbleBox(ctx, sp.x, sp.y, b.text), min = ar.rect.y + BUBBLE_IN_AREA; if (bx.y < min) sp = { ...sp, y: sp.y + (min - bx.y) }; }
782
799
  if (b) bubbles.push({ key: sp.look.name, area: sp.area, state: sp.look.state, calling: CALLING.has(sp.look.state), rank: own ? 0 : scText ? 1 : bubbleRank(sp.look.state), shown: b.shown, ...(raSays ? { keep: true } : {}),
783
800
  box: bubbleBox(ctx, sp.x, sp.y, b.text), tail: { x: sp.x, y: sp.y }, sp, b });
784
801
  }
785
802
  // A crowded area speaks less (thinBubbles: calls, then work, a few at most); no bubble covers a name tag. `defer`
786
803
  // (All offices): drawn after every tile, unclipped, so a bubble at a tile's edge is whole.
787
- const placed = placeBubbles(thinBubbles(bubbles, p.zones ? p.L.over : null), 22, titleBoxes.length ? [...tags, ...titleBoxes] : tags);
788
- const say = () => { T(); for (const { sp, b, dy } of placed) {
789
- const text = [...b.text].slice(0, b.shown).join("");
804
+ // M-3648: an area's name blocks chatter; a call may cover it (placeBubbles' `soft`): a name never keeps a call out.
805
+ const placed = placeBubbles(thinBubbles(bubbles, p.zones ? p.L.over : null), 22, tags, titleBoxes);
806
+ // M-3533 R2c: and after placing (which lifts a bubble clear of another), a room character's bubble still stays in its area.
807
+ const inArea = (sp, text, dy) => {
808
+ const ar = sk.ownCharacters && p.zones && sp.area != null ? p.L.areas && p.L.areas[sp.area] : null;
809
+ if (!ar || !ar.rect || !dy) return dy;
810
+ const over = ar.rect.y + BUBBLE_IN_AREA - bubbleBox(ctx, sp.x, sp.y, text, -dy).y;
811
+ return over > 0 ? Math.max(0, dy - over) : dy;
812
+ };
813
+ const say = () => { T(); for (const { sp, b, dy: lifted } of placed) {
814
+ const text = [...b.text].slice(0, b.shown).join(""), dy = inArea(sp, b.text, lifted);
790
815
  sk.drawBubble(ctx, sp.x, sp.y, text, env, -dy);
791
816
  if (bubbleHits && text) {
792
817
  const box = bubbleBox(ctx, sp.x, sp.y, text, -dy);
793
818
  bubbleHits.push({ name: sp.look.name, box: { x: ox + box.x * a, y: oy + box.y * a, w: box.w * a, h: box.h * a } });
794
819
  }
820
+ }
821
+ const bl = sk.pack && sk.pack.dialogBox ? sk.pack.dialogBox.bubble : null;
822
+ const im = bl && bl.frame && typeof sk.picture === "function" ? sk.picture(bl.frame, () => {}) : null;
823
+ for (const { sp, said } of replies) {
824
+ // Typed out from its page's start, at the reading mode's pace; ▼ once whole; Auto / Fast: it goes on by itself.
825
+ const cps = rp.pace(rp.read).cps, n = ms > 0 ? Math.floor(((tSaid - (said.pageAt ?? said.at)) * cps) / 1000) : Infinity;
826
+ // #4406: never smaller than its own size on the page — zoomed out (a phone's whole office at 30 %), it is drawn at
827
+ // 1 CSS px a unit about its tail, so the words stay readable; zoomed in, as the map.
828
+ const u = Math.max(1, (rp.ratio || 1) / a);
829
+ // And kept on screen: the canvas's visible width in this part's units, into the bubble's own (scaled about its tail).
830
+ const vl = -ox / a, vr = ((ctx.canvas && ctx.canvas.width) || Infinity) / a - ox / a, m = 6 / u;
831
+ const vt = -oy / a, vb = ((ctx.canvas && ctx.canvas.height) || Infinity) / a - oy / a;
832
+ const fit = Number.isFinite(vr) ? { l: sp.x + (vl - sp.x) / u + m, r: sp.x + (vr - sp.x) / u - m,
833
+ ...(Number.isFinite(vb) ? { t: sp.y + (vt - sp.y) / u + m, b: sp.y + (vb - sp.y) / u - m } : {}) } : null;
834
+ ctx.save(); ctx.translate(sp.x, sp.y); ctx.scale(u, u); ctx.translate(-sp.x, -sp.y);
835
+ const b0 = rp.draw(ctx, sp.x, sp.y, sp.look.label || sp.look.name, said.text, ms > 0 ? tSaid - said.at : 0, rp.style(bl, env), im ? { im, slice: bl.slice || 6, k: sk.pack.scale || 2 } : null,
836
+ { page: said.page, n }, fit);
837
+ ctx.restore();
838
+ const box = { ...b0, x: sp.x + (b0.x - sp.x) * u, y: sp.y + (b0.y - sp.y) * u, w: b0.w * u, h: b0.h * u };
839
+ said.pages = box.pages;
840
+ if (n >= box.len && !said.whole) { said.whole = true; said.wholeAt = tSaid; }
841
+ if (said.whole && tSaid - said.wholeAt >= rp.pace(rp.read, box.len).wait) rp.chat.advance(sp.look.name);
842
+ if (bubbleHits) bubbleHits.push({ name: sp.look.name, reply: true, box: { x: ox + box.x * a, y: oy + box.y * a, w: box.w * a, h: box.h * a } });
795
843
  } };
796
844
  if (defer) defer.push(say); else say();
797
- return walking || up.length > 0 || p.flights.size() > 0 || post.some((it) => it.t > 0) || rising.length > 0 || !!reacting || (!!p.snacks && p.snacks.active(t0)) || !!(p.snackDrop && p.snackDrop.current) || !!(p.hold && p.hold.held());
845
+ return replies.length > 0 || walking || up.length > 0 || p.flights.size() > 0 || post.some((it) => it.t > 0) || rising.length > 0 || !!reacting || (!!p.snacks && p.snacks.active(t0)) || !!(p.snackDrop && p.snackDrop.current) || !!(p.hold && p.hold.held());
798
846
  }
799
847
  /**
800
848
  * #2661: an NPC's name tag (a furniture item's label) — with the title a pack pins on it (`levels.fixed` by its id),
@@ -900,7 +948,8 @@ export function OfficeKey({ pal }) {
900
948
  * in the zoom stack (a Hub room's office: the scene right under the room's header, M-3533 #4370);
901
949
  * `cardAction(name)` a card's main action ({ label, title, run }: the room's "@ it"), or null; `cardName(name)` a card's
902
950
  * title instead of the person's name (the room's: the agent's own, without the owner its scene label carries); `officesKey` read the offices
903
- * again when it changes (a page with no stream: the room's office when an agent joins, leaves or is renamed).
951
+ * again when it changes (a page with no stream: the room's office when an agent joins, leaves or is renamed); M-3533 R2b:
952
+ * `cardPhoto(name)` the src of a card's identity-card picture (the room's), or null: the figure.
904
953
  */
905
954
  function ensureDialogueStyle() {
906
955
  const doc = globalThis.document;
@@ -909,8 +958,8 @@ function ensureDialogueStyle() {
909
958
  link.href = assetUrl("/assets/office-dialogue.css");
910
959
  link.setAttribute("data-office-dialogue-css", "1"); doc.head.appendChild(link);
911
960
  }
912
- export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetImage, opening, talk, more = false, onMore = null, live = null, onLive = null,
913
- oneOffice = false, readOnly = false, stream = true, storage = undefined, cardRows = null, words = null, cardAction = null, cardName = null, officesKey = undefined, foldBar = false }) {
961
+ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetImage, opening, talk, chatUi = null, more = false, onMore = null, live = null, onLive = null,
962
+ oneOffice = false, readOnly = false, stream = true, storage = undefined, cardRows = null, words = null, cardAction = null, cardName = null, officesKey = undefined, foldBar = false, cardPhoto = null, characters = null }) {
914
963
  // M-3253: on a phone the page above (fleet-canvas.js) puts a ⋯ in its bar: `more` is that sheet open, `onMore(open)`;
915
964
  // `live` / `onLive` its Live toggle, which moves into the sheet. Without one (a share link's page) the bar stays.
916
965
  useLayoutEffect(ensureDialogueStyle, []);
@@ -924,7 +973,9 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
924
973
  const [canEdit, setCanEdit] = useState(false); // an admin session (never a guest or the public link)
925
974
  const [canShare, setCanShare] = useState(false); // #2636: an admin session, here or over the public link
926
975
  const [editing, setEditing] = useState(false);
927
- const [choice, setChoice] = useState(() => opening ?? store.choice());
976
+ // Never picked here: All offices, the map of every office (one click enters one, unremembered; Back returns) — the
977
+ // whole fleet while fewer than two are stored. A pick from the switcher is kept per device, as before.
978
+ const [choice, setChoice] = useState(() => opening ?? store.choice(ALL_ID));
928
979
  const [filter, setFilter] = useState(() => store.filter());
929
980
  // #4010: the carousel's offices and interval (per browser); the slide index and playing are this visit only.
930
981
  const [carSaved, setCarSaved] = useState(() => store.carousel());
@@ -956,6 +1007,17 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
956
1007
  // conversations; the avatars read for it; what it last said for a screen reader. `dlgRef`: what draw() reads (it runs
957
1008
  // from the loop, outside a render); `dlgShown`: the box as last drawn (its clicks).
958
1009
  const [dialogueOn, setDialogueOn] = useState(() => store.dialogueOn());
1010
+ // Talking from here (fleet-office-talk.js, `chatUi`: the dashboard's only, never a share link): how (per browser) and
1011
+ // to whom; `chat` the conversations every way shows.
1012
+ const [talkMode, setTalkMode] = useState(() => store.talkMode());
1013
+ const [talkTo, setTalkTo] = useState(null);
1014
+ const [readMode, setReadMode] = useState(() => (chatUi ? chatUi.readModeOf(store.talkRead()) : "click"));
1015
+ const chat = useMemo(() => (chatUi ? chatUi.createTalk() : null), [chatUi]);
1016
+ // #4406: the Dialogue-box talk shows the dialogue's conversations, so they run while it is picked — without ticking
1017
+ // Dialogue for the person (their own choice, kept as they left it when they pick another way to talk).
1018
+ const boxTalk = !!chat && talk === undefined && typeof onOpen === "function" && chatUi.talkModeOf(talkMode) === "box";
1019
+ const dlgOn = dialogueOn || boxTalk;
1020
+ const replyRef = useRef(null);
959
1021
  const dlg = useMemo(createDialogue, []);
960
1022
  const faces = useMemo(() => createFaces(), []);
961
1023
  const [dlgSay, setDlgSay] = useState("");
@@ -992,6 +1054,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
992
1054
  // back there when it closes); the card's element and where it points (placed every frame: it follows them).
993
1055
  const [card, setCard] = useState(null);
994
1056
  const cardFrom = useRef(null), cardEl = useRef(null), cardDesk = useRef(null);
1057
+ // M-3633: how much of the stage a bottom-sheet card covers (px from its foot); the scene is kept in the rest.
1058
+ const sheetCover = useRef(0);
995
1059
  const stageRef = useRef(null), canvasRef = useRef(null), tipRef = useRef(null), lastType = useRef("mouse");
996
1060
  // Fullscreen: null, "native" (the Fullscreen API) or "immersive" (the CSS cover); per visit, never kept.
997
1061
  const ooRef = useRef(null), [fs, setFs] = useState(null), fsRef = useRef(null), fsAsked = useRef(false), fsTarget = useRef(null);
@@ -1115,7 +1179,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1115
1179
  if (who) setDlgSay(to("dlgSays", ...words(who)));
1116
1180
  };
1117
1181
  useEffect(() => {
1118
- if (!dialogueOn || talk !== undefined) return undefined;
1182
+ if (!dlgOn || talk !== undefined) return undefined;
1119
1183
  const sub = streamOn();
1120
1184
  if (!sub) return undefined;
1121
1185
  let skew = 0;
@@ -1135,9 +1199,9 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1135
1199
  const hold = (off) => (lease ? lease.hold(off) : off);
1136
1200
  const offs = [hold(sub("clock", (d) => { if (d && typeof d.now === "number") skew = d.now - Date.now(); })), hold(sub("message", take))];
1137
1201
  return () => { for (const off of offs) if (typeof off === "function") off(); };
1138
- }, [dialogueOn, lease, talk === undefined]);
1202
+ }, [dlgOn, lease, talk === undefined]);
1139
1203
  useEffect(() => {
1140
- if (!dialogueOn || !talk) return;
1204
+ if (!dlgOn || !talk) return;
1141
1205
  let changed = false;
1142
1206
  for (const x of talkOf(talk)) {
1143
1207
  const k = `${x.instance}|${x.kind}|${x.at}`;
@@ -1150,13 +1214,13 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1150
1214
  sayFor(x.instance, (who) => (x.kind === "heard" ? [to("dlgSomeone"), to("dlgHeardShare", nodeText(who.node).primary)] : [nodeText(who.node).primary, to("dlgAnsweredShare")]));
1151
1215
  }
1152
1216
  if (changed) dlgWake();
1153
- }, [dialogueOn, talk]);
1217
+ }, [dlgOn, talk]);
1154
1218
  // What is over goes (an answer after its fade, a conversation never answered); the box is drawn again meanwhile.
1155
1219
  useEffect(() => {
1156
- if (!dialogueOn) return undefined;
1157
- const h = setInterval(() => { if (dlg.sweep(now(), still) || dlg.size()) dlgWake(); }, 1000);
1220
+ if (!dlgOn) return undefined;
1221
+ const h = setInterval(() => { if (dlg.sweep(now(), still, !!(dlgRef.current && dlgRef.current.vn)) || dlg.size()) dlgWake(); }, 1000);
1158
1222
  return () => clearInterval(h);
1159
- }, [dialogueOn]);
1223
+ }, [dlgOn]);
1160
1224
  const toggleDialogue = () => {
1161
1225
  const v = !dialogueOn;
1162
1226
  store.saveDialogueOn(v); setDialogueOn(v);
@@ -1276,11 +1340,24 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1276
1340
  if (zones && layout && !layoutStale) return { skin: { ...baseSkin, pack: layout.draft }, ignored: false };
1277
1341
  return withOverrides(baseSkin, zones, custom);
1278
1342
  }, [baseSkin, zones, custom, layout, layoutStale]);
1279
- const skin = placed.skin;
1343
+ // M-3533 R2c: a Hub room office's agents in their own characters (`characters`: { sets, images }), over its style.
1344
+ const skin = useMemo(() => (characters ? withCharacters(placed.skin, characters.sets, characters.images) : placed.skin), [placed.skin, characters]);
1280
1345
  // While Edit layout is open: a faint figure on every seat, in the pose its area is for (#2558), so a seat is placed by
1281
1346
  // what will stand, sit or lie there, not by a dot.
1282
1347
  const ghosts = zones && !!layout && !layoutStale;
1283
1348
  const shared = talk !== undefined || typeof onOpen !== "function";
1349
+ const tmode = chat && !shared ? chatUi.talkModeOf(talkMode) : "window";
1350
+ useEffect(() => {
1351
+ if (!chat || tmode === "window") return undefined;
1352
+ const sub = appStore.get().streamOn, hold = (off) => (lease ? lease.hold(off) : off);
1353
+ const off = sub ? hold(sub("message", chat.take)) : null;
1354
+ const quiet = chat.subscribe(() => { if (still && scene.current) draw(0); else loop.current?.wake(); });
1355
+ return () => { if (typeof off === "function") off(); quiet(); };
1356
+ }, [chat, tmode, lease]);
1357
+ const pickTalkMode = (v) => {
1358
+ store.saveTalkMode(v); setTalkMode(v);
1359
+ if (v === "window") setTalkTo(null);
1360
+ };
1284
1361
  // What a view and per-device seat choices are kept for: the office and its style (All offices: its own key).
1285
1362
  const officeKey = overview ? `${ALL_ID}@tiles` : `${custom ? custom.id : AUTO_ID}@${baseSkin.id}`;
1286
1363
  const keep = (n) => !(hideAsleep && ASLEEP.has(n.state));
@@ -1454,17 +1531,55 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1454
1531
  */
1455
1532
  const placeCard = () => {
1456
1533
  const el = cardEl.current, c = cardDesk.current;
1457
- if (!el || !c || !el.style || el.classList?.contains("sheet")) return;
1534
+ if (!el || !c || !el.style) return;
1535
+ if (el.classList?.contains("sheet")) { el.style.removeProperty("max-height"); liftOverSheet(el, c); return; }
1458
1536
  const v = view0(), sz = sizeRef.current;
1459
1537
  const w = c.walks ? walkers.at(c.name, now()) : null;
1460
1538
  const pt = w ? { x: w.x, y: w.y - 52, r: 16 } : { x: c.box.x + c.box.w / 2, y: c.box.y, r: (c.box.w / 2) * v.k };
1461
- const p = toScreen(v, pt.x, pt.y), cw = el.offsetWidth || 320, ch = el.offsetHeight || 260, gap = 12 + (w ? pt.r : pt.r);
1462
- let x = p.x + gap;
1463
- if (x + cw > sz.w - 8) x = p.x - gap - cw;
1464
- x = Math.max(8, Math.min(x, sz.w - cw - 8));
1465
- const y = Math.max(8, Math.min(p.y - 24, sz.h - ch - 8));
1539
+ // Its whole height (a card held shorter below an area's name scrolls: its content's height, not the box's).
1540
+ const sc = (typeof el.querySelector === "function" && el.querySelector(".oo-card-body")) || el;
1541
+ const natural = sc.scrollHeight ? sc.scrollHeight + ((el.offsetHeight || 0) - (sc.clientHeight || 0)) : 0;
1542
+ const p = toScreen(v, pt.x, pt.y), cw = el.offsetWidth || 320, ch = natural || el.offsetHeight || 260, gap = (c.skin?.pack?.card?.layout?.gap ?? 12) + pt.r;
1543
+ // M-3633: clear of the areas' names — where the Office writes each one (areaTitleBox, a few px around it), else, on a
1544
+ // pack's own picture, the corner a name painted there takes.
1545
+ // The scene's own layout and skin (the draw loop's: this runs in it, where the render's may be an older one).
1546
+ const sc0 = scene.current, part = sc0 && !sc0.overview ? sc0.part : null, sk0 = part && part.skin;
1547
+ const titled = !!(sk0 && sk0.areaTitleBox && sc0.ctx && sc0.env);
1548
+ const avoid = part && part.zones && part.L ? Object.values(part.L.areas || {}).map((ar) => {
1549
+ const b = titled ? sk0.areaTitleBox(sc0.ctx, ar, sc0.env) : null;
1550
+ const r = b ? { x: b.x - 4, y: b.y - 4, w: b.w + 8, h: b.h + 8 } : { x: ar.rect.x, y: ar.rect.y, w: Math.min(ar.rect.w, AREA_LABEL.w), h: Math.min(ar.rect.h, AREA_LABEL.h) };
1551
+ const q = toScreen(v, r.x, r.y);
1552
+ return { x: q.x, y: q.y, w: r.w * v.k, h: r.h * v.k };
1553
+ }) : [];
1554
+ const { x, y, maxH } = cardSpot({ px: p.x, py: p.y, gap, cw, ch, w: sz.w, h: sz.h, avoid });
1555
+ if (maxH) el.style.setProperty("max-height", `${Math.round(maxH)}px`); else el.style.removeProperty("max-height");
1466
1556
  el.style.setProperty("transform", `translate(${Math.round(x)}px, ${Math.round(y)}px)`);
1467
1557
  };
1558
+ /**
1559
+ * M-3633: a phone's bottom-sheet card covers the stage's foot. The scene is kept in the rest (setView's clampPan is
1560
+ * given the uncovered height: a scene smaller than it is centred there), and the person is brought above the sheet —
1561
+ * once each time the sheet's height changes, so a pan of their own is left alone. It closes: the whole stage again.
1562
+ */
1563
+ const visSize = () => { const z = sizeRef.current || size; return { w: z.w, h: Math.max(1, z.h - sheetCover.current) }; };
1564
+ const liftOverSheet = (el, c) => {
1565
+ const st = stageRef.current;
1566
+ if (!st || typeof st.getBoundingClientRect !== "function" || typeof el.getBoundingClientRect !== "function") return;
1567
+ const cover = Math.max(0, Math.round(st.getBoundingClientRect().bottom - el.getBoundingClientRect().top));
1568
+ if (cover === sheetCover.current) return;
1569
+ sheetCover.current = cover;
1570
+ // The scene's current layout (this runs in the draw loop, where the render's `L` may be an older one).
1571
+ const LL = (scene.current && !scene.current.overview && scene.current.part && scene.current.part.L) || L;
1572
+ const v = view0(), w = c.walks ? walkers.at(c.name, now()) : null;
1573
+ const p = toScreen(v, w ? w.x : c.box.x + c.box.w / 2, w ? w.y : c.box.y + c.box.h), room = (sizeRef.current || size).h - cover - 16;
1574
+ vp.current = clampPan({ ...v, y: v.y - Math.max(0, p.y - room) }, LL.width, LL.height, visSize());
1575
+ apply();
1576
+ };
1577
+ const unliftSheet = () => {
1578
+ if (!sheetCover.current) return;
1579
+ sheetCover.current = 0;
1580
+ vp.current = clampPan(view0(), L.width, L.height, size);
1581
+ apply();
1582
+ };
1468
1583
  /**
1469
1584
  * Put the view on everything that shows it beside the canvas: the overview's frame (the part of the scene in view;
1470
1585
  * the whole view on its data-k/x/y), the zoom's percentage, the overlay, the tooltip.
@@ -1513,7 +1628,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1513
1628
  * fit (a resize fits it again).
1514
1629
  */
1515
1630
  const setView = (v, user = true, fit = false) => {
1516
- vp.current = clampPan(v, L.width, L.height, size);
1631
+ vp.current = clampPan(v, L.width, L.height, visSize());
1517
1632
  fitted.current = fit;
1518
1633
  apply();
1519
1634
  if (!user) return;
@@ -1526,11 +1641,13 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1526
1641
  * under the zoom controls at the side.
1527
1642
  */
1528
1643
  const fitL = (mode) => fitScene(L.width, L.height, size, mode, overview && mode !== "cover" ? FIT_PAD : 0);
1644
+ /** #4405: this scene's zoom floor — lower than OK_MIN for a pack's big canvas (or All offices), so − reaches its Fit. */
1645
+ const kLo = minK(L.width, L.height);
1529
1646
  /** The view an office opens on: its kept one (a kept fit: fitted to this size), else its opening; and whether a fit. */
1530
1647
  const openView = () => {
1531
1648
  const kept = store.view(officeKey);
1532
1649
  if (kept && kept.fit) return { v: fitL(fitMode), fit: true };
1533
- if (kept) return { v: viewFromSaved(kept, size), fit: false };
1650
+ if (kept) return { v: viewFromSaved(kept, size, kLo), fit: false };
1534
1651
  const fitted0 = zones || overview; // All offices opens whole, as a zones scene
1535
1652
  return { v: overview ? fitL(fitMode) : openingView(L.width, L.height, size, ratio, fitted0, fitMode), fit: fitted0 };
1536
1653
  };
@@ -1551,7 +1668,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1551
1668
  else if (!touched.current) reopen();
1552
1669
  else { const v = vp.current, cx = (was.w / 2 - v.x) / v.k, cy = (was.h / 2 - v.y) / v.k; vp.current = { k: v.k, x: size.w / 2 - cx * v.k, y: size.h / 2 - cy * v.k }; }
1553
1670
  } else if (fitted.current) vp.current = fitL(fitMode); // the scene's size changed
1554
- vp.current = clampPan(view0(), L.width, L.height, size);
1671
+ vp.current = clampPan(view0(), L.width, L.height, visSize());
1555
1672
  raw.current = vp.current.k;
1556
1673
  }, [officeKey, size.w, size.h, ratio, L.width, L.height]);
1557
1674
  useEffect(() => () => flushSave(), []);
@@ -1564,7 +1681,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1564
1681
  fit(next);
1565
1682
  };
1566
1683
  /** + / −: the next pixel level about the stage's middle. */
1567
- const zoomStep = (dir) => { const v = view0(), k = stepK(v.k, dir, ratio); raw.current = k; setView(zoomTo(v, k, size.w / 2, size.h / 2)); };
1684
+ const zoomStep = (dir) => { const v = view0(), k = stepK(v.k, dir, ratio, kLo); raw.current = k; setView(zoomTo(v, k, size.w / 2, size.h / 2)); };
1568
1685
  /** Bring a box (logical units) into view, unchanged when it already is. */
1569
1686
  const show = (b) => {
1570
1687
  const v = view0(), p = toScreen(v, b.x, b.y);
@@ -1647,7 +1764,14 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1647
1764
  return () => root.classList.remove("oo-immersive");
1648
1765
  }, [fs]);
1649
1766
  /** A desk opens its chat: out of fullscreen first (the chat is beside the view, or instead of it). */
1650
- const open = (name) => { if (!onOpen) return; if (fsRef.current) exitFs(); onOpen(name); };
1767
+ const open = (name) => {
1768
+ if (!onOpen) return;
1769
+ if (tmode !== "window") { setTalkTo(name); return; }
1770
+ if (fsRef.current) exitFs();
1771
+ onOpen(name);
1772
+ };
1773
+ /** The whole chat (the pop-up), from a talk in the Office. */
1774
+ const openFull = () => { if (!onOpen || !talkTo) return; if (fsRef.current) exitFs(); onOpen(talkTo); };
1651
1775
 
1652
1776
  // ── Drawing: the back and front layers are pictures of the scene at the view's resolution (remade when the office
1653
1777
  // or the zoom changes, never on a pan); each frame draws the matte, the layers, the people and the items in the air ──
@@ -1704,6 +1828,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1704
1828
  ctx.clearRect(0, 0, BW, BH);
1705
1829
  ctx.fillStyle = s.matte; ctx.fillRect(0, 0, BW, BH);
1706
1830
  ctx.imageSmoothingEnabled = false;
1831
+ for (const p of s.overview ? s.parts : [s.part]) p.reply = replyRef.current ? { ...replyRef.current, ratio: s.ratio } : null;
1707
1832
  if (!s.overview) {
1708
1833
  // #4379 review: an open card (beside its person, or a bottom sheet) covers part of the scene: a name tag under it is
1709
1834
  // left out whole, never a fragment showing past its edge. Its box in bitmap px, as the canvas lies on the page.
@@ -1760,7 +1885,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1760
1885
  if (!front) { dlgShown.current = null; showDialogueDock(false); return false; }
1761
1886
  const who = d.who.get(front.instance), node = who.node;
1762
1887
  const stage = stageOf(front, t, node.state === "working", still);
1763
- if (stage.done) { dlgShown.current = null; showDialogueDock(false); return false; }
1888
+ // Talk "Dialogue box" (d.vn) keeps an answer until it is clicked away in its own box (TalkStage); the dock is not drawn then.
1889
+ if (stage.done && !d.vn) { dlgShown.current = null; showDialogueDock(false); return false; }
1764
1890
  showDialogueDock(true);
1765
1891
  const cv = dialogueCanvasRef.current;
1766
1892
  if (!cv) return false; // layout commit mounts the dock, then its effect paints even with reduced motion
@@ -1817,10 +1943,10 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1817
1943
  }
1818
1944
  // A newly mounted dock must paint even when reduced motion leaves the map loop asleep.
1819
1945
  useLayoutEffect(() => {
1820
- if (!dialogueOn || !dlgVisible) return;
1946
+ if (!dlgOn || !dlgVisible) return;
1821
1947
  if (scene.current) drawDialogue(scene.current.ctx, scene.current, still ? 0 : now());
1822
1948
  if (!still) loop.current?.wake();
1823
- }, [dialogueOn, dlgVisible, dlgSay, width, phone, ratio]);
1949
+ }, [dlgOn, dlgVisible, dlgSay, width, phone, ratio]);
1824
1950
 
1825
1951
  // The loop: drawing only when the frame (FPS) changed or something is in the air; stopped while the tab is hidden,
1826
1952
  // gone with the view. Office review: while something walks or flies, one requestAnimationFrame per display frame (the
@@ -1879,7 +2005,35 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1879
2005
  area: zones ? areaName(d.area) : roomOf(L, d), skin, look: looks.get(d.key) }));
1880
2006
  // #2861: who the dialogue box may speak for — everyone drawn here (All offices: the first tile they are in), with what
1881
2007
  // draws them; null while it is off (draw() then draws nothing of it).
1882
- dlgRef.current = dialogueOn ? {
2008
+ replyRef.current = tmode === "bubble" ? { chat, draw: chatUi.drawReply, style: chatUi.replyStyle, pace: chatUi.readPace, read: readMode } : null;
2009
+ const talkWho = talkTo ? people.find((d) => d.node && d.node.name === talkTo) || null : null;
2010
+ const talkLabel = talkWho ? nodeText(talkWho.node).primary : talkTo;
2011
+ const sidePanel = tmode === "panel" && !!talkTo;
2012
+ /** Talk "Dialogue box": what the box on the scene shows now (fleet-office-talk.js TalkStage), or null. */
2013
+ const stagePeek = () => {
2014
+ const d = dlgRef.current;
2015
+ const pf = d ? pickFront(dlg.list(), (n) => d.who.has(n), (n) => d.who.get(n).look?.pose === "paused") : { front: null, more: 0 };
2016
+ const conv = pf.front, name = conv ? conv.instance : talkTo;
2017
+ if (!name) return null;
2018
+ const who = d ? d.who.get(name) : null, node = who ? who.node : (people.find((x) => x.node && x.node.name === name) || {}).node;
2019
+ if (!node) return null;
2020
+ const sk = (who && who.skin) || skin, pack = sk && sk.pack, act = actsHere && actsHere.get(name);
2021
+ const pic = (src) => { const im = src && sk && typeof sk.picture === "function" ? sk.picture(src, () => {}) : null; return im && im.src ? im.src : null; };
2022
+ return {
2023
+ name, label: nodeText(node).primary, conv, more: pf.more,
2024
+ status: node.state === "working" ? (actLive(act, node.state, Date.now(), null) && act.say ? act.say : to("dlgWorking")) : null,
2025
+ portrait: pack ? pic(portraitSrc(pack, { agent: name, state: node.state })) : null,
2026
+ colours: (pack && pack.dialogBox) || null,
2027
+ };
2028
+ };
2029
+ const stageOps = {
2030
+ now, skip: () => skipTalk(), target: (n) => { if (talkTo !== n) setTalkTo(n); },
2031
+ drop: (instance) => { dlg.drop(instance); dlgWake(); },
2032
+ };
2033
+ // The dialogue box is the talk only as itself (or beside the pop-up): never under the side panel or the head bubble.
2034
+ const dockShown = dlgOn && dlgVisible && tmode === "window";
2035
+ dlgRef.current = dlgOn ? {
2036
+ vn: tmode === "box", read: readMode,
1883
2037
  who: new Map(people.filter((d) => d.node && d.node.name).reverse().map((d) => [d.node.name, { key: d.key, node: d.node, look: d.look, skin: d.skin || skin }])),
1884
2038
  acts: actsHere, share: talk !== undefined,
1885
2039
  } : null;
@@ -1909,7 +2063,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1909
2063
  return d ? { key: p.prefix + d.key, node: d.node } : null;
1910
2064
  };
1911
2065
  const g = gestures(drag.current, { el: () => stageRef.current, pan: (dx, dy) => { const v = view0(); setView({ ...v, x: v.x + dx, y: v.y + dy }); },
1912
- pinch: (from, to) => { raw.current = Math.min(OK_MAX, Math.max(OK_MIN, raw.current * (to.dist / from.dist))); setView(pinchOffice(view0(), from, to, raw.current)); } });
2066
+ pinch: (from, to) => { raw.current = Math.min(OK_MAX, Math.max(kLo, raw.current * (to.dist / from.dist))); setView(pinchOffice(view0(), from, to, raw.current, kLo)); } });
1913
2067
  /** Where a drag pans: the canvas, and Edit layout's overlay off its handles (the controls, the bar and the list: never). */
1914
2068
  const onScene = (el) => !!el && (el === canvasRef.current || (typeof el.closest === "function" && !!el.closest(".ol-svg") && !el.closest(".ol-handle")));
1915
2069
  /** M-3293 / M-3445: update the floor-level seat drop targets while carrying `h` ({ name, at }). */
@@ -2005,8 +2159,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2005
2159
  if (!onScene(e.target) && !(typeof e.target?.closest === "function" && e.target.closest(".ol-handle, .oo-tile-label"))) return;
2006
2160
  e.preventDefault();
2007
2161
  const r = stageRef.current.getBoundingClientRect(), v = view0();
2008
- raw.current = Math.min(OK_MAX, Math.max(OK_MIN, raw.current * wheelFactor(e)));
2009
- if (raw.current !== v.k) setView(zoomOffice(v, raw.current, e.clientX - r.left, e.clientY - r.top));
2162
+ raw.current = Math.min(OK_MAX, Math.max(kLo, raw.current * wheelFactor(e)));
2163
+ if (raw.current !== v.k) setView(zoomOffice(v, raw.current, e.clientX - r.left, e.clientY - r.top, kLo));
2010
2164
  };
2011
2165
  const onKeyDown = (e) => {
2012
2166
  if (e.defaultPrevented) return; // Edit layout's handles move with the arrows
@@ -2057,6 +2211,9 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2057
2211
  }
2058
2212
  setCard(null); open(dlgShown.current.name);
2059
2213
  };
2214
+ /** Skip (the reading controls): every reply in the box, or over the heads, goes now. */
2215
+ const skipTalk = () => { if (tmode === "box") dlg.skip(); else if (chat) chat.skipAll(); dlgWake(); };
2216
+ const pickRead = (v) => { store.saveTalkRead(v); setReadMode(v); dlgWake(); };
2060
2217
  const onMove = (e) => {
2061
2218
  if (e.pointerType === "touch" || g.busy() || snackDrag || snackDropRef.current) return;
2062
2219
  const onDlg = !!dlgAt(e) || !!bubbleAtEvent(e);
@@ -2082,7 +2239,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2082
2239
  const wk = zones ? walkers.at(d.node.name, at) : null;
2083
2240
  return { key: d.key, node: d.node, x: wk ? wk.x : d.box.x + d.box.w / 2, y: wk ? wk.y - 32 : d.box.y + d.box.h / 2 };
2084
2241
  });
2085
- return nearestPerson(list, w.x, w.y, TAP_R / Math.max(OK_MIN, view0().k));
2242
+ return nearestPerson(list, w.x, w.y, TAP_R / Math.max(kLo, view0().k));
2086
2243
  };
2087
2244
  /** M-3432 (#4255): feed an awake person a snack (plays eat animation + hearts + feed bubble + optional Tell). */
2088
2245
  const feedPerson = (name, snack, at) => {
@@ -2198,6 +2355,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2198
2355
  const onClick = (e) => {
2199
2356
  const box = dlgAt(e);
2200
2357
  const bubble = bubbleAtEvent(e);
2358
+ if (bubble && bubble.reply && chat) { if (talkTo !== bubble.name) setTalkTo(bubble.name); chat.advance(bubble.name); return; }
2201
2359
  if ((box || bubble) && !shared && onOpen) {
2202
2360
  if (!(e.detail > 1)) { setCard(null); open((box || bubble).name); }
2203
2361
  return;
@@ -2224,12 +2382,21 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2224
2382
  }
2225
2383
  }
2226
2384
  const d = deskOf(e) || (lastType.current === "touch" ? nearOf(e) : null);
2227
- if (!d || !d.node.i) { setTip(null); setCard(null); return; }
2385
+ if (!d || !d.node.i) { if (enterTile(e)) return; setTip(null); setCard(null); return; }
2228
2386
  if (lastType.current === "touch") setTip(null);
2229
2387
  cardFrom.current = null;
2230
2388
  setCard((cur) => (cur === d.key ? null : d.key));
2231
2389
  };
2232
- // All offices: a double-click on a tile (off its people) opens that office; the lobby is no office.
2390
+ /** All offices: a click on a tile (off its people) enters that office for this visit; the lobby is no office. */
2391
+ const enterTile = (e) => {
2392
+ const s = scene.current, w = pointOf(e);
2393
+ if (!overview || !s || !s.overview || !w || deskOf(e)) return false;
2394
+ const tt = tileAt(s.lay, w.x, w.y) || labelAt(s.lay, w.x, w.y), tl = tt ? tiles.find((x) => x.key === tt.key) : null;
2395
+ if (!tl || tl.lobby) return false;
2396
+ setCard(null); pick(tl.key, false);
2397
+ return true;
2398
+ };
2399
+ // All offices: a double-click on a tile (off its people) opens that office, as one click does.
2233
2400
  const onDblClick = (e) => {
2234
2401
  const box = dlgAt(e);
2235
2402
  if (box || bubbleAtEvent(e)) return; // the first click already opened it
@@ -2281,7 +2448,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2281
2448
  const teamValue = (opts.find((o) => o.team === f.team) || opts[0]).value;
2282
2449
  const setF = (next) => { const v = filterOk(next); store.saveFilter(v); setFilter(v); };
2283
2450
  // While Edit layout is open the office stays (its picker is disabled; this is the guard behind it).
2284
- const pick = (id) => {
2451
+ /** The switcher's pick (kept per device); `keep` false: a tile entered from All offices, for this visit only. */
2452
+ const pick = (id, keep = true) => {
2285
2453
  if (layoutRef.current) return;
2286
2454
  if (id === CAROUSEL_ID) {
2287
2455
  const cur = store.carousel();
@@ -2289,7 +2457,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2289
2457
  const next = { ids: ids.length ? ids : stored.map((o) => o.id), interval: intervalOk(cur && cur.interval) };
2290
2458
  store.saveCarousel(next); setCarSaved(next); setCarIndex(0); setCarPlaying(true);
2291
2459
  }
2292
- store.saveChoice(id); setChoice(id); setTip(null);
2460
+ if (keep) store.saveChoice(id);
2461
+ setChoice(id); setTip(null);
2293
2462
  };
2294
2463
  const setCarIds = (ids) => {
2295
2464
  const next = { ids, interval: intervalOk(carSaved && carSaved.interval) };
@@ -2308,7 +2477,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2308
2477
  const tipText = tipDesk ? nodeText(tipDesk.node) : null;
2309
2478
  // #2661: the card's person (gone from the office, filtered out or the office changed: it closes).
2310
2479
  const cardOf = card ? people.find((d) => d.key === card && d.node.i) || null : null;
2311
- cardDesk.current = cardOf ? { name: cardOf.node.name, box: cardOf.box, walks: zones && !overview } : null;
2480
+ cardDesk.current = cardOf ? { name: cardOf.node.name, box: cardOf.box, walks: zones && !overview, skin: cardOf.skin } : null;
2312
2481
  useEffect(() => { if (card && !cardOf) setCard(null); }, [card, !!cardOf]);
2313
2482
  const closeCard = () => {
2314
2483
  setCard(null);
@@ -2348,7 +2517,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2348
2517
  const r = deviceRatio(), W = Number(sizePx) || 56;
2349
2518
  if (cv.width !== Math.round(W * r) || cv.height !== Math.round(W * r)) { cv.width = Math.round(W * r); cv.height = Math.round(W * r); }
2350
2519
  g.setTransform(1, 0, 0, 1, 0, 0); g.clearRect(0, 0, cv.width, cv.height); g.imageSmoothingEnabled = false;
2351
- const look = { ...c.look, pose: "idle", dim: false, match: false, badge: null, notag: true, free: true, work: 0, sign: null };
2520
+ // The card's avatar: the set's still `stand` when it has one (poseStrip falls back to idle).
2521
+ const look = { ...c.look, pose: "stand", dim: false, match: false, badge: null, notag: true, free: true, work: 0, sign: null };
2352
2522
  const at = { x: 0, y: 0 }, b = c.skin.charBox ? c.skin.charBox(look, at) : null, box = b || { x: -16, y: -48, w: 32, h: 48 };
2353
2523
  const k = Math.min((W - 8) / box.w, (W - 8) / box.h) * r;
2354
2524
  g.setTransform(k, 0, 0, k, (W * r) / 2 - (box.x + box.w / 2) * k, (W * r) / 2 - (box.y + box.h / 2) * k);
@@ -2417,6 +2587,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2417
2587
  // M-3556: the bar in three groups — scope (which office, whom: left of the desk's one row), the display options (behind
2418
2588
  // ⚙) and the actions (right). A phone's ⋯ sheet lists all three in that order.
2419
2589
  const scopeItems = html`
2590
+ ${custom && !carouselPick && opening == null && !layout && overviewOk(stored) ? html`<button type="button" class="btn btn-sm oo-back-all" onClick=${() => pick(ALL_ID)}>${to("backAll")}</button>` : null}
2420
2591
  ${oneOffice ? null : html`<label class="oo-pick"><span class="oo-pick-label">${to("office")}</span>${officeSelect("oo-office")}</label>`}
2421
2592
  ${auto ? html`<label class="oo-pick"><span class="oo-pick-label">${to("show")}</span>
2422
2593
  <select class="tb-select oo-team" value=${teamValue} onChange=${(e) => { const o = opts.find((x) => x.value === e.target.value); setF({ ...f, team: o ? o.team : "" }); }}>
@@ -2447,6 +2618,10 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2447
2618
  onChange=${() => { const v = !playOn; store.savePlayOn(v); setPlayOn(v); }} /><span>${to("playOn")}</span>${playStillOff ? html`<span class="muted oo-note oo-play-still">${to("playMotionOff")}</span>` : null}</label>` : null}
2448
2619
  ${zones || overview ? html`<label class="check oo-night"><input type="checkbox" checked=${nightOn} onChange=${() => { const v = !nightOn; store.saveNightOn(v); setNightOn(v); }} /><span>${to("nightOn")}</span></label>` : null}
2449
2620
  <label class="check oo-dialogue" title=${to("dialogueTitle")}><input type="checkbox" checked=${dialogueOn} onChange=${toggleDialogue} /><span>${to("dialogue")}</span></label>
2621
+ ${chat && !shared ? html`<label class="oo-pick oo-talk-pick" title=${chatUi.talkWord("modeTitle")}><span class="oo-pick-label">${chatUi.talkWord("mode")}</span>
2622
+ <select class="tb-select oo-talk-mode" value=${tmode} onChange=${(e) => pickTalkMode(e.target.value)}>
2623
+ ${chatUi.TALK_MODES.map((m) => html`<option key=${m} value=${m}>${chatUi.talkWord(m)}</option>`)}
2624
+ </select></label>` : null}
2450
2625
  ${overview ? html`<label class="check oo-lobby-tile" title=${lobbyAll.length ? undefined : to("lobbyEveryone")}><input type="checkbox" checked=${lobbyOn && lobbyAll.length > 0}
2451
2626
  disabled=${!lobbyAll.length} onChange=${() => { const v = !lobbyOn; store.saveLobbyTile(v); setLobbyOn(v); setTip(null); }} /><span>${to("lobbyTile")}</span></label>
2452
2627
  ${lobbyAll.length ? null : html`<span class="muted oo-note oo-lobby-none">${to("lobbyEveryone")}</span>`}` : null}
@@ -2475,7 +2650,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2475
2650
  const displayMenu = (opener) => html`<div class=${`oo-display${roomGear ? " oo-display-zoom" : ""}`} ref=${displayRef}>${opener}
2476
2651
  ${dispOpen ? html`<div class="oo-display-pop" role="group" aria-label=${to("display")} ref=${fitPop}><h3 class="oo-display-h">${to("display")}</h3>
2477
2652
  <div class="oo-bar oo-display-list">${optionItems}</div></div>` : null}</div>`;
2478
- return html`<div class=${`oo${fs ? ` fs ${fs}` : ""}${compact ? " phone" : ""}${dlgVisible ? " has-dialogue" : ""}`} ref=${ooRef}>
2653
+ return html`<div class=${`oo${fs ? ` fs ${fs}` : ""}${compact ? " phone" : ""}${dockShown ? " has-dialogue" : ""}${sidePanel && !phone ? " ot-side" : ""}`} ref=${ooRef}>
2479
2654
  ${folded ? null : html`<div class="oo-bar oo-bar-row">
2480
2655
  <div class="oo-bar-scope">${scopeItems}</div>
2481
2656
  <div class="oo-bar-actions">${actionItems}
@@ -2489,7 +2664,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2489
2664
  ${tile("fitwidth", to("fill"), toggleFill, "oo-sheet-fill", fitMode === "cover")}
2490
2665
  ${tile("fullscreen", to("fullscreen"), () => { closeMore(); enterFs(); }, "oo-sheet-fs")}
2491
2666
  </div>` : null}
2492
- ${typeof onLive === "function" ? html`<label class="check oo-sheet-live"><input type="checkbox" checked=${!!live} onChange=${() => onLive(!live)} /><span>${t("orgc.live")}</span></label>` : null}
2667
+ ${typeof onLive === "function" ? html`<label class="check oo-sheet-live"><input type="checkbox" checked=${!!live} onChange=${() => onLive(!live)} /><span>${to("live")}</span></label>` : null}
2493
2668
  <div class="oo-bar oo-sheet-bar" onClick=${sheetClick}>${barItems}</div>
2494
2669
  </${Dialog}>` : null}
2495
2670
  ${traffic && keyOpen ? html`<${OfficeKey} pal=${pal} />` : null}
@@ -2498,14 +2673,16 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2498
2673
  ${overview || people.length || L.rooms.length ? null : html`<p class="note oo-empty">${to("nobody")} ${auto && (f.team || f.pinned.length) ? html`<button type="button" class="btn btn-sm" onClick=${() => setF({ team: "", pinned: [] })}>${to("everyone")}</button>` : null}</p>`}
2499
2674
  <div class=${`oo-stage${layout ? " editing" : ""}`} ref=${stageRef} onPointerDown=${onDown} onPointerMove=${onStageMove} onPointerUp=${onStageUp} onPointerCancel=${onStageCancel}
2500
2675
  onWheel=${onWheel} onKeyDown=${onKeyDown} onFocusIn=${onFocusIn} onClickCapture=${g.clickCapture}>
2501
- ${dialogueOn ? html`<div class="sr-only oo-dialogue-live" aria-live="polite">${dlgSay}</div>` : null}
2676
+ ${dlgOn ? html`<div class="sr-only oo-dialogue-live" aria-live="polite">${dlgSay}</div>` : null}
2502
2677
  <canvas ref=${canvasRef} class=${`oo-canvas${(tipDesk && tipDesk.node.i) || dlgHot ? " hot" : ""}`} role="application" tabindex="0" aria-label=${to(carouselPick ? "labelCarousel" : overview ? "labelAll" : "label")}
2503
2678
  onPointerMove=${onMove} onPointerLeave=${() => setTip(null)} onClick=${onClick} ondblclick=${onDblClick}></canvas>
2679
+ ${tmode === "box" ? html`<${chatUi.TalkStage} peek=${stagePeek} ops=${stageOps} talk=${chat} read=${readMode} onRead=${pickRead} phone=${phone} still=${still}
2680
+ onFull=${openFull} onClose=${() => { dlg.skip(); setTalkTo(null); dlgWake(); }} />` : null}
2504
2681
  ${overview ? tiles.map((tl) => {
2505
2682
  const text = to("tileLabel", tl.name, tl.count), at = (el) => { if (el) labelEls.current.set(tl.key, el); else labelEls.current.delete(tl.key); };
2506
2683
  return tl.lobby ? html`<span key=${tl.key} ref=${at} class="oo-tile-label lobby">${text}</span>`
2507
2684
  : html`<button key=${tl.key} ref=${at} type="button" class="oo-tile-label" data-office=${tl.key} title=${to("openOffice", tl.name)} aria-label=${to("openOffice", tl.name)}
2508
- onClick=${() => pick(tl.key)}>${text}</button>`;
2685
+ onClick=${() => pick(tl.key, false)}>${text}</button>`;
2509
2686
  }) : null}
2510
2687
  ${layout ? html`<${LayoutEditor} key=${layout.id} base=${layout.base} start=${layout.start} place=${placeOverlay} dock=${!fs} members=${layoutMembers}
2511
2688
  stale=${layoutStale ? t("orgl.stale") : ""} onChange=${onDraft} onSave=${saveLayout} onClose=${closeLayout} />` : null}
@@ -2518,7 +2695,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2518
2695
  model=${cardModel({ node: cardOf.node, lv, levels: wordsOf(cardOf.skin), share: !onOpen, rows: cardRows ? cardRows(cardOf.node.name) : null, display: cardName ? cardName(cardOf.node.name) : "",
2519
2696
  state: stateOf(cardOf.node), now: nowOf(cardOf.node),
2520
2697
  where: [cardOf.office || (custom ? custom.name : to("allOffice")), cardOf.area].filter(Boolean).join(" · ") })}
2521
- avatar=${drawAvatar} sheet=${phone || size.w < SHEET_W} place=${(el) => { const was = cardEl.current; cardEl.current = el; placeCard();
2698
+ avatar=${drawAvatar} sheet=${phone || size.w < SHEET_W} place=${(el) => { const was = cardEl.current; cardEl.current = el; if (!el || !el.classList?.contains("sheet")) unliftSheet(); placeCard();
2522
2699
  // #4379 review: the tags it covers (or uncovers) are judged at the next frame; a still scene draws one now.
2523
2700
  if (was !== el && scene.current) { scene.current.dirty = true; const go = () => (still ? draw(0) : loop.current?.wake()); if (typeof requestAnimationFrame === "function") requestAnimationFrame(go); else go(); } }}
2524
2701
  onChat=${onOpen ? () => { const n = cardOf.node.name; setCard(null); open(n); } : null} onFind=${findCard} onClose=${closeCard}
@@ -2532,13 +2709,17 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2532
2709
  walkNow.current?.();
2533
2710
  }
2534
2711
  }
2535
- reacts.current.set(n, { kind, t0: now() }); loop.current?.wake(); if (store.tellOn(n)) void store.tell(n, kind);
2712
+ // A pat with the set's `pat` strip lasts one full pass of it (never shorter than the hearts).
2713
+ const t0 = now(), patSt = kind === "pat" && skin.patStrip ? skin.patStrip(n) : null;
2714
+ reacts.current.set(n, { kind, t0, ...(patSt ? { until: t0 + Math.max(PLAY.REACT_MS, stripDurationMs(patSt)) } : {}) });
2715
+ loop.current?.wake(); if (store.tellOn(n)) void store.tell(n, kind);
2536
2716
  } : null}
2537
2717
  tell=${play ? { on: store.tellOn(cardOf.node.name), set: (v) => { store.saveTell(cardOf.node.name, v); setTellRev((x) => x + 1); } } : null}
2538
2718
  packCard=${cardOf.skin?.pack?.card || null}
2539
2719
  picture=${typeof cardOf.skin?.picture === "function" ? cardOf.skin.picture : null}
2540
2720
  portrait=${cardOf.skin?.pack ? portraitSrc(cardOf.skin.pack, { agent: cardOf.node.name, state: cardOf.node.state }) : null}
2541
- packScale=${cardOf.skin?.pack?.scale || 2} action=${cardAction ? cardAction(cardOf.node.name) : null} />` : null}
2721
+ packScale=${cardOf.skin?.pack?.scale || 2} action=${cardAction ? cardAction(cardOf.node.name) : null}
2722
+ photo=${cardPhoto ? cardPhoto(cardOf.node.name) : null} />` : null}
2542
2723
  <ul class="oo-desks" aria-label=${to("desks")}>${people.map((d) => {
2543
2724
  const nt = nodeText(d.node), cap = nowOf(d.node), where = d.office ? ` · ${d.office}` : "";
2544
2725
  const full = words ? `${nt.primary} — ${stateOf(d.node)}` : nt.full;
@@ -2547,10 +2728,10 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2547
2728
  onFocus=${() => setTip(d.key)} onBlur=${() => setTip(null)} onClick=${() => { cardFrom.current = d.key; setCard((cur) => (cur === d.key ? null : d.key)); }}>${nt.primary}</button>`
2548
2729
  : html`<span class="oo-desk" data-name=${d.node.name} data-key=${d.key}>${full}</span>`}</li>`;
2549
2730
  })}</ul>
2550
- <div class="oc-zoom oo-zoom" role="group" aria-label=${t("orgc.view")}>
2731
+ <div class="oc-zoom oo-zoom" role="group" aria-label=${to("view")}>
2551
2732
  <output ref=${pctRef} class="oo-zoom-pct"></output>
2552
- <button type="button" class="icon-btn oo-zoom-in" aria-label=${t("orgc.zoomIn")} title=${t("orgc.zoomIn")} onClick=${() => zoomStep(1)}><${Icon} name="plus" size=${16} /></button>
2553
- <button type="button" class="icon-btn oo-zoom-out" aria-label=${t("orgc.zoomOut")} title=${t("orgc.zoomOut")} onClick=${() => zoomStep(-1)}><${Icon} name="minus" size=${16} /></button>
2733
+ <button type="button" class="icon-btn oo-zoom-in" aria-label=${to("zoomIn")} title=${to("zoomIn")} onClick=${() => zoomStep(1)}><${Icon} name="plus" size=${16} /></button>
2734
+ <button type="button" class="icon-btn oo-zoom-out" aria-label=${to("zoomOut")} title=${to("zoomOut")} onClick=${() => zoomStep(-1)}><${Icon} name="minus" size=${16} /></button>
2554
2735
  <button type="button" class="icon-btn oo-fit" aria-label=${to("fit")} title=${to("fit")} onClick=${() => fit()}><${Icon} name="fitwidth" size=${16} /></button>
2555
2736
  <button type="button" class=${`icon-btn oo-fill${fitMode === "cover" ? " on" : ""}`} aria-pressed=${fitMode === "cover" ? "true" : "false"} aria-label=${to("fillTitle")}
2556
2737
  title=${to("fillTitle")} onClick=${toggleFill}>${to("fill")}</button>
@@ -2590,9 +2771,13 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2590
2771
  <button type="button" class="btn btn-sm oo-zone-all" onClick=${() => fit()}>${to("zoneAll")}</button>
2591
2772
  ${zoneList.map((z) => html`<button key=${z.key} type="button" class="btn btn-sm oo-zone" data-area=${z.key} onClick=${() => toZone(z)}>${to("zoneN", areaName(z.key), z.n)}</button>`)}
2592
2773
  </div>` : null}
2593
- ${dialogueOn && dlgVisible ? html`<canvas class="oo-dialogue-canvas" ref=${dialogueCanvasRef}
2774
+ ${dockShown ? html`<canvas class="oo-dialogue-canvas" ref=${dialogueCanvasRef}
2594
2775
  role=${onOpen && !shared ? "button" : "img"} tabindex=${onOpen && !shared ? "0" : null}
2595
2776
  aria-label=${onOpen && !shared ? to("dlgOpenChat") : dlgSay} title=${onOpen && !shared ? to("dlgOpenChat") : null}
2596
2777
  onClick=${openDialogue} onKeyDown=${openDialogue}></canvas>` : null}
2778
+ ${tmode === "bubble" ? html`<${chatUi.TalkBar} talk=${chat} name=${talkTo} label=${talkLabel} onFull=${openFull}
2779
+ read=${readMode} onRead=${pickRead} onSkip=${skipTalk} />` : null}
2780
+ ${sidePanel ? html`<${chatUi.TalkPanel} talk=${chat} name=${talkTo} label=${talkLabel} state=${talkWho ? talkWho.node.state : null} stateLabel=${talkWho ? stateOf(talkWho.node) : null} sheet=${phone}
2781
+ onClose=${() => setTalkTo(null)} onFull=${openFull} top=${stageRef.current ? stageRef.current.offsetTop : null} />` : null}
2597
2782
  </div>`;
2598
2783
  }