pi-straw-boss 0.57.1 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/README.zh-TW.md +11 -1
- package/dist/gui/assets/{answer-B2xVIGxA.js → answer-Df5Xsumd.js} +1 -1
- package/dist/gui/assets/{ask-GnsZN-ZU.js → ask-YLFOfyPL.js} +1 -1
- package/dist/gui/assets/chat-qWL8FgQ4.js +2 -0
- package/dist/gui/assets/drawer-Bw9Ifvof.js +1 -0
- package/dist/gui/assets/index-C5ao9YJA.js +2 -0
- package/dist/gui/assets/index-DTAQvxMk.css +1 -0
- package/dist/gui/assets/layer-fkM6TRNE.js +1 -0
- package/dist/gui/assets/{lightbox-B_LOCdRi.js → lightbox-D-X8iJX-.js} +1 -1
- package/dist/gui/assets/link-BtJYO_kH.js +1 -0
- package/dist/gui/assets/linkdialogs-JxXE8c5p.js +1 -0
- package/dist/gui/assets/{pair-_0iZp_rL.js → pair-CDu1AZdS.js} +3 -3
- package/dist/gui/assets/{picker-BxEsplO6.js → picker-BRc40HjN.js} +1 -1
- package/dist/gui/assets/{server-CfO0fbdV.js → server-BoioQoSN.js} +2 -2
- package/dist/gui/assets/sessionfacts-BVSrxWWq.js +1 -0
- package/dist/gui/assets/{settings-BbLlLiNl.js → settings-BjTSI7y8.js} +2 -2
- package/dist/gui/assets/{spawn-Ctnm_ccF.js → spawn-1QOqPxeT.js} +1 -1
- package/dist/gui/assets/{trust-rtDPq63p.js → trust-7XUKlnNS.js} +1 -1
- package/dist/gui/assets/{unit_count-C_IKdFh4.js → unit_count-DK_9HQJj.js} +1 -1
- package/dist/gui/assets/views-Cuh01A5V.js +2 -0
- package/dist/gui/assets/waitpanel-DZzSM06_.js +6 -0
- package/dist/gui/assets/zenchunk-dFTpPJf3.js +2 -0
- package/dist/gui/assets/zenchunk-mcuxHiQU.css +1 -0
- package/dist/gui/index.html +4 -2
- package/dist/server/{chunk-LJ3SPNF5.mjs → chunk-DST2WCCT.mjs} +83 -10
- package/dist/server/cli.mjs +8 -60
- package/dist/server/main.mjs +3481 -2764
- package/package.json +1 -1
- package/prompts/head-run.md +9 -0
- package/prompts/tower-run.md +2 -2
- package/prompts/tower.md +1 -1
- package/src/boss.ts +8 -1
- package/src/control.ts +7 -0
- package/src/dashboard.ts +5 -3
- package/src/gui.ts +1 -1
- package/src/headcmd.ts +105 -0
- package/src/header.ts +10 -32
- package/src/headerfields.ts +50 -0
- package/src/headhistory.ts +46 -0
- package/src/headkey.ts +4 -0
- package/src/headroutes.ts +41 -0
- package/src/herdr.ts +21 -9
- package/src/items.ts +1 -1
- package/src/memorycmd.ts +3 -1
- package/src/net.ts +14 -13
- package/src/nethead.ts +42 -0
- package/src/order.ts +5 -5
- package/src/reach.ts +24 -21
- package/src/reachhead.ts +40 -0
- package/src/restored.ts +6 -3
- package/src/runallow.ts +11 -5
- package/src/runhead.ts +19 -0
- package/src/runmode.ts +24 -16
- package/src/server/bossconv.ts +6 -2
- package/src/server/client.ts +2 -2
- package/src/server/guihost.ts +4 -1
- package/src/server/head.ts +143 -0
- package/src/server/headasks.ts +86 -0
- package/src/server/headbrief.ts +91 -0
- package/src/server/headchapters.ts +78 -0
- package/src/server/headcmds.ts +20 -0
- package/src/server/headgate.ts +22 -0
- package/src/server/headnet.ts +60 -0
- package/src/server/headside.ts +108 -0
- package/src/server/headtools.ts +66 -0
- package/src/server/lineage.ts +2 -1
- package/src/server/main.ts +6 -2
- package/src/server/opentower.ts +2 -2
- package/src/server/record.ts +3 -0
- package/src/server/rungate.ts +3 -1
- package/src/server/runs.ts +64 -28
- package/src/server/runtools.ts +16 -1
- package/src/server/standing.ts +7 -5
- package/src/server/towerbrief.ts +4 -4
- package/src/server/towermemory.ts +10 -5
- package/src/server/towerpanel.ts +16 -6
- package/src/server/towerrunstore.ts +2 -0
- package/src/server/towers.ts +119 -40
- package/src/server/towerstore.ts +35 -15
- package/src/server/typegate.ts +9 -4
- package/src/session.ts +2 -3
- package/src/spawn.ts +2 -2
- package/src/stash.ts +2 -1
- package/src/state.ts +1 -3
- package/src/tools.ts +8 -3
- package/src/tower.ts +0 -2
- package/src/towerprompt/look.ts +4 -3
- package/src/towerprompt/messages.ts +4 -0
- package/src/towerprompt/prompt.ts +1 -1
- package/src/towerprompt/serversource.ts +1 -1
- package/src/towerprompt/source.ts +2 -0
- package/src/watch.ts +10 -9
- package/dist/gui/assets/chat-BjCnzH9C.js +0 -2
- package/dist/gui/assets/drawer-Db1FxK9v.js +0 -1
- package/dist/gui/assets/index-BeKhdUMk.css +0 -1
- package/dist/gui/assets/index-xkaqCr46.js +0 -2
- package/dist/gui/assets/layer-C0tYSonN.js +0 -1
- package/dist/gui/assets/link-Czdv2G24.js +0 -1
- package/dist/gui/assets/linkdialogs-DvpmFqpw.js +0 -1
- package/dist/gui/assets/sessionfacts-DEAEBK6-.js +0 -1
- package/dist/gui/assets/termcard-fFZrioKd.js +0 -6
- package/dist/gui/assets/views-46qJ0r7v.js +0 -2
- package/dist/gui/assets/zenchunk-CSJxIIPm.js +0 -2
- package/dist/gui/assets/zenchunk-wpsmgtPq.css +0 -1
- package/src/headwatch.ts +0 -31
package/README.md
CHANGED
|
@@ -32,6 +32,14 @@ English | [繁體中文](https://github.com/wayne930242/pi-straw-boss/blob/main/
|
|
|
32
32
|
|
|
33
33
|
<p align="center"><sub>Zen: one item at a time, the companion session when nothing waits, a breathing circle when there is no session, the corner menu, the context, the command palette, the music, and the same on a phone.</sub></p>
|
|
34
34
|
|
|
35
|
+
**The head tower** is the one tower that belongs to no project. You talk to it in one long conversation, on its own page in Standard or in a line under Zen's breathing circle, and it decides which workspace owns each instruction and hands it to that workspace's tower, opening the tower if there is none. It does no work itself and answers you in a line when a tower answers it. Zen shows its last lines fading as they age (hover to read them clear, **H** or a swipe up for the whole conversation), and the input stays a hairline until you click it or press Enter.
|
|
36
|
+
|
|
37
|
+
<p align="center"><img src="docs/gui-head.png" width="49%" alt="The head tower's page in the Standard view: a crowned header, the conversation with two forwards to the Harbor API and Lighthouse Web towers and one answer, the open and answered asks as chips, and the composer"> <img src="docs/gui-zen-head.png" width="49%" alt="The Zen view with the head tower: its last lines under the breathing circle, a note for the answer from the Lighthouse Web tower, and a hairline input that says Enter to talk to the head tower"></p>
|
|
38
|
+
|
|
39
|
+
<p align="center"><img src="docs/gui-zen-head-open.png" width="49%" alt="The Zen strip with the input open and a draft typed, the head tower's lines clear under the pointer"> <img src="docs/gui-phone-zen-head.png" width="220" alt="The Zen strip on a phone: two lines of the head tower's conversation, the Whole conversation link, and the folded input"></p>
|
|
40
|
+
|
|
41
|
+
<p align="center"><sub>The head tower: its page, the strip under Zen's circle, the open input, and the strip on a phone.</sub></p>
|
|
42
|
+
|
|
35
43
|

|
|
36
44
|
|
|
37
45
|
<p align="center"><sub>Herdr with the net view in its sidebar.</sub></p>
|
|
@@ -47,10 +55,12 @@ Run a few agents on the same project and they start stepping on each other: two
|
|
|
47
55
|
- **A tower per workspace.** It opens in its own tab, pinned first, when agents start to collide: a member dispatches a subagent (it promotes itself first), a workspace has two members while another workspace already has a tower, an agent promotes itself, or you type `/boss tower`. Mains and the tower go together: a tower that opens promotes each tab's earliest member, and a tower that quits turns every main back into a member (its subagents stay). It and coordinates the main agents and the other towers, and opens a tab with a main agent for work no session owns. You don't need to talk to it.
|
|
48
56
|
- **A live dashboard** in the tower: who joined, and what they and their subagents are doing.
|
|
49
57
|
- **Towers talk to each other.** A tower lists every workspace's tower (`tower_list`: who a message for it reaches, what its tabs work on) and writes to one or all of them (`tower_send`); a workspace without a tower is reached through its mains, else its members. Every `call_tower`, `boss_broadcast`, and `tower_send` message opens with a header the code writes: who sent it, in what role, to whom, and whether a reply is expected ([how](docs/how-it-works.md#talking-between-towers)).
|
|
58
|
+
- **A head tower of your own.** One tower that belongs to no project: you talk to it in the GUI (its page, or the line under Zen's circle) or with `/boss head`, it keeps one long conversation with you across runs, and it hands each instruction to the tower of the workspace that owns it (`tower_send`, opening that tower if needed) and tells you in a line when the tower answers. Its tools are the tower's lookup and forwarding tools and nothing else, and it listens only to you and to answers to its own forwards ([how](docs/how-it-works.md#the-head-tower)).
|
|
50
59
|
- **A work board.** A main's board fills itself from its todo list and its name (`board_set` overrides it); allies see only an auto entry's name and progress (`<name> (3/5)`), never its task text; towers read every main's entry (`board_read`), on this computer and, with Straw Link, on teammates' computers, so a tower routes work knowing where each main stands ([how](docs/how-it-works.md#the-work-board)).
|
|
51
60
|
- **A tower closes the mains it opened.** A main a tower opened for a request reports to the sender and to the tower, and the tower closes it (`boss_close_main`) when nothing is running in it ([how](docs/how-it-works.md#closing-an-opened-main)).
|
|
52
61
|
- **A digest for the tower**: joins, subagent launches, and renames in its workspace since its last run, read into its next run once and cleared ([how](docs/how-it-works.md#the-towers-digest)).
|
|
53
62
|
- **A browser view** of the whole net, `/boss gui`: every workspace as a base with its tower, agents, and subagents, animated and read-only. Click a base to zoom in, click a unit to read its chat as a live comms log; units that wait on you queue up as alerts, and Space opens the next one, F enlarges the top dialog, and Escape closes it (none of them while you type); a question is answered from the keyboard too: arrows choose, Tab walks a question's own-words box and note and then on to the next question, and Enter confirms and goes on. A switch in the header's settings (the gear) raises a system notification, and another plays a sound, when a unit waits on you, fails, or finishes; finished units wait in a list of their own, cleared one by one or all at once, and a finished subagent on the map is dismissed one by one or all at once (Dismiss finished, beside the location). A unit's comms show its background monitors, and one that fails or goes quiet raises a notice (a quiet entry under the header's Notices button; only a unit waiting on you raises the prominent alert); a unit that is idle while a subagent of it works, or while a monitor of it runs, shows as commanding with a glow, and one that only waits on a running monitor shows its note in red. On a desktop a unit's terminal takes your keyboard once you click into it. An answer that leaves its next step in a terminal (robot_hand's prompt and pane choices) shows a small card to finish it: the command, a pane's last rows, one line (hidden while a password is asked), and one button, with a link to the full terminal for ssh and vim. It reads in English or Traditional Chinese, following your browser, with a language menu in the header's settings. + New base, the last card on the map, opens a base in a folder you pick with one member and no tower. A base without a tower takes more members (+ Member on the base adds one in a new tab, on a squad beside that squad), and its tower opens by the rules above; a base with a tower takes new mains (+ Main, on the base or in the tower's comms), each in a tab of its own. In a session's composer, a file pasted, dropped, or picked with + (20 MB at most) is stored in a private temp folder and its path goes into the message. × closes a base, a squad, or (in its view) a unit after a confirmation: each agent quits pi as `/quit` would, then its pane, tab, or workspace closes; nothing closes if one of them refuses. Each opening form takes an optional first message; the folder is picked in Finder-style columns (with New folder, and the base named after the folder by default), staying inside your home folder and skipping hidden folders (on Windows also the ones with the Hidden or System attribute, such as AppData and the old profile links), and while the unit opens a deploy panel shows the real steps (create, start, join the net, deliver the first message) with each step's clock, and names the step and the reason when one fails. A pi that must confirm project trust before it starts (a folder with `.pi/` settings, extensions, skills, or MCP servers) asks in the GUI as an alert too, with the folder, what trusting would load, and Trust, Trust this time, or Don't trust (the terminal can answer as well, and the first answer counts; a paired phone may answer; the deploy panel of an opening shows it inline).
|
|
63
|
+
- **An unattended device**, a computer nobody sits at (a build box, a server), takes work from teammates' computers over Straw Link: it runs the sb server as the link holder, with no boot pi session, and a controller invites it from the GUI ([setup](docs/unattended-device.md), also [in Traditional Chinese](docs/unattended-device.zh-TW.md)).
|
|
54
64
|
- **Broadcast** to a tab, a workspace, every tower (a workspace without one, through its mains or members), or every session.
|
|
55
65
|
- **Tidy tabs.** When a pi starts in a tab or quits out of it, the tab's panes are made equal again, so workers split off one by one don't leave a chain of halves.
|
|
56
66
|
- **Stranded subagents are asked to report.** A subagent that stays open after finishing, while the pi that launched it was restarted and no longer receives its result, is asked once over intercom to send its final report there ([how it works](docs/how-it-works.md#orphaned-subagents)).
|
|
@@ -138,7 +148,7 @@ Subagents and sessions in Herdr worktree workspaces never join: the session that
|
|
|
138
148
|
## Net view in the sidebar
|
|
139
149
|
|
|
140
150
|
An optional Herdr plugin in [`herdr-plugin/`](herdr-plugin) turns the sidebar's Agents list into a net view.
|
|
141
|
-
It lists the head tower's workspace first, in each workspace the tower, then each tab's main agent and members, and every subagent right under the session that launched it, even in a worktree workspace.
|
|
151
|
+
It lists the head tower's workspace first (once the head tower exists), in each workspace the tower, then each tab's main agent and members, and every subagent right under the session that launched it, even in a worktree workspace.
|
|
142
152
|
The view is on whenever the Herdr server starts, and one key switches it off and on again.
|
|
143
153
|
pi-straw-boss writes the sort key (`sb_order`), a role label (`sb_mark`) and, on subagents, a tree branch (`sb_indent`) and the subagent's name (`sb_name`) the view and your sidebar rows can use.
|
|
144
154
|
It needs Herdr 0.9.5 or newer and node.
|
package/README.zh-TW.md
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
|
|
33
33
|
<p align="center"><sub>禪:一次一件待辦、沒東西等時陪著的 session、沒有 session 時的呼吸圓圈、右上角選單、前情、指令面板、音樂,以及同樣的畫面在手機上的樣子。</sub></p>
|
|
34
34
|
|
|
35
|
+
**主塔台(head tower)** 是唯一不屬於任何專案的塔台。你和它只有一場很長的對話:在標準檢視有它自己的一頁,在禪檢視則是呼吸圓圈下方的幾行字。它判斷每件事該由哪個工作區處理,轉給那個工作區的塔台,那個工作區還沒有塔台就先替它開一座。它自己不做事;塔台回覆之後,它再用一行話告訴你。禪檢視裡,它最近說的話會隨時間慢慢淡去(滑鼠移上去就看得清楚,按 **H** 或往上滑可以看全部對話),輸入框平時只是一條細線,點一下或按 Enter 才展開。
|
|
36
|
+
|
|
37
|
+
<p align="center"><img src="docs/gui-head.png" width="49%" alt="標準檢視裡主塔台的頁面:標題有皇冠,對話裡有兩則轉給 Harbor API 和 Lighthouse Web 塔台的紀錄和一則回覆,進行中和已回覆的轉交以標籤列在下方,最下面是輸入框"> <img src="docs/gui-zen-head.png" width="49%" alt="禪檢視裡的主塔台:呼吸圓圈下方是它最近說的幾行字,其中有一行是 Lighthouse Web 塔台的回覆,再下面是一條細線的輸入框,寫著按 Enter 和主塔台說話"></p>
|
|
38
|
+
|
|
39
|
+
<p align="center"><img src="docs/gui-zen-head-open.png" width="49%" alt="輸入框展開、已打了一段草稿的禪檢視:主塔台的幾行字在滑鼠底下是清楚的"> <img src="docs/gui-phone-zen-head.png" width="220" alt="手機上的禪檢視:主塔台對話的兩行字、「全部對話」連結,和收起的輸入框"></p>
|
|
40
|
+
|
|
41
|
+
<p align="center"><sub>主塔台:它的頁面、禪檢視圓圈下方的幾行字、展開的輸入框,以及手機上的樣子。</sub></p>
|
|
42
|
+
|
|
35
43
|

|
|
36
44
|
|
|
37
45
|
<p align="center"><sub>側邊欄開著網路檢視的 Herdr。</sub></p>
|
|
@@ -47,10 +55,12 @@
|
|
|
47
55
|
- **每個工作區一座塔台。** 工作區出現第一個主智慧體時,塔台就在自己的分頁開起來,固定排在最前面。它負責協調各個主智慧體和其他塔台;沒有 session 負責的工作,它會開一個分頁、啟動新的主智慧體來處理。你不用跟它說話。
|
|
48
56
|
- **即時儀表板**在塔台裡:誰加入了,他們和他們的子智慧體正在做什麼。
|
|
49
57
|
- **塔台之間可以直接溝通。** 塔台能列出每個工作區的塔台(`tower_list`:訊息會送到誰、各分頁在做什麼),也能對其中一座或全部發訊息(`tower_send`);沒有塔台的工作區,訊息改送它的主智慧體,沒有主智慧體就送成員。`call_tower`、`boss_broadcast`、`tower_send` 的每則訊息開頭都有一行程式寫的標頭:誰送的、什麼角色、送給誰、要不要回覆([細節](docs/how-it-works.md#talking-between-towers),英文)。
|
|
58
|
+
- **你自己的主塔台。** 一座不屬於任何專案的塔台:你在 GUI(它自己的一頁,或禪檢視圓圈下方的幾行字)或用 `/boss head` 和它說話,它和你保持一場跨越多次執行的長對話,把每件事轉給該處理的工作區的塔台(用 `tower_send`,必要時先替那個工作區開一座塔台),塔台回覆之後用一行話告訴你。它只有查詢和轉交用的塔台工具,只聽你的話和對它自己轉交的回覆([細節](docs/how-it-works.md#the-head-tower),英文)。
|
|
50
59
|
- **工作看板。** 主智慧體的看板由它的待辦清單和名稱自動填入(`board_set` 可覆寫);塔台讀每個主智慧體的項目(`board_read`),本機的,加上 Straw Link 團隊中隊友電腦上的,這樣塔台分派工作時知道各主智慧體做到哪([細節](docs/how-it-works.md#the-work-board))。
|
|
51
60
|
- **塔台會關掉自己開的主智慧體。** 塔台替請求開出的主智慧體做完後,向發話者和那座塔台各回報一次;塔台確認裡面沒有東西在跑,就用 `boss_close_main` 把它關掉([細節](docs/how-it-works.md#closing-an-opened-main),英文)。
|
|
52
61
|
- **給塔台的摘要**:自塔台上一輪以來,工作區裡有誰加入、啟動了哪些子智慧體、誰改了名字;塔台下一輪會讀進來一次,讀完就清掉([細節](docs/how-it-works.md#the-towers-digest))。
|
|
53
62
|
- **瀏覽器畫面** `/boss gui` 看得到整張網:每個工作區是一座基地,裡面有塔台、智慧體和子智慧體,畫面會動,但只能看。點基地可以放大,點單位可以把它的對話當成即時通訊紀錄來讀;在等你回覆的單位會排成警示,按空白鍵開下一則,按 F 放大最上面的對話框,按 Esc 關掉它(打字時都不會觸發);回答問題也可以只用鍵盤:方向鍵選項目,Tab 依序走過每一題自己的答案框和備註、再換到下一題,Enter 確認並跳到下一題。頂端齒輪「設定」裡有兩個開關:單位在等你、出錯或完成時,一個會跳系統通知,一個會播音效;已完成的單位另外排在自己的清單裡,可以一個一個清,也可以一次全清;地圖上已結束的子智慧體也可以一個一個移除,或用位置列旁的「移除已完成」一次全移除。單位的通訊畫面也會列出它在背景跑的 Monitor,出錯或太久沒輸出的 Monitor 會列進標頭的「通知」(只有在等你回答的單位才會跳出醒目的警示,出錯和完成都只是安靜的通知);自己閒置、但它的子智慧體在工作或等待,或它的 Monitor 還在跑的單位,會顯示成帶光暈的「指揮中」;只在等 Monitor 跑完的單位,備註會用紅字顯示「監看中」。在桌面上點進單位的終端機,就能直接用鍵盤操作它。如果一個答案的下一步要在終端機進行(robot_hand 的「放進提示列」和開新 pane 的選項),畫面會出現一張小卡片讓你完成它:指令、窗格最後幾行、一行輸入(要輸入密碼時會自動遮住)和一個按鈕,另有連到完整終端機的連結,給 ssh 和 vim 這類程式用。畫面有英文和正體中文,預設跟隨瀏覽器語言,也可以從頂端「設定」裡的語言選單切換。地圖最後一張「+新基地」會在選定的資料夾開一座基地,裡面先有一位成員、沒有塔台。沒有塔台的基地只能加成員(基地上的「+成員」開在新分頁,小隊上的開在該小隊旁),等成員自己升格時才會開塔台;有塔台的基地只能加主智慧體(「+主智慧體」,各開在自己的分頁)。在 session 的輸入框貼上、拖進或用「+」選的檔案(最多 20 MB)會存到私有的暫存資料夾,路徑放進訊息。開啟表單都可以先填第一句指令;資料夾選擇只能在家目錄以下,也不會列出點開頭的資料夾。
|
|
63
|
+
- **無人值守裝置**是沒有人坐在前面的電腦(建置機、伺服器),透過 Straw Link 接隊友電腦送來的工作:它以 sb server 當連線持有者,沒有開機時啟動的 pi session,由控制端在 GUI 邀請它加入([設定方式](docs/unattended-device.zh-TW.md);[English](docs/unattended-device.md))。
|
|
54
64
|
- **廣播**給一個分頁、一個工作區、所有塔台(沒有塔台的工作區改送主智慧體或成員),或所有 session。
|
|
55
65
|
- **分頁保持整齊。** pi 在分頁裡啟動或結束時,分頁裡的 pane 會重新平均分配,一個一個切出來的 worker 就不會留下一長串對半切的窄 pane。
|
|
56
66
|
- **斷線的子智慧體會被提醒回報。** 子智慧體做完後還開著,但開出它的 pi 已經重開、收不到它的結果時,它會收到一則 intercom,請它把最終報告送回去,只會送一次([運作方式](docs/how-it-works.md#orphaned-subagents))。
|
|
@@ -134,7 +144,7 @@ pi install npm:pi-straw-boss
|
|
|
134
144
|
## 側邊欄的網路檢視
|
|
135
145
|
|
|
136
146
|
[`herdr-plugin/`](herdr-plugin) 裡有一個選用的 Herdr plugin,會把側邊欄的 Agents 清單變成網路檢視。
|
|
137
|
-
|
|
147
|
+
它先列出主塔台(head tower)所在的工作區(主塔台存在時);每個工作區裡先列塔台,再列各分頁的主智慧體和成員,每個子智慧體緊接在開出它的 session 底下,即使它在 worktree 工作區裡也一樣。
|
|
138
148
|
Herdr server 啟動時這個檢視就會打開,按一個鍵可以關掉,再按一次打開。
|
|
139
149
|
pi-straw-boss 會寫入排序鍵(`sb_order`)、角色標記(`sb_mark`),子智慧體另外有樹狀分支(`sb_indent`)和它的名稱(`sb_name`),網路檢視和你自己的側邊欄列設定都可以用。
|
|
140
150
|
需要 Herdr 0.9.5 以上和 node。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./ask-
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./ask-YLFOfyPL.js";import{n}from"./post-CmicYl-f.js";import{I as r}from"./index-C5ao9YJA.js";var i=((t={},n={})=>(n.locale??e())===`zh-TW`?`這些訊息在 sb server 的佇列裡,等塔台下一個 run 取走;run 啟動時就會被取走。`:`These messages wait in the sb server's queue for the tower's next run; they are taken when it runs.`),a=((t={},n={})=>(n.locale??e())===`zh-TW`?`塔台正在待命:沒有進行中的 run,所以沒有終端機。請在輸入框寫給它,那會喚醒它。`:`The tower is standing by: no run is live, so there is no terminal. Write to it in the composer; that wakes it.`),o=((t={},n={})=>(n.locale??e())===`zh-TW`?`塔台因反覆當機而暫停,沒有終端機。請重試,或在「通訊」裡寫給它。`:`The tower is held after repeated crashes, so it has no terminal. Retry it, or write to it in Comms.`),s=((t={},n={})=>(n.locale??e())===`zh-TW`?`塔台正在待命,沒有終端機。run 被喚醒時才會開一個;請在「通訊」裡寫給它來喚醒。`:`The tower is standing by, so it has no terminal. A run opens one when it wakes; write to it in Comms to wake it.`),c=`[the boss writes to you from the GUI or /boss tower; this is an instruction]`,l=`[possibly handled by a run that crashed: check before acting]`;function u(e){let t=(e??``).split(`
|
|
2
2
|
`,1)[0];if(t.startsWith(`[intercom from `)&&t.endsWith(`]`))return{kind:`intercom`,from:t.slice(15,-1)};if(t===`[notice from the sb server]`)return{kind:`server`};if(t===`[your wakeAfter follow-up is due]`)return{kind:`timer`}}function d(e){let t=(e??``).split(`
|
|
3
3
|
`);if(t[0]!==`[the boss writes to you from the GUI or /boss tower; this is an instruction]`)return;let n=t[1]===l;return{body:t.slice(n?2:1).join(`
|
|
4
4
|
`),crashed:n}}function f(e){let t=(e??``).trim(),n=/^(.*?)\s*\(([^()]*)\)$/.exec(t);return n?{name:n[1],...n[2]?{id:n[2]}:{}}:{name:t}}function p(e){let t=e??``;if(!t.startsWith(`[straw net `))return;let n={},r=11;for(;;){for(;t[r]===` `;)r++;if(t[r]===`]`)break;let e=t.indexOf(`=`,r);if(e<0||!/^[a-z]+$/.test(t.slice(r,e)))return;let i=t.slice(r,e),a;if(t[e+1]===`"`){if(a=t.indexOf(`"`,e+2),a<0)return;n[i]=t.slice(e+2,a++)}else{for(a=e+1;a<t.length&&t[a]!==` `&&t[a]!==`]`;)a++;n[i]=t.slice(e+1,a)}r=a}return{fields:n,raw:t.slice(0,r+1),body:t.slice(r+1).replace(/^ /,``)}}var m={intercom:e=>e.startsWith(`[intercom from `)&&e.endsWith(`]`),notice:e=>e===`[notice from the sb server]`,timer:e=>e===`[your wakeAfter follow-up is due]`};function h(e){let t=e.text??``,n=e=>{let n=t.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{a as t,i as n,n as r,r as i,t as a}from"./sending-aEpvzoz2.js";import{Rt as o,Ut as s,t as c,vt as l}from"./index-xkaqCr46.js";var u=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer it in the terminal.`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer them in the terminal.`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`下方還有 ▾`:`More below ▾`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`也可以自己輸入答案。`:`It also takes your own words.`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`可以複選。`:`It takes several choices.`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`已取消。`:`Cancelled.`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇`:`Choices`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`瀏覽器拒絕存取剪貼簿。`:`The browser refused the clipboard.`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`已複製到這台裝置的剪貼簿。`:`Copied to this device's clipboard.`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`複製指令`:`Copy command`),ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個選項有預覽;請在終端機中查看。`:`It has a preview; see it in the terminal.`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註`:`Note`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註(選填)`:`Note (optional)`),S=e=>`Opened while ${e?.tool} was running; it may not be about that call.`,C=e=>`在 ${e?.tool} 執行時開啟,不一定與該呼叫有關。`,te=((t,n={})=>(n.locale??e())===`zh-TW`?C(t):S(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`選項`:`Options`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`另一個答案沒有被採用;這個可以送出。`:`The other answer was not taken; this one can go.`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的答案`:`Your own answer`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`或自己輸入答案`:`Or type your own answer`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`問題已變更,請重新閱讀。`:`The question changed; read it again.`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 讀不懂這個答案。`:`The session could not read that answer.`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個答案不符合問題。`:`That answer does not fit the question.`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 拒絕了這個答案。`:`The session refused that answer.`),M=((t={},n={})=>(n.locale??e())===`zh-TW`?`安全考量,遠端不支援輸入機密。請到執行 GUI 的那台電腦的終端機中回答。`:`For security, entering a secret is not supported remotely. Answer it in the terminal on the computer the GUI runs on.`),N=((t={},n={})=>(n.locale??e())===`zh-TW`?`機密內容只能在終端機輸入,這裡不接受。請到執行 GUI 的那台電腦的終端機中回答。`:`A secret is entered in the terminal only, not here. Answer it in the terminal on the computer the GUI runs on.`),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`送出答案`:`Send answer`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示終端機`:`Show terminal`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中關閉。`:`It was dismissed in the terminal.`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`它已不再開啟。`:`It is no longer open.`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中回答。`:`It was already answered in the terminal.`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框。`:`It waits on a dialog.`),B={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function V(e,t,n,r,i){let{q:a}=n,o=r[a],s=B[e]??0,c=e===`ArrowUp`,l=c||e===`ArrowDown`,u=()=>({to:r.map((e,t)=>({q:(a+1+t)%r.length,part:`opt`})).find(e=>e.q!==a&&!i[e.q])??`send`});if(e===`Tab`){let e=r[a-1],i=n.part===`opt`?o.own||o.note:n.part===`own`&&o.note;return t?n.part===`opt`&&e?{to:{q:a-1,part:e.note?`note`:e.own?`own`:`opt`}}:void 0:i||a===r.length-1?void 0:{to:{q:a+1,part:`opt`}}}if(!t){if(n.part===`opt`){let t=n.o+s;if(s)return t>=0&&t<o.options?{to:{q:a,part:`opt`,o:t},...o.multiple?{}:{pick:t}}:{to:s>0&&o.own?{q:a,part:`own`}:n};if(e===`Enter`||e===` `&&!o.multiple)return{...u(),...o.multiple?{}:{pick:n.o}}}else if(n.part===`own`){if(e===`Enter`)return u();if(l)return{to:c?{q:a,part:`opt`,o:o.options-1}:{q:a,part:`note`}}}else if(c)return{to:{q:a,part:`own`}}}}function H(e,t,n){let r=e=>Math.max(0,e.opts.findIndex(e=>e.getAttribute(`aria-checked`)===`true`)),i=(e,t)=>e.opts.forEach((e,n)=>e.setAttribute(`tabindex`,n===t?`0`:`-1`)),a=e=>{for(let[n,r]of t.entries()){let t=r.opts.indexOf(e);if(t>=0)return{q:n,part:`opt`,o:t};if(e===r.own||e===r.note)return{q:n,part:e===r.own?`own`:`note`}}};t.forEach(e=>i(e,r(e)));let o=e=>{let n=a(e.target);n?.part===`opt`&&i(t[n.q],n.o)};e.addEventListener(`focusin`,o),e.addEventListener(`click`,o);let s=!1;return e.addEventListener(`keydown`,i=>{let o=a(i.target);if(!o||i.ctrlKey||i.altKey||i.metaKey||i.isComposing)return;let c=i.target;if(o.part!==`opt`&&(i.key===`ArrowUp`?c.selectionStart!==0:i.key===`ArrowDown`&&c.selectionEnd!==c.value.length))return;let l=V(i.key,i.shiftKey,o,t.map(e=>({options:e.opts.length,multiple:e.multiple,own:!!e.own,note:!!e.note})),t.map(e=>e.answered()));if(!l||(i.preventDefault(),i.repeat&&[`Enter`,` `].includes(i.key)))return;if(s=i.key===` `,l.pick!==void 0){let e=t[o.q].opts[l.pick];e.getAttribute(`aria-checked`)!==`true`&&e.click()}let u=l.to===`send`?void 0:t[l.to.q],d=l.to===`send`?n():l.to.part===`opt`?u.opts[l.to.o??r(u)]:l.to.part===`own`?u.own:u.note;d&&!d.disabled&&(e.dispatchEvent(new CustomEvent(`ask-reveal`,{detail:d})),d.focus())}),e.addEventListener(`keyup`,e=>s&&e.key===` `&&(s=!1,e.preventDefault())),()=>t[0]?.opts[r(t[0])]}var U=e=>e.multiple?m():e.freeform&&e.options.length?p():``,W=90,G=(e,t)=>s(`div`,{class:`ask-one`},e.header&&s(`b`,{class:`ask-head`},e.header),s(`p`,{class:`ask-q`,...e.question.length>W?{"data-long":``}:{}},e.question),e.context&&s(`div`,{class:`ask-ctx`},e.context),e.options.length>0&&s(`ol`,{class:`ask-opts`,"aria-label":w()},...e.options.map(e=>s(`li`,{class:`ask-opt`},s(`b`,null,e.title),e.description&&s(`small`,null,e.description)))),t&&U(e)&&s(`small`,{class:`ask-how`},U(e))),K=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\p{Cf}]/gu,`�`),q=e=>(e.select?.choices??[]).map((e,t)=>({...e,i:t})),J=(e,t,n)=>({...e.size?{choices:[...e].sort((e,t)=>e-t)}:{},...t.trim()?{text:t}:{},...n.trim()?{note:n}:{}}),Y=(e,t,n)=>({dialog:e.dialog,digest:e.digest,answerId:n,...t}),X=(e,t)=>({dialog:e.dialog,digest:e.digest,answerId:t,cancel:!0}),Z=(e,t)=>e.cancel===!0&&!(t&&e.select?.choices.every(e=>e.hereOnly)),Q={digest:O,"not-allowed":A,malformed:k};function ne(e,i=!1){let{outcome:a,reason:o,by:s}=e.body;return a===`accepted`?[`ok`,i?h():n()]:a===`stale`?[`error`,s===`local`?R():s===`cancel`?I():L()]:a===`rejected`?[`error`,(Object.hasOwn(Q,String(o))?Q[String(o)]:j)()]:a===`busy`?[`error`,t()]:a===`unknown`||e.status===504?[`error`,r(),!0]:[`error`,o??l({status:e.status})]}var re=e=>[`accepted`,`stale`,`busy`,`unknown`].includes(String(e.body.outcome))||e.status===504,$=e=>e.answer?`d\n${e.answer.dialog}\n${e.answer.digest}`:`c\n${e.callId}\n${e.why??``}`;function ie(e){if(e.dataset.cued)return;e.dataset.cued=`1`;let t=()=>{e.toggleAttribute(`data-more`,e.scrollHeight-e.scrollTop-e.clientHeight>4);for(let t of e.querySelectorAll(`.ask-acts`))t.dataset.cue=f()};for(let n of[`scroll`,`input`])e.addEventListener(n,t,{passive:!0});typeof ResizeObserver<`u`&&new ResizeObserver(t).observe(e),typeof MutationObserver<`u`&&new MutationObserver(t).observe(e,{childList:!0,subtree:!0,characterData:!0}),typeof requestAnimationFrame<`u`&&requestAnimationFrame(t)}function ae(e,t,n=location.hostname!==`127.0.0.1`,l,f,p=F){let m,h,S,C=!1,O=!1,k;for(let e of[`focusin`,`pointerdown`])document.addEventListener(e,e=>h&&!h.el.contains(e.target)&&(h.lost=void 0));let A=(e,t,n,...r)=>(e.dataset.tone=t,e.replaceChildren(n,...r)),j=()=>{if(!h)return;let e=document.activeElement;e&&e!==document.body&&e!==h.lost&&(h.lost=void 0),h.controls.forEach(e=>e.disabled=!C||O||h.done),h.send&&(h.send.disabled=!C||O||h.done||!h.pick()),e&&h.el.contains(e)&&e.disabled&&(h.lost=e);let t=h.lost;t&&!t.disabled&&h.el.contains(t)&&(!document.activeElement||document.activeElement===document.body)&&(t.focus(),h.lost=void 0)};async function I(e,n){[e.sending,O,e.spell]=[!0,!0,!1],j(),A(e.note,``,a());let o=await t(`answer`,n).catch(()=>void 0),u=s(`button`,{type:`button`,class:`cmp-link`},i());u.onclick=()=>void I(e,n);let[d,p,m]=o?ne(o,n.cancel===!0):[`error`,r(),!0];[e.done,e.sending,O,e.busy]=[!o||re(o),!1,!1,o?.body.outcome===`busy`],A(e.note,d,p,...m?[u]:[]);let h=o?.body.outcome===`accepted`?o.body.then:void 0,g=h&&c(h,{key:l?.key??``,command:e.copy,answerId:String(n.answerId??``)});g&&A(e.note,d,`${p} ${g}`),j(),e.note.scrollIntoView?.({block:`nearest`}),f&&o?.body.outcome===`accepted`&&setTimeout(()=>f(!!h&&!g),h&&!g?0:1200)}let L=(e,t,n,r,i)=>{let a=s(`button`,{type:`button`,class:`ask-opt`,role:e,"aria-checked":`false`},s(`b`,i?{"data-n":String(i)}:null,t),...n.filter(Boolean).map(e=>s(`small`,null,e)));return a.onclick=r,a};function R(e,t){let r,i=q(t).map(e=>L(`radio`,K(e.label),[e.note&&K(e.note)],()=>(r=e.i,i.forEach((n,r)=>n.setAttribute(`aria-checked`,String(q(t)[r].i===e.i))),j()),e.i+1)),a=t.select?.copy!==void 0&&s(`button`,{type:`button`,class:`cmp-link`},y());a&&(a.disabled=!navigator.clipboard,a.onclick=()=>void navigator.clipboard.writeText(t.select.copy).then(()=>A(e.note,`ok`,v()),()=>A(e.note,`error`,_())));let o=i.filter((e,r)=>!(n&&q(t)[r].hereOnly));return i.forEach(e=>!o.includes(e)&&(e.disabled=!0)),e.pick=()=>r===void 0?void 0:{choice:r},e.first=H(e.el,[{opts:i,multiple:!1,answered:()=>r!==void 0}],()=>e.send),e.controls=o,[s(`pre`,{class:`ask-title`},K(t.select.title)),s(`div`,{class:`ask-opts`,role:`radiogroup`,"aria-label":g()},...i),s(`div`,{class:`ask-acts`},e.send,e.cancel,a)]}function B(e,t){let n=t.questions.map(()=>({picks:new Set,text:s(`textarea`,{rows:`1`,maxlength:`8192`,class:`ask-own`,placeholder:D(),"aria-label":E()}),note:s(`input`,{type:`text`,maxlength:`2048`,class:`ask-own ask-memo`,placeholder:x(),"aria-label":b()})})),r=[],i=t.questions.map((t,i)=>{let a=n[i],o=t.multiple?`checkbox`:`radio`,c=t.options.map((e,n)=>L(o,e.title,[e.description,e.preview&&ee()],()=>{t.multiple||(a.picks.clear(),a.text.value=``),a.picks.has(n)?a.picks.delete(n):a.picks.add(n),c.forEach((e,t)=>e.setAttribute(`aria-checked`,String(a.picks.has(t)))),j()}));return a.text.oninput=()=>(t.multiple||(a.picks.clear(),c.forEach(e=>e.setAttribute(`aria-checked`,`false`))),j()),e.controls.push(...c,a.text,a.note),r.push({opts:c,multiple:!!t.multiple,own:a.text,note:a.note,answered:()=>a.picks.size>0||a.text.value.trim()!==``}),s(`div`,{class:`ask-one`},t.header&&s(`b`,{class:`ask-head`},t.header),s(`p`,{class:`ask-q`,...t.question.length>W?{"data-long":``}:{}},t.question),s(`div`,{class:`ask-opts`,role:t.multiple?`group`:`radiogroup`,"aria-label":w()},...c),a.text,a.note)});return e.pick=()=>n.every(e=>e.picks.size||e.text.value.trim())?{answers:n.map(e=>J(e.picks,e.text.value,e.note.value))}:void 0,e.first=H(e.el,r,()=>e.send),[...i,s(`div`,{class:`ask-acts`},e.send,e.cancel)]}function V(e){let t=e.asks??(e.ask?[e.ask]:[]),r=t.length>1,i=e.answer,a={copy:i?.select?.copy,key:$(e),el:s(`section`,{class:`ask`}),note:s(`p`,{class:`ask-note`,role:`status`,"aria-live":`polite`}),controls:[],pick:()=>void 0,done:!1,sending:!1};i&&((a.send=s(`button`,{type:`button`,class:`ask-send`},P())).onclick=()=>void(a.pick()&&I(a,Y(i,a.pick(),crypto.randomUUID()))));let c=e.tool===`secret_drop`;i&&!c&&Z(i,n)&&((a.cancel=s(`button`,{type:`button`,class:`ask-cancel`},o())).onclick=()=>void I(a,X(i,crypto.randomUUID())));let f=s(`p`,{class:`ask-term`},e.why&&t.length?e.why:`${r?d():u()} ${r||!t[0]?``:U(t[0])}`.trim()),m=l&&e.tool!==`secret_drop`&&s(`button`,{type:`button`,class:`cmp-link`},p());m&&(m.onclick=l.show);let h=e.answer?.twin&&e.tool&&e.tool!==`dialog`?[s(`p`,{class:`ask-why`},te({tool:e.tool}))]:[];return a.el.append(...h,...i&&!c?i.select?R(a,i):B(a,i):[...t.length?t.map(e=>G(e,r)):[s(`p`,{class:`ask-why`},c?n?M():N():e.why??z())],s(`div`,{class:`ask-acts`},c?s(`p`,{class:`ask-term`},u()):f,m)],a.note),a.cancel&&a.controls.push(a.cancel),a}let Q=(t,n)=>{let r=document.activeElement;h&&h!==n&&(h.focus=h.el.contains(r)?r:void 0),[m,h,S]=[t,n,n?.send?n:S],e.replaceChildren(...n?[n.el]:[]),n&&ie(n.el),j(),n?.focus&&(!document.activeElement||document.activeElement===document.body)&&n.focus.focus()};return{enter(){let e=h&&!h.done?h.first?.():void 0;return!!(e&&!e.disabled&&(e.focus(),1))},cancel(){let e=h&&!h.done?h.cancel:void 0;return!!(e&&!e.disabled&&(e.click(),1))},sending:()=>O,update(e,t){C=t,e&&(k=void clearTimeout(k)),!e&&(h?.done||h?.sending)?k??=setTimeout(()=>(k=void 0,Q()),6e3):e?h&&($(e)===h.key||!e.answer&&(h.done||h.sending)&&e.callId===m?.callId)?((h.busy||h.sending)&&!e.answer?h.spell=!0:h.busy&&h.spell&&e.answer&&([h.done,h.busy]=[!1,!1],A(h.note,``,T())),m=e):Q(e,S?.key===$(e)&&!S.done?S:V(e)):Q(),j()}}}export{ae as t};
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{a as t,i as n,n as r,r as i,t as a}from"./sending-aEpvzoz2.js";import{Mt as o,ct as s,nn as c,t as l}from"./index-C5ao9YJA.js";var u=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer it in the terminal.`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer them in the terminal.`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`下方還有 ▾`:`More below ▾`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`也可以自己輸入答案。`:`It also takes your own words.`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`可以複選。`:`It takes several choices.`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`已取消。`:`Cancelled.`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇`:`Choices`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`瀏覽器拒絕存取剪貼簿。`:`The browser refused the clipboard.`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`已複製到這台裝置的剪貼簿。`:`Copied to this device's clipboard.`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`複製指令`:`Copy command`),ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個選項有預覽;請在終端機中查看。`:`It has a preview; see it in the terminal.`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註`:`Note`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註(選填)`:`Note (optional)`),S=e=>`Opened while ${e?.tool} was running; it may not be about that call.`,C=e=>`在 ${e?.tool} 執行時開啟,不一定與該呼叫有關。`,te=((t,n={})=>(n.locale??e())===`zh-TW`?C(t):S(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`選項`:`Options`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`另一個答案沒有被採用;這個可以送出。`:`The other answer was not taken; this one can go.`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的答案`:`Your own answer`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`或自己輸入答案`:`Or type your own answer`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`問題已變更,請重新閱讀。`:`The question changed; read it again.`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 讀不懂這個答案。`:`The session could not read that answer.`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個答案不符合問題。`:`That answer does not fit the question.`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 拒絕了這個答案。`:`The session refused that answer.`),M=((t={},n={})=>(n.locale??e())===`zh-TW`?`安全考量,遠端不支援輸入機密。請到執行 GUI 的那台電腦的終端機中回答。`:`For security, entering a secret is not supported remotely. Answer it in the terminal on the computer the GUI runs on.`),N=((t={},n={})=>(n.locale??e())===`zh-TW`?`機密內容只能在終端機輸入,這裡不接受。請到執行 GUI 的那台電腦的終端機中回答。`:`A secret is entered in the terminal only, not here. Answer it in the terminal on the computer the GUI runs on.`),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`送出答案`:`Send answer`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示終端機`:`Show terminal`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中關閉。`:`It was dismissed in the terminal.`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`它已不再開啟。`:`It is no longer open.`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中回答。`:`It was already answered in the terminal.`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框。`:`It waits on a dialog.`),B={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function V(e,t,n,r,i){let{q:a}=n,o=r[a],s=B[e]??0,c=e===`ArrowUp`,l=c||e===`ArrowDown`,u=()=>({to:r.map((e,t)=>({q:(a+1+t)%r.length,part:`opt`})).find(e=>e.q!==a&&!i[e.q])??`send`});if(e===`Tab`){let e=r[a-1],i=n.part===`opt`?o.own||o.note:n.part===`own`&&o.note;return t?n.part===`opt`&&e?{to:{q:a-1,part:e.note?`note`:e.own?`own`:`opt`}}:void 0:i||a===r.length-1?void 0:{to:{q:a+1,part:`opt`}}}if(!t){if(n.part===`opt`){let t=n.o+s;if(s)return t>=0&&t<o.options?{to:{q:a,part:`opt`,o:t},...o.multiple?{}:{pick:t}}:{to:s>0&&o.own?{q:a,part:`own`}:n};if(e===`Enter`||e===` `&&!o.multiple)return{...u(),...o.multiple?{}:{pick:n.o}}}else if(n.part===`own`){if(e===`Enter`)return u();if(l)return{to:c?{q:a,part:`opt`,o:o.options-1}:{q:a,part:`note`}}}else if(c)return{to:{q:a,part:`own`}}}}function H(e,t,n){let r=e=>Math.max(0,e.opts.findIndex(e=>e.getAttribute(`aria-checked`)===`true`)),i=(e,t)=>e.opts.forEach((e,n)=>e.setAttribute(`tabindex`,n===t?`0`:`-1`)),a=e=>{for(let[n,r]of t.entries()){let t=r.opts.indexOf(e);if(t>=0)return{q:n,part:`opt`,o:t};if(e===r.own||e===r.note)return{q:n,part:e===r.own?`own`:`note`}}};t.forEach(e=>i(e,r(e)));let o=e=>{let n=a(e.target);n?.part===`opt`&&i(t[n.q],n.o)};e.addEventListener(`focusin`,o),e.addEventListener(`click`,o);let s=!1;return e.addEventListener(`keydown`,i=>{let o=a(i.target);if(!o||i.ctrlKey||i.altKey||i.metaKey||i.isComposing)return;let c=i.target;if(o.part!==`opt`&&(i.key===`ArrowUp`?c.selectionStart!==0:i.key===`ArrowDown`&&c.selectionEnd!==c.value.length))return;let l=V(i.key,i.shiftKey,o,t.map(e=>({options:e.opts.length,multiple:e.multiple,own:!!e.own,note:!!e.note})),t.map(e=>e.answered()));if(!l||(i.preventDefault(),i.repeat&&[`Enter`,` `].includes(i.key)))return;if(s=i.key===` `,l.pick!==void 0){let e=t[o.q].opts[l.pick];e.getAttribute(`aria-checked`)!==`true`&&e.click()}let u=l.to===`send`?void 0:t[l.to.q],d=l.to===`send`?n():l.to.part===`opt`?u.opts[l.to.o??r(u)]:l.to.part===`own`?u.own:u.note;d&&!d.disabled&&(e.dispatchEvent(new CustomEvent(`ask-reveal`,{detail:d})),d.focus())}),e.addEventListener(`keyup`,e=>s&&e.key===` `&&(s=!1,e.preventDefault())),()=>t[0]?.opts[r(t[0])]}var U=e=>e.multiple?m():e.freeform&&e.options.length?p():``,W=90,G=(e,t)=>s(`div`,{class:`ask-one`},e.header&&s(`b`,{class:`ask-head`},e.header),s(`p`,{class:`ask-q`,...e.question.length>W?{"data-long":``}:{}},e.question),e.context&&s(`div`,{class:`ask-ctx`},e.context),e.options.length>0&&s(`ol`,{class:`ask-opts`,"aria-label":w()},...e.options.map(e=>s(`li`,{class:`ask-opt`},s(`b`,null,e.title),e.description&&s(`small`,null,e.description)))),t&&U(e)&&s(`small`,{class:`ask-how`},U(e))),K=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\p{Cf}]/gu,`�`),q=e=>(e.select?.choices??[]).map((e,t)=>({...e,i:t})),J=(e,t,n)=>({...e.size?{choices:[...e].sort((e,t)=>e-t)}:{},...t.trim()?{text:t}:{},...n.trim()?{note:n}:{}}),Y=(e,t,n)=>({dialog:e.dialog,digest:e.digest,answerId:n,...t}),X=(e,t)=>({dialog:e.dialog,digest:e.digest,answerId:t,cancel:!0}),Z=(e,t)=>e.cancel===!0&&!(t&&e.select?.choices.every(e=>e.hereOnly)),Q={digest:O,"not-allowed":A,malformed:k};function ne(e,i=!1){let{outcome:a,reason:s,by:c}=e.body;return a===`accepted`?[`ok`,i?h():n()]:a===`stale`?[`error`,c===`local`?R():c===`cancel`?I():L()]:a===`rejected`?[`error`,(Object.hasOwn(Q,String(s))?Q[String(s)]:j)()]:a===`busy`?[`error`,t()]:a===`unknown`||e.status===504?[`error`,r(),!0]:[`error`,s??o({status:e.status})]}var re=e=>[`accepted`,`stale`,`busy`,`unknown`].includes(String(e.body.outcome))||e.status===504,$=e=>e.answer?`d\n${e.answer.dialog}\n${e.answer.digest}`:`c\n${e.callId}\n${e.why??``}`;function ie(e){if(e.dataset.cued)return;e.dataset.cued=`1`;let t=()=>{e.toggleAttribute(`data-more`,e.scrollHeight-e.scrollTop-e.clientHeight>4);for(let t of e.querySelectorAll(`.ask-acts`))t.dataset.cue=f()};for(let n of[`scroll`,`input`])e.addEventListener(n,t,{passive:!0});typeof ResizeObserver<`u`&&new ResizeObserver(t).observe(e),typeof MutationObserver<`u`&&new MutationObserver(t).observe(e,{childList:!0,subtree:!0,characterData:!0}),typeof requestAnimationFrame<`u`&&requestAnimationFrame(t)}function ae(e,t,n=location.hostname!==`127.0.0.1`,o,f,p=F){let m,h,S,C=!1,O=!1,k;for(let e of[`focusin`,`pointerdown`])document.addEventListener(e,e=>h&&!h.el.contains(e.target)&&(h.lost=void 0));let A=(e,t,n,...r)=>(e.dataset.tone=t,e.replaceChildren(n,...r)),j=()=>{if(!h)return;let e=document.activeElement;e&&e!==document.body&&e!==h.lost&&(h.lost=void 0),h.controls.forEach(e=>e.disabled=!C||O||h.done),h.send&&(h.send.disabled=!C||O||h.done||!h.pick()),e&&h.el.contains(e)&&e.disabled&&(h.lost=e);let t=h.lost;t&&!t.disabled&&h.el.contains(t)&&(!document.activeElement||document.activeElement===document.body)&&(t.focus(),h.lost=void 0)};async function I(e,n){[e.sending,O,e.spell]=[!0,!0,!1],j(),A(e.note,``,a());let c=await t(`answer`,n).catch(()=>void 0),u=s(`button`,{type:`button`,class:`cmp-link`},i());u.onclick=()=>void I(e,n);let[d,p,m]=c?ne(c,n.cancel===!0):[`error`,r(),!0];[e.done,e.sending,O,e.busy]=[!c||re(c),!1,!1,c?.body.outcome===`busy`],A(e.note,d,p,...m?[u]:[]);let h=c?.body.outcome===`accepted`?c.body.then:void 0,g=h&&l(h,{key:o?.key??``,command:e.copy,answerId:String(n.answerId??``)});g&&A(e.note,d,`${p} ${g}`),j(),e.note.scrollIntoView?.({block:`nearest`}),f&&c?.body.outcome===`accepted`&&setTimeout(()=>f(!!h&&!g),h&&!g?0:1200)}let L=(e,t,n,r,i)=>{let a=s(`button`,{type:`button`,class:`ask-opt`,role:e,"aria-checked":`false`},s(`b`,i?{"data-n":String(i)}:null,t),...n.filter(Boolean).map(e=>s(`small`,null,e)));return a.onclick=r,a};function R(e,t){let r,i=q(t).map(e=>L(`radio`,K(e.label),[e.note&&K(e.note)],()=>(r=e.i,i.forEach((n,r)=>n.setAttribute(`aria-checked`,String(q(t)[r].i===e.i))),j()),e.i+1)),a=t.select?.copy!==void 0&&s(`button`,{type:`button`,class:`cmp-link`},y());a&&(a.disabled=!navigator.clipboard,a.onclick=()=>void navigator.clipboard.writeText(t.select.copy).then(()=>A(e.note,`ok`,v()),()=>A(e.note,`error`,_())));let o=i.filter((e,r)=>!(n&&q(t)[r].hereOnly));return i.forEach(e=>!o.includes(e)&&(e.disabled=!0)),e.pick=()=>r===void 0?void 0:{choice:r},e.first=H(e.el,[{opts:i,multiple:!1,answered:()=>r!==void 0}],()=>e.send),e.controls=o,[s(`pre`,{class:`ask-title`},K(t.select.title)),s(`div`,{class:`ask-opts`,role:`radiogroup`,"aria-label":g()},...i),s(`div`,{class:`ask-acts`},e.send,e.cancel,a)]}function B(e,t){let n=t.questions.map(()=>({picks:new Set,text:s(`textarea`,{rows:`1`,maxlength:`8192`,class:`ask-own`,placeholder:D(),"aria-label":E()}),note:s(`input`,{type:`text`,maxlength:`2048`,class:`ask-own ask-memo`,placeholder:x(),"aria-label":b()})})),r=[],i=t.questions.map((t,i)=>{let a=n[i],o=t.multiple?`checkbox`:`radio`,c=t.options.map((e,n)=>L(o,e.title,[e.description,e.preview&&ee()],()=>{t.multiple||(a.picks.clear(),a.text.value=``),a.picks.has(n)?a.picks.delete(n):a.picks.add(n),c.forEach((e,t)=>e.setAttribute(`aria-checked`,String(a.picks.has(t)))),j()}));return a.text.oninput=()=>(t.multiple||(a.picks.clear(),c.forEach(e=>e.setAttribute(`aria-checked`,`false`))),j()),e.controls.push(...c,a.text,a.note),r.push({opts:c,multiple:!!t.multiple,own:a.text,note:a.note,answered:()=>a.picks.size>0||a.text.value.trim()!==``}),s(`div`,{class:`ask-one`},t.header&&s(`b`,{class:`ask-head`},t.header),s(`p`,{class:`ask-q`,...t.question.length>W?{"data-long":``}:{}},t.question),s(`div`,{class:`ask-opts`,role:t.multiple?`group`:`radiogroup`,"aria-label":w()},...c),a.text,a.note)});return e.pick=()=>n.every(e=>e.picks.size||e.text.value.trim())?{answers:n.map(e=>J(e.picks,e.text.value,e.note.value))}:void 0,e.first=H(e.el,r,()=>e.send),[...i,s(`div`,{class:`ask-acts`},e.send,e.cancel)]}function V(e){let t=e.asks??(e.ask?[e.ask]:[]),r=t.length>1,i=e.answer,a={copy:i?.select?.copy,key:$(e),el:s(`section`,{class:`ask`}),note:s(`p`,{class:`ask-note`,role:`status`,"aria-live":`polite`}),controls:[],pick:()=>void 0,done:!1,sending:!1};i&&((a.send=s(`button`,{type:`button`,class:`ask-send`},P())).onclick=()=>void(a.pick()&&I(a,Y(i,a.pick(),crypto.randomUUID()))));let l=e.tool===`secret_drop`;i&&!l&&Z(i,n)&&((a.cancel=s(`button`,{type:`button`,class:`ask-cancel`},c())).onclick=()=>void I(a,X(i,crypto.randomUUID())));let f=s(`p`,{class:`ask-term`},e.why&&t.length?e.why:`${r?d():u()} ${r||!t[0]?``:U(t[0])}`.trim()),m=o&&e.tool!==`secret_drop`&&s(`button`,{type:`button`,class:`cmp-link`},p());m&&(m.onclick=o.show);let h=e.answer?.twin&&e.tool&&e.tool!==`dialog`?[s(`p`,{class:`ask-why`},te({tool:e.tool}))]:[];return a.el.append(...h,...i&&!l?i.select?R(a,i):B(a,i):[...t.length?t.map(e=>G(e,r)):[s(`p`,{class:`ask-why`},l?n?M():N():e.why??z())],s(`div`,{class:`ask-acts`},l?s(`p`,{class:`ask-term`},u()):f,m)],a.note),a.cancel&&a.controls.push(a.cancel),a}let Q=(t,n)=>{let r=document.activeElement;h&&h!==n&&(h.focus=h.el.contains(r)?r:void 0),[m,h,S]=[t,n,n?.send?n:S],e.replaceChildren(...n?[n.el]:[]),n&&ie(n.el),j(),n?.focus&&(!document.activeElement||document.activeElement===document.body)&&n.focus.focus()};return{enter(){let e=h&&!h.done?h.first?.():void 0;return!!(e&&!e.disabled&&(e.focus(),1))},cancel(){let e=h&&!h.done?h.cancel:void 0;return!!(e&&!e.disabled&&(e.click(),1))},sending:()=>O,update(e,t){C=t,e&&(k=void clearTimeout(k)),!e&&(h?.done||h?.sending)?k??=setTimeout(()=>(k=void 0,Q()),6e3):e?h&&($(e)===h.key||!e.answer&&(h.done||h.sending)&&e.callId===m?.callId)?((h.busy||h.sending)&&!e.answer?h.spell=!0:h.busy&&h.spell&&e.answer&&([h.done,h.busy]=[!1,!1],A(h.note,``,T())),m=e):Q(e,S?.key===$(e)&&!S.done?S:V(e)):Q(),j()}}}export{ae as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DTAQvxMk.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{n as t,t as n}from"./markdown-DvbY97ID.js";import{c as r,l as i,o as a,s as o}from"./answer-Df5Xsumd.js";import{L as s,N as c,Xt as l,b as u,ct as d,d as f,ut as ee,w as p}from"./index-C5ao9YJA.js";var te=((t={},n={})=>(n.locale??e())===`zh-TW`?`可能已被當機的 run 處理過:動手前先確認。`:`A run that crashed may already have handled this: check before acting.`),ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`分支摘要`:`branch summary`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`通訊紀錄`:`Comms log`),m=e=>`context compacted · ${e?.tokens} tokens summarized`,h=e=>`上下文已壓縮 · 摘要了 ${e?.tokens} tokens`,ie=((t,n={})=>(n.locale??e())===`zh-TW`?h(t):m(t)),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`…(於 1 MB 截斷)`:`… (cut at 1 MB)`),g=e=>`exit ${e?.code}`,_=e=>`結束碼 ${e?.code}`,oe=((t,n={})=>(n.locale??e())===`zh-TW`?_(t):g(t)),se=e=>`New chapter · ${e?.date} · ${e?.why}`,v=e=>`新的一章・${e?.date}・${e?.why}`,ce=((t,n={})=>(n.locale??e())===`zh-TW`?v(t):se(t)),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`第一次對話`:`the first conversation`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`你要求開新對話`:`you asked for a new conversation`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`上一章太長了`:`the last one grew too large`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`上一章無法接續`:`the last one could not be resumed`),C=e=>`Image ${e?.n}`,w=e=>`圖片 ${e?.n}`,le=((t,n={})=>(n.locale??e())===`zh-TW`?w(t):C(t)),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`圖片無法讀取`:`Image unavailable`),T=e=>`${e?.count} image(s)`,E=e=>`${e?.count} 張圖片`,de=((t,n={})=>(n.locale??e())===`zh-TW`?E(t):T(t)),fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`收到`:`incoming`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`跳到最新`:`jump to latest`),O=e=>`${e?.count} new`,k=e=>`${e?.count} 則新訊息`,A=((t,n={})=>(n.locale??e())===`zh-TW`?k(t):O(t)),pe=((t={},n={})=>(n.locale??e())===`zh-TW`?`還沒有通訊。`:`No transmissions yet.`),me=((t={},n={})=>(n.locale??e())===`zh-TW`?`通知`:`notice`),he=((t={},n={})=>(n.locale??e())===`zh-TW`?`細節`:`details`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`表單回覆`:`form answers`),ge=((t={},n={})=>(n.locale??e())===`zh-TW`?`訊息,來自`:`message from`),M=e=>`answer from ${e?.from}`,N=e=>`${e?.from} 的回答`,_e=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),P=e=>`request from ${e?.from}`,F=e=>`${e?.from} 的請求`,ve=((t,n={})=>(n.locale??e())===`zh-TW`?F(t):P(t)),I=e=>`message from ${e?.from}`,ye=e=>`${e?.from} 的訊息`,be=((t,n={})=>(n.locale??e())===`zh-TW`?ye(t):I(t)),L=e=>`reply to your ask from ${e?.from}`,R=e=>`${e?.from} 回覆了你的詢問`,xe=((t,n={})=>(n.locale??e())===`zh-TW`?R(t):L(t)),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`記憶`:`memory`),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`監看`:`monitor`),Ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`本機`:`this computer`),we=((t={},n={})=>(n.locale??e())===`zh-TW`?`隊友`:`teammate`),B=((t={},n={})=>(n.locale??e())===`zh-TW`?`提問,來自`:`question from`),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`回報,來自`:`report from`),Te=((t={},n={})=>(n.locale??e())===`zh-TW`?`sb server 的通知`:`notice from the sb server`),H=((t={},n={})=>(n.locale??e())===`zh-TW`?`狀態:`:`status of`),U=((t={},n={})=>(n.locale??e())===`zh-TW`?`Straw Link 訊息`:`Straw Link message`),Ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`喚醒鬧鐘`:`wake-up call`),De=((t={},n={})=>(n.locale??e())===`zh-TW`?`塔台事件`:`tower event`),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`在旁開啟`:`open beside`),W=e=>`Open image ${e?.n}`,G=e=>`打開圖片 ${e?.n}`,ke=((t,n={})=>(n.locale??e())===`zh-TW`?G(t):W(t)),K=e=>`show all (${e?.size})`,q=e=>`顯示全部(${e?.size})`,Ae=((t,n={})=>(n.locale??e())===`zh-TW`?q(t):K(t)),je=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示全部參數`:`show all arguments`),J=e=>`◇ thought · ${e?.count} chars`,Y=e=>`◇ 思考 · ${e?.count} 字元`,Me=((t,n={})=>(n.locale??e())===`zh-TW`?Y(t):J(t)),Ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`◇ 思考 · 已遮蔽`:`◇ thought · redacted`),Pe=((t={},n={})=>(n.locale??e())===`zh-TW`?`這座塔台正在待命。有訊息進來時,sb server 會喚醒它跑一個 run;你在這裡送出的第一則訊息就會啟動它。`:`This tower stands by. The sb server wakes it for a run when a message arrives; your first message here starts that run.`),Fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法取得`:`unavailable`),Ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`你`:`you`);function Le(){let e=!0,t=0;return{get pinned(){return e},scrolled(n){e=n,n&&(t=0)},hold:()=>void(e=!1),arrived(n){return e||(t+=n),e},jump:()=>void(e=!0,t=0),button:n=>e&&!n?void 0:t&&!n?A({count:t}):D()}}async function Re(e,t,n,r){let i=()=>e.items.some(e=>e.id===n);for(;!i()&&e.before;)r(e.prepend(await t.older(e.before)));return i()?!0:(r(e.reset(await t.latest())),!1)}function ze(e=600){let t=[],n,r=!1,i=new Set,a=new Map,o=new Map,s=e=>e.forEach(e=>(i.delete(e.id),e.tools?.forEach(e=>(o.delete(e.id),a.delete(e.id)))));function c(e,t){let n=[];for(let r of e)i.has(r.id)||(i.add(r.id),r.kind===`result`&&r.callId?(a.set(r.callId,r),o.has(r.callId)&&t.add(o.get(r.callId))):(r.tools?.forEach(e=>o.set(e.id,r.id)),n.push(r)));return n}let l=e=>({rebuild:!1,added:[],touched:[],dropped:[],front:!1,...e});return{get items(){return t},get before(){return n},get detached(){return r},result:e=>a.get(e),reset(e){return[t,n,r]=[[],e.before,!1],i.clear(),a.clear(),o.clear(),t=c(e.items,new Set),l({rebuild:!0,added:t})},append(i){if(r)return l({});let a=new Set,o=c(i,a);t.push(...o);let u=t.length>e?t.splice(0,t.length-e):[];return s(u),u.length&&(n=t[0].id),l({added:o,touched:[...a],dropped:u.map(e=>e.id)})},prepend(i){let a=new Set,o=c(i.items,a);t.unshift(...o),n=i.before;let u=t.length>e?t.splice(e):[];return s(u),u.length&&(r=!0),l({added:o,touched:[...a],dropped:u.map(e=>e.id),front:!0})}}}var Be=(e,t)=>({first:y,new:b,size:x,unreadable:S})[e??``]?.()??t??``,Ve=e=>e.head?l():p(e.role),He=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1}):``,Ue=e=>e>=1024?`${(e/1024).toFixed(e>=10240?0:1)} KB`:`${e} B`,We={intercom_message:ge,subagent_result:V,subagent_ping:B,subagent_status:H,"pi-loop-monitor":Se,"memory-context":z,"doc-review":j,"straw-tower":De,"straw-link":U},X=e=>{let t=u(`<span class="ava"><svg><use/></svg></span>`);return t.querySelector(`use`).setAttribute(`href`,`#i-${f[e]??e}`),t};function Ge(e){let t=[],n=0;for(let r of e.matchAll(/https?:\/\/[^\s<>)\]]+/g))t.push(e.slice(n,r.index),d(`a`,{href:r[0],rel:`noopener noreferrer`,target:`_blank`},r[0])),n=r.index+r[0].length;return[...t,e.slice(n)]}function Z(l,u,{who:f,link:p,docFor:m}){let h=ze(),g=new Map,_=new Set,se=()=>_.forEach(e=>e.button.isConnected?(e.shown=!0,e.button.hidden=!e.paths.some(e=>m?.(e))):e.shown&&_.delete(e)),v=d(`div`,{class:`chat-list`}),y=d(`div`,{class:`chat-top`}),b=d(`div`,{class:`chat-live`}),x=d(`div`,{class:`chat-end`}),S=d(`button`,{class:`chat-pill`,type:`button`,hidden:``}),C=d(`p`,{class:`chat-empty`},pe()),w=d(`div`,{class:`chat-scroll`,tabindex:`-1`,"aria-label":re()},y,v,b,x);l.replaceChildren(w,S);let T=Le(),E=!1,D=!1,O,k,A=0,j=!1,M,N=()=>j||M!==void 0,P=()=>(clearTimeout(M),M=setTimeout(()=>(M=void 0,T.pinned&&!h.detached&&I()),250)),F=(e=T.button(h.detached))=>(S.hidden=!e,S.textContent=e??``),I=()=>(T.jump(),k=void 0,w.scrollTop=w.scrollHeight,F());async function ye(e){E=!0;let t=await Re(h,u,e,e=>(G(e),Y(e))).finally(()=>E=!1),n=g.get(e);if(O===e){if(!t||!n)return I();T.hold(),k=n,n.scrollIntoView({block:`center`}),ee(n,`lit`),clearTimeout(A),A=window.setTimeout(()=>(k=void 0,n.classList.remove(`lit`)),2e3),F()}}let L=()=>O?void ye(O):I(),R=(e,t,n,r)=>{e.disabled=!0,u.entry(n).then(n=>{let i=n&&r(n);if(i===void 0)return void(e.textContent=Fe());t.textContent=i,e.remove()},()=>e.textContent=Fe())};function z(e,t=0){if(!t||!u.pic)return null;let n=Array.from({length:t},(t,n)=>u.pic(e,n));return d(`div`,{class:`pics`},...n.map((e,t)=>{let r=d(`img`,{src:e,alt:le({n:t+1}),loading:`lazy`,decoding:`async`}),i=d(`button`,{type:`button`,class:`pic`,"aria-label":ke({n:t+1})},r);return r.addEventListener(`error`,()=>i.replaceWith(d(`em`,{class:`pic-gone`},ue()))),i.addEventListener(`click`,()=>void c(async()=>{let{lightbox:e}=await import(`./lightbox-D-X8iJX-.js`);return{lightbox:e}},__vite__mapDeps([0]),import.meta.url).then(({lightbox:e})=>e(n,t))),i}))}function Se(e,t){let n=h.result(e.id),r=d(`pre`,{class:`out`},n?.text??``),i=d(`pre`,{class:`args`},e.args??``),a=e.cut?d(`button`,{class:`more`,type:`button`},je()):null;a?.addEventListener(`click`,()=>R(a,i,t,t=>(e=>e&&`${e.args??``}${e.cut?`\n${ae()}`:``}`)(t.tools?.find(t=>t.id===e.id))));let o=n?.more?d(`button`,{class:`more`,type:`button`},Ae({size:Ue(n.bytes??0)})):null;o?.addEventListener(`click`,()=>R(o,r,n.id,e=>e.text));let s=e.name===`show_doc`&&m?d(`button`,{class:`more open`,type:`button`,hidden:``},Oe()):null;s?.addEventListener(`click`,t=>(t.preventDefault(),e.summary.split(`, `).forEach(e=>m?.(e)?.()))),s&&_.add({paths:e.summary.split(`, `),button:s}),s&&queueMicrotask(se);let c=d(`details`,{class:`act`},d(`summary`,{"data-mark":n?n.isError?`error`:`done`:`working`},d(`b`,{class:`badge`}),d(`code`,null,e.name),d(`span`,{class:`sum`},e.summary),s),i,a,n&&d(`div`,{class:`result`},n.images?d(`em`,null,de({count:n.images})):null,r,o)),l=n&&z(n.id,n.images);return l?[c,l]:[c]}let B=e=>d(`time`,null,He(e.at)),V=(e,t,n,r)=>d(`article`,{class:`tx you`},d(`header`,null,B(e),d(`b`,null,Ie()),X(`user`)),d(`div`,{class:`bubble`,title:r},n?d(`small`,{class:`boss-flag`},te()):null,...Ge(t),z(e.id,e.images))),H=(e,t,n,r={})=>d(`article`,{class:`tx sys`},d(`details`,{class:`notice`},d(`summary`,null,X(`comms`),d(`em`,null,fe()),...t,B(e)),r.crashed?d(`small`,{class:`boss-flag`},te()):null,d(`pre`,null,n),r.raw?d(`details`,{class:`notice-raw`},d(`summary`,null,he()),d(`pre`,{class:`raw`},r.raw)):null)),U=e=>{let t=i(e);return[ge(),` `,t.name&&p(t.name)||t.name,t.id?` (${t.id})`:``,` · `,Ce()]},De=e=>e.kind===`link`?[{ask:ve,reply:xe,answer:_e,message:be}[e.what]({from:e.from}),` · `,we()]:e.kind===`intercom`?U(e.from):[e.kind===`server`?Te():Ee()];function W(i){switch(i.kind){case`user`:{let e=f().service?r(i.text):void 0;if(e)return H(i,e.kind===`intercom`?U(e.from):[e.kind===`server`?Te():Ee()],i.text??``);let t=f().service?a(i.text):void 0;return V(i,t?t.body:i.text??``,t?.crashed,t?i.text??``:``)}case`assistant`:{let e=f(),r=d(`pre`,{class:`thought-text`}),a=i.thought?d(`button`,{class:`thought`,type:`button`},i.thought<0?Ne():Me({count:i.thought.toLocaleString()})):null;return i.thought&&i.thought>0&&a?.addEventListener(`click`,()=>R(a,r,i.id,e=>e.thoughtText)),d(`article`,{class:e.head?`tx in head`:`tx in`},X(e.head?`crown`:e.role),d(`div`,{class:`tx-body`},d(`header`,null,d(`b`,null,Ve(e)),i.model?d(`span`,null,i.model):null,B(i),i.stop?d(`span`,{class:`stop`,"data-mark":`error`},i.stop):null),a,r,i.text?d(`div`,{class:`md`},n(t(i.text))):null,i.error?d(`p`,{class:`fault`},i.error):null,...(i.tools??[]).flatMap(e=>Se(e,i.id))))}case`bash`:return d(`article`,{class:`tx sys`},d(`details`,{class:`act`},d(`summary`,{"data-mark":i.exit?`error`:`done`},d(`b`,{class:`badge`}),d(`code`,null,`shell`),d(`span`,{class:`sum`},`! ${i.command}`),i.exit?d(`span`,{class:`stop`,"data-mark":`error`},oe({code:i.exit})):null),i.text?d(`pre`,{class:`out`},i.text):null));case`notice`:{let e=o(i);return e?.kind===`boss`&&f().service?V(i,e.body,e.crashed,i.text??``):e&&e.kind!==`boss`?H(i,De(e),e.body,e.kind===`link`?{raw:e.raw}:{crashed:e.crashed}):H(i,[We[i.type??``]?.()??i.type??me(),` `,i.from&&p(i.from)||(i.from??``)],i.text??``)}case`divider`:return i.type===`chapter`?d(`article`,{class:`tx rule chapter`},d(`p`,null,ce({date:i.at?new Date(i.at).toLocaleDateString(e(),{year:`numeric`,month:`short`,day:`numeric`}):``,why:Be(i.code,i.text)}))):d(`article`,{class:`tx rule`},d(`details`,null,d(`summary`,null,i.type===`compaction`?ie({tokens:(i.tokens??0).toLocaleString()}):ne()),d(`pre`,null,i.text??``)));default:return d(`article`,{class:`tx note`},i.text??``,` `,B(i))}}function G(e){e.rebuild&&(g.clear(),v.replaceChildren());for(let t of e.dropped)g.get(t)?.remove(),g.delete(t);let t=e.added.map(e=>(g.set(e.id,W(e)),g.get(e.id)));e.front?v.prepend(...t):v.append(...t),D&&!e.front&&!e.rebuild&&t.forEach(e=>(e.classList.add(`fresh`),e.dataset.born=String(Date.now()))),C.remove();let n=f().service;C.textContent=n?.state===`standing`&&!n.run?Pe():pe(),h.items.length||v.append(C),y.hidden=!h.before,J()}let K=[],q=new Map;function J(){let e=new Set;for(let t of K){let n=Date.parse(t.startedAt),r=h.items.findIndex(e=>e.at!==void 0&&Date.parse(e.at)>=n);if(r===0&&h.before)continue;let i=r<0?``:h.items[r].id,a=JSON.stringify([i,s(t)]),o=q.get(t.id);if(e.add(t.id),o&&o.sig===a&&o.el.isConnected)continue;o?.el.remove();let c=s(t),l=d(`article`,{class:`tx rule conv-rule`},d(`div`,null,d(`b`,null,c.title),c.ended?d(`small`,null,c.ended):null));q.set(t.id,{el:l,sig:a});let u=i?g.get(i):void 0;u?u.before(l):v.append(l)}for(let[t,n]of q)e.has(t)||(n.el.remove(),q.delete(t))}let Y=e=>e.touched.forEach(e=>{let t=g.get(e),n=h.items.find(t=>t.id===e);if(t&&n){let r=W(n);t.classList.contains(`fresh`)&&Date.now()-Number(t.dataset.born??0)<400&&r.classList.add(`fresh`),t.replaceWith(r),g.set(e,r)}}),Z=async()=>{if(!E&&h.before&&D){E=!0;try{let e=w.scrollHeight,t=h.prepend(await u.older(h.before));G(t),Y(t),w.scrollTop+=w.scrollHeight-e}finally{E=!1}h.before&&w.clientHeight&&y.getBoundingClientRect().bottom>=w.getBoundingClientRect().top&&Z()}};S.addEventListener(`click`,()=>{O=void 0,h.detached?u.latest().then(e=>(G(h.reset(e)),I())):I()});let Q=[new IntersectionObserver(e=>e.some(e=>e.isIntersecting)&&void Z(),{root:w}),new IntersectionObserver(e=>w.clientHeight&&(T.scrolled(e.at(-1).isIntersecting),F()),{root:w,rootMargin:`0px 0px 67px`})],$,Ke=()=>($??(Q[0].observe(y),Q[1].observe(x)),clearTimeout($),$=setTimeout(()=>($=void 0,Q.forEach(e=>e.disconnect())),600));w.addEventListener(`scroll`,()=>(Ke(),!j&&M!==void 0&&P()),{passive:!0}),w.addEventListener(`touchstart`,()=>(j=!0,clearTimeout(M),M=void 0),{passive:!0});for(let e of[`touchend`,`touchcancel`])w.addEventListener(e,()=>(j=!1,P()),{passive:!0});for(let e of[`wheel`,`touchstart`,`pointerdown`,`keydown`])w.addEventListener(e,()=>k=O=void 0,{passive:!0});let qe=new ResizeObserver(()=>N()?void 0:T.pinned&&!h.detached?w.scrollTop=w.scrollHeight:k?.scrollIntoView({block:`center`}));return qe.observe(v),qe.observe(w),{log:w,docs:se,runs(e){JSON.stringify(e)!==JSON.stringify(K)&&(K=e,J())},apply(e){if(e.reset)G(h.reset({items:e.items??[],before:e.before})),D=!0,L();else if(e.items?.length){let t=h.append(e.items);G(t),Y(t),T.arrived(t.added.length)&&!h.detached&&!N()?I():F()}},reveal(e){O=e,D&&L()},setLive(e,t){b.dataset.mark=t,b.lastChild?.textContent!==e&&b.replaceChildren(...e?[d(`b`,{class:`badge`}),d(`span`,null,e)]:[])}}}export{Z as mountChat,le as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./open_main_title-Ccbha5pD.js";import{n,t as r}from"./unit_count-DK_9HQJj.js";import{A as i,C as a,D as o,E as s,M as c,T as l,Xt as ee,Zt as u,b as d,ct as f,h as p,i as m,j as h,m as g,o as _,p as v,v as y,w as b,xt as x}from"./index-C5ao9YJA.js";var S=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉清單`:`Close the list`),C=((t={},n={})=>(n.locale??e())===`zh-TW`?`切換到其他單位`:`Switch to a unit`),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`回到主地圖`:`Back to the map`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`所有單位`:`All units`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`指揮中`:`commanding`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`已結束`:`ended`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`錯誤`:`error`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`閒置`:`idle`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`無狀態`:`unknown`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`等待`:`waiting`),M=((t={},n={})=>(n.locale??e())===`zh-TW`?`工作中`:`working`),N=.4;function P(e,t,n){let[r,i]=[Math.abs(e),Math.abs(t)];return Math.max(r,i)<10?`wait`:r>=1.7*i&&(n?e<0:e>0)?`drag`:`pass`}var F=(e,t,n)=>Math.abs(n)>=.45?n>0:e>=t*N,I=(e,t)=>t||e.some(e=>e.editable||e.sink||e.scrollsX||[`input`,`textarea`,`select`].includes(e.tag));function L(e){let t=e,n=getComputedStyle(e).overflowX;return{tag:e.tagName.toLowerCase(),editable:t.isContentEditable,sink:e.matches(`.composer, .term-sink`),scrollsX:(n===`auto`||n===`scroll`)&&e.scrollWidth>e.clientWidth+1}}var R=e=>{let t=[];for(let n=e;n;n=n.parentElement)t.push(L(n));return t},z={working:M,waiting:j,idle:k,done:D,error:O,unknown:A,commanding:E},B=(e,t,n)=>(t?D:z[e])({},n&&{locale:n}),V=(e,t)=>t.flatMap(t=>[t,...t.subs.map(e=>({...e,sub:!0}))].map(t=>({id:t.key,key:t.key,ws:e,name:t.name,role:t.role,mark:t.mark,note:t.note,ended:!!t.ended,sub:`sub`in t,control:!!t.control})));function H(e){return e.bases.flatMap(e=>{let t=[{id:`tower`,rows:e.tower?V(e.id,[{...e.tower,role:`tower`}]):[]},...e.tabs.map(t=>({id:t.id,label:x({label:t.label}),rows:V(e.id,t.units)})),{id:`outside`,label:n(),rows:V(e.id,e.outside)}].filter(e=>e.rows.length);return t.length?[{id:e.id,label:e.label,mark:e.mark,groups:t}]:[]})}var U=(e,t)=>e?.head?{mark:e.head.mark,word:e.head.state===`absent`?u({},t&&{locale:t}):B(e.head.mark,!1,t)}:void 0,W=e=>e.role===`main`&&e.mark===`idle`,G=e=>e.reduce((e,t)=>(t.sub?e.at(-1)?.subs.push(t):e.push({...t,subs:[]}),e),[]),K=()=>d(`<div class="unit"><div class="card"><a class="hit"></a>${v}<div class="meta"><span class="name"></span><span class="line"><em class="role"></em><b class="dstate"></b><span class="note"></span></span></div><button type="button" class="quit-btn" data-close="unit" hidden></button></div><div class="subs"></div></div>`),q=()=>d(`<div class="unit tower-row"><div class="trow"><a class="tower-go">${v}<span class="meta"><span class="name"></span><span class="line"><em class="role"></em><b class="dstate"></b></span></span></a><button type="button" class="pair-btn tower-add"></button></div><div class="subs"></div></div>`),J=()=>d(`<section class="dbase"><h3><a></a><small></small></h3><div class="dgroups"></div></section>`),te=()=>d(`<div class="dgroup"><h4></h4><div class="drows"></div></div>`),ne=()=>matchMedia(`(max-width: 640px)`).matches;function Y(e=()=>!1){let n=f(`div`,{class:`drawer-body`}),u=f(`button`,{type:`button`,class:`x`,"aria-label":S()},`×`),v=f(`a`,{class:`drawer-map`},w()),x=f(`button`,{type:`button`,class:`pair-btn`,"data-close":`dismiss-all`,hidden:``}),E=f(`div`,{class:`drawer-sweep`,hidden:``},x);g(v,{view:`map`});let D=d(`<a class="drawer-head"><svg viewBox="0 0 512 512" aria-hidden="true"><use href="#i-crown"/></svg><span class="name"></span><b class="dstate"></b></a>`);D.hidden=!0,g(D,{view:`head`});let O=f(`aside`,{class:`drawer`,"aria-label":C()},f(`header`,null,f(`b`,null,T()),u),D,n,f(`footer`,{class:`drawer-foot`},E,v)),k=f(`div`,{class:`drawer-veil`});document.body.append(k,O);let A,j,M=!1,N=!1,L=0,z=0,V,Y=()=>{let e=U(A);D.hidden=!e,e&&(a(D,e.mark),o(D,`.name`,ee()),o(D,`.dstate`,e.word),D.classList.toggle(`current`,M),D.toggleAttribute(`data-news`,m(A?.head,_())&&!M)),c(x,A??{bases:[]}),E.hidden=x.hidden;let u=(e,t)=>{g(e.querySelector(`.hit`),{view:`session`,ws:t.ws,key:t.key}),e.querySelector(`.hit`).setAttribute(`aria-label`,`${t.name}: ${B(t.mark,t.ended)}`),e.classList.toggle(`current`,t.key===j),e.toggleAttribute(`data-dismiss`,t.role===`subagent`&&t.ended),e.dataset.key=t.key,a(e,t.mark),y(e.querySelector(`.plate`),t.role,t.mark),o(e,`.name`,t.name),o(e,`.role`,b(t.role)),o(e,`.dstate`,B(t.mark,t.ended)),l(e,`.note`,t.note,t.mark,t.note?void 0:``);let n=e.querySelector(`:scope > .card > .quit-btn`);W(t)?i(n,t):n.hidden=!0,s(e.querySelector(`.subs`),t.subs??[],K,u)},d=(e,n)=>{let r=e.querySelector(`.tower-go`),i=e.querySelector(`.tower-add`),c=A?.bases.find(e=>e.id===n.ws);g(r,{view:`session`,ws:n.ws,key:n.key}),r.setAttribute(`aria-label`,`${n.name}: ${B(n.mark,n.ended)}`),e.classList.toggle(`current`,n.key===j),e.dataset.key=n.key,a(e,n.mark),y(r.querySelector(`.plate`),`tower`,n.mark),o(r,`.name`,n.name),o(r,`.role`,b(`tower`)),o(r,`.dstate`,B(n.mark,n.ended)),i.hidden=!c,c&&(p(i,c),i.setAttribute(`aria-label`,t({base:c.label}))),s(e.querySelector(`.subs`),n.subs,K,u)};s(n,H(A??{bases:[]}),J,(e,t)=>{a(e,t.mark),o(e,`h3 a`,t.label),g(e.querySelector(`h3 a`),{view:`workspace`,ws:t.id}),o(e,`small`,r({count:t.groups.reduce((e,t)=>e+t.rows.length,0)})),s(e.querySelector(`.dgroups`),t.groups,te,(e,t)=>{o(e,`h4`,t.label??``),e.querySelector(`h4`).toggleAttribute(`hidden`,!t.label),t.id===`tower`?s(e.querySelector(`.drows`),G(t.rows),q,d):s(e.querySelector(`.drows`),G(t.rows),K,u)})})},X=e=>{L=Math.max(0,Math.min(z,e)),O.style.setProperty(`--dx`,`${L}px`),k.style.opacity=String(z?L/z:0),k.style.pointerEvents=L>0?`auto`:`none`},Z=e=>{N=e,O.classList.toggle(`on`,e),O.inert=!e,document.documentElement.classList.remove(`drawer-drag`),X(e?z:0)},Q=()=>{z=O.offsetWidth,Y(),O.classList.add(`on`),document.documentElement.classList.add(`drawer-drag`)};O.inert=!0,document.addEventListener(`touchstart`,t=>{let n=t.target,r=O.contains(n)||n===k;if(V=void 0,!ne()||e()||t.touches.length!==1||document.querySelector(`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`)||(N?!r:I(R(n),!!getSelection()?.toString())))return;let i=t.touches[0],a=N?n.closest(`.unit[data-dismiss] > .card`)??void 0:void 0;V={x0:i.clientX,y0:i.clientY,mode:`wait`,was:N,base:L,last:i.clientX,at:performance.now(),v:0,card:a}},{passive:!0}),document.addEventListener(`touchmove`,e=>{if(!V||V.mode===`pass`)return;let t=e.touches[0],n=t.clientX-V.x0,r=t.clientY-V.y0;if(V.mode===`wait`){let e=P(n,r,V.was);if(e===`wait`)return;if(e===`pass`&&V.card&&P(n,r,!1)===`drag`)V.mode=`card`,V.card.classList.add(`swiping`);else if(e===`pass`)return void(V.mode=`pass`);else V.mode=`drag`,Q()}e.preventDefault();let i=performance.now();if(V.v=(t.clientX-V.last)/Math.max(1,i-V.at),[V.last,V.at]=[t.clientX,i],V.mode!==`card`)return X(V.base+n);let a=Math.max(0,n);V.card.style.setProperty(`--sx`,`${a}px`),V.card.style.setProperty(`--so`,String(1-a/V.card.offsetWidth))},{passive:!1});let re=(e,t)=>{e.classList.remove(`swiping`),e.style.removeProperty(`--sx`),e.style.removeProperty(`--so`),t&&(e.classList.add(`gone`),h({key:e.parentElement.dataset.key}).then(t=>t||e.classList.remove(`gone`)))},$=e=>{let t=V;V=void 0,t?.mode===`drag`&&Z(F(L,z,t.v)),t?.mode===`card`&&re(t.card,e.type===`touchend`&&F(Math.max(0,t.last-t.x0),t.card.offsetWidth,t.v))};return document.addEventListener(`touchend`,$),document.addEventListener(`touchcancel`,$),k.addEventListener(`click`,()=>Z(!1)),O.addEventListener(`click`,e=>e.target.closest(`a[data-route], button[data-open], .x`)&&Z(!1)),document.addEventListener(`keydown`,e=>N&&e.key===`Escape`&&(e.preventDefault(),Z(!1)),!0),document.addEventListener(`sb-drawer`,()=>(N||Q(),Z(!N))),{net(e){A=e,N&&Y()},route(e){j=e.view===`session`?e.key:void 0,M=e.view===`head`||e.view===`session`&&e.ws===`@head`,v.toggleAttribute(`aria-current`,e.view===`map`),N&&Y()}}}export{Y as mountDrawer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./zenchunk-mcuxHiQU.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,n as t,r as n,t as r}from"./runtime-ZX6HkxDa.js";import{n as i}from"./post-CmicYl-f.js";var a={view:`sb.view`,locale:`sb-locale`,sound:`sb.sound`,volume:`sb.volume`,remind:`sb.remind`,wide:`sb.dialog-wide`,zenHint:`sb.zen.homehint`,zenMusic:`sb.zen.music`,zenTrack:`sb.zen.track`},o={view:e=>e??`auto`,locale:e=>e??null,sound:e=>e===`1`,volume:e=>Math.min(100,Math.max(0,Number(e??`60`)||0)),remind:e=>(e??`1`)===`1`,wide:e=>e===`1`,zenHint:e=>e!==null,zenMusic:e=>e===`1`,zenTrack:e=>e??null};function s(e){let t=[];return{get(t){let n;try{n=e.getItem?.(a[t])}catch{}return o[t](n)},set(t,n){try{return e.setItem(a[t],typeof n==`boolean`?n?`1`:`0`:String(n)),!0}catch{return!1}},on(e,n){t.length||addEventListener(`storage`,e=>t.forEach(([t,n])=>e.key===t&&n())),t.push([a[e],n])}}}var c=s({getItem:e=>localStorage.getItem(e),setItem:(e,t)=>localStorage.setItem(e,t)});a.view;var l={geek:`#000000`,zen:`#14110e`},u=e=>e===`standard`||e===`geek`||e===`zen`?e:`auto`,d=(e,t=`auto`)=>t===`auto`?e?`geek`:`standard`:t,f=(e,t,n=`auto`)=>e===`auto`?d(t,n):e;function p(){return{root:document.documentElement,meta:document.querySelector(`meta[name="theme-color"]`),server:document.querySelector(`meta[name="sb-view"]`),media:matchMedia(`(prefers-contrast: more)`),storage:localStorage}}function m(e=p()){let t=[],n=[],r=e.meta?.content??``,i=s(e.storage),a=()=>u(i.get(`view`)),o=a(),c=u(e.server?.content),d;function m(n){let i=f(o,e.media.matches,c),a=i===`zen`&&e.root.dataset.zenAway!==void 0?`standard`:i;e.root.dataset.view=a,e.meta&&(e.meta.content=a===`standard`?r:l[a]);let s=n===`pick`||n===`follow`&&d!==void 0&&d!==i;if(d=i,s)for(let e of t)e(i,n)}return m(),e.media.addEventListener(`change`,()=>m(`follow`)),{choice:()=>o,view:()=>f(o,e.media.matches,c),server:()=>c,setServer(e){let t=u(typeof e==`string`?e:void 0);if(t!==c){c=t;for(let e of n)e(c);m(`follow`)}},set(e){o=e,i.set(`view`,e),m(`pick`)},refresh:()=>m(),reread(){o=a(),m(`pick`)},onStored:e=>i.on(`view`,e),onChange:e=>void t.push(e),onServer:e=>void n.push(e)}}function h(e,t,n){let r=[...e.querySelectorAll(`button[data-choice]`)],i=r.find(e=>e.dataset.choice===`auto`),a=()=>{i&&n&&(i.textContent=n(t.server())),e.dataset&&e.toggleAttribute(`data-following`,t.server()!==`auto`)};a(),t.onServer(a);let o=()=>r.forEach(e=>e.setAttribute(`aria-pressed`,String(e.dataset.choice===t.choice())));for(let e of r)e.addEventListener(`click`,()=>(t.set(u(e.dataset.choice)),o()));t.onStored(()=>(t.reread(),o())),o()}var g=(e,t)=>(delete t.dataset.zenAway,e.reread());function _(e,t,n,r=()=>g(t,n)){let i=()=>e.hidden=t.view()!==`zen`||n.dataset.zenAway===void 0;return t.onChange(i),e.addEventListener(`click`,()=>(r(),i())),i(),i}function v(e){let t=[],n=(e,r,i)=>(t.push({base:e,unit:r,sub:i}),r.subs.forEach(t=>n(e,t,!0)));for(let t of e.bases)[...t.tower?[t.tower]:[],...t.tabs.flatMap(e=>e.units),...t.outside].forEach(e=>n(t,e,!1));return t}var y=e=>e.mark===`waiting`||e.pending?0:1,ee=e=>[...e].filter(e=>y(e)===0),te=e=>`${e?.n}d`,ne=e=>`${e?.n} 天`,b=((e,t={})=>(t.locale??r())===`zh-TW`?ne(e):te(e)),re=e=>`${e?.n}h`,ie=e=>`${e?.n} 小時`,ae=((e,t={})=>(t.locale??r())===`zh-TW`?ie(e):re(e)),oe=e=>`${e?.n}m`,se=e=>`${e?.n} 分`,ce=((e,t={})=>(t.locale??r())===`zh-TW`?se(e):oe(e)),le=e=>`${e?.n}s`,ue=e=>`${e?.n} 秒`,de=((e,t={})=>(t.locale??r())===`zh-TW`?ue(e):le(e)),fe=((e={},t={})=>(t.locale??r())===`zh-TW`?`警示`:`Alerts`),pe=((e={},t={})=>(t.locale??r())===`zh-TW`?`所有基地`:`all bases`),me=e=>`ally run · ${e?.device}`,he=e=>`隊友 run · ${e?.device}`,ge=((e,t={})=>(t.locale??r())===`zh-TW`?he(e):me(e)),_e=((e={},t={})=>(t.locale??r())===`zh-TW`?`唯讀查看這個隊友 run 的通訊`:`Read this ally run's comms (read only)`),ve=((e={},t={})=>(t.locale??r())===`zh-TW`?`還看不到它的通訊:尚未取得這個 run 的工作階段檔`:`Its comms are not shown yet: the run's session file is not known`);function ye(e,t,n,r){if(typeof t!=`string`||n!==void 0&&!r)return new e(t,n);let i=ye;if(n!==void 0){let r=i.prototypeKeys??=new Set([`constructor`,`__defineGetter__`,`__defineSetter__`,`hasOwnProperty`,`__lookupGetter__`,`__lookupSetter__`,`isPrototypeOf`,`propertyIsEnumerable`,`toString`,`valueOf`,`__proto__`,`toLocaleString`]);if(Object.getOwnPropertyNames(Object.prototype).some(e=>!r.has(e)))return new e(t,n)}let a=[];for(let r of Object.keys(n??{}).sort()){let i=n[r];if(i!==void 0){if(i!==null&&![`string`,`number`,`boolean`].includes(typeof i)||typeof i==`number`&&!Number.isFinite(i))return new e(t,n);a.push([r,i])}}let o=JSON.stringify([t,a]),s=i.caches??=new WeakMap,c=s.get(e);if(c||(c=new Map,s.set(e,c)),c.has(o))return c.get(o);let l=new e(t,n);if(c.size>=256){let e=c.keys().next().value;e!==void 0&&c.delete(e)}return c.set(o,l),l}function x(e,t,n,r=!1){return ye(Intl.PluralRules,e,n,r).select(Number(t)-Number(n?.offset??0))}var be=e=>{let t=x(`en`,e?.count,{},!0);return t===`one`?`${e?.count} ally run`:t===`other`?`${e?.count} ally runs`:`ally_runs`},xe=e=>`${e?.count} 個隊友 run`,Se=((e,t={})=>(t.locale??r())===`zh-TW`?xe(e):be(e)),Ce=e=>`${e?.team} · teammate`,we=e=>`${e?.team} · 隊友`,Te=((e,t={})=>(t.locale??r())===`zh-TW`?we(e):Ce(e)),Ee=((e={},t={})=>(t.locale??r())===`zh-TW`?`返回`:`Back`),De=((e={},t={})=>(t.locale??r())===`zh-TW`?``:`.`),Oe=((e={},t={})=>(t.locale??r())===`zh-TW`?`最後更新:`:`Last update`),ke=e=>`Disconnected. Gave up after ${e?.tries} tries; it reconnects when you return to this tab.`,Ae=e=>`連線中斷。重試 ${e?.tries} 次後放棄;回到此分頁時會重新連線。`,je=((e,t={})=>(t.locale??r())===`zh-TW`?Ae(e):ke(e)),Me=e=>`The server is up but cannot read the net: ${e?.problem}`,Ne=e=>`伺服器正常,但讀不到網:${e?.problem}`,Pe=((e,t={})=>(t.locale??r())===`zh-TW`?Ne(e):Me(e)),Fe=((e={},t={})=>(t.locale??r())===`zh-TW`?`與稻草網的連線中斷,正在重新連線…畫面顯示的是最後已知狀態。`:`Disconnected from the straw net. Reconnecting… The view shows the last known state.`),Ie=e=>`Disconnected from the straw net. Reconnecting (try ${e?.attempt})… The view shows the last known state.`,Le=e=>`與稻草網的連線中斷,正在重新連線(第 ${e?.attempt} 次)…畫面顯示的是最後已知狀態。`,Re=((e,t={})=>(t.locale??r())===`zh-TW`?Le(e):Ie(e)),ze=((e={},t={})=>(t.locale??r())===`zh-TW`?`這個網址在這裡無法使用(sb server 可能重新啟動過,或連結已過期):在這台電腦請開啟 /boss gui;在手機請重新掃描新的 QR code。`:`This address does not work here (the sb server may have restarted, or the link expired): on this computer open /boss gui; on a phone scan a new QR code.`),Be=((e={},t={})=>(t.locale??r())===`zh-TW`?`Straw Net:所有基地`:`Straw Net: all bases`),Ve=((e={},t={})=>(t.locale??r())===`zh-TW`?`取消`:`Cancel`),He=((e={},t={})=>(t.locale??r())===`zh-TW`?`關閉`:`Close`),Ue=e=>`Quit base ${e?.name}`,We=e=>`關掉基地 ${e?.name}`,Ge=((e,t={})=>(t.locale??r())===`zh-TW`?We(e):Ue(e)),Ke=e=>`Quit base ${e?.name}? Every agent in it and its tower quit. Nothing quits while anything running would be lost.`,qe=e=>`要關掉基地 ${e?.name} 嗎?裡面所有 agent 和塔台都會退出。有會遺失的東西時什麼都不關。`,Je=((e,t={})=>(t.locale??r())===`zh-TW`?qe(e):Ke(e)),Ye=e=>`Quit squad ${e?.name}`,Xe=e=>`關掉小隊 ${e?.name}`,Ze=((e,t={})=>(t.locale??r())===`zh-TW`?Xe(e):Ye(e)),Qe=e=>`Quit squad ${e?.name}? Every agent in it quits.`,$e=e=>`要關掉小隊 ${e?.name} 嗎?裡面所有 agent 都會退出。`,et=((e,t={})=>(t.locale??r())===`zh-TW`?$e(e):Qe(e)),tt=e=>`Quit the tower ${e?.name}? The base's mains become members again.`,nt=e=>`要關掉塔台 ${e?.name} 嗎?這個基地的主智慧體都會降格成成員。`,rt=((e,t={})=>(t.locale??r())===`zh-TW`?nt(e):tt(e)),it=e=>`Quit ${e?.name}`,at=e=>`關掉 ${e?.name}`,ot=((e,t={})=>(t.locale??r())===`zh-TW`?at(e):it(e)),st=e=>`Quit ${e?.name}? It quits pi and its pane closes.`,ct=e=>`要關掉 ${e?.name} 嗎?它會退出 pi,窗格也會關掉。`,lt=((e,t={})=>(t.locale??r())===`zh-TW`?ct(e):st(e)),ut=((e={},t={})=>(t.locale??r())===`zh-TW`?`連線中…`:`Connecting…`),dt=((e={},t={})=>(t.locale??r())===`zh-TW`?`重新連線中…`:`Reconnecting…`),ft=((e={},t={})=>(t.locale??r())===`zh-TW`?`重試`:`Try again`),pt=e=>`control tower · ${e?.state}`,mt=e=>`塔台 · ${e?.state}`,ht=((e,t={})=>(t.locale??r())===`zh-TW`?mt(e):pt(e)),gt=e=>`hard cap ${e?.time}`,_t=e=>`上限 ${e?.time}`,vt=((e,t={})=>(t.locale??r())===`zh-TW`?_t(e):gt(e)),yt=((e={},t={})=>(t.locale??r())===`zh-TW`?`收尾中`:`closing`),bt=e=>`Boss conversation · new session · ${e?.time}`,xt=e=>`老闆對話・新的工作階段・${e?.time}`,St=((e,t={})=>(t.locale??r())===`zh-TW`?xt(e):bt(e)),Ct=e=>`Boss conversation · resumed · ${e?.time}`,wt=e=>`老闆對話・接續・${e?.time}`,Tt=((e,t={})=>(t.locale??r())===`zh-TW`?wt(e):Ct(e)),Et=e=>`ended ${e?.time}`,Dt=e=>`${e?.time} 結束`,Ot=((e,t={})=>(t.locale??r())===`zh-TW`?Dt(e):Et(e)),kt=e=>`waiting for you; it ends at ${e?.time} if you stay quiet`,At=e=>`等你說話;你若不說話,${e?.time} 結束`,jt=((e,t={})=>(t.locale??r())===`zh-TW`?At(e):kt(e)),Mt=((e={},t={})=>(t.locale??r())===`zh-TW`?`新的工作階段`:`new session`),Nt=e=>`new session · ${e?.why}`,Pt=e=>`新的工作階段・${e?.why}`,Ft=((e,t={})=>(t.locale??r())===`zh-TW`?Pt(e):Nt(e)),It=e=>`resumed session · boss turns: ${e?.turns}`,Lt=e=>`接續舊工作階段・老闆輪數 ${e?.turns}`,Rt=((e,t={})=>(t.locale??r())===`zh-TW`?Lt(e):It(e)),zt=((e={},t={})=>(t.locale??r())===`zh-TW`?`老闆對話・收尾中`:`boss conversation · closing`),Bt=e=>`boss conversation · waiting for you · ends after ${e?.minutes} min idle`,Vt=e=>`老闆對話・等你說話・閒置 ${e?.minutes} 分鐘後結束`,Ht=((e,t={})=>(t.locale??r())===`zh-TW`?Vt(e):Bt(e)),Ut=e=>`boss conversation · ends after ${e?.minutes} min idle`,Wt=e=>`老闆對話・閒置 ${e?.minutes} 分鐘後結束`,Gt=((e,t={})=>(t.locale??r())===`zh-TW`?Wt(e):Ut(e)),Kt=e=>`working; it ends after ${e?.minutes} min idle`,qt=e=>`處理中;閒置 ${e?.minutes} 分鐘後結束`,Jt=((e,t={})=>(t.locale??r())===`zh-TW`?qt(e):Kt(e)),Yt=((e={},t={})=>(t.locale??r())===`zh-TW`?`圖示來自 game-icons.net(Lorc、Delapouite),CC BY 3.0。`:`Icons from game-icons.net by Lorc and Delapouite, CC BY 3.0.`),Xt=((e={},t={})=>(t.locale??r())===`zh-TW`?`移除`:`Dismiss`),Zt=e=>`Dismiss finished (${e?.count})`,Qt=e=>`移除已完成(${e?.count})`,$t=((e,t={})=>(t.locale??r())===`zh-TW`?Qt(e):Zt(e)),en=e=>`Dismiss ${e?.name}`,tn=e=>`從畫面移除 ${e?.name}`,nn=((e,t={})=>(t.locale??r())===`zh-TW`?tn(e):en(e)),rn=((e={},t={})=>(t.locale??r())===`zh-TW`?`文件`:`Documents`),an=((e={},t={})=>(t.locale??r())===`zh-TW`?`第一則訊息會開啟主塔台`:`The head tower opens with your first message`),on=e=>`${e?.workspace} · ${e?.age} · open`,sn=e=>`${e?.workspace}・${e?.age}・交辦中`,cn=((e,t={})=>(t.locale??r())===`zh-TW`?sn(e):on(e)),ln=e=>`${e?.workspace} · ${e?.age} · answered`,un=e=>`${e?.workspace}・${e?.age}・已回覆`,dn=((e,t={})=>(t.locale??r())===`zh-TW`?un(e):ln(e)),fn=((e={},t={})=>(t.locale??r())===`zh-TW`?`交給各塔台的工作`:`Work handed to the towers`),pn=((e={},t={})=>(t.locale??r())===`zh-TW`?`關閉主塔台`:`Close the head tower`),mn=((e={},t={})=>(t.locale??r())===`zh-TW`?`要關閉主塔台嗎?對話和記憶都會保留。`:`Close the head tower? The conversation and its memory are kept.`),hn=((e={},t={})=>(t.locale??r())===`zh-TW`?`主塔台有新的話`:`The head tower said something new`),gn=((e={},t={})=>(t.locale??r())===`zh-TW`?`尚未開啟`:`not open`),S=((e={},t={})=>(t.locale??r())===`zh-TW`?`主塔台`:`Head tower`),_n=((e={},t={})=>(t.locale??r())===`zh-TW`?`語言`:`Language`),vn=e=>`${e?.label} (${e?.short}) asks you to confirm a ${e?.tool} call from its tower ${e?.tower}, which acts on a message you sent`,yn=e=>`${e?.label}(${e?.short})請你確認它的塔台 ${e?.tower} 的一次 ${e?.tool} 呼叫,該塔台正在處理你送出的訊息`,bn=((e,t={})=>(t.locale??r())===`zh-TW`?yn(e):vn(e)),xn=e=>`${e?.label} (${e?.short}) asks you to confirm a ${e?.tool} call from its tower`,Sn=e=>`${e?.label}(${e?.short})請你確認它塔台的一次 ${e?.tool} 呼叫`,Cn=((e,t={})=>(t.locale??r())===`zh-TW`?Sn(e):xn(e)),wn=e=>`${e?.label} (${e?.short}) in team ${e?.team} asks a question (${e?.owner}).`,Tn=e=>`團隊 ${e?.team} 的 ${e?.label}(${e?.short})問了一個問題(${e?.owner})。`,En=((e,t={})=>(t.locale??r())===`zh-TW`?Tn(e):wn(e)),Dn=e=>`Team ${e?.team} stopped: ${e?.reason}`,On=e=>`團隊 ${e?.team} 已停止:${e?.reason}`,kn=((e,t={})=>(t.locale??r())===`zh-TW`?On(e):Dn(e)),An=e=>{let t=x(`en`,e?.count,{},!0);return t===`one`?`${e?.count} message has waited more than 10 minutes for an idle tower in team ${e?.team}`:t===`other`?`${e?.count} messages have waited more than 10 minutes for an idle tower in team ${e?.team}`:`link_a_held`},jn=e=>`團隊 ${e?.team} 有 ${e?.count} 則訊息已等了超過 10 分鐘,塔台一直不閒`,Mn=((e,t={})=>(t.locale??r())===`zh-TW`?jn(e):An(e)),Nn=e=>{let t=x(`en`,e?.count,{},!0);return t===`one`?`${e?.count} message waits in the inbox of team ${e?.team}: no tower is open on its project`:t===`other`?`${e?.count} messages wait in the inbox of team ${e?.team}: no tower is open on its project`:`link_a_inbox`},Pn=e=>`團隊 ${e?.team} 的收件匣有 ${e?.count} 則訊息在等:專案上沒有開著的塔台`,Fn=((e,t={})=>(t.locale??r())===`zh-TW`?Pn(e):Nn(e)),In=e=>`${e?.label} (${e?.short}) asks to join team ${e?.team}`,Ln=e=>`${e?.label}(${e?.short})要求加入團隊 ${e?.team}`,Rn=((e,t={})=>(t.locale??r())===`zh-TW`?Ln(e):In(e)),zn=e=>`${e?.label} (${e?.short}), an unattended device, asks to join team ${e?.team}`,Bn=e=>`${e?.label}(${e?.short})是無人值守的裝置,要求加入團隊 ${e?.team}`,Vn=((e,t={})=>(t.locale??r())===`zh-TW`?Bn(e):zn(e)),Hn=e=>`${e?.label} (${e?.short}) shows another roster than this computer in team ${e?.team}; the relay may be showing different rosters`,Un=e=>`團隊 ${e?.team} 中,${e?.label}(${e?.short})顯示的名冊和這台電腦不同;中繼站可能對不同人顯示不同名冊`,Wn=((e,t={})=>(t.locale??r())===`zh-TW`?Un(e):Hn(e)),Gn=e=>`${e?.label} (${e?.short}), unattended, in team ${e?.team} — ${e?.what}, ${e?.unit}: ${e?.text}`,Kn=e=>`團隊 ${e?.team} 無人值守的 ${e?.label}(${e?.short}):${e?.what},${e?.unit}:${e?.text}`,qn=((e,t={})=>(t.locale??r())===`zh-TW`?Kn(e):Gn(e)),Jn=e=>{let t=x(`en`,e?.count,{},!0);return t===`one`?`${e?.count} Straw Link message has waited more than 10 minutes in the inbox of team ${e?.team} for an ally run. Look at the tower's card on the map: a held tower or a refused start keeps it waiting.`:t===`other`?`${e?.count} Straw Link messages have waited more than 10 minutes in the inbox of team ${e?.team} for an ally run. Look at the tower's card on the map: a held tower or a refused start keeps them waiting.`:`link_a_served`},Yn=e=>`團隊 ${e?.team} 的收件匣有 ${e?.count} 則 Straw Link 訊息等隊友 run 接手已超過 10 分鐘。請看地圖上塔台的卡片:塔台已暫停或 run 啟動被拒,都會讓它們一直等。`,Xn=((e,t={})=>(t.locale??r())===`zh-TW`?Yn(e):Jn(e)),Zn=e=>`The relay of team ${e?.team} has been unreachable for ${e?.minutes} minutes`,Qn=e=>`團隊 ${e?.team} 的中繼站已經 ${e?.minutes} 分鐘連不上`,$n=((e,t={})=>(t.locale??r())===`zh-TW`?Qn(e):Zn(e)),er=e=>`Link ${e?.count}`,tr=e=>`連線 ${e?.count}`,nr=((e,t={})=>(t.locale??r())===`zh-TW`?tr(e):er(e)),rr=((e={},t={})=>(t.locale??r())===`zh-TW`?`Straw Link 通知`:`Straw Link notices`),ir=((e={},t={})=>(t.locale??r())===`zh-TW`?`允許`:`Allow`),ar=((e={},t={})=>(t.locale??r())===`zh-TW`?`連線中`:`connecting`),or=((e={},t={})=>(t.locale??r())===`zh-TW`?`拒絕`:`Deny`),sr=((e={},t={})=>(t.locale??r())===`zh-TW`?`即時`:`live`),cr=((e={},t={})=>(t.locale??r())===`zh-TW`?`尚未見到`:`not seen yet`),lr=((e={},t={})=>(t.locale??r())===`zh-TW`?`清除`:`Clear`),ur=((e={},t={})=>(t.locale??r())===`zh-TW`?`離線`:`offline`),dr=((e={},t={})=>(t.locale??r())===`zh-TW`?`在線`:`online`),fr=((e={},t={})=>(t.locale??r())===`zh-TW`?`開啟團隊`:`Open Teams`),pr=((e={},t={})=>(t.locale??r())===`zh-TW`?`重新連線中`:`reconnecting`),mr=((e={},t={})=>(t.locale??r())===`zh-TW`?`查看`:`Review`),hr=e=>`seen ${e?.ago} ago`,gr=e=>`${e?.ago}前見到`,_r=((e,t={})=>(t.locale??r())===`zh-TW`?gr(e):hr(e)),vr=((e={},t={})=>(t.locale??r())===`zh-TW`?`查看塔台`:`Show towers`),yr=e=>`${e?.count} monitors running`,br=e=>`${e?.count} 個監看程序執行中`,xr=((e,t={})=>(t.locale??r())===`zh-TW`?br(e):yr(e)),Sr=((e={},t={})=>(t.locale??r())===`zh-TW`?`最後回報`:`Last report`),Cr=((e={},t={})=>(t.locale??r())===`zh-TW`?`最近沒有狀態`:`no status lately`),wr=((e={},t={})=>(t.locale??r())===`zh-TW`?`正體中文`:`English`),Tr=((e={},t={})=>(t.locale??r())===`zh-TW`?`位置`:`Location`),Er=e=>`${e?.name} is commanding`,Dr=e=>`${e?.name} 指揮中`,Or=((e,t={})=>(t.locale??r())===`zh-TW`?Dr(e):Er(e)),kr=e=>`${e?.name} finished`,Ar=e=>`${e?.name} 已完成`,jr=((e,t={})=>(t.locale??r())===`zh-TW`?Ar(e):kr(e)),Mr=e=>`${e?.name} hit an error`,Nr=e=>`${e?.name} 發生錯誤`,Pr=((e,t={})=>(t.locale??r())===`zh-TW`?Nr(e):Mr(e)),Fr=e=>`${e?.name} went idle`,Ir=e=>`${e?.name} 轉為閒置`,Lr=((e,t={})=>(t.locale??r())===`zh-TW`?Ir(e):Fr(e)),Rr=e=>`${e?.name} joined`,zr=e=>`${e?.name} 加入`,Br=((e,t={})=>(t.locale??r())===`zh-TW`?zr(e):Rr(e)),Vr=e=>`${e?.name} left`,Hr=e=>`${e?.name} 離開`,Ur=((e,t={})=>(t.locale??r())===`zh-TW`?Hr(e):Vr(e)),Wr=e=>`${e?.name} lost its status`,Gr=e=>`${e?.name} 失去狀態`,Kr=((e,t={})=>(t.locale??r())===`zh-TW`?Gr(e):Wr(e)),qr=e=>`${e?.name} is waiting on a question`,Jr=e=>`${e?.name} 正在等待回答`,Yr=((e,t={})=>(t.locale??r())===`zh-TW`?Jr(e):qr(e)),Xr=e=>`${e?.name} started working`,Zr=e=>`${e?.name} 開始工作`,Qr=((e,t={})=>(t.locale??r())===`zh-TW`?Zr(e):Xr(e)),$r=((e={},t={})=>(t.locale??r())===`zh-TW`?`指揮中`:`commanding`),ei=((e={},t={})=>(t.locale??r())===`zh-TW`?`已完成`:`finished`),ti=((e={},t={})=>(t.locale??r())===`zh-TW`?`錯誤`:`error`),ni=((e={},t={})=>(t.locale??r())===`zh-TW`?`閒置`:`idle`),ri=((e={},t={})=>(t.locale??r())===`zh-TW`?`待命`:`standing by`),ii=((e={},t={})=>(t.locale??r())===`zh-TW`?`無狀態`:`no status`),ai=((e={},t={})=>(t.locale??r())===`zh-TW`?`等待回答`:`waiting on a question`),oi=((e={},t={})=>(t.locale??r())===`zh-TW`?`工作中`:`working`),si=((e={},t={})=>(t.locale??r())===`zh-TW`?`你的原話`:`your words`),ci=((e={},t={})=>(t.locale??r())===`zh-TW`?`塔台提議,你確認`:`proposed by the tower, confirmed by you`),li=((e={},t={})=>(t.locale??r())===`zh-TW`?`塔台自己的備註`:`the tower's note`),ui=((e={},t={})=>(t.locale??r())===`zh-TW`?`確認`:`Confirm`),di=e=>`${e?.standing} standing · ${e?.decisions} decisions · ${e?.waits} waits`,fi=e=>`${e?.standing} 常駐指示・${e?.decisions} 決定・${e?.waits} 等待`,pi=((e,t={})=>(t.locale??r())===`zh-TW`?fi(e):di(e)),mi=e=>`${e?.standing} standing · ${e?.decisions} decisions · ${e?.waits} waits · ${e?.proposals} to confirm`,hi=e=>`${e?.standing} 常駐指示・${e?.decisions} 決定・${e?.waits} 等待・${e?.proposals} 則待你確認`,gi=((e,t={})=>(t.locale??r())===`zh-TW`?hi(e):mi(e)),_i=e=>`The tower proposes a decision: ${e?.text}`,vi=e=>`塔台提議一項決定:${e?.text}`,yi=((e,t={})=>(t.locale??r())===`zh-TW`?vi(e):_i(e)),bi=e=>`The tower proposes a standing instruction: ${e?.text}`,xi=e=>`塔台提議一則常駐指示:${e?.text}`,Si=((e,t={})=>(t.locale??r())===`zh-TW`?xi(e):bi(e)),Ci=e=>`The tower proposes to retire ${e?.id}: ${e?.text}`,wi=e=>`塔台提議撤掉 ${e?.id}:${e?.text}`,Ti=((e,t={})=>(t.locale??r())===`zh-TW`?wi(e):Ci(e)),Ei=((e={},t={})=>(t.locale??r())===`zh-TW`?`駁回`:`Reject`),Di=((e={},t={})=>(t.locale??r())===`zh-TW`?`你讀到記憶之後它又有變動,所以重新顯示了。請再試一次。`:`The memory changed since you read it, so it is shown again. Try once more.`),Oi=e=>`waits for ${e?.who}`,ki=e=>`等 ${e?.who}`,Ai=((e,t={})=>(t.locale??r())===`zh-TW`?ki(e):Oi(e)),ji=e=>`answered? a message came from ${e?.who}`,Mi=e=>`可能已回覆:${e?.who} 來了一則訊息`,Ni=((e,t={})=>(t.locale??r())===`zh-TW`?Mi(e):ji(e)),Pi=((e={},t={})=>(t.locale??r())===`zh-TW`?`等你決定`:`waits for you`),Fi=((e={},t={})=>(t.locale??r())===`zh-TW`?`已過 7 天而失效`:`expired after 7 days`),Ii=e=>`resolved: ${e?.outcome}`,Li=e=>`已處理:${e?.outcome}`,Ri=((e,t={})=>(t.locale??r())===`zh-TW`?Li(e):Ii(e)),zi=((e={},t={})=>(t.locale??r())===`zh-TW`?`更多`:`More`),Bi=e=>`More actions for ${e?.name}`,Vi=e=>`「${e?.name}」的更多動作`,Hi=((e,t={})=>(t.locale??r())===`zh-TW`?Vi(e):Bi(e)),Ui=((e={},t={})=>(t.locale??r())===`zh-TW`?`地圖總覽`:`Overview of the map`),Wi=e=>`Monitor failed: ${e?.what}`,Gi=e=>`Monitor 出錯:${e?.what}`,Ki=((e,t={})=>(t.locale??r())===`zh-TW`?Gi(e):Wi(e)),qi=e=>`Monitor went quiet and stopped: ${e?.what}`,Ji=e=>`Monitor 太久沒輸出,已停止:${e?.what}`,Yi=((e,t={})=>(t.locale??r())===`zh-TW`?Ji(e):qi(e)),Xi=((e={},t={})=>(t.locale??r())===`zh-TW`?`從未`:`never`),Zi=((e={},t={})=>(t.locale??r())===`zh-TW`?`+新基地`:`+ New base`),Qi=((e={},t={})=>(t.locale??r())===`zh-TW`?`沒有執行中的智慧體`:`no agent running`),$i=((e={},t={})=>(t.locale??r())===`zh-TW`?`無警示`:`no alerts`),C=((e={},t={})=>(t.locale??r())===`zh-TW`?`伺服器沒有回應。`:`The server did not answer.`),ea=((e={},t={})=>(t.locale??r())===`zh-TW`?`尚無塔台`:`no tower yet`),ta=((e={},t={})=>(t.locale??r())===`zh-TW`?`監看中`:`Watching a monitor`),na=((e={},t={})=>(t.locale??r())===`zh-TW`?`思考中`:`thinking`),ra=e=>`Finished ${e?.note}`,ia=e=>`完成了 ${e?.note}`,aa=((e,t={})=>(t.locale??r())===`zh-TW`?ia(e):ra(e)),oa=e=>`Failed ${e?.note}`,sa=e=>`出錯了 ${e?.note}`,ca=((e,t={})=>(t.locale??r())===`zh-TW`?sa(e):oa(e)),la=e=>`Waiting on you ${e?.note}`,ua=e=>`等你回答 ${e?.note}`,da=((e,t={})=>(t.locale??r())===`zh-TW`?ua(e):la(e)),fa=((e={},t={})=>(t.locale??r())===`zh-TW`?`+主智慧體`:`+ Main`),pa=((e={},t={})=>(t.locale??r())===`zh-TW`?`+成員`:`+ Member`),ma=((e={},t={})=>(t.locale??r())===`zh-TW`?`前哨`:`Outposts`),ha=((e={},t={})=>(t.locale??r())===`zh-TW`?`Herdr 開了新窗格,請到 Herdr 裡接著做。`:`A pane opened in Herdr; carry on there.`),ga=((e={},t={})=>(t.locale??r())===`zh-TW`?`接回`:`Pop`),_a=e=>`Pop ${e?.name}`,va=e=>`接回 ${e?.name}`,ya=((e,t={})=>(t.locale??r())===`zh-TW`?va(e):_a(e)),ba=((e={},t={})=>(t.locale??r())===`zh-TW`?`伺服器送來的快照,頁面無法讀取`:`the server sent a snapshot the page cannot read`),xa=((e={},t={})=>(t.locale??r())===`zh-TW`?`伺服器回報了頁面無法讀取的問題`:`the server reported a problem the page cannot read`),Sa=((e={},t={})=>(t.locale??r())===`zh-TW`?`關掉`:`Quit`),Ca=((e={},t={})=>(t.locale??r())===`zh-TW`?`關掉塔台`:`Quit tower`),wa=e=>`Refused (${e?.status}).`,Ta=e=>`已拒絕(${e?.status})。`,w=((e,t={})=>(t.locale??r())===`zh-TW`?Ta(e):wa(e)),Ea=((e={},t={})=>(t.locale??r())===`zh-TW`?`提醒`:`Remind`),Da=((e={},t={})=>(t.locale??r())===`zh-TW`?`點一下允許瀏覽器通知`:`Press to allow browser notifications`),Oa=((e={},t={})=>(t.locale??r())===`zh-TW`?`瀏覽器已封鎖通知,要到網站設定裡允許`:`The browser blocks notifications; allow them in the site settings`),ka=((e={},t={})=>(t.locale??r())===`zh-TW`?`提醒已關`:`Reminders off`),Aa=((e={},t={})=>(t.locale??r())===`zh-TW`?`提醒已開:分頁不在前景時,單位等你回答、完成或出錯會跳系統通知`:`Reminders on: while the page is in the background, a unit waiting on you, finishing, or failing raises a system notification`),ja=((e={},t={})=>(t.locale??r())===`zh-TW`?`這個瀏覽器不支援通知`:`This browser has no notifications`),Ma=((e={},t={})=>(t.locale??r())===`zh-TW`?`隊友 run`:`ally run`),Na=((e={},t={})=>(t.locale??r())===`zh-TW`?`主智慧體`:`main`),Pa=((e={},t={})=>(t.locale??r())===`zh-TW`?`成員`:`member`),Fa=((e={},t={})=>(t.locale??r())===`zh-TW`?`前哨`:`outpost`),Ia=((e={},t={})=>(t.locale??r())===`zh-TW`?`未編入`:`unaligned`),La=((e={},t={})=>(t.locale??r())===`zh-TW`?`事件 run`:`event run`),Ra=((e={},t={})=>(t.locale??r(),`session`)),za=((e={},t={})=>(t.locale??r())===`zh-TW`?`子智慧體`:`subagent`),Ba=((e={},t={})=>(t.locale??r())===`zh-TW`?`塔台`:`tower`),Va=((e={},t={})=>(t.locale??r())===`zh-TW`?`這台裝置`:`This device`),Ha=((e={},t={})=>(t.locale??r())===`zh-TW`?`這些選擇只留在這台裝置的這個瀏覽器。`:`These choices stay on this device, in this browser.`),Ua=((e={},t={})=>(t.locale??r())===`zh-TW`?`手機與裝置`:`Phone & devices`),Wa=((e={},t={})=>(t.locale??r())===`zh-TW`?`伺服器`:`Server`),Ga=((e={},t={})=>(t.locale??r())===`zh-TW`?`團隊`:`Teams`),Ka=((e={},t={})=>(t.locale??r())===`zh-TW`?`設定`:`Settings`),qa=((e={},t={})=>(t.locale??r())===`zh-TW`?`音效`:`Sound`),Ja=((e={},t={})=>(t.locale??r())===`zh-TW`?`音效:開關、音量與試聽`:`Sounds: on or off, volume, and a try`),Ya=((e={},t={})=>(t.locale??r())===`zh-TW`?`▶ 試聽`:`▶ Try`),Xa=((e={},t={})=>(t.locale??r())===`zh-TW`?`音量`:`Volume`),Za=((e={},t={})=>(t.locale??r())===`zh-TW`?`收起`:`Stash`),Qa=e=>`Stash base ${e?.name}`,$a=e=>`收起基地 ${e?.name}`,eo=((e,t={})=>(t.locale??r())===`zh-TW`?$a(e):Qa(e)),to=e=>`Stash base ${e?.name}? Its tower, mains, and members quit and come back with Pop. Nothing is stashed while anything running would be lost.`,no=e=>`要收起基地 ${e?.name} 嗎?塔台、主智慧體和成員會結束,之後可以用「接回」叫回來。有會遺失的東西時不會收。`,ro=((e,t={})=>(t.locale??r())===`zh-TW`?no(e):to(e)),io=e=>`Stashed (${e?.count})`,ao=e=>`已收起(${e?.count})`,oo=((e,t={})=>(t.locale??r())===`zh-TW`?ao(e):io(e)),so=((e={},t={})=>(t.locale??r())===`zh-TW`?`智慧體`:`Agents`),co=((e={},t={})=>(t.locale??r())===`zh-TW`?`基地`:`Bases`),lo=((e={},t={})=>(t.locale??r())===`zh-TW`?`指揮中`:`Commanding`),uo=((e={},t={})=>(t.locale??r())===`zh-TW`?`等待中`:`Waiting`),fo=((e={},t={})=>(t.locale??r())===`zh-TW`?`工作中`:`Working`),po=((e={},t={})=>(t.locale??r())===`zh-TW`?`待允許`:`Allow?`),mo=((e={},t={})=>(t.locale??r())===`zh-TW`?`被擋`:`Blocked`),ho=((e={},t={})=>(t.locale??r())===`zh-TW`?`關`:`Off`),go=((e={},t={})=>(t.locale??r())===`zh-TW`?`開`:`On`),_o=((e={},t={})=>(t.locale??r())===`zh-TW`?`狀態`:`States`),vo=e=>`tab ${e?.label}`,yo=e=>`分頁 ${e?.label}`,bo=((e,t={})=>(t.locale??r())===`zh-TW`?yo(e):vo(e)),xo=((e={},t={})=>(t.locale??r())===`zh-TW`?`即時網況 · 通訊`:`live net · comms`),So=((e={},t={})=>(t.locale??r())===`zh-TW`?`網路活動`:`Net activity`),Co=((e={},t={})=>(t.locale??r())===`zh-TW`?`伺服器啟動後還沒有動靜`:`Nothing has happened since the server started`),wo=((e={},t={})=>(t.locale??r())===`zh-TW`?`現在`:`now`),To=e=>`${e?.count} events in 30 min`,Eo=e=>`近 30 分鐘 ${e?.count} 筆`,Do=((e,t={})=>(t.locale??r())===`zh-TW`?Eo(e):To(e)),Oo=((e={},t={})=>(t.locale??r())===`zh-TW`?`網的總計`:`Net totals`),ko=e=>`The tower refused it: ${e?.reason}`,Ao=e=>`塔台拒絕了:${e?.reason}`,jo=((e,t={})=>(t.locale??r())===`zh-TW`?Ao(e):ko(e)),Mo=((e={},t={})=>(t.locale??r())===`zh-TW`?`去處理`:`Handle`),No=((e={},t={})=>(t.locale??r())===`zh-TW`?`重新送達`:`Deliver again`),Po=((e={},t={})=>(t.locale??r())===`zh-TW`?`捨棄`:`Drop`),Fo=((e={},t={})=>(t.locale??r())===`zh-TW`?`沒有這則已擱置的事件。`:`No such parked event.`),Io=((e={},t={})=>(t.locale??r())===`zh-TW`?`sb server 沒有替這個工作區執行塔台。`:`The sb server runs no tower for this workspace.`),Lo=e=>{let t=x(`en`,e?.count,{},!0);return t===`one`?`${e?.count} failed run lately`:t===`other`?`${e?.count} failed runs lately`:`tower_failures`},Ro=e=>`近來有 ${e?.count} 次 run 失敗`,zo=((e,t={})=>(t.locale??r())===`zh-TW`?Ro(e):Lo(e)),Bo=((e={},t={})=>(t.locale??r())===`zh-TW`?`上一次 run 當機`:`last run crashed`),Vo=((e={},t={})=>(t.locale??r())===`zh-TW`?`上一次 run 已結束`:`last run quit`),Ho=((e={},t={})=>(t.locale??r())===`zh-TW`?`上一次 run 逾時`:`last run timed out`),Uo=e=>`An event was parked after two runs crashed with it: ${e?.what}`,Wo=e=>`有一則事件在兩個 run 都當機後被擱置:${e?.what}`,Go=((e,t={})=>(t.locale??r())===`zh-TW`?Wo(e):Uo(e)),Ko=((e={},t={})=>(t.locale??r())===`zh-TW`?`run 一再當機或逾時,所以塔台不再自動喚醒。佇列仍保留;按重試,或由老闆送一則訊息,就會再喚醒它。`:`Runs crashed or timed out again and again, so the tower stops waking. The queue is kept; Retry, or a message from the boss, wakes it again.`),qo=((e={},t={})=>(t.locale??r())===`zh-TW`?`常駐窗格不在它自己的 shell:裡面有巢狀 shell 或程式在跑。請先離開它,再按重試`:`The standing pane is not at its own shell: a nested shell or a program runs there. Leave it, then press Retry`),Jo=e=>`The tower types nothing in the standing pane: ${e?.reason}`,Yo=e=>`塔台不在常駐窗格輸入任何東西:${e?.reason}`,Xo=((e,t={})=>(t.locale??r())===`zh-TW`?Yo(e):Jo(e)),Zo=((e={},t={})=>(t.locale??r())===`zh-TW`?`重試`:`Retry`),Qo=e=>`A run could not start: ${e?.reason}`,$o=e=>`run 無法啟動:${e?.reason}`,es=((e,t={})=>(t.locale??r())===`zh-TW`?$o(e):Qo(e)),ts=((e={},t={})=>(t.locale??r())===`zh-TW`?`塔台無法檢查常駐窗格裡有沒有你的程式,所以不在那裡輸入任何東西;窗格空出來後請按重試`:`The tower could not check the standing pane for a program of yours, so it types nothing there; press Retry when it is free`),ns=e=>`Parked: ${e?.kind} from ${e?.from}: ${e?.first}`,rs=e=>`已擱置:${e?.kind},來自 ${e?.from}:${e?.first}`,is=((e,t={})=>(t.locale??r())===`zh-TW`?rs(e):ns(e)),as=e=>`Parked: ${e?.kind}: ${e?.first}`,os=e=>`已擱置:${e?.kind}:${e?.first}`,ss=((e,t={})=>(t.locale??r())===`zh-TW`?os(e):as(e)),cs=e=>{let t=x(`en`,e?.count,{},!0);return t===`one`?`${e?.count} message queued`:t===`other`?`${e?.count} messages queued`:`tower_queued`},ls=e=>`${e?.count} 則排隊中`,us=((e,t={})=>(t.locale??r())===`zh-TW`?ls(e):cs(e)),ds=e=>`ally run · ${e?.device}`,fs=e=>`隊友 run · ${e?.device}`,ps=((e,t={})=>(t.locale??r())===`zh-TW`?fs(e):ds(e)),ms=((e={},t={})=>(t.locale??r())===`zh-TW`?`收工中`:`closing`),hs=((e={},t={})=>(t.locale??r())===`zh-TW`?`已暫停`:`held`),gs=((e={},t={})=>(t.locale??r())===`zh-TW`?`喚醒中`:`waking`),_s=e=>`open for ${e?.age}`,vs=e=>`已等 ${e?.age}`,ys=((e,t={})=>(t.locale??r())===`zh-TW`?vs(e):_s(e)),bs=((e={},t={})=>(t.locale??r())===`zh-TW`?`可能已過時`:`may be out of date`),xs=e=>`Waits for you: ${e?.text}`,Ss=e=>`等你決定:${e?.text}`,Cs=((e,t={})=>(t.locale??r())===`zh-TW`?Ss(e):xs(e)),ws=((e={},t={})=>(t.locale??r())===`zh-TW`?`處理中…`:`Working…`),Ts=((e={},t={})=>(t.locale??r())===`zh-TW`?`有智慧體等你同意,才能載入資料夾的設定`:`An agent needs your OK to load a folder's settings`),Es=((e={},t={})=>(t.locale??r())===`zh-TW`?`連不上伺服器。`:`The server could not be reached.`),Ds=e=>`using ${e?.tool}`,Os=e=>`使用 ${e?.tool}`,ks=((e,t={})=>(t.locale??r())===`zh-TW`?Os(e):Ds(e)),As=((e={},t={})=>(t.locale??r())===`zh-TW`?`自動`:`Auto`),js=e=>`Follow server (${e?.view})`,Ms=e=>`跟隨伺服器(${e?.view})`,Ns=((e,t={})=>(t.locale??r())===`zh-TW`?Ms(e):js(e)),Ps=((e={},t={})=>(t.locale??r())===`zh-TW`?`極客`:`Geek`),Fs=((e={},t={})=>(t.locale??r())===`zh-TW`?`檢視`:`View`),Is=((e={},t={})=>(t.locale??r())===`zh-TW`?`標準`:`Standard`),Ls=((e={},t={})=>(t.locale??r())===`zh-TW`?`自動:跟隨伺服器設定的檢視(/boss gui view);伺服器沒設定時,系統要求較高對比就用極客檢視。標準、極客與禪依你在這台裝置的選擇`:`Auto follows the view the server sets (/boss gui view); with none set, it is Geek when your system asks for more contrast. Standard, Geek, and Zen stay as you choose on this device`),Rs=((e={},t={})=>(t.locale??r())===`zh-TW`?`禪`:`Zen`),zs=((e={},t={})=>(t.locale??r())===`zh-TW`?`略過`:`Dismiss`),Bs=((e={},t={})=>(t.locale??r())===`zh-TW`?`禪`:`Zen`),Vs=((e={},t={})=>(t.locale??r())===`zh-TW`?`回到禪`:`Back to Zen`),Hs=864e5,Us=(e,t)=>t-Date.parse(e);function Ws(e,t,n){let r=Us(e,t)/1e3;return r>=3600?r<86400?ae({n:String(Math.floor(r/3600))},n):b({n:String(Math.floor(r/86400))},n):void 0}function Gs(e,t,n){let r=Ws(e.at,t,n);return[Cs({text:e.text},n),r&&ys({age:r},n),Us(e.at,t)>=864e5&&bs({},n)].filter(Boolean).join(` · `)}function Ks(e,t,n){return(t?.service?.memory?.bossWaits??[]).filter(e=>Us(e.at,n)<Hs).map(r=>({key:`wait\u001f${e}\u001f${r.id}`,unit:t.key,ws:e,name:t.name,role:`tower`,mark:`waiting`,note:r.text,at:n,since:Date.parse(r.at),closed:!t.control,wait:{id:r.id,text:r.text}}))}var qs=new Set,Js=e=>e.unit??e.key;function Ys(e,t){let n=new Map;for(let{base:r,unit:i}of v(e)){let e=i,a=e.role??`tower`;n.set(e.key,{key:e.key,ws:r.id,name:e.name,role:a,mark:e.mark,note:e.note,at:t,since:e.since,pending:e.pending,closed:!e.control||!!e.ended});for(let e of Ks(r.id,i,t))n.set(e.key,e);for(let i of e.monitors??[])(i.status===`error`||i.status===`stale`)&&(o=>n.set(o,{key:o,unit:e.key,ws:r.id,name:e.name,role:a,mark:`error`,note:`monitor:${i.status}:${i.what}`,at:t}))(`${e.key}\u001fmonitor:${i.id}:${i.at}`)}for(let r of e.trust??[])r.opening&&qs.has(r.opening)||(e=>n.set(e,{key:e,ws:``,name:r.folder.split(/[\\/]/).filter(Boolean).at(-1)??r.folder,role:r.agents[0]?.role??`none`,mark:`waiting`,at:t,since:r.agents.length?Math.min(...r.agents.map(e=>e.at)):void 0,trust:r}))(`trust\u001f${r.folder}\u001f${r.digest}`);return n}function Xs(e,t){return[...t.values()].filter(t=>{let n=e?.get(t.key);return y(t)===0?!n||y(n)!==0||n.mark!==t.mark:e!==void 0&&n?.mark!==t.mark&&(t.mark===`error`||t.mark===`done`)})}var Zs={count:!0,signal:!0,announce:`arrivals`,keys:`dialogs`,drawer:!0,calm:!0,chime:!0,escape:`stay`},Qs={standard:Zs,geek:{...Zs,calm:!1},zen:{count:!1,signal:!1,announce:`current`,keys:`zen`,drawer:!1,calm:!0,chime:!1,escape:`blur`}},$s=(e,t)=>Qs[e===`zen`&&t?`standard`:e],ec=(...e)=>e.filter(e=>e!==!1&&e!=null),tc=(e,t)=>(e.classList.add(t),e.classList.toggle(`flip`));function T(e,t,...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t??{}))r.setAttribute(e,n);return r.append(...ec(...n)),r}var E=e=>String(e??``);function nc(e){let t=e.data,n=e.teamName;switch(e.kind){case`join-request`:return t.unattended?Vn({label:E(t.label),short:E(t.short),team:n}):Rn({label:E(t.label),short:E(t.short),team:n});case`confirm`:return t.tower?bn({label:E(t.label),short:E(t.short),tool:E(t.tool),tower:E(t.tower)}):Cn({label:E(t.label),short:E(t.short),tool:E(t.tool)});case`dialog`:return En({label:E(t.label),short:E(t.short),team:n,owner:E(t.owner)});case`fork`:return kn({team:n,reason:E(t.reason)});case`mismatch`:return Wn({label:E(t.label),short:E(t.short),team:n});case`unreachable`:return $n({team:n,minutes:E(t.minutes)});case`inbox`:return Fn({count:Number(t.count)||0,team:n});case`held`:return Mn({count:Number(t.count)||0,team:n});case`served`:return Xn({count:Number(t.count)||0,team:n});case`notice`:return qn({label:E(t.label),short:E(t.short),team:n,what:E(t.what),unit:E(t.unit),text:E(t.text)})}}var rc=e=>{let t={error:0,warning:1,info:2};return[...e].sort((e,n)=>t[e.level]-t[n.level])};function ic(e){let t=Math.max(0,Math.ceil(e/1e3)),n=e=>String(e).padStart(2,`0`);return t>=3600?`${Math.floor(t/3600)}:${n(Math.floor(t/60)%60)}:${n(t%60)}`:`${Math.floor(t/60)}:${n(t%60)}`}function ac(e,t){if(e===null)return cr();if(t)return dr();let n=Math.floor(e/1e3);return _r({ago:n<3600?ce({n:String(Math.max(1,Math.floor(n/60)))}):n<86400?ae({n:String(Math.floor(n/3600))}):b({n:String(Math.floor(n/86400))})})}function oc(e){return e.online?e.tower===`blocked`?`waiting`:e.tower===`working`?`working`:e.tower===`unknown`?`unknown`:`idle`:`unknown`}function sc(e){switch(e){case`working`:return oi();case`blocked`:return ai();case`idle`:return ni();case`done`:return ei();case`unknown`:return ii();default:return e}}function cc(e){let{closed:t,answered:n}=e.data;return t===void 0?n?`sent`:`open`:t===`remote`?n?`done-here`:`done-other`:t===`local`?`done-local`:t===`cancel`?`cancelled`:t===`withdrawn`?`withdrawn`:`expired`}function lc(e,t){let n=(e??[]).find(e=>e.team===t.team&&e.device===t.device);return n?n.units.filter(e=>t.workspace===null||e.unit===t.workspace).map(e=>({...e,stale:n.stale===!0})):[]}var uc=e=>[sc(e.state),...e.monitors.length?[xr({count:String(e.monitors.length)})]:[],...e.stale?[Cr()]:[]].join(` · `),dc=3e4,fc=[`pointermove`,`pointerdown`,`keydown`,`wheel`,`touchstart`];function pc(e=document.documentElement){if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=Date.now(),n,r=()=>Qs[e.dataset.view]?.calm===!1,i=()=>{let a=t+dc-Date.now();a>0?n=setTimeout(i,a):(n=void 0,r()||e.toggleAttribute(`data-calm`,!0))},a=()=>{t=Date.now(),n===void 0&&(e.toggleAttribute(`data-calm`,!1),r()||(n=setTimeout(i,dc)))};for(let e of fc)addEventListener(e,a,{capture:!0,passive:!0});document.addEventListener(`visibilitychange`,()=>document.hidden||a()),a()}var mc=0,hc=`button:not([disabled]):not([hidden]), a[href]:not([hidden])`;function gc(e,t){e.id||=`menu-${++mc}`;let n=t?Hi({name:t}):zi();return T(`button`,{type:`button`,class:`pair-btn menu-btn`,popovertarget:e.id,"aria-haspopup":`true`,"aria-label":n,title:n},`⋯`)}function _c(e,t,n=``){let r=T(`div`,{class:`menu-pop hud-pop`,popover:`auto`,role:`group`,"aria-label":t?Hi({name:t}):zi()},...e);return T(`span`,{class:`menu ${n}`.trim()},gc(r,t),r)}function vc(e){let t=document.createComment(``);e.replaceWith(t);let n=_c([e]);return t.replaceWith(n),n}function yc(e,t){let n=Hi({name:t});for(let t of[e.querySelector(`.menu-btn`),e.querySelector(`.menu-pop`)])t&&t.getAttribute(`aria-label`)!==n&&t.setAttribute(`aria-label`,n);e.querySelector(`.menu-btn`)?.setAttribute(`title`,n)}function bc(e,t,n={width:innerWidth,height:innerHeight}){let r=t.getBoundingClientRect(),i=e.offsetWidth,a=e.offsetHeight,o=r.bottom+8+a<=n.height-8||r.top-8-a<8;e.style.top=`${Math.max(8,o?r.bottom+8:r.top-8-a)}px`,e.style.left=`${Math.max(8,Math.min(r.right-i,n.width-i-8))}px`}function xc(e,t,n){if(e.length){if(n===`Home`)return e[0];if(n===`End`)return e.at(-1);if(n===`ArrowDown`)return e[(t+1)%e.length];if(n===`ArrowUp`)return e[(t<0?0:t-1+e.length)%e.length]}}var Sc=e=>e instanceof Element?e.closest(`.menu-pop`):null,Cc=e=>document.querySelector(`[popovertarget="${CSS.escape(e.id)}"]`);function wc(){document.addEventListener(`toggle`,e=>{let t=Sc(e.target);if(!t||e.newState!==`open`)return;let n=Cc(t);n&&bc(t,n),t.querySelector(hc)?.focus({preventScroll:!0})},!0),document.addEventListener(`keydown`,e=>{let t=Sc(e.target);if(!t||!t.matches(`:popover-open`))return;if(e.key===`Escape`)return void(e.preventDefault(),t.hidePopover(),Cc(t)?.focus());let n=[...t.querySelectorAll(hc)],r=xc(n,n.indexOf(document.activeElement),e.key);r&&(e.preventDefault(),r.focus())}),document.addEventListener(`click`,e=>{let t=Sc(e.target),n=e.target instanceof Element?e.target.closest(`button, a`):null;t&&n&&t.contains(n)&&!n.hasAttribute(`popovertarget`)&&!n.hasAttribute(`data-menu-keep`)&&t.matches(`:popover-open`)&&t.hidePopover()})}var Tc=`@head`,Ec=e=>e.route.view===`map`||e.route.view===`head`?``:e.route.ws,Dc=(e,t)=>{let n=e?.head;return n?.key===t?{u:{key:t,name:n.name,role:`tower`,head:!0,mark:n.mark,control:!0,queued:n.queued,service:n.service,subs:[]},base:{id:Tc,label:n.name,mark:n.mark,tower:null,tabs:[],outposts:[],outside:[]}}:void 0};function Oc(e,t){let n=Dc(e,t);if(n)return n;for(let n of e?.bases??[]){if(n.tower?.key===t)return{u:{key:t,name:n.tower.name,role:`tower`,mark:n.tower.mark,control:n.tower.control,pending:n.tower.pending,queued:n.tower.queued,monitors:n.tower.monitors,service:n.tower.service,docs:n.tower.docs,docsCut:n.tower.docsCut,subs:n.tower.subs},base:n};for(let[e,r]of[...n.tabs.map(e=>[e.label,e.units]),[void 0,n.outside],[void 0,n.tower?.subs??[]]])for(let i of r){if(i.key===t)return{u:i,base:n,squad:e};let r=i.subs.find(e=>e.key===t);if(r)return{u:r,base:n,squad:e,launcher:i}}}}var kc=e=>e?.u.role===`tower`&&e.base.tower?.key===e.u.key?e.base:void 0,D=(e,t)=>(t?t!==`live`:!e)||!(!e?.ended||e.control);function Ac(e,t,n){return n?`readonly`:D(e,t)?t===`recent`||e?.ended?`closed`:`none`:`live`}function jc(e){if(e.route.view!==`session`)return;let t=e.route.key,n=Oc(e.net,t),r=n?.u;return{key:t,hit:n,u:r,mk:r?.mark??`unknown`,state:e.info?.state,name:r?.name??e.info?.name??t}}var Mc=[`phone`,`wifi`,`teams`,`server`],Nc=e=>{try{return decodeURIComponent(e)}catch{return e}},Pc=e=>/^\.+$/.test(e)?e.replaceAll(`.`,`%2E`):encodeURIComponent(e);function Fc(e){let[t,n]=e.split(`#`)[0].split(`?`),[r,i,a,o]=t.replace(/^\/+|\/+$/g,``).split(`/`).map(Nc);if(r===`head`&&!i)return{view:`head`};if(r===`settings`)return Mc.includes(i)?{view:`settings`,section:i}:{view:`settings`};if(r!==`w`||!i)return{view:`map`};if(a!==`s`||!o)return{view:`workspace`,ws:i};let s=new URLSearchParams(n).get(`at`);return s?{view:`session`,ws:i,key:o,at:s}:{view:`session`,ws:i,key:o}}var O=e=>e.view===`map`?``:e.view===`head`||e.view===`session`&&e.ws===`@head`?`head`:e.view===`settings`?e.section?`settings/${e.section}`:`settings`:e.view===`workspace`?`w/${Pc(e.ws)}`:`w/${Pc(e.ws)}/s/${Pc(e.key)}${e.at?`?at=${encodeURIComponent(e.at)}`:``}`,Ic=e=>e.view===`session`&&e.ws!==`@head`?{view:`workspace`,ws:e.ws}:{view:`map`},k=e=>e.view===`settings`?{view:`map`}:e,Lc=(e,t)=>e.view===`session`?e.key:e.view===`head`?t??null:e.view===`workspace`?`w:${e.ws}`:null,Rc=e=>Math.max(0,e?.depth||0);function zc(e,t=new URL(document.baseURI).pathname){let n=()=>Fc(location.pathname.slice(t.length)+location.search),r={route:n,href:e=>O(e)||`./`,go(n){let r=t+O(n);location.pathname+location.search!==r&&history.pushState({depth:Rc(history.state)+1},``,r),e(n)}};return addEventListener(`popstate`,()=>e(n())),document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[data-route]`);!t||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),t.hasAttribute(`data-back`)&&Rc(history.state)>0?history.back():r.go(Fc(t.getAttribute(`data-route`))))}),r}function Bc(e,t,n){let r=n?.allyRuns??[],i=JSON.stringify([t,r.map(e=>[e.id,e.label,e.key])]);e.dataset.sig!==i&&(e.dataset.sig=i,e.hidden=!r.length,e.replaceChildren(...r.length>1?[T(`b`,null,Se({count:r.length}))]:[],...r.map(e=>{let n=ge({device:e.label});if(!e.key)return T(`span`,{class:`ally-chip`,title:ve()},n);let r=O({view:`session`,ws:t,key:e.key});return T(`a`,{class:`ally-chip`,href:r||`./`,"data-route":r,title:_e()},n)})))}var Vc=e=>e===`@head`?`head`:`tower/${encodeURIComponent(e)}`,Hc=(e,t)=>e.allyRuns.length===1?ps({device:e.allyRuns[0].label},t):e.allyRuns.length>1?Se({count:e.allyRuns.length},t):Ma({},t),Uc=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1}),Wc=e=>Math.max(1,Math.round(e.idleMs/6e4)),Gc=(e,t)=>e.closing?zt({},t):(e.idle?Ht:Gt)({minutes:Wc(e)},t);function Kc(e,t){return{began:e.resumed?Rt({turns:e.turns},t):e.why?Ft({why:e.why},t):Mt({},t),...e.why?{why:e.why}:{},now:e.closing?yt({},t):e.idle&&e.idleAt?jt({time:Uc(e.idleAt)},t):Jt({minutes:Wc(e)},t),cap:vt({time:Uc(e.capAt)},t)}}function qc(e,t){return{title:(e.resumed?Tt:St)({time:Uc(e.startedAt)},t),...e.endedAt?{ended:[Ot({time:Uc(e.endedAt)},t),e.note].filter(Boolean).join(` · `)}:{}}}function Jc(e,t,n,r){if(!e)return n(t);switch(e.state){case`held`:return hs({},r);case`waking`:return gs({},r);case`closing`:return ms({},r);case`running`:return e.run?.kind===`ally`?Hc(e,r):e.conversation&&t!==`waiting`?Gc(e.conversation,r):n(t);case`standing`:return t===`idle`?e.allyRuns.length?Hc(e,r):ri({},r):n(t)}}var Yc={crashed:e=>Bo({},e),timeout:e=>Ho({},e),quit:e=>Vo({},e)};function Xc(e,t){if(!e||e.run)return;let n=Object.hasOwn(Yc,e.lastRun?.outcome??``)?Yc[e.lastRun.outcome](t):void 0;return n&&[n,e.crashes?zo({count:e.crashes},t):``].filter(Boolean).join(` · `)}var Zc=(e,t,n,r)=>[Jc(e,t,n,r),Xc(e,r)].filter(Boolean).join(` · `),Qc=(e,t)=>e?.queued?us({count:e.queued},t):void 0,$c=`A run could not start: `,el=`The tower could not check the standing pane for a program of yours, so it types nothing there; press Retry when it is free`,tl=`The standing pane is not at its own shell: a nested shell or a program runs there. Leave it, then press Retry`,nl=`The tower types nothing in the standing pane: `,rl=`An event was parked after two runs crashed with it: `;function il(e,t){return(e.kind===`settings`||e.kind===`start`)&&e.text.startsWith($c)?es({reason:e.text.slice(23)},t):e.kind===`start`&&e.text===el?ts({},t):e.kind===`start`&&e.text===tl?qo({},t):e.kind===`start`&&e.text.startsWith(nl)?Xo({reason:e.text.slice(46)},t):e.kind===`loop`?Ko({},t):e.kind===`late`&&e.text.startsWith(rl)?Go({what:e.text.slice(52)},t):e.text}function al(e,t,n=Date.now()){return[...(e?.notices??[]).filter(e=>!e.id.startsWith(`parked-`)).map(e=>({id:e.id,level:e.level,text:il(e,t),actions:e.kind===`loop`||e.kind===`start`&&e.id===`start`?[`retry`]:[]})),...(e?.memory?.bossWaits??[]).map(e=>({id:`wait-${e.id}`,level:`warning`,text:Gs(e,n,t),wait:e.id,actions:[`answer`,`dismiss`]})),...(e?.memory?.proposals??[]).map(n=>({id:`proposal-${n.id}`,level:`warning`,text:ul(n,t),proposal:n.id,rev:e.memory.rev,actions:[`confirm`,`reject`]})),...e?.memory?.problem?[{id:`memory-unreadable`,level:`warning`,text:e.memory.problem,actions:[]}]:[],...(e?.parked??[]).map(e=>({id:`parked-${e.id}`,level:`warning`,text:e.from?is({kind:e.kind,from:e.from,first:e.first},t):ss({kind:e.kind,first:e.first},t),event:e.id,actions:[`deliver`,`drop`]}))]}function ol(e,t){if(!(e.status<400)){if(e.body.reason===`No such parked event`)return Fo({},t);if(e.body.reason?.startsWith(`The sb server stands in for no tower`))return Io({},t)}}async function sl(e,t,n,r=1200){let i=e.textContent;e.disabled=!0,e.textContent=ws(),t(void 0);try{let e=await n();e.ok?r&&await new Promise(e=>setTimeout(e,r)):t(jo({reason:ol(e)??e.body.reason??e.body.error??String(e.status)}))}catch{t(jo({reason:Es()}))}finally{e.disabled=!1,e.textContent=i}}var cl={standing:12,decision:24};function ll(e){let t=e=>e.state===`resolved`||e.state===`expired`;return{standing:e.filter(e=>e.kind===`standing`),decisions:e.filter(e=>e.kind===`decision`).reverse(),waits:e.filter(e=>e.kind===`wait`).sort((e,n)=>Number(t(e))-Number(t(n)))}}var ul=(e,t)=>e.op===`retire`?Ti({id:e.target??``,text:e.text},t):(e.kind===`standing`?Si:yi)({text:e.text},t),dl=(e,t)=>e.proposals.length?gi({standing:e.standing,decisions:e.decisions,waits:e.waits,proposals:e.proposals.length},t):pi({standing:e.standing,decisions:e.decisions,waits:e.waits},t);function fl(e,t){return[e.kind===`wait`?li({},t):e.via===`proposal`?ci({},t):si({},t),e.kind===`wait`?e.for===`boss`?Pi({},t):Ai({who:e.on??``},t):void 0,e.state===`answered`?Ni({who:e.on??``},t):e.state===`resolved`?Ri({outcome:e.outcome??``},t):e.state===`expired`?Fi({},t):void 0].filter(Boolean).join(` · `)}function pl(e,t){return e.body.error===`rev`?Di({},t):String(e.body.reason??e.body.error??e.status)}var ml={retry:Zo,deliver:No,drop:Po,answer:Mo,dismiss:zs,confirm:ui,reject:Ei};function hl(e,t,n,r){let a=al(n),o=JSON.stringify([t,a]);e.dataset.sig!==o&&(e.dataset.sig=o,e.replaceChildren(...a.map(e=>{let n=T(`small`,{class:`tnote-fail`,role:`alert`}),a=T(`p`,{class:`tnote ${e.level}`},T(`span`,null,e.text));for(let o of e.actions){if(o===`answer`){let e=r?O({view:`session`,ws:t,key:r}):``,n=T(`a`,{class:`pair-btn`,href:e||`./`,"data-route":e},ml[o]());n.addEventListener(`click`,()=>document.querySelector(`.composer-root textarea`)?.focus()),a.append(n);continue}let s=T(`button`,{type:`button`,class:`pair-btn`},ml[o]()),[c,l]=e.proposal&&(o===`confirm`||o===`reject`)?[`memory`,o===`confirm`?{op:`confirm`,proposal:e.proposal,rev:e.rev}:{op:`reject`,proposal:e.proposal}]:e.wait&&o===`dismiss`?[`memory`,{op:`drop`,id:e.wait}]:[o,e.event?{id:e.event}:{}];s.onclick=()=>void sl(s,e=>n.textContent=e??``,()=>i(`${Vc(t)}/${c}`,l)),a.append(s)}return a.append(n),a})))}var gl=140;function _l(e,t){let n=document.createElement(`nav`),r=document.createElement(`div`),i=document.createElement(`i`);[n.className,r.className,i.className,n.hidden]=[`minimap`,`mm-in`,`mm-view`,!0],n.setAttribute(`aria-label`,Ui()),n.append(r,i),document.body.append(n);let a=1,o=0,s=()=>{o=0;let t=e.getBoundingClientRect();i.style.transform=`translateY(${Math.round(Math.max(0,-t.top)*a)}px)`,i.style.height=`${Math.round(Math.min(innerHeight-Math.max(0,t.top),t.bottom)*a)}px`,n.classList.toggle(`away`,t.bottom<innerHeight)},c=()=>{let i=e.getBoundingClientRect();n.hidden=e.hidden||i.height<innerHeight*1.05||!matchMedia(`(min-width: 900px) and (hover: hover)`).matches,!n.hidden&&(a=Math.min(gl/i.width,innerHeight*.4/i.height),Object.assign(n.style,{width:`${Math.round(i.width*a)}px`,height:`${Math.round(i.height*a)}px`}),r.replaceChildren(...[...t.querySelectorAll(`:scope > .base:not(.leaving)`)].map(e=>{let t=e.getBoundingClientRect(),n=document.createElement(`i`);return n.dataset.mark=e.dataset.mark??`idle`,n.style.cssText=`left:${(t.left-i.left)*a}px;top:${(t.top-i.top)*a}px;width:${t.width*a}px;height:${t.height*a}px`,n})),s())};return addEventListener(`scroll`,()=>o||=requestAnimationFrame(s),{passive:!0}),addEventListener(`resize`,c),n.addEventListener(`click`,t=>{let n=e.getBoundingClientRect(),i=(t.clientY-r.getBoundingClientRect().top)/a;scrollTo({top:n.top+scrollY+i-innerHeight/2,behavior:matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})}),c}function vl({x1:e,y1:t,x2:n,y2:r,mid:i},a=64){let o=Array.from({length:201},(a,o)=>{let s=o/200,c=1-s;return[c**3*e+3*c*c*s*i+3*c*s*s*i+s**3*n,c**3*t+3*c*c*s*t+3*c*s*s*r+s**3*r]}),s=o.reduce((e,t,n)=>(e.push(n?e[n-1]+Math.hypot(t[0]-o[n-1][0],t[1]-o[n-1][1]):0),e),[]);return Array.from({length:a+1},(e,t)=>{let n=t/a*s.at(-1),r=Math.max(1,s.findIndex(e=>e>=n)),[i,c]=[o[r-1],o[r]],l=s[r]>s[r-1]?(n-s[r-1])/(s[r]-s[r-1]):0;return[i[0]+(c[0]-i[0])*l,i[1]+(c[1]-i[1])*l]})}function yl(e,t){if(t||!e.length)return[];let n=document.createElement(`style`);return n.textContent=e.map((e,t)=>`@keyframes pk${t}{${vl(e).map(([e,t],n,r)=>`${(n/(r.length-1)*100).toFixed(2)}%{transform:translate(${e.toFixed(1)}px,${t.toFixed(1)}px)}`).join(``)}}`).join(``),[n,...e.map((e,t)=>(e=>(e.className=`packet`,e.style.animationName=`pk${t}`,e))(document.createElement(`i`)))]}var bl=typeof document<`u`&&typeof document.querySelector==`function`&&((e=document)=>e.querySelector(`meta[name="sb-desk"]`)?.content===`1`)(),xl=(e,t=bl)=>t||e!==`127.0.0.1`,Sl=(e,t=bl)=>({phone:!xl(e,t),server:e===`127.0.0.1`}),Cl=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),wl=function(e,t){return new URL(e,t).href},Tl={},El=function(e){return e.pathname.endsWith(`.css`)},Dl=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},A=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=wl(t,n);let r=s(t),i=El(r);return Dl(Tl,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Cl,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function j(e,t,n,r,i=!1){Object.assign(e.dataset,t),[e.hidden,e.textContent]=[i,n],r&&e.setAttribute(`aria-label`,r)}var Ol=(e,t)=>t.role===`subagent`&&t.ended&&t.key?j(e,{close:`dismiss`,key:t.key,name:t.name,role:t.role},Xt(),nn({name:t.name})):j(e,{close:`unit`,key:t.key??``,name:t.name,role:t.role},Sa(),ot({name:t.name}),!(t.control&&t.key)||t.role===`subagent`),kl=(e,t)=>j(e,{key:t?.key??``,name:t?.name??``,role:`tower`},Ca(),void 0,!t?.control);function Al(e,t){e.dataset.close=`unit`,t?.u.role===`tower`&&t.base.tower?.key===t.u.key?kl(e,t.base.tower):t&&Ol(e,t.u),e.hidden=!t||e.dataset.close!==`unit`||e.hidden}var jl=(e,t)=>j(e,{ws:t.id,name:t.label},Sa(),Ge({name:t.label})),Ml=(e,t,n=bl)=>j(e,{ws:t.id,name:t.label},Za(),eo({name:t.label}),n),Nl=(e,t,n)=>j(e,{ws:t.id,name:n.label,tab:n.id},Sa(),Ze({name:n.label})),M=(e,t)=>new Promise(n=>{let r=document.createElement(`dialog`),i=document.createElement(`p`),a=document.createElement(`div`),o=(e,t,i)=>Object.assign(document.createElement(`button`),{type:`button`,className:t,textContent:e,onclick:()=>(r.close(),n(i))});[r.className,i.textContent,a.className]=[`sheet`,e,`sheet-row`],a.append(...t?[o(Ve(),`later`,!1),o(t,`sheet-yes`,!0)]:[o(He(),`later`,!1)]),r.append(i,a),r.addEventListener(`close`,()=>(r.remove(),n(!1))),document.body.append(r),r.showModal()}),Pl=e=>v(e).filter(e=>e.sub&&`ended`in e.unit&&e.unit.ended).map(e=>e.unit.key);function Fl(e,t){let n=Pl(t).length;e.hidden=!n,n&&(e.textContent=$t({count:n}))}function Il(e,t,n,r=bl){if(r)return void(e.hidden=!0);let i=n.stashed??[],a=JSON.stringify(i);e.hidden=!i.length;let o=t.closest(`[popover]`);!i.length&&o?.matches(`:popover-open`)&&o.hidePopover(),i.length&&(e.textContent=oo({count:i.length})),t.dataset.key!==a&&(t.dataset.key=a,t.replaceChildren(...i.map(e=>{let t=document.createElement(`li`),n=document.createElement(`span`),r=document.createElement(`button`);return n.textContent=e.name===e.label?e.label:`${e.name} (${e.label})`,[r.type,r.className]=[`button`,`pair-btn`],j(r,{close:`pop`,name:e.name},ga(),ya({name:e.name})),t.append(n,r),t})))}var Ll=e=>A(async()=>{let{post:e}=await import(`./post-CmicYl-f.js`).then(e=>e.r);return{post:e}},[],import.meta.url).then(({post:t})=>t(`dismiss`,e)).then(e=>e.ok||(M(e.body.reason??w({status:e.status})),!1),()=>(M(C()),!1));function Rl(e,{route:t,net:n,go:r}){let i=t();if(i.view===`map`||i.view===`head`)return;if(e.close===`base`||e.close===`stash`)return void(i.ws===e.ws&&r({view:`map`}));let a=e=>e.flatMap(e=>[e.key,...a(e.subs)]),o=e.close===`tab`&&i.ws===e.ws?n()?.bases.find(t=>t.id===e.ws)?.tabs.find(t=>t.id===e.tab):void 0;i.view===`session`&&(e.close===`unit`?i.key===e.key:o&&a(o.units).includes(i.key))&&r({view:`workspace`,ws:i.ws})}function zl(e){document.addEventListener(`click`,t=>{let n=t.target?.closest?.(`button[data-close]`),r=n?.dataset;if(n&&r){if(t.preventDefault(),r.close===`head`)return void M(mn(),pn()).then(e=>e&&(n.toggleAttribute(`disabled`,!0),A(async()=>{let{post:e}=await import(`./post-CmicYl-f.js`).then(e=>e.r);return{post:e}},[],import.meta.url).then(({post:e})=>e(`head/close`,{})).then(e=>e.ok||M(e.body.reason??w({status:e.status})),()=>M(C())).finally(()=>n.toggleAttribute(`disabled`,!1))));if(r.close===`dismiss`||r.close===`dismiss-all`)return void Ll(r.close===`dismiss`?{key:r.key}:{all:!0});if(r.close===`pop`)return void(n.toggleAttribute(`disabled`,!0),Promise.all([A(()=>import(`./post-CmicYl-f.js`).then(e=>e.r),[],import.meta.url),A(()=>import(`./refusal-CTAnRvLI.js`).then(e=>e.n),[],import.meta.url)]).then(([{post:e},{reasonOf:t}])=>e(`close/pop`,{name:r.name}).then(e=>e.ok||M(t(e.body.reason,e.body.settings)??w({status:e.status})))).catch(()=>M(C())).finally(()=>n.toggleAttribute(`disabled`,!1)));M((r.close===`stash`?ro:r.close===`base`?Je:r.close===`tab`?et:r.role===`tower`?rt:lt)({name:r.name??``}),r.close===`stash`?Za():Sa()).then(t=>{t&&(n.toggleAttribute(`disabled`,!0),A(async()=>{let{post:e}=await import(`./post-CmicYl-f.js`).then(e=>e.r);return{post:e}},[],import.meta.url).then(({post:e})=>e(`close/${r.close===`base`?`all`:r.close}`,r.close===`unit`?{key:r.key}:{workspace:r.ws,...r.tab&&{tab:r.tab}})).then(t=>t.ok?Rl(r,e):M(t.body.reason??w({status:t.status})),()=>M(C())).finally(()=>n.toggleAttribute(`disabled`,!1)))})}})}var Bl={main:`main`,member:`member`,subagent:`subagent`,outpost:`outpost`,outside:`outside`,tower:`tower`,ally:`tower`,run:`tower`},N={commanding:$r,working:oi,waiting:ai,idle:ni,done:ei,error:ti,unknown:ii},Vl={ally:Ma,run:La,main:Na,member:Pa,subagent:za,tower:Ba,outpost:Fa,outside:Ia,session:Ra},Hl={thinking:na,"watching a monitor":ta,idle:ni,"waiting on a question":ai,finished:ei},Ul={claude:`Claude`,codex:`Codex`},Wl=e=>Object.hasOwn(Vl,e)?Vl[e]():e,Gl=e=>e===`waiting`||e===`error`,P=e=>{let t=new DOMParser().parseFromString(e.trim(),`text/html`).body.firstElementChild;if(!(t instanceof HTMLElement))throw Error(`bad template`);return document.importNode(t,!0)},F=(e,t)=>{let n=document.getElementById(e);if(!(n instanceof t))throw Error(`#${e} is missing from the page`);return n},I=(e,t,n)=>{let r=e.querySelector(t);r.textContent!==n&&(r.textContent=n)},L=(e,t)=>{if(e.dataset.mark===t)return;let n=e.dataset.mark!==void 0;e.dataset.mark=t,n&&tc(e,`flash`)},Kl=e=>(t=>(e.slice(8,t)===`stale`?Yi:Ki)({what:e.slice(t+1)}))(e.indexOf(`:`,8)),R=(e,t)=>e?e.startsWith(`tool:`)?ks({tool:e.slice(5)}):e.startsWith(`monitor:`)?Kl(e):Object.hasOwn(Hl,e)?Hl[e]():e:N[t](),ql=(e,t,n)=>D(e,t)?``:n===`working`||n===`commanding`?R(e?.note,n):Gl(n)?N[n]():``,Jl=(e,t,n)=>D(e,t)&&(n===`working`||n===`commanding`)?`done`:n,Yl=(e,t,n,r,i=R(n,r))=>{I(e,t,i),e.querySelector(t).toggleAttribute(`data-monitoring`,i===R(n,r)&&n===`watching a monitor`)},z=(e,t)=>{e.toggleAttribute(`hidden`,!t),t&&(e.setAttribute(`href`,O(t)||`./`),e.setAttribute(`data-route`,O(t)))},Xl=(e,t)=>{let n=t.getBoundingClientRect(),r=e.offsetWidth;e.style.top=`${n.bottom+8}px`,e.style.left=`${Math.max(8,Math.min(n.right-r,innerWidth-r-8))}px`},Zl=`<div class="plate"><i class="ring"></i><svg><use href="#i-main"/></svg><b class="badge"></b></div>`;function Ql(e,t,n,r){L(e,n);let i=e.querySelector(`use`),a=`#i-${Bl[t]??`member`}`,o=r?.filter(e=>e.onScreen).length;i.getAttribute(`href`)!==a&&i.setAttribute(`href`,a),o?e.dataset.docs=String(o):delete e.dataset.docs}function B(e,t,n,r){let i=new Map;for(let t of e.children)!t.classList.contains(`leaving`)&&t.dataset.key&&i.set(t.dataset.key,t);let a=e.firstElementChild;for(let o of t){let t=i.get(o.id);for(t||(t=n(o),t.dataset.key=o.id,t.classList.add(`enter`),setTimeout(()=>t.classList.remove(`enter`),600)),i.delete(o.id);a?.classList.contains(`leaving`);)a=a.nextElementSibling;t===a?a=a.nextElementSibling:e.insertBefore(t,a),r(t,o)}for(let e of i.values())e.classList.add(`leaving`),setTimeout(()=>e.remove(),400)}var $l=(e,t=Math.max(0,Date.now()-e)/1e3)=>t<60?de({n:String(Math.floor(t))}):t<3600?ce({n:String(Math.floor(t/60))}):t<86400?ae({n:String(Math.floor(t/3600))}):b({n:String(Math.floor(t/86400))}),eu=(e,t)=>(t===void 0?delete e.dataset.since:e.dataset.since=String(t),e.textContent=t===void 0?``:$l(t));function tu(e,t=[]){let n=e.querySelector(`:scope > .ticks`),r=t.map(e=>`${e.at}${e.mark}`).join();n.dataset.sig!==r&&(n.dataset.sig=r,e.classList.toggle(`ticked`,t.length>0),n.replaceChildren(...t.map((e,n)=>{let r=document.createElement(`i`);return r.dataset.mark=e.mark,r.style.setProperty(`--o`,((n+1)/t.length).toFixed(2)),r})))}var nu=()=>P(`<div class="unit"><div class="card"><a class="hit"></a>${Zl}<div class="meta"><span class="name"></span><span class="line"><em class="role"></em><em class="agent"></em><span class="note"></span><span class="age"></span></span><span class="todo" hidden><b></b><span></span></span></div><button type="button" class="quit-btn" data-close="unit" hidden></button><span class="ticks" aria-hidden="true"></span></div><div class="subs"></div></div>`);function ru(e,t){let n=e.closest(`.base`)?.dataset.key,r=e.querySelector(`.hit`),i=Jl(t,void 0,t.mark),a=D(t)?void 0:t.note;z(r,t.key&&n?{view:`session`,ws:n,key:t.key}:void 0),r.setAttribute(`aria-label`,`${t.name}: ${R(a,i)}`),r.toggleAttribute(`data-alert`,Gl(i)),L(e,i),Ql(e.querySelector(`.plate`),t.role,i,t.docs),I(e,`.name`,t.name),I(e,`.role`,Wl(t.role)),I(e,`.agent`,t.agent?Ul[t.agent]:``),Yl(e,`.note`,a,i),eu(e.querySelector(`:scope > .card .age`),t.since);let o=e.querySelector(`:scope > .card .todo`);o.hidden=!t.todo,t.todo&&(I(o,`b`,`${t.todo.done<t.todo.total?`◐`:`✓`} ${t.todo.done}/${t.todo.total}`),I(o,`span`,t.todo.now??``)),tu(e.querySelector(`:scope > .card`),t.ticks),Ol(e.querySelector(`:scope > .card > .quit-btn`),t),B(e.querySelector(`.subs`),t.subs??[],nu,ru)}function iu(e,t,n){let r=t.tower?`main`:`member`;e.hidden=!!(n&&t.tower),e.dataset.open=r,e.dataset.ws=t.id,n&&(e.dataset.tab=n),e.textContent!==(r===`main`?fa():pa())&&(e.textContent=r===`main`?fa():pa())}var au=()=>P(`<section class="base"><header><div class="tower"><i class="sweep"></i><i class="pulse"></i><svg><use href="#i-tower"/></svg><b class="badge"></b></div><div class="title"><h2><a class="enter-base"></a></h2><p><span class="tstate"></span><span class="tqueue"></span><span class="age"></span></p><div class="allies" hidden></div><button type="button" class="quit-btn tower-quit" data-close="unit" hidden></button></div><button type="button" class="quit-btn" data-close="base"></button></header><div class="subs tower-subs"></div><div class="tower-notices"></div><div class="spawn-btns"><button type="button" class="pair-btn"></button><button type="button" class="pair-btn" data-close="stash"></button></div><div class="tabs"></div><div class="outposts" data-label="${ma()}"></div></section>`),ou=()=>{let e=au();return vc(e.querySelector(`header > .quit-btn`)),e},su=e=>Zc(e.service,e.mark,e=>N[e]());function cu(e,t){L(e,t.mark);let n=e.querySelector(`.tower`);n.classList.toggle(`ghost`,!t.tower),L(n,t.tower?.mark??`unknown`),I(e,`h2 a`,t.label),z(e.querySelector(`h2 a`),{view:`workspace`,ws:t.id}),I(e,`.title .tstate`,t.tower?ht({state:su(t.tower)}):ea()),I(e,`.title .tqueue`,Qc(t.tower?.service)??``),eu(e.querySelector(`.title .age`),t.tower?.since),iu(e.querySelector(`.spawn-btns button`),t),jl(e.querySelector(`header .menu-pop > .quit-btn`),t),yc(e.querySelector(`header > .menu`),t.label),Ml(e.querySelector(`.spawn-btns [data-close=stash]`),t),kl(e.querySelector(`.tower-quit`),t.tower),B(e.querySelector(`.tower-subs`),t.tower?.subs??[],nu,ru),Bc(e.querySelector(`.title .allies`),t.id,t.tower?.service),hl(e.querySelector(`.tower-notices`),t.id,t.tower?.service,t.tower?.key),B(e.querySelector(`.tabs`),t.tabs,()=>{let e=P(`<div class="tab"><h3><span></span><button type="button" class="tab-add"></button><button type="button" class="quit-btn" data-close="tab"></button></h3><div class="units"></div></div>`);return vc(e.querySelector(`h3 > .quit-btn`)),e},(e,n)=>{I(e,`h3 span`,bo({label:n.label})),Nl(e.querySelector(`.menu-pop > .quit-btn`),t,n),yc(e.querySelector(`h3 > .menu`),bo({label:n.label})),iu(e.querySelector(`.tab-add`),t,n.id),B(e.querySelector(`.units`),n.units,nu,ru)}),B(e.querySelector(`.outposts`),t.outposts.map(e=>({id:e.id,name:e.label,role:`outpost`,mark:e.mark,note:e.mark===`unknown`?Qi():void 0,since:e.since,ticks:e.ticks})),nu,ru)}var lu=()=>P(`<section class="base ally"><header><div class="tower"><i class="pulse"></i><svg><use href="#i-tower"/></svg><b class="badge"></b></div><div class="title"><span class="crown"><svg><use href="#i-main"/></svg><em class="ally-tag"></em></span><h2></h2><p><span class="tstate"></span></p></div></header><ul class="ally-tabs"></ul><ul class="ally-units"></ul></section>`);function uu(e,t,n){let r=oc(t);L(e,r),e.classList.toggle(`offline`,!t.online),L(e.querySelector(`.tower`),r),I(e,`.ally-tag`,Te({team:t.teamName})),I(e,`h2`,t.workspace??t.label),I(e,`.tstate`,`${t.workspace?`${t.label} · `:``}${t.short} · ${t.online?sc(t.tower):ur()}`),B(e.querySelector(`.ally-tabs`),t.tabs.map((e,t)=>({id:`${t}`,...e})),()=>P(`<li class="ally-tab"><b></b><span></span></li>`),(e,n)=>{I(e,`b`,n.label),I(e,`span`,t.online?sc(n.state):``),e.dataset.state=n.state}),B(e.querySelector(`.ally-units`),lc(n,t).map(e=>({id:e.unit,...e})),()=>P(`<li class="ally-unit"><b></b><span></span><pre></pre></li>`),(e,t)=>{I(e,`b`,t.unit),I(e,`span`,uc(t)),I(e,`pre`,t.report),e.querySelector(`pre`).hidden=!t.report,e.querySelector(`pre`).title=Sr(),e.dataset.state=t.state})}function du(e,t){if(e.hidden=!t,e.classList.toggle(`off`,!t),!t)return;let n=t.state!==`absent`;e.classList.toggle(`absent`,!n),L(e,t.mark);let r=e.querySelector(`.tower`);r.classList.toggle(`ghost`,!n),L(r,t.mark),e.setAttribute(`href`,`head`),I(e,`.head-name`,S()),I(e,`.tstate`,n?Zc(t.service,t.mark,e=>N[e]()):gn())}var fu=(e,t)=>e?t.map(([t,n])=>({x1:e[0],y1:e[1],x2:t,y2:n,mid:Math.round((e[0]+t)/2)})):[];function pu(e,t,n,r){let i=[...e.querySelectorAll(`.base:not(.leaving):not(.ally) .tower`)],a=e.querySelector(`.head-node:not(.off) .tower`)??void 0,o=e.getBoundingClientRect(),s=e=>{let t=e.getBoundingClientRect();return[Math.round(t.x+t.width/2-o.x),Math.round(t.y+t.height/2-o.y)]},c=a?i.filter(e=>e!==a):[],l=fu(a&&s(a),c.map(s)),u=l.map(({x1:e,y1:t,x2:n,y2:r,mid:i})=>`M${e} ${t}C${i} ${t} ${i} ${r} ${n} ${r}`),d=u.join(`|`);t.dataset.sig!==d&&(t.dataset.sig=d,t.replaceChildren(...u.map(e=>(t=>(t.setAttribute(`class`,`wire`),t.setAttribute(`d`,e),t))(document.createElementNS(`http://www.w3.org/2000/svg`,`path`)))),n.replaceChildren(...yl(l,r))),n.querySelectorAll(`.packet`).forEach((e,t)=>e.toggleAttribute(`data-live`,[`working`,`commanding`].includes(a.dataset.mark??``)||[`working`,`commanding`].includes(c[t].dataset.mark??``)))}var mu=2,hu=20;function gu(){let[e,t,n,r]=[F(`map`,HTMLElement),F(`bases`,HTMLElement),F(`links`,SVGSVGElement),F(`packets`,HTMLElement)],i=matchMedia(`(prefers-reduced-motion: reduce)`).matches,a=new Set,o=_l(e,t),s=()=>(o(),!e.hidden&&pu(e,n,r,i)),c=0,l=()=>c||=requestAnimationFrame(()=>(c=0,s())),u=new ResizeObserver(e=>(e.forEach(({target:e,borderBoxSize:t})=>e.style.gridRowEnd=`span ${Math.ceil((t[0].blockSize+hu)/mu)}`),l()));return setInterval(()=>document.querySelectorAll(`.age[data-since]`).forEach(e=>eu(e,Number(e.dataset.since))),15e3),addEventListener(`resize`,l),new ResizeObserver(([e])=>document.documentElement.style.setProperty(`--hud`,`${Math.ceil(e.borderBoxSize[0].blockSize)}px`)).observe(document.querySelector(`.hud`)),pc(),{layout:s,stats(e){let t=e.bases.flatMap(e=>[...e.tower?.subs??[],...e.tabs.flatMap(e=>e.units.flatMap(e=>[e,...e.subs]))]),n=e=>String(t.filter(t=>!e||t.mark===e).length);F(`s-commanding`,HTMLElement).parentElement.toggleAttribute(`data-on`,t.some(e=>e.mark===`commanding`));for(let[t,r]of[[`s-bases`,String(e.bases.length)],[`s-agents`,n()],[`s-working`,n(`working`)],[`s-commanding`,n(`commanding`)],[`s-waiting`,n(`waiting`)]])F(t,HTMLElement).textContent=r},show(e){let n=(e.link?.allies??[]).map(e=>({...e,id:`ally/${e.id}`,ally:!0}));du(F(`head-node`,HTMLElement),e.head),B(t,[...e.bases,...n],e=>`ally`in e?lu():ou(),(t,n)=>`ally`in n?uu(t,n,e.link?.units):cu(t,n));for(let e of t.children)a.has(e)||(a.add(e),u.observe(e));for(let e of a)e.isConnected||(a.delete(e),u.unobserve(e));requestAnimationFrame(s)},pause(e){document.documentElement.classList.toggle(`paused`,e)}}}var _u=(e,t)=>n=>n&&!e()&&t();function vu(e,t){let n=F(`link-alerts`,HTMLButtonElement),r=F(`link-alerts-pop`,HTMLElement),a=F(`link-alerts-list`,HTMLElement),o=``,s=new Set,c=!0;r.addEventListener(`toggle`,e=>e.newState===`open`&&Xl(r,n)),r.setAttribute(`aria-label`,rr()),n.title=rr();let l=(e,t,n)=>{let r=n.querySelector(`.link-note`);for(let e of n.querySelectorAll(`button`))e.disabled=!0;i(`link/confirm-answer`,{dialogId:e.dialogId,allow:t}).then(e=>{e.ok||(r.textContent=e.body.reason??w({status:e.status}));for(let e of n.querySelectorAll(`button`))e.disabled=!1},()=>{r.textContent=C();for(let e of n.querySelectorAll(`button`))e.disabled=!1})},u=e=>{let t=T(`li`,{class:`link-alert`,"data-level":`warning`}),n=T(`button`,{type:`button`,class:`pair-btn`},ir()),r=T(`button`,{type:`button`,class:`pair-btn`},or());return n.onclick=()=>l(e,!0,t),r.onclick=()=>l(e,!1,t),t.append(T(`b`,null,nc({id:``,kind:`confirm`,level:`warning`,team:e.team,teamName:``,data:{label:e.fromLabel,short:e.fromShort,tool:e.tool,tower:e.tower}})),T(`pre`,{class:`link-args`},e.args),T(`div`,{class:`devices-acts`},n,r),T(`small`,{class:`link-note`,role:`status`})),t},d,f,p=()=>void A(async()=>{let{mountDialogCards:e}=await import(`./linkdialogs-JxXE8c5p.js`);return{mountDialogCards:e}},[],import.meta.url).then(({mountDialogCards:e})=>(d=e(),o=``,h.net(f))),m=new Set,h={net(i){f=i;let l=rc((i?.alerts??[]).filter(e=>e.kind!==`confirm`&&!m.has(e.id))),g=i?.confirms??[],_=JSON.stringify([l,g]);if(_===o)return;o=_;let v=new Set([...g.map(e=>`c/${e.dialogId}`),...l.filter(e=>e.kind===`join-request`||e.kind===`dialog`&&cc(e)===`open`).map(e=>e.id)]);d?.keep(new Set(l.map(e=>e.id))),!d&&l.some(e=>e.kind===`dialog`)&&p(),c||t([...v].filter(e=>!s.has(e)).length),[s,c]=[v,!1];let y=l.length+g.length;n.hidden=y===0,n.textContent=nr({count:String(y)}),n.dataset.state=g.length||l.some(e=>e.level===`error`)?`error`:l.some(e=>e.level===`warning`)?`waiting`:`done`,!y&&r.matches(`:popover-open`)&&r.hidePopover(),a.replaceChildren(...ec(...g.map(u),...l.map(t=>{if(t.kind===`dialog`&&d)return d.row(t);let n=T(`li`,{class:`link-alert`,"data-level":t.level,"data-kind":t.kind},T(`span`,null,nc(t)));if(t.kind===`join-request`||t.kind===`fork`||t.kind===`mismatch`){let i=T(`button`,{type:`button`,class:`later`},t.kind===`join-request`?mr():fr());i.onclick=()=>(r.hidePopover(),e()),n.append(i)}if(t.kind===`notice`){let e=T(`button`,{type:`button`,class:`later`},lr());e.onclick=()=>(m.add(t.id),o=``,h.net(f)),n.append(e)}if(t.kind===`served`){let e=T(`a`,{class:`later`,href:`./`,"data-route":``},vr());e.onclick=()=>r.hidePopover(),n.append(e)}return n})))}};return h}var yu=45e3,bu=1e3,xu=3e4,Su={state:`connecting`,attempt:0},Cu=(e,t)=>Math.min(xu,bu*2**(e-1))*(.8+.4*t);function wu(e){try{return JSON.parse(e)}catch{return}}function Tu(e){let t,n,r,i=0,a={state:`connecting`,attempt:0},o=t=>e.onStatus(a={...a,...t}),s=()=>(e.clearTimeout(n),e.clearTimeout(r),n=r=void 0),c=()=>{let e=t;t=void 0,e?.close()},l=()=>{e.clearTimeout(r),r=e.setTimeout(()=>u(),yu),o({state:`live`,attempt:0,lastContact:e.now()})},u=()=>{c(),s();let t=a.attempt+1;if(t>8)return o({state:`offline`,attempt:t});o({state:`reconnecting`,attempt:t}),e.hidden()||(n=e.setTimeout(d,Cu(t,e.random())))},d=()=>{c(),s(),i=e.now();let n=t=e.open();n.onError(()=>{t===n&&(u(),e.replaced?.().then(e=>{e&&a.state!==`live`&&a.state!==`replaced`&&(c(),s(),o({state:`replaced`}))},()=>{}))}),n.listen(`message`,r=>{if(t!==n)return;let i=wu(r);i&&e.onNet(i),o({problem:i?void 0:ba()}),l()}),n.listen(`ping`,()=>t===n&&l()),n.listen(`problem`,e=>{t===n&&(o({problem:wu(e)??xa()}),l())}),r=e.setTimeout(()=>u(),yu)};return{start(){o({state:`connecting`,attempt:0}),d()},resume(){if(a.state===`replaced`)return;let n=e.now()-i<2e3||a.lastContact!==void 0&&e.now()-a.lastContact<=2e4;t&&n||(o({attempt:0,state:a.state===`live`||a.state===`offline`?`reconnecting`:a.state}),d())},restart:d,hide(){e.clearTimeout(n),n=void 0},stop(){c(),s()}}}function Eu(e,t,n){let r=t===`zen`;switch(e.on){case`pick`:return{away:!1,settings:n.settings,leaveSettings:r&&n.settings};case`follow`:return{away:r?n.settings?!0:n.away:!1,settings:n.settings,leaveSettings:!1};case`leave`:return{away:!0,settings:n.settings,leaveSettings:!1};case`back`:return{away:!1,settings:n.settings,leaveSettings:!1};case`route`:return{away:r?e.settings:n.away,settings:e.settings,leaveSettings:!1}}}function Du(e){let t=()=>({away:e.root.dataset.zenAway!==void 0,settings:e.settings()});function n(n){let r=t(),i=Eu(n,e.view.view(),r);i.away?e.root.dataset.zenAway=``:delete e.root.dataset.zenAway,e.view.refresh(),e.draw(),i.leaveSettings&&e.leaveSettings()}return e.view.onChange((e,t)=>n({on:t})),{leave:()=>n({on:`leave`}),back:()=>n({on:`back`}),route:e=>n({on:`route`,settings:e})}}function Ou(e){let t={view:`map`},n,r,i,a=Su,o,s,c=null,l=null,u=()=>$s(e.view.view(),e.root.dataset.zenAway!==void 0||t.view===`settings`),d=()=>u()===Qs.zen,f=()=>d()&&c||Lc(t,n?.head?.key);function p(){let t=f();t!==l&&(l=t,e.restart())}let m=t=>e.icon(u().count?ee(v(t).map(e=>e.unit)).length+(t.trust?.length??0)+[...Ys(t,Date.now()).values()].filter(e=>e.wait).length:0);function h(){let t=d();e.zenEl.hidden=!t,t?e.withZen(e=>d()&&(n&&e.net(Ys(n,Date.now()),n),e.show())):e.zen()?.hide(),n&&m(n),p()}let _=Du({view:e.view,root:e.root,settings:()=>t.view===`settings`,leaveSettings:e.leaveSettings,draw:()=>(e.back(),h())});function y(a){n=r=a,m(a),e.link(a.link),t.view===`head`&&p();let c=Ys(a,Date.now()),l=u();if(l.announce===`current`)return void(s=c,e.withZen(e=>e.net(c,a)));if(s&&l.signal&&e.signal(Xs(s,c)),s=c,e.hidden())return;let d=Xs(o,c);o=c,e.draw(a,d,c),t.view===`map`&&(e.map(a),i=a,r=void 0)}let te=()=>void(r&&y(r)),ne=t=>e.withPanels(e=>e.stack.show(t));function b(t,n,{mode:r,at:i}={}){if(r===`term`&&d())return e.withZen(e=>d()?e.terminal({key:n}):b(t,n,{mode:r,at:i}));r===`term`&&e.panels()?.stack.close(`go`),e.go({view:`session`,ws:t,key:n,at:i}),r===`term`&&e.withFocus(e=>e.terminal(n))}function re(t){if(d())return e.withZen(e=>d()?e.step(t):re(t));e.withPanels(e=>e.step(t,n))}return{get current(){return t},get latest(){return n},alertOf:e=>o?.get(e),rules:u,zenOn:d,watch:f,face:_,snapshot:y,sync:h,online:()=>a.state===`live`,status(t){a=t,e.zen()?.refresh()},opened:()=>l=f(),wake:te,route(r){let a=t;t=r,r.view===`settings`!=(a.view===`settings`)&&_.route(r.view===`settings`),e.navigate(r,a),r.view===`map`&&n&&n!==i&&(y(n),e.layout()),p()},openAlert:ne,openSession:b,openStep:re,leaveZen({item:t,route:n}){_.leave(),t&&ne(t),n&&e.go(n),te()},enterZen:()=>g(e.view,e.root),notified:e=>u().announce===`current`||(e.trust||e.wait?ne(e):b(e.ws,Js(e))),news:_u(()=>!u().chime,e.chime),keys:()=>u().keys,modal:()=>e.modal(),hotkey:t=>(t===`next`||t===`zoom`?e.panels()?.hotkey(t):e.zen()?.key(t))??!1,newest:()=>n,openSettings:()=>e.go({view:`settings`}),noDrawer:()=>!u().drawer,escape(n,r){if(!(n.key!==`Escape`||n.defaultPrevented||e.modal())){if(r)return void(!n.isComposing&&d()&&e.zen()?.escape(n)&&n.stopPropagation());d()||(n.preventDefault(),!(e.panels()?.stack.close()||t.view===`map`)&&(t.view===`settings`?e.leaveSettings():e.go(Ic(t))))}},watchLog(e){c=e,p()}}}function ku(t){let n=/^zh\b/i.test(t)&&(/-(hant|tw|hk|mo)\b/i.test(t)?`zh-TW`:/-(hans|cn|sg|my)\b/i.test(t)?`zh-CN`:void 0);return e(t)??(n?e(n):void 0)??e(t.split(`-`)[0])}function Au(t,n){return e(t)??n.map(ku).find(Boolean)??`en`}var ju={brand_label:Be,head_tower:S,menu_more:zi,tagline:xo,totals_label:Oo,stat_bases:co,stat_agents:so,stat_working:fo,stat_waiting:uo,stat_commanding:lo,mark_commanding:$r,alerts:fe,no_alerts:$i,link_connecting:ar,connect_connecting:ut,connect_retry:ft,location:Tr,all_bases:pe,documents:rn,timeline:So,states:_o,mark_working:oi,mark_waiting:ai,mark_idle:ni,mark_done:ei,mark_error:ti,credit:Yt,language:_n,view_label:Fs,view_auto:As,view_standard:Is,view_geek:Ps,view_zen:Rs,zen_back:Bs,zen_back_title:Vs,view_title:Ls,settings:Ka,new_base:Zi,back:Ee,remind:Ea,sound:qa,sound_volume:Xa,sound_try:Ya,sound_title:Ja,set_device:Va,set_device_note:Ha,set_phone:Ua,set_teams:Ga,set_server:Wa};Object.keys(ju);function Mu(e,t=localStorage,n=()=>location.reload()){return s(t).set(`locale`,e)?(n(),!0):!1}var Nu=()=>t.map(e=>({id:e,name:wr({},{locale:e})}));function Pu(){let e=Au(c.get(`locale`),navigator.languages??[navigator.language]);n(()=>e),document.documentElement.lang=e;let r={m:(e,t)=>e.textContent=t,mLabel:(e,t)=>e.setAttribute(`aria-label`,t),mTitle:(e,t)=>e.title=t,mEmpty:(e,t)=>e.dataset.empty=t};for(let e of document.querySelectorAll(`[data-m], [data-m-label], [data-m-title], [data-m-empty]`))for(let[t,n]of Object.entries(r))e.dataset[t]&&n(e,ju[e.dataset[t]]?.()??e.dataset[t]);let i=document.getElementById(`lang`);i.replaceChildren(...t.map(t=>new Option(wr({},{locale:t}),t,!1,t===e))),i.onchange=()=>Mu(i.value)||(i.value=e)}var Fu=e=>e===`auto`?As():Ns({view:e===`geek`?Ps():e===`zen`?Rs():Is()}),Iu=e=>e.state===`live`?void 0:e.state,Lu={connecting:ut,reconnecting:dt,offline:e=>je({tries:e.attempt-1}),replaced:ze},Ru=[`click`,`dblclick`,`auxclick`,`contextmenu`,`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`keydown`,`keyup`,`keypress`,`submit`,`dragstart`],zu=new Set([`click`,`dblclick`,`auxclick`,`contextmenu`,`submit`]),V=e=>document.getElementById(e),Bu=()=>({win:window,dialog:V(`connect`),text:V(`connect-text`),retry:V(`connect-retry`),reload:V(`connect-reload`),guarded:[document.querySelector(`.shell`),V(`dock`),V(`zen`)]});function Vu(e,t=Bu()){let{win:n,dialog:r,text:i,guarded:a}=t,o,s=!1,c=!1,l=()=>{c=!0,r.close(),c=!1},u=()=>{s||=(r.open&&l(),r.showModal(),!0);for(let e of a)e.inert=!0},d=()=>{for(let e of a)e.inert=!1;r.open&&l(),s=!1};r.addEventListener(`cancel`,e=>e.preventDefault()),r.addEventListener(`close`,()=>{c||r.open||(s=!1,o&&u())});for(let e of Ru)n.addEventListener(e,t=>{!o||r.contains(t.target)||t.target?.closest?.(`dialog:modal`)||(t.stopPropagation(),zu.has(e)&&t.preventDefault())},!0),r.addEventListener(e,e=>e.stopPropagation());return t.reload?.remove(),t.retry.addEventListener(`click`,e),e=>{if(o=Iu(e),!o)return d();r.dataset.state=o,i.textContent=Lu[o](e),t.retry.hidden=o!==`offline`,u()}}var Hu=`input, textarea, select, [role=textbox], [role=combobox], [role=listbox], .term-scroll`,Uu=`button, a, summary, [role=button], [role=link]`,Wu=`.ask-opt, [role=radio], [role=checkbox]`,Gu=`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`,Ku={dialogs:[{keys:[`f`],hotkey:`zoom`},{keys:[` `],hotkey:`next`,native:`keyboard`}]};function qu(e,t,n=!1,r=`dialogs`,i){if(t||e.defaultPrevented||e.isComposing)return;let a=e.key.toLowerCase(),o=Ku[r]?.find(t=>t.keys.includes(a)&&(t.takes?t.takes(e,i):!e.metaKey&&!e.ctrlKey&&!e.altKey)),s=e.target;if(!(!o||(o.blocks?o.blocks(s):s?.isContentEditable||s?.closest?.(Hu)))&&(!o.native||!s?.closest?.(Uu)||o.native!==`any`&&n)&&!(a===` `&&s?.closest?.(Wu)))return o.hotkey}function Ju(e,t=()=>document.querySelector(Gu)!==null,n=window,r=()=>`dialogs`,i){let a,o=!1,s=null;n.addEventListener(`pointerdown`,()=>o=!0,!0),n.addEventListener(`focusin`,e=>s=o?e.target:null,!0),n.addEventListener(`keydown`,n=>{let c=n.target===s;o=!1;let l=qu(n,t(),c,r(),i?.());if(l){if(n.repeat)return a===l?n.preventDefault():void 0;e(l)&&(a=l,n.preventDefault())}}),n.addEventListener(`keyup`,e=>{(a===`next`||a===`pause`)&&e.key===` `&&e.preventDefault(),a=void 0})}function Yu(e=()=>new AudioContext,t=e=>fetch(e).then(e=>e.arrayBuffer())){let n,r,i=1,a=new Map,o=()=>(n??=e(),r||((r=n.createGain()).connect(n.destination),r.gain.value=i),{c:n,g:r});return{volume:e=>void(i=(e/100)**2,r&&(r.gain.value=i)),unlock:()=>o().c.resume().then(()=>o().c.state===`running`,()=>!1),out:o,running:()=>n?.state===`running`,play(e){let{c:n,g:r}=o();a.has(e)||a.set(e,t(e).then(e=>n.decodeAudioData(e))),Promise.all([n.resume(),a.get(e)]).then(([,e])=>{let t=n.createBufferSource();t.buffer=e,t.connect(r),t.start()}).catch(()=>a.delete(e))}}}var Xu=Yu(),Zu=new URL(`done-jqKY4qf5.mp3`,import.meta.url).href,Qu=new URL(`error-DdTLgPEw.mp3`,import.meta.url).href,$u={waiting:new URL(`waiting-DOg8-8gu.mp3`,import.meta.url).href,error:Qu,done:Zu},ed=e=>e.mark===`waiting`||e.pending?`waiting`:e.mark===`error`?`error`:e.mark===`done`?`done`:void 0;function td(e){let t=e=>document.getElementById(e),n=t(`remind`),r=t(`sound`),i=t(`sound-vol`),a=t(`sound-vol-out`),o=typeof Notification<`u`,s=c.get(`remind`),l=c.get(`sound`),u=c.get(`volume`),d=[],f=()=>{let e=o?Notification.permission:`denied`;n.setAttribute(`aria-pressed`,String(s)),n.dataset.state=s?e===`granted`?`on`:e===`denied`?`blocked`:`ask`:`off`,n.title=o?s?e===`granted`?Aa():e===`denied`?Oa():Da():ka():ja(),t(`remind-note`).textContent=n.title,r.dataset.state=l?`on`:`off`,n.textContent={off:ho,on:go,blocked:mo,ask:po}[n.dataset.state](),r.textContent=l?go():ho(),r.setAttribute(`aria-pressed`,String(l)),i.value=a.value=String(u),Xu.volume(u)};n.onclick=async()=>{s&&o&&Notification.permission==="default"?await Notification.requestPermission().catch(()=>{}):c.set(`remind`,s=!s),f()};let p=e=>{c.set(`sound`,l=e),f(),l&&h(`done`)},m=e=>(c.set(`volume`,u=e),f());c.on(`sound`,()=>(l=c.get(`sound`),f(),d.forEach(e=>e()))),c.on(`volume`,()=>(u=c.get(`volume`),f(),d.forEach(e=>e()))),r.onclick=()=>p(!l),i.oninput=()=>m(Number(i.value)),i.onchange=()=>h(`done`),t(`sound-try`).onclick=()=>h(`done`);let h=e=>Xu.play($u[e]);function g(t,n){if(!s||!o||Notification.permission!==`granted`||!document.hidden&&document.hasFocus())return;let r=new Notification(t.name,{body:t.trust?Ts():{waiting:da,error:ca,done:aa}[n]({note:t.note??``}).trim(),tag:t.key,icon:document.querySelector(`link[rel="icon"]`)?.href,silent:n!==`waiting`});r.onclick=()=>(window.focus(),r.close(),e(t))}return f(),{remind:e=>g(e,`waiting`),sound:{on:()=>l,volume:()=>u,set:p,setVolume:m,try:()=>h(`done`),onChange:e=>void d.push(e)},chime:()=>l&&h(`done`),signal(e){let t=e.flatMap(e=>(t=>t?[{a:e,k:t}]:[])(ed(e)));if(t.length){l&&h([`waiting`,`error`,`done`].find(e=>t.some(t=>t.k===e)));for(let{a:e,k:n}of t)g(e,n)}}}}var nd=`sb.head.seen`;function rd(){try{let e=Number(localStorage.getItem(nd));return Number.isFinite(e)&&e>0?e:0}catch{return 0}}function id(e){try{e>rd()&&localStorage.setItem(nd,String(e))}catch{}}var ad=(e,t)=>!!(e?.said&&e.said>t);function od(e,t,n,r){if(e.hidden=!t,!t)return;e.dataset.mark=t.mark,e.dataset.state=t.state,e.title=S(),e.setAttribute(`aria-label`,t.said&&ad(t,n)&&!r?`${S()}: ${hn()}`:S()),e.toggleAttribute(`aria-current`,r),r&&e.setAttribute(`aria-current`,`page`);let i=e.querySelector(`.dot`);i&&(i.hidden=r||!ad(t,n))}var sd=(e,t)=>e.state===`absent`?gn({},t):Zc(e.service,e.mark,e=>N[e](),t);function cd(e,t){let n=(t,n)=>{let r=e.querySelector(t);r&&r.textContent!==n&&(r.textContent=n)};e.querySelector(`.head-icon`)?.setAttribute(`href`,`#i-crown`),n(`.head-kicker`,``),n(`.head-title`,S()),n(`.head-line`,sd(t));let r=e.querySelector(`.head-absent`);r&&(r.hidden=t.state!==`absent`,n(`.head-absent`,an()))}function ld(e,t,n,r){return e.map(e=>{let i=n?.bases.find(t=>t.id===e.workspace)?.tower?.key,a={workspace:e.label,age:$l(e.at,Math.max(0,t-e.at)/1e3)};return{id:e.id,text:(e.open?cn:dn)(a,r),open:e.open,...i?{route:O({view:`session`,ws:e.workspace,key:i})}:{},...e.last?{title:e.last}:{}}})}function ud(e,t,n,r=Date.now()){let i=t?ld(t.asks,r,n):[],a=JSON.stringify(i);e.hidden=!i.length,e.dataset.sig!==a&&(e.dataset.sig=a,e.setAttribute(`aria-label`,fn()),e.replaceChildren(...i.map(e=>T(e.route?`a`:`span`,{class:`head-ask`,"data-open":String(e.open),...e.route?{href:e.route||`./`,"data-route":e.route}:{},...e.title?{title:e.title}:{}},e.text))))}var dd,fd=e=>void(dd=e);function pd(e,t){if(`terminal`in e)return void(t.key&&dd?.({kind:`prompt`,key:t.key,asker:t.key,command:t.command,...e.run&&t.answerId?{run:t.answerId}:{}}));if(e.pane===null)return ha();dd?.({kind:`pane`,key:`grant:${e.pane}`,asker:t.key,command:t.command})}var md={commanding:Or,working:Qr,waiting:Yr,idle:Lr,done:jr,error:Pr,unknown:Kr},hd=e=>(e.kind===`joined`?Br:e.kind===`left`?Ur:md[e.mark])({name:e.name}),gd=18e5,_d={waiting:0,error:0,working:1,commanding:1},vd=e=>new Date(e).toLocaleTimeString([],{hour12:!1});function yd(e){let[t,n,r,i,a]=[`.tl-lanes`,`.tl-axis`,`.tl-at`,`.tl-last`,`.tl-span`].map(t=>e.querySelector(t)),o=[],s=``;matchMedia(`(max-width: 640px)`).matches&&(e.open=!1);let c=()=>{let e=Date.now()-gd,s=o.filter(t=>t.at>=e),c=s.at(-1);t.replaceChildren(...s.map(t=>{let n=document.createElement(`a`),r=(t.at-e)/gd*100;return n.className=`tl-mark ${t.kind}${r>70?` end`:``}`,n.dataset.mark=t.kind===`left`?`unknown`:t.mark,n.style.cssText=`left:${r.toFixed(2)}%;top:${(_d[t.mark]??2)*14+4}px`,n.setAttribute(`aria-label`,`${vd(t.at)} ${hd(t)}`),z(n,t.key&&t.kind!==`left`?{view:`session`,ws:t.ws,key:t.key}:{view:`workspace`,ws:t.ws}),n})),n.replaceChildren(...[0,10,20].map(t=>Object.assign(document.createElement(`span`),{textContent:vd(e+t*6e4).slice(0,5)})),Object.assign(document.createElement(`span`),{textContent:wo()})),r.textContent=c?vd(c.at):``,i.textContent=c?hd(c):Co(),a.textContent=Do({count:String(s.length)})};return setInterval(c,3e4),c(),{net(e){let t=e.events??[],n=t.map(e=>`${e.at}${e.kind}${e.key??e.name}${e.mark}`).join();n!==s&&(s=n,o=t,c())}}}async function bd(e,t=fetch){return e.startsWith(`data:`)?decodeURIComponent(e.slice(e.indexOf(`,`)+1)):t(e).then(e=>e.text(),()=>void 0)}function xd(e,t){let n=`<circle cx='23' cy='9' r='9' fill='#e0af68' stroke='#1a1b26' stroke-width='2'/><text x='23' y='13' text-anchor='middle' font-family='sans-serif' font-size='${t>9?9:12}' font-weight='700' fill='#16161e'>${t>9?`9+`:t}</text>`;return`data:image/svg+xml,${encodeURIComponent(t?e.replace(`</svg>`,`${n}</svg>`):e)}`}var H=m(void 0);Pu(),wc(),h(document.getElementById(`view-pick`),H,Fu);var Sd=gu(),Cd=yd(document.getElementById(`timeline`)),U=e=>document.getElementById(e),wd=document.documentElement,Td=_(U(`zen-back`),H,wd,()=>J.enterZen()),Ed=e=>e?new Date(e).toLocaleTimeString([],{hour12:!1}):Xi(),Dd=!1,Od=``,W,kd,G=e=>W?e(W):void kd?.then(e);function Ad(){kd??=A(async()=>{let{mountFocus:e}=await import(`./views-Cuh01A5V.js`);return{mountFocus:e}},[],import.meta.url).then(({mountFocus:e})=>(W=e({data:cf,restart:()=>Q.restart(),openTile:Fd,embedTerminal:(e,t,n)=>jd(e,t,n,{keys:!1}),online:J.online}),W.show(k(J.current),k(J.current)),J.latest&&W.net(J.latest),W))}var jd=(e,t,n,r)=>new Promise(i=>q(a=>i(a.terminal.embed(e,t,n,r)))),Md=()=>new Promise(e=>q(t=>e(t.kit))),Nd=e=>J.latest?.bases.find(t=>t.id===e)?.label??e,K,Pd,q=e=>{if(K)return e(K);Pd??=A(async()=>{let{mountPanels:e}=await import(`./layer-fkM6TRNE.js`);return{mountPanels:e}},[],import.meta.url).then(({mountPanels:e})=>K=e({label:Nd,recent:lf,post:e=>X&&((t,n)=>X.data(e).post(t,n)),trust:X&&X.trust,stream:()=>Od,showTerminal:(e,t)=>J.openSession(e,t,{mode:`term`})})),Pd.then(e)},Fd=(e,t)=>q(n=>n.tiles.open(e,t)),Id,Ld,Rd=e=>{Ld??=A(async()=>{let{mountZen:e,zenPage:t}=await import(`./zenchunk-dFTpPJf3.js`);return{mountZen:e,zenPage:t}},__vite__mapDeps([0]),import.meta.url).then(({mountZen:e,zenPage:t})=>{let n=t({sound:Y.sound,api:X?.api??of,snapshot:J.newest});return Id=e(U(`zen`),{data:cf,recent:lf,label:Nd,online:J.online,post:e=>X&&((t,n)=>X.data(e).post(t,n)),trust:X&&X.trust,remind:e=>Y.remind(e),sound:n.sound,menu:{language:{get:r,names:Nu,set:Mu},view:{choice:()=>H.choice(),set:e=>H.set(e),auto:()=>Fu(H.server())},sound:{...Y.sound,...n.menuSound}},music:n.music,leave:J.leaveZen,terminals:Md,watch:J.watchLog,companions:n.companions,activity:n.activity,settings:J.openSettings,start:X?.start})}),Ld.then(e)},zd=Sl(location.hostname),Bd=zd.phone,Vd,Hd=e=>void(Vd??=A(async()=>{let{mountSettings:e}=await import(`./settings-BjTSI7y8.js`);return{mountSettings:e}},[],import.meta.url).then(({mountSettings:e})=>e(U(`settings-view`),zd))).then(e),Ud=e=>J.current.view===`settings`?Hd(t=>t.show(e)):Z.go({view:`settings`,section:e}),Wd=document.querySelector(`link[rel="icon"]`),Gd=Wd?bd(Wd.href):void 0,Kd=0;function qd(e){Wd&&Gd&&e!==Kd&&(Kd=e,Gd.then(t=>t&&e===Kd&&(Wd.href=xd(t,e))))}function Jd(){let e=U(`dismiss-all`).hidden&&U(`stashed`).hidden&&U(`head-btn`).hidden;U(`bar-more`).hidden=e,e&&U(`bar-pop`).matches(`:popover-open`)&&U(`bar-pop`).hidePopover()}function Yd(e,t,n){Sd.stats(e),Fl(U(`dismiss-all`),e),Il(U(`stashed`),U(`stashed-list`),e),od(U(`head-btn`),e.head,rd(),J.current.view===`head`||J.current.view===`session`&&J.current.ws===`@head`),Jd(),U(`bar-more`).toggleAttribute(`data-news`,ad(e.head,rd())&&!(J.current.view===`head`||J.current.view===`session`&&J.current.ws===`@head`)),$?.net(e),(t.length||K)&&q(r=>r.alerts(t,n,e)),Cd.net(e),G(t=>t.net(e))}function Xd(e,t){let n=e.view===`workspace`&&t.view===`map`?document.querySelector(`#bases [data-key="${CSS.escape(e.ws)}"]`)?.getBoundingClientRect():void 0,r=e.view===`head`?`session`:e.view;document.body.dataset.route=r,$?.route(e),(e.view===`workspace`||e.view===`session`||e.view===`head`)&&Ad(),U(`map`).hidden=e.view!==`map`,U(`settings-view`).hidden=e.view!==`settings`,U(`crumbs`).hidden=e.view===`settings`,U(`legend`).hidden=r===`session`||e.view===`settings`,U(`prefs`).toggleAttribute(`aria-current`,e.view===`settings`),U(`stage`).dataset.view=e.view===`head`||e.view===`session`&&e.ws===`@head`?`head`:r,G(r=>r.show(k(e),k(t),n)),e.view===`settings`?Hd(t=>J.current===e&&t.show(e.section)):t.view===`settings`&&Hd(e=>e.hide())}var Zd=()=>Rc(window.history.state)>0?window.history.back():Z.go({view:`map`}),J=Ou({view:H,root:wd,zenEl:U(`zen`),zen:()=>Id,withZen:Rd,hidden:()=>document.hidden,back:Td,leaveSettings:Zd,restart:()=>Dd&&Q.restart(),icon:qd,link:e=>Qd.net(e),signal:e=>Y.signal(e),draw:Yd,map:Sd.show,navigate:Xd,layout:()=>requestAnimationFrame(Sd.layout),panels:()=>K,withPanels:q,withFocus:G,go:e=>Z.go(e),modal:()=>document.querySelector(Gu)!==null,chime:()=>Y.chime()});fd(J.openStep);var Qd=vu(()=>Ud(`teams`),J.news),Y=td(J.notified);function $d(e){ff(e),J.status(e);let t=e.state===`reconnecting`||e.state===`offline`||e.state===`replaced`;document.body.dataset.stale=U(`stage`).dataset.stale=String(t),U(`link`).dataset.state=e.state,U(`link-text`).textContent={connecting:ar,live:sr,reconnecting:pr,offline:ur,replaced:ur}[e.state](),W&&J.latest&&W.net(J.latest),K?.stack.redraw();let n=U(`banner`);n.hidden=!t&&!e.problem;let r=e.state===`replaced`?ze():e.state===`offline`?je({tries:e.attempt-1}):e.state===`reconnecting`?e.attempt?Re({attempt:e.attempt}):Fe():Pe({problem:e.problem??``}),i=document.createElement(`b`);i.textContent=Ed(e.lastContact),n.replaceChildren(`${r} ${Oe()} `,i,De())}function ef(e,t){try{let n=JSON.parse(t);e===`history`&&Id?.history(n),G(t=>e===`history`?t.history(n):t.cards(n))}catch{}}var tf=document.querySelector(`meta[name="sb-build"]`)?.content,nf=e=>!!(tf&&tf!==JSON.parse(e).build);function rf(e,t=!1){try{let n=JSON.parse(e),r=t?n:n?.view;typeof r==`string`&&H.setServer(r)}catch{}}function af(e){let t=new EventSource(e?`events?watch=${encodeURIComponent(e)}`:`events`);return{onError:e=>t.onerror=e,listen:(e,n)=>t.addEventListener(e,e=>n(e.data)),close:()=>t.close()}}var of=e=>fetch(`api/${e}`,{cache:`no-store`}).then(e=>e.ok?e.json():Promise.reject(Error(String(e.status)))),sf=(e,t=``)=>of(`history/${encodeURIComponent(e)}${t}`),X=void 0,cf=e=>({older:t=>sf(e,`?before=${encodeURIComponent(t)}`),latest:()=>sf(e),entry:t=>of(`entry/${encodeURIComponent(e)}/${encodeURIComponent(t)}`).catch(()=>void 0),pic:(t,n)=>`api/image/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${n}`}),lf=async e=>(await sf(e,`?limit=12`)).items,uf=()=>{let e=af(J.opened());return e.listen(`history`,e=>ef(`history`,e)),e.listen(`cards`,e=>ef(`cards`,e)),e.listen(`hello`,e=>nf(e)?location.reload():(Od=e,rf(e),K?.terminal.hello())),e.listen(`view`,e=>rf(e,!0)),e.listen(`mirror`,e=>K?.terminal.frame(e)),e};document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[data-alert]`),n=t&&Fc(t.getAttribute(`data-route`)??``);if(!n||n.view!==`session`||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let r=J.alertOf(n.key);r&&(e.preventDefault(),J.openAlert(r))},!0);var Z=zc(e=>J.route(e)),Q=Tu({open:uf,now:Date.now,setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e),random:Math.random,hidden:()=>document.hidden,onNet:J.snapshot,onStatus:$d,replaced:()=>fetch(`./`,{cache:`no-store`}).then(e=>e.status===403)}),df=()=>Q.resume(),ff=Vu(df);document.addEventListener(`visibilitychange`,()=>{if(Sd.pause(document.hidden),Id?.visible(!document.hidden),document.hidden)return Q.hide();J.wake(),G(e=>e.wake()),df()}),addEventListener(`keydown`,e=>J.escape(e,!0),!0),addEventListener(`keydown`,e=>J.escape(e,!1)),Ju(J.hotkey,J.modal,window,J.keys),U(`prefs`).addEventListener(`click`,e=>J.current.view===`settings`&&(e.preventDefault(),Zd())),Bd&&A(async()=>{let{mountLanWait:e}=await import(`./lanwait-B5xr0Cu-.js`);return{mountLanWait:e}},[],import.meta.url).then(({mountLanWait:e})=>e(U(`lan-wait`),()=>Ud(`wifi`)));var $,pf=matchMedia(`(pointer: coarse), (max-width: 640px)`),mf=()=>void A(async()=>{let{mountDrawer:e}=await import(`./drawer-Bw9Ifvof.js`);return{mountDrawer:e}},[],import.meta.url).then(({mountDrawer:e})=>($??=e(J.noDrawer),J.latest&&$.net(J.latest),$.route(J.current)));pf.matches?mf():pf.addEventListener(`change`,()=>pf.matches&&!$&&mf(),{once:!0}),zl({route:()=>k(J.current),net:()=>J.latest,go:e=>Z.go(e)}),U(`stashed-pop`).addEventListener(`toggle`,e=>e.newState===`open`&&Xl(U(`stashed-pop`),U(`stashed`))),document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`button[data-open]`);t&&A(async()=>{let{openingOf:e,spawnTile:t}=await import(`./spawn-1QOqPxeT.js`);return{openingOf:e,spawnTile:t}},[],import.meta.url).then(({openingOf:e,spawnTile:n})=>{let r=e(t,J.latest?.bases??[]);r&&Fd(n(r,(e,t,n)=>(K?.tiles.close(n),J.openSession(e,t)),()=>Y.chime()),!0)})});for(let e of[`focus`,`pageshow`,`online`])window.addEventListener(e,()=>!document.hidden&&df());$d(Su),J.route(Z.route()),J.sync(),Q.start(),Dd=!0;export{jc as $,rn as $t,Ol as A,Na as At,dl as B,Pi as Bt,L as C,ho as Ct,I as D,qa as Dt,B as E,Xa as Et,cl as F,C as Ft,Qc as G,$n as Gt,fl as H,ui as Ht,ol as I,$i as It,Bc as J,kn as Jt,Zc as K,Vn as Kt,qc as L,Qi as Lt,Fl as M,w as Mt,A as N,ma as Nt,Gl as O,La as Ot,hl as P,ea as Pt,Oc as Q,pn as Qt,Kc as R,Xi as Rt,ql as S,go as St,Yl as T,uo as Tt,pl as U,ti as Ut,ll as V,Ei as Vt,ul as W,ur as Wt,Ac as X,S as Xt,O as Y,_n as Yt,D as Z,gn as Zt,R as _,Fs as _t,id as a,ge as an,ic as at,P as b,Mo as bt,Ku as c,v as cn,T as ct,Bl as d,s as dn,qs as dt,ht as en,kc as et,N as f,c as fn,Js as ft,F as g,Is as gt,iu as h,Rs as ht,ad as i,x as in,nc as it,Ll as j,Ma as jt,Al as k,Pa as kt,Gu as l,ee as ln,ec as lt,z as m,zs as mt,ud as n,Ve as nn,Tc as nt,rd as o,pe as on,cc as ot,Zl as p,Vs as pt,Vc as q,Rn as qt,cd as r,Ee as rn,gc as rt,Xu as s,y as sn,ac as st,pd as t,He as tn,Ec as tt,Ul as u,a as un,tc as ut,Ql as v,Ps as vt,Wl as w,fo as wt,Jl as x,bo as xt,Xl as y,Es as yt,sl as z,zi as zt};
|