pi-straw-boss 0.76.0 → 0.77.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -4
  3. package/dist/gui/assets/{allyasks-Czxu9N0_.js → allyasks-B157BVSK.js} +1 -1
  4. package/dist/gui/assets/{allyunits-Cu820tRD.js → allyunits-D49tC5yS.js} +1 -1
  5. package/dist/gui/assets/{answer-D3Fc6DBr.js → answer-B_eEaZuu.js} +1 -1
  6. package/dist/gui/assets/{ask-DK8Sf6Pa.js → ask-Cf4u8awy.js} +1 -1
  7. package/dist/gui/assets/{asks-DqkFBBS7.js → asks-BP9fh8zE.js} +1 -1
  8. package/dist/gui/assets/{askview-gHx_Hk2d.js → askview-BzFy3A9l.js} +1 -1
  9. package/dist/gui/assets/{autoback-CZkFJtdj.js → autoback-mQmgZrYL.js} +1 -1
  10. package/dist/gui/assets/{blockschunk-DUknCMor.js → blockschunk-Bcf8T3l_.js} +1 -1
  11. package/dist/gui/assets/{box-BUf9E97Z.js → box-CdTJxlY3.js} +1 -1
  12. package/dist/gui/assets/{chat-CraWb-vz.js → chat-pwXYtfIJ.js} +1 -1
  13. package/dist/gui/assets/{drawer-DyN2PbF3.js → drawer-C4b67hAK.js} +1 -1
  14. package/dist/gui/assets/index-Dvw58cHb.js +4 -0
  15. package/dist/gui/assets/{lanwait-y3ZgXxvk.js → lanwait-D8XQhI49.js} +1 -1
  16. package/dist/gui/assets/{layer-BMeWKQ6w.js → layer-CcPpb9oC.js} +1 -1
  17. package/dist/gui/assets/{lightbox-BtmIeJYB.js → lightbox-cGNtXXLf.js} +1 -1
  18. package/dist/gui/assets/{link-_ku8_F1J.js → link-CfF8WoKX.js} +1 -1
  19. package/dist/gui/assets/{linkdialogs-BHiWLB73.js → linkdialogs-BtrIR5oZ.js} +1 -1
  20. package/dist/gui/assets/{mdbody-DmC2OoJ3.js → mdbody-CM0vyeve.js} +1 -1
  21. package/dist/gui/assets/{pair-6RKgnkV8.js → pair-BdBNEx-I.js} +1 -1
  22. package/dist/gui/assets/{picker-C9mN-2Ml.js → picker-CBlvQLT5.js} +1 -1
  23. package/dist/gui/assets/{server-D8Peiga1.js → server-CSZVUOSr.js} +1 -1
  24. package/dist/gui/assets/{sessionfacts-C-3Lh2Gu.js → sessionfacts-R0PNxQ07.js} +1 -1
  25. package/dist/gui/assets/{settings-C5nXwYtK.js → settings-Bqjz9KP-.js} +1 -1
  26. package/dist/gui/assets/{spawn-DmP1vT7z.js → spawn-DlKByPlr.js} +1 -1
  27. package/dist/gui/assets/{termcard-BWctoI4H.js → termcard-acLQMoog.js} +1 -1
  28. package/dist/gui/assets/{towerturns-Cd9alhqa.js → towerturns-Cldgw4hX.js} +1 -1
  29. package/dist/gui/assets/{trains-GY_I0p6W.js → trains-CY_wPPrG.js} +1 -1
  30. package/dist/gui/assets/{trust-D-_wrdAz.js → trust-DYlVFo7K.js} +1 -1
  31. package/dist/gui/assets/{views-SvadD2NQ.js → views-BxBhtxB1.js} +1 -1
  32. package/dist/gui/assets/{waitcard-Xgi9yQRE.js → waitcard-BF4toG4g.js} +1 -1
  33. package/dist/gui/assets/{yard-C6xyMp5L.js → yard-Bqrbq1yf.js} +1 -1
  34. package/dist/gui/index.html +2 -2
  35. package/dist/gui/themes/raven/{raven-DGx4eH2o.js → raven-Dr7te0ib.js} +2 -2
  36. package/dist/gui/themes/zen/{zen-BQrgqRoA.js → zen-C2J8hYV2.js} +1 -1
  37. package/dist/gui/themes.json +2 -2
  38. package/dist/server/{chunk-7HXSLT4U.mjs → chunk-ENYILM47.mjs} +4 -0
  39. package/dist/server/cli.mjs +1 -1
  40. package/dist/server/main.mjs +208 -42
  41. package/package.json +1 -1
  42. package/prompts/apps-config.md +1 -1
  43. package/prompts/integrator.md +1 -1
  44. package/prompts/main.md +1 -1
  45. package/prompts/planning.md +1 -1
  46. package/prompts/tower-run.md +1 -1
  47. package/prompts/train.md +1 -1
  48. package/src/carwait.ts +105 -0
  49. package/src/index.ts +1 -1
  50. package/src/server/carbook.ts +186 -33
  51. package/src/server/carnotices.ts +14 -8
  52. package/src/server/carops.ts +3 -1
  53. package/src/train/cars.ts +12 -2
  54. package/src/train/contract-legacy.ts +19 -0
  55. package/src/train/contract.ts +51 -0
  56. package/src/traincar.ts +32 -6
  57. package/src/trainguard.ts +11 -12
  58. package/dist/gui/assets/index-LCc1BzpW.js +0 -4
  59. package/src/train/anchorloop.ts +0 -78
@@ -1,3 +1,3 @@
1
- import{t as e}from"./runtime-ZX6HkxDa.js";import{a as t,i as n,n as r,t as i}from"./pairs-B51CKIwf.js";import{n as a,r as o,t as s}from"./lan_number_ask-DlHJl9jN.js";import{o as c,s as l}from"./asks-DqkFBBS7.js";import{Ft as u,K as d,Nt as f,Rt as p,_t as m,q as h,vt as g}from"./index-LCc1BzpW.js";var ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在取得配對碼…`:`Asking for a pairing code…`),_=e=>`Wi-Fi · ${e?.host}`,v=e=>`Wi-Fi・${e?.host}`,y=((t,n={})=>(n.locale??e())===`zh-TW`?v(t):_(t)),b=((t={},n={})=>(n.locale??e(),`Tailscale`)),x=e=>`Paired ${e?.paired} · last used ${e?.seen}`,S=e=>`配對於 ${e?.paired}・最後使用 ${e?.seen}`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`沒有已配對的裝置。`:`No device is paired.`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`已配對的裝置`:`Paired devices`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取維持關閉:憑證檔讀不出來,或其他帳號也讀得到。請在 pi session 執行 /boss gui lan reset 產生新的憑證,每支手機要重新安裝。`:`Wi-Fi access stays off: the certificate file is unreadable or readable by other accounts. Run /boss gui lan reset in a pi session to make a new certificate; each phone installs it again.`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦的 Wi-Fi 憑證已經到期;請在 pi session 執行 /boss gui lan reset 並選擇更新,每支手機再安裝新的憑證。`:`This computer's Wi-Fi certificate has ended; run /boss gui lan reset in a pi session and choose renew, and each phone installs the new one.`),te=e=>`This computer's Wi-Fi certificate ends on ${e?.date}. Run /boss gui lan reset in a pi session and choose renew; each phone installs the new one.`,O=e=>`這台電腦的 Wi-Fi 憑證將於 ${e?.date} 到期。請在 pi session 執行 /boss gui lan reset 並選擇更新;每支手機要安裝新的憑證。`,k=((t,n={})=>(n.locale??e())===`zh-TW`?O(t):te(t)),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取維持關閉:這台電腦的 Wi-Fi 憑證不見了。請在 pi session 執行 /boss gui lan 產生新的(每支手機要重新安裝)。`:`Wi-Fi access stays off: this computer's Wi-Fi certificate is missing. Run /boss gui lan in a pi session to make a new one (each phone installs it again).`),ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`憑證頁面的 QR code`:`QR code for the certificate page`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機打不開,請改用位址。`:`If the phone cannot open it, use the address.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`全部拒絕`:`Deny all`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`Android,安裝之後:「加密和憑證」>「信任的憑證」>「使用者」裡只能有一張 Straw Boss LAN CA,沒有你沒加過的憑證,且 SHA-256 要相符。否則立刻移除。`:`Android, after installing: Encryption & credentials, Trusted credentials, User must show exactly one Straw Boss LAN CA and nothing you did not add, with this SHA-256. Otherwise remove them now.`),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`iPhone,按「安裝」之前:「已下載描述檔」> 描述檔。「包含」只能寫「憑證」;「更多詳細資訊」裡只能有一張憑證、沒有其他項目,且 SHA-256 要相符。否則點「移除」。`:`iPhone, before Install: Profile Downloaded, the profile. Contains must say only Certificate; More Details must list exactly one certificate and nothing else, with this SHA-256. Otherwise tap Remove.`),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機是透過 Wi-Fi 下載憑證,信任之前請在手機上核對指紋。SHA-256 開頭是:`:`If the phone downloaded it over Wi-Fi, check the fingerprint on the phone before trusting it. SHA-256 starts:`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`Mac:「鑰匙圈存取」搜尋 Straw Boss:只能有一張 Straw Boss LAN CA,「詳細資訊」裡的 SHA-256 要相符。`:`Mac: Keychain Access, search Straw Boss: exactly one Straw Boss LAN CA, with this SHA-256 in Details.`),j=e=>`Windows: exactly one Security Warning appears, and its SHA-1 thumbprint is ${e?.sha1}. If a second warning appears, choose No, then remove the first in certmgr.msc.`,M=e=>`Windows:只會出現一個「安全性警告」,其中的 SHA-1 指紋是 ${e?.sha1}。如果出現第二個警告,請選「否」,再到 certmgr.msc 移除第一張。`,le=((t,n={})=>(n.locale??e())===`zh-TW`?M(t):j(t)),N=((t={},n={})=>(n.locale??e())===`zh-TW`?`macOS 防火牆封鎖了所有連入連線,手機連不上:請到「系統設定」、「網路」、「防火牆」、「選項」,關閉「封鎖所有連入連線」。`:`The macOS firewall blocks all incoming connections, so a phone cannot connect: turn off "Block all incoming connections" in System Settings, Network, Firewall, Options.`),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`macOS 防火牆封鎖了 node:請到「系統設定」、「網路」、「防火牆」、「選項」允許它。`:`The macOS firewall blocks node: allow it in System Settings, Network, Firewall, Options.`),P=e=>`Firewall: ${e?.text}`,F=e=>`防火牆:${e?.text}`,de=((t,n={})=>(n.locale??e())===`zh-TW`?F(t):P(t)),I=e=>`In an elevated PowerShell: ${e?.command}`,fe=e=>`在系統管理員身分的 PowerShell 執行:${e?.command}`,L=((t,n={})=>(n.locale??e())===`zh-TW`?fe(t):I(t)),pe=e=>`Cannot go in a command (the name holds a control character, an invisible or direction-changing character, or a wildcard): ${e?.left}. Disable them in wf.msc (Inbound Rules, the rule, Disable Rule).`,R=e=>`下列規則無法用指令處理(名稱含有控制字元、不可見或改變方向的字元,或萬用字元):${e?.left}。請在 wf.msc(輸入規則、該規則、停用規則)停用。`,me=((t,n={})=>(n.locale??e())===`zh-TW`?R(t):pe(t)),z=e=>`Windows Firewall has rules that block node.exe (${e?.names}); they win over any allow rule.`,B=e=>`Windows 防火牆有規則封鎖 node.exe(${e?.names});封鎖規則的優先權高於任何允許規則。`,V=((t,n={})=>(n.locale??e())===`zh-TW`?B(t):z(t)),H=e=>`Windows Firewall has rules that block TCP port ${e?.port} (${e?.names}); they win over any allow rule.`,U=e=>`Windows 防火牆有規則封鎖 TCP 連接埠 ${e?.port}(${e?.names});封鎖規則的優先權高於任何允許規則。`,W=((t,n={})=>(n.locale??e())===`zh-TW`?U(t):H(t)),G=e=>`No Windows Firewall rule allows incoming connections to TCP port ${e?.port}, so a phone cannot connect. A port rule survives node upgrades, which a program rule does not. In an elevated PowerShell: ${e?.command}`,he=e=>`沒有任何 Windows 防火牆規則允許連入 TCP 連接埠 ${e?.port},手機連不上。連接埠規則在 node 升級後仍有效,程式規則則不會。在系統管理員身分的 PowerShell 執行:${e?.command}`,K=((t,n={})=>(n.locale??e())===`zh-TW`?he(t):G(t)),ge=e=>`Windows calls the network of ${e?.where} Public, which blocks incoming connections: Settings, Network & internet, Wi-Fi, the network, Network profile type, Private.`,_e=e=>`Windows 把 ${e?.where} 所在的網路視為「公用」,會封鎖連入連線:請到「設定」、「網路和網際網路」、「Wi-Fi」、該網路、「網路設定檔類型」,改成「私人」。`,ve=((t,n={})=>(n.locale??e())===`zh-TW`?_e(t):ge(t)),ye=e=>`Windows Firewall could not be read (${e?.why}). If a phone cannot connect, allow the port in an elevated PowerShell with ${e?.allow} and list rules that block node.exe with ${e?.list}; disable one by its InstanceID with Disable-NetFirewallRule -Name '<InstanceID>'.`,be=e=>`無法讀取 Windows 防火牆(${e?.why})。如果手機連不上,請在系統管理員身分的 PowerShell 用 ${e?.allow} 允許該連接埠,並用 ${e?.list} 列出封鎖 node.exe 的規則;用 InstanceID 以 Disable-NetFirewallRule -Name '<InstanceID>' 停用其中一條。`,xe=((t,n={})=>(n.locale??e())===`zh-TW`?be(t):ye(t)),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`建議在手機的個人熱點,或手機直接連到這台電腦的 Wi-Fi 上使用 Wi-Fi 存取,讓網路上沒有其他人。`:`We recommend using Wi-Fi access on your phone's hotspot, or on a Wi-Fi that connects the phone directly to this computer, so no one else is on the network.`),Ce=e=>`Port ${e?.from} was taken on this computer; Wi-Fi access moved to ${e?.to}. An app installed from the old address needs adding again.`,we=e=>`這台電腦的連接埠 ${e?.from} 被佔用,Wi-Fi 存取已改到 ${e?.to}。從舊位址安裝的 app 要重新加入。`,Te=((t,n={})=>(n.locale??e())===`zh-TW`?we(t):Ce(t)),Ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦目前沒有 Wi-Fi 存取可以使用的私人網路位址(VPN 通道不提供服務)。`:`This computer has no private network address Wi-Fi access can serve now (a VPN tunnel is not served).`),De=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機警告「此連線不是私人連線」,不要繼續:先完成第一步安裝憑證。`:`If the phone warns that the connection is not private, do not go on: install the certificate first (step 1).`),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取還沒開啟。要開啟,讓和這台電腦在同一個網路的手機可以開這個頁面嗎?它只回應這個網路私人位址上的裝置;每支手機要先安裝一次這台電腦的憑證,每個新裝置都要在這裡允許。`:`Wi-Fi access is off. Turn it on so a phone on the same network as this computer can open this page? It answers only devices on this network's private addresses; each phone installs this computer's certificate once, and you allow each new device here.`),ke=e=>`Paired over Wi-Fi: ${e?.label} (${e?.peer})`,Ae=e=>`已透過 Wi-Fi 配對:${e?.label}(${e?.peer})`,je=((t,n={})=>(n.locale??e())===`zh-TW`?Ae(t):ke(t)),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`不只一個裝置用了配對碼:其中最多只有一個是你的手機。`:`More than one device used a code: only one of them can be your phone.`),Ne=e=>`Port ${e?.port} is taken on ${e?.address} by another program; Wi-Fi access does not serve that address. Run /boss gui lan in a pi session to move to a free port (installed apps then need to be added again).`,Pe=e=>`連接埠 ${e?.port} 在 ${e?.address} 上被其他程式佔用,Wi-Fi 存取不會服務那個位址。請在 pi session 執行 /boss gui lan 換到空的連接埠(已安裝的 app 之後要重新加入)。`,Fe=((t,n={})=>(n.locale??e())===`zh-TW`?Pe(t):Ne(t)),Ie=e=>`A Wi-Fi pairing code was used from ${e?.peer} and not allowed. If that was not your phone, someone saw the code.`,Le=e=>`有人從 ${e?.peer} 使用了 Wi-Fi 配對碼,但沒有被允許。如果那不是你的手機,代表有人看到了配對碼。`,Re=((t,n={})=>(n.locale??e())===`zh-TW`?Le(t):Ie(t)),ze=e=>`A Wi-Fi pairing code was used from ${e?.peer} and not allowed, ${e?.count} times (last at ${e?.time}). If that was not your phone, someone saw the code.`,Be=e=>`有人從 ${e?.peer} 使用了 Wi-Fi 配對碼但沒有被允許,共 ${e?.count} 次(最近一次 ${e?.time})。如果那不是你的手機,代表有人看到了配對碼。`,Ve=((t,n={})=>(n.locale??e())===`zh-TW`?Be(t):ze(t)),He=e=>`This computer is now called ${e?.name}; the certificate is for ${e?.caName}.local. Run /boss gui lan reset in a pi session to make a new certificate (each phone installs it again).`,Ue=e=>`這台電腦現在叫 ${e?.name},但憑證是給 ${e?.caName}.local 的。請在 pi session 執行 /boss gui lan reset 產生新的憑證(每支手機要重新安裝)。`,We=((t,n={})=>(n.locale??e())===`zh-TW`?Ue(t):He(t)),Ge=e=>`Another device on this network answers to ${e?.caName}.local, so macOS renamed this computer ${e?.name}. Use the address instead of the name below, and set the name back in System Settings, General, Sharing, Local hostname.`,Ke=e=>`這個網路上另一台裝置也叫 ${e?.caName}.local,所以 macOS 把這台電腦改名為 ${e?.name}。請改用下方的位址,不用名稱,並到「系統設定」>「一般」>「共享」>「本機主機名稱」把名稱改回來。`,qe=((t,n={})=>(n.locale??e())===`zh-TW`?Ke(t):Ge(t)),Je=e=>`Risk: anyone who copies this certificate's key from this computer (a backup, a program running as you, an agent you run) can pose to your phones, and to any computer that installed it, as ${e?.name}.local and as any private-network address, such as your router's or NAS's 192.168.x.x page, on any Wi-Fi they join, until you remove the certificate from each of them.`,Ye=e=>`風險:任何人只要從這台電腦複製走這張憑證的金鑰(例如備份檔、以你身分執行的程式、你執行的 agent),就能在你的手機和裝過它的電腦連上的任何 Wi-Fi 上,冒充 ${e?.name}.local 和任何私人網路位址(例如路由器或 NAS 的 192.168.x.x 管理頁),直到你從每台裝置移除這張憑證。`,Xe=((t,n={})=>(n.locale??e())===`zh-TW`?Ye(t):Je(t)),Ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`詳細說明`:`Details`),Qe=((t={},n={})=>(n.locale??e())===`zh-TW`?`風險:任何人只要從這台電腦複製走這張憑證的金鑰(例如備份檔、以你身分執行的程式、你執行的 agent),就能在你的手機和裝過它的電腦連上的任何 Wi-Fi 上,冒充任何私人網路位址(例如路由器或 NAS 的 192.168.x.x 管理頁),直到你從每台裝置移除這張憑證。`:`Risk: anyone who copies this certificate's key from this computer (a backup, a program running as you, an agent you run) can pose to your phones, and to any computer that installed it, as any private-network address, such as your router's or NAS's 192.168.x.x page, on any Wi-Fi they join, until you remove the certificate from each of them.`),$e=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的手機信任這台電腦的憑證。手機會不會限制它,目前還沒有驗證過,所以金鑰一旦被複製,就可能被用來向手機冒充任何網站。`:`This computer's certificate is trusted by your phones. Whether they limit it has not been verified, so a copy of its key could pose as any website to them.`),et=((t={},n={})=>(n.locale??e())===`zh-TW`?`或在你信任的網路上用手機掃描(最好是個人熱點或直連的 Wi-Fi)。`:`Or scan this on the phone, on a network you trust (a hotspot or direct Wi-Fi is best).`),tt=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取由預設 Herdr 的 sb server 提供。`:`Wi-Fi access is served by the default Herdr's sb server.`),nt=((t={},n={})=>(n.locale??e())===`zh-TW`?`在這裡下載憑證,再用 AirDrop 或快速分享傳到手機(除非手機要你接受來自不明傳送者的檔案,否則不必核對)。`:`Download the certificate here, then send it to the phone by AirDrop or Quick Share (no check needed unless the phone asked you to accept it from an unknown sender).`),rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`Android 或 Windows 用:憑證(.crt)`:`For Android or Windows: the certificate (.crt)`),it=((t={},n={})=>(n.locale??e())===`zh-TW`?`iPhone 或 Mac 用:描述檔(.mobileconfig)`:`For iPhone or Mac: the profile (.mobileconfig)`),at=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示給已安裝的 app 用的配對碼`:`Show a code for the installed app`),ot=e=>`Wi-Fi access stays off: ${e?.why}`,st=e=>`Wi-Fi 存取維持關閉:${e?.why}`,ct=((t,n={})=>(n.locale??e())===`zh-TW`?st(t):ot(t)),lt=e=>`Wi-Fi access stays off: ${e?.message}. It is tried again when the server next starts.`,ut=e=>`Wi-Fi 存取維持關閉:${e?.message}。伺服器下次啟動時會再試一次。`,dt=((t,n={})=>(n.locale??e())===`zh-TW`?ut(t):lt(t)),ft=((t={},n={})=>(n.locale??e())===`zh-TW`?`第一步,每支手機只要做一次:把這台電腦的憑證給手機。`:`Step 1, once per phone: give it this computer's certificate.`),pt=((t={},n={})=>(n.locale??e())===`zh-TW`?`第二步:用手機掃描並點「配對」,再在這裡允許。配對碼只能用一次,十分鐘內有效。`:`Step 2: scan with the phone and tap Pair, then allow it here. The code works once, within ten minutes.`),mt=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉 Wi-Fi 存取`:`Turn off Wi-Fi access`),ht=((t={},n={})=>(n.locale??e())===`zh-TW`?`產生憑證並開啟 Wi-Fi 存取`:`Make the certificate and turn on Wi-Fi access`),gt=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟 Wi-Fi 存取`:`Turn on Wi-Fi access`),_t=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在開啟 Wi-Fi 存取…`:`Turning Wi-Fi access on…`),vt=((t={},n={})=>(n.locale??e())===`zh-TW`?`尚未驗證:你的手機會不會把這張憑證限制在這台電腦的名稱和私人位址,目前還沒有查證過。在查證之前,請當作金鑰一旦被複製,就可能被用來向你的手機冒充任何網站。可以的話,請改用 Tailscale。`:`Not verified yet: whether your phone limits this certificate to this computer's name and private addresses has not been checked. Until it has, assume that a copy of the key could pose as any website to your phone. Use Tailscale instead if you can.`),yt=e=>`Use the address ${e?.address} instead of the name`,bt=e=>`改用位址 ${e?.address},不用名稱`,xt=((t,n={})=>(n.locale??e())===`zh-TW`?bt(t):yt(t)),St=e=>`Use the name ${e?.name}.local instead of the address`,Ct=e=>`改用名稱 ${e?.name}.local,不用位址`,wt=((t,n={})=>(n.locale??e())===`zh-TW`?Ct(t):St(t)),Tt=e=>`Too many wrong codes from ${e?.peers} addresses: this code is void. Choose Show a code for the installed app to get a new one (the QR still works). Someone on this network is guessing codes. Pair on your phone's hotspot instead.`,Et=e=>`來自 ${e?.peers} 個位址的錯誤配對碼太多次:這組配對碼已作廢。請按「顯示給已安裝的 app 用的配對碼」取得新的(QR code 仍可使用)。這個網路上有人在猜配對碼,請改用手機的個人熱點配對。`,Dt=((t,n={})=>(n.locale??e())===`zh-TW`?Et(t):Tt(t)),Ot=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦的流量經過 VPN;如果手機連不上,請在 VPN 設定裡允許存取區域網路。`:`A VPN carries this computer's traffic; if the phone cannot connect, allow local network access in the VPN's settings.`),kt=e=>`${e?.count} wrong codes from ${e?.peer}`,At=e=>`來自 ${e?.peer} 的錯誤配對碼 ${e?.count} 次`,jt=((t,n={})=>(n.locale??e())===`zh-TW`?At(t):kt(t)),Mt=((t={},n={})=>(n.locale??e())===`zh-TW`?`新的配對碼`:`New code`),Nt=((t={},n={})=>(n.locale??e())===`zh-TW`?`或在已安裝的 app 裡輸入這 8 個字元(不需要連字號)。只能用一次,十分鐘內有效。`:`Or, in an installed app, type these 8 characters (no hyphen needed). It works once, within ten minutes.`),Pt=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對 QR code`:`Pairing QR code`),Ft=((t={},n={})=>(n.locale??e())===`zh-TW`?`用以本機使用者身分登入 Tailscale 的手機掃描。只能用一次,十分鐘內有效。`:`Scan it with a phone signed in to Tailscale as this machine's user. It works once, within ten minutes.`),It=((t={},n={})=>(n.locale??e())===`zh-TW`?`同一個 Wi-Fi`:`Same Wi-Fi`),Lt=((t={},n={})=>(n.locale??e(),`Tailscale`)),Rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`網路`:`Network`),zt=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對手機`:`Pair a phone`),Bt=((t={},n={})=>(n.locale??e())===`zh-TW`?`遠端存取還沒開啟。要開啟,讓你 tailnet 上的手機可以開這個頁面嗎?只有用這台電腦的 Tailscale 帳號登入的裝置能配對,絕不使用 Funnel。`:`Remote access is off. Turn it on so a phone on your tailnet can open this page? Only devices signed in to Tailscale as this machine's user can pair; Funnel is never used.`),Vt=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉遠端存取不會刪除已配對的裝置;要結束某個裝置的配對,請按它的「解除配對」。`:`Turning remote access off keeps the paired devices. Unpair a device to end its pairing.`),Ht=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉遠端存取`:`Turn off remote access`),Ut=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟遠端存取`:`Turn on remote access`),Wt=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在開啟遠端存取…`:`Turning remote access on…`),Gt=((t={},n={})=>(n.locale??e())===`zh-TW`?`解除配對`:`Unpair`),Kt=((t={},n={})=>(n.locale??e())===`zh-TW`?`全部解除配對`:`Unpair all`),qt=e=>`Unpair ${e?.name}`,Jt=e=>`解除 ${e?.name} 的配對`,Yt=((t,n={})=>(n.locale??e())===`zh-TW`?Jt(t):qt(t)),Xt=e=>e?new Date(e).toLocaleString([],{hour12:!1,dateStyle:`medium`,timeStyle:`short`}):p();function Zt(e,n=()=>!0){let r=m(`div`,{class:`devices`}),i=m(`p`,{class:`chat-empty`,role:`status`}),a=(e,t,n)=>{let r=m(`button`,{type:`button`,class:`later`,"aria-label":t},e);return r.onclick=()=>(r.disabled=!0,void n().finally(()=>(r.disabled=!1,void s()))),r},o=(e,t={})=>h(e,t).then(e=>e.ok?i.replaceChildren():i.replaceChildren(e.body.reason??f({status:e.status})),()=>i.replaceChildren(u()));async function s(){let s=await h(`remote/devices`,{}).catch(()=>void 0),c=s?.ok?s.body.devices:[];if(!s?.ok)return void r.replaceChildren(m(`p`,{class:`chat-empty`},s?.body.reason??u()));let l=c.map(e=>m(`li`,null,m(`b`,null,e.label||t()),a(Gt(),Yt({name:e.label||t()}),()=>o(`remote/unpair`,{id:e.id})),m(`small`,null,e.net===`lan`?y({host:e.host??``}):b()),m(`small`,null,C({paired:Xt(e.paired),seen:Xt(e.seen)})))),d=s.body.on===!0&&n()&&a(Ht(),Ht(),()=>o(`remote/off`).then(e));r.replaceChildren(...g(m(`div`,{class:`devices-head`},m(`h4`,null,T()),c.length>1&&a(Kt(),Kt(),()=>o(`remote/unpair-all`))),c.length?m(`ul`,null,...l):m(`p`,{class:`chat-empty`},w()),i,d&&m(`div`,{class:`devices-acts`},d),d&&m(`small`,null,Vt())))}return s(),{box:r,refresh:s}}var q=`http://www.w3.org/2000/svg`;function J(e,t=Pt()){let n=e.length,r=document.createElementNS(q,`svg`),i=document.createElementNS(q,`rect`),a=document.createElementNS(q,`path`);r.setAttribute(`viewBox`,`-4 -4 ${n+8} ${n+8}`),r.setAttribute(`class`,`qr`),r.setAttribute(`role`,`img`),r.setAttribute(`aria-label`,t);for(let[e,t]of Object.entries({x:`-4`,y:`-4`,width:String(n+8),height:String(n+8),fill:`#fff`}))i.setAttribute(e,t);return a.setAttribute(`d`,e.flatMap((e,t)=>[...e].flatMap((e,n)=>e===`1`?[`M${n} ${t}h1v1h-1z`]:[])).join(``)),a.setAttribute(`fill`,`#06101e`),r.append(i,a),r}var Y=e=>Array.isArray(e)?e.map(String):[],X=e=>({name:typeof e.name==`string`?e.name:null,sha256:String(e.sha256??``),sha1:String(e.sha1??``),...typeof e.url==`string`?{url:e.url}:{},...Array.isArray(e.rows)?{rows:Y(e.rows)}:{},files:Y(e.files),ended:e.ended===!0}),Qt=n,Z=e=>Array.isArray(e)?e.map(e=>({text:String(e?.text??``),...typeof e?.code==`string`?{code:e.code}:{},...e?.params&&typeof e.params==`object`?{params:e.params}:{},...Array.isArray(e?.of)?{of:Z(e.of)}:{},...typeof e?.at==`number`?{at:e.at}:{}})):[],$t=e=>({on:e.on===!0,addresses:Array.isArray(e.addresses)?e.addresses.map(e=>({address:String(e?.address),...e?.interface?{interface:String(e.interface)}:{}})):[],pending:Qt(e.pending),notes:Array.isArray(e.noteList)?Z(e.noteList):typeof e.note==`string`?[{text:e.note}]:[],events:Array.isArray(e.eventList)?Z(e.eventList):Y(e.events).map(e=>({text:e}))});function Q(e){let n=t=>String(e.params?.[t]??``);switch(e.code){case`paired`:return je({label:n(`label`)||t(),peer:n(`peer`)});case`refused`:return Re({peer:n(`peer`)});case`wrong`:return jt({count:n(`count`),peer:n(`peer`)});case`void`:return Dt({peers:n(`peers`)});case`vpn`:return Ot();case`no_address`:return Ee();case`ca_ended`:return D();case`ca_ending`:return k({date:new Date(Number(n(`until`))).toLocaleDateString()});case`ca_corrupt`:return E();case`ca_missing`:return A();case`secondary`:return tt();case`renamed_n`:return qe({caName:n(`caName`),name:n(`name`)});case`renamed`:return We({caName:n(`caName`),name:n(`name`)});case`taken`:return Fe({port:n(`port`),address:n(`address`)});case`moved`:return Te({from:n(`from`),to:n(`to`)});case`fw_block_all`:return N();case`fw_block_node`:return ue();case`fw_win_block`:return[n(`what`)?V({names:n(`names`)}):W({port:n(`port`),names:n(`names`)}),n(`command`)?L({command:n(`command`)}):``,n(`left`)?me({left:n(`left`)}):``].filter(Boolean).join(` `);case`fw_win_noallow`:return K({port:n(`port`),command:n(`command`)});case`fw_win_public`:return ve({where:n(`where`)});case`fw_win_unknown`:return xe({why:n(`why`),allow:n(`allow`),list:n(`list`)});case`refused_n`:return Ve({peer:n(`peer`),count:n(`count`),time:new Date(e.at??0).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})});case`stays_off_error`:return dt({message:n(`message`)});case`fw_other`:return de({text:e.text});case`stays_off`:return e.of?ct({why:e.of.map(Q).join(` `)}):e.text;default:return e.text}}var en=new Set([`stays_off`,`stays_off_error`,`ca_corrupt`,`ca_missing`,`ca_ended`,`taken`,`no_address`,`fw_block_all`,`fw_block_node`,`fw_win_block`,`fw_win_noallow`,`fw_win_public`]),tn=e=>en.has(e.code??``);function nn(e){let t=new Map,n=new Map;for(let r of e)r.code===`refused`&&(t.set(String(r.params?.peer),(t.get(String(r.params?.peer))??0)+1),n.set(String(r.params?.peer),r));return e.flatMap(e=>e.code===`refused`?n.get(String(e.params?.peer))===e?t.get(String(e.params?.peer))>1?[{...e,code:`refused_n`,params:{...e.params,count:t.get(String(e.params?.peer))}}]:[e]:[]:[e])}var $=e=>String(e.body.reason??f({status:e.status}));function rn(e){let t=m(`div`,{class:`lan`}),n=m(`div`,{class:`lan-board`}),d=m(`div`,{class:`lan-main`}),f=m(`div`,{class:`lan-note`,role:`status`}),p=m(`ul`,{class:`lan-news`,role:`status`}),h=m(`p`,{class:`lan-no`,role:`status`});t.append(n,h,f,p,d);let _,v,y=0,b=0,x=!1,S,C={},w=``,T=``,E=(e,t)=>e!==T&&(T=e,f.replaceChildren(...e?e.split(`
1
+ import{t as e}from"./runtime-ZX6HkxDa.js";import{a as t,i as n,n as r,t as i}from"./pairs-B51CKIwf.js";import{n as a,r as o,t as s}from"./lan_number_ask-DlHJl9jN.js";import{o as c,s as l}from"./asks-BP9fh8zE.js";import{Ft as u,K as d,Nt as f,Rt as p,_t as m,q as h,vt as g}from"./index-Dvw58cHb.js";var ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在取得配對碼…`:`Asking for a pairing code…`),_=e=>`Wi-Fi · ${e?.host}`,v=e=>`Wi-Fi・${e?.host}`,y=((t,n={})=>(n.locale??e())===`zh-TW`?v(t):_(t)),b=((t={},n={})=>(n.locale??e(),`Tailscale`)),x=e=>`Paired ${e?.paired} · last used ${e?.seen}`,S=e=>`配對於 ${e?.paired}・最後使用 ${e?.seen}`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`沒有已配對的裝置。`:`No device is paired.`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`已配對的裝置`:`Paired devices`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取維持關閉:憑證檔讀不出來,或其他帳號也讀得到。請在 pi session 執行 /boss gui lan reset 產生新的憑證,每支手機要重新安裝。`:`Wi-Fi access stays off: the certificate file is unreadable or readable by other accounts. Run /boss gui lan reset in a pi session to make a new certificate; each phone installs it again.`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦的 Wi-Fi 憑證已經到期;請在 pi session 執行 /boss gui lan reset 並選擇更新,每支手機再安裝新的憑證。`:`This computer's Wi-Fi certificate has ended; run /boss gui lan reset in a pi session and choose renew, and each phone installs the new one.`),te=e=>`This computer's Wi-Fi certificate ends on ${e?.date}. Run /boss gui lan reset in a pi session and choose renew; each phone installs the new one.`,O=e=>`這台電腦的 Wi-Fi 憑證將於 ${e?.date} 到期。請在 pi session 執行 /boss gui lan reset 並選擇更新;每支手機要安裝新的憑證。`,k=((t,n={})=>(n.locale??e())===`zh-TW`?O(t):te(t)),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取維持關閉:這台電腦的 Wi-Fi 憑證不見了。請在 pi session 執行 /boss gui lan 產生新的(每支手機要重新安裝)。`:`Wi-Fi access stays off: this computer's Wi-Fi certificate is missing. Run /boss gui lan in a pi session to make a new one (each phone installs it again).`),ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`憑證頁面的 QR code`:`QR code for the certificate page`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機打不開,請改用位址。`:`If the phone cannot open it, use the address.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`全部拒絕`:`Deny all`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`Android,安裝之後:「加密和憑證」>「信任的憑證」>「使用者」裡只能有一張 Straw Boss LAN CA,沒有你沒加過的憑證,且 SHA-256 要相符。否則立刻移除。`:`Android, after installing: Encryption & credentials, Trusted credentials, User must show exactly one Straw Boss LAN CA and nothing you did not add, with this SHA-256. Otherwise remove them now.`),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`iPhone,按「安裝」之前:「已下載描述檔」> 描述檔。「包含」只能寫「憑證」;「更多詳細資訊」裡只能有一張憑證、沒有其他項目,且 SHA-256 要相符。否則點「移除」。`:`iPhone, before Install: Profile Downloaded, the profile. Contains must say only Certificate; More Details must list exactly one certificate and nothing else, with this SHA-256. Otherwise tap Remove.`),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機是透過 Wi-Fi 下載憑證,信任之前請在手機上核對指紋。SHA-256 開頭是:`:`If the phone downloaded it over Wi-Fi, check the fingerprint on the phone before trusting it. SHA-256 starts:`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`Mac:「鑰匙圈存取」搜尋 Straw Boss:只能有一張 Straw Boss LAN CA,「詳細資訊」裡的 SHA-256 要相符。`:`Mac: Keychain Access, search Straw Boss: exactly one Straw Boss LAN CA, with this SHA-256 in Details.`),j=e=>`Windows: exactly one Security Warning appears, and its SHA-1 thumbprint is ${e?.sha1}. If a second warning appears, choose No, then remove the first in certmgr.msc.`,M=e=>`Windows:只會出現一個「安全性警告」,其中的 SHA-1 指紋是 ${e?.sha1}。如果出現第二個警告,請選「否」,再到 certmgr.msc 移除第一張。`,le=((t,n={})=>(n.locale??e())===`zh-TW`?M(t):j(t)),N=((t={},n={})=>(n.locale??e())===`zh-TW`?`macOS 防火牆封鎖了所有連入連線,手機連不上:請到「系統設定」、「網路」、「防火牆」、「選項」,關閉「封鎖所有連入連線」。`:`The macOS firewall blocks all incoming connections, so a phone cannot connect: turn off "Block all incoming connections" in System Settings, Network, Firewall, Options.`),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`macOS 防火牆封鎖了 node:請到「系統設定」、「網路」、「防火牆」、「選項」允許它。`:`The macOS firewall blocks node: allow it in System Settings, Network, Firewall, Options.`),P=e=>`Firewall: ${e?.text}`,F=e=>`防火牆:${e?.text}`,de=((t,n={})=>(n.locale??e())===`zh-TW`?F(t):P(t)),I=e=>`In an elevated PowerShell: ${e?.command}`,fe=e=>`在系統管理員身分的 PowerShell 執行:${e?.command}`,L=((t,n={})=>(n.locale??e())===`zh-TW`?fe(t):I(t)),pe=e=>`Cannot go in a command (the name holds a control character, an invisible or direction-changing character, or a wildcard): ${e?.left}. Disable them in wf.msc (Inbound Rules, the rule, Disable Rule).`,R=e=>`下列規則無法用指令處理(名稱含有控制字元、不可見或改變方向的字元,或萬用字元):${e?.left}。請在 wf.msc(輸入規則、該規則、停用規則)停用。`,me=((t,n={})=>(n.locale??e())===`zh-TW`?R(t):pe(t)),z=e=>`Windows Firewall has rules that block node.exe (${e?.names}); they win over any allow rule.`,B=e=>`Windows 防火牆有規則封鎖 node.exe(${e?.names});封鎖規則的優先權高於任何允許規則。`,V=((t,n={})=>(n.locale??e())===`zh-TW`?B(t):z(t)),H=e=>`Windows Firewall has rules that block TCP port ${e?.port} (${e?.names}); they win over any allow rule.`,U=e=>`Windows 防火牆有規則封鎖 TCP 連接埠 ${e?.port}(${e?.names});封鎖規則的優先權高於任何允許規則。`,W=((t,n={})=>(n.locale??e())===`zh-TW`?U(t):H(t)),G=e=>`No Windows Firewall rule allows incoming connections to TCP port ${e?.port}, so a phone cannot connect. A port rule survives node upgrades, which a program rule does not. In an elevated PowerShell: ${e?.command}`,he=e=>`沒有任何 Windows 防火牆規則允許連入 TCP 連接埠 ${e?.port},手機連不上。連接埠規則在 node 升級後仍有效,程式規則則不會。在系統管理員身分的 PowerShell 執行:${e?.command}`,K=((t,n={})=>(n.locale??e())===`zh-TW`?he(t):G(t)),ge=e=>`Windows calls the network of ${e?.where} Public, which blocks incoming connections: Settings, Network & internet, Wi-Fi, the network, Network profile type, Private.`,_e=e=>`Windows 把 ${e?.where} 所在的網路視為「公用」,會封鎖連入連線:請到「設定」、「網路和網際網路」、「Wi-Fi」、該網路、「網路設定檔類型」,改成「私人」。`,ve=((t,n={})=>(n.locale??e())===`zh-TW`?_e(t):ge(t)),ye=e=>`Windows Firewall could not be read (${e?.why}). If a phone cannot connect, allow the port in an elevated PowerShell with ${e?.allow} and list rules that block node.exe with ${e?.list}; disable one by its InstanceID with Disable-NetFirewallRule -Name '<InstanceID>'.`,be=e=>`無法讀取 Windows 防火牆(${e?.why})。如果手機連不上,請在系統管理員身分的 PowerShell 用 ${e?.allow} 允許該連接埠,並用 ${e?.list} 列出封鎖 node.exe 的規則;用 InstanceID 以 Disable-NetFirewallRule -Name '<InstanceID>' 停用其中一條。`,xe=((t,n={})=>(n.locale??e())===`zh-TW`?be(t):ye(t)),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`建議在手機的個人熱點,或手機直接連到這台電腦的 Wi-Fi 上使用 Wi-Fi 存取,讓網路上沒有其他人。`:`We recommend using Wi-Fi access on your phone's hotspot, or on a Wi-Fi that connects the phone directly to this computer, so no one else is on the network.`),Ce=e=>`Port ${e?.from} was taken on this computer; Wi-Fi access moved to ${e?.to}. An app installed from the old address needs adding again.`,we=e=>`這台電腦的連接埠 ${e?.from} 被佔用,Wi-Fi 存取已改到 ${e?.to}。從舊位址安裝的 app 要重新加入。`,Te=((t,n={})=>(n.locale??e())===`zh-TW`?we(t):Ce(t)),Ee=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦目前沒有 Wi-Fi 存取可以使用的私人網路位址(VPN 通道不提供服務)。`:`This computer has no private network address Wi-Fi access can serve now (a VPN tunnel is not served).`),De=((t={},n={})=>(n.locale??e())===`zh-TW`?`如果手機警告「此連線不是私人連線」,不要繼續:先完成第一步安裝憑證。`:`If the phone warns that the connection is not private, do not go on: install the certificate first (step 1).`),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取還沒開啟。要開啟,讓和這台電腦在同一個網路的手機可以開這個頁面嗎?它只回應這個網路私人位址上的裝置;每支手機要先安裝一次這台電腦的憑證,每個新裝置都要在這裡允許。`:`Wi-Fi access is off. Turn it on so a phone on the same network as this computer can open this page? It answers only devices on this network's private addresses; each phone installs this computer's certificate once, and you allow each new device here.`),ke=e=>`Paired over Wi-Fi: ${e?.label} (${e?.peer})`,Ae=e=>`已透過 Wi-Fi 配對:${e?.label}(${e?.peer})`,je=((t,n={})=>(n.locale??e())===`zh-TW`?Ae(t):ke(t)),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`不只一個裝置用了配對碼:其中最多只有一個是你的手機。`:`More than one device used a code: only one of them can be your phone.`),Ne=e=>`Port ${e?.port} is taken on ${e?.address} by another program; Wi-Fi access does not serve that address. Run /boss gui lan in a pi session to move to a free port (installed apps then need to be added again).`,Pe=e=>`連接埠 ${e?.port} 在 ${e?.address} 上被其他程式佔用,Wi-Fi 存取不會服務那個位址。請在 pi session 執行 /boss gui lan 換到空的連接埠(已安裝的 app 之後要重新加入)。`,Fe=((t,n={})=>(n.locale??e())===`zh-TW`?Pe(t):Ne(t)),Ie=e=>`A Wi-Fi pairing code was used from ${e?.peer} and not allowed. If that was not your phone, someone saw the code.`,Le=e=>`有人從 ${e?.peer} 使用了 Wi-Fi 配對碼,但沒有被允許。如果那不是你的手機,代表有人看到了配對碼。`,Re=((t,n={})=>(n.locale??e())===`zh-TW`?Le(t):Ie(t)),ze=e=>`A Wi-Fi pairing code was used from ${e?.peer} and not allowed, ${e?.count} times (last at ${e?.time}). If that was not your phone, someone saw the code.`,Be=e=>`有人從 ${e?.peer} 使用了 Wi-Fi 配對碼但沒有被允許,共 ${e?.count} 次(最近一次 ${e?.time})。如果那不是你的手機,代表有人看到了配對碼。`,Ve=((t,n={})=>(n.locale??e())===`zh-TW`?Be(t):ze(t)),He=e=>`This computer is now called ${e?.name}; the certificate is for ${e?.caName}.local. Run /boss gui lan reset in a pi session to make a new certificate (each phone installs it again).`,Ue=e=>`這台電腦現在叫 ${e?.name},但憑證是給 ${e?.caName}.local 的。請在 pi session 執行 /boss gui lan reset 產生新的憑證(每支手機要重新安裝)。`,We=((t,n={})=>(n.locale??e())===`zh-TW`?Ue(t):He(t)),Ge=e=>`Another device on this network answers to ${e?.caName}.local, so macOS renamed this computer ${e?.name}. Use the address instead of the name below, and set the name back in System Settings, General, Sharing, Local hostname.`,Ke=e=>`這個網路上另一台裝置也叫 ${e?.caName}.local,所以 macOS 把這台電腦改名為 ${e?.name}。請改用下方的位址,不用名稱,並到「系統設定」>「一般」>「共享」>「本機主機名稱」把名稱改回來。`,qe=((t,n={})=>(n.locale??e())===`zh-TW`?Ke(t):Ge(t)),Je=e=>`Risk: anyone who copies this certificate's key from this computer (a backup, a program running as you, an agent you run) can pose to your phones, and to any computer that installed it, as ${e?.name}.local and as any private-network address, such as your router's or NAS's 192.168.x.x page, on any Wi-Fi they join, until you remove the certificate from each of them.`,Ye=e=>`風險:任何人只要從這台電腦複製走這張憑證的金鑰(例如備份檔、以你身分執行的程式、你執行的 agent),就能在你的手機和裝過它的電腦連上的任何 Wi-Fi 上,冒充 ${e?.name}.local 和任何私人網路位址(例如路由器或 NAS 的 192.168.x.x 管理頁),直到你從每台裝置移除這張憑證。`,Xe=((t,n={})=>(n.locale??e())===`zh-TW`?Ye(t):Je(t)),Ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`詳細說明`:`Details`),Qe=((t={},n={})=>(n.locale??e())===`zh-TW`?`風險:任何人只要從這台電腦複製走這張憑證的金鑰(例如備份檔、以你身分執行的程式、你執行的 agent),就能在你的手機和裝過它的電腦連上的任何 Wi-Fi 上,冒充任何私人網路位址(例如路由器或 NAS 的 192.168.x.x 管理頁),直到你從每台裝置移除這張憑證。`:`Risk: anyone who copies this certificate's key from this computer (a backup, a program running as you, an agent you run) can pose to your phones, and to any computer that installed it, as any private-network address, such as your router's or NAS's 192.168.x.x page, on any Wi-Fi they join, until you remove the certificate from each of them.`),$e=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的手機信任這台電腦的憑證。手機會不會限制它,目前還沒有驗證過,所以金鑰一旦被複製,就可能被用來向手機冒充任何網站。`:`This computer's certificate is trusted by your phones. Whether they limit it has not been verified, so a copy of its key could pose as any website to them.`),et=((t={},n={})=>(n.locale??e())===`zh-TW`?`或在你信任的網路上用手機掃描(最好是個人熱點或直連的 Wi-Fi)。`:`Or scan this on the phone, on a network you trust (a hotspot or direct Wi-Fi is best).`),tt=((t={},n={})=>(n.locale??e())===`zh-TW`?`Wi-Fi 存取由預設 Herdr 的 sb server 提供。`:`Wi-Fi access is served by the default Herdr's sb server.`),nt=((t={},n={})=>(n.locale??e())===`zh-TW`?`在這裡下載憑證,再用 AirDrop 或快速分享傳到手機(除非手機要你接受來自不明傳送者的檔案,否則不必核對)。`:`Download the certificate here, then send it to the phone by AirDrop or Quick Share (no check needed unless the phone asked you to accept it from an unknown sender).`),rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`Android 或 Windows 用:憑證(.crt)`:`For Android or Windows: the certificate (.crt)`),it=((t={},n={})=>(n.locale??e())===`zh-TW`?`iPhone 或 Mac 用:描述檔(.mobileconfig)`:`For iPhone or Mac: the profile (.mobileconfig)`),at=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示給已安裝的 app 用的配對碼`:`Show a code for the installed app`),ot=e=>`Wi-Fi access stays off: ${e?.why}`,st=e=>`Wi-Fi 存取維持關閉:${e?.why}`,ct=((t,n={})=>(n.locale??e())===`zh-TW`?st(t):ot(t)),lt=e=>`Wi-Fi access stays off: ${e?.message}. It is tried again when the server next starts.`,ut=e=>`Wi-Fi 存取維持關閉:${e?.message}。伺服器下次啟動時會再試一次。`,dt=((t,n={})=>(n.locale??e())===`zh-TW`?ut(t):lt(t)),ft=((t={},n={})=>(n.locale??e())===`zh-TW`?`第一步,每支手機只要做一次:把這台電腦的憑證給手機。`:`Step 1, once per phone: give it this computer's certificate.`),pt=((t={},n={})=>(n.locale??e())===`zh-TW`?`第二步:用手機掃描並點「配對」,再在這裡允許。配對碼只能用一次,十分鐘內有效。`:`Step 2: scan with the phone and tap Pair, then allow it here. The code works once, within ten minutes.`),mt=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉 Wi-Fi 存取`:`Turn off Wi-Fi access`),ht=((t={},n={})=>(n.locale??e())===`zh-TW`?`產生憑證並開啟 Wi-Fi 存取`:`Make the certificate and turn on Wi-Fi access`),gt=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟 Wi-Fi 存取`:`Turn on Wi-Fi access`),_t=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在開啟 Wi-Fi 存取…`:`Turning Wi-Fi access on…`),vt=((t={},n={})=>(n.locale??e())===`zh-TW`?`尚未驗證:你的手機會不會把這張憑證限制在這台電腦的名稱和私人位址,目前還沒有查證過。在查證之前,請當作金鑰一旦被複製,就可能被用來向你的手機冒充任何網站。可以的話,請改用 Tailscale。`:`Not verified yet: whether your phone limits this certificate to this computer's name and private addresses has not been checked. Until it has, assume that a copy of the key could pose as any website to your phone. Use Tailscale instead if you can.`),yt=e=>`Use the address ${e?.address} instead of the name`,bt=e=>`改用位址 ${e?.address},不用名稱`,xt=((t,n={})=>(n.locale??e())===`zh-TW`?bt(t):yt(t)),St=e=>`Use the name ${e?.name}.local instead of the address`,Ct=e=>`改用名稱 ${e?.name}.local,不用位址`,wt=((t,n={})=>(n.locale??e())===`zh-TW`?Ct(t):St(t)),Tt=e=>`Too many wrong codes from ${e?.peers} addresses: this code is void. Choose Show a code for the installed app to get a new one (the QR still works). Someone on this network is guessing codes. Pair on your phone's hotspot instead.`,Et=e=>`來自 ${e?.peers} 個位址的錯誤配對碼太多次:這組配對碼已作廢。請按「顯示給已安裝的 app 用的配對碼」取得新的(QR code 仍可使用)。這個網路上有人在猜配對碼,請改用手機的個人熱點配對。`,Dt=((t,n={})=>(n.locale??e())===`zh-TW`?Et(t):Tt(t)),Ot=((t={},n={})=>(n.locale??e())===`zh-TW`?`這台電腦的流量經過 VPN;如果手機連不上,請在 VPN 設定裡允許存取區域網路。`:`A VPN carries this computer's traffic; if the phone cannot connect, allow local network access in the VPN's settings.`),kt=e=>`${e?.count} wrong codes from ${e?.peer}`,At=e=>`來自 ${e?.peer} 的錯誤配對碼 ${e?.count} 次`,jt=((t,n={})=>(n.locale??e())===`zh-TW`?At(t):kt(t)),Mt=((t={},n={})=>(n.locale??e())===`zh-TW`?`新的配對碼`:`New code`),Nt=((t={},n={})=>(n.locale??e())===`zh-TW`?`或在已安裝的 app 裡輸入這 8 個字元(不需要連字號)。只能用一次,十分鐘內有效。`:`Or, in an installed app, type these 8 characters (no hyphen needed). It works once, within ten minutes.`),Pt=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對 QR code`:`Pairing QR code`),Ft=((t={},n={})=>(n.locale??e())===`zh-TW`?`用以本機使用者身分登入 Tailscale 的手機掃描。只能用一次,十分鐘內有效。`:`Scan it with a phone signed in to Tailscale as this machine's user. It works once, within ten minutes.`),It=((t={},n={})=>(n.locale??e())===`zh-TW`?`同一個 Wi-Fi`:`Same Wi-Fi`),Lt=((t={},n={})=>(n.locale??e(),`Tailscale`)),Rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`網路`:`Network`),zt=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對手機`:`Pair a phone`),Bt=((t={},n={})=>(n.locale??e())===`zh-TW`?`遠端存取還沒開啟。要開啟,讓你 tailnet 上的手機可以開這個頁面嗎?只有用這台電腦的 Tailscale 帳號登入的裝置能配對,絕不使用 Funnel。`:`Remote access is off. Turn it on so a phone on your tailnet can open this page? Only devices signed in to Tailscale as this machine's user can pair; Funnel is never used.`),Vt=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉遠端存取不會刪除已配對的裝置;要結束某個裝置的配對,請按它的「解除配對」。`:`Turning remote access off keeps the paired devices. Unpair a device to end its pairing.`),Ht=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉遠端存取`:`Turn off remote access`),Ut=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟遠端存取`:`Turn on remote access`),Wt=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在開啟遠端存取…`:`Turning remote access on…`),Gt=((t={},n={})=>(n.locale??e())===`zh-TW`?`解除配對`:`Unpair`),Kt=((t={},n={})=>(n.locale??e())===`zh-TW`?`全部解除配對`:`Unpair all`),qt=e=>`Unpair ${e?.name}`,Jt=e=>`解除 ${e?.name} 的配對`,Yt=((t,n={})=>(n.locale??e())===`zh-TW`?Jt(t):qt(t)),Xt=e=>e?new Date(e).toLocaleString([],{hour12:!1,dateStyle:`medium`,timeStyle:`short`}):p();function Zt(e,n=()=>!0){let r=m(`div`,{class:`devices`}),i=m(`p`,{class:`chat-empty`,role:`status`}),a=(e,t,n)=>{let r=m(`button`,{type:`button`,class:`later`,"aria-label":t},e);return r.onclick=()=>(r.disabled=!0,void n().finally(()=>(r.disabled=!1,void s()))),r},o=(e,t={})=>h(e,t).then(e=>e.ok?i.replaceChildren():i.replaceChildren(e.body.reason??f({status:e.status})),()=>i.replaceChildren(u()));async function s(){let s=await h(`remote/devices`,{}).catch(()=>void 0),c=s?.ok?s.body.devices:[];if(!s?.ok)return void r.replaceChildren(m(`p`,{class:`chat-empty`},s?.body.reason??u()));let l=c.map(e=>m(`li`,null,m(`b`,null,e.label||t()),a(Gt(),Yt({name:e.label||t()}),()=>o(`remote/unpair`,{id:e.id})),m(`small`,null,e.net===`lan`?y({host:e.host??``}):b()),m(`small`,null,C({paired:Xt(e.paired),seen:Xt(e.seen)})))),d=s.body.on===!0&&n()&&a(Ht(),Ht(),()=>o(`remote/off`).then(e));r.replaceChildren(...g(m(`div`,{class:`devices-head`},m(`h4`,null,T()),c.length>1&&a(Kt(),Kt(),()=>o(`remote/unpair-all`))),c.length?m(`ul`,null,...l):m(`p`,{class:`chat-empty`},w()),i,d&&m(`div`,{class:`devices-acts`},d),d&&m(`small`,null,Vt())))}return s(),{box:r,refresh:s}}var q=`http://www.w3.org/2000/svg`;function J(e,t=Pt()){let n=e.length,r=document.createElementNS(q,`svg`),i=document.createElementNS(q,`rect`),a=document.createElementNS(q,`path`);r.setAttribute(`viewBox`,`-4 -4 ${n+8} ${n+8}`),r.setAttribute(`class`,`qr`),r.setAttribute(`role`,`img`),r.setAttribute(`aria-label`,t);for(let[e,t]of Object.entries({x:`-4`,y:`-4`,width:String(n+8),height:String(n+8),fill:`#fff`}))i.setAttribute(e,t);return a.setAttribute(`d`,e.flatMap((e,t)=>[...e].flatMap((e,n)=>e===`1`?[`M${n} ${t}h1v1h-1z`]:[])).join(``)),a.setAttribute(`fill`,`#06101e`),r.append(i,a),r}var Y=e=>Array.isArray(e)?e.map(String):[],X=e=>({name:typeof e.name==`string`?e.name:null,sha256:String(e.sha256??``),sha1:String(e.sha1??``),...typeof e.url==`string`?{url:e.url}:{},...Array.isArray(e.rows)?{rows:Y(e.rows)}:{},files:Y(e.files),ended:e.ended===!0}),Qt=n,Z=e=>Array.isArray(e)?e.map(e=>({text:String(e?.text??``),...typeof e?.code==`string`?{code:e.code}:{},...e?.params&&typeof e.params==`object`?{params:e.params}:{},...Array.isArray(e?.of)?{of:Z(e.of)}:{},...typeof e?.at==`number`?{at:e.at}:{}})):[],$t=e=>({on:e.on===!0,addresses:Array.isArray(e.addresses)?e.addresses.map(e=>({address:String(e?.address),...e?.interface?{interface:String(e.interface)}:{}})):[],pending:Qt(e.pending),notes:Array.isArray(e.noteList)?Z(e.noteList):typeof e.note==`string`?[{text:e.note}]:[],events:Array.isArray(e.eventList)?Z(e.eventList):Y(e.events).map(e=>({text:e}))});function Q(e){let n=t=>String(e.params?.[t]??``);switch(e.code){case`paired`:return je({label:n(`label`)||t(),peer:n(`peer`)});case`refused`:return Re({peer:n(`peer`)});case`wrong`:return jt({count:n(`count`),peer:n(`peer`)});case`void`:return Dt({peers:n(`peers`)});case`vpn`:return Ot();case`no_address`:return Ee();case`ca_ended`:return D();case`ca_ending`:return k({date:new Date(Number(n(`until`))).toLocaleDateString()});case`ca_corrupt`:return E();case`ca_missing`:return A();case`secondary`:return tt();case`renamed_n`:return qe({caName:n(`caName`),name:n(`name`)});case`renamed`:return We({caName:n(`caName`),name:n(`name`)});case`taken`:return Fe({port:n(`port`),address:n(`address`)});case`moved`:return Te({from:n(`from`),to:n(`to`)});case`fw_block_all`:return N();case`fw_block_node`:return ue();case`fw_win_block`:return[n(`what`)?V({names:n(`names`)}):W({port:n(`port`),names:n(`names`)}),n(`command`)?L({command:n(`command`)}):``,n(`left`)?me({left:n(`left`)}):``].filter(Boolean).join(` `);case`fw_win_noallow`:return K({port:n(`port`),command:n(`command`)});case`fw_win_public`:return ve({where:n(`where`)});case`fw_win_unknown`:return xe({why:n(`why`),allow:n(`allow`),list:n(`list`)});case`refused_n`:return Ve({peer:n(`peer`),count:n(`count`),time:new Date(e.at??0).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})});case`stays_off_error`:return dt({message:n(`message`)});case`fw_other`:return de({text:e.text});case`stays_off`:return e.of?ct({why:e.of.map(Q).join(` `)}):e.text;default:return e.text}}var en=new Set([`stays_off`,`stays_off_error`,`ca_corrupt`,`ca_missing`,`ca_ended`,`taken`,`no_address`,`fw_block_all`,`fw_block_node`,`fw_win_block`,`fw_win_noallow`,`fw_win_public`]),tn=e=>en.has(e.code??``);function nn(e){let t=new Map,n=new Map;for(let r of e)r.code===`refused`&&(t.set(String(r.params?.peer),(t.get(String(r.params?.peer))??0)+1),n.set(String(r.params?.peer),r));return e.flatMap(e=>e.code===`refused`?n.get(String(e.params?.peer))===e?t.get(String(e.params?.peer))>1?[{...e,code:`refused_n`,params:{...e.params,count:t.get(String(e.params?.peer))}}]:[e]:[]:[e])}var $=e=>String(e.body.reason??f({status:e.status}));function rn(e){let t=m(`div`,{class:`lan`}),n=m(`div`,{class:`lan-board`}),d=m(`div`,{class:`lan-main`}),f=m(`div`,{class:`lan-note`,role:`status`}),p=m(`ul`,{class:`lan-news`,role:`status`}),h=m(`p`,{class:`lan-no`,role:`status`});t.append(n,h,f,p,d);let _,v,y=0,b=0,x=!1,S,C={},w=``,T=``,E=(e,t)=>e!==T&&(T=e,f.replaceChildren(...e?e.split(`
2
2
  `).map((e,n)=>m(`p`,{class:(t??[])[n]??!0?`lan-no`:`lan-info`},e)):[])),te=m(`ul`,{class:`lan-rows`}),O=m(`p`,null,Me()),k=m(`p`,{class:`lan-no`,role:`status`}),A=m(`input`,{type:`text`,inputmode:`numeric`,pattern:`[0-9]{4}`,maxlength:`4`,autocomplete:`off`,spellcheck:`false`,class:`lan-number`,"aria-label":s(),placeholder:`0000`}),j=m(`button`,{type:`button`,class:`go`},o()),M=m(`button`,{type:`button`,class:`later`},ie()),N=!1,ue=c((t,n)=>e.post(t,n)),P=t=>N?Promise.resolve():(N=j.disabled=M.disabled=!0,t(ue).then(t=>{let n=l(t);return k.replaceChildren(n.answer),h.replaceChildren(n.verdict),t.ok&&(A.value=``),e.changed(),K()},()=>k.replaceChildren(u())).finally(()=>N=j.disabled=M.disabled=!1)),F=()=>/^\d{4}$/.test(A.value)&&void P(e=>e.approve(A.value));A.addEventListener(`input`,()=>A.value=A.value.replace(/\D/g,``).slice(0,4)),A.addEventListener(`keydown`,e=>e.key===`Enter`&&F()),j.onclick=F,M.onclick=()=>void P(e=>e.denyAll());let de=m(`div`,{class:`lan-ask`},m(`label`,null,s()),m(`div`,{class:`lan-ask-row`},A,j,M),k),I=new Map;function fe(e){n.hidden=e.length===0;let t=new Set(e.map(e=>e.id));for(let[e,n]of I)t.has(e)||(n.li.remove(),I.delete(e));for(let t of e){let e=r(t),n=I.get(t.id);if(n){n.text!==e&&(n.span.replaceChildren(e),n.text=e);continue}let o=m(`button`,{type:`button`,class:`later`,"aria-label":`${a()}: ${i(t)}`},a()),s=m(`span`,null,e),c=m(`li`,null,s,o);o.onclick=()=>void P(e=>e.deny(t.id)),te.append(c),I.set(t.id,{li:c,span:s,text:e})}O.hidden=e.length<2,e.length?h.replaceChildren():k.replaceChildren()}n.append(O,te,de);let L=new Map;function pe(e){let t=nn(e),n=t.map(e=>`${e.at??``}|${e.code??``}|${e.text}`);for(let[e,t]of L)n.includes(e)||(t.remove(),L.delete(e));t.forEach((e,t)=>{if(L.has(n[t]))return;let r=m(`li`,null,Q(e));p.append(r),L.set(n[t],r)})}let R=e=>e?Xe({name:e}):Qe();async function me(t){let n=await e.post(`lan/ca`,{}).catch(()=>void 0);if(t!==y)return;let r=n?.status===409&&n.body.error===`no_ca`;if(!n?.ok&&!r)return void(d.replaceChildren(m(`p`,null,n?$(n):u())),v=void 0);let i=n.ok?X(n.body).name:typeof n.body.name==`string`?n.body.name:null,a=m(`button`,{type:`button`,class:`go lan-on`},n.ok?gt():ht()),o=m(`p`,{class:`lan-no`,role:`status`});n.ok&&X(n.body).ended&&o.append(D()),a.onclick=()=>(a.disabled=!0,o.replaceChildren(_t()),void e.post(`lan/on`,{accept_risk:!0}).then(e=>e.ok?K():(o.replaceChildren(e.body.error===`lan_ca_ended`?D():$(e)),void(a.disabled=!1)),()=>(o.replaceChildren(u()),void(a.disabled=!1)))),d.replaceChildren(m(`p`,null,Oe()),m(`p`,null,R(i)),m(`p`,{class:`lan-risk`},vt()),m(`p`,null,Se()),a,o)}let z=m(`div`,{class:`lan-pair`}),B=`name`,V=-1,H=!1,U=()=>[...S?.name&&!H?[``]:[],...(C.addresses??[]).map(e=>e.address)];async function W(t,n,r){z.replaceChildren(m(`p`,{class:`chat-empty`},ee()));let i=await e.post(`lan/pair`,{surface:e.surface,form:n,...r?{address:r}:{}}).catch(()=>void 0);if(t!==y)return;if(!i?.ok)return void z.replaceChildren(m(`p`,null,i?$(i):u()),G());let a=i.body,o=a.rows,s=a.code;n===`name`&&(H=a.form===`address`),n!==`typed`&&(B=a.form===`address`?`address`:`name`,V=B===`name`?U().indexOf(``):U().indexOf(String(a.host)));let c=U(),l=c.length>1?c[(V+1)%c.length]:void 0,d=l===void 0?void 0:m(`button`,{type:`button`,class:`later`},l?xt({address:l}):wt({name:S?.name??``}));d&&(d.onclick=()=>void W(y,l?`address`:`name`,l||void 0));let f=m(`button`,{type:`button`,class:`later`},at());f.onclick=()=>void W(y,`typed`);let p=Array.isArray(o)?J(o.map(String)):void 0;z.replaceChildren(...g(m(`p`,null,pt()),p,m(`p`,null,m(`code`,null,`${a.host}:${a.port}`)),typeof s==`string`&&m(`p`,null,Nt(),m(`br`,null),m(`code`,{class:`pair-code`},s),m(`br`,null),m(`small`,null,String(a.entry??``))),m(`p`,{class:`lan-hint`},De()),d&&B===`name`&&m(`p`,{class:`lan-hint`},re()),m(`div`,{class:`devices-acts`},G(),f,d)))}let G=()=>{let e=m(`button`,{type:`button`,class:`later`},Mt());return e.onclick=()=>void W(y,B,B===`address`?U()[V]:void 0),e};async function he(t){let n=await e.post(`lan/ca`,{}).catch(()=>void 0);if(t!==y)return;if(!n?.ok)return void d.replaceChildren(m(`p`,null,n?$(n):u()));S=X(n.body),H=!1;let r=m(`button`,{type:`button`,class:`later`},mt());r.onclick=()=>(r.disabled=!0,void e.post(`lan/off`,{}).then(()=>K(),()=>E(u())));let i=[...S.files??[]].filter(e=>e.endsWith(`.crt`)||e.endsWith(`.mobileconfig`)).sort().reverse().map(e=>m(`a`,{href:`api/lan/ca/${e}`,download:e,class:`go`},e.endsWith(`.crt`)?rt():it())),a=[oe(),ae(),ce(),le({sha1:S.sha1})];d.replaceChildren(m(`p`,{class:`lan-risk`},$e()),m(`details`,null,m(`summary`,null,Ze()),m(`p`,null,R(S.name)),m(`p`,{class:`lan-risk`},vt()),m(`p`,null,Se())),m(`h4`,null,ft()),m(`p`,null,nt()),m(`div`,{class:`devices-acts`},...i),...S.url&&S.rows?[m(`p`,null,et()),J(S.rows.map(String),ne()),m(`p`,null,m(`code`,null,S.url))]:[],m(`p`,null,se()),m(`p`,null,m(`code`,{class:`pair-code lan-fp`},S.sha256)),m(`ul`,{class:`lan-fps`},...a.map(e=>m(`li`,null,e))),m(`hr`,null),z,m(`div`,{class:`devices-acts`},r)),await W(t,`name`)}async function K(){if(!x)return;let t=b,n=await e.get(`lan/pending`).catch(()=>void 0);if(!x||t!==b)return;if(!n)return E(u());if(!n.ok)return E($(n));C=$t(n.body);let r=C.on===!0,i=v===r?y:++y,a=C.pending??[];fe(r?a:[]),E(r&&!(C.addresses??[]).length?Ee():(C.notes??[]).map(Q).join(`
3
3
  `),(C.notes??[]).map(tn)),pe(r?C.events??[]:[]);let o=JSON.stringify([C.events,a.length]);o!==w&&(w=o,e.changed()),v!==r&&(v=r,r?he(i):me(i))}return{root:t,start(){_?.(),v=void 0,x=!0,b++,K(),_=e.every(()=>void K(),1e3)},end(){_?.(),_=void 0,x=!1,b++,y++}}}var an=()=>`tile-${[...crypto.getRandomValues(new Uint8Array(8))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`;function on(e=`tailscale`){let t,n;return{id:`pair`,title:zt(),closed:()=>t?.end(),select:e=>n?.(e),body:()=>{let r=m(`div`,{class:`pair`}),i=m(`button`,{type:`button`,class:`later`},Mt()),a=m(`button`,{type:`button`,class:`pair-btn`},Ut()),o=(e=`remote/pair`,t=ee())=>{r.replaceChildren(m(`p`,{class:`chat-empty`},t)),h(e,{}).then(t=>{c.refresh();let n=t.body.rows,o=String(t.body.url??``),s=t.body.code;if(t.body.error===`remote_off`)return r.replaceChildren(m(`p`,null,Bt()),a);if(!t.ok||!Array.isArray(n))return r.replaceChildren(m(`p`,null,t.body.reason??f({status:t.status})),e===`remote/on`?a:i);r.replaceChildren(...g(J(n.map(String)),m(`p`,null,Ft()),m(`p`,null,m(`code`,null,new URL(o).host)),typeof s==`string`&&m(`p`,null,Nt(),m(`br`,null),m(`code`,{class:`pair-code`},s)),i))},()=>r.replaceChildren(m(`p`,null,u()),i))};a.onclick=()=>o(`remote/on`,Wt()),i.onclick=()=>o();let s=`tailscale`,c=Zt(()=>r.replaceChildren(m(`p`,null,Bt()),a),()=>s===`tailscale`);t=rn({get:d,post:h,surface:an(),changed:()=>void c.refresh(),every:(e,t)=>{let n=setInterval(e,t);return()=>clearInterval(n)}});let l=[`tailscale`,`lan`],p=l.map(e=>{let t=m(`button`,{type:`button`,role:`tab`,class:`later`,id:`pair-tab-${e}`,"aria-controls":`pair-panel-${e}`},e===`lan`?It():Lt());return t.onclick=()=>_(e),t.addEventListener(`keydown`,t=>{let n=t.key,r=n===`ArrowRight`||n===`ArrowLeft`?(l.indexOf(e)+(n===`ArrowRight`?1:l.length-1))%l.length:n===`Home`?0:n===`End`?l.length-1:-1;r<0||(t.preventDefault(),_(l[r]),p[r][1].focus())}),[e,t]});for(let[e,n]of[[`tailscale`,r],[`lan`,t.root]])for(let[t,r]of Object.entries({role:`tabpanel`,id:`pair-panel-${e}`,"aria-labelledby":`pair-tab-${e}`}))n.setAttribute(t,r);let _=(e,n=!1)=>{s=e;for(let[t,n]of p)n.setAttribute(`aria-selected`,String(t===e)),n.setAttribute(`tabindex`,t===e?`0`:`-1`),n.classList.toggle(`on`,t===e);r.hidden=e!==`tailscale`,t.root.hidden=e!==`lan`,e===`lan`?t.start():(t.end(),n||o()),c.refresh()};return n=e=>e!==s&&_(e),_(e,!0),e===`tailscale`&&o(),m(`div`,{class:`pair`},m(`div`,{class:`pair-tabs`,role:`tablist`,"aria-label":Rt()},...p.map(([,e])=>e)),r,t.root,c.box)}}}export{on as pairTile,J as t};
@@ -1 +1 @@
1
- import{t as e}from"./runtime-ZX6HkxDa.js";import{Ft as t,Nt as n,_t as r,q as i}from"./index-LCc1BzpW.js";var a=((t={},n={})=>(n.locale??e())===`zh-TW`?`只顯示前 500 個資料夾。`:`Showing the first 500 folders.`),o=((t={},n={})=>(n.locale??e())===`zh-TW`?`這裡沒有資料夾。`:`No folders here.`),s=((t={},n={})=>(n.locale??e())===`zh-TW`?`資料夾:`:`Folder:`),c=((t={},n={})=>(n.locale??e())===`zh-TW`?`新資料夾`:`New folder`),l=((t={},n={})=>(n.locale??e())===`zh-TW`?`新資料夾的名稱`:`Name of the new folder`),u=((t={},n={})=>(n.locale??e())===`zh-TW`?`上一步`:`Back`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇…`:`Choose…`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇資料夾`:`Choose a folder`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`桌面`:`Desktop`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`文件`:`Documents`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`下一步`:`Forward`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`家目錄`:`Home`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`資料夾`:`Folders`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`路徑`:`Path`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`位置`:`Places`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`最近`:`Recent`),x=(e,t)=>e===t?``:e.slice(Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1),S=(e,t,n)=>(e.endsWith(n)?e:e+n)+t;function C({list:e,make:t}){let n=new Map,r=[],i=[],a=[],o=0,s=-1,c=``,l=`/`,u,d,f=0,p=()=>i.forEach(e=>e()),m=e=>{r[s]!==e&&(r.splice(s+1,r.length,e),s=r.length-1)},h=async t=>{let r=t===void 0?void 0:n.get(t);if(r)return r;let i=await e(t);return n.set(i.path,i),t!==void 0&&n.set(t,i),[c,l]=[i.home,i.sep],i},g=async e=>{let t=e.path===e.home||!e.path.startsWith(e.home)?[]:e.path.slice(e.home.length).split(e.sep).filter(Boolean),n=t.reduce((t,n)=>[...t,S(t.at(-1),n,e.sep)],[e.home]);return(await Promise.all(n.map(t=>t===e.path?e:h(t)))).map((e,n)=>({path:e.path,dirs:e.dirs,truncated:e.truncated,...t[n]!==void 0&&{pick:t[n]}}))};async function _(e,t=!0){let n=++f;try{let r=await h(e),i=await g(r);if(n!==f)return;[a,u,d]=[i,r.path,void 0],o=Math.max(0,a.length-2),t&&m(u)}catch(e){n===f&&(d=e.message)}p()}async function v(e,t){let n=S(a[e].path,t,l),r=++f;[a,o,u,d]=[[...a.slice(0,e+1).map((n,r)=>r===e?{...n,pick:t}:n)],e,n,void 0],p();try{let e=await h(n);if(r!==f)return;if(e.path!==n)return void await _(e.path);a=[...a,{path:e.path,dirs:e.dirs,truncated:e.truncated}],m(n)}catch(e){r===f&&(d=e.message)}p()}let y=e=>e>=0&&e<r.length?(s=e,_(r[s],!1)):Promise.resolve();return{state:()=>({path:u,home:c,sep:l,cols:a,focus:o,error:d,back:s>0,forward:s<r.length-1,crumbs:a.map((e,t)=>({path:e.path,name:t===0?``:x(e.path)}))}),on:e=>void i.push(e),start:e=>_(e),go:e=>_(e),pick:v,back:()=>y(s-1),forward:()=>y(s+1),async make(e){if(u!==void 0)try{let r=await t(u,e);n.delete(u),await _(r)}catch(e){d=e.message,p()}},async key(e){let t=a[o];if(!t)return!1;if(e===`Enter`)return u!==void 0&&`chosen`;if(e===`ArrowLeft`){if(o===0)return!0;let e=o-1;return[a,o,u]=[a.slice(0,o+1).map((e,t)=>t===o?{path:e.path,dirs:e.dirs,truncated:e.truncated}:e),e,a[o].path],m(u),p(),!0}if(e===`ArrowRight`){let e=a[o+1];return e?.dirs.length&&(o++,e.pick===void 0?await v(o,e.dirs[0]):p()),!0}if(!t.dirs.length)return!0;let n=t.pick===void 0?-1:t.dirs.indexOf(t.pick);return await v(o,t.dirs[Math.min(t.dirs.length-1,Math.max(0,e===`ArrowDown`?n+1:n<0?t.dirs.length-1:n-1))]),!0}}}var w=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Enter`]),T=()=>(e=>typeof e==`function`?e:void 0)(globalThis.strawBossDesk?.pickFolder),E=e=>Error(e.body.reason??n({status:e.status}));function D(e,n,x){let S=C({list:async n=>{let r=await i(`dirs`,n?{path:n}:e).catch(()=>Promise.reject(Error(t())));return r.ok?r.body:Promise.reject(E(r))},make:async(e,n)=>{let r=await i(`dirs/new`,{path:e,name:n}).catch(()=>Promise.reject(Error(t())));return r.ok?r.body.path:Promise.reject(E(r))}}),D=r(`button`,{type:`button`,class:`later`,"aria-label":u(),title:u()},`←`),O=r(`button`,{type:`button`,class:`later`,"aria-label":h(),title:h()},`→`),k=T(),A=k&&r(`button`,{type:`button`,class:`later`},d()),j=r(`nav`,{class:`picker-crumbs`,"aria-label":v()}),M=r(`button`,{type:`button`,class:`later`},`+ ${c()}`),N=r(`input`,{type:`text`,maxlength:`255`,placeholder:l(),"aria-label":l()}),P=r(`div`,{class:`picker-places`,role:`group`,"aria-label":y()}),F=r(`div`,{class:`picker-cols`,tabindex:`0`,role:`group`,"aria-label":_()}),I=r(`code`,{class:`spawn-path`}),L=r(`p`,{class:`chat-empty`,role:`status`});N.hidden=!0;let R;S.on(()=>{let e=S.state();[D.disabled,O.disabled]=[!e.back,!e.forward],j.replaceChildren(...e.crumbs.map((t,n)=>{let i=r(`button`,{type:`button`,"aria-current":String(n===e.crumbs.length-1)},t.name||g());return[i.title,i.onclick]=[t.name||t.path,()=>void S.go(t.path)],i})),F.replaceChildren(...e.cols.map((t,n)=>{let i=t.dirs.map(e=>{let i=r(`button`,{type:`button`,class:`pitem`,role:`option`,tabindex:`-1`,"aria-selected":String(t.pick===e),title:e},e);return i.onclick=()=>(F.focus(),void S.pick(n,e)),i}),s=r(`div`,{class:`pcol`,role:`listbox`,"data-focus":String(n===e.focus)},...i,!t.dirs.length&&r(`p`,{class:`pempty`},o()),t.truncated&&r(`p`,{class:`pempty`},a())),c=i.find(e=>e.getAttribute(`aria-selected`)===`true`);return c&&requestAnimationFrame(()=>s.scrollTop=Math.max(0,c.offsetTop-s.clientHeight/2)),s})),requestAnimationFrame(()=>{let e=Math.max(1,Math.floor(F.clientWidth/176)),t=F.clientWidth/e,n=F.children.length;F.style.setProperty(`--pw`,`${t}px`),[F.scrollLeft,j.scrollLeft]=[Math.max(0,n-e)*t,j.scrollWidth]}),I.textContent=I.title=e.path??``,L.textContent=e.error??``,e.path!==void 0&&e.path!==R&&n(R=e.path,e.home)}),D.onclick=()=>void S.back(),O.onclick=()=>void S.forward();let z=()=>{if(N.hidden)return void(N.hidden=!1,N.focus());S.make(N.value).then(()=>{S.state().error||(N.value=``,N.hidden=!0,F.focus())})};return M.onclick=z,A&&(A.onclick=()=>void k({defaultPath:S.state().path,title:f()}).then(e=>e?S.go(e):void 0,e=>void(L.textContent=e.message))),N.addEventListener(`keydown`,e=>e.key===`Enter`&&(e.preventDefault(),z())),N.addEventListener(`keydown`,e=>e.key===`Escape`&&N.value===``&&!N.hidden&&(e.stopPropagation(),N.hidden=!0,F.focus())),F.addEventListener(`keydown`,e=>{!w.has(e.key)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.preventDefault(),S.key(e.key).then(e=>e===`chosen`&&x()))}),i(`dirs/places`,{}).then(e=>{if(!e.ok)return;let t=e.body,n=(e,t)=>{let n=r(`button`,{type:`button`,title:t},e);return n.onclick=()=>void S.go(t),n},i=e=>t.places.find(t=>t.name===e);P.replaceChildren(n(g(),t.home),...[`Desktop`,`Documents`].flatMap(e=>(t=>t?[n(e===`Desktop`?p():m(),t.path)]:[])(i(e))),...t.recent.length?[r(`b`,null,b()),...t.recent.map(e=>n(e.slice(Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1),e))]:[])},()=>{}),S.start(),{picker:S,el:r(`div`,{class:`picker`},r(`div`,{class:`picker-bar`},D,O,j,M,A),N,r(`div`,{class:`picker-body`},P,F),r(`p`,{class:`spawn-at`},s(),` `,I),L)}}export{x as n,D as t};
1
+ import{t as e}from"./runtime-ZX6HkxDa.js";import{Ft as t,Nt as n,_t as r,q as i}from"./index-Dvw58cHb.js";var a=((t={},n={})=>(n.locale??e())===`zh-TW`?`只顯示前 500 個資料夾。`:`Showing the first 500 folders.`),o=((t={},n={})=>(n.locale??e())===`zh-TW`?`這裡沒有資料夾。`:`No folders here.`),s=((t={},n={})=>(n.locale??e())===`zh-TW`?`資料夾:`:`Folder:`),c=((t={},n={})=>(n.locale??e())===`zh-TW`?`新資料夾`:`New folder`),l=((t={},n={})=>(n.locale??e())===`zh-TW`?`新資料夾的名稱`:`Name of the new folder`),u=((t={},n={})=>(n.locale??e())===`zh-TW`?`上一步`:`Back`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇…`:`Choose…`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇資料夾`:`Choose a folder`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`桌面`:`Desktop`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`文件`:`Documents`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`下一步`:`Forward`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`家目錄`:`Home`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`資料夾`:`Folders`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`路徑`:`Path`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`位置`:`Places`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`最近`:`Recent`),x=(e,t)=>e===t?``:e.slice(Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1),S=(e,t,n)=>(e.endsWith(n)?e:e+n)+t;function C({list:e,make:t}){let n=new Map,r=[],i=[],a=[],o=0,s=-1,c=``,l=`/`,u,d,f=0,p=()=>i.forEach(e=>e()),m=e=>{r[s]!==e&&(r.splice(s+1,r.length,e),s=r.length-1)},h=async t=>{let r=t===void 0?void 0:n.get(t);if(r)return r;let i=await e(t);return n.set(i.path,i),t!==void 0&&n.set(t,i),[c,l]=[i.home,i.sep],i},g=async e=>{let t=e.path===e.home||!e.path.startsWith(e.home)?[]:e.path.slice(e.home.length).split(e.sep).filter(Boolean),n=t.reduce((t,n)=>[...t,S(t.at(-1),n,e.sep)],[e.home]);return(await Promise.all(n.map(t=>t===e.path?e:h(t)))).map((e,n)=>({path:e.path,dirs:e.dirs,truncated:e.truncated,...t[n]!==void 0&&{pick:t[n]}}))};async function _(e,t=!0){let n=++f;try{let r=await h(e),i=await g(r);if(n!==f)return;[a,u,d]=[i,r.path,void 0],o=Math.max(0,a.length-2),t&&m(u)}catch(e){n===f&&(d=e.message)}p()}async function v(e,t){let n=S(a[e].path,t,l),r=++f;[a,o,u,d]=[[...a.slice(0,e+1).map((n,r)=>r===e?{...n,pick:t}:n)],e,n,void 0],p();try{let e=await h(n);if(r!==f)return;if(e.path!==n)return void await _(e.path);a=[...a,{path:e.path,dirs:e.dirs,truncated:e.truncated}],m(n)}catch(e){r===f&&(d=e.message)}p()}let y=e=>e>=0&&e<r.length?(s=e,_(r[s],!1)):Promise.resolve();return{state:()=>({path:u,home:c,sep:l,cols:a,focus:o,error:d,back:s>0,forward:s<r.length-1,crumbs:a.map((e,t)=>({path:e.path,name:t===0?``:x(e.path)}))}),on:e=>void i.push(e),start:e=>_(e),go:e=>_(e),pick:v,back:()=>y(s-1),forward:()=>y(s+1),async make(e){if(u!==void 0)try{let r=await t(u,e);n.delete(u),await _(r)}catch(e){d=e.message,p()}},async key(e){let t=a[o];if(!t)return!1;if(e===`Enter`)return u!==void 0&&`chosen`;if(e===`ArrowLeft`){if(o===0)return!0;let e=o-1;return[a,o,u]=[a.slice(0,o+1).map((e,t)=>t===o?{path:e.path,dirs:e.dirs,truncated:e.truncated}:e),e,a[o].path],m(u),p(),!0}if(e===`ArrowRight`){let e=a[o+1];return e?.dirs.length&&(o++,e.pick===void 0?await v(o,e.dirs[0]):p()),!0}if(!t.dirs.length)return!0;let n=t.pick===void 0?-1:t.dirs.indexOf(t.pick);return await v(o,t.dirs[Math.min(t.dirs.length-1,Math.max(0,e===`ArrowDown`?n+1:n<0?t.dirs.length-1:n-1))]),!0}}}var w=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Enter`]),T=()=>(e=>typeof e==`function`?e:void 0)(globalThis.strawBossDesk?.pickFolder),E=e=>Error(e.body.reason??n({status:e.status}));function D(e,n,x){let S=C({list:async n=>{let r=await i(`dirs`,n?{path:n}:e).catch(()=>Promise.reject(Error(t())));return r.ok?r.body:Promise.reject(E(r))},make:async(e,n)=>{let r=await i(`dirs/new`,{path:e,name:n}).catch(()=>Promise.reject(Error(t())));return r.ok?r.body.path:Promise.reject(E(r))}}),D=r(`button`,{type:`button`,class:`later`,"aria-label":u(),title:u()},`←`),O=r(`button`,{type:`button`,class:`later`,"aria-label":h(),title:h()},`→`),k=T(),A=k&&r(`button`,{type:`button`,class:`later`},d()),j=r(`nav`,{class:`picker-crumbs`,"aria-label":v()}),M=r(`button`,{type:`button`,class:`later`},`+ ${c()}`),N=r(`input`,{type:`text`,maxlength:`255`,placeholder:l(),"aria-label":l()}),P=r(`div`,{class:`picker-places`,role:`group`,"aria-label":y()}),F=r(`div`,{class:`picker-cols`,tabindex:`0`,role:`group`,"aria-label":_()}),I=r(`code`,{class:`spawn-path`}),L=r(`p`,{class:`chat-empty`,role:`status`});N.hidden=!0;let R;S.on(()=>{let e=S.state();[D.disabled,O.disabled]=[!e.back,!e.forward],j.replaceChildren(...e.crumbs.map((t,n)=>{let i=r(`button`,{type:`button`,"aria-current":String(n===e.crumbs.length-1)},t.name||g());return[i.title,i.onclick]=[t.name||t.path,()=>void S.go(t.path)],i})),F.replaceChildren(...e.cols.map((t,n)=>{let i=t.dirs.map(e=>{let i=r(`button`,{type:`button`,class:`pitem`,role:`option`,tabindex:`-1`,"aria-selected":String(t.pick===e),title:e},e);return i.onclick=()=>(F.focus(),void S.pick(n,e)),i}),s=r(`div`,{class:`pcol`,role:`listbox`,"data-focus":String(n===e.focus)},...i,!t.dirs.length&&r(`p`,{class:`pempty`},o()),t.truncated&&r(`p`,{class:`pempty`},a())),c=i.find(e=>e.getAttribute(`aria-selected`)===`true`);return c&&requestAnimationFrame(()=>s.scrollTop=Math.max(0,c.offsetTop-s.clientHeight/2)),s})),requestAnimationFrame(()=>{let e=Math.max(1,Math.floor(F.clientWidth/176)),t=F.clientWidth/e,n=F.children.length;F.style.setProperty(`--pw`,`${t}px`),[F.scrollLeft,j.scrollLeft]=[Math.max(0,n-e)*t,j.scrollWidth]}),I.textContent=I.title=e.path??``,L.textContent=e.error??``,e.path!==void 0&&e.path!==R&&n(R=e.path,e.home)}),D.onclick=()=>void S.back(),O.onclick=()=>void S.forward();let z=()=>{if(N.hidden)return void(N.hidden=!1,N.focus());S.make(N.value).then(()=>{S.state().error||(N.value=``,N.hidden=!0,F.focus())})};return M.onclick=z,A&&(A.onclick=()=>void k({defaultPath:S.state().path,title:f()}).then(e=>e?S.go(e):void 0,e=>void(L.textContent=e.message))),N.addEventListener(`keydown`,e=>e.key===`Enter`&&(e.preventDefault(),z())),N.addEventListener(`keydown`,e=>e.key===`Escape`&&N.value===``&&!N.hidden&&(e.stopPropagation(),N.hidden=!0,F.focus())),F.addEventListener(`keydown`,e=>{!w.has(e.key)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.preventDefault(),S.key(e.key).then(e=>e===`chosen`&&x()))}),i(`dirs/places`,{}).then(e=>{if(!e.ok)return;let t=e.body,n=(e,t)=>{let n=r(`button`,{type:`button`,title:t},e);return n.onclick=()=>void S.go(t),n},i=e=>t.places.find(t=>t.name===e);P.replaceChildren(n(g(),t.home),...[`Desktop`,`Documents`].flatMap(e=>(t=>t?[n(e===`Desktop`?p():m(),t.path)]:[])(i(e))),...t.recent.length?[r(`b`,null,b()),...t.recent.map(e=>n(e.slice(Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1),e))]:[])},()=>{}),S.start(),{picker:S,el:r(`div`,{class:`picker`},r(`div`,{class:`picker-bar`},D,O,j,M,A),N,r(`div`,{class:`picker-body`},P,F),r(`p`,{class:`spawn-at`},s(),` `,I),L)}}export{x as n,D as t};
@@ -1,2 +1,2 @@
1
- import{t as e}from"./runtime-ZX6HkxDa.js";import{Ft as t,Nt as n,_t as r,q as i}from"./index-LCc1BzpW.js";var a=((t={},n={})=>(n.locale??e())===`zh-TW`?`取消`:`Cancel`),o=((t={},n={})=>(n.locale??e())===`zh-TW`?`最近的錯誤`:`Last error`),s=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示記錄`:`Show log`),c=((t={},n={})=>(n.locale??e())===`zh-TW`?`記錄是空的。`:`The log is empty.`),l=((t={},n={})=>(n.locale??e())===`zh-TW`?`原因(選填)`:`Reason (optional)`),u=((t={},n={})=>(n.locale??e())===`zh-TW`?`重新啟動伺服器`:`Restart server`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`要重新啟動 sb 伺服器嗎?這個網址會保留,頁面會自行重新連線。執行中的工作與對話框不受影響。`:`Restart the sb server? This page keeps its address and reconnects by itself. Runs and dialogs carry on.`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`立即重新啟動`:`Restart now`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`重新啟動中。伺服器回來後頁面會自行重新連線;若沒有(連接埠被占用時網址會改變),請用 /boss gui 開啟。`:`Restarting. This page reconnects when the server is back; if it does not, open /boss gui (the address changes when a port was taken).`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在重新啟動伺服器…`:`Restarting the server…`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`狀態`:`State`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`伺服器`:`Server`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`已執行`:`Up for`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`版本`:`Version`),y=e=>e>=36e5?`${Math.floor(e/36e5)} h ${Math.floor(e%36e5/6e4)} min`:e>=6e4?`${Math.floor(e/6e4)} min`:`${Math.floor(e/1e3)} s`;function b(){return{id:`server`,title:g(),body:()=>{let e=r(`dl`,{class:`server-facts`}),g=r(`p`,{class:`chat-empty`,role:`status`}),b=r(`pre`,{class:`link-args`}),x=r(`input`,{type:`text`,maxlength:`200`,placeholder:l(),"aria-label":l()}),S=r(`button`,{type:`button`,class:`pair-btn`},u()),C=r(`button`,{type:`button`,class:`later`},s());b.hidden=!0;let w=(e,t)=>[r(`dt`,null,e),r(`dd`,null,t)];async function T(){let n=await i(`server/status`,{}).catch(()=>void 0);if(!n?.ok)return e.replaceChildren(),g.replaceChildren(n?.body.reason??t()),!1;let r=n.body;return e.replaceChildren(...w(h(),r.state??`?`),...w(v(),r.version??`?`),...typeof r.uptimeMs==`number`?w(_(),y(r.uptimeMs)):[],...r.lastError?w(o(),`${r.lastError.code}: ${r.lastError.text}`):[]),!0}let E=r(`button`,{type:`button`,class:`later`},a());E.hidden=!0;let D=!1;return E.onclick=()=>(D=!1,S.textContent=u(),E.hidden=!0,g.replaceChildren()),S.onclick=()=>{if(!D)return D=!0,S.textContent=f(),E.hidden=!1,g.replaceChildren(d());D=!1,E.hidden=!0,S.textContent=u(),S.disabled=!0,g.replaceChildren(m()),i(`server/restart`,x.value.trim()?{reason:x.value.trim()}:{}).then(async e=>{if(!e.ok)return void g.replaceChildren(e.body.reason??n({status:e.status}));g.replaceChildren(p())},()=>g.replaceChildren(t())).finally(()=>S.disabled=!1)},C.onclick=()=>void i(`server/log`,{lines:200}).then(e=>{b.hidden=!1,b.textContent=e.ok?e.body.lines.join(`
1
+ import{t as e}from"./runtime-ZX6HkxDa.js";import{Ft as t,Nt as n,_t as r,q as i}from"./index-Dvw58cHb.js";var a=((t={},n={})=>(n.locale??e())===`zh-TW`?`取消`:`Cancel`),o=((t={},n={})=>(n.locale??e())===`zh-TW`?`最近的錯誤`:`Last error`),s=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示記錄`:`Show log`),c=((t={},n={})=>(n.locale??e())===`zh-TW`?`記錄是空的。`:`The log is empty.`),l=((t={},n={})=>(n.locale??e())===`zh-TW`?`原因(選填)`:`Reason (optional)`),u=((t={},n={})=>(n.locale??e())===`zh-TW`?`重新啟動伺服器`:`Restart server`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`要重新啟動 sb 伺服器嗎?這個網址會保留,頁面會自行重新連線。執行中的工作與對話框不受影響。`:`Restart the sb server? This page keeps its address and reconnects by itself. Runs and dialogs carry on.`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`立即重新啟動`:`Restart now`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`重新啟動中。伺服器回來後頁面會自行重新連線;若沒有(連接埠被占用時網址會改變),請用 /boss gui 開啟。`:`Restarting. This page reconnects when the server is back; if it does not, open /boss gui (the address changes when a port was taken).`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在重新啟動伺服器…`:`Restarting the server…`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`狀態`:`State`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`伺服器`:`Server`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`已執行`:`Up for`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`版本`:`Version`),y=e=>e>=36e5?`${Math.floor(e/36e5)} h ${Math.floor(e%36e5/6e4)} min`:e>=6e4?`${Math.floor(e/6e4)} min`:`${Math.floor(e/1e3)} s`;function b(){return{id:`server`,title:g(),body:()=>{let e=r(`dl`,{class:`server-facts`}),g=r(`p`,{class:`chat-empty`,role:`status`}),b=r(`pre`,{class:`link-args`}),x=r(`input`,{type:`text`,maxlength:`200`,placeholder:l(),"aria-label":l()}),S=r(`button`,{type:`button`,class:`pair-btn`},u()),C=r(`button`,{type:`button`,class:`later`},s());b.hidden=!0;let w=(e,t)=>[r(`dt`,null,e),r(`dd`,null,t)];async function T(){let n=await i(`server/status`,{}).catch(()=>void 0);if(!n?.ok)return e.replaceChildren(),g.replaceChildren(n?.body.reason??t()),!1;let r=n.body;return e.replaceChildren(...w(h(),r.state??`?`),...w(v(),r.version??`?`),...typeof r.uptimeMs==`number`?w(_(),y(r.uptimeMs)):[],...r.lastError?w(o(),`${r.lastError.code}: ${r.lastError.text}`):[]),!0}let E=r(`button`,{type:`button`,class:`later`},a());E.hidden=!0;let D=!1;return E.onclick=()=>(D=!1,S.textContent=u(),E.hidden=!0,g.replaceChildren()),S.onclick=()=>{if(!D)return D=!0,S.textContent=f(),E.hidden=!1,g.replaceChildren(d());D=!1,E.hidden=!0,S.textContent=u(),S.disabled=!0,g.replaceChildren(m()),i(`server/restart`,x.value.trim()?{reason:x.value.trim()}:{}).then(async e=>{if(!e.ok)return void g.replaceChildren(e.body.reason??n({status:e.status}));g.replaceChildren(p())},()=>g.replaceChildren(t())).finally(()=>S.disabled=!1)},C.onclick=()=>void i(`server/log`,{lines:200}).then(e=>{b.hidden=!1,b.textContent=e.ok?e.body.lines.join(`
2
2
  `)||c():e.body.reason??n({status:e.status})},()=>(b.hidden=!1,b.textContent=t())),T(),r(`div`,{class:`server`},e,r(`div`,{class:`devices-acts`},x,S,E,C),g,b)}}}export{b as serverTile};
@@ -1 +1 @@
1
- import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sending-aEpvzoz2.js";import{t as n}from"./sentencepack-DtYqpppS.js";import{c as r,d as i,o as a,u as o}from"./towerturns-Cd9alhqa.js";import{Ft as s,J as c,Nt as l,Q as ee,_t as u,rn as te,x as d}from"./index-LCc1BzpW.js";var ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`附加檔案`:`Attach files`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 已經結束`:`This session has ended`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個隊友 run 由隊友的訊息驅動。你可以在這裡看它的通訊,但不能寫給它。`:`A teammate's message drives this ally run. You can read its comms here; you cannot write to it.`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在上方或終端機回答。`:`Answer above or in pi`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框;請在它的終端機中回答。`:`It waits on a dialog; answer it in its terminal.`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 已不再即時;紀錄仍可閱讀。`:`This session is no longer live; its history stays readable.`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個單位沒有即時的 pi 窗格,無處可輸入。`:`No live pi pane backs this unit, so there is nothing to type into.`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`串流中斷;要等它恢復才能送出。`:`The stream is down; sending waits for it to come back.`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 run 是塔台為事件啟動的。你可以在這裡看它的通訊;要跟它說話,請寫給塔台。`:`The tower started this run for events. You can read its comms here; to talk to it, write to the tower.`),b=(e,t)=>n(`blocked_run`,y,e,t),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`現在連不上這台機器;連上之後才能傳送。`:`This machine cannot be reached right now; sending waits until it can.`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`指令`:`Commands`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對、遠端存取、Wi-Fi、伺服器、預設檢視、決定加入請求與回答其他工作階段的對話框要在這台電腦的頁面或終端機操作,配對裝置不能做。`:`Pairing, remote access, Wi-Fi, the server, the default view, deciding a join request, and answering another session’s dialog are managed on this computer’s own page or terminal, not from a paired device.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`再取一次`:`Fetch again`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`已經沒有排隊的訊息了:它們已送達,或在終端機的輸入框裡。`:`Nothing is queued any more: the messages were delivered, or they are in the terminal’s editor.`),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`排隊中的訊息已放進輸入框,改完再送出。`:`The queued messages are in the box. Edit them and send.`),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在取回排隊中的訊息…`:`Taking the queued messages back…`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`未確認。若訊息已被取回,請再取一次;否則它們仍在終端機裡。`:`Not confirmed. If the messages were taken back, fetch them again; otherwise they are still in the terminal.`),C=e=>`${e?.command} ends this session or switches its pane to another one.`,w=e=>`${e?.command} 會結束這個 session,或把它的窗格切換到別的 session。`,le=((t,n={})=>(n.locale??e())===`zh-TW`?w(t):C(t)),T=e=>`${e?.name} is larger than 20 MB.`,E=e=>`${e?.name} 超過 20 MB。`,ue=((t,n={})=>(n.locale??e())===`zh-TW`?E(t):T(t)),de=((t={},n={})=>(n.locale??e())===`zh-TW`?`做完再送`:`After this`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`接續與主塔台的對話`:`Continue the conversation with the head tower`),O=(e,t)=>n(`head_continues`,D,e,t),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`叫醒主塔台`:`Wakes the head tower`),A=(e,t)=>n(`head_wakes`,k,e,t),j=e=>`From your message: ${e?.text}`,M=e=>`引自你的訊息:${e?.text}`,N=((t,n={})=>(n.locale??e())===`zh-TW`?M(t):j(t)),fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`訊息`:`Message`),P=e=>`Message ${e?.name}`,F=e=>`傳訊息給 ${e?.name}`,I=((t,n={})=>(n.locale??e())===`zh-TW`?F(t):P(t)),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`隊友的 run 正在回應・送出訊息會另外喚醒塔台跑你自己的 run`:`An ally run is answering a teammate · a message wakes a run of your own`),R=(e,t)=>n(`placeholder_ally`,L,e,t),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`接續與塔台的老闆對話`:`Continues the boss conversation`),B=(e,t)=>n(`placeholder_conversation`,z,e,t),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`送給正在跑的事件 run・它會在這裡回答`:`Goes to the running event run · it answers here`),H=((t={},n={})=>(n.locale??e())===`zh-TW`?`反覆當機後暫停中・送出訊息就會喚醒`:`Held after repeated crashes · a message wakes it`),U=((t={},n={})=>(n.locale??e())===`zh-TW`?`喚醒塔台`:`Wakes the tower`),W=(e,t)=>n(`placeholder_wake`,U,e,t),G=e=>`Send ${e?.command}`,pe=e=>`送出 ${e?.command}`,me=((t,n={})=>(n.locale??e())===`zh-TW`?pe(t):G(t)),he=((t={},n={})=>(n.locale??e())===`zh-TW`?`已照原文送出;你的修改留在這裡,尚未送出。`:`Sent as it was; your edits stayed here, unsent.`),ge=((t={},n={})=>(n.locale??e())===`zh-TW`?`停止`:`Stop`),_e=((t={},n={})=>(n.locale??e())===`zh-TW`?`要停止目前的任務嗎?佇列中的訊息會退回它的終端機編輯器。`:`Stop the current task? Queued messages go back to its terminal editor.`),ve=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框:請在終端機中回答。`:`It is waiting on a dialog: answer it in the terminal.`),ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 上還有另一個輸入在途中。`:`Another input to this session is still on its way.`),be=((t={},n={})=>(n.locale??e())===`zh-TW`?`終端機的輸入框裡除了排隊中的訊息與草稿,還有其他內容(期間有人輸入,或 pi 展開了訊息)。訊息在輸入框裡,請查看終端機。`:`The terminal’s editor holds something other than the queued messages and the draft (typed meanwhile, or a message pi expanded). The messages are in it; check the terminal.`),xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待連結請求時,配對裝置只能送出 Escape。請在這台電腦的頁面或終端機核准。`:`While it waits on a link request, a paired device can only send Escape. Approve it on this computer’s own page or terminal.`),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 沒有輸入框,無法把訊息取回。`:`This session has no editor to take the messages back into.`),Ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`pi 的取回按鍵(keybindings.json 裡的 app.message.dequeue)不是這個頁面能送出的按鍵。請在終端機裡按。`:`pi’s dequeue key (app.message.dequeue in its keybindings.json) is not one this page can send. Press it in the terminal.`),we=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法清掉終端機輸入框裡的訊息。它們在那裡,不在這裡。`:`The messages could not be cleared from the terminal’s editor. They are there, not here.`),Te=e=>`pi did not take its queue back; its dequeue key may not be ${e?.key}. Check the terminal.`,Ee=e=>`pi 沒有取回它的佇列;它的取回按鍵可能不是 ${e?.key}。請查看終端機。`,De=((t,n={})=>(n.locale??e())===`zh-TW`?Ee(t):Te(t)),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`一次按太多鍵了。請一秒後再試。`:`Too many keys at once. Try again in a second.`),ke=((t={},n={})=>(n.locale??e())===`zh-TW`?`取回逾時,或按鍵送出後 session 已有變動:訊息在終端機的輸入框裡,不在這裡。`:`The take-back timed out, or the session changed, after the key went: the messages are in the terminal’s editor, not here.`),Ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`排隊中的訊息太長,帶不回這裡。它們在終端機的輸入框裡。`:`The queued messages are too long to bring here. They are in the terminal’s editor.`),K=((t={},n={})=>(n.locale??e())===`zh-TW`?`未確認。再次送出前請先查看終端機。`:`Not confirmed. Check the terminal before sending again.`),je=((t={},n={})=>(n.locale??e())===`zh-TW`?`上傳中…`:`Uploading…`),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`原文已送到 session;這裡是你編輯過、尚未送出的副本。`:`The original already went to the session; what is here is your edited copy, unsent.`),Ne=e=>/^\/(\S{0,64})$/.exec(e)?.[1],Pe=(e,t,n)=>(e+n+t)%t;function Fe(e,t){let n=u(`ul`,{class:`slash`,id:`slash`,role:`listbox`,"aria-label":S()}),r=[],i=0,a;e.setAttribute(`aria-controls`,`slash`);let o=()=>!n.hidden&&r.length>0,s=()=>(r=[],n.hidden=!0,e.removeAttribute(`aria-activedescendant`)),c=()=>{n.replaceChildren(...r.map((e,t)=>{let n=u(`li`,{id:`slash-${t}`,role:`option`,"aria-selected":String(t===i)},u(`b`,null,`/${e.name}`),e.description&&u(`span`,null,e.description));return n.onmousedown=e=>e.preventDefault(),n.onclick=()=>l(e),n})),n.hidden=!r.length,r.length&&(e.setAttribute(`aria-activedescendant`,`slash-${i}`),n.children[i]?.scrollIntoView({block:`nearest`}))},l=t=>{e.value=`/${t.name} `,s(),e.focus(),e.dispatchEvent(new Event(`input`))};return s(),e.addEventListener(`input`,()=>{let n=Ne(e.value),o=e.value;if(clearTimeout(a),n===void 0)return s();a=setTimeout(async()=>{let a=await t(n).catch(()=>void 0);if(e.value!==o)return;let s=a?.ok&&Array.isArray(a.body.commands)?a.body.commands:[];[r,i]=[s,0],c()},120)}),e.addEventListener(`blur`,s),e.addEventListener(`keydown`,e=>{if(!o()||e.isComposing||e.keyCode===229)return;let t=e.key;if(t===`ArrowDown`||t===`ArrowUp`)i=Pe(i,r.length,t===`ArrowDown`?1:-1),c();else if(t===`Enter`&&!e.shiftKey||t===`Tab`)l(r[i]);else if(t===`Escape`)s();else return;e.preventDefault(),e.stopImmediatePropagation()}),n}var Ie=16384,Le=/^\s*\/(quit|exit|new|resume|fork|clone|import|reload)(?=\s|$)/,Re=(e,t)=>t.wakes?void 0:e.match(Le)?.[0].trim(),q=new Map;function ze(e,t,n,i){if(!e.ok)return[`error`,e.status===504?K({},i?{locale:i}:void 0):r(e,i)??e.body.reason??l({status:e.status},i?{locale:i}:void 0)];if(t&&!t.startsWith(n))return[`ok`,Me()]}var Be=e=>{try{return e?.startsWith(`[`)?JSON.parse(e):e?[`error`,e]:void 0}catch{return[`error`,e]}},Ve=(e,t)=>e!==``&&!e.startsWith(t)?he():``,He=(e,t)=>e.startsWith(t)?e.slice(t.length).replace(/^\n/,``):e,J=(e,t)=>t.trim()?`${e}\n\n${t}`:e,Y=new Map,Ue=54e4,X=new Map,Z=new Map,Q=e=>`sb-draft:${e}:take`;function We(e,t=Date.now()){let n=X.get(e);if(!n)try{let[t,r]=(sessionStorage.getItem(Q(e))??``).split(`:`);r&&Number(t)>0&&X.set(e,n={id:r,at:Number(t)})}catch{}return n&&t-n.at>=Ue&&(Ke(e),n=void 0),n?.id}function Ge(e,t=Date.now()){let n=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``);X.set(e,{id:n,at:t});try{sessionStorage.setItem(Q(e),`${t}:${n}`)}catch{}return n}function Ke(e){X.delete(e);try{sessionStorage.removeItem(Q(e))}catch{}}function qe(e,t){let n=`sb-draft:${e}`;try{sessionStorage.setItem(n,J(t,sessionStorage.getItem(n)??``)),sessionStorage.setItem(`${n}:note`,JSON.stringify([`ok`,oe()]))}catch{Z.set(e,J(t,Z.get(e)??``))}}function Je(e,t){let n=Z.get(e);return Z.delete(e),n===void 0?t:J(n,t)}var Ye=[`no_editor`,`stale`,`not_taken`,`changed`,`too_large`,`not_cleared`,`no_key`];function Xe(e,t){let n=t?{locale:t}:void 0,r=typeof e.body.label==`string`?e.body.label:`?`;return e.status>=400&&e.status!==504?{no_key:()=>Ce({},n),no_editor:()=>Se({},n),stale:()=>ke({},n),not_taken:()=>De({key:r},n),changed:()=>be({},n),too_large:()=>Ae({},n),not_cleared:()=>we({},n),blocked:()=>ve({},n),local_only:()=>xe({},n),rate:()=>Oe({},n),busy:()=>ye({},n)}[e.body.error??``]?.():void 0}function Ze(e,t,n){t.ok&&typeof t.body.text==`string`&&(n?(n.box.value=J(t.body.text,n.box.value),n.save()):qe(e,t.body.text)),(t.ok||t.status===400||t.status===409&&Ye.includes(t.body.error??``))&&Ke(e)}var Qe=e=>e.live&&!e.ally;function $(e){if(!e.online)return e.away?x():v();if(!e.live)return g();if(!e.control)return e.run?b():e.ally?p():_();if(e.mark===`waiting`)return e.answerable?m():h()}function $e(e){if(e.online){if(!e.live)return f();if(!e.control&&(e.run||e.ally))return e.run?b():p()}}var et=e=>e.wakes?e.held?H():e.allyLive?R():e.eventRun?V():e.head?e.conversation?O():A():e.conversation?B():W():I({name:e.name}),tt=e=>({eventRun:!(!e?.bossIn||e.conversation),wakes:!!e,held:e?.state===`held`,conversation:!(!e?.conversation||e.conversation.closing),allyLive:!(!e?.allyRuns.length||e.run)});function nt(e,n,r,ee=e=>c(`sessions/${encodeURIComponent(n)}/upload`,e)){let d=`sb-draft:${n}`,f=matchMedia(`(pointer: coarse)`).matches,p=u(`textarea`,{rows:`1`,maxlength:String(Ie),"aria-label":fe(),enterkeyhint:f?`enter`:`send`}),m=u(`button`,{type:`submit`,class:`cmp-send`},i()),h=u(`button`,{type:`button`,class:`cmp-alt`},de()),g=u(`button`,{type:`button`,class:`cmp-alt cmp-stop`},ge()),_=u(`input`,{type:`file`,multiple:``,hidden:``}),v=u(`button`,{type:`button`,class:`cmp-alt`,"aria-label":ne()},`+`),y=u(`p`,{class:`cmp-note`,role:`status`,"aria-live":`polite`}),b=Fe(p,e=>r(`commands`,{prefix:e})),x=u(`p`,{class:`cmp-bar`,role:`status`}),S=u(`p`,{class:`cmp-activity`,role:`status`,"aria-live":`polite`});x.hidden=!0;let C=u(`form`,{class:`composer`},b,u(`div`,{class:`cmp-row`},v,_,p,u(`div`,{class:`cmp-acts`},m,h,g)),u(`div`,{class:`cmp-foot`},y),x,S);e.replaceChildren(C);let w={name:``,control:!1,live:!1,mark:`unknown`,online:!1},T=!1,E=!1,D=e=>{try{e()}catch{}};D(()=>p.value=sessionStorage.getItem(d)??``),p.value=Je(n,p.value);let O=()=>D(()=>p.value?sessionStorage.setItem(d,p.value):sessionStorage.removeItem(d)),k=CSS.supports(`field-sizing`,`content`)?()=>{}:()=>(p.style.height=`auto`,p.style.height=`${Math.min(p.scrollHeight,220)}px`),A=(e,t=``,...n)=>(y.dataset.tone=t,y.replaceChildren(e,...n)),j=(e,t,n)=>{let r=u(`button`,{type:`button`,class:`cmp-yes`},t),i=u(`button`,{type:`button`,class:`cmp-link`},te());E=!0,r.onclick=()=>(E=!1,n()),i.onclick=()=>(E=!1,A(``),p.focus()),A(e,`ask`,r,i),r.focus()},[M,N]=[`${d}:note`,()=>{try{return sessionStorage.getItem(d)??``}catch{return}}],P=e=>D(()=>e?sessionStorage.setItem(M,JSON.stringify(e)):sessionStorage.removeItem(M));function F(e,t,i){let a={sent:i,answer:r(e,t)};return i!==void 0&&(P([`error`,K()]),q.set(n,a),a.answer.then(e=>{let t=N();e.ok&&t!==void 0&&D(()=>sessionStorage.setItem(d,He(t,i))),P(ze(e,t,i))},()=>P([`error`,K()]))),I(a)}async function I(e,{sent:r}=e){T=!0,E=!1,R(),A(r===void 0?``:t());try{let t=await e.answer;if(!C.isConnected)return;if(!t.ok)return t.status===504||P(),A(a(t)??(t.status===403&&t.body.error===`local_only`?re():void 0)??t.body.reason??l({status:t.status}),`error`);if(r===void 0)return A(``);P();let n=Ve(p.value,r);p.value=He(p.value,r),O(),k(),A(n,`ok`)}catch{A(K(),`error`)}finally{q.get(n)===e&&q.delete(n),T=!1,R()}}function L(e,t){let n=p.value,r=$(w),i=t===n;if(T||E||!n.trim())return;if(r)return A(r,`error`);if(new TextEncoder().encode(n).length>16384)return A(o(),`error`);let a=!i&&Re(n,w);if(a)return j(le({command:a}),me({command:a}),()=>L(e,n));F(`input`,{text:n,as:e,confirmed:i},n)}function R(){let e=$e(w),t=[C.querySelector(`.cmp-row`),C.querySelector(`.cmp-foot`)];x.hidden=e===void 0,x.textContent=e??``,C.classList.toggle(`ended`,e!==void 0);for(let n of t)n.hidden=e!==void 0;b.hidden||=e!==void 0;let n=w.activity;for(let[e,t]of[[`activity`,n?.mark],[`kind`,n?.kind]])t===void 0?delete C.dataset[e]:C.dataset[e]=t;S.textContent!==(n?.text??``)&&(S.textContent=n?.text??``);let r=$(w),i=w.mark===`working`;p.placeholder=r??et(w),p.disabled=v.disabled=!Qe(w),m.disabled=T||!!r||!p.value.trim(),h.hidden=g.hidden=!i||!!r||!!w.wakes,[h.disabled,g.disabled]=[m.disabled,T]}let z=()=>{let e=u(`button`,{type:`button`,class:`cmp-yes`},ie());e.onclick=()=>void V(),A(ce(),`error`,e)};function B(){return r(`dequeue`,{take:We(n)??Ge(n)}).then(e=>(Ze(n,e,C.isConnected?{box:p,save:O}:void 0),e),()=>void 0)}async function V(){if(T||E||Y.has(n))return;let e=$(w);if(e)return A(e,`error`);let t=B();Y.set(n,t),await H(t)}async function H(e){T=!0,R(),A(se());try{let t=await e;if(!C.isConnected)return;if(!t||t.status===504)return z();if(!t.ok)return A(Xe(t)??t.body.reason??l({status:t.status}),`error`);if(typeof t.body.text!=`string`)return A(ae());let r=N();r!==void 0&&r!==p.value&&(p.value=r),p.value=Je(n,p.value),O(),P(),k(),p.focus(),p.selectionStart=p.selectionEnd=p.value.length,A(oe(),`ok`)}finally{Y.get(n)===e&&Y.delete(n),T=!1,R()}}async function U(e){if(!e.length||T)return;let t=$(w);if(t)return A(t,`error`);A(je(),``);for(let t of e){if(t.size>20971520)return A(ue({name:t.name}),`error`);let e=await ee(t).catch(()=>void 0);if(!e?.ok||typeof e.body.path!=`string`)return A(e?.body.reason??s(),`error`);let n=p.selectionStart??p.value.length,r=p.value.slice(0,n),i=p.value.slice(p.selectionEnd??n),a=`${r&&!/\s$/.test(r)?` `:``}${e.body.path}${/^\s/.test(i)?``:` `}`;p.value=r+a+i,p.selectionStart=p.selectionEnd=n+a.length}A(``),O(),k(),R(),p.focus()}v.onclick=()=>_.click(),_.onchange=()=>void U([..._.files??[]]).finally(()=>_.value=``),p.addEventListener(`paste`,e=>{let t=[...e.clipboardData?.files??[]];t.length&&(e.preventDefault(),U(t))}),C.addEventListener(`dragover`,e=>e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()),C.addEventListener(`drop`,e=>{let t=[...e.dataTransfer?.files??[]];t.length&&(e.preventDefault(),U(t))}),C.addEventListener(`submit`,e=>(e.preventDefault(),L(`send`))),h.onclick=()=>L(`followUp`),g.onclick=()=>j(_e(),ge(),()=>void(T||F(`keys`,{keys:[`esc`]}))),p.addEventListener(`input`,()=>(O(),k(),R())),C.addEventListener(`keydown`,e=>{e.key===`Escape`&&!e.isComposing&&(E||e.target===p&&p.value)&&(e.preventDefault(),E&&(E=!1,A(``),p.focus()))}),p.addEventListener(`keydown`,e=>{e.isComposing||e.keyCode===229||e.key!==`Enter`||e.shiftKey||f&&!e.altKey||(e.preventDefault(),L(e.altKey?`followUp`:`send`))});let W=window.visualViewport,G=()=>[[`--vvh`,W.height],[`--vvt`,W.offsetTop]].forEach(([e,t])=>document.documentElement.style.setProperty(e,`${t}px`));return W&&(W.addEventListener(`resize`,G),W.addEventListener(`scroll`,G),G()),k(),q.has(n)?I(q.get(n)):Y.has(n)?H(Y.get(n)):D(()=>{let e=Be(sessionStorage.getItem(M));sessionStorage.removeItem(M),e?A(e[1],e[0]):We(n)&&z()}),{box:p,update:e=>(w=e,R()),ready:()=>!$(w),takeQueue:V}}var rt=(e,{name:t,mk:n,state:r,online:i,away:a,role:o,head:s})=>({name:t,control:!!e?.control,live:!ee(e,r),mark:n,online:i,away:a,answerable:!!e?.pending?.answer,...tt(e?.service??(s?{state:`absent`,allyRuns:[]}:void 0)),head:!!s,activity:it(e,r,n),ally:!e&&(o===`ally`||o===`run`),run:!e&&o===`run`});function it(e,t,n){let r=d(e,t,n);if(!r)return;let i=e?.note??``;return{text:r,mark:n,kind:i.startsWith(`tool:`)?`tool`:i===`watching a monitor`?`monitoring`:`thinking`}}export{h as a,N as i,nt as n,K as r,rt as t};
1
+ import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sending-aEpvzoz2.js";import{t as n}from"./sentencepack-DtYqpppS.js";import{c as r,d as i,o as a,u as o}from"./towerturns-Cldgw4hX.js";import{Ft as s,J as c,Nt as l,Q as ee,_t as u,rn as te,x as d}from"./index-Dvw58cHb.js";var ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`附加檔案`:`Attach files`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 已經結束`:`This session has ended`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個隊友 run 由隊友的訊息驅動。你可以在這裡看它的通訊,但不能寫給它。`:`A teammate's message drives this ally run. You can read its comms here; you cannot write to it.`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在上方或終端機回答。`:`Answer above or in pi`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框;請在它的終端機中回答。`:`It waits on a dialog; answer it in its terminal.`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 已不再即時;紀錄仍可閱讀。`:`This session is no longer live; its history stays readable.`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個單位沒有即時的 pi 窗格,無處可輸入。`:`No live pi pane backs this unit, so there is nothing to type into.`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`串流中斷;要等它恢復才能送出。`:`The stream is down; sending waits for it to come back.`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 run 是塔台為事件啟動的。你可以在這裡看它的通訊;要跟它說話,請寫給塔台。`:`The tower started this run for events. You can read its comms here; to talk to it, write to the tower.`),b=(e,t)=>n(`blocked_run`,y,e,t),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`現在連不上這台機器;連上之後才能傳送。`:`This machine cannot be reached right now; sending waits until it can.`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`指令`:`Commands`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`配對、遠端存取、Wi-Fi、伺服器、預設檢視、決定加入請求與回答其他工作階段的對話框要在這台電腦的頁面或終端機操作,配對裝置不能做。`:`Pairing, remote access, Wi-Fi, the server, the default view, deciding a join request, and answering another session’s dialog are managed on this computer’s own page or terminal, not from a paired device.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`再取一次`:`Fetch again`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`已經沒有排隊的訊息了:它們已送達,或在終端機的輸入框裡。`:`Nothing is queued any more: the messages were delivered, or they are in the terminal’s editor.`),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`排隊中的訊息已放進輸入框,改完再送出。`:`The queued messages are in the box. Edit them and send.`),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`正在取回排隊中的訊息…`:`Taking the queued messages back…`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`未確認。若訊息已被取回,請再取一次;否則它們仍在終端機裡。`:`Not confirmed. If the messages were taken back, fetch them again; otherwise they are still in the terminal.`),C=e=>`${e?.command} ends this session or switches its pane to another one.`,w=e=>`${e?.command} 會結束這個 session,或把它的窗格切換到別的 session。`,le=((t,n={})=>(n.locale??e())===`zh-TW`?w(t):C(t)),T=e=>`${e?.name} is larger than 20 MB.`,E=e=>`${e?.name} 超過 20 MB。`,ue=((t,n={})=>(n.locale??e())===`zh-TW`?E(t):T(t)),de=((t={},n={})=>(n.locale??e())===`zh-TW`?`做完再送`:`After this`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`接續與主塔台的對話`:`Continue the conversation with the head tower`),O=(e,t)=>n(`head_continues`,D,e,t),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`叫醒主塔台`:`Wakes the head tower`),A=(e,t)=>n(`head_wakes`,k,e,t),j=e=>`From your message: ${e?.text}`,M=e=>`引自你的訊息:${e?.text}`,N=((t,n={})=>(n.locale??e())===`zh-TW`?M(t):j(t)),fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`訊息`:`Message`),P=e=>`Message ${e?.name}`,F=e=>`傳訊息給 ${e?.name}`,I=((t,n={})=>(n.locale??e())===`zh-TW`?F(t):P(t)),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`隊友的 run 正在回應・送出訊息會另外喚醒塔台跑你自己的 run`:`An ally run is answering a teammate · a message wakes a run of your own`),R=(e,t)=>n(`placeholder_ally`,L,e,t),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`接續與塔台的老闆對話`:`Continues the boss conversation`),B=(e,t)=>n(`placeholder_conversation`,z,e,t),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`送給正在跑的事件 run・它會在這裡回答`:`Goes to the running event run · it answers here`),H=((t={},n={})=>(n.locale??e())===`zh-TW`?`反覆當機後暫停中・送出訊息就會喚醒`:`Held after repeated crashes · a message wakes it`),U=((t={},n={})=>(n.locale??e())===`zh-TW`?`喚醒塔台`:`Wakes the tower`),W=(e,t)=>n(`placeholder_wake`,U,e,t),G=e=>`Send ${e?.command}`,pe=e=>`送出 ${e?.command}`,me=((t,n={})=>(n.locale??e())===`zh-TW`?pe(t):G(t)),he=((t={},n={})=>(n.locale??e())===`zh-TW`?`已照原文送出;你的修改留在這裡,尚未送出。`:`Sent as it was; your edits stayed here, unsent.`),ge=((t={},n={})=>(n.locale??e())===`zh-TW`?`停止`:`Stop`),_e=((t={},n={})=>(n.locale??e())===`zh-TW`?`要停止目前的任務嗎?佇列中的訊息會退回它的終端機編輯器。`:`Stop the current task? Queued messages go back to its terminal editor.`),ve=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框:請在終端機中回答。`:`It is waiting on a dialog: answer it in the terminal.`),ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 上還有另一個輸入在途中。`:`Another input to this session is still on its way.`),be=((t={},n={})=>(n.locale??e())===`zh-TW`?`終端機的輸入框裡除了排隊中的訊息與草稿,還有其他內容(期間有人輸入,或 pi 展開了訊息)。訊息在輸入框裡,請查看終端機。`:`The terminal’s editor holds something other than the queued messages and the draft (typed meanwhile, or a message pi expanded). The messages are in it; check the terminal.`),xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待連結請求時,配對裝置只能送出 Escape。請在這台電腦的頁面或終端機核准。`:`While it waits on a link request, a paired device can only send Escape. Approve it on this computer’s own page or terminal.`),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個 session 沒有輸入框,無法把訊息取回。`:`This session has no editor to take the messages back into.`),Ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`pi 的取回按鍵(keybindings.json 裡的 app.message.dequeue)不是這個頁面能送出的按鍵。請在終端機裡按。`:`pi’s dequeue key (app.message.dequeue in its keybindings.json) is not one this page can send. Press it in the terminal.`),we=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法清掉終端機輸入框裡的訊息。它們在那裡,不在這裡。`:`The messages could not be cleared from the terminal’s editor. They are there, not here.`),Te=e=>`pi did not take its queue back; its dequeue key may not be ${e?.key}. Check the terminal.`,Ee=e=>`pi 沒有取回它的佇列;它的取回按鍵可能不是 ${e?.key}。請查看終端機。`,De=((t,n={})=>(n.locale??e())===`zh-TW`?Ee(t):Te(t)),Oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`一次按太多鍵了。請一秒後再試。`:`Too many keys at once. Try again in a second.`),ke=((t={},n={})=>(n.locale??e())===`zh-TW`?`取回逾時,或按鍵送出後 session 已有變動:訊息在終端機的輸入框裡,不在這裡。`:`The take-back timed out, or the session changed, after the key went: the messages are in the terminal’s editor, not here.`),Ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`排隊中的訊息太長,帶不回這裡。它們在終端機的輸入框裡。`:`The queued messages are too long to bring here. They are in the terminal’s editor.`),K=((t={},n={})=>(n.locale??e())===`zh-TW`?`未確認。再次送出前請先查看終端機。`:`Not confirmed. Check the terminal before sending again.`),je=((t={},n={})=>(n.locale??e())===`zh-TW`?`上傳中…`:`Uploading…`),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`原文已送到 session;這裡是你編輯過、尚未送出的副本。`:`The original already went to the session; what is here is your edited copy, unsent.`),Ne=e=>/^\/(\S{0,64})$/.exec(e)?.[1],Pe=(e,t,n)=>(e+n+t)%t;function Fe(e,t){let n=u(`ul`,{class:`slash`,id:`slash`,role:`listbox`,"aria-label":S()}),r=[],i=0,a;e.setAttribute(`aria-controls`,`slash`);let o=()=>!n.hidden&&r.length>0,s=()=>(r=[],n.hidden=!0,e.removeAttribute(`aria-activedescendant`)),c=()=>{n.replaceChildren(...r.map((e,t)=>{let n=u(`li`,{id:`slash-${t}`,role:`option`,"aria-selected":String(t===i)},u(`b`,null,`/${e.name}`),e.description&&u(`span`,null,e.description));return n.onmousedown=e=>e.preventDefault(),n.onclick=()=>l(e),n})),n.hidden=!r.length,r.length&&(e.setAttribute(`aria-activedescendant`,`slash-${i}`),n.children[i]?.scrollIntoView({block:`nearest`}))},l=t=>{e.value=`/${t.name} `,s(),e.focus(),e.dispatchEvent(new Event(`input`))};return s(),e.addEventListener(`input`,()=>{let n=Ne(e.value),o=e.value;if(clearTimeout(a),n===void 0)return s();a=setTimeout(async()=>{let a=await t(n).catch(()=>void 0);if(e.value!==o)return;let s=a?.ok&&Array.isArray(a.body.commands)?a.body.commands:[];[r,i]=[s,0],c()},120)}),e.addEventListener(`blur`,s),e.addEventListener(`keydown`,e=>{if(!o()||e.isComposing||e.keyCode===229)return;let t=e.key;if(t===`ArrowDown`||t===`ArrowUp`)i=Pe(i,r.length,t===`ArrowDown`?1:-1),c();else if(t===`Enter`&&!e.shiftKey||t===`Tab`)l(r[i]);else if(t===`Escape`)s();else return;e.preventDefault(),e.stopImmediatePropagation()}),n}var Ie=16384,Le=/^\s*\/(quit|exit|new|resume|fork|clone|import|reload)(?=\s|$)/,Re=(e,t)=>t.wakes?void 0:e.match(Le)?.[0].trim(),q=new Map;function ze(e,t,n,i){if(!e.ok)return[`error`,e.status===504?K({},i?{locale:i}:void 0):r(e,i)??e.body.reason??l({status:e.status},i?{locale:i}:void 0)];if(t&&!t.startsWith(n))return[`ok`,Me()]}var Be=e=>{try{return e?.startsWith(`[`)?JSON.parse(e):e?[`error`,e]:void 0}catch{return[`error`,e]}},Ve=(e,t)=>e!==``&&!e.startsWith(t)?he():``,He=(e,t)=>e.startsWith(t)?e.slice(t.length).replace(/^\n/,``):e,J=(e,t)=>t.trim()?`${e}\n\n${t}`:e,Y=new Map,Ue=54e4,X=new Map,Z=new Map,Q=e=>`sb-draft:${e}:take`;function We(e,t=Date.now()){let n=X.get(e);if(!n)try{let[t,r]=(sessionStorage.getItem(Q(e))??``).split(`:`);r&&Number(t)>0&&X.set(e,n={id:r,at:Number(t)})}catch{}return n&&t-n.at>=Ue&&(Ke(e),n=void 0),n?.id}function Ge(e,t=Date.now()){let n=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``);X.set(e,{id:n,at:t});try{sessionStorage.setItem(Q(e),`${t}:${n}`)}catch{}return n}function Ke(e){X.delete(e);try{sessionStorage.removeItem(Q(e))}catch{}}function qe(e,t){let n=`sb-draft:${e}`;try{sessionStorage.setItem(n,J(t,sessionStorage.getItem(n)??``)),sessionStorage.setItem(`${n}:note`,JSON.stringify([`ok`,oe()]))}catch{Z.set(e,J(t,Z.get(e)??``))}}function Je(e,t){let n=Z.get(e);return Z.delete(e),n===void 0?t:J(n,t)}var Ye=[`no_editor`,`stale`,`not_taken`,`changed`,`too_large`,`not_cleared`,`no_key`];function Xe(e,t){let n=t?{locale:t}:void 0,r=typeof e.body.label==`string`?e.body.label:`?`;return e.status>=400&&e.status!==504?{no_key:()=>Ce({},n),no_editor:()=>Se({},n),stale:()=>ke({},n),not_taken:()=>De({key:r},n),changed:()=>be({},n),too_large:()=>Ae({},n),not_cleared:()=>we({},n),blocked:()=>ve({},n),local_only:()=>xe({},n),rate:()=>Oe({},n),busy:()=>ye({},n)}[e.body.error??``]?.():void 0}function Ze(e,t,n){t.ok&&typeof t.body.text==`string`&&(n?(n.box.value=J(t.body.text,n.box.value),n.save()):qe(e,t.body.text)),(t.ok||t.status===400||t.status===409&&Ye.includes(t.body.error??``))&&Ke(e)}var Qe=e=>e.live&&!e.ally;function $(e){if(!e.online)return e.away?x():v();if(!e.live)return g();if(!e.control)return e.run?b():e.ally?p():_();if(e.mark===`waiting`)return e.answerable?m():h()}function $e(e){if(e.online){if(!e.live)return f();if(!e.control&&(e.run||e.ally))return e.run?b():p()}}var et=e=>e.wakes?e.held?H():e.allyLive?R():e.eventRun?V():e.head?e.conversation?O():A():e.conversation?B():W():I({name:e.name}),tt=e=>({eventRun:!(!e?.bossIn||e.conversation),wakes:!!e,held:e?.state===`held`,conversation:!(!e?.conversation||e.conversation.closing),allyLive:!(!e?.allyRuns.length||e.run)});function nt(e,n,r,ee=e=>c(`sessions/${encodeURIComponent(n)}/upload`,e)){let d=`sb-draft:${n}`,f=matchMedia(`(pointer: coarse)`).matches,p=u(`textarea`,{rows:`1`,maxlength:String(Ie),"aria-label":fe(),enterkeyhint:f?`enter`:`send`}),m=u(`button`,{type:`submit`,class:`cmp-send`},i()),h=u(`button`,{type:`button`,class:`cmp-alt`},de()),g=u(`button`,{type:`button`,class:`cmp-alt cmp-stop`},ge()),_=u(`input`,{type:`file`,multiple:``,hidden:``}),v=u(`button`,{type:`button`,class:`cmp-alt`,"aria-label":ne()},`+`),y=u(`p`,{class:`cmp-note`,role:`status`,"aria-live":`polite`}),b=Fe(p,e=>r(`commands`,{prefix:e})),x=u(`p`,{class:`cmp-bar`,role:`status`}),S=u(`p`,{class:`cmp-activity`,role:`status`,"aria-live":`polite`});x.hidden=!0;let C=u(`form`,{class:`composer`},b,u(`div`,{class:`cmp-row`},v,_,p,u(`div`,{class:`cmp-acts`},m,h,g)),u(`div`,{class:`cmp-foot`},y),x,S);e.replaceChildren(C);let w={name:``,control:!1,live:!1,mark:`unknown`,online:!1},T=!1,E=!1,D=e=>{try{e()}catch{}};D(()=>p.value=sessionStorage.getItem(d)??``),p.value=Je(n,p.value);let O=()=>D(()=>p.value?sessionStorage.setItem(d,p.value):sessionStorage.removeItem(d)),k=CSS.supports(`field-sizing`,`content`)?()=>{}:()=>(p.style.height=`auto`,p.style.height=`${Math.min(p.scrollHeight,220)}px`),A=(e,t=``,...n)=>(y.dataset.tone=t,y.replaceChildren(e,...n)),j=(e,t,n)=>{let r=u(`button`,{type:`button`,class:`cmp-yes`},t),i=u(`button`,{type:`button`,class:`cmp-link`},te());E=!0,r.onclick=()=>(E=!1,n()),i.onclick=()=>(E=!1,A(``),p.focus()),A(e,`ask`,r,i),r.focus()},[M,N]=[`${d}:note`,()=>{try{return sessionStorage.getItem(d)??``}catch{return}}],P=e=>D(()=>e?sessionStorage.setItem(M,JSON.stringify(e)):sessionStorage.removeItem(M));function F(e,t,i){let a={sent:i,answer:r(e,t)};return i!==void 0&&(P([`error`,K()]),q.set(n,a),a.answer.then(e=>{let t=N();e.ok&&t!==void 0&&D(()=>sessionStorage.setItem(d,He(t,i))),P(ze(e,t,i))},()=>P([`error`,K()]))),I(a)}async function I(e,{sent:r}=e){T=!0,E=!1,R(),A(r===void 0?``:t());try{let t=await e.answer;if(!C.isConnected)return;if(!t.ok)return t.status===504||P(),A(a(t)??(t.status===403&&t.body.error===`local_only`?re():void 0)??t.body.reason??l({status:t.status}),`error`);if(r===void 0)return A(``);P();let n=Ve(p.value,r);p.value=He(p.value,r),O(),k(),A(n,`ok`)}catch{A(K(),`error`)}finally{q.get(n)===e&&q.delete(n),T=!1,R()}}function L(e,t){let n=p.value,r=$(w),i=t===n;if(T||E||!n.trim())return;if(r)return A(r,`error`);if(new TextEncoder().encode(n).length>16384)return A(o(),`error`);let a=!i&&Re(n,w);if(a)return j(le({command:a}),me({command:a}),()=>L(e,n));F(`input`,{text:n,as:e,confirmed:i},n)}function R(){let e=$e(w),t=[C.querySelector(`.cmp-row`),C.querySelector(`.cmp-foot`)];x.hidden=e===void 0,x.textContent=e??``,C.classList.toggle(`ended`,e!==void 0);for(let n of t)n.hidden=e!==void 0;b.hidden||=e!==void 0;let n=w.activity;for(let[e,t]of[[`activity`,n?.mark],[`kind`,n?.kind]])t===void 0?delete C.dataset[e]:C.dataset[e]=t;S.textContent!==(n?.text??``)&&(S.textContent=n?.text??``);let r=$(w),i=w.mark===`working`;p.placeholder=r??et(w),p.disabled=v.disabled=!Qe(w),m.disabled=T||!!r||!p.value.trim(),h.hidden=g.hidden=!i||!!r||!!w.wakes,[h.disabled,g.disabled]=[m.disabled,T]}let z=()=>{let e=u(`button`,{type:`button`,class:`cmp-yes`},ie());e.onclick=()=>void V(),A(ce(),`error`,e)};function B(){return r(`dequeue`,{take:We(n)??Ge(n)}).then(e=>(Ze(n,e,C.isConnected?{box:p,save:O}:void 0),e),()=>void 0)}async function V(){if(T||E||Y.has(n))return;let e=$(w);if(e)return A(e,`error`);let t=B();Y.set(n,t),await H(t)}async function H(e){T=!0,R(),A(se());try{let t=await e;if(!C.isConnected)return;if(!t||t.status===504)return z();if(!t.ok)return A(Xe(t)??t.body.reason??l({status:t.status}),`error`);if(typeof t.body.text!=`string`)return A(ae());let r=N();r!==void 0&&r!==p.value&&(p.value=r),p.value=Je(n,p.value),O(),P(),k(),p.focus(),p.selectionStart=p.selectionEnd=p.value.length,A(oe(),`ok`)}finally{Y.get(n)===e&&Y.delete(n),T=!1,R()}}async function U(e){if(!e.length||T)return;let t=$(w);if(t)return A(t,`error`);A(je(),``);for(let t of e){if(t.size>20971520)return A(ue({name:t.name}),`error`);let e=await ee(t).catch(()=>void 0);if(!e?.ok||typeof e.body.path!=`string`)return A(e?.body.reason??s(),`error`);let n=p.selectionStart??p.value.length,r=p.value.slice(0,n),i=p.value.slice(p.selectionEnd??n),a=`${r&&!/\s$/.test(r)?` `:``}${e.body.path}${/^\s/.test(i)?``:` `}`;p.value=r+a+i,p.selectionStart=p.selectionEnd=n+a.length}A(``),O(),k(),R(),p.focus()}v.onclick=()=>_.click(),_.onchange=()=>void U([..._.files??[]]).finally(()=>_.value=``),p.addEventListener(`paste`,e=>{let t=[...e.clipboardData?.files??[]];t.length&&(e.preventDefault(),U(t))}),C.addEventListener(`dragover`,e=>e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()),C.addEventListener(`drop`,e=>{let t=[...e.dataTransfer?.files??[]];t.length&&(e.preventDefault(),U(t))}),C.addEventListener(`submit`,e=>(e.preventDefault(),L(`send`))),h.onclick=()=>L(`followUp`),g.onclick=()=>j(_e(),ge(),()=>void(T||F(`keys`,{keys:[`esc`]}))),p.addEventListener(`input`,()=>(O(),k(),R())),C.addEventListener(`keydown`,e=>{e.key===`Escape`&&!e.isComposing&&(E||e.target===p&&p.value)&&(e.preventDefault(),E&&(E=!1,A(``),p.focus()))}),p.addEventListener(`keydown`,e=>{e.isComposing||e.keyCode===229||e.key!==`Enter`||e.shiftKey||f&&!e.altKey||(e.preventDefault(),L(e.altKey?`followUp`:`send`))});let W=window.visualViewport,G=()=>[[`--vvh`,W.height],[`--vvt`,W.offsetTop]].forEach(([e,t])=>document.documentElement.style.setProperty(e,`${t}px`));return W&&(W.addEventListener(`resize`,G),W.addEventListener(`scroll`,G),G()),k(),q.has(n)?I(q.get(n)):Y.has(n)?H(Y.get(n)):D(()=>{let e=Be(sessionStorage.getItem(M));sessionStorage.removeItem(M),e?A(e[1],e[0]):We(n)&&z()}),{box:p,update:e=>(w=e,R()),ready:()=>!$(w),takeQueue:V}}var rt=(e,{name:t,mk:n,state:r,online:i,away:a,role:o,head:s})=>({name:t,control:!!e?.control,live:!ee(e,r),mark:n,online:i,away:a,answerable:!!e?.pending?.answer,...tt(e?.service??(s?{state:`absent`,allyRuns:[]}:void 0)),head:!!s,activity:it(e,r,n),ally:!e&&(o===`ally`||o===`run`),run:!e&&o===`run`});function it(e,t,n){let r=d(e,t,n);if(!r)return;let i=e?.note??``;return{text:r,mark:n,kind:i.startsWith(`tool:`)?`tool`:i===`watching a monitor`?`monitoring`:`thinking`}}export{h as a,N as i,nt as n,K as r,rt as t};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CVl6pSSe.css"])))=>i.map(i=>d[i]);
2
- import{G as e}from"./index-LCc1BzpW.js";var t=[`phone`,`teams`,`server`],n={phone:t=>e(()=>import(`./pair-6RKgnkV8.js`).then(e=>e.pairTile(t())),__vite__mapDeps([0]),import.meta.url),teams:()=>e(()=>import(`./link-_ku8_F1J.js`).then(e=>e.linkTile()),__vite__mapDeps([0]),import.meta.url),server:()=>e(()=>import(`./server-D8Peiga1.js`).then(e=>e.serverTile()),__vite__mapDeps([0]),import.meta.url)},r=e=>e===`wifi`?[`phone`,`lan`]:[e,`tailscale`];function i(e,i,a=n){let o=t.map(t=>{let n=e.querySelector(`#set-${t}`),r=n.querySelector(`.set-body`);return n.hidden=t!==`teams`&&!i[t],{name:t,box:n,body:r,panel:void 0,loading:!1,turn:0,tab:`tailscale`}}),s=e=>o.find(t=>t.name===e);function c(e,t){let n=s(e);if(t&&(n.tab=t),n.panel)return void(t&&n.panel.select?.(t));if(n.loading)return;let r=++n.turn;n.loading=!0,a[e](()=>n.tab).then(e=>{n.loading=!1,r===n.turn&&(n.panel=e,n.body.replaceChildren(e.body()))},()=>n.loading=!1)}function l(e){let t=s(e);t.turn++,t.loading=!1,t.panel?.closed?.(),t.panel=void 0,t.body.replaceChildren()}for(let e of o)e.box.addEventListener(`toggle`,()=>e.box.open?c(e.name):l(e.name));return{show(e){if(!e)return;let[t,n]=r(e),i=s(t);i.box.hidden||(i.box.open=!0,c(t,n),i.box.scrollIntoView({block:`start`}))},hide(){for(let e of o)e.box.open=!1,l(e.name)}}}export{i as mountSettings};
2
+ import{G as e}from"./index-Dvw58cHb.js";var t=[`phone`,`teams`,`server`],n={phone:t=>e(()=>import(`./pair-BdBNEx-I.js`).then(e=>e.pairTile(t())),__vite__mapDeps([0]),import.meta.url),teams:()=>e(()=>import(`./link-CfF8WoKX.js`).then(e=>e.linkTile()),__vite__mapDeps([0]),import.meta.url),server:()=>e(()=>import(`./server-CSZVUOSr.js`).then(e=>e.serverTile()),__vite__mapDeps([0]),import.meta.url)},r=e=>e===`wifi`?[`phone`,`lan`]:[e,`tailscale`];function i(e,i,a=n){let o=t.map(t=>{let n=e.querySelector(`#set-${t}`),r=n.querySelector(`.set-body`);return n.hidden=t!==`teams`&&!i[t],{name:t,box:n,body:r,panel:void 0,loading:!1,turn:0,tab:`tailscale`}}),s=e=>o.find(t=>t.name===e);function c(e,t){let n=s(e);if(t&&(n.tab=t),n.panel)return void(t&&n.panel.select?.(t));if(n.loading)return;let r=++n.turn;n.loading=!0,a[e](()=>n.tab).then(e=>{n.loading=!1,r===n.turn&&(n.panel=e,n.body.replaceChildren(e.body()))},()=>n.loading=!1)}function l(e){let t=s(e);t.turn++,t.loading=!1,t.panel?.closed?.(),t.panel=void 0,t.body.replaceChildren()}for(let e of o)e.box.addEventListener(`toggle`,()=>e.box.open?c(e.name):l(e.name));return{show(e){if(!e)return;let[t,n]=r(e),i=s(t);i.box.hidden||(i.box.open=!0,c(t,n),i.box.scrollIntoView({block:`start`}))},hide(){for(let e of o)e.box.open=!1,l(e.name)}}}export{i as mountSettings};
@@ -1 +1 @@
1
- import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sentencepack-DtYqpppS.js";import{t as n}from"./refusal--wJ5SRx-.js";import{n as r,t as i}from"./picker-C9mN-2Ml.js";import{t as a}from"./open_main_title-DyToxqLu.js";import{t as o}from"./trust-D-_wrdAz.js";import{Ft as s,Nt as c,_t as l,at as u,bt as d,q as f,rt as p}from"./index-LCc1BzpW.js";var m=((t={},n={})=>(n.locale??e())===`zh-TW`?`基地名稱`:`Base name`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`部署進度`:`Deployment progress`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`回到表單`:`Back to the form`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`建立基地`:`Create the base`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`分割窗格`:`Split a pane`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟分頁`:`Open a tab`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`交付任務`:`Deliver the task`),x=e=>`Failed at “${e?.step}”.`,S=e=>`在「${e?.step}」失敗:`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`加入稻草網`:`Join the Straw Net`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`基地`:`base`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`單位就緒`:`Unit ready`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`啟動智慧體`:`Start the agent`),O=(e,n)=>t(`deploy_start`,D,e,n),k=e=>`No answer after ${e?.seconds} s. The unit may still open; check the map.`,A=e=>`${e?.seconds} 秒內沒有回應。單位可能仍會開好,請看地圖確認。`,j=((t,n={})=>(n.locale??e())===`zh-TW`?A(t):k(t)),M=e=>`Deploying ${e?.kind} · ${e?.name}`,N=e=>`部署${e?.kind} · ${e?.name}`,P=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`等你確認是否信任這個資料夾`:`Waiting for your OK to trust this folder`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`第一句指令(選填)`:`First message (optional)`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`在這裡開基地`:`Open the base here`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`開新基地`:`New base`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`在這裡開主智慧體`:`Open the main here`),B=(e,n)=>t(`open_main_go`,z,e,n),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`加入成員`:`Add the member`),H=e=>`New member in squad ${e?.tab}`,U=e=>`在小隊 ${e?.tab} 加一位成員`,W=((t,n={})=>(n.locale??e())===`zh-TW`?U(t):H(t)),G=e=>`New member in ${e?.base}`,K=e=>`在 ${e?.base} 加一位成員`,q=((t,n={})=>(n.locale??e())===`zh-TW`?K(t):G(t)),J=((t={},n={})=>(n.locale??e())===`zh-TW`?`基地已經開好,第一位成員已就位。`:`The base is open with its first member.`),Y=e=>`The main is open in a new squad of ${e?.base}.`,X=e=>`已在 ${e?.base} 的新小隊開好主智慧體。`,Z=((t,n={})=>(n.locale??e())===`zh-TW`?X(t):Y(t)),Q=(e,n)=>t(`opened_main`,Z,e,n),ee=e=>`The member is open in ${e?.base}.`,te=e=>`已在 ${e?.base} 加好成員。`,ne=((t,n={})=>(n.locale??e())===`zh-TW`?te(t):ee(t)),re=500,$=12e4,ie={now:()=>Date.now(),every:(e,t)=>(e=>()=>clearInterval(e))(setInterval(e,t)),after:(e,t)=>(e=>()=>clearTimeout(e))(setTimeout(e,t))},ae=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`,oe=e=>{let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),n=document.createElementNS(`http://www.w3.org/2000/svg`,`use`);return n.dataset.icon=e,n.setAttribute(`href`,u(e)),t.append(n),t},se=e=>[`create`,`start`,`join`,...e?[`deliver`]:[]];function ce(e){let t=e.clock??ie,r=`deploy-${crypto.randomUUID()}`,i=t=>({create:e.kind===`base`?_():e.split?v():y(),start:O(),trust:F(),join:w(),deliver:b()})[t],a=se(e.hasPrompt).map(e=>({id:e,state:`pending`,ms:0,since:0})),u=`running`,f=!1,m=!1,x=!1,S=``,D=()=>{},k=l(`span`,{class:`deploy-fill`}),A=l(`span`,{class:`deploy-count`}),M=l(`ol`,{class:`deploy-steps`}),N=l(`p`,{class:`deploy-note`,"aria-live":`polite`}),I=l(`button`,{type:`button`,class:`later`},g()),L=l(`h3`,{class:`deploy-title`},oe(e.kind===`main`?`main`:`member`),P({kind:e.kind===`base`?T():e.kind===`main`?p(`role_main`):p(`role_member`),name:e.name})),R=l(`div`,{class:`deploy-trust`}),z=l(`div`,{class:`deploy`,role:`status`,"aria-label":h()},L,l(`div`,{class:`deploy-bar`},k),A,M,R,N,I),B;d.add(r);let V=t=>{if(!t)return void(B&&=(R.replaceChildren(),void 0));let n=!B;B||R.replaceChildren(B=o(t=>e.trust?.(t)??Promise.reject(Error(`no route`)))),B.update(t),n&&R.scrollIntoView?.({block:`end`,behavior:`smooth`})};I.onclick=()=>e.back();let H=new Map,U=()=>{let e=a.filter(e=>e.state===`done`).length;z.dataset.state=u,k.style.setProperty(`--done`,String(e)),k.style.setProperty(`--of`,String(a.length)),A.textContent=`${e}/${a.length}`,a.map(e=>e.id).join()!==[...H.keys()].join()&&(H.clear(),M.replaceChildren(...a.map(e=>{let t=l(`time`,{class:`deploy-time`}),n=l(`li`,{"data-step":e.id},l(`i`,{class:`deploy-mark`}),l(`span`,null,i(e.id)),t);return H.set(e.id,{li:n,at:t}),n})));for(let e of a){let n=H.get(e.id),r=e.state===`active`?t.now()-e.since:e.ms;n.li.dataset.state=e.state,n.at.textContent=e.state===`pending`||e.state===`done`&&r<1e3?``:ae(r)}},W=j({seconds:$/1e3}),G=()=>a.some(e=>e.id===`trust`&&e.state===`active`)?(X(),X=t.after(G,$)):q(void 0,W),K=()=>(d.delete(r),Y(),X()),q=(e,n)=>{if(u!==`running`)return;u=`failed`,K(),x=e===void 0&&n===W;let r=a.find(t=>t.id===e)??a.find(e=>e.state===`active`)??a[0];a=a.map(e=>e===r?{...e,state:`failed`,ms:e.state===`active`?t.now()-e.since:e.ms}:e.state===`active`?{...e,state:`pending`}:e),N.setAttribute(`role`,`alert`),N.textContent=`${C({step:i(r.id)})} ${n}`,U(),I.focus?.()},J=e=>{if(u===`running`){if(a=e.steps.map(e=>({id:e.id,state:e.state,ms:e.ms,since:t.now()-e.ms})),V(e.trust),e.failed)return q(e.failed.step,n(e.failed.reason,e.failed.settings));U()}},Y=t.every(()=>{U(),!f&&(f=!0,e.progress(r).then(e=>{if(!e.ok||u!==`running`)return;let n=JSON.stringify(e.body);n!==S&&(S=n,X(),X=t.after(G,$)),J(e.body)},()=>{}).finally(()=>f=!1))},re),X=t.after(G,$);return e.open(r).then(r=>{if(!(m||u!==`running`&&!(u===`failed`&&x&&r.ok))){if(!r.ok)return q(r.body.step,n(r.body.reason,r.body.settings)??c({status:r.status}));u=`ready`,K(),N.setAttribute(`role`,`status`),N.textContent=E(),a=a.map(e=>({...e,state:`done`,ms:e.state===`active`?t.now()-e.since:e.ms})),U(),e.chime?.(),D=t.after(()=>e.ready(r.body),matchMedia(`(prefers-reduced-motion: reduce)`).matches?600:1500)}},()=>q(void 0,s())),U(),Object.assign(z,{close:()=>(m=!0,K(),D())})}function le(e,t,n){let o=e.kind===`base`?void 0:e.base,s=e.kind===`base`?void 0:e.tab,c=e.kind===`base`?R():e.kind===`main`?a({base:o.label}):s?W({tab:s.label}):q({base:o.label}),u=`open-${e.kind}-${o?.id??``}-${s?.id??``}`,d;return{id:u,title:c,closed:()=>d?.close(),body:()=>{let a=l(`button`,{type:`button`,class:`go`,disabled:``},e.kind===`base`?L():e.kind===`main`?B():V()),c=l(`textarea`,{rows:`3`,placeholder:I()}),p=l(`input`,{type:`text`,maxlength:`64`,placeholder:m(),"aria-label":m()}),h,g=``,_=!1;p.addEventListener(`input`,()=>_=!0);let v=i(o?{workspace:o.id,...s&&{tab:s.id}}:{},(e,t)=>{[h,g,a.disabled]=[e,t,!1],_||(p.value=r(e,t))},()=>(e.kind===`base`?p:c).focus());a.onclick=()=>{if(h===void 0)return;let i=h,a=c.value,l=p.value.trim()||r(i,g),m=e.kind===`base`?{dir:i,label:p.value,prompt:a}:{workspace:o.id,...s&&{tab:s.id},dir:i,prompt:a};x.replaceChildren(d=ce({kind:e.kind,split:e.kind===`member`&&!!s,hasPrompt:!!a.trim(),name:e.kind===`base`?l:r(i,g)||i,chime:n,open:t=>f(`open/${e.kind}`,{...m,deploy:t}),progress:e=>f(`open/progress`,{id:e}),trust:e=>f(`trust/answer`,e),back:()=>x.replaceChildren(...b),ready:n=>{if(c.value=p.value=``,_=!1,x.replaceChildren(...b),t&&typeof n.session==`string`)return t(n.workspace,n.session,u);y.textContent=e.kind===`base`?J():e.kind===`main`?Q({base:o.label}):ne({base:o.label})}}))};let y=l(`p`,{class:`chat-empty`}),b=[v.el,...e.kind===`base`?[l(`label`,{class:`spawn-name`},m(),p)]:[],c,y,a],x=l(`div`,{class:`spawn`},...b);return x}}}function ue(e,t){let n=e.dataset.open;if(n===`base`)return{kind:n};let r=t.find(t=>t.id===e.dataset.ws),i=e.dataset.tab?r?.tabs.find(t=>t.id===e.dataset.tab):void 0;if(!(n!==`main`&&n!==`member`||!r||e.dataset.tab&&!i))return{kind:n,base:{id:r.id,label:r.label},...i&&{tab:{id:i.id,label:i.label}}}}export{ue as openingOf,le as spawnTile};
1
+ import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sentencepack-DtYqpppS.js";import{t as n}from"./refusal--wJ5SRx-.js";import{n as r,t as i}from"./picker-CBlvQLT5.js";import{t as a}from"./open_main_title-DyToxqLu.js";import{t as o}from"./trust-DYlVFo7K.js";import{Ft as s,Nt as c,_t as l,at as u,bt as d,q as f,rt as p}from"./index-Dvw58cHb.js";var m=((t={},n={})=>(n.locale??e())===`zh-TW`?`基地名稱`:`Base name`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`部署進度`:`Deployment progress`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`回到表單`:`Back to the form`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`建立基地`:`Create the base`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`分割窗格`:`Split a pane`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`開啟分頁`:`Open a tab`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`交付任務`:`Deliver the task`),x=e=>`Failed at “${e?.step}”.`,S=e=>`在「${e?.step}」失敗:`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`加入稻草網`:`Join the Straw Net`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`基地`:`base`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`單位就緒`:`Unit ready`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`啟動智慧體`:`Start the agent`),O=(e,n)=>t(`deploy_start`,D,e,n),k=e=>`No answer after ${e?.seconds} s. The unit may still open; check the map.`,A=e=>`${e?.seconds} 秒內沒有回應。單位可能仍會開好,請看地圖確認。`,j=((t,n={})=>(n.locale??e())===`zh-TW`?A(t):k(t)),M=e=>`Deploying ${e?.kind} · ${e?.name}`,N=e=>`部署${e?.kind} · ${e?.name}`,P=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`等你確認是否信任這個資料夾`:`Waiting for your OK to trust this folder`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`第一句指令(選填)`:`First message (optional)`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`在這裡開基地`:`Open the base here`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`開新基地`:`New base`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`在這裡開主智慧體`:`Open the main here`),B=(e,n)=>t(`open_main_go`,z,e,n),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`加入成員`:`Add the member`),H=e=>`New member in squad ${e?.tab}`,U=e=>`在小隊 ${e?.tab} 加一位成員`,W=((t,n={})=>(n.locale??e())===`zh-TW`?U(t):H(t)),G=e=>`New member in ${e?.base}`,K=e=>`在 ${e?.base} 加一位成員`,q=((t,n={})=>(n.locale??e())===`zh-TW`?K(t):G(t)),J=((t={},n={})=>(n.locale??e())===`zh-TW`?`基地已經開好,第一位成員已就位。`:`The base is open with its first member.`),Y=e=>`The main is open in a new squad of ${e?.base}.`,X=e=>`已在 ${e?.base} 的新小隊開好主智慧體。`,Z=((t,n={})=>(n.locale??e())===`zh-TW`?X(t):Y(t)),Q=(e,n)=>t(`opened_main`,Z,e,n),ee=e=>`The member is open in ${e?.base}.`,te=e=>`已在 ${e?.base} 加好成員。`,ne=((t,n={})=>(n.locale??e())===`zh-TW`?te(t):ee(t)),re=500,$=12e4,ie={now:()=>Date.now(),every:(e,t)=>(e=>()=>clearInterval(e))(setInterval(e,t)),after:(e,t)=>(e=>()=>clearTimeout(e))(setTimeout(e,t))},ae=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`,oe=e=>{let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),n=document.createElementNS(`http://www.w3.org/2000/svg`,`use`);return n.dataset.icon=e,n.setAttribute(`href`,u(e)),t.append(n),t},se=e=>[`create`,`start`,`join`,...e?[`deliver`]:[]];function ce(e){let t=e.clock??ie,r=`deploy-${crypto.randomUUID()}`,i=t=>({create:e.kind===`base`?_():e.split?v():y(),start:O(),trust:F(),join:w(),deliver:b()})[t],a=se(e.hasPrompt).map(e=>({id:e,state:`pending`,ms:0,since:0})),u=`running`,f=!1,m=!1,x=!1,S=``,D=()=>{},k=l(`span`,{class:`deploy-fill`}),A=l(`span`,{class:`deploy-count`}),M=l(`ol`,{class:`deploy-steps`}),N=l(`p`,{class:`deploy-note`,"aria-live":`polite`}),I=l(`button`,{type:`button`,class:`later`},g()),L=l(`h3`,{class:`deploy-title`},oe(e.kind===`main`?`main`:`member`),P({kind:e.kind===`base`?T():e.kind===`main`?p(`role_main`):p(`role_member`),name:e.name})),R=l(`div`,{class:`deploy-trust`}),z=l(`div`,{class:`deploy`,role:`status`,"aria-label":h()},L,l(`div`,{class:`deploy-bar`},k),A,M,R,N,I),B;d.add(r);let V=t=>{if(!t)return void(B&&=(R.replaceChildren(),void 0));let n=!B;B||R.replaceChildren(B=o(t=>e.trust?.(t)??Promise.reject(Error(`no route`)))),B.update(t),n&&R.scrollIntoView?.({block:`end`,behavior:`smooth`})};I.onclick=()=>e.back();let H=new Map,U=()=>{let e=a.filter(e=>e.state===`done`).length;z.dataset.state=u,k.style.setProperty(`--done`,String(e)),k.style.setProperty(`--of`,String(a.length)),A.textContent=`${e}/${a.length}`,a.map(e=>e.id).join()!==[...H.keys()].join()&&(H.clear(),M.replaceChildren(...a.map(e=>{let t=l(`time`,{class:`deploy-time`}),n=l(`li`,{"data-step":e.id},l(`i`,{class:`deploy-mark`}),l(`span`,null,i(e.id)),t);return H.set(e.id,{li:n,at:t}),n})));for(let e of a){let n=H.get(e.id),r=e.state===`active`?t.now()-e.since:e.ms;n.li.dataset.state=e.state,n.at.textContent=e.state===`pending`||e.state===`done`&&r<1e3?``:ae(r)}},W=j({seconds:$/1e3}),G=()=>a.some(e=>e.id===`trust`&&e.state===`active`)?(X(),X=t.after(G,$)):q(void 0,W),K=()=>(d.delete(r),Y(),X()),q=(e,n)=>{if(u!==`running`)return;u=`failed`,K(),x=e===void 0&&n===W;let r=a.find(t=>t.id===e)??a.find(e=>e.state===`active`)??a[0];a=a.map(e=>e===r?{...e,state:`failed`,ms:e.state===`active`?t.now()-e.since:e.ms}:e.state===`active`?{...e,state:`pending`}:e),N.setAttribute(`role`,`alert`),N.textContent=`${C({step:i(r.id)})} ${n}`,U(),I.focus?.()},J=e=>{if(u===`running`){if(a=e.steps.map(e=>({id:e.id,state:e.state,ms:e.ms,since:t.now()-e.ms})),V(e.trust),e.failed)return q(e.failed.step,n(e.failed.reason,e.failed.settings));U()}},Y=t.every(()=>{U(),!f&&(f=!0,e.progress(r).then(e=>{if(!e.ok||u!==`running`)return;let n=JSON.stringify(e.body);n!==S&&(S=n,X(),X=t.after(G,$)),J(e.body)},()=>{}).finally(()=>f=!1))},re),X=t.after(G,$);return e.open(r).then(r=>{if(!(m||u!==`running`&&!(u===`failed`&&x&&r.ok))){if(!r.ok)return q(r.body.step,n(r.body.reason,r.body.settings)??c({status:r.status}));u=`ready`,K(),N.setAttribute(`role`,`status`),N.textContent=E(),a=a.map(e=>({...e,state:`done`,ms:e.state===`active`?t.now()-e.since:e.ms})),U(),e.chime?.(),D=t.after(()=>e.ready(r.body),matchMedia(`(prefers-reduced-motion: reduce)`).matches?600:1500)}},()=>q(void 0,s())),U(),Object.assign(z,{close:()=>(m=!0,K(),D())})}function le(e,t,n){let o=e.kind===`base`?void 0:e.base,s=e.kind===`base`?void 0:e.tab,c=e.kind===`base`?R():e.kind===`main`?a({base:o.label}):s?W({tab:s.label}):q({base:o.label}),u=`open-${e.kind}-${o?.id??``}-${s?.id??``}`,d;return{id:u,title:c,closed:()=>d?.close(),body:()=>{let a=l(`button`,{type:`button`,class:`go`,disabled:``},e.kind===`base`?L():e.kind===`main`?B():V()),c=l(`textarea`,{rows:`3`,placeholder:I()}),p=l(`input`,{type:`text`,maxlength:`64`,placeholder:m(),"aria-label":m()}),h,g=``,_=!1;p.addEventListener(`input`,()=>_=!0);let v=i(o?{workspace:o.id,...s&&{tab:s.id}}:{},(e,t)=>{[h,g,a.disabled]=[e,t,!1],_||(p.value=r(e,t))},()=>(e.kind===`base`?p:c).focus());a.onclick=()=>{if(h===void 0)return;let i=h,a=c.value,l=p.value.trim()||r(i,g),m=e.kind===`base`?{dir:i,label:p.value,prompt:a}:{workspace:o.id,...s&&{tab:s.id},dir:i,prompt:a};x.replaceChildren(d=ce({kind:e.kind,split:e.kind===`member`&&!!s,hasPrompt:!!a.trim(),name:e.kind===`base`?l:r(i,g)||i,chime:n,open:t=>f(`open/${e.kind}`,{...m,deploy:t}),progress:e=>f(`open/progress`,{id:e}),trust:e=>f(`trust/answer`,e),back:()=>x.replaceChildren(...b),ready:n=>{if(c.value=p.value=``,_=!1,x.replaceChildren(...b),t&&typeof n.session==`string`)return t(n.workspace,n.session,u);y.textContent=e.kind===`base`?J():e.kind===`main`?Q({base:o.label}):ne({base:o.label})}}))};let y=l(`p`,{class:`chat-empty`}),b=[v.el,...e.kind===`base`?[l(`label`,{class:`spawn-name`},m(),p)]:[],c,y,a],x=l(`div`,{class:`spawn`},...b);return x}}}function ue(e,t){let n=e.dataset.open;if(n===`base`)return{kind:n};let r=t.find(t=>t.id===e.dataset.ws),i=e.dataset.tab?r?.tabs.find(t=>t.id===e.dataset.tab):void 0;if(!(n!==`main`&&n!==`member`||!r||e.dataset.tab&&!i))return{kind:n,base:{id:r.id,label:r.label},...i&&{tab:{id:i.id,label:i.label}}}}export{ue as openingOf,le as spawnTile};
@@ -1,4 +1,4 @@
1
- import{_ as e}from"./towermodel-BIQTmR-P.js";import{t}from"./runtime-ZX6HkxDa.js";import{l as n,s as r}from"./towerturns-Cd9alhqa.js";import{_t as i,nn as a,rn as o,yt as s}from"./index-LCc1BzpW.js";import{t as c}from"./focusback-DGGGUsJl.js";var l=((e={},n={})=>(n.locale??t())===`zh-TW`?`現在連不上這台機器;連上之後才能送按鍵。`:`This machine cannot be reached right now; keys wait until it can.`),u=e=>`This runs a command in ${e?.name}'s prompt.`,d=e=>`這會在 ${e?.name} 的提示列執行指令。`,f=((e,n={})=>(n.locale??t())===`zh-TW`?d(e):u(e)),p=e=>`Enter runs /${e?.command}, which ends or replaces this session.`,m=e=>`Enter 會執行 /${e?.command},這會結束或取代這個 session。`,ee=((e,n={})=>(n.locale??t())===`zh-TW`?m(e):p(e)),h=e=>`${e?.name}'s prompt could not be read, so Enter may run something else.`,g=e=>`讀不到 ${e?.name} 的提示列,Enter 可能會執行別的東西。`,te=((e,n={})=>(n.locale??t())===`zh-TW`?g(e):h(e)),ne=((e={},n={})=>(n.locale??t())===`zh-TW`?`確認送出`:`Send it`),re=((e={},n={})=>(n.locale??t())===`zh-TW`?`完整終端機`:`Full terminal`),ie=((e={},n={})=>(n.locale??t())===`zh-TW`?`要送進終端機的一行`:`A line for the terminal`),ae=((e={},n={})=>(n.locale??t())===`zh-TW`?`遮住`:`Hide what I type`),oe=((e={},n={})=>(n.locale??t())===`zh-TW`?`執行`:`Run`),_=((e={},n={})=>(n.locale??t())===`zh-TW`?`看起來在問密碼:輸入內容已遮住。`:`Looks like a password prompt: what you type is hidden.`),se=((e={},n={})=>(n.locale??t())===`zh-TW`?`送出中…`:`Sending…`),ce=((e={},n={})=>(n.locale??t())===`zh-TW`?`已送出。`:`Sent.`),le=((e={},n={})=>(n.locale??t())===`zh-TW`?`終端機暫時沒有更新,稍候。`:`The terminal has not updated for a moment; waiting.`),v=e=>`The command waits in ${e?.name}'s prompt.`,y=e=>`指令在 ${e?.name} 的提示列等 Enter。`,ue=((e,n={})=>(n.locale??t())===`zh-TW`?y(e):v(e)),b=((e={},n={})=>(n.locale??t())===`zh-TW`?`連線中…`:`Connecting…`),x=((e={},n={})=>(n.locale??t())===`zh-TW`?`符合寬度`:`Fit width`),S=((e={},n={})=>(n.locale??t())===`zh-TW`?`鍵盤`:`Keyboard`),C=e=>`The mirror ended: ${e?.why}`,w=e=>`鏡像已結束:${e?.why}`,T=((e,n={})=>(n.locale??t())===`zh-TW`?w(e):C(e)),E=((e={},n={})=>(n.locale??t())===`zh-TW`?`等待輸入密碼時隱藏;請在終端機中輸入。`:`Hidden while it waits for a secret; type it in the terminal.`),D=e=>`Live · ${e?.cols}×${e?.rows}`,O=e=>`即時 · ${e?.cols}×${e?.rows}`,k=((e,n={})=>(n.locale??t())===`zh-TW`?O(e):D(e)),A=((e={},n={})=>(n.locale??t())===`zh-TW`?`此分頁隱藏時暫停。`:`Paused while this tab is hidden.`),j=e=>`${e?.why} Open the terminal again to retry.`,M=e=>`${e?.why} 重新開啟終端機即可重試。`,de=((e,n={})=>(n.locale??t())===`zh-TW`?M(e):j(e)),fe=((e={},n={})=>(n.locale??t())===`zh-TW`?`送出 Enter`:`Send Enter`),pe=e=>`Terminal of ${e?.name}, read only`,N=e=>`${e?.name} 的終端機,唯讀`,P=((e,n={})=>(n.locale??t())===`zh-TW`?N(e):pe(e)),F=e=>`Terminal · ${e?.name}`,me=e=>`終端機 · ${e?.name}`,I=((e,n={})=>(n.locale??t())===`zh-TW`?me(e):F(e)),L=((e={},n={})=>(n.locale??t())===`zh-TW`?`要信任這個資料夾嗎?`:`Trust this folder?`),R=((e={},n={})=>(n.locale??t())===`zh-TW`?`◉ 鍵盤直送中 · 按 Shift+Esc 或點外面結束`:`◉ Keyboard goes to the pane · Shift+Esc or a click outside stops it`),z=((e={},n={})=>(n.locale??t())===`zh-TW`?`點這裡後,鍵盤直接送進終端機(Ctrl、Alt、⌘ 組合鍵除外);按 Shift+Esc 放開`:`Click here and the keyboard goes straight to the terminal (except Ctrl, Alt, and ⌘ combinations); Shift+Esc lets it go`);function B(e){let t=new Set(e.flatMap(e=>e.kind===`result`&&e.callId?[e.callId]:[])),n=e.filter(e=>e.kind===`assistant`),r=n.at(-1),i=r?.tools?.find(e=>!t.has(e.id));return{said:(n.findLast(e=>e.text?.trim())?.text?.trim().split(`
1
+ import{_ as e}from"./towermodel-BIQTmR-P.js";import{t}from"./runtime-ZX6HkxDa.js";import{l as n,s as r}from"./towerturns-Cldgw4hX.js";import{_t as i,nn as a,rn as o,yt as s}from"./index-Dvw58cHb.js";import{t as c}from"./focusback-DGGGUsJl.js";var l=((e={},n={})=>(n.locale??t())===`zh-TW`?`現在連不上這台機器;連上之後才能送按鍵。`:`This machine cannot be reached right now; keys wait until it can.`),u=e=>`This runs a command in ${e?.name}'s prompt.`,d=e=>`這會在 ${e?.name} 的提示列執行指令。`,f=((e,n={})=>(n.locale??t())===`zh-TW`?d(e):u(e)),p=e=>`Enter runs /${e?.command}, which ends or replaces this session.`,m=e=>`Enter 會執行 /${e?.command},這會結束或取代這個 session。`,ee=((e,n={})=>(n.locale??t())===`zh-TW`?m(e):p(e)),h=e=>`${e?.name}'s prompt could not be read, so Enter may run something else.`,g=e=>`讀不到 ${e?.name} 的提示列,Enter 可能會執行別的東西。`,te=((e,n={})=>(n.locale??t())===`zh-TW`?g(e):h(e)),ne=((e={},n={})=>(n.locale??t())===`zh-TW`?`確認送出`:`Send it`),re=((e={},n={})=>(n.locale??t())===`zh-TW`?`完整終端機`:`Full terminal`),ie=((e={},n={})=>(n.locale??t())===`zh-TW`?`要送進終端機的一行`:`A line for the terminal`),ae=((e={},n={})=>(n.locale??t())===`zh-TW`?`遮住`:`Hide what I type`),oe=((e={},n={})=>(n.locale??t())===`zh-TW`?`執行`:`Run`),_=((e={},n={})=>(n.locale??t())===`zh-TW`?`看起來在問密碼:輸入內容已遮住。`:`Looks like a password prompt: what you type is hidden.`),se=((e={},n={})=>(n.locale??t())===`zh-TW`?`送出中…`:`Sending…`),ce=((e={},n={})=>(n.locale??t())===`zh-TW`?`已送出。`:`Sent.`),le=((e={},n={})=>(n.locale??t())===`zh-TW`?`終端機暫時沒有更新,稍候。`:`The terminal has not updated for a moment; waiting.`),v=e=>`The command waits in ${e?.name}'s prompt.`,y=e=>`指令在 ${e?.name} 的提示列等 Enter。`,ue=((e,n={})=>(n.locale??t())===`zh-TW`?y(e):v(e)),b=((e={},n={})=>(n.locale??t())===`zh-TW`?`連線中…`:`Connecting…`),x=((e={},n={})=>(n.locale??t())===`zh-TW`?`符合寬度`:`Fit width`),S=((e={},n={})=>(n.locale??t())===`zh-TW`?`鍵盤`:`Keyboard`),C=e=>`The mirror ended: ${e?.why}`,w=e=>`鏡像已結束:${e?.why}`,T=((e,n={})=>(n.locale??t())===`zh-TW`?w(e):C(e)),E=((e={},n={})=>(n.locale??t())===`zh-TW`?`等待輸入密碼時隱藏;請在終端機中輸入。`:`Hidden while it waits for a secret; type it in the terminal.`),D=e=>`Live · ${e?.cols}×${e?.rows}`,O=e=>`即時 · ${e?.cols}×${e?.rows}`,k=((e,n={})=>(n.locale??t())===`zh-TW`?O(e):D(e)),A=((e={},n={})=>(n.locale??t())===`zh-TW`?`此分頁隱藏時暫停。`:`Paused while this tab is hidden.`),j=e=>`${e?.why} Open the terminal again to retry.`,M=e=>`${e?.why} 重新開啟終端機即可重試。`,de=((e,n={})=>(n.locale??t())===`zh-TW`?M(e):j(e)),fe=((e={},n={})=>(n.locale??t())===`zh-TW`?`送出 Enter`:`Send Enter`),pe=e=>`Terminal of ${e?.name}, read only`,N=e=>`${e?.name} 的終端機,唯讀`,P=((e,n={})=>(n.locale??t())===`zh-TW`?N(e):pe(e)),F=e=>`Terminal · ${e?.name}`,me=e=>`終端機 · ${e?.name}`,I=((e,n={})=>(n.locale??t())===`zh-TW`?me(e):F(e)),L=((e={},n={})=>(n.locale??t())===`zh-TW`?`要信任這個資料夾嗎?`:`Trust this folder?`),R=((e={},n={})=>(n.locale??t())===`zh-TW`?`◉ 鍵盤直送中 · 按 Shift+Esc 或點外面結束`:`◉ Keyboard goes to the pane · Shift+Esc or a click outside stops it`),z=((e={},n={})=>(n.locale??t())===`zh-TW`?`點這裡後,鍵盤直接送進終端機(Ctrl、Alt、⌘ 組合鍵除外);按 Shift+Esc 放開`:`Click here and the keyboard goes straight to the terminal (except Ctrl, Alt, and ⌘ combinations); Shift+Esc lets it go`);function B(e){let t=new Set(e.flatMap(e=>e.kind===`result`&&e.callId?[e.callId]:[])),n=e.filter(e=>e.kind===`assistant`),r=n.at(-1),i=r?.tools?.find(e=>!t.has(e.id));return{said:(n.findLast(e=>e.text?.trim())?.text?.trim().split(`
2
2
  `).filter(Boolean).at(-1))?.slice(0,280),pending:i&&`${i.name} · ${i.summary}`.slice(0,200),at:(r??e.findLast(e=>e.kind!==`result`))?.id}}var V=[`Tab`,`Shift`,`Escape`,`Control`,`Alt`,`Meta`],H=400;function he(e,t,n,r,a,s={}){let c=i(`button`,{type:`button`,class:`pad-yes`},n),l=i(`button`,{type:`button`,class:`pad-no`},o());if(c.onclick=e=>e.isTrusted&&r(),l.onclick=a,e.dataset.tone=`ask`,e.replaceChildren(i(`span`,{class:`pad-ask-why`},t),i(`span`,{class:`pad-ask-acts`},c,l)),!s.enter)return l.focus();let u=globalThis.performance?.now?.()??0,d=!1;c.addEventListener(`keydown`,e=>{(e.key===`Enter`?d||e.repeat||e.timeStamp<u+H:!V.includes(e.key))&&e.preventDefault(),e.key!==`Enter`&&!V.includes(e.key)&&(d=!0,l.focus())}),c.addEventListener(`keyup`,e=>e.key===` `&&e.preventDefault()),c.focus()}var ge=/^\s*\/(quit|exit|new|resume|fork|clone|import|reload)(?=\s|$)/,U=4e3;function _e({post:t,stream:r,...i}){let a=[],o=0,s=!1,c;async function l(c,l){s=!0,i.busy?.(),i.clear?.(),o=Date.now(),i.sent?.(c);try{let e=await t(`keys`,{...c,stream:r(),...l?{confirmed:l}:{}});e.ok?i.taken?.(c):i.failed?.(c,e),e.status===409&&e.body.error===`confirm`&&typeof e.body.confirm==`string`&&`key`in c?(a=[],i.ask?.(c,String(e.body.reason??``),e.body.confirm)):e.ok||(a=[],i.error?.(n(e)))}catch{i.failed?.(c),a=[],i.error?.(e())}finally{s=!1,i.busy?.(),u()}}function u(){if(s||c||!a.length)return;let e=o+130-Date.now();if(e>0)return void(c=setTimeout(()=>(c=void 0,u()),e));l(a.shift())}return{push(e){a.push(e),u()},confirm(e,t){s||l({key:e},t)},text(e){let t=[...e.replace(/[\u0000-\u001f\u007f-\u009f]/g,``)];for(let e of t){let t=a.at(-1);t&&`text`in t&&[...t.text].length<64?t.text+=e:a.push({text:e})}return u(),t.length>0},paste(e){let t=[...e.replace(/\r\n?/g,`
3
3
  `).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/g,``)];for(let e=0;e<t.length;e+=U)a.push({paste:t.slice(e,e+U).join(``)});return u(),t.length>0},busy:()=>s,queued:()=>a.length}}var W=5e3,G=3e3;function K({post:t,stream:i}){let a=new Map,o,s=()=>{try{return String(JSON.parse(i()).stream??``)}catch{return``}},c=e=>e.watchers.forEach(t=>t.state?.(e.state(),e)),l=(e,t,n=``)=>(Object.assign(e,{phase:t,why:n}),c(e)),u=(e,t)=>(e.ended=!0,l(e,`refused`,t)),d=e=>e.watchers.forEach(e=>e.end?.()),f=(t,r,i=s())=>i&&void(t.queue=t.queue.then(()=>t.post(`mirror`,{stream:i,on:r}).then(e=>r&&!e.ok&&(u(t,n(e)),(e.status===404||e.body.error===`pane_closed`)&&d(t)),()=>r&&u(t,e())))),p=e=>e.ended&&void(e.ended=!1,l(e,`connecting`),f(e,!0)),m=()=>(clearInterval(o),o=a.size&&!document.hidden?setInterval(()=>a.forEach(c),1e3):void 0);return document.addEventListener(`visibilitychange`,()=>(m(),a.forEach(e=>{clearTimeout(e.away),document.hidden?e.away=setTimeout(()=>(e.parked=!0,f(e,!1),l(e,`paused`)),W):e.parked&&(e.parked=!1,f(e,!0))}))),{id:s,retry:e=>p(e),taken:e=>e.watchers.forEach(e=>e.taken?.()),join(e,n){let r=a.get(e);if(r)p(r);else{let n={key:e,post:t(e),rows:[],cols:0,seen:0,phase:`connecting`,why:``,hidden:!1,ended:!1,parked:!1,watchers:new Set,queue:Promise.resolve(),state:()=>n.parked||n.ended||n.stale()?`off`:n.hidden?`hidden`:`live`,stale:()=>Date.now()-n.seen>G};a.set(e,r=n),f(r,!0)}let i=r;return i.watchers.add(n),m(),{conn:i,stop:()=>i.watchers.delete(n)&&!i.watchers.size&&void(clearTimeout(i.away),f(i,!1),a.delete(e),m())}},hello:()=>a.forEach(e=>!e.parked&&!e.ended&&f(e,!0)),frame(e){let t;try{t=JSON.parse(e)}catch{return}let n=a.get(t.key);if(!n)return;if(n.hidden=!!(t.hidden||t.ended),t.ended)return u(n,T({why:r(t.ended)})),d(n);if([n.seen,n.ended]=[Date.now(),!1],t.hidden)return void(n.rows.length=0,n.watchers.forEach(e=>e.rows?.(n.rows,{key:n.key,rows:0},!1)),l(n,`hidden`));let i=Math.min(Math.max(0,Number(t.rows)||0),120);for(;n.rows.length<i;)n.rows.push(``);n.rows.length=i;for(let[e,r]of Array.isArray(t.set)?t.set:[])Number.isInteger(e)&&e>=0&&e<i&&typeof r==`string`&&(n.rows[e]=r);let o=!!(t.whole||t.cols&&t.cols!==n.cols);o&&(n.cols=t.cols||n.cols),n.watchers.forEach(e=>e.rows?.(n.rows,t,o)),l(n,`live`)}}}var q=`​`,J=[0,95,135,175,215,255],Y=e=>Number.isInteger(e)&&e>=0&&e<=255,X=e=>Y(e)?e<16?e:e<232?`rgb(${J[Math.floor((e-16)/36)]},${J[Math.floor((e-16)/6)%6]},${J[(e-16)%6]})`:`rgb(${8+10*(e-232)},${8+10*(e-232)},${8+10*(e-232)})`:void 0,ve=([e,t,n])=>[e,t,n].every(e=>Y(e))?`rgb(${e},${t},${n})`:void 0;function ye(e,t){let n={...e},r=t.split(`;`);for(let e=0;e<r.length;e++){let t=r[e].split(`:`).map(e=>e===``?0:Number(e)),i=t[0];if(i===38||i===48||i===58){let a=t.length>1?t[1]:Number(r[e+1]),o=t.length>1?t.slice(2):r.slice(e+2,e+(a===5?3:5)).map(Number);t.length===1&&(e+=a===5?2:a===2?4:1);let s=a===5?X(o[0]):a===2?ve(o.slice(-3)):void 0;s!==void 0&&i!==58&&(n[i===38?`fg`:`bg`]=s)}else if(i===0)for(let e of Object.keys(n))delete n[e];else i===1||i===2?n[i===1?`b`:`d`]=!0:i===22?n.b=n.d=!1:i===3||i===23?n.i=i===3:i===4||i===21||i===24?n.u=i!==24&&t[1]!==0:i===7||i===27?n.v=i===7:i===9||i===29?n.s=i===9:i>=30&&i<=37||i>=90&&i<=97?n.fg=i-(i<90?30:82):i>=40&&i<=47||i>=100&&i<=107?n.bg=i-(i<100?40:92):(i===39||i===49)&&delete n[i===39?`fg`:`bg`]}return n}function Z(e){let t=[],n={},r=0,i=e=>{let r=e.replace(/\x1b(\[[0-?]*[ -/]*[@-~]?)?|[\u0000-\u001f\u007f-\u009f]/g,``);if(!r)return;let[i,a]=n.v?[n.bg??`z`,n.fg??`z`]:[n.fg,n.bg],o=[typeof i==`number`||i===`z`?`c${i}`:``,typeof a==`number`||a===`z`?`k${a}`:``,...[`b`,`d`,`i`,`u`,`s`].filter(e=>n[e]).map(e=>`t${e}`)].filter(Boolean).join(` `);t.push({text:r,cls:o,...typeof i==`string`&&i!==`z`&&{fg:i},...typeof a==`string`&&a!==`z`&&{bg:a}})};for(let t of e.matchAll(/\x1b\[([0-9;:]{0,64})m/g))i(e.slice(r,t.index)),n=ye(n,t[1]),r=t.index+t[0].length;return i(e.slice(r)),t}function be(e,t){let n=Math.min(Math.max(0,Number(t.rows)||0),120);for(;e.children.length<n;)e.append(i(`div`,{class:`tr`}));for(;e.children.length>n;)e.lastElementChild.remove();for(let[r,a]of Array.isArray(t.set)?t.set:[])!Number.isInteger(r)||r<0||r>=n||typeof a!=`string`||e.children[r].replaceChildren(...Z(a).map(e=>{if(!e.cls&&!e.fg&&!e.bg)return e.text;let t=i(`span`,e.cls?{class:e.cls}:null,e.text);return e.fg&&(t.style.color=e.fg),e.bg&&(t.style.backgroundColor=e.bg),t}))}function xe({tiles:e,post:t,stream:n,pad:r}){let a=new Map,o=K({post:t,stream:n}),c=e=>void(e.sink.dataset.pad=e.conn.state()),l=e=>e.phase===`live`?[k({cols:e.cols,rows:e.rows.length}),`ok`]:e.phase===`refused`?[de({why:e.why}),`error`]:[e.phase===`hidden`?E():e.phase===`paused`?A():b(),``],u=e=>{let t=e.conn,[n,r]=l(t);e.box.classList.toggle(`stale`,t.stale()),e.box.classList.toggle(`hidden`,t.hidden),e.pad?.update(),c(e),(e.state.textContent!==n||e.state.dataset.tone!==r)&&(e.state.dataset.tone=r,e.state.textContent=n)},d=(e,t=Math.max(e.conn.cols,...[...e.box.children].map(e=>e.textContent?.length??0)))=>e.box.style.fontSize=e.fit.getAttribute(`aria-pressed`)===`true`&&t?`${Math.max(6,Math.floor((e.scroll.clientWidth-20)/(t*.6)))}px`:``,f=(e,t)=>{let n={key:e,box:i(`div`,{class:`term`,role:`group`,"aria-label":P({name:t})}),scroll:i(`div`,{class:`term-scroll`,tabindex:`0`}),state:i(`p`,{class:`term-state`,role:`status`},b()),fit:i(`button`,{type:`button`,class:`cmp-link`,"aria-pressed":`false`},x()),kb:i(`button`,{type:`button`,class:`cmp-link term-kb`,"aria-pressed":`false`},S()),typing:i(`span`,{class:`term-typing`,hidden:``},R()),sink:i(`textarea`,{class:`term-sink`,rows:`1`,"aria-label":z(),inputmode:`text`,enterkeyhint:`enter`,autocomplete:`off`,autocapitalize:`off`,autocorrect:`off`,spellcheck:`false`}),first:!0};n.fit.onclick=()=>(n.fit.setAttribute(`aria-pressed`,String(n.fit.getAttribute(`aria-pressed`)!==`true`)),d(n),requestAnimationFrame(()=>n.scroll.scrollTop=n.scroll.scrollHeight)),n.scroll.append(n.box);{let{sink:e}=n,t=()=>(e.value=q,e.setSelectionRange?.(1,1)),r=()=>e.value.replaceAll(q,``),i=()=>(r=>(a?t():e.value=``,r&&n.pad?.text?.(r)))(r()),a=!1;globalThis.matchMedia?.(`(pointer: fine)`).matches&&(n.scroll.title=z(),n.scroll.addEventListener(`click`,()=>getSelection()?.isCollapsed!==!1&&e.focus({preventScroll:!0}))),n.kb.addEventListener(`mousedown`,e=>e.preventDefault()),n.kb.addEventListener(`click`,()=>a?e.blur():e.focus({preventScroll:!0})),e.addEventListener(`keydown`,t=>t.key===`Escape`&&t.shiftKey?(t.preventDefault(),e.blur(),n.scroll.focus({preventScroll:!0})):n.pad?.type?.(t)&&t.preventDefault()),e.addEventListener(`beforeinput`,e=>{let{inputType:t,isComposing:a}=e,o=t===`deleteContentBackward`&&!r()?`backspace`:t===`insertLineBreak`||t===`insertParagraph`?`enter`:void 0;!a&&o&&(e.preventDefault(),i(),n.pad?.key?.(o))}),e.addEventListener(`input`,e=>!e.isComposing&&i()),e.addEventListener(`compositionend`,i),e.addEventListener(`paste`,e=>(e.preventDefault(),n.pad?.paste?.(e.clipboardData?.getData(`text/plain`)??``))),e.addEventListener(`focus`,()=>{let r=n.scroll.getBoundingClientRect();Object.assign(e.style,{left:`${r.left+12}px`,top:`${Math.min(r.bottom,innerHeight)-28}px`}),a=!0,t(),n.kb.setAttribute(`aria-pressed`,`true`),n.typing.hidden=!1,n.scroll.classList.add(`typing`,`engage`)}),e.addEventListener(`blur`,()=>(a=!1,n.kb.setAttribute(`aria-pressed`,`false`),n.typing.hidden=!0,n.scroll.classList.remove(`typing`,`engage`,`blip`),i())),n.scroll.addEventListener(`animationend`,e=>n.scroll.classList.remove(e.animationName===`term-engage`?`engage`:`blip`))}new ResizeObserver(()=>d(n)).observe(n.scroll),a.set(e,n),Object.assign(n,o.join(e,{rows:(e,t,r)=>(be(n.box,t),r&&d(n),n.first&&t.whole&&(n.first=!1,requestAnimationFrame(()=>n.scroll.scrollTop=n.scroll.scrollHeight))),state:()=>u(n),end:()=>n.end?.(),taken:()=>n.taken?.()}));let{conn:l}=n;return l.rows.length&&be(n.box,{key:e,rows:l.rows.length,set:l.rows.map((e,t)=>[t,e])}),l.phase!==`connecting`&&u(n),n.pad=r?.({key:e,name:t,state:l.state,post:l.post,stream:o.id,blip:()=>s(n.scroll,`blip`),taken:()=>o.taken(l)}),c(n),n.tile={id:`term:${e}`,title:I({name:t}),icon:`comms`,body:()=>i(`div`,{class:`term-tile`},i(`div`,{class:`term-bar`},n.state,n.typing,n.kb,n.fit),n.scroll,n.sink,n.pad?.el),closed:()=>(n.sink.blur(),n.stop(),a.delete(e))}};return{refresh:()=>a.forEach(e=>e.pad?.update()),open(t,n,r=!1){let i=a.get(t);i&&o.retry(i.conn),e.open(i?.tile??f(t,n),!0);let s=a.get(t);r&&s&&globalThis.matchMedia?.(`(pointer: fine)`).matches&&requestAnimationFrame(()=>s.sink.focus({preventScroll:!0}))},embed(e,t,n,{keys:r=!1,end:i,taken:s}={}){let c=a.get(e);c&&o.retry(c.conn);let l=c?.tile??f(e,t),u=a.get(e);return[u.end,u.taken]=[i,s],n.replaceChildren(l.body()),r&&globalThis.matchMedia?.(`(pointer: fine)`).matches&&requestAnimationFrame(()=>u.sink.focus({preventScroll:!0})),()=>(u.end=u.taken=void 0,l.closed?.(),n.replaceChildren())},watch(e,t,{rows:n,state:r,end:i,taken:a}){let s=o.join(e,{rows:n&&(e=>n(e)),state:r,end:i,taken:a});return{...s,retry:()=>o.retry(s.conn)}},id:o.id,hello:o.hello,frame:o.frame}}var Se=/(password|passphrase|passcode|\bpin\b|密碼|口令).{0,80}[::]$/i,Ce=e=>Z(e).map(e=>e.text).join(``).trimEnd(),we=(e,t)=>e.endsWith(t)&&(e.length===t.length||/[$#%>❯]\s+$/.test(e.slice(0,-t.length))),Te=(e,t)=>e.map(Ce).filter(e=>e&&!(t&&we(e,t))).slice(-4),Ee=e=>Se.test(e.map(Ce).findLast(Boolean)??``),Q={on:!1,hand:!1},De=(e,{secret:t,empty:n})=>e.hand?e:t?e.on?e:{on:!0,hand:!1}:e.on&&n?Q:e,Oe=e=>({on:!e.on,hand:!0});function ke(e){let t=e.kind===`pane`;return e.held?`held`:e.ended?t?`gone`:`ended`:e.sending?`sending`:e.confirm===void 0?e.refused||e.phase===`refused`?`refused`:e.phase===`live`?e.stale?`stale`:t&&Ee(e.rows)?`secret`:t&&e.after&&e.after.join(`
4
4
  `)!==Te(e.rows).join(`
@@ -1,4 +1,4 @@
1
- import{n as e}from"./towermodel-BIQTmR-P.js";import{t}from"./runtime-ZX6HkxDa.js";import{t as n}from"./sentencepack-DtYqpppS.js";import{Nt as r}from"./index-LCc1BzpW.js";var i=((e={},n={})=>(n.locale??t())===`zh-TW`?`現在連不上這台機器;連上之後才能回答。`:`This machine cannot be reached right now; answers wait until it can.`),a=((e={},n={})=>(n.locale??t())===`zh-TW`?`窗格已關閉。`:`The pane closed.`),ee=((e={},n={})=>(n.locale??t())===`zh-TW`?`session 已移到另一個窗格。`:`The session moved to another pane.`),te=((e={},n={})=>(n.locale??t())===`zh-TW`?`session 已不在這個窗格中即時執行。`:`The session is no longer live in this pane.`),o=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個窗格現在執行別的程式。`:`The pane runs something else now.`),s=((e={},n={})=>(n.locale??t())===`zh-TW`?`讀不到這個窗格。`:`The pane could not be read.`),c=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個頁面的串流沒有名稱;請重新載入頁面。`:`This page's stream has no name; reload the page.`),ne=((e={},n={})=>(n.locale??t())===`zh-TW`?`它在等機密或提問時,這裡只能送出 Esc;請在它的面板或終端機中回答。`:`While it waits on a secret or a question only Escape is sent from here; answer in its panel or the terminal.`),re=((e={},n={})=>(n.locale??t())===`zh-TW`?`上一個按鍵還在送出;請稍候。`:`Another key to this terminal is still on its way; wait a moment.`),ie=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個按鍵不從這裡送出:只送出按鍵板上的鍵、Delete,以及 Ctrl 或 Alt 組合鍵(絕不送 Ctrl+Z)。`:`That key is not sent from here: only pad keys, Delete, and Ctrl or Alt chords (never Ctrl+Z).`),l=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個 session 開著 /boss gui lan 畫面;配對裝置只能對它送出 Esc。`:`A /boss gui lan screen is open in this session; only Escape can be sent to it from a paired device.`),u=((e={},n={})=>(n.locale??t())===`zh-TW`?`它在等連結請求時,配對裝置只能送出 Esc;請在這台電腦自己的頁面或終端機核准。`:`While it waits on a link request, a paired device can only send Escape; approve it on this computer's own page or terminal.`),d=((e={},n={})=>(n.locale??t())===`zh-TW`?`pi 的取消排隊按鍵無法從這個頁面送出;請在終端機中按。`:`pi's dequeue key cannot be sent from this page; press it in the terminal.`),f=((e={},n={})=>(n.locale??t())===`zh-TW`?`只有在這個頁面即時顯示終端機時,才能送出按鍵;請重新開啟。`:`Keys are sent only while this page shows the terminal live; open it again.`),p=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個終端機已不在這裡開著。`:`That terminal is not open here any more.`),m=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個 session 已不在任何窗格中即時執行。`:`This session is no longer live in a pane.`),h=((e={},n={})=>(n.locale??t())===`zh-TW`?`機器上的 pi 把那個按鍵綁在編輯以外的動作,所以不從這裡送出;請在機器上按。`:`pi on the box binds that key to something other than editing, so it is not sent from here; press it on the box.`),g=((e={},n={})=>(n.locale??t())===`zh-TW`?`讀不到機器上的按鍵綁定,所以不從這裡送任何按鍵;請重試,或到機器上操作。`:`The box's key bindings could not be read, so no key is sent from here; try again, or use the box.`),_=((e={},n={})=>(n.locale??t())===`zh-TW`?`/boss 指令不會從這裡執行:它在機器上能碰到其他團隊的 session 和機器本身的設定。`:`A /boss command is not run from here: on the box it reaches other teams' sessions and the box's own settings.`),v=((e={},n={})=>(n.locale??t())===`zh-TW`?`那個組合鍵是 pi 在編輯器以外的動作;遠端連線只送編輯器自己的按鍵。`:`That chord is a pi action outside its editor; a remote session sends the editor's own keys only.`),y=((e={},n={})=>(n.locale??t())===`zh-TW`?`斜線指令不會從這裡執行:Enter 會套用指令選單上反白的選項,而這個頁面無法從草稿判斷是哪一個。`:`A slash command is not run from here: Enter would apply the command menu's highlighted choice, which this page cannot tell from the draft.`),b=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個 session 的編輯器裡已經有草稿,送出的文字會接在後面;請先清掉草稿,或在空的編輯器送出。`:`The session's editor already holds a draft and the text would join it; clear the draft first, or send from an empty editor.`),x=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個 session 已經結束,所以不送出任何內容。`:`The session ended, so nothing is sent to it.`),S=((e={},n={})=>(n.locale??t())===`zh-TW`?`Ctrl+M 等於略過編輯器檢查的 Enter;請改送 Enter。`:`Ctrl+M is Enter without the editor check; send Enter instead.`),C=((e={},n={})=>(n.locale??t())===`zh-TW`?`機器的終端機可能被 pi 以外的程式佔著(或機器無法確認),所以不從這裡送出任何內容。`:`Something other than pi may be holding the box's terminal (or the box cannot say), so nothing is sent from here.`),w=((e={},n={})=>(n.locale??t())===`zh-TW`?`一秒內第二次按 Ctrl+C 或 Esc 會離開 pi 的編輯器;請稍等一下。`:`A second Ctrl+C or Escape within a second would leave pi's editor; wait a moment.`),T=((e={},n={})=>(n.locale??t())===`zh-TW`?`這件事只能在機器本身的主控台操作。`:`That stays on the box's own console.`),E=((e={},n={})=>(n.locale??t())===`zh-TW`?`這部裝置不是擁有它的團隊的管理員。`:`This device is not an admin of the team that owns that.`),D=((e={},n={})=>(n.locale??t())===`zh-TW`?`這部裝置沒有這台機器的操作權限。`:`This device is not granted operate on this box.`),O=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個單位不在這條連線能碰到的範圍內。`:`That unit is not one this connection reaches.`),k=((e={},n={})=>(n.locale??t())===`zh-TW`?`這台機器的政策不允許遠端操作。`:`This box's policy does not allow operate.`),A=((e={},n={})=>(n.locale??t())===`zh-TW`?`這台機器不讓遠端連線做這件事;請在機器本身操作。`:`This box does not let a remote session do that (a shell line, a /boss command, or something it keeps for itself); do it on the box.`),j=((e={},n={})=>(n.locale??t())===`zh-TW`?`遠端連線不提供這個操作(例如開啟終端機窗格,或動到機器自己保管的東西);請在機器本身操作。`:`A remote session does not offer this (it would open a pane or reach something the box keeps for itself); do it on the box.`),M=((e={},n={})=>(n.locale??t())===`zh-TW`?`以 ! 開頭的 shell 指令不會從這裡執行:機器不接受透過連線傳來的任意 shell。`:`A shell line (starting with !) is not run from here: the box takes no arbitrary shell over the link.`),N=((e={},n={})=>(n.locale??t())===`zh-TW`?`機器上的 pi 目前沒有握著終端機(可能開著外部編輯器,或 pi 已暫停),或機器無法確認,所以不從這裡送出任何內容。`:`The box’s pi does not hold its terminal right now (an external editor or a suspended pi may), or the box cannot say, so nothing is sent from here.`),P=((e={},n={})=>(n.locale??t())===`zh-TW`?`機器讀不到這個 session 的編輯器狀態,無法確認 Enter 會執行什麼,所以不從這裡送出任何內容。`:`The box could not tell what Enter would run in this session's editor, so nothing is sent from here.`),F=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個窗格已關閉。`:`That pane has closed.`),I=((e={},n={})=>(n.locale??t())===`zh-TW`?`貼上的內容除換行與 Tab 外不能含控制字元,也不能太長。`:`A paste may not hold control characters other than line breaks and tabs, and may not be too long.`),L=((e={},n={})=>(n.locale??t())===`zh-TW`?`按鍵送得太快,請稍候。`:`Keys are coming too fast; wait a moment.`),R=((e={},n={})=>(n.locale??t())===`zh-TW`?`提示列裡已不是當初放進去的指令,所以沒有送出;請到終端機查看。`:`The prompt no longer holds the command that was put there, so nothing was sent. Read it in the terminal.`),z=((e={},n={})=>(n.locale??t())===`zh-TW`?`指令等太久,不能一鍵執行;再按一次「執行」確認。`:`The command waited too long to run in one tap; press Run again to confirm it.`),B=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個指令已經執行過,或不是這裡的回答放進提示列的;再按一次「執行」確認。`:`That command was already run, or no answer here put it in the prompt; press Run again to confirm it.`),V=((e={},n={})=>(n.locale??t())===`zh-TW`?`塔台待命中:沒有執行中的 run,所以沒有終端機。請在輸入框寫給它,就會喚醒它。`:`The tower is standing by: no run is live, so there is no terminal. Write to it in the composer to wake it.`),H=(e,t)=>n(`refuse_standing`,V,e,t),U=((e={},n={})=>(n.locale??t())===`zh-TW`?`輸入的文字須是一小段可列印字元,不能有換行、Tab 或控制鍵。`:`Typed text must be a short run of printable characters, without line breaks, tabs, or control keys.`),ae=((e={},n={})=>(n.locale??t())===`zh-TW`?`開著的終端機太多;請先關閉一個。`:`Too many terminals are open; close one first.`),W=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個伺服器連不上 Herdr。`:`This server cannot reach Herdr.`),G=((e={},n={})=>(n.locale??t())===`zh-TW`?`送出`:`Send`),K=((e={},n={})=>(n.locale??t())===`zh-TW`?`文字超過 16 KB,請縮短。`:`The text is longer than 16 KB; shorten it.`),q=((e={},n={})=>(n.locale??t())===`zh-TW`?`瀏覽器不能輸入控制字元。`:`Control characters cannot be typed from the browser.`),J=((e={},n={})=>(n.locale??t())===`zh-TW`?`指令不是對等待事項的回覆,請到塔台的對話裡輸入。`:`A command is not an answer to a wait; type it in the tower's comms.`),oe=(e,t)=>n(`tower_err_not_an_answer`,J,e,t),se=((e={},n={})=>(n.locale??t())===`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.`),ce=(e,t)=>n(`tower_err_server_queue`,se,e,t),le=((e={},n={})=>(n.locale??t())===`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.`),ue=(e,t)=>n(`tower_err_standing`,le,e,t),de=((e={},n={})=>(n.locale??t())===`zh-TW`?`塔台因反覆當機而暫停,沒有終端機。請重試,或在「通訊」裡寫給它。`:`The tower is held after repeated crashes, so it has no terminal. Retry it, or write to it in Comms.`),fe=(e,t)=>n(`tower_term_held`,de,e,t),pe=((e={},n={})=>(n.locale??t())===`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.`),me=(e,t)=>n(`tower_term_standing`,pe,e,t),he=`[the boss writes to you from the GUI or /boss tower; this is an instruction]`,ge=`[possibly handled by a run that crashed: check before acting]`,Y={no_mirror:f,blocked:ne,lan_overlay_open:l,local_only:u,rate:L,no_key:d,text:U,paste:I,key:ie,bad_request:c,not_live:m,unavailable:W,too_many:ae,standing:H,not_found:p,pane_closed:F,busy:re,run_unknown:B,run_expired:z,run_changed:R,operate_refused:A},X={binding:h,"binding-unread":g,foreground:C,terminal:N,unread:P,shell:M,"boss-command":_,command:y,draft:b,ended:x,route:j,"enter-chord":S,chord:v,"leaves-editor":w,"out-of-scope":O,"not-granted":D,"not-admin":E,"local-only":T,policy:k};Object.keys(X);var _e={"The session is no longer live in this pane.":te,"The pane runs something else now.":o,"The pane closed.":a,"The pane could not be read.":s,"The session moved to another pane.":ee};Object.keys(Y);var Z=(e,t)=>e?.({},t?{locale:t}:void 0),Q=(e,t)=>e.body.error===`operate_refused`&&typeof e.body.why==`string`&&Object.hasOwn(X,e.body.why)?Z(X[e.body.why],t):void 0,ve=(e,t)=>Q(e,t)??Z(Y[String(e.body.error)],t)??e.body.reason??r({status:e.status},t?{locale:t}:void 0),ye=(e,t)=>Z(_e[e],t)??e;function be(e){let t=(e??``).split(`
1
+ import{n as e}from"./towermodel-BIQTmR-P.js";import{t}from"./runtime-ZX6HkxDa.js";import{t as n}from"./sentencepack-DtYqpppS.js";import{Nt as r}from"./index-Dvw58cHb.js";var i=((e={},n={})=>(n.locale??t())===`zh-TW`?`現在連不上這台機器;連上之後才能回答。`:`This machine cannot be reached right now; answers wait until it can.`),a=((e={},n={})=>(n.locale??t())===`zh-TW`?`窗格已關閉。`:`The pane closed.`),ee=((e={},n={})=>(n.locale??t())===`zh-TW`?`session 已移到另一個窗格。`:`The session moved to another pane.`),te=((e={},n={})=>(n.locale??t())===`zh-TW`?`session 已不在這個窗格中即時執行。`:`The session is no longer live in this pane.`),o=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個窗格現在執行別的程式。`:`The pane runs something else now.`),s=((e={},n={})=>(n.locale??t())===`zh-TW`?`讀不到這個窗格。`:`The pane could not be read.`),c=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個頁面的串流沒有名稱;請重新載入頁面。`:`This page's stream has no name; reload the page.`),ne=((e={},n={})=>(n.locale??t())===`zh-TW`?`它在等機密或提問時,這裡只能送出 Esc;請在它的面板或終端機中回答。`:`While it waits on a secret or a question only Escape is sent from here; answer in its panel or the terminal.`),re=((e={},n={})=>(n.locale??t())===`zh-TW`?`上一個按鍵還在送出;請稍候。`:`Another key to this terminal is still on its way; wait a moment.`),ie=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個按鍵不從這裡送出:只送出按鍵板上的鍵、Delete,以及 Ctrl 或 Alt 組合鍵(絕不送 Ctrl+Z)。`:`That key is not sent from here: only pad keys, Delete, and Ctrl or Alt chords (never Ctrl+Z).`),l=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個 session 開著 /boss gui lan 畫面;配對裝置只能對它送出 Esc。`:`A /boss gui lan screen is open in this session; only Escape can be sent to it from a paired device.`),u=((e={},n={})=>(n.locale??t())===`zh-TW`?`它在等連結請求時,配對裝置只能送出 Esc;請在這台電腦自己的頁面或終端機核准。`:`While it waits on a link request, a paired device can only send Escape; approve it on this computer's own page or terminal.`),d=((e={},n={})=>(n.locale??t())===`zh-TW`?`pi 的取消排隊按鍵無法從這個頁面送出;請在終端機中按。`:`pi's dequeue key cannot be sent from this page; press it in the terminal.`),f=((e={},n={})=>(n.locale??t())===`zh-TW`?`只有在這個頁面即時顯示終端機時,才能送出按鍵;請重新開啟。`:`Keys are sent only while this page shows the terminal live; open it again.`),p=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個終端機已不在這裡開著。`:`That terminal is not open here any more.`),m=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個 session 已不在任何窗格中即時執行。`:`This session is no longer live in a pane.`),h=((e={},n={})=>(n.locale??t())===`zh-TW`?`機器上的 pi 把那個按鍵綁在編輯以外的動作,所以不從這裡送出;請在機器上按。`:`pi on the box binds that key to something other than editing, so it is not sent from here; press it on the box.`),g=((e={},n={})=>(n.locale??t())===`zh-TW`?`讀不到機器上的按鍵綁定,所以不從這裡送任何按鍵;請重試,或到機器上操作。`:`The box's key bindings could not be read, so no key is sent from here; try again, or use the box.`),_=((e={},n={})=>(n.locale??t())===`zh-TW`?`/boss 指令不會從這裡執行:它在機器上能碰到其他團隊的 session 和機器本身的設定。`:`A /boss command is not run from here: on the box it reaches other teams' sessions and the box's own settings.`),v=((e={},n={})=>(n.locale??t())===`zh-TW`?`那個組合鍵是 pi 在編輯器以外的動作;遠端連線只送編輯器自己的按鍵。`:`That chord is a pi action outside its editor; a remote session sends the editor's own keys only.`),y=((e={},n={})=>(n.locale??t())===`zh-TW`?`斜線指令不會從這裡執行:Enter 會套用指令選單上反白的選項,而這個頁面無法從草稿判斷是哪一個。`:`A slash command is not run from here: Enter would apply the command menu's highlighted choice, which this page cannot tell from the draft.`),b=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個 session 的編輯器裡已經有草稿,送出的文字會接在後面;請先清掉草稿,或在空的編輯器送出。`:`The session's editor already holds a draft and the text would join it; clear the draft first, or send from an empty editor.`),x=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個 session 已經結束,所以不送出任何內容。`:`The session ended, so nothing is sent to it.`),S=((e={},n={})=>(n.locale??t())===`zh-TW`?`Ctrl+M 等於略過編輯器檢查的 Enter;請改送 Enter。`:`Ctrl+M is Enter without the editor check; send Enter instead.`),C=((e={},n={})=>(n.locale??t())===`zh-TW`?`機器的終端機可能被 pi 以外的程式佔著(或機器無法確認),所以不從這裡送出任何內容。`:`Something other than pi may be holding the box's terminal (or the box cannot say), so nothing is sent from here.`),w=((e={},n={})=>(n.locale??t())===`zh-TW`?`一秒內第二次按 Ctrl+C 或 Esc 會離開 pi 的編輯器;請稍等一下。`:`A second Ctrl+C or Escape within a second would leave pi's editor; wait a moment.`),T=((e={},n={})=>(n.locale??t())===`zh-TW`?`這件事只能在機器本身的主控台操作。`:`That stays on the box's own console.`),E=((e={},n={})=>(n.locale??t())===`zh-TW`?`這部裝置不是擁有它的團隊的管理員。`:`This device is not an admin of the team that owns that.`),D=((e={},n={})=>(n.locale??t())===`zh-TW`?`這部裝置沒有這台機器的操作權限。`:`This device is not granted operate on this box.`),O=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個單位不在這條連線能碰到的範圍內。`:`That unit is not one this connection reaches.`),k=((e={},n={})=>(n.locale??t())===`zh-TW`?`這台機器的政策不允許遠端操作。`:`This box's policy does not allow operate.`),A=((e={},n={})=>(n.locale??t())===`zh-TW`?`這台機器不讓遠端連線做這件事;請在機器本身操作。`:`This box does not let a remote session do that (a shell line, a /boss command, or something it keeps for itself); do it on the box.`),j=((e={},n={})=>(n.locale??t())===`zh-TW`?`遠端連線不提供這個操作(例如開啟終端機窗格,或動到機器自己保管的東西);請在機器本身操作。`:`A remote session does not offer this (it would open a pane or reach something the box keeps for itself); do it on the box.`),M=((e={},n={})=>(n.locale??t())===`zh-TW`?`以 ! 開頭的 shell 指令不會從這裡執行:機器不接受透過連線傳來的任意 shell。`:`A shell line (starting with !) is not run from here: the box takes no arbitrary shell over the link.`),N=((e={},n={})=>(n.locale??t())===`zh-TW`?`機器上的 pi 目前沒有握著終端機(可能開著外部編輯器,或 pi 已暫停),或機器無法確認,所以不從這裡送出任何內容。`:`The box’s pi does not hold its terminal right now (an external editor or a suspended pi may), or the box cannot say, so nothing is sent from here.`),P=((e={},n={})=>(n.locale??t())===`zh-TW`?`機器讀不到這個 session 的編輯器狀態,無法確認 Enter 會執行什麼,所以不從這裡送出任何內容。`:`The box could not tell what Enter would run in this session's editor, so nothing is sent from here.`),F=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個窗格已關閉。`:`That pane has closed.`),I=((e={},n={})=>(n.locale??t())===`zh-TW`?`貼上的內容除換行與 Tab 外不能含控制字元,也不能太長。`:`A paste may not hold control characters other than line breaks and tabs, and may not be too long.`),L=((e={},n={})=>(n.locale??t())===`zh-TW`?`按鍵送得太快,請稍候。`:`Keys are coming too fast; wait a moment.`),R=((e={},n={})=>(n.locale??t())===`zh-TW`?`提示列裡已不是當初放進去的指令,所以沒有送出;請到終端機查看。`:`The prompt no longer holds the command that was put there, so nothing was sent. Read it in the terminal.`),z=((e={},n={})=>(n.locale??t())===`zh-TW`?`指令等太久,不能一鍵執行;再按一次「執行」確認。`:`The command waited too long to run in one tap; press Run again to confirm it.`),B=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個指令已經執行過,或不是這裡的回答放進提示列的;再按一次「執行」確認。`:`That command was already run, or no answer here put it in the prompt; press Run again to confirm it.`),V=((e={},n={})=>(n.locale??t())===`zh-TW`?`塔台待命中:沒有執行中的 run,所以沒有終端機。請在輸入框寫給它,就會喚醒它。`:`The tower is standing by: no run is live, so there is no terminal. Write to it in the composer to wake it.`),H=(e,t)=>n(`refuse_standing`,V,e,t),U=((e={},n={})=>(n.locale??t())===`zh-TW`?`輸入的文字須是一小段可列印字元,不能有換行、Tab 或控制鍵。`:`Typed text must be a short run of printable characters, without line breaks, tabs, or control keys.`),ae=((e={},n={})=>(n.locale??t())===`zh-TW`?`開著的終端機太多;請先關閉一個。`:`Too many terminals are open; close one first.`),W=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個伺服器連不上 Herdr。`:`This server cannot reach Herdr.`),G=((e={},n={})=>(n.locale??t())===`zh-TW`?`送出`:`Send`),K=((e={},n={})=>(n.locale??t())===`zh-TW`?`文字超過 16 KB,請縮短。`:`The text is longer than 16 KB; shorten it.`),q=((e={},n={})=>(n.locale??t())===`zh-TW`?`瀏覽器不能輸入控制字元。`:`Control characters cannot be typed from the browser.`),J=((e={},n={})=>(n.locale??t())===`zh-TW`?`指令不是對等待事項的回覆,請到塔台的對話裡輸入。`:`A command is not an answer to a wait; type it in the tower's comms.`),oe=(e,t)=>n(`tower_err_not_an_answer`,J,e,t),se=((e={},n={})=>(n.locale??t())===`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.`),ce=(e,t)=>n(`tower_err_server_queue`,se,e,t),le=((e={},n={})=>(n.locale??t())===`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.`),ue=(e,t)=>n(`tower_err_standing`,le,e,t),de=((e={},n={})=>(n.locale??t())===`zh-TW`?`塔台因反覆當機而暫停,沒有終端機。請重試,或在「通訊」裡寫給它。`:`The tower is held after repeated crashes, so it has no terminal. Retry it, or write to it in Comms.`),fe=(e,t)=>n(`tower_term_held`,de,e,t),pe=((e={},n={})=>(n.locale??t())===`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.`),me=(e,t)=>n(`tower_term_standing`,pe,e,t),he=`[the boss writes to you from the GUI or /boss tower; this is an instruction]`,ge=`[possibly handled by a run that crashed: check before acting]`,Y={no_mirror:f,blocked:ne,lan_overlay_open:l,local_only:u,rate:L,no_key:d,text:U,paste:I,key:ie,bad_request:c,not_live:m,unavailable:W,too_many:ae,standing:H,not_found:p,pane_closed:F,busy:re,run_unknown:B,run_expired:z,run_changed:R,operate_refused:A},X={binding:h,"binding-unread":g,foreground:C,terminal:N,unread:P,shell:M,"boss-command":_,command:y,draft:b,ended:x,route:j,"enter-chord":S,chord:v,"leaves-editor":w,"out-of-scope":O,"not-granted":D,"not-admin":E,"local-only":T,policy:k};Object.keys(X);var _e={"The session is no longer live in this pane.":te,"The pane runs something else now.":o,"The pane closed.":a,"The pane could not be read.":s,"The session moved to another pane.":ee};Object.keys(Y);var Z=(e,t)=>e?.({},t?{locale:t}:void 0),Q=(e,t)=>e.body.error===`operate_refused`&&typeof e.body.why==`string`&&Object.hasOwn(X,e.body.why)?Z(X[e.body.why],t):void 0,ve=(e,t)=>Q(e,t)??Z(Y[String(e.body.error)],t)??e.body.reason??r({status:e.status},t?{locale:t}:void 0),ye=(e,t)=>Z(_e[e],t)??e;function be(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 xe(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]===ge;return{body:t.slice(n?2:1).join(`
4
4
  `),crashed:n}}function Se(e){let t=(e??``).trim(),n=/^(.*?)\s*\(([^()]*)\)$/.exec(t);return n?{name:n[1],...n[2]?{id:n[2]}:{}}:{name:t}}function Ce(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 $={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 we(e){let t=e.text??``,n=e=>{let n=t.split(`
@@ -1 +1 @@
1
- import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sentencepack-DtYqpppS.js";import{Ct as n,Qt as r,un as i}from"./index-LCc1BzpW.js";var a=e=>`Accepted: ${e?.kinds}`,o=e=>`已驗收:${e?.kinds}`,s=((t,n={})=>(n.locale??e())===`zh-TW`?o(t):a(t)),c=((t={},n={})=>(n.locale??e())===`zh-TW`?`免驗收`:`No acceptance required`),l=((t={},n={})=>(n.locale??e())===`zh-TW`?`驗收不明`:`Acceptance unknown`),u=e=>`${e?.ticket}: not before ${e?.time}`,d=e=>`${e?.ticket}:${e?.time} 後才出車`,ee=((t,n={})=>(n.locale??e())===`zh-TW`?d(t):u(t)),te=e=>`${e?.ticket}: leaves alone`,ne=e=>`${e?.ticket}:單獨出車`,re=((t,n={})=>(n.locale??e())===`zh-TW`?ne(t):te(t)),ie=e=>`${e?.ticket}: leaves by ${e?.time}`,ae=e=>`${e?.ticket}:最晚 ${e?.time} 出車`,oe=((t,n={})=>(n.locale??e())===`zh-TW`?ae(t):ie(t)),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`被移出`:`dropped from the train`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`已落地`:`landed`),le=((t={},n={})=>(n.locale??e())===`zh-TW`?`已收件`:`received`),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`退回`:`returned`),de=e=>`${e?.ticket}: waits to ride with ${e?.other}`,fe=e=>`${e?.ticket}:等 ${e?.other} 同車`,pe=((t,n={})=>(n.locale??e())===`zh-TW`?fe(t):de(t)),me=e=>`Trains ${e?.count}`,he=e=>`火車 ${e?.count}`,ge=((t,n={})=>(n.locale??e())===`zh-TW`?he(t):me(t)),_e=e=>`Forming ${e?.count}`,ve=e=>`編組中 ${e?.count}`,ye=((t,n={})=>(n.locale??e())===`zh-TW`?ve(t):_e(t)),be=e=>`Trains stalled ${e?.count}`,xe=e=>`火車停滯 ${e?.count}`,Se=((t,n={})=>(n.locale??e())===`zh-TW`?xe(t):be(t)),Ce=e=>`Trains ${e?.count} (${e?.waiting} waiting)`,we=e=>`火車 ${e?.count}(等待 ${e?.waiting})`,Te=((t,n={})=>(n.locale??e())===`zh-TW`?we(t):Ce(t)),Ee=e=>`${e?.count} departing`,De=e=>`出發中 ${e?.count}`,Oe=((t,n={})=>(n.locale??e())===`zh-TW`?De(t):Ee(t)),ke=e=>`${e?.count} forming`,Ae=e=>`編組中 ${e?.count}`,f=((t,n={})=>(n.locale??e())===`zh-TW`?Ae(t):ke(t)),p=e=>`${e?.count} refused`,m=e=>`被拒絕 ${e?.count}`,h=((t,n={})=>(n.locale??e())===`zh-TW`?m(t):p(t)),g=e=>`${e?.count} unreadable`,_=e=>`讀不到 ${e?.count}`,v=((t,n={})=>(n.locale??e())===`zh-TW`?_(t):g(t)),y=e=>`${e?.trains} trains: ${e?.running} running, ${e?.waiting} waiting`,b=e=>`${e?.trains} 列火車:${e?.running} 運行、${e?.waiting} 等待`,x=((t,n={})=>(n.locale??e())===`zh-TW`?b(t):y(t)),S=e=>`${e?.trains} trains: ${e?.running} running, ${e?.waiting} waiting (waiting on each other: ${e?.mutual})`,C=e=>`${e?.trains} 列火車:${e?.running} 運行、${e?.waiting} 等待(互相等待 ${e?.mutual})`,je=((t,n={})=>(n.locale??e())===`zh-TW`?C(t):S(t)),Me=e=>`Leaves at ${e?.maxCars} cars or ${e?.maxWaitMin} min (time is up)`,Ne=e=>`滿 ${e?.maxCars} 節或 ${e?.maxWaitMin} 分(時間到)`,Pe=((t,n={})=>(n.locale??e())===`zh-TW`?Ne(t):Me(t)),Fe=e=>`Leaves at ${e?.maxCars} cars or ${e?.maxWaitMin} min (${e?.left} min left)`,Ie=e=>`滿 ${e?.maxCars} 節或 ${e?.maxWaitMin} 分(還 ${e?.left} 分)`,Le=((t,n={})=>(n.locale??e())===`zh-TW`?Ie(t):Fe(t)),Re=((t={},n={})=>(n.locale??e())===`zh-TW`?`出發中`:`Departing`),ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`編組中`:`Forming`),Be=e=>`${e?.kind}: closed`,Ve=e=>`${e?.kind}:已關閉`,He=((t,n={})=>(n.locale??e())===`zh-TW`?Ve(t):Be(t)),Ue=e=>`${e?.kind}: open its comms`,We=e=>`${e?.kind}:開啟它的對話`,Ge=((t,n={})=>(n.locale??e())===`zh-TW`?We(t):Ue(t)),Ke=e=>`${e?.kind}: changed kind`,qe=e=>`${e?.kind}:已換種類`,Je=((t,n={})=>(n.locale??e())===`zh-TW`?qe(t):Ke(t)),Ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`組裝`:`Assemble`),Xe=((t={},n={})=>(n.locale??e(),`CI/CD`)),Ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`部署`:`Deploy`),Qe=((t={},n={})=>(n.locale??e())===`zh-TW`?`部署驗證`:`Deploy verify`),$e=((t={},n={})=>(n.locale??e())===`zh-TW`?`全檢查`:`Full check`),et=((t={},n={})=>(n.locale??e())===`zh-TW`?`落地`:`Land`),tt=((t={},n={})=>(n.locale??e())===`zh-TW`?`合併`:`Merge`),nt=((t={},n={})=>(n.locale??e())===`zh-TW`?`審查`:`Review`),rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`回滾`:`Rollback`),it=e=>`Load ${e?.now} / ${e?.cores} cores`,at=e=>`負載 ${e?.now}/${e?.cores} 核`,ot=((t,n={})=>(n.locale??e())===`zh-TW`?at(t):it(t)),st=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個系統沒有負載讀數`:`This system gives no load reading`),ct=e=>`needs load ≤${e?.max}`,lt=e=>`需負載 ≤${e?.max}`,w=((t,n={})=>(n.locale??e())===`zh-TW`?lt(t):ct(t)),ut=e=>`needs load ≤${e?.perCore} per core`,dt=e=>`需負載 ≤每核 ${e?.perCore}`,ft=((t,n={})=>(n.locale??e())===`zh-TW`?dt(t):ut(t)),pt=e=>`about ${e?.weight} cores`,mt=e=>`約 ${e?.weight} 核`,ht=((t,n={})=>(n.locale??e())===`zh-TW`?mt(t):pt(t)),gt=e=>`${e?.kind}: ${e?.nod}`,_t=e=>`${e?.kind}:${e?.nod}`,vt=((t,n={})=>(n.locale??e())===`zh-TW`?_t(t):gt(t)),yt=e=>`${e?.kind}: no approval quoted`,bt=e=>`${e?.kind}:沒有留存核可的話`,xt=((t,n={})=>(n.locale??e())===`zh-TW`?bt(t):yt(t)),St=e=>`${e?.step}: ${e?.wait}`,Ct=e=>`${e?.step}:${e?.wait}`,wt=((t,n={})=>(n.locale??e())===`zh-TW`?Ct(t):St(t)),Tt=e=>`${e?.step}, running`,Et=e=>`${e?.step}(進行中)`,Dt=((t,n={})=>(n.locale??e())===`zh-TW`?Et(t):Tt(t)),Ot=e=>`Told ${e?.ticket}: ${e?.state}`,kt=e=>`已通知 ${e?.ticket}:${e?.state}`,At=((t,n={})=>(n.locale??e())===`zh-TW`?kt(t):Ot(t)),jt=e=>`Reported to the tower: the sender of ${e?.ticket} cannot be reached`,Mt=e=>`已上報塔台:${e?.ticket} 的送車者聯絡不上`,Nt=((t,n={})=>(n.locale??e())===`zh-TW`?Mt(t):jt(t)),Pt=(e,n)=>t(`yard_notice_escalated`,Nt,e,n),Ft=e=>`${e?.text} (from the saved file)`,It=e=>`${e?.text}(取自檔案紀錄)`,Lt=((t,n={})=>(n.locale??e())===`zh-TW`?It(t):Ft(t)),Rt=e=>`Last answer: ${e?.answer}`,zt=e=>`最後一次回覆:${e?.answer}`,Bt=((t,n={})=>(n.locale??e())===`zh-TW`?zt(t):Rt(t)),Vt=e=>`Telling ${e?.ticket}: ${e?.state} (try ${e?.attempts})`,Ht=e=>`通知中 ${e?.ticket}:${e?.state}(重試 ${e?.attempts})`,Ut=((t,n={})=>(n.locale??e())===`zh-TW`?Ht(t):Vt(t)),Wt=e=>`Telling ${e?.ticket}: ${e?.state}`,Gt=e=>`通知中 ${e?.ticket}:${e?.state}`,Kt=((t,n={})=>(n.locale??e())===`zh-TW`?Gt(t):Wt(t)),qt=e=>`Notice of ${e?.ticket} unreadable: ${e?.reason}`,Jt=e=>`讀不到 ${e?.ticket} 的通知紀錄:${e?.reason}`,Yt=((t,n={})=>(n.locale??e())===`zh-TW`?Jt(t):qt(t)),Xt=e=>`The yard could not be read: ${e?.problem}`,Zt=e=>`調車場讀不到:${e?.problem}`,T=((t,n={})=>(n.locale??e())===`zh-TW`?Zt(t):Xt(t)),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`被拒絕`:`Refused`),Qt=e=>`${e?.ticket} (${e?.why})`,$t=e=>`${e?.ticket}(${e?.why})`,D=((t,n={})=>(n.locale??e())===`zh-TW`?$t(t):Qt(t)),en=e=>`Round ${e?.round}`,tn=e=>`第 ${e?.round} 次組裝`,nn=((t,n={})=>(n.locale??e())===`zh-TW`?tn(t):en(t)),rn=e=>`Round ${e?.round}: removed ${e?.cars}`,an=e=>`第 ${e?.round} 次組裝:移除 ${e?.cars}`,on=((t,n={})=>(n.locale??e())===`zh-TW`?an(t):rn(t)),sn=((t={},n={})=>(n.locale??e())===`zh-TW`?`失敗`:`failed`),cn=((t={},n={})=>(n.locale??e())===`zh-TW`?`通過`:`passed`),ln=((t={},n={})=>(n.locale??e())===`zh-TW`?`未開始`:`not started`),un=((t={},n={})=>(n.locale??e())===`zh-TW`?`進行中`:`running`),dn=((t={},n={})=>(n.locale??e())===`zh-TW`?`略過`:`skipped`),fn=((t={},n={})=>(n.locale??e())===`zh-TW`?`作廢(被重組取代)`:`void (superseded)`),pn=((t={},n={})=>(n.locale??e())===`zh-TW`?`等待中`:`waiting`),mn=((t={},n={})=>(n.locale??e())===`zh-TW`?`,`:`, `),O=((t={},n={})=>(n.locale??e(),` · `)),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`、`:`, `),hn=e=>`${e?.count} stalled`,gn=e=>`停滯 ${e?.count}`,_n=((t,n={})=>(n.locale??e())===`zh-TW`?gn(t):hn(t)),vn=e=>`Unreadable: ${e?.reason}`,yn=e=>`讀不到:${e?.reason}`,bn=((t,n={})=>(n.locale??e())===`zh-TW`?yn(t):vn(t)),xn=e=>`${e?.kind}: ${e?.state}`,Sn=e=>`${e?.kind}:${e?.state}`,Cn=((t,n={})=>(n.locale??e())===`zh-TW`?Sn(t):xn(t)),wn=e=>`${e?.kind} · ${e?.name}`,Tn=e=>`${e?.kind} · ${e?.name}`,En=((t,n={})=>(n.locale??e())===`zh-TW`?Tn(t):wn(t)),Dn=e=>`${e?.count} earlier steps are not shown`,On=e=>`更早的 ${e?.count} 步沒有列出`,kn=((t,n={})=>(n.locale??e())===`zh-TW`?On(t):Dn(t)),An=e=>`Yard · ${e?.project}`,jn=e=>`調車場 · ${e?.project}`,Mn=((t,n={})=>(n.locale??e())===`zh-TW`?jn(t):An(t)),Nn=e=>`waiting for ${e?.holder}'s merge lane (${e?.app})`,Pn=e=>`等 ${e?.holder} 合併道(${e?.app})`,Fn=((t,n={})=>(n.locale??e())===`zh-TW`?Pn(t):Nn(t)),In=e=>`waiting for load ≤${e?.max} (now ${e?.now})`,Ln=e=>`等負載 ≤${e?.max}(現在 ${e?.now})`,Rn=((t,n={})=>(n.locale??e())===`zh-TW`?Ln(t):In(t)),zn=e=>`waiting for lock ${e?.name}`,Bn=e=>`等鎖 ${e?.name}`,Vn=((t,n={})=>(n.locale??e())===`zh-TW`?Bn(t):zn(t)),Hn=e=>`waiting for lock ${e?.name} (train ${e?.holder} holds it)`,Un=e=>`等鎖 ${e?.name}(train ${e?.holder} 持有)`,Wn=((t,n={})=>(n.locale??e())===`zh-TW`?Un(t):Hn(t)),Gn=e=>`${e?.wait} — it is stalled`,Kn=e=>`${e?.wait}(它已停滯)`,qn=((t,n={})=>(n.locale??e())===`zh-TW`?Kn(t):Gn(t)),Jn=e=>`waiting for ${e?.holder}'s deploy target (${e?.target})`,Yn=e=>`等 ${e?.holder} 部署目標(${e?.target})`,Xn=((t,n={})=>(n.locale??e())===`zh-TW`?Yn(t):Jn(t)),Zn=e=>`${e?.wait} — its board cannot be read`,Qn=e=>`${e?.wait}(它的看板讀不到)`,$n=((t,n={})=>(n.locale??e())===`zh-TW`?Qn(t):Zn(t)),er=((t={},n={})=>(n.locale??e())===`zh-TW`?`這次讀取的位元組額度用完了`:`this reading's byte budget is spent`),tr=((t={},n={})=>(n.locale??e())===`zh-TW`?`讀取時出錯`:`an error while reading it`),nr=((t={},n={})=>(n.locale??e())===`zh-TW`?`檔案讀取失敗`:`the file could not be read`),rr=((t={},n={})=>(n.locale??e())===`zh-TW`?`檔案屬於別處(代號、專案或檔名對不上)`:`the file belongs elsewhere (its code, project or name does not match)`),ir=((t={},n={})=>(n.locale??e())===`zh-TW`?`不是一般檔案(可能是連結)`:`not a regular file (it may be a link)`),ar=((t={},n={})=>(n.locale??e())===`zh-TW`?`內容不是有效的 JSON`:`its content is not valid JSON`),or=((t={},n={})=>(n.locale??e())===`zh-TW`?`格式不對`:`its shape is wrong`),sr=((t={},n={})=>(n.locale??e())===`zh-TW`?`檔案超過大小上限`:`the file is over the size limit`),cr=[`assemble`,`review`,`full-check`,`merge`,`ci`,`deploy`,`deploy-verify`,`rollback`,`land`],A=/^(\d{4})-(\d{2})-(\d{2})-([a-z]{1,2})$/,lr=(e,t,n)=>{let r=new Date(Date.UTC(e,t-1,n));return r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n},ur=e=>{let t=typeof e==`string`?A.exec(e):null;return!!t&&lr(Number(t[1]),Number(t[2]),Number(t[3]))};function dr(e){let t=ur(e)?A.exec(e):null;if(!t)throw Error(`sb: "${e}" is not a train code (YYYY-MM-DD-<letters>)`);return`${t[2]}${t[3]}${t[4]}`}`${cr.join(`, `)}`;var fr=6e4,j=e=>{try{return dr(e)}catch{return e}},M=e=>e.join(k()),N={assemble:Ye,review:nt,"full-check":$e,merge:tt,ci:Xe,deploy:Ze,"deploy-verify":Qe,rollback:rt,land:et},pr={pending:ln,running:un,waiting:pn,passed:cn,failed:sn,void:fn},mr={received:le,returned:ue,dropped:se,landed:ce},P=e=>e.status===`pending`?`pending`:e.status===`in_progress`?e.waits.length?`waiting`:`running`:e.outcome===`failed`?`failed`:e.outcome===`void`?`void`:`passed`,hr=e=>P(e)===`void`&&e.why===`skipped`?dn():pr[P(e)](),F=e=>e.replace(/-/g,`-⁠`);function I(e){if(`load`in e)return Rn({max:e.load.max,now:e.load.now});if(`lock`in e)return e.lock.holder?Wn({name:e.lock.name,holder:j(e.lock.holder.train)}):Vn({name:e.lock.name});let[t,n]=`lane`in e?[Fn({holder:j(e.lane.holder),app:F(e.lane.app)}),e.lane.why]:[Xn({holder:j(e.target.holder),target:F(e.target.target)}),e.target.why];return n===`stale`?qn({wait:t}):n===`unreadable`?$n({wait:t}):t}function L(e,t){if(!e)return``;let n=e=>Math.round(e*10)/10;return[e.max===void 0?e.perCore===void 0?``:t?w({max:n(e.perCore*t)}):ft({perCore:n(e.perCore)}):w({max:n(e.max)}),e.weight===void 0?``:ht({weight:n(e.weight)})].filter(Boolean).join(mn())}function R(e){let t=e.round??1;return e.removed?.length?on({round:t,cars:M(e.removed.map(e=>D({ticket:e.ticket,why:e.why})))}):nn({round:t})}var z={toobig:sr,budget:er,notfile:ir,notjson:ar,io:nr,misplaced:rr,shape:or,failed:tr},B=(e,t)=>t!==void 0&&Object.hasOwn(z,t)?{said:z[t](),title:e}:{said:e},gr=e=>e.toLowerCase()===`uat`?`UAT`:e;function V(e){if(e.unverified)return{text:l(),nods:[]};if(!e.accepted.length)return{text:c(),nods:[]};let t=e.accepted.map(e=>({kind:gr(e.kind),nod:e.nod}));return{text:s({kinds:M(t.map(e=>e.kind))}),nods:t.map(e=>e.nod?vt({kind:e.kind,nod:e.nod}):xt({kind:e.kind}))}}var H=e=>{let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString([],{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}):e};function U(e){let t=M(e.tickets);return e.departs.split(`,`).map(e=>e.trim()).filter(Boolean).flatMap(e=>{let[,n=``,r=``]=/^(\w+)\s*(.*)$/.exec(e)??[],i=n.toLowerCase();return i===`next`&&!r?[]:i===`alone`&&!r?[re({ticket:t})]:i===`with`&&r?[pe({ticket:t,other:r})]:i===`after`&&r?[ee({ticket:t,time:H(r)})]:i===`by`&&r?[oe({ticket:t,time:H(r)})]:[e]})}function W(e,t){let n=e.departs;if(!n)return;let r=Date.parse(n.oldest),i=Math.ceil(n.maxWaitMin-(Number.isFinite(r)?t-r:0)/fr);return i>0?Le({maxCars:n.maxCars,maxWaitMin:n.maxWaitMin,left:i}):Pe({maxCars:n.maxCars,maxWaitMin:n.maxWaitMin})}function G(e){let t=e.notice,n=M(e.tickets);if(!t)return;if(t.status===`unreadable`){let e=B(t.reason,t.kind);return{text:Yt({ticket:n,reason:e.said}),tone:`unreadable`,...e.title?{title:e.title}:{}}}let r=mr[t.state](),i=e=>t.journal?Lt({text:e}):e;return t.status===`delivered`?{text:i(At({ticket:n,state:r})),tone:`told`}:t.status===`escalated`?{text:i(Pt({ticket:n})),tone:`escalated`}:{text:i(t.attempts>0?Ut({ticket:n,state:r,attempts:t.attempts}):Kt({ticket:n,state:r})),tone:`pending`,...t.last?{detail:Bt({answer:t.last})}:{}}}var K=(e,t)=>{let n=G(e);return{tickets:M(e.tickets),accepted:V(e),conditions:t?U(e):[],...n?{notice:n}:{}}},q=e=>!e.name||e.name===e.kind||e.name===N[e.kind]()?N[e.kind]():En({kind:N[e.kind](),name:e.name}),J=e=>e.steps.filter(e=>e.status===`in_progress`).sort((e,t)=>e.id-t.id);function Y(e,t,n=()=>void 0){let r={short:j(e.code),app:e.app??``,...e.key?{key:e.key}:{}},i=n(e.key);if(e.state===`unreadable`){let t=B(e.reason??``,e.reasonKind);return{...r,status:`unreadable`,...i?{route:i}:{},reason:bn({reason:t.said}),...t.title?{reasonTitle:t.title}:{},round:``,tickets:[],pills:[],wait:``,need:``,cars:[],removed:[],removedNotices:[]}}let a=J(e),o=[...new Set(a.flatMap(e=>e.waits.map(I)))],s=a[0],c=a.find(e=>e.load&&e.waits.length)??a.find(e=>e.load),l=e.state===`stale`?`stale`:e.state===`ended`?`ended`:o.length?`waiting`:`running`,u=M(o),d=e.state===`live`&&s?u?wt({step:q(s),wait:u}):Dt({step:q(s)}):void 0;return{...r,status:l,...i?{route:i}:{},round:R(e),tickets:[...new Set(e.cars.flatMap(e=>e.tickets))],wait:u,need:L(c?.load,t.load?.cores),...d?{note:d}:{},pills:e.steps.map(e=>({id:e.id,text:q(e),title:Cn({kind:N[e.kind](),state:hr(e)}),state:P(e),round:e.round,current:e===s})),cars:e.cars.map(e=>K(e,!1)),removed:(e.removed??[]).map(e=>D({ticket:e.ticket,why:e.why})),removedNotices:(e.removed??[]).flatMap(e=>G({tickets:[e.ticket],...e.notice?{notice:e.notice}:{}})??[]),...e.stepsCut?{cut:kn({count:e.stepsCut})}:{}}}function X(e){let t=e.trains.filter(e=>e.state===`live`),n=t.filter(e=>J(e).some(e=>e.waits.length)).length,r=new Set(e.trains.map(e=>e.code));return{trains:t.length,running:t.length-n,waiting:n,mutual:e.waiting.filter(e=>r.has(e)).length,stale:e.trains.filter(e=>e.state===`stale`).length,forming:e.forming.filter(e=>e.status===`forming`).length,departing:e.forming.filter(e=>e.status===`departing`).length,refused:e.forming.filter(e=>e.status===`refused`).length,ended:e.trains.filter(e=>e.state===`ended`).length,unreadable:e.trains.filter(e=>e.state===`unreadable`).length}}var Z=e=>e.mutual?je({trains:e.trains,running:e.running,waiting:e.waiting,mutual:e.mutual}):x({trains:e.trains,running:e.running,waiting:e.waiting}),Q=e=>[e.stale&&_n({count:e.stale}),e.forming&&f({count:e.forming}),e.departing&&Oe({count:e.departing}),e.refused&&h({count:e.refused}),e.unreadable&&v({count:e.unreadable})].filter(Boolean).join(O()),_r=e=>e.trains?e.waiting?Te({count:e.trains,waiting:e.waiting}):ge({count:e.trains}):e.stale?Se({count:e.stale}):e.forming+e.departing?ye({count:e.forming+e.departing}):n(),$=e=>e?ot({now:e.now,cores:e.cores}):st(),vr=e=>e.reduce((e,t)=>Object.fromEntries(Object.keys(e).map(n=>[n,e[n]+t[n]])),{trains:0,running:0,waiting:0,mutual:0,stale:0,forming:0,departing:0,refused:0,ended:0,unreadable:0}),yr=(e,t)=>{let n=W(e,t.now);return{short:j(e.code),app:e.app,status:e.status,word:e.status===`forming`?ze():e.status===`departing`?Re():E(),...n?{condition:n}:{},cars:e.cars.map(e=>K(e,!0))}};function br(e,t,n){let i=X(e),a=e.trains.map(e=>Y(e,t,n)),o=a.filter(e=>e.status===`ended`).reverse(),s=n(e.integrator?.key),c=e.integrator?e.integrator.live&&e.integrator.key?{text:Ge({kind:r()}),...s?{route:s}:{}}:{text:e.integrator.switched?Je({kind:r()}):He({kind:r()})}:void 0,l=e.problem?B(e.problem,e.problemKind):void 0;return{project:e.project,title:Mn({project:e.project}),counts:i,head:Z(i),others:Q(i),load:$(t.load),...c?{integrator:c}:{},forming:e.forming.map(e=>yr(e,t)),trains:a.filter(e=>e.status!==`ended`),ended:o,...l?{problem:T({problem:l.said}),...l.title?{problemTitle:l.title}:{}}:{},empty:!e.forming.length&&!e.trains.length&&!e.problem}}function xr(e){let t={byBase:new Map,loose:[],integrators:new Map};if(!e.yards)return t;let n=new Map;for(let t of i(e))n.set(t.unit.key,t.base.id);for(let r of e.yards.projects){let e=r.integrator?.key,i=e&&n.has(e)?e:void 0;i&&t.integrators.set(i,r.project);let a=(i?n.get(i):void 0)??r.trains.map(e=>e.key?n.get(e.key):void 0).find(Boolean);a?t.byBase.set(a,[...t.byBase.get(a)??[],r.project]):t.loose.push(r.project)}return t}function Sr(e,t){let n=new Map;for(let r of e.yards?.projects??[])for(let e of r.trains){let r=e.key?Y(e,t):void 0;e.key&&r?.note&&n.set(e.key,r.note)}return n}function Cr(e){let t=new Set;for(let n of e.yards?.projects??[])for(let e of n.trains)e.key&&e.state===`live`&&J(e).some(e=>e.waits.length)&&t.add(e.key);return t}function wr(e){let t=(e?.yards?.projects??[]).map(X);return{count:t.reduce((e,t)=>e+t.trains,0),waiting:t.reduce((e,t)=>e+t.waiting,0)}}export{V as acceptedChip,_r as chipWords,U as conditionLines,X as countsOf,W as formingWords,Z as headWords,$ as loadWords,O as n,L as needWords,G as noticeLine,Q as othersWords,br as projectView,T as r,R as roundWords,P as stepState,vr as sumCounts,k as t,Sr as trainNotes,Y as trainView,Cr as trainWaits,I as waitWords,xr as yardMap,wr as zenTrains};
1
+ import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sentencepack-DtYqpppS.js";import{Ct as n,Qt as r,un as i}from"./index-Dvw58cHb.js";var a=e=>`Accepted: ${e?.kinds}`,o=e=>`已驗收:${e?.kinds}`,s=((t,n={})=>(n.locale??e())===`zh-TW`?o(t):a(t)),c=((t={},n={})=>(n.locale??e())===`zh-TW`?`免驗收`:`No acceptance required`),l=((t={},n={})=>(n.locale??e())===`zh-TW`?`驗收不明`:`Acceptance unknown`),u=e=>`${e?.ticket}: not before ${e?.time}`,d=e=>`${e?.ticket}:${e?.time} 後才出車`,ee=((t,n={})=>(n.locale??e())===`zh-TW`?d(t):u(t)),te=e=>`${e?.ticket}: leaves alone`,ne=e=>`${e?.ticket}:單獨出車`,re=((t,n={})=>(n.locale??e())===`zh-TW`?ne(t):te(t)),ie=e=>`${e?.ticket}: leaves by ${e?.time}`,ae=e=>`${e?.ticket}:最晚 ${e?.time} 出車`,oe=((t,n={})=>(n.locale??e())===`zh-TW`?ae(t):ie(t)),se=((t={},n={})=>(n.locale??e())===`zh-TW`?`被移出`:`dropped from the train`),ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`已落地`:`landed`),le=((t={},n={})=>(n.locale??e())===`zh-TW`?`已收件`:`received`),ue=((t={},n={})=>(n.locale??e())===`zh-TW`?`退回`:`returned`),de=e=>`${e?.ticket}: waits to ride with ${e?.other}`,fe=e=>`${e?.ticket}:等 ${e?.other} 同車`,pe=((t,n={})=>(n.locale??e())===`zh-TW`?fe(t):de(t)),me=e=>`Trains ${e?.count}`,he=e=>`火車 ${e?.count}`,ge=((t,n={})=>(n.locale??e())===`zh-TW`?he(t):me(t)),_e=e=>`Forming ${e?.count}`,ve=e=>`編組中 ${e?.count}`,ye=((t,n={})=>(n.locale??e())===`zh-TW`?ve(t):_e(t)),be=e=>`Trains stalled ${e?.count}`,xe=e=>`火車停滯 ${e?.count}`,Se=((t,n={})=>(n.locale??e())===`zh-TW`?xe(t):be(t)),Ce=e=>`Trains ${e?.count} (${e?.waiting} waiting)`,we=e=>`火車 ${e?.count}(等待 ${e?.waiting})`,Te=((t,n={})=>(n.locale??e())===`zh-TW`?we(t):Ce(t)),Ee=e=>`${e?.count} departing`,De=e=>`出發中 ${e?.count}`,Oe=((t,n={})=>(n.locale??e())===`zh-TW`?De(t):Ee(t)),ke=e=>`${e?.count} forming`,Ae=e=>`編組中 ${e?.count}`,f=((t,n={})=>(n.locale??e())===`zh-TW`?Ae(t):ke(t)),p=e=>`${e?.count} refused`,m=e=>`被拒絕 ${e?.count}`,h=((t,n={})=>(n.locale??e())===`zh-TW`?m(t):p(t)),g=e=>`${e?.count} unreadable`,_=e=>`讀不到 ${e?.count}`,v=((t,n={})=>(n.locale??e())===`zh-TW`?_(t):g(t)),y=e=>`${e?.trains} trains: ${e?.running} running, ${e?.waiting} waiting`,b=e=>`${e?.trains} 列火車:${e?.running} 運行、${e?.waiting} 等待`,x=((t,n={})=>(n.locale??e())===`zh-TW`?b(t):y(t)),S=e=>`${e?.trains} trains: ${e?.running} running, ${e?.waiting} waiting (waiting on each other: ${e?.mutual})`,C=e=>`${e?.trains} 列火車:${e?.running} 運行、${e?.waiting} 等待(互相等待 ${e?.mutual})`,je=((t,n={})=>(n.locale??e())===`zh-TW`?C(t):S(t)),Me=e=>`Leaves at ${e?.maxCars} cars or ${e?.maxWaitMin} min (time is up)`,Ne=e=>`滿 ${e?.maxCars} 節或 ${e?.maxWaitMin} 分(時間到)`,Pe=((t,n={})=>(n.locale??e())===`zh-TW`?Ne(t):Me(t)),Fe=e=>`Leaves at ${e?.maxCars} cars or ${e?.maxWaitMin} min (${e?.left} min left)`,Ie=e=>`滿 ${e?.maxCars} 節或 ${e?.maxWaitMin} 分(還 ${e?.left} 分)`,Le=((t,n={})=>(n.locale??e())===`zh-TW`?Ie(t):Fe(t)),Re=((t={},n={})=>(n.locale??e())===`zh-TW`?`出發中`:`Departing`),ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`編組中`:`Forming`),Be=e=>`${e?.kind}: closed`,Ve=e=>`${e?.kind}:已關閉`,He=((t,n={})=>(n.locale??e())===`zh-TW`?Ve(t):Be(t)),Ue=e=>`${e?.kind}: open its comms`,We=e=>`${e?.kind}:開啟它的對話`,Ge=((t,n={})=>(n.locale??e())===`zh-TW`?We(t):Ue(t)),Ke=e=>`${e?.kind}: changed kind`,qe=e=>`${e?.kind}:已換種類`,Je=((t,n={})=>(n.locale??e())===`zh-TW`?qe(t):Ke(t)),Ye=((t={},n={})=>(n.locale??e())===`zh-TW`?`組裝`:`Assemble`),Xe=((t={},n={})=>(n.locale??e(),`CI/CD`)),Ze=((t={},n={})=>(n.locale??e())===`zh-TW`?`部署`:`Deploy`),Qe=((t={},n={})=>(n.locale??e())===`zh-TW`?`部署驗證`:`Deploy verify`),$e=((t={},n={})=>(n.locale??e())===`zh-TW`?`全檢查`:`Full check`),et=((t={},n={})=>(n.locale??e())===`zh-TW`?`落地`:`Land`),tt=((t={},n={})=>(n.locale??e())===`zh-TW`?`合併`:`Merge`),nt=((t={},n={})=>(n.locale??e())===`zh-TW`?`審查`:`Review`),rt=((t={},n={})=>(n.locale??e())===`zh-TW`?`回滾`:`Rollback`),it=e=>`Load ${e?.now} / ${e?.cores} cores`,at=e=>`負載 ${e?.now}/${e?.cores} 核`,ot=((t,n={})=>(n.locale??e())===`zh-TW`?at(t):it(t)),st=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個系統沒有負載讀數`:`This system gives no load reading`),ct=e=>`needs load ≤${e?.max}`,lt=e=>`需負載 ≤${e?.max}`,w=((t,n={})=>(n.locale??e())===`zh-TW`?lt(t):ct(t)),ut=e=>`needs load ≤${e?.perCore} per core`,dt=e=>`需負載 ≤每核 ${e?.perCore}`,ft=((t,n={})=>(n.locale??e())===`zh-TW`?dt(t):ut(t)),pt=e=>`about ${e?.weight} cores`,mt=e=>`約 ${e?.weight} 核`,ht=((t,n={})=>(n.locale??e())===`zh-TW`?mt(t):pt(t)),gt=e=>`${e?.kind}: ${e?.nod}`,_t=e=>`${e?.kind}:${e?.nod}`,vt=((t,n={})=>(n.locale??e())===`zh-TW`?_t(t):gt(t)),yt=e=>`${e?.kind}: no approval quoted`,bt=e=>`${e?.kind}:沒有留存核可的話`,xt=((t,n={})=>(n.locale??e())===`zh-TW`?bt(t):yt(t)),St=e=>`${e?.step}: ${e?.wait}`,Ct=e=>`${e?.step}:${e?.wait}`,wt=((t,n={})=>(n.locale??e())===`zh-TW`?Ct(t):St(t)),Tt=e=>`${e?.step}, running`,Et=e=>`${e?.step}(進行中)`,Dt=((t,n={})=>(n.locale??e())===`zh-TW`?Et(t):Tt(t)),Ot=e=>`Told ${e?.ticket}: ${e?.state}`,kt=e=>`已通知 ${e?.ticket}:${e?.state}`,At=((t,n={})=>(n.locale??e())===`zh-TW`?kt(t):Ot(t)),jt=e=>`Reported to the tower: the sender of ${e?.ticket} cannot be reached`,Mt=e=>`已上報塔台:${e?.ticket} 的送車者聯絡不上`,Nt=((t,n={})=>(n.locale??e())===`zh-TW`?Mt(t):jt(t)),Pt=(e,n)=>t(`yard_notice_escalated`,Nt,e,n),Ft=e=>`${e?.text} (from the saved file)`,It=e=>`${e?.text}(取自檔案紀錄)`,Lt=((t,n={})=>(n.locale??e())===`zh-TW`?It(t):Ft(t)),Rt=e=>`Last answer: ${e?.answer}`,zt=e=>`最後一次回覆:${e?.answer}`,Bt=((t,n={})=>(n.locale??e())===`zh-TW`?zt(t):Rt(t)),Vt=e=>`Telling ${e?.ticket}: ${e?.state} (try ${e?.attempts})`,Ht=e=>`通知中 ${e?.ticket}:${e?.state}(重試 ${e?.attempts})`,Ut=((t,n={})=>(n.locale??e())===`zh-TW`?Ht(t):Vt(t)),Wt=e=>`Telling ${e?.ticket}: ${e?.state}`,Gt=e=>`通知中 ${e?.ticket}:${e?.state}`,Kt=((t,n={})=>(n.locale??e())===`zh-TW`?Gt(t):Wt(t)),qt=e=>`Notice of ${e?.ticket} unreadable: ${e?.reason}`,Jt=e=>`讀不到 ${e?.ticket} 的通知紀錄:${e?.reason}`,Yt=((t,n={})=>(n.locale??e())===`zh-TW`?Jt(t):qt(t)),Xt=e=>`The yard could not be read: ${e?.problem}`,Zt=e=>`調車場讀不到:${e?.problem}`,T=((t,n={})=>(n.locale??e())===`zh-TW`?Zt(t):Xt(t)),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`被拒絕`:`Refused`),Qt=e=>`${e?.ticket} (${e?.why})`,$t=e=>`${e?.ticket}(${e?.why})`,D=((t,n={})=>(n.locale??e())===`zh-TW`?$t(t):Qt(t)),en=e=>`Round ${e?.round}`,tn=e=>`第 ${e?.round} 次組裝`,nn=((t,n={})=>(n.locale??e())===`zh-TW`?tn(t):en(t)),rn=e=>`Round ${e?.round}: removed ${e?.cars}`,an=e=>`第 ${e?.round} 次組裝:移除 ${e?.cars}`,on=((t,n={})=>(n.locale??e())===`zh-TW`?an(t):rn(t)),sn=((t={},n={})=>(n.locale??e())===`zh-TW`?`失敗`:`failed`),cn=((t={},n={})=>(n.locale??e())===`zh-TW`?`通過`:`passed`),ln=((t={},n={})=>(n.locale??e())===`zh-TW`?`未開始`:`not started`),un=((t={},n={})=>(n.locale??e())===`zh-TW`?`進行中`:`running`),dn=((t={},n={})=>(n.locale??e())===`zh-TW`?`略過`:`skipped`),fn=((t={},n={})=>(n.locale??e())===`zh-TW`?`作廢(被重組取代)`:`void (superseded)`),pn=((t={},n={})=>(n.locale??e())===`zh-TW`?`等待中`:`waiting`),mn=((t={},n={})=>(n.locale??e())===`zh-TW`?`,`:`, `),O=((t={},n={})=>(n.locale??e(),` · `)),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`、`:`, `),hn=e=>`${e?.count} stalled`,gn=e=>`停滯 ${e?.count}`,_n=((t,n={})=>(n.locale??e())===`zh-TW`?gn(t):hn(t)),vn=e=>`Unreadable: ${e?.reason}`,yn=e=>`讀不到:${e?.reason}`,bn=((t,n={})=>(n.locale??e())===`zh-TW`?yn(t):vn(t)),xn=e=>`${e?.kind}: ${e?.state}`,Sn=e=>`${e?.kind}:${e?.state}`,Cn=((t,n={})=>(n.locale??e())===`zh-TW`?Sn(t):xn(t)),wn=e=>`${e?.kind} · ${e?.name}`,Tn=e=>`${e?.kind} · ${e?.name}`,En=((t,n={})=>(n.locale??e())===`zh-TW`?Tn(t):wn(t)),Dn=e=>`${e?.count} earlier steps are not shown`,On=e=>`更早的 ${e?.count} 步沒有列出`,kn=((t,n={})=>(n.locale??e())===`zh-TW`?On(t):Dn(t)),An=e=>`Yard · ${e?.project}`,jn=e=>`調車場 · ${e?.project}`,Mn=((t,n={})=>(n.locale??e())===`zh-TW`?jn(t):An(t)),Nn=e=>`waiting for ${e?.holder}'s merge lane (${e?.app})`,Pn=e=>`等 ${e?.holder} 合併道(${e?.app})`,Fn=((t,n={})=>(n.locale??e())===`zh-TW`?Pn(t):Nn(t)),In=e=>`waiting for load ≤${e?.max} (now ${e?.now})`,Ln=e=>`等負載 ≤${e?.max}(現在 ${e?.now})`,Rn=((t,n={})=>(n.locale??e())===`zh-TW`?Ln(t):In(t)),zn=e=>`waiting for lock ${e?.name}`,Bn=e=>`等鎖 ${e?.name}`,Vn=((t,n={})=>(n.locale??e())===`zh-TW`?Bn(t):zn(t)),Hn=e=>`waiting for lock ${e?.name} (train ${e?.holder} holds it)`,Un=e=>`等鎖 ${e?.name}(train ${e?.holder} 持有)`,Wn=((t,n={})=>(n.locale??e())===`zh-TW`?Un(t):Hn(t)),Gn=e=>`${e?.wait} — it is stalled`,Kn=e=>`${e?.wait}(它已停滯)`,qn=((t,n={})=>(n.locale??e())===`zh-TW`?Kn(t):Gn(t)),Jn=e=>`waiting for ${e?.holder}'s deploy target (${e?.target})`,Yn=e=>`等 ${e?.holder} 部署目標(${e?.target})`,Xn=((t,n={})=>(n.locale??e())===`zh-TW`?Yn(t):Jn(t)),Zn=e=>`${e?.wait} — its board cannot be read`,Qn=e=>`${e?.wait}(它的看板讀不到)`,$n=((t,n={})=>(n.locale??e())===`zh-TW`?Qn(t):Zn(t)),er=((t={},n={})=>(n.locale??e())===`zh-TW`?`這次讀取的位元組額度用完了`:`this reading's byte budget is spent`),tr=((t={},n={})=>(n.locale??e())===`zh-TW`?`讀取時出錯`:`an error while reading it`),nr=((t={},n={})=>(n.locale??e())===`zh-TW`?`檔案讀取失敗`:`the file could not be read`),rr=((t={},n={})=>(n.locale??e())===`zh-TW`?`檔案屬於別處(代號、專案或檔名對不上)`:`the file belongs elsewhere (its code, project or name does not match)`),ir=((t={},n={})=>(n.locale??e())===`zh-TW`?`不是一般檔案(可能是連結)`:`not a regular file (it may be a link)`),ar=((t={},n={})=>(n.locale??e())===`zh-TW`?`內容不是有效的 JSON`:`its content is not valid JSON`),or=((t={},n={})=>(n.locale??e())===`zh-TW`?`格式不對`:`its shape is wrong`),sr=((t={},n={})=>(n.locale??e())===`zh-TW`?`檔案超過大小上限`:`the file is over the size limit`),cr=[`assemble`,`review`,`full-check`,`merge`,`ci`,`deploy`,`deploy-verify`,`rollback`,`land`],A=/^(\d{4})-(\d{2})-(\d{2})-([a-z]{1,2})$/,lr=(e,t,n)=>{let r=new Date(Date.UTC(e,t-1,n));return r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n},ur=e=>{let t=typeof e==`string`?A.exec(e):null;return!!t&&lr(Number(t[1]),Number(t[2]),Number(t[3]))};function dr(e){let t=ur(e)?A.exec(e):null;if(!t)throw Error(`sb: "${e}" is not a train code (YYYY-MM-DD-<letters>)`);return`${t[2]}${t[3]}${t[4]}`}`${cr.join(`, `)}`;var fr=6e4,j=e=>{try{return dr(e)}catch{return e}},M=e=>e.join(k()),N={assemble:Ye,review:nt,"full-check":$e,merge:tt,ci:Xe,deploy:Ze,"deploy-verify":Qe,rollback:rt,land:et},pr={pending:ln,running:un,waiting:pn,passed:cn,failed:sn,void:fn},mr={received:le,returned:ue,dropped:se,landed:ce},P=e=>e.status===`pending`?`pending`:e.status===`in_progress`?e.waits.length?`waiting`:`running`:e.outcome===`failed`?`failed`:e.outcome===`void`?`void`:`passed`,hr=e=>P(e)===`void`&&e.why===`skipped`?dn():pr[P(e)](),F=e=>e.replace(/-/g,`-⁠`);function I(e){if(`load`in e)return Rn({max:e.load.max,now:e.load.now});if(`lock`in e)return e.lock.holder?Wn({name:e.lock.name,holder:j(e.lock.holder.train)}):Vn({name:e.lock.name});let[t,n]=`lane`in e?[Fn({holder:j(e.lane.holder),app:F(e.lane.app)}),e.lane.why]:[Xn({holder:j(e.target.holder),target:F(e.target.target)}),e.target.why];return n===`stale`?qn({wait:t}):n===`unreadable`?$n({wait:t}):t}function L(e,t){if(!e)return``;let n=e=>Math.round(e*10)/10;return[e.max===void 0?e.perCore===void 0?``:t?w({max:n(e.perCore*t)}):ft({perCore:n(e.perCore)}):w({max:n(e.max)}),e.weight===void 0?``:ht({weight:n(e.weight)})].filter(Boolean).join(mn())}function R(e){let t=e.round??1;return e.removed?.length?on({round:t,cars:M(e.removed.map(e=>D({ticket:e.ticket,why:e.why})))}):nn({round:t})}var z={toobig:sr,budget:er,notfile:ir,notjson:ar,io:nr,misplaced:rr,shape:or,failed:tr},B=(e,t)=>t!==void 0&&Object.hasOwn(z,t)?{said:z[t](),title:e}:{said:e},gr=e=>e.toLowerCase()===`uat`?`UAT`:e;function V(e){if(e.unverified)return{text:l(),nods:[]};if(!e.accepted.length)return{text:c(),nods:[]};let t=e.accepted.map(e=>({kind:gr(e.kind),nod:e.nod}));return{text:s({kinds:M(t.map(e=>e.kind))}),nods:t.map(e=>e.nod?vt({kind:e.kind,nod:e.nod}):xt({kind:e.kind}))}}var H=e=>{let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString([],{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}):e};function U(e){let t=M(e.tickets);return e.departs.split(`,`).map(e=>e.trim()).filter(Boolean).flatMap(e=>{let[,n=``,r=``]=/^(\w+)\s*(.*)$/.exec(e)??[],i=n.toLowerCase();return i===`next`&&!r?[]:i===`alone`&&!r?[re({ticket:t})]:i===`with`&&r?[pe({ticket:t,other:r})]:i===`after`&&r?[ee({ticket:t,time:H(r)})]:i===`by`&&r?[oe({ticket:t,time:H(r)})]:[e]})}function W(e,t){let n=e.departs;if(!n)return;let r=Date.parse(n.oldest),i=Math.ceil(n.maxWaitMin-(Number.isFinite(r)?t-r:0)/fr);return i>0?Le({maxCars:n.maxCars,maxWaitMin:n.maxWaitMin,left:i}):Pe({maxCars:n.maxCars,maxWaitMin:n.maxWaitMin})}function G(e){let t=e.notice,n=M(e.tickets);if(!t)return;if(t.status===`unreadable`){let e=B(t.reason,t.kind);return{text:Yt({ticket:n,reason:e.said}),tone:`unreadable`,...e.title?{title:e.title}:{}}}let r=mr[t.state](),i=e=>t.journal?Lt({text:e}):e;return t.status===`delivered`?{text:i(At({ticket:n,state:r})),tone:`told`}:t.status===`escalated`?{text:i(Pt({ticket:n})),tone:`escalated`}:{text:i(t.attempts>0?Ut({ticket:n,state:r,attempts:t.attempts}):Kt({ticket:n,state:r})),tone:`pending`,...t.last?{detail:Bt({answer:t.last})}:{}}}var K=(e,t)=>{let n=G(e);return{tickets:M(e.tickets),accepted:V(e),conditions:t?U(e):[],...n?{notice:n}:{}}},q=e=>!e.name||e.name===e.kind||e.name===N[e.kind]()?N[e.kind]():En({kind:N[e.kind](),name:e.name}),J=e=>e.steps.filter(e=>e.status===`in_progress`).sort((e,t)=>e.id-t.id);function Y(e,t,n=()=>void 0){let r={short:j(e.code),app:e.app??``,...e.key?{key:e.key}:{}},i=n(e.key);if(e.state===`unreadable`){let t=B(e.reason??``,e.reasonKind);return{...r,status:`unreadable`,...i?{route:i}:{},reason:bn({reason:t.said}),...t.title?{reasonTitle:t.title}:{},round:``,tickets:[],pills:[],wait:``,need:``,cars:[],removed:[],removedNotices:[]}}let a=J(e),o=[...new Set(a.flatMap(e=>e.waits.map(I)))],s=a[0],c=a.find(e=>e.load&&e.waits.length)??a.find(e=>e.load),l=e.state===`stale`?`stale`:e.state===`ended`?`ended`:o.length?`waiting`:`running`,u=M(o),d=e.state===`live`&&s?u?wt({step:q(s),wait:u}):Dt({step:q(s)}):void 0;return{...r,status:l,...i?{route:i}:{},round:R(e),tickets:[...new Set(e.cars.flatMap(e=>e.tickets))],wait:u,need:L(c?.load,t.load?.cores),...d?{note:d}:{},pills:e.steps.map(e=>({id:e.id,text:q(e),title:Cn({kind:N[e.kind](),state:hr(e)}),state:P(e),round:e.round,current:e===s})),cars:e.cars.map(e=>K(e,!1)),removed:(e.removed??[]).map(e=>D({ticket:e.ticket,why:e.why})),removedNotices:(e.removed??[]).flatMap(e=>G({tickets:[e.ticket],...e.notice?{notice:e.notice}:{}})??[]),...e.stepsCut?{cut:kn({count:e.stepsCut})}:{}}}function X(e){let t=e.trains.filter(e=>e.state===`live`),n=t.filter(e=>J(e).some(e=>e.waits.length)).length,r=new Set(e.trains.map(e=>e.code));return{trains:t.length,running:t.length-n,waiting:n,mutual:e.waiting.filter(e=>r.has(e)).length,stale:e.trains.filter(e=>e.state===`stale`).length,forming:e.forming.filter(e=>e.status===`forming`).length,departing:e.forming.filter(e=>e.status===`departing`).length,refused:e.forming.filter(e=>e.status===`refused`).length,ended:e.trains.filter(e=>e.state===`ended`).length,unreadable:e.trains.filter(e=>e.state===`unreadable`).length}}var Z=e=>e.mutual?je({trains:e.trains,running:e.running,waiting:e.waiting,mutual:e.mutual}):x({trains:e.trains,running:e.running,waiting:e.waiting}),Q=e=>[e.stale&&_n({count:e.stale}),e.forming&&f({count:e.forming}),e.departing&&Oe({count:e.departing}),e.refused&&h({count:e.refused}),e.unreadable&&v({count:e.unreadable})].filter(Boolean).join(O()),_r=e=>e.trains?e.waiting?Te({count:e.trains,waiting:e.waiting}):ge({count:e.trains}):e.stale?Se({count:e.stale}):e.forming+e.departing?ye({count:e.forming+e.departing}):n(),$=e=>e?ot({now:e.now,cores:e.cores}):st(),vr=e=>e.reduce((e,t)=>Object.fromEntries(Object.keys(e).map(n=>[n,e[n]+t[n]])),{trains:0,running:0,waiting:0,mutual:0,stale:0,forming:0,departing:0,refused:0,ended:0,unreadable:0}),yr=(e,t)=>{let n=W(e,t.now);return{short:j(e.code),app:e.app,status:e.status,word:e.status===`forming`?ze():e.status===`departing`?Re():E(),...n?{condition:n}:{},cars:e.cars.map(e=>K(e,!0))}};function br(e,t,n){let i=X(e),a=e.trains.map(e=>Y(e,t,n)),o=a.filter(e=>e.status===`ended`).reverse(),s=n(e.integrator?.key),c=e.integrator?e.integrator.live&&e.integrator.key?{text:Ge({kind:r()}),...s?{route:s}:{}}:{text:e.integrator.switched?Je({kind:r()}):He({kind:r()})}:void 0,l=e.problem?B(e.problem,e.problemKind):void 0;return{project:e.project,title:Mn({project:e.project}),counts:i,head:Z(i),others:Q(i),load:$(t.load),...c?{integrator:c}:{},forming:e.forming.map(e=>yr(e,t)),trains:a.filter(e=>e.status!==`ended`),ended:o,...l?{problem:T({problem:l.said}),...l.title?{problemTitle:l.title}:{}}:{},empty:!e.forming.length&&!e.trains.length&&!e.problem}}function xr(e){let t={byBase:new Map,loose:[],integrators:new Map};if(!e.yards)return t;let n=new Map;for(let t of i(e))n.set(t.unit.key,t.base.id);for(let r of e.yards.projects){let e=r.integrator?.key,i=e&&n.has(e)?e:void 0;i&&t.integrators.set(i,r.project);let a=(i?n.get(i):void 0)??r.trains.map(e=>e.key?n.get(e.key):void 0).find(Boolean);a?t.byBase.set(a,[...t.byBase.get(a)??[],r.project]):t.loose.push(r.project)}return t}function Sr(e,t){let n=new Map;for(let r of e.yards?.projects??[])for(let e of r.trains){let r=e.key?Y(e,t):void 0;e.key&&r?.note&&n.set(e.key,r.note)}return n}function Cr(e){let t=new Set;for(let n of e.yards?.projects??[])for(let e of n.trains)e.key&&e.state===`live`&&J(e).some(e=>e.waits.length)&&t.add(e.key);return t}function wr(e){let t=(e?.yards?.projects??[]).map(X);return{count:t.reduce((e,t)=>e+t.trains,0),waiting:t.reduce((e,t)=>e+t.waiting,0)}}export{V as acceptedChip,_r as chipWords,U as conditionLines,X as countsOf,W as formingWords,Z as headWords,$ as loadWords,O as n,L as needWords,G as noticeLine,Q as othersWords,br as projectView,T as r,R as roundWords,P as stepState,vr as sumCounts,k as t,Sr as trainNotes,Y as trainView,Cr as trainWaits,I as waitWords,xr as yardMap,wr as zenTrains};